This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* TwitterX | |
* | |
* This package loads Twitter feeds using the new (and very annoying) Twitter | |
* 1.1 API. You will need to create a Twitter app and get the keys and tokens | |
* by creating a new app here: https://dev.twitter.com/apps/new | |
* | |
* This uses twitteroauth: https://github.com/abraham/twitteroauth | |
* | |
* TwitterX is free software; you can redistribute it and/or modify it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// get user-defined source document and target parents | |
$source = intval($modx->getOption('sourceId', $scriptProperties, '')); | |
$targets = array_map('trim', explode(',', $modx->getOption('targetIds', $scriptProperties, ''))); | |
// to prevent accidents... | |
$_allowedUsers = explode(',', 'username1,username2'); | |
// check stuff, and if passed then get the source document object | |
if ( !in_array($modx->user->get('username'), $_allowedUsers) || empty($source) || $source == 0 || !is_array($targets) || empty($targets) ) return; | |
$sourceDoc = $modx->getObject('modResource', $source); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Copyright (c) YJ Tso <[email protected]> | |
* | |
* GPL2, do what you want at your own risk. No warranties whatsoever. | |
* | |
*/ | |
// Get &resources property from snippet call | |
$ids = array_map('trim', explode(',', $modx->getOption('resources', $scriptProperties, ''))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myimagerenderer = function(value, metaData, record, rowIndex, colIndex, store) { | |
if (value != '' && value != null) { | |
var baseUrl = MODx.config.collections_renderer_basepath_img; | |
if (value.indexOf('http://') === 0) { | |
baseUrl = ''; | |
} | |
return '<div class="myimagerenderer"><img src="' + baseUrl + value + '" width="100"></div>'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timestampToDatetime = function(value, metaData, record, rowIndex, colIndex, store) { | |
if (value == 0 || value == null) return ''; | |
return Ext.util.Format.date(new Date(parseInt(value) * 1000),MODx.config['collections.mgr_datetime_format']); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* @author @sepiariver | |
* | |
* GPL license, no warranties, no liability, etc. | |
* | |
* USAGE EXAMPLE: | |
* [[getCtx? &context=`othercontext` &key=`site_url`]] | |
* // outputs the "site_url" context setting from "othercontext" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$select = 'id,pagetitle'; | |
$includeTVs = 'Text'; | |
$tvFilters = 'Text==%2017-10%'; | |
$where = '%2017%'; | |
echo '<pre>'; | |
$pdo = $modx->getService('pdoFetch'); | |
$res = $pdo->getCollection( | |
'modResource', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$month_arr = array('01' => 'Янвваря', | |
'02' => 'Февраля', | |
'03' => 'Марта', | |
'04' => 'Апреля', | |
'05' => 'Мая', | |
'06' => 'Июня', | |
'07' => 'Июля', | |
'08' => 'Августа', | |
'09' => 'Сентября', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USER=########### | |
PASSWORD=############### | |
BACKUP=/home/host1372784/Backup | |
OLD=4 # Сколько дней хранить бэкапы | |
# Создаем директорию для сегодняшнего бэкапа | |
DIR=$BACKUP/`date '+%Y-%m-%d'` | |
mkdir $DIR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# MySQL root password | |
ROOTPASS='password' | |
TIMEZONE='Europe/Moscow' | |
MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
SFTPPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
############## |