Skip to content

Instantly share code, notes, and snippets.

@patrickatwsrn
patrickatwsrn / xpdo-where
Created October 11, 2023 20:49 — forked from davidpede/xpdo-where
pdoResources where examples
&where=`{ "template:IN" : [ 1,2,3 ] }
&where=`{ "template:NOT IN" : [ 1,2,3 ] }
&where=`[{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}]`
@patrickatwsrn
patrickatwsrn / gist:2c174a724a76f1c209109074531abe5b
Created May 13, 2022 07:15 — forked from mythicallage/gist:4514994
MODx Revo snippet. This a snippet is generator a list of possible values ​​from a list of existing values by ​​tv name.
<?php
/*[[newGetTvList? &tvname=`articlestags`]]
* Аналогично:
*@EVAL return $modx->runSnippet('GetTvList',array('tvname'=>'articlestags'));
*
*
*Убирает все пробелы, заменяет ','=>'||'
*Сниппет получает все значения ТВ по tv.name и формирует в список возможных значений
*для tv Множественный выбор, Одиночный выбор.
*/
@patrickatwsrn
patrickatwsrn / MODX plugn. Save Chunks and Snippets to the external files MODX Revolution Plugin that saves all your Chunks and Snippets to the external files (in category folders) right in the Root directory. Save the plugin, go to "System Events", check "On Manager Cache Update", Refresh cache from Dashboard, Disable Plugin.
<?php
$chunks = $modx->getCollection('modChunk');
$snippets = $modx->getCollection('modSnippet');
foreach ($chunks as $chunk) {
$content = $chunk->getContent();
$category = "SELECT category FROM `modx_categories` WHERE id = " . $chunk->get('category') . "";
@patrickatwsrn
patrickatwsrn / result.js
Created May 4, 2022 16:21 — forked from larscwallin/result.js
XPDO to simple ExtJS 3 Stores
var SimplxStudio = {};
SimplxStudio.modx = {};
/* Creating JSON representation for modAccess */
SimplxStudio.modx.modAccess={
"class": "modAccess",
"extends":"xPDOSimpleObject",
"fields": [
"id","alias","target","principal_class","principal","authority","policy"
@patrickatwsrn
patrickatwsrn / WebHook.php
Created November 27, 2021 19:27 — forked from bwente/WebHook.php
Very basic webhook for MODX, posts JSON to a URL. Works well with Zapier.
<?php
// [[!WebHook? &secret=`dh730>soteW` &runsnippet=`updateSettings` &params=`setting=savings`]]
$mySecret = $modx->getOption('secret', $scriptProperties);
$mySnippet = $modx->getOption('runsnippet', $scriptProperties);
$myParams = $modx->getOption('params', $scriptProperties);
$achunks = array_chunk(preg_split('/(=|,)/', $myParams), 2);
$myParams = array_combine(array_column($achunks, 0), array_column($achunks, 1));
$webhookContent = "";
@patrickatwsrn
patrickatwsrn / curl.with.cookie.php
Created November 15, 2021 14:27 — forked from nazt/curl.with.cookie.php
curl.with.cookie.php
01-autoResizeOnUpload.php - Plugin to automatically resize images uploaded via MODX that are larger than the dimensions specified
in the config within the plugin code. This should be considered experimental but has been tested
successfully on MODX Revolution 2.3.2-pl (traditional) running on Windows Server 2008.
02-set-expires-headers.php - Sets expires headers to value defined in plugin