This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This module is build by Adrian, tnx Adrian. | |
* | |
* | |
* Module to hide pages that are not editable by the logged in user. | |
* | |
* ProcessWire 2.x | |
* Copyright (C) 2010 by Ryan Cramer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Build a CSS fractural grid. | |
* | |
* @var (int) $columns, Amount of columns, 10 columns means 10 columns of 10% width | |
* @var (string) $prefix, Classname prefix | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Switch ProcessWire templates directory on $_SERVER['HTTP_HOST']. Type the | |
* Hostname as key and the name of the new templates folder as value. | |
* | |
*/ | |
$config->templates = array( | |
'mobile.domain.dev' => 'templates-mobile', // domain => templates folder name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Groups & Products references guard. | |
* | |
* Bidirectional save & remove of products & groups | |
* | |
* templates: | |
* - 'group', pagefield: page_products | |
* - 'product', pagefield: page_groups |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* JSON response with a “standardized” structure | |
* | |
* @author ©2015 Martijn Geerts | |
* | |
* --------------------------------------------------------------------------------------- | |
* | |
* 4 types: success, redirect, fail, error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$config->form = array( | |
// Name of the formbuilder form | |
'formName' => $form_name, | |
// Redirect to here after successful submit. | |
'successUrl' => $success_url, | |
// Global error message after faulty submit. | |
'errorMessage' => $error_message, | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Stolen code, thanks Soma ! | |
public function init() { | |
$this->addHookAfter("ProcessPageView::pageNotFound", $this, "hook404Page"); | |
} | |
public function hook404Page($event){ | |
header("HTTP/1.1 404 Page Not Found"); | |
$page = wire("pages")->get("/404/"); // get your 404 page | |
$this->wire('page', $page); | |
$event->return = $page->render(); // render and return that page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// author: http://jeffreysambells.com/2012/10/25/human-readable-filesize-php | |
function human_filesize($bytes, $decimals = 2) { | |
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB'); | |
$factor = floor((strlen($bytes) - 1) / 3); | |
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Module from ryan.... | |
class CustomPageRoles extends WireData implements Module { | |
/** | |
* Provide information about this module to ProcessWire | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
array('icon-glass','music','search','envelope-alt','heart','star','star-empty','user','film','th-large','zoom-out','off','signal','cog','trash','home','file-alt','time','road','download-alt','refresh','list-alt','lock','flag','headphones','volume-off','volume-down','volume-up','qrcode','camera','font','bold','italic','text-height','text-width','align-left',''align-center','align-right','align-justify','pencil','map-marker','adjust','tint','edit','share','check','move','step-backward','fast-backward','fast-forward','step-forward','eject','chevron-left','chevron-right','plus-sign','minus-sign','remove-sign','ok-sign','question-sign','arrow-left','arrow-right','arrow-up','arrow-down','share-alt','resize-full','resize-small','plus','minus','asterisk','eye-close','warning-sign','plane','calendar','random','comment','magnet','chevron-up','chevron-down','retweet','bar-chart','twitter-sign','facebook-sign','camera-retro','key','cogs','comments','thumbs-up-alt','thumbs-down-alt','star-half','signin','trophy','gi |