Skip to content

Instantly share code, notes, and snippets.

<?
public function frontendInitialised(&$context) {
$uri = getCurrentPage();
$uri = trim($uri, '/');
// is the request for a specific render resource (HTML or RDF)
if (preg_match('/(rdf|html)$/', $uri)) {
$extension = end(explode('.', $uri));
}
public function frontendInitialised(&$context) {
$uri = getCurrentPage();
$uri = trim($uri, '/');
// is the request for a specific render resource (HTML or RDF)
if (preg_match('/(rdf|html)$/', $uri)) {
$extension = end(explode('.', $uri));
}
// Store templates:
object.find(settings.templates).each(function(position) {
var template = jQuery(this).remove();
var header = template.find(settings.headers).addClass('header');
var option = widgets.selector.append('<option />')
.find('option:last');
var header_children = header.children();
if (header_children.length) {
header_text = header.get(0).childNodes[0].nodeValue + ' (' + header_children.filter(':eq(0)').text() + ')';
<?php
require_once(TOOLKIT . '/class.datasource.php');
class DatasourceSearchException extends Exception {
}
class DatasourceSearch extends Datasource {
protected $fieldDefaults = array();
server {
listen 80;
server_name localhost;
access_log /path/to/log/access.log;
error_log /path/to/log/error.log;
location / {
root /path/to/root;
index index.php;
<?php
require_once(TOOLKIT . '/class.datasource.php');
Class datasourceblog_post_moderated_comment_count extends Datasource{
var $dsParamROOTELEMENT = 'blog-post-moderated-comment-count';
var $dsParamORDER = 'desc';
var $dsParamLIMIT = '9999';
var $dsParamREDIRECTONEMPTY = 'no';
<?php
Class CacheableDatasource extends Datasource {
private function buildCacheFilename(&$filename, &$file_age) {
$filename = null;
// get resolved values of each public property of this DS
// (sort, filters, included elements etc.)
foreach (get_class_vars(get_class($this)) as $key => $value) {
<?php
// comes from the Akismet extension
include_once(WORKSPACE . '/assets/akismet.curl.class.php');
$comment = array(
'comment_type' => 'comment',
'comment_author' => $_POST['fields']['author'],
'comment_author_email' => $_POST['fields']['email'],
'comment_author_url' => $_POST['fields']['url'], // this might be optional?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
Name: Basic Tumbler.com API Utility
Version: 1.0
Author: Josh Nichols <[email protected]>
URL: http://www.joshnichols.com/
Description:
This utility transforms a basic Tumblr.com XML source into XHTML. Each post is grouped by date and is marked up in a way that allows for easy styling with CSS.
/* Pagination
================================================*/
ul.pagination {
margin: 0;
}
ul.pagination li {
list-style-type: none;
font-size: 1.2em;
display: inline;