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 | |
$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 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 | |
require_once '/absolute_path/config.core.php'; | |
require_once MODX_CORE_PATH.'model/modx.class.php'; | |
$modx = new modX(); | |
$modx->initialize('web'); | |
$modx->getService('error','error.modError'); | |
//To get Base Path | |
$basePath = $modx->config['base_path']; | |
// Prepare the data |
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 (!$modx->user->hasSessionContext($modx->context->get('key')) return ''; | |
$userArray = $modx->user->toArray(); | |
$profile = $modx->user->getOne('Profile'); | |
if ($profile) { | |
$userArray = array_merge($profile->toArray(),$userArray); | |
$extended = $profile->get('extended'); | |
if (!empty($extended) && is_array($extended)) { |
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 | |
$debug = $modx->getOption('debug', $scriptProperties, false); | |
if ($debug) { | |
$modx->setLogLevel(modX::LOG_LEVEL_DEBUG); | |
} | |
//new user object | |
$user = $modx->newObject('modUser'); | |
//get all form fields | |
$formFields = $hook->getValues(); |
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 | |
$docArray = $modx->getCollection('modResource'); | |
foreach($docArray as $doc) { | |
$doc->joinGroup('GroupName'); | |
} |
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 | |
/** | |
* This is a MODX snippet to add "new" or "Updated" images to menu, | |
* pages and such. | |
* You need to provide your own new.gif and updated.gif file. change the | |
* file path to the images files accordingly. | |
* if called without input parameter then it will look at the page resource and | |
* determine if the page is newly published or updated. | |
* if called with input=`resourceID` then it will look into that resource ID. | |
* This snippet can be also used with getResoruces or Wayfinder. |
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 ($debug) { | |
$modx->setLogLevel(modx::LOG_LEVEL_DEBUG); | |
$mtime = microtime(); | |
$mtime = explode(" ", $mtime); | |
$mtime = $mtime[1] + $mtime[0]; | |
$tstart = $mtime; | |
} |
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 | |
/*** GetTemplate ***/ | |
include MODX_CORE_PATH . 'custom/templates/' . $modx->resource->template . '.html'; | |
return; | |
/*** Include ***/ | |
$chunk = $modx->getOption('chunk', $scriptProperties, false); |
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 | |
$doodle = $modx->getService('doodles','Doodles',$modx->getOption('doodles.core_path',null,$modx->getOption('core_path').'components/doodles/').'model/doodles/'); | |
if (!($doodle instanceof Doodles)) { | |
$hook->addError('error_message','Unable to load doodle service.'); | |
return false; | |
}; | |
$newEntry = $modx->newObject('Doodle'); | |
$newEntry->fromArray($scriptProperties['fields']); |