Skip to content

Instantly share code, notes, and snippets.

@leihog
leihog / xmltoarray.php
Created December 14, 2010 13:30
Very basic class to convert simple xml snippets in to arrays.
<?php
/**
* (extremely) simple class to convert a DOMNode to an array.
* @todo Add support for attributes, namespaces and other goodies...
*/
class XmlToArray
{
/**
* Checks if node has any children other than just text
*
@leihog
leihog / flattr5.php
Created November 29, 2010 15:58
wordpress flattr plugin quick fix
<?php
class Flattr
{
const VERSION = '0.9.18';
const WP_MIN_VER = '2.9';
const API_SCRIPT = 'api.flattr.com/js/0.6/load.js?mode=auto';
/** @var array */
protected static $categories = array('text', 'images', 'audio', 'video', 'software', 'rest');
<?php
define('FLAG_0', 1);
define('FLAG_1', 2);
define('FLAG_2', 4);
define('FLAG_3', 8);
/**
* Will fail when setting multiple flags at once
*/