Skip to content

Instantly share code, notes, and snippets.

View blynx's full-sized avatar

Steffen blynx

View GitHub Profile
@blynx
blynx / getFieldsetOf.php
Last active July 23, 2017 23:08
PHP, ProcessWire function: Get fields inside fieldsets of Template or Page objects. Choose to retrieve FieldsArray or values as WireData.
/**
* getFieldsetOf
*
* for ProcessWire
*
* gets fields inside a fieldset of pages or templates
* choose to retrieve values
*
* @param Template|Page $context the page or template
* @param String $fieldsetName name of the fieldset
@blynx
blynx / value_in.php
Last active January 26, 2017 02:42
PHP function: Get values by given path in plain or mix-nested objects and arrays
<?php
/**
* value_in
*
* @param mixed $haystack array or object or nested mix of both
* @param string $path path in any token-separated notation
* @param string $token path separator token
* @return mixed resolved value
*/
@blynx
blynx / placeSVG.php
Last active January 18, 2017 18:34
PHP, ProcessWire: SVG placement function
/**
* placeSVG
*
* verson 1.0.4
*
* Insert svg file as svg markup or image tag
*
* @param String $filename file relative to templates folder
* @param array $option
* String markup 'img'|null, defines output
@blynx
blynx / universal-module.js
Last active January 17, 2017 19:06 — forked from ryanflorence/universal-module.js
Universal JavaScript Module, supports AMD (RequireJS), Node.js, and the browser.
(function (name, definition){
if (typeof define === 'function'){ // AMD
define(definition);
} else if (typeof module !== 'undefined' && module.exports) { // Node.js
module.exports = definition();
} else { // Browser
var theModule = definition(), global = this, old = global[name];
theModule.noConflict = function () {
global[name] = old;
return theModule;
@blynx
blynx / ModuleBoilerplate.module
Last active August 12, 2016 13:40 — forked from yckart/ModuleBoilerplate.module
ModuleBoilerplate.module for ProcessWire
<?php namespace ProcessWire;
/**
* A simple module-boilerplate
*
* @see https://gist.github.com/yckart/7040320
* @see http://wiki.processwire.com/index.php/Module_Creation
*/
class ModuleBoilerplate extends WireData implements Module, ConfigurableModule {