Skip to content

Instantly share code, notes, and snippets.

View herooutoftime's full-sized avatar

Andreas Bilz herooutoftime

  • Content Garden
  • Vienna, Austria
View GitHub Profile
@herooutoftime
herooutoftime / wp_link_shortcode.php
Last active January 18, 2016 10:43
Wordpress Shortcode for links in MODx similar style
@herooutoftime
herooutoftime / README.md
Last active May 13, 2022 15:55
MODx (missing) preview of unsaved changes

Idea & Concept

MODx Revolution lacks a preview of unsaved changes. For editors this is a rather important feature to check if their changes are correctly displayed and it's easy to do. No need to unpublish, save and view the resource. Just click 'Preview' and a MODx Window will show you all the changes.

The way it works is pretty easy: When clicking the 'Preview' button and OnBeforeDocFormSave is triggered all current (saved) data will be stored in a cache file, the resource will be saved with the new data. If OnWebPageComplete is fired, the saved data will be replaced with the previously cached data.

So for a short period the actual preview will be live!

Installation

@herooutoftime
herooutoftime / default.conf
Created March 31, 2014 14:23
MODx sync script
#!/bin/bash
declare -A db_tables_exclude_content
enabled=true
mail=true
rsync=true
dbsync=true
modxsetup=true
@herooutoftime
herooutoftime / file-upload-dialog-hook
Last active December 20, 2015 19:49
A MODx plugin to hook into the 'fileadd' event of the file-upload-dialog and render a window with a form to fill out. Please use carefully!
<?php
$event = $modx->event->name;
switch($event) {
case 'OnManagerPageInit':
$id = 'ext-comp-1107';
$js =<<<JS
<script type="text/javascript">
function find_dialog() {
Ext.onReady(function() {
@herooutoftime
herooutoftime / README.md
Last active March 13, 2016 22:46
MODX real preview

THERE IS A NEW PREVIEW IN TOWN: https://gist.github.com/herooutoftime/59eebf7c0bbf1299410c

MODx real preview:

Up to now MODx lacks a real preview (which shows unsaved changes to a resource). This plugin is a workaround and simulates a preview behavior.

Usage:

  • Create a new resource, call it 'Preview'
  • Create a new system setting with key 'previewer.resource_id' and save with above resource ID