Skip to content

Instantly share code, notes, and snippets.

@opengeek
opengeek / recalculateURIs.php
Created April 13, 2011 14:47
Script to recalculate all unfrozen URI values for MODX Resources in 2.1.x+
<?php
include 'config.core.php';
include MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->initialize('mgr');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
var win = Ti.UI.createWindow({backgroundColor:'#ccc'});
var isRunning = false;
var btn = Ti.UI.createButton({
title:'start',
bottom:10,
height:50,
left:10,
right:10
});
var slider = Ti.UI.createSlider({
@Mark-H
Mark-H / disabletooltips.plugin.php
Last active March 1, 2016 22:15
Plugin to disable tooltips in MODX globally.
<?php
// Disables tooltips globally.
//
// Create a new plugin and add the following system event: OnManagerPageInit
//
// © 2010 Mark Hamstra <hello@markhamstra.com>
// Buy me a beer? Paypal hamstra.mark at gmail.com.
//
// Licensed under the MIT license
@larscwallin
larscwallin / visioncart.getorders.php
Created June 16, 2011 10:49
visioncart.getorders
<?php
$query = $modx->newQuery('vcOrder');
$query->where(array(
'shopid' => $shopid
));
$query->sortby($sortBy, $sortOrder);
@bfncs
bfncs / defaultTemplateByParentTv.plugin.php
Created December 13, 2011 23:55
Default Children Template by Parent TV - modX Revolution Plugin
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
@fomigo
fomigo / defaultTemplateByParentTv.plugin.php
Created April 9, 2012 15:37 — forked from bfncs/defaultTemplateByParentTv.plugin.php
Default Children Template by Parent TV - modX Revolution Plugin
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
@terryjbates
terryjbates / txt2dbm.pl
Created September 27, 2012 02:58
Perl program to generate a .dbm file given a .txt file to be used by RewriteMap directive. Faster!
#!/usr/bin/perl -w
##
## txt2dbm -- convert txt map to dbm format
##
use SDBM_File;
use Fcntl;
($txtmap, $dbmmap) = @ARGV;
@sepiariver
sepiariver / cloneResource.php
Last active January 8, 2019 20:58
A Snippet to clone a Resource into multiple, user-defined parent containers in arbitrary contexts
<?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);
@DESIGNfromWITHIN
DESIGNfromWITHIN / Gulpfile.js
Created June 27, 2014 07:56
MODX Gulp, SASS, NEAT & Browser-Sync build file
var gulp = require('gulp');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var minifycss = require('gulp-minify-css');
var concat = require('gulp-concat');
var neat = require('node-neat').includePaths;
var browserSync = require('browser-sync');
var paths = {
@christianseel
christianseel / introRTE
Created August 14, 2014 14:52
RTE for introtext #modx
<?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>');