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
<style> | |
.clearImageTV + .x-panel.modx-panel.x-panel-noborder{ | |
margin-left: 30px; | |
margin-top: -34px; | |
} | |
</style> | |
<div id="tvbrowser{$tv->id}"></div> | |
<div id="tv-image-{$tv->id}"><a class="clearImageTV" href="#" onclick="javascript:Ext.getCmp('tvbrowser{$tv->id}').setValue('');document.getElementById('tv{$tv->id}').value='';document.getElementById('tv-image-preview-{$tv->id}').getElementsByTagName('img')[0].remove();"><i class="icon icon-2x icon-trash-o"></i></i></a></div> |
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(!function_exists(autoRotateImage)) { | |
function autoRotateImage($image) { | |
$orientation = $image->getImageOrientation(); | |
switch($orientation) { | |
case imagick::ORIENTATION_BOTTOMRIGHT: | |
$image->rotateimage("#000", 180); // rotate 180 degrees | |
break; | |
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 | |
/** | |
* Sample plugin to add a "created by" field on a resource form | |
* | |
* @var modX $modx | |
* @var array $scriptProperties | |
* | |
* @event OnDocFormPrerender | |
*/ |
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
Collections.renderer.imageplus = function(value, metaData, record, rowIndex, colIndex, store) { | |
if (value != '' && value != null) { | |
var data = Ext.decode(value); | |
var url = MODx.config.connectors_url + 'system/phpthumb.php?imageplus=1'; | |
var params = {}; | |
params.src = MODx.config['collections.renderer_image_path'] + data.sourceImg.src; | |
params.w = 100; | |
if (data.sourceImg.src.indexOf('.png') !== -1) { | |
params.f = 'png'; |
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 | |
include 'config.core.php'; | |
include MODX_CORE_PATH . 'model/modx/modx.class.php'; | |
$modx = new modX(); | |
$modx->initialize('web'); | |
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML'); | |
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO); | |
$tstart = $modx->getMicroTime(); |
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 | |
/** | |
* Use the cbGetFieldContent snippet to get the content of a particular field. | |
* | |
* For example, this can be useful if you need to get a bit of content | |
* in a getResources call | |
* | |
* Example usage: | |
* | |
* [[cbGetFieldContent? |
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
/** | |
* A* (A-Star) Pathfinding Algorithm in JavaScript | |
* @author Matthew Trost | |
* @license Creative Commons Attribution-ShareAlike 3.0 Unported License | |
* @datepublished December 2010 | |
*/ | |
function astar (map, heuristic, cutCorners) { | |
var listOpen = []; | |
var listClosed = []; |
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>'); |