Skip to content

Instantly share code, notes, and snippets.

@nickdunn
nickdunn / gist:1004597
Created June 2, 2011 14:57
Symphony 3 versioning ideas
===========================
tbl_entries
===========================
id				int (PK)
created_date	date
created_by		int (FK)
default_version	int
is_deleted		boolean

===========================
@nickdunn
nickdunn / EventTutorial.md
Created May 17, 2011 08:29 — forked from brendo/EventTutorial.md
Symphony Events: A Detailed Look

Forms have been an integral part of any interactive site since the dawn of time — they promote interactivity and are usually the most common way users interact with a site. It's commonplace that when a form is submitted (input), the website will take 'action' and do something with the data (processing) and then provide a user with the result (output). Symphony provides this logic layer via events.

This tutorial assumes you have a basic understanding of how events work in Symphony (if not, this may be a good introduction) and are semi-comfortable writing some PHP code. I'll be showing you some of the lesser-known features of Symphony events, including event priority, event chaining, and a brief demonstration of how to write a custom event. The difficulty level progresses as we go through, but with any luck you'll be able to learn a thing or two :)

Getting Started

The Scenario

Our client requires a form that allows a user to submit some detai

@nickdunn
nickdunn / gist:974737
Created May 16, 2011 16:08
Grab repackage a zip from Github
<?php
require_once('pclzip.lib.php');
$name = 'publishfiltering';
$tmp_zip_path = $name . '-' . sha1(microtime());
$tmp_zip_name = $tmp_zip_path . '.zip';
file_put_contents($tmp_zip_name, file_get_contents('https://github.com/nickdunn/publishfiltering/zipball/1.6.0'));
<?php
require_once('pclzip.lib.php');
$name = 'publishfiltering';
$tmp_zip_path = $name . '-' . sha1(microtime());
$tmp_zip_name = $tmp_zip_path . '.zip';
file_put_contents($tmp_zip_name, file_get_contents('https://github.com/nickdunn/publishfiltering/zipball/1.6.0'));
<?xml version="1.0"?>
<extensions>
<section id="15" handle="extensions">Extensions</section>
<entry id="57">
<repo name="mediathek" owner="nilshoerrmann" watchers="22" forks="10">
<description>A Mediathek Field for Symphony 2</description>
<url>https://github.com/nilshoerrmann/mediathek</url>
<pushed-at time="14:15" weekday="5">2011-03-25</pushed-at>
<fork-of name="">https://github.com/</fork-of>
<contributors>
<?
$like = '';
$keywords = urldecode($keywords);
$keywords = preg_replace("/[^a-zA-Z0-9\s]/", '', $keywords);
$words = explode(' ', $keywords);
foreach($words as $word) {
$word = trim($word);
$like .= 'index.data REGEXP "[[:<:]]'.Symphony::Database()->cleanValue($word).'[[:>:]]" AND ';
}
<?php
//Function to seperate multiple tags one line
function fix_newlines_for_clean_html($fixthistext)
{
$fixthistext_array = explode("\n", $fixthistext);
foreach ($fixthistext_array as $unfixedtextkey => $unfixedtextvalue)
{
//Makes sure empty lines are ignores
if (!preg_match("/^(\s)*$/", $unfixedtextvalue))
Cool. Lunch at 1 it is.
<?php
// ensure output is sent as XML
header('Content-Type: text/xml');
echo('<?xml version="1.0" encoding="utf-8" ?>');
include_once('markdown.php');
$handle = opendir('.');
@nickdunn
nickdunn / Members.md
Created January 11, 2011 14:51 — forked from brendo/Members.md

Member: Password (Required)

  • Extends FieldInput (Text Input)
  • SHA1
  • Has a salt
  • Can have minimum strength/length

Member: Username

  • Extends FieldInput (Text Input)