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 | |
// Add RTE for introtext if richtext option is enabled for the resource | |
// check "OnDocFormRender" event | |
$modx->regClientStartupHTMLBlock('<script>Ext.onReady(function() { | |
if(MODx.loadRTE) MODx.loadRTE("modx-resource-introtext"); | |
});</script>'); |
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 | |
// get user-defined source document and target parents | |
$source = intval($modx->getOption('sourceId', $scriptProperties, '')); | |
$targets = array_map('trim', explode(',', $modx->getOption('targetIds', $scriptProperties, ''))); | |
// to prevent accidents... | |
$_allowedUsers = explode(',', 'username1,username2'); | |
// check stuff, and if passed then get the source document object | |
if ( !in_array($modx->user->get('username'), $_allowedUsers) || empty($source) || $source == 0 || !is_array($targets) || empty($targets) ) return; | |
$sourceDoc = $modx->getObject('modResource', $source); |
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 | |
/** | |
* Created by Andrey Stepanenko. | |
* User: webnitros | |
* Date: 24.01.2019 | |
* Time: 1:00 | |
*/ | |
ini_set('display_errors', 1); | |
ini_set("max_execution_time", 50); | |
define('MODX_API_MODE', true); |
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->event->name == 'OnDocFormRender' && $mode == modSystemEvent::MODE_NEW ) { | |
$template = $modx->runSnippet( 'pdoField', array( | |
"id" => $_REQUEST['parent'] | |
, "field" => "template" | |
, "top" => 0 | |
) ); | |
switch ( $template ) { | |
case 1: | |
$template = 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 | |
/* | |
0346745008178 | |
Should fail - checksum should be 9 | |
5060096384137 | |
Should pass | |
5020650002112 |
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 | |
/** | |
* Plugin to add a "created by" field on a resource form and moves "published on" to document tab | |
* | |
* @var modX $modx | |
* @var array $scriptProperties | |
* | |
* @event OnDocFormPrerender | |
*/ | |
$dateFormat = $modx->getOption('manager_date_format',null,'d.m.Y'); |
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 | |
/** | |
* 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() { | |