Skip to content

Instantly share code, notes, and snippets.

View hugopeek's full-sized avatar

Hugo Peek hugopeek

View GitHub Profile
@rtripault
rtripault / plugin.php
Created January 26, 2017 12:13
Plugin to add a "created by" field on a MODX Revolution resource form, listening on the "OnDocFormPrerender" event
<?php
/**
* Sample plugin to add a "created by" field on a resource form
*
* @var modX $modx
* @var array $scriptProperties
*
* @event OnDocFormPrerender
*/
@morelmm
morelmm / babelGen.snippet.php
Created November 17, 2016 18:51
Modx/babel recursive translation generation
<?php
$id =$scriptProperties['id'];
$ctxSource = $scriptProperties['ctxSource'];
$ctxDest = $scriptProperties['ctxDest'];
$count = 0;
global $babel;
$babel = $modx->getService('babel','Babel',$modx->getOption('babel.core_path',null,$modx->getOption('core_path').'components/babel/').'model/babel/');
$resources = $modx->getCollection('modResource',
array('parent'=> 0, 'context_key' => $ctxSource));
@chrisdempsey
chrisdempsey / Bezumkin equivalent plugin.php
Last active March 23, 2022 15:19
Automatically resizes images uploaded through the MODX File Manager if they exceed the dimensions specified in the config settings below and the file extension is included in the upload_images System Setting. Provides basic filename sanitization. Dependancies: Resizer Extra (http://modx.com/extras/package/resizer)
<?php
/**
* ResizeOnUpload Plugin
*
* Events: OnFileManagerUpload
* Author: Vasiliy Naumkin <bezumkin@yandex.ru>
* Required: PhpThumbOf snippet for resizing images
*/
if ($modx->event->name != 'OnFileManagerUpload') {return;}
@christianseel
christianseel / Chunk tabNavigationItem
Last active November 8, 2023 11:47
"generateTabs" output filter for ContentBlocks. See http://slides.com/christianseel/contentblocks/ for instructions.
<li class="tab-title [[+idx:is=`1`:then=`active`:else=``]]" role="presentational">
<a href="#[[+id]]" role="tab" tabindex="0" aria-selected="false" controls="[[+id]]">[[+title]]</a>
</li>
@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>');
@lavoiesl
lavoiesl / bs3-stacked-tabs.less
Created September 18, 2013 15:21
Add tabs-left, tabs-right and tabs-below in bootstrap 3 Credit: http://stackoverflow.com/questions/18432577/stacked-tabs-in-bootstrap-3
// http://stackoverflow.com/questions/18432577/stacked-tabs-in-bootstrap-3
.tabs-below, .tabs-right, .tabs-left {
.nav-tabs {
border-bottom: 0;
}
}
.tab-content > .tab-pane,
.pill-content > .pill-pane {
display: none;
@refringe
refringe / sendy-server
Last active February 5, 2024 07:50
Nginx configuration file example for Sendy (http://sendy.co/).
server {
listen 80;
listen [::]:80;
server_name domain.com;
autoindex off;
index index.php index.html;
root /srv/www/domain.com/public;