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 | |
| /* | |
| * Converts CSV to JSON | |
| * Example uses Google Spreadsheet CSV feed | |
| * csvToArray function I think I found on php.net | |
| */ | |
| header('Content-type: application/json'); | |
| // Set your CSV feed |
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 | |
| // First we require the xml2json file of course. | |
| require_once($modx->getOption('core_path').'components/simplx/common/xml2json.php'); | |
| // xml2json simply takes a String containing XML contents as input. | |
| // Remember that the preprocessor always get a parameter called $dataSet | |
| // containing the complete dataSet recieved from the dataSourceUrl or the | |
| // dataSet Snippet parameter. |
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 | |
| // Request URL | |
| $url = 'http://www.google.com/'; | |
| // HTTP headers | |
| $headers = array( | |
| //'Content-Type: application/json', | |
| //'Accept: application/json', | |
| ); |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta name="description" content=""> | |
| <meta name="author" content=""> | |
| <title></title> |
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
| $(function() { | |
| var t = $('#thetable tbody').eq(0); | |
| var r = t.find('tr'); | |
| var cols= r.length; | |
| var rows= r.eq(0).find('td').length; | |
| var cell, next, tem, i = 0; | |
| var tb= $('<tbody></tbody>'); | |
| while(i<rows){ | |
| cell= 0; |
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 | |
| $mailto = (isset($mailto)) ? $mailto : '@@ DEFAULT EMAIL HERE @@'; | |
| $warningMail = '@@ EMAIL TO SEND WARNING TO IN CASE OF A SMALL BACKUP FILE @@'; | |
| include MODX_CORE_PATH.'/config/'.MODX_CONFIG_KEY.'.inc.php'; | |
| $host = $database_server; // database host | |
| $dbuser = $database_user; // database user name | |
| $dbpswd = $database_password; // database password | |
| $mysqldb = $dbase; // name of database |
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 | |
| /* | |
| Update resource fields when they are saved | |
| trigger on the following system events: | |
| OnBeforeDocFormSave | |
| OnDocFormSave | |
| note: changing / inserting tv values is better done onDocFormSave as the process for saving tvs onBeforeDocFormSave is much more complicated (apparently) |
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
| Snippet: [[SnippetName]] | |
| Chunk: [[$ChunkName]] | |
| System Setting: [[++SettingName]] | |
| TV: [[*fieldName/TvName]] | |
| Link tag: [[~PageId? ¶mName=`value`]] | |
| Placeholder: [[+PlaceholderName]] | |
| <?php |
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
| // Scenario: Some event handler is blocking events (event.preventDefault()) that shouldn't be blocked, i.e. because it binds to document instead of a more specific element | |
| // 1) Place this before all other JavaScript | |
| var originalPreventDefault = Event.prototype.preventDefault; | |
| Event.prototype.preventDefault = function () { | |
| // Lookup specific event you're expecting, i.e. pressing space | |
| if (this instanceof KeyboardEvent && this.keyCode === 32) { | |
| // This will log an error with full stack trace | |
| make_error_to_see_stacktrace |
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->context->get('key') != "mgr"){ | |
| /* grab the current langauge from the cultureKey request var */ | |
| switch ($_REQUEST['cultureKey']) { | |
| case 'en': | |
| /* switch the context */ | |
| $modx->switchContext('en'); | |
| break; | |
| default: | |
| /* Set the default context here */ |