Skip to content

Instantly share code, notes, and snippets.

View somatonic's full-sized avatar

Philipp Urlich somatonic

View GitHub Profile
@somatonic
somatonic / download.php
Created May 23, 2012 15:25
Download PHP Class
<?php
class download{
public function startDownload( $vFilePath, $vDownloadName=""){
$vFilename = basename( $vFilePath);
$vNewFilename = $vDownloadName == "" ? $vFilename : $vDownloadName;
$vFileType = $this->getFileType( $vFilename);
$vContentType = $this->GetContentType( $vFileType);
// Fix IE bug [0]
@somatonic
somatonic / flourishautoloader.php
Last active October 5, 2015 09:37
flourish autloader
<?php
function flourish_loader( $class_name )
{
// Customize this to your root Flourish directory
$flourish_root = wire("config")->paths->root . '.libs/flourish/';
$file = $flourish_root . $class_name . '.php';
if (file_exists($file)) {
include $file;
}
@somatonic
somatonic / anchorinclude.js
Created May 25, 2012 20:30 — forked from scottjehl/anchorinclude.js
Anchor-include Pattern
/*
* anchor-include pattern for already-functional links that work as a client-side include
* Copyright 2011, Scott Jehl, scottjehl.com
* Dual licensed under the MIT
* Idea from Scott Gonzalez
* to use, place attributes on an already-functional anchor pointing to content
* that should either replace, or insert before or after that anchor
* after the page has loaded
* Replace: <a href="..." data-replace="articles/latest/fragment">Latest Articles</a>
* Before: <a href="..." data-before="articles/latest/fragment">Latest Articles</a>
@somatonic
somatonic / PageReferenceLink.module
Created June 5, 2012 22:04
Add link from page reference fields - Module example
@somatonic
somatonic / FieldHelper.module
Created July 16, 2012 11:17
FieldHelper.module
<?php
/**
* ProcessWire Module FieldHelper
*
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
@somatonic
somatonic / TagsHelper.module
Created August 31, 2012 21:05
Find related pages using Fieldtype Page for tagging. Returns PageArray with added property "score" for later use.
<?php
/**
* TagsHelper ProcessWire2.+ Module
*
*
* @author Soma
* modified 2012/08/31
*
* ProcessWire 2.x
@somatonic
somatonic / Helloworld.module
Created October 3, 2012 21:07
custom page name
<?php
class Helloworld extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'Hello World',
@somatonic
somatonic / form-example.php
Last active September 14, 2021 01:46
PW simple form via API
<?php
$out = '';
// create a new form field (also field wrapper)
$form = $modules->get("InputfieldForm");
$form->action = "./";
$form->method = "post";
$form->attr("id+name",'subscribe-form');
@somatonic
somatonic / upload_images_to_page_form.php
Created November 26, 2012 22:08
Upload Images to new created Page Form Example
<?php
// front-end form example with multiple images upload
// add new page created on the fly and adding images
$message = '';
if($input->post->submit){
// tmp upload folder for additional security
@somatonic
somatonic / TextAreaCounter.module
Created December 10, 2012 20:00
TextAreaCounter concept module
<?php
// start module to textarea counter
class TextAreaCounter extends WireData implements Module {
//const default_maxlength = 255;
/**
* getModuleInfo is a module required by all modules to tell ProcessWire about them