Skip to content

Instantly share code, notes, and snippets.

View helhum's full-sized avatar
💭
I may be slow to respond.

Helmut Hummel helhum

💭
I may be slow to respond.
View GitHub Profile
@helhum
helhum / generateIdeDummyFile.php
Created November 3, 2015 15:39
Dummy IDE file for class aliases
<?php
error_reporting(E_ALL);
$aliasMapFile = '/Migrations/Code/ClassAliasMap.php';
$ideFile = '/Migrations/Code/LegacyClassesForIde.php';
$extensionDir = getcwd() . '/typo3/sysext/';
$map = array();
$iterator = new DirectoryIterator($extensionDir);
foreach ($iterator as $fileinfo) {
/** @var $fileinfo DirectoryIterator */
@helhum
helhum / composer.json
Last active October 10, 2015 16:12
Composer class loading for existing TYPO3 6.2 projects
{
"name": "helhum/typo3-62-composer-classloader",
"description": "Benefit from composer class loader power in TYPO3 6.2",
"authors": [
{
"name": "Helmut Hummel",
"email": "info@helhum.io"
}
],
"require": {
@helhum
helhum / IncludeLibsWrapper.php
Last active December 7, 2017 15:21
includeLibsWrapper for removed config.includeLibs functionality
<?php
namespace Helhum\IncludeLibsWrapper;
class IncludeLibsWrapper {
public function includeLibs($content, $conf) {
if (!empty($conf['includeLibs.'] && is_array($conf['includeLibs.']))) {
$GLOBALS['TSFE']->includeLibraries($conf['includeLibs.']);
}
}
@helhum
helhum / PersistentObjectConverter.php
Last active January 24, 2021 14:08
Extbase TypeConverter to fetch hidden records from persistence (Using this will *always* fetch hidden models of the specified type)
<?php
namespace MyVendor\MyExtension\Property\TypeConverters
use TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter
class MyPersistentObjectConverter extends PersistentObjectConverter {
/**
* @var string
*/
@helhum
helhum / test-class-loading.php
Created December 1, 2014 14:01
::class feature of PHP 5.5
<?php
namespace Baz;
use Bar\Foo;
define('LF', chr(10));
spl_autoload_register(function($className){
echo 'trying to load class: ' . $className . LF;
});
echo LF . 'starting ...' . LF;
$a = Foo::class;
@helhum
helhum / ResourcePublisher.php
Created November 17, 2014 20:14
Secure TYPO3 CMS frontent delivery
<?php
namespace Helhum\YourSitePackage\Hooks;
/***************************************************************
* Copyright notice
*
* (c) 2014 Helmut Hummel <helmut.hummel@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@helhum
helhum / surf-command.sh
Created November 14, 2014 12:11
TYPO3 Surf shortcut command
#!/bin/bash
function surf() {
if ([ "$#" == "1" ] && [ "$1" == "help" ]) || [ "$#" == "0" ]
then
./flow help surf
return $?
fi
if [ "$1" == "help" ]
then
@helhum
helhum / FormErrorsPartial.html
Created October 21, 2014 15:28
Ordered validation results
<f:form.validationResults for="{propertyPath}">
<f:if condition="{validationResults.flattenedErrors}">
<ul>
<f:for each="{validationResults.flattenedErrors}" as="errors">
<li>
<ul>
<f:for each="{errors}" as="error"><li>{error}</li></f:for>
</ul>
</li>
</f:for></ul>
@helhum
helhum / git-search-commit-message
Created September 12, 2014 15:06
Git command to show (remote) branches and tags that contain a commit with a specified commit message
#!/bin/bash
function search-branches() {
for sha1 in `git log --oneline --all --grep "$1" | cut -d" " -f1`
do
git branch -r --contains $sha1
done
}
function search-tags() {
for sha1 in `git log --oneline --all --grep "$1" | cut -d" " -f1`
do
@helhum
helhum / class_alias_test.php
Created August 4, 2014 13:06
Class Alias Test
<?php
error_reporting(E_ALL);
class request {}
class_alias('request', 'old_request');
interface foo {
public function baz(\request $request);
}