Skip to content

Instantly share code, notes, and snippets.

View m-engel's full-sized avatar

Michael Engel m-engel

View GitHub Profile
<?php
/**
* A custom FormIt hook for CSRF Protection
*
* Usage:
* Append this Plugin as PreHook and Hook
*
* [[!FormIt?
* &preHooks=`FormItCSRF`
* &hooks=`spam,FormItCSRF,email`
@m-engel
m-engel / MODX FilesTree Drag onlyfiles.php
Last active August 5, 2018 20:51
MODX FilesTree Drag onlyfiles
// Event: OnManagerPageBeforeRender
$script = "<script>
DirectoryTreeHandleDrop = MODx.tree.Directory.prototype._handleDrop;
Ext.override(MODx.tree.Directory, {
_handleDrop:function(e){
var dropNode = e.dropNode;
var targetParent = e.target;
if(dropNode.hasChildNodes()) return false;
return DirectoryTreeHandleDrop(e);

php7-debian-build install php7 on debian wheezy

Build php 7

Mostly for my own reference. Should work on a fresh Debian installation.

####### TODO: Install phpmyadmin

add to /etc/apt/sources.list:

# Testing repository - main, contrib and non-free branches
<?php
// just for specific template
if($resource->get('template') != '3') return true;
$modx->regClientStartupScript('http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true');
$modx->regClientStartupScript('<script type="text/javascript">
Ext.onReady(function() {
var input = document.getElementById("tv10");
var options = {
types: ["(cities)"],
//<?php
/**
* SEO Strict URLs
*
* Enforces the use of strict URLs to prevent duplicate content.
*
* @category plugin
* @version 1.0.1P2
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
* @author Jeremy Luebke, Phize
@m-engel
m-engel / MODX ResourceTree Onlysort.php
Last active March 3, 2017 10:25
Disable Drag&Drop Resources out of Containers
// Event: OnManagerPageBeforeRender
$script = "<script>
var ResourceTreeHandleDrop = MODx.tree.Resource.prototype._handleDrop;
Ext.override(MODx.tree.Resource, {
_handleDrop:function(e){
var dropNode = e.dropNode;
var targetParent = e.target;
if(dropNode.getDepth() != targetParent.getDepth() || (e.point == 'append')) return false;
if(dropNode.parentNode.id != targetParent.parentNode.id) return false;
@m-engel
m-engel / 0_reuse_code.js
Created April 10, 2014 18:59
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console