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 'OnMODXInit': | |
| if(strpos($_SERVER['REQUEST_URI'], '/index.php') === 0){ | |
| $modx->sendRedirect($modx->getOption("base_url", null, '/'), array( | |
| 'responseCode' => 'HTTP/1.1 301 Moved Permanently' | |
| )); | |
| return; | |
| } |
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 | |
| print '<pre>'; | |
| class parserXPath extends DOMXPath { | |
| private function getPage($url){ | |
| $ch = curl_init(); | |
| curl_setopt ($ch , CURLOPT_URL , $url); | |
| curl_setopt ($ch , CURLOPT_USERAGENT , "Mozilla/5.0"); | |
| curl_setopt ($ch , CURLOPT_RETURNTRANSFER , 1 ); | |
| // можете добавить кучу других опций |
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 | |
| //*************************************************** | |
| //ModxSitecore/processors/web/public/action.class.php | |
| //Добавить: | |
| //*************************************************** | |
| case 'forms/callback': | |
| require_once dirname(dirname(__FILE__)) . '/forms/callback.class.php'; | |
| self::$actualClassName = "modWebFormsCallbackProcessor"; | |
| break; | |
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 | |
| /** | |
| * ========================= | |
| * ChangeTemplate | |
| * ========================= | |
| * | |
| * Plugin for MODX Revolution | |
| * Set which template is inherited by children | |
| * documents of a certain parent document | |
| * |
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
| [[pdoResources? | |
| &tpl=`showList` | |
| &includeTVs=`number,image` | |
| &limit=`10` | |
| &prepareTVs=`number` | |
| &where=`{"number:>=":"010","number:<=":"100"}` | |
| ]] | |
| [[!pdoPage? | |
| &limit=`5` |
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 'index.php'; | |
| $modx->getService('error', 'error.modError'); | |
| $modx->setLogLevel(modX::LOG_LEVEL_ERROR); | |
| $modx->setLogTarget('ECHO'); | |
| if (!XPDO_CLI_MODE) { | |
| echo '<pre>'; | |
| } |
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 | |
| $text = 'Ìàðèíà'; | |
| $text = iconv("utf-8", "windows-1252", $text); | |
| $text = iconv("windows-1251", "utf-8", $text); | |
| echo $text; |
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 | |
| $csvData = file_get_contents($fileName); | |
| $lines = explode(PHP_EOL, $csvData); | |
| $array = array(); | |
| foreach ($lines as $line) { | |
| $array[] = str_getcsv($line); | |
| } | |
| print_r($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 | |
| //Apply ace editor to TV with id 5 and 7 | |
| $tvs = array( | |
| array( | |
| 'id' => 5, | |
| 'height' => '600px', | |
| 'mimeType' => 'application/json' | |
| ), | |
| array( | |
| 'id' => 7, |
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
| {'!pdoPage' | snippet : [ | |
| 'select' => [ | |
| 'galItem' => '*', | |
| 'Tag' => 'tag,item', | |
| ], | |
| 'ajaxMode' => 'button', | |
| 'tpl' => 'InstagramRowTpl', | |
| 'limit' => 3, | |
| 'class' => 'galItem', | |
| 'sortby' => 'id', |