Skip to content

Instantly share code, notes, and snippets.

Purpose:

Give a visual feedback on all moregallery custom fields starting with "color".

image

Usage:

Add custom fields to moregallery.

Start the variable name with "color". "colorBg" or "colorText" are valid field names

@pepebe
pepebe / readme.md
Last active August 12, 2023 08:56
Wordpress shortcode: Render all posts by a certain user

shortcode

[wsrn_autorPosts user="11"]

Note: user must contain a valid userid

Note:

html is rendered by a small function that replaces a placeholder inside swirly brackets with a value from an array.

<?php
echo dirname(__FILE__)."<br>";
$locales = ["af_NA", "af_ZA", "af", "ak_GH", "ak", "sq_AL", "sq", "am_ET", "am", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SD", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "ar", "hy_AM", "hy", "as_IN", "as", "asa_TZ", "asa", "az_Cyrl", "az_Cyrl_AZ", "az_Latn", "az_Latn_AZ", "az", "bm_ML", "bm", "eu_ES", "eu", "be_BY", "be", "bem_ZM", "bem", "bez_TZ", "bez", "bn_BD", "bn_IN", "bn", "bs_BA", "bs", "bg_BG", "bg", "my_MM", "my", "ca_ES", "ca", "tzm_Latn", "tzm_Latn_MA", "tzm", "chr_US", "chr", "cgg_UG", "cgg", "zh_Hans", "zh_Hans_CN", "zh_Hans_HK", "zh_Hans_MO", "zh_Hans_SG", "zh_Hant", "zh_Hant_HK", "zh_Hant_MO", "zh_Hant_TW", "zh", "kw_GB", "kw", "hr_HR", "hr", "cs_CZ", "cs", "da_DK", "da", "nl_BE", "nl_NL", "nl", "ebu_KE", "ebu", "en_AS", "en_AU", "en_BE", "en_BZ", "en_BW", "en_CA", "en_GU", "en_HK", "en_IN", "en_IE", "en_JM", "en_MT", "en_MH", "en_MU", "en_NA", "en_NZ", "en_MP", "en_PK", "en_PH", "en_SG", "en_Z
<?php
/*
write all formvalues as well as the complete formit config into modx error log
*/
$modx->log(xPDO::LOG_LEVEL_ERROR, "snippetname values: " . print_r($hook->getValues(), true));
$modx->log(xPDO::LOG_LEVEL_ERROR, "snippetname config: " . print_r($hook->formit->config, true));
return true;
<?php
/**
* seoSuiteRecoverLongtitle v:0.0.1
* Last edited: 2022-05-01
*
* AUTHOR:
* [email protected]
*
* PLUGIN EVENT(S):
* OnDocFormRender
@pepebe
pepebe / 01_readme.md
Last active April 23, 2022 14:54
ConfigurePHP recursively searches all directories below its own position for php files. If a directory with at least one php file is found, a symlink to ./php.ini will be created.

Found this script years ago on the 1und1 forum. It was a nice workaround to make sure that the php.ini file would work inside root and all directories below it.

@pepebe
pepebe / 00-datagrid.md
Last active February 3, 2022 20:56
Data Grid Tutorial by Susann Ottwell

Backup of a an article write by Susan Ottwell in February 2008

The original source seems to be lost but there is still a copy a archive.org

Disclaimer: I didn't check the code for potential problems with current versions of MODX. If you find something that breaks the code, post it in the comments below.

@pepebe
pepebe / readme.md
Last active June 21, 2023 09:43
pdoTools Kichensink

About this list

A currated list of useful pdoTools settings/examples

@pepebe
pepebe / CreateXpdoClasses.snippet.php
Last active January 6, 2022 13:18
pdoResources - load class with custom db prefix
<?php
/**
* @package = CreateXpdoClasses
*
* Create Xpdo Classes script
*
* This script creates xPDO-ready classes from existing custom
* database tables. Run it again whenever you change
* your schema.
*