Skip to content

Instantly share code, notes, and snippets.

View stefanheimes's full-sized avatar

Stefan Heimes stefanheimes

  • MEN AT WORK
  • Lage
View GitHub Profile
@stefanheimes
stefanheimes / gist:7118746
Created October 23, 2013 13:27
Example for mapping MM elements to the wf_extendedBreadcrumb.
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
class XBreadCrumb extends Frontend
{
/**
* Constructor
*/
public function __construct()
{
@stefanheimes
stefanheimes / gist:7119030
Created October 23, 2013 13:43
Search the initialize.php . Special feature for symlinks.
<?php
/**
* Initialize the system
*/
$dir = dirname(isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : __FILE__);
while ($dir && $dir != '.' && $dir != '/' && !is_file($dir . '/system/initialize.php')) {
$dir = dirname($dir);
}
@stefanheimes
stefanheimes / gist:7533853
Last active December 28, 2015 17:09
Test recipient for a valid email. Use avisot.
<?php
$objResult = Database::getInstance()
->prepare('SELECT id, email FROM orm_avisota_recipient')
->execute();
$objTester = new Swift_Mime_Grammar();
while($objResult->next())
{
@stefanheimes
stefanheimes / gist:7578782
Last active July 19, 2016 12:20
wf_extendedBreadcrumb - Add missing items like MetaModels/Isotope etc.
<?php
// MM
use MetaModels\Filter\Rules\SearchAttribute as MetaModelFilterRuleSearchAttribute;
use MetaModels\Filter\Setting\Factory as MetaModelFilterSettingsFactory;
// Isotope
use Isotope\Model\Product;
/**
* PHP version 5
@stefanheimes
stefanheimes / gist:7694188
Last active December 29, 2015 15:59
Replace filepath with dbfas id
<?php
$objResult = Database::getInstance()->prepare('SELECT * FROM XXXX') ->execute();
while($objResult->next())
{
$objTlFiles = Database::getInstance()
->prepare('SELECT * FROM tl_files WHERE path=?')
->execute($objResult->image);
@stefanheimes
stefanheimes / gist:7920427
Created December 11, 2013 23:27
Inserttags für MM - Überarbeitete Version - Alpha
<?php
/**
* The MetaModels extension allows the creation of multiple collections of custom items,
* each with its own unique set of selectable attributes, with attribute extendability.
* The Front-End modules allow you to build powerful listing and filtering of the
* data in each collection.
*
* PHP version 5
* @package MetaModels
@stefanheimes
stefanheimes / config.php
Last active January 4, 2016 18:09
Contao - Inserttag for counting entries.
<?php
// config.php
$GLOBALS['TL_HOOKS']['replaceInsertTags'][] = array('ExtendedComments', 'myReplaceInsertTags');
class ExtendedComments
{
/**
* Replace a inserttag.
*
* @param $strTag The inserttag.
@stefanheimes
stefanheimes / gist:9277192
Created February 28, 2014 18:49
Database
mysql -u [user] -p[password] [database] -P [port] -h [host]
@stefanheimes
stefanheimes / gist:9538959
Created March 13, 2014 22:58
Trace for php
<?php
function log_place()
{
$e = new \Exception();
$trace = $e->getTrace();
$file = @$trace[0]['file'];
$line = @$trace[0]['line'];
$class = @$trace[1]['class'];
@stefanheimes
stefanheimes / gist:9786945
Last active August 29, 2015 13:57
PHP CLI Caller
<?php
/**
* Contao Open Source CMS
*
* @copyright MEN AT WORK 2014
* @package .....
* @license GNU/LGPL
* @filesource
*/