This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Что сделать: | |
| Сохранить файл как backup.php в корне сайта. | |
| В строке | |
| const BACKUP_KEY = 'CHANGE_THIS_TO_LONG_RANDOM_STRING'; | |
| поставить длинный случайный ключ. | |
| Открыть в браузере: | |
| https://ваш-сайт/backup.php?key=ВАШ_КЛЮЧ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $db = $modx->getManager()->xpdo->pdo; | |
| // Получаем список таблиц | |
| $tables = $db->query("SHOW TABLES LIKE 'mt_%'")->fetchAll(PDO::FETCH_COLUMN); | |
| foreach ($tables as $table) { | |
| $new_table = str_replace('mt_', 'lr_', $table); | |
| $sql = "RENAME TABLE `$table` TO `$new_table`"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| *плагин для переключения контекстов | |
| */ | |
| // Работаем только на фронте | |
| if ($modx->event->name != 'OnHandleRequest' || $modx->context->key == 'mgr') {return;} | |
| // Определяем запрашиваемый хост | |
| $host = $_SERVER['HTTP_HOST']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html lang="ru"> | |
| <head> | |
| <meta name="robots" content="noindex"> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| <title>[[*pagetitle]]</title> | |
| <style type="text/css"> | |
| *{font-family: DejaVu Sans} | |
| [[+toPDF:is=`1`:then=`*{font-family: DejaVu Sans;font-size:13px}small{font-size:8px}body { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| switch ($modx->event->name){ | |
| case 'msOnBeforeAddToCart': | |
| if (!is_array($options)) $options = json_decode($options, true); | |
| //$modx->log(modX::LOG_LEVEL_ERROR, print_r($cart->get(), true)); | |
| //$modx->log(modX::LOG_LEVEL_ERROR, print_r($product->toArray(), true)); | |
| if(isset($options['size-price']) && !empty($options['size-price'])){ | |
| $tvr = $modx->getObject('modTemplateVarResource', array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $db_server = "localhost"; // hostname MySQL server | |
| $db_username = "cl723w"; // username MySQL server | |
| $db_password = "Wwe"; // password MySQL server | |
| $db_name = "cl7"; // database name | |
| $pattern = "a_"; // search string | |
| $new_pattern = "b_"; // replacement string, | |
| // can be empty | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Get full parsed HTML from resource | |
| * (you already need to have the resource object available in $this->resource) | |
| * | |
| * @access public | |
| * @return string $html The parsed html of the resource | |
| */ | |
| public function parseResource() { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| switch ($modx->event->name) { | |
| case 'OnLoadWebDocument': | |
| // id ресурса | |
| $id = $modx->resource->get('id'); | |
| // объект ресурса | |
| $doc = $modx->resource; | |
| // текущий контекст | |
| $mgrCtx = $modx->context->get('key'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define('MODX_API_MODE', true); | |
| require_once(dirname(__FILE__).'/index.php'); | |
| // Включаем обработку ошибок | |
| $modx->getService('error','error.modError'); | |
| $modx->setLogLevel(modX::LOG_LEVEL_ERROR); | |
| $modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML'); | |
| $modx->error->message = null; // Обнуляем переменную | |
| $parent = 15; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $ress = $modx->getIterator('msProduct', ['class_key' => 'msProduct']); | |
| foreach($ress as $res){ | |
| $introtext = $res->get('introtext'); | |
| if($introtext){ | |
| $introtext = preg_replace('/\?\s{0,}-Хранение/iu', '🏰-Хранение', $introtext ); | |
| $introtext = preg_replace('/\?-<\/span><\/span>Хранение/iu', '🏰-</span></span>Хранение', $introtext ); | |
| $introtext = preg_replace('/\?\s{0,}️-Развал/iu', '🛠️-Развал', $introtext ); | |
| $introtext = preg_replace('/\?- Доставка по/iu', '🚀- Доставка по', $introtext ); |
NewerOlder