Skip to content

Instantly share code, notes, and snippets.

View avoronkin's full-sized avatar

Alexandr Voronkin avoronkin

  • Saint-Petersburg
View GitHub Profile
@avoronkin
avoronkin / phpthumbof.php
Created April 6, 2011 13:10
Multiple fltr not working.
<php?
//phpthumbof 1.1.0
//Multiple fltr not working. Works only the last filter
//[[*photo:phpthumbof=`&fltr=gray&fltr=flip|y&w=100&h=100&zc=1`]]
//I changed snippet code from this
if (!empty($opt[0])) {
$ptOptions[$opt[0]] = $opt[1];
}
@avoronkin
avoronkin / MultipleTV.php
Created March 22, 2011 09:30
Multiple TV searching via xPDO
<?php
//http://modxcms.com/forums/index.php?topic=58644.msg354702#msg354702
$query->where(array(
array(
'id:IN' => $children_of_this_folder,
'published' => true,
'deleted' => false,
'hidemenu' => false,
'isfolder' => false,
@avoronkin
avoronkin / FormIt2AddUser.php
Created February 17, 2011 09:57
FormIt custom hook
<?php
$debug = $modx->getOption('debug', $scriptProperties, false);
if ($debug) {
$modx->setLogLevel(modX::LOG_LEVEL_DEBUG);
}
//new user object
$user = $modx->newObject('modUser');
//get all form fields
$formFields = $hook->getValues();
@avoronkin
avoronkin / rssGrabber.snippet.php
Created February 17, 2011 09:32
Grab RSS to resources
<?php
if ($debug) {
$modx->setLogLevel(modx::LOG_LEVEL_DEBUG);
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime;
}
@avoronkin
avoronkin / specificTV.php
Created February 15, 2011 16:53
return all resources with a specific TV value
<?php
$c = $modx->newQuery('modResource');
$c->innerJoin('modTemplateVarResource','TemplateVarResources');
$c->innerJoin('modTemplateVar','TemplateVar','TemplateVarResources.tmplvarid = TemplateVar.id');
$c->where(array(
'TemplateVar.name' => 'access_front',
'TemplateVarResources.value' => true,
));
$ress = $modx->getCollection('modResource',$c);
<?php
$parent = 156; //parent to put the new pages under
$published = 1; //published? 0 or 1
$hidemenu = 0; //hidemenu? 0 or 1
$template = 11; // template that you like to use for page
$newsdateId = 7; //newsdate tv id
$rssfeed = 'http://www.BLABLABLA.co.uk/index.php?id=68'; //put your feed here
$doc = new DOMDocument();
$doc->load($rssfeed);
@avoronkin
avoronkin / clientarea
Created January 20, 2011 17:01
autoClientArea
<?php
$adminId = 1;
$polisyID = 4;
$authorityLevel = 9999;
$extendedField = 'redirect';
//resorce setings
$template = 1;
$parent = 2;
$published = 1;