Skip to content

Instantly share code, notes, and snippets.

View BetterXMLElement.php
<?php
class BetterXMLElement extends SimpleXMLElement {
//appends this xml to a parent
public function appendToSimpleXML(SimpleXMLElement $parent) {
$toDom = dom_import_simplexml($parent);
$fromDom = dom_import_simplexml($this);
$toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true));
}
@ericmulder
ericmulder / fileupload.api.php
Created Sep 23, 2015
Wordpress JSON API Controller for media upload
View fileupload.api.php
<?php
/**
* Plugin Name: JSON API - Media Controller
* Version: 0.0.1
* Author: Eric Mulder
* Author URI: https://emdevelopment.nl
* Plugin URI: https://emdevelopment.nl
* Description: Extensions to the JSON API plugin, to enable file upload
* Licence: GPLv2+
*/
View gist:3897504
//How to sort the following list?
//Array with NSStrings:
[NSArray arrayWithObjects:@"0.0 Title", @"1.1 Title", @"1.10 Title", @"1.11 Title", @"1.12 Title", @"1.2 Title", @"10.1 Title",@"10.11 Title",@"10.2 Title",@"2.1 Title", nil];
Solution:
NSSortDescriptor *sortDescriptor;
You can’t perform that action at this time.