Skip to content

Instantly share code, notes, and snippets.

Thomas Jakobi Jako

View GitHub Profile
View gist:0679e1b23cb8f5c5494c6826eba0f6a9
<?php
$selectField = $modx->getOption('emailSelectField', $scriptProperties, 'department');
$selectTo = $modx->getOption('emailSelectTo', $scriptProperties, '');
$selectTo = ($selectTo) ? explode(',', $selectTo) : array();
if ($selectField && $selectTo) {
$selected = intval($hook->getValue($selectField)) - 1;
if ($selected && isset($selectTo[$selected])) {
$hook->formit->config['emailTo'] = $selectTo[$selected];
}
@Jako
Jako / Revolution-Integrators-Guide.md
Last active Jan 26, 2017
Revolution Integrators Guide
View Revolution-Integrators-Guide.md

Few rules

  • Don't merge own PRs
  • Don't do direct changes (submit a PR instead)

GitHub repository setup

  • Clone your fork
  • Add modxcms/revolution as a remote (git remote add upstream git@github.com:modxcms/revolution.git)
  • Update .git/config and add fetch = +refs/pull/*/head:refs/remotes/upstream/pr/* in section [remote "upstream"]
@Jako
Jako / resolve.access_permissions.php
Created Nov 20, 2016
Access permissions resolver for MODX packages
View resolve.access_permissions.php
<?php
/**
* Resolve access permissions
*
* @package sample
* @subpackage build
*
* @var mixed $object
* @var array $options
*/
@Jako
Jako / gist:c9ea82324c62c90c15ade95254ac57e1
Created Nov 16, 2016
Recursive download with curl and open_basedir
View gist:c9ea82324c62c90c15ade95254ac57e1
/**
* Load data from URL with curl
*
* @param $url
* @return mixed
*/
public function loadData($url)
{
$curloptHeader = false;
View gist:8ba13f097b36e94fe315f505d3003d8b
<?php
/**
* RedirectByValue
*
* Copyright 2016 by Thomas Jakobi <thomas.jakobi@partout.info>
*
* Description:
* This FormIt Hook redirects to different targets on base of the
* formItRedirectByValue property. The property has to contain a json encoded
* object of fieldnames, values, redirects and redirect parameters. Only a
@Jako
Jako / gist:1967614434a98e52a063
Created Nov 9, 2014
Replaces line 308 in core/components/formit/model/formit/fihooks.class.php
View gist:1967614434a98e52a063
if (!is_numeric($this->formit->config['redirectTo']) &&
isset($fields[$this->formit->config['redirectTo']]) &&
is_numeric($fields[$this->formit->config['redirectTo']])
) {
$url = $this->modx->makeUrl($fields[$this->formit->config['redirectTo']],$contextKey,$redirectParams,'full');
} else {
$url = $this->modx->makeUrl($this->formit->config['redirectTo'],$contextKey,$redirectParams,'full');
}
You can’t perform that action at this time.