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 | |
/** | |
* Insert an array into another array before/after a certain key | |
* | |
* @param array $array The initial array | |
* @param array $pairs The array to insert | |
* @param string $key The certain key | |
* @param string $position Wether to insert the array before or after the key | |
* @return 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: Category Custom Fields | |
Author: scribu | |
*/ | |
class Category_Custom_Fields { | |
function init() { |
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 | |
/** | |
* Copy entire sidebar configuration from one site to another | |
* | |
* @param int $old_site The id of the original site | |
* @param int $old_site The id of the site to copy the widgets to | |
*/ | |
function copy_widgets($old_site, $new_site) { | |
global $wpdb, $blog_id; |
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: Better Deprecation Warnings | |
Author: scribu | |
Version: 1.0 | |
*/ | |
class Backtrace_Deprecated { | |
function init() { |
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 | |
// Forked from: http://stackoverflow.com/questions/1159216/how-can-i-get-php-to-produce-a-backtrace-upon-errors/1159235#1159235 | |
function process_error_backtrace($errno, $errstr, $errfile, $errline) { | |
if(!(error_reporting() & $errno)) | |
return; | |
switch($errno) { | |
case E_WARNING : | |
case E_USER_WARNING : | |
case E_STRICT : |
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
# add these lines in your .htaccess file | |
php_value memory_limit 128M | |
php_value upload_max_filesize 128M | |
php_value post_max_size 128M | |
php_value max_execution_time 120 |
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 | |
function locate_skin_url( $name ) { | |
$dir = false === strpos($name, '.css') ? 'js' : 'css'; | |
if ( file_exists(STYLESHEETPATH . "/$dir/$name")) { | |
$url = get_bloginfo('stylesheet_directory') . "/$dir/$name"; | |
} elseif ( file_exists(TEMPLATEPATH . "/$dir/$name") ) { | |
$url = get_bloginfo('template_directory') . "/$dir/$name"; | |
} else { |
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 | |
function wp_query_debug() { | |
global $wp, $wp_query; | |
echo '<pre>'; | |
var_dump($wp->matched_rule); | |
print_r($wp_query); | |
echo '</pre>'; | |
} |
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 | |
/** | |
* Returns an array containing the ASCII codes of a string (useful for decomposition) | |
* Example: print_r(get_ascii_array('ș')) | |
* | |
* @param string $str | |
* @return array | |
*/ | |
function get_ascii_array($str) { |
OlderNewer