Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
//This converts errors into exceptions, but if the error is caused | |
//by an argument being invalid (for example failing a typehint), it gets converted into an InvalidArgumentException | |
function handle($code, $message, $file, $line) { | |
//This test might be naive but it worked in my very very simple test code :) | |
if(strpos($message, 'Argument ') === 0) { | |
throw new InvalidArgumentException($message); | |
} | |
else { | |
throw new ErrorException($message, 0, $code, $file, $line); |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
// Include the XML-RPC files | |
include_once(ABSPATH . WPINC . '/class-IXR.php'); | |
include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php'); | |
class my_xmlrpc extends wp_xmlrpc_server { | |
function __construct() { | |
// This filter will add the new methods we're building | |
add_filter('xmlrpc_methods', array($this, 'my_xmlrpc_methods')); | |
parent::__construct(); |
#!/bin/bash | |
# Disclaimer - make backups, use at your own risk. | |
# | |
# Based on this comment: http://stackoverflow.com/a/13944924/843067 | |
# Views and stored procedures have to be done separately. | |
OLDDB="old_db_name" | |
NEWDB="new_db_name" | |
MYSQL="mysql -u root -pyour_password " |