This file contains 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 | |
/* runFn Snippet | |
* by info@pepebe.de | |
* | |
* Pass the snippet a php function name and pipe delimited list of parameters. | |
* | |
* Example: Format a large number with number_format() | |
* See: www.php.net/manual/en/function.number-format.php | |
* | |
* [[!runFn? &fn=`number_format` &args=`123456789||2||,||.`]] |
This file contains 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 | |
/* LangRouter | |
* ========== | |
* | |
* This plugin is meant to be used with Babel extra for MODX Revolution. It | |
* takes care of switching contexts, which hold translations, depending on URL | |
* requested by client. LangRouter works with so called subfolder based setup, | |
* in which many languages are served under a single domain but are | |
* differentiated by a virtual subfolder indicating the language, eg. | |
* mydomain.com/pl/. |
This file contains 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 | |
// Requires an Template ID | |
if (empty($id)) | |
return ''; | |
else | |
{//Get the Template | |
$parent = $modx->getObject('modTemplate', $id); | |
// Must be a valid Template ID | |
if (empty($parent)) | |
return ''; |
This file contains 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 | |
/* | |
* A small MODX snippet to extract POST, GET, SESSION & COOKIE values - (c) 2012 ackwa.fr | |
* | |
* @version : 1.0.1 | |
* @see : https://gist.github.com/gists/2853625 | |
* | |
* @usage : [[!argv?key=`myparam`&default=`1`]] -> return the value | |
* [[!argv?key=`myparam`&default=`1`&toph=`1`]] -> set [[+argv.myparam]] | |
* [[!argv?key=`myparam`&from=`GP`]] -> return the value from GET or POST |
This file contains 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 | |
/* | |
* A small MODX snippet to time other snippets - (c) 2012 ackwa.fr | |
* | |
* @see : https://gist.github.com/gists/3169775 | |
* @name : now.php | |
* @author : g.noel@ackwa.fr | |
* @usage : [[!now]] -> First call | |
* [[!now?seed=`1`]] -> subsequent calls | |
* |
This file contains 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
/* Android stock browser won't let you set font-size smaller than 8px unless you apply this. */ | |
:root { | |
-webkit-text-size-adjust: none; | |
-moz-text-size-adjust: none; | |
-ms-text-size-adjust: none; | |
-o-text-size-adjust: none; | |
text-size-adjust: none; | |
} |
This file contains 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
/** | |
Usage (the label is required) | |
<input id="uid" type="checkbox" ... /><label for="uid">Label</label> | |
Produces styled checkboxes in IE9+, current Firefox and Chrome | |
Demo here: http://jsfiddle.net/7Fggq/ | |
@author Bryan Elliott <ook@codemonkeybryan.com> | |
*/ |
This file contains 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 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( !isset($modx) ) { | |
/*Test the realpath by just starting with /../ and keep adding till you get where you're going*/ | |
$modx_base_path = realpath(dirname(__FILE__) . '/../../../../../'); | |
define('MODX_BASE_PATH', $modx_base_path.'/' ); | |
$old_dir = getcwd(); | |
chdir(MODX_BASE_PATH); | |
require MODX_BASE_PATH . 'manager/includes/config.inc.php'; |
This file contains 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-s | |
RewriteRule ^(.*)$ rest/index.php?_rest=$1 [QSA,NC,L] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^(.*)$ rest/index.php [QSA,NC,L] | |
</IfModule> |