Skip to content

Instantly share code, notes, and snippets.

@bohwaz
bohwaz / php-8.1-strftime.php
Last active September 27, 2024 14:55
strftime() replacement function for PHP 8.1
<?php
namespace PHP81_BC;
/**
* Locale-formatted strftime using \IntlDateFormatter (PHP 8.1 compatible)
* This provides a cross-platform alternative to strftime() for when it will be removed from PHP.
* Note that output can be slightly different between libc sprintf and this function as it is using ICU.
*
* Usage:
* use function \PHP81_BC\strftime;
@pepebe
pepebe / 01-introduction.md
Last active February 2, 2022 10:27
Collections Editors Complete List

1 Introduction

Collections is a handy tool to display the child resources of a parent inside a configurable grid. Each column can get its own configurable editor so you can edit a resource right from the grid.

image Example for a datatime editor

Editors can be attached by editing the collections column settings:

image

#redactor_modal_overlay, #redactor_modal, .redactor_dropdown {
z-index: 9999 !important;
}
.redactor_editor.redactor_editor_wym h1, .redactor_editor.redactor_editor_wym h2, .redactor_editor.redactor_editor_wym h3, .redactor_editor.redactor_editor_wym h4, .redactor_editor.redactor_editor_wym h5, .redactor_editor.redactor_editor_wym p, .redactor_editor.redactor_editor_wym blockquote, .redactor_editor.redactor_editor_wym pre {
position: relative;
}
.redactor_editor.redactor_editor_wym h1:before, .redactor_editor.redactor_editor_wym h2:before, .redactor_editor.redactor_editor_wym h3:before, .redactor_editor.redactor_editor_wym h4:before, .redactor_editor.redactor_editor_wym h5:before, .redactor_editor.redactor_editor_wym p:before, .redactor_editor.redactor_editor_wym blockquote:before, .redactor_editor.redactor_editor_wym pre:before {
position: absolute;
@carnevlu
carnevlu / install-CB-import-Fields-Layouts-Templates.php
Last active May 18, 2022 09:08
MODX install package __ContentBlock__ and import Fields,Layouts,Templates from multiple export files
<?php
define('MODX_API_MODE', true);
// Full path to the index
require_once('index.php');
$modx = new modX();
$modx->initialize('mgr');
######################## Variables
#redactor_modal_overlay, #redactor_modal, .redactor_dropdown{
z-index: 9999 !important; // fix for migx redactor fields
}
.redactor_editor.redactor_editor_wym{
h1,h2,h3,h4,h5,p,blockquote,pre{
position: relative;
&::before{
position: absolute;
top: 1px;
@opengeek
opengeek / src-Middleware-MODSlim.php
Created June 9, 2015 15:52
This is a proof of concept for using MODX 2.x as a dependency in a Slim application
<?php
/*
* This file is part of the MODSlim package.
*
* Copyright (c) Jason Coward <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@alroniks
alroniks / Gulpfile.js
Last active April 1, 2018 14:08
Gulpfile for run watch commands for Gitify (MODX)
'use strict';
console.time('Loading plugins');
var gulp = require('gulp'),
watch = require('gulp-watch'),
shell = require('gulp-shell'),
tap = require('gulp-tap');
console.timeEnd('Loading plugins');
@pepebe
pepebe / mgThumb.plugin.php
Last active August 29, 2015 14:01 — forked from christianseel/moregallery img to TV
Add this as a plugin (OnDocFormSave). Saves the first MoreGallery image or cropimage into a TV (could be a hidden one) for quicker access.
<?php
/*
mgThumb by pepebe
---------------------------------------------
saves the first image in a galley inside a tv
trigger OnDocFormSave
Initial idea: https://gist.github.com/christianseel/557a1e0f2a1f502ce1c5
Changelog:
@opengeek
opengeek / Changeset configuration example
Last active February 8, 2023 12:19
Adding the following config_options entries to your MODX Revolution config file will allow you to track changes made to any xPDOObject class via the `xPDOObject::save()`, `xPDOObject::remove()`, `xPDO::updateCollection()`, or `xPDO::removeCollection()` methods. This example records changes into a database register called `changes` under a config…
<?php
$config_options = array (
'callback_excludes' => array(
'modSession',
'modManagerLog',
'modActiveUser',
'modDbRegisterQueue',
'modDbRegisterTopic',
'modDbRegisterMessage',
'modUser',
@splittingred
splittingred / gist:4689218
Last active April 30, 2019 09:39
Example of modRest, a REST Client, in MODX 2.3.
$config = array(
'baseUrl' => rtrim('http://mywebsite.com/rest/api/','/'),
'format' => 'json', // json or xml, the format to request
'suppressSuffix' => false, // if false, will append .json or .xml to the URI requested
'username' => 'myuser', // if set, will use cURL auth to authenticate user
'password' => 'mypass',
'curlOptions' => array(
'timeout' => 30, // cURL timeout
'otherCurlOption' => 1,