Skip to content

Instantly share code, notes, and snippets.

@BobRay
BobRay / php-8.1-strftime.php
Created January 11, 2022 21:07 — forked from bohwaz/php-8.1-strftime.php
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 func \PHP81_BC\strftime;
@BobRay
BobRay / gmsug.php
Created August 15, 2012 21:32
Get user group's media sources (maybe)
<?php
$output = 'No Media Sources found';
$fields = array(
'principal_class' => 'modUserGroup',
'principal' => $userGroupId,
);
$sources = $modx->getCollection('modAccessMediaSource', $fields);
@BobRay
BobRay / transport.menu.php
Created April 20, 2012 18:38
MODX menu transport file
$action= $modx->newObject('modAction');
$action->fromArray(array(
'id' => 1,
'namespace' => 'mycomponent',
'parent' => 0,
'controller' => 'index',
'haslayout' => true,
'lang_topics' => 'mycomponent.:default,lexicon',
'assets' => '',
),'',true,true);