Performance Comparison:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace WCM; | |
# USES PHP 5.3 + Closures | |
// No white surrounding space | |
$data = array_map( 'trim', $_POST['foo'] ); | |
$data = filter_var_array( $data, array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Your friendly "Current User Data" Deamon | |
Plugin URI: http://not-going-to-come-anytime.com | |
Description: Gives you an overview about any Data of the currently logged in user including all code to get or display it. Includes different code-approaches of user_role and the (depracated) user_level inside the code. So just take a look at the code and inline-comments. Makes a new menu at "Tools" > "Show User Data". | |
Version: 0.5 | |
Author: F. J. Kaiser | |
Author URI: http://unserkaiser.com | |
License: GPL2 | |
========================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined( 'ABSPATH' ) OR exit; | |
/** | |
* Plugin Name: (WCM) RSS Importer | |
*/ | |
add_action( 'plugins_loaded', array( 'WCMRSSImporterBootstrap', 'init' ) ); | |
class WCMRSSImporterBootstrap | |
{ | |
protected static $instance = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define( 'DS', DIRECTORY_SEPARATOR ); | |
# ================================== | |
# PHP errors & log | |
error_reporting( | |
E_ALL | E_STRICT | E_CORE_ERROR | E_CORE_WARNING | |
| E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | |
| E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR | |
); | |
# OR: shorter and all together |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function( $, plugin ) { | |
"use strict"; | |
// Working with promises to bubble event later than core. | |
$.when( someObjectWithEvents ).done( function() { | |
console.log( 'AJAX request done.' ); | |
} ) | |
.then( function() { | |
setTimeout( function() { | |
console.log( 'AJAX requests resolved.' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Dump WP HTTP API cURL Request & Response | |
* Author: Franz Josef Kaiser | |
*/ | |
add_action( 'plugins_loaded', array( 'WPSE81791_cURL', 'init' ) ); | |
class WPSE81791_cURL | |
{ | |
protected static $instance; |
If you are collaborating with others, chances that not everyone's on the same OS are good. If you want to avoid "running on my machine" kind of problems, just share an installer script for your favorite binaries installers/ upgrader/ uninstallers. This is one way to do it.
This is a simple installer script that selects different installation methods based on the OS you are running this on.
Just replace @TODO
with whatever you are installing. Make sure to adjust the different installation methods some project/ program offers.
Linux currently is running a Git clone installer that symlinks into some $PATH
supporting place. This does not clone the complete repo, but just the last commit!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Delay post publishing | |
* Plugin URI: http://unserkaiser.com | |
* Description: Only allows publishing a post if the user registered one week ago. | |
* Version: 0.1 | |
* Author: Franz Josef Kaiser | |
* Author URI: http://unserkaiser.com | |
*/ | |
// Not a WordPress context? Stop. Why? Ask @toscho |