Remove more create_function calls. props huichen, see #14424.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -677,7 +677,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
|
||||
$tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#';
|
||||
$tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key;
|
||||
$tag_name = $tags[ $key ]->name;
|
||||
$a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( $topic_count_text_callback( $real_count ) ) . "' style='font-size: " .
|
||||
$a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( call_user_func( 'topic_count_text_callback', $real_count ) ) . "' style='font-size: " .
|
||||
( $smallest + ( ( $count - $min_count ) * $font_step ) )
|
||||
. "$unit;'>$tag_name</a>";
|
||||
}
|
||||
@@ -702,6 +702,26 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for comparing tags based on name
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @access private
|
||||
*/
|
||||
function _wp_tag_cloud_name_sort_cb( $a, $b ) {
|
||||
return strnatcasecmp( $a->name, $b->name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for comparing tags based on count
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @access private
|
||||
*/
|
||||
function _wp_tag_cloud_count_sort_cb( $a, $b ) {
|
||||
return ( $a->count > $b->count );
|
||||
}
|
||||
|
||||
//
|
||||
// Helper functions
|
||||
//
|
||||
|
||||
@@ -236,7 +236,7 @@ function wpautop($pee, $br = 1) {
|
||||
$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
|
||||
$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
|
||||
if ($br) {
|
||||
$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '__autop_newline_preservation_helper', $pee);
|
||||
$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);
|
||||
$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
|
||||
$pee = str_replace('<WPPreserveNewline />', "\n", $pee);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ function wpautop($pee, $br = 1) {
|
||||
* @param array $matches preg_replace_callback matches array
|
||||
* @returns string
|
||||
*/
|
||||
function __autop_newline_preservation_helper( $matches ) {
|
||||
function _autop_newline_preservation_helper( $matches ) {
|
||||
return str_replace("\n", "<WPPreserveNewline />", $matches[0]);
|
||||
}
|
||||
|
||||
@@ -1595,7 +1595,7 @@ function wp_iso_descrambler($string) {
|
||||
return $string;
|
||||
} else {
|
||||
$subject = str_replace('_', ' ', $matches[2]);
|
||||
$subject = preg_replace_callback('#\=([0-9a-f]{2})#i', '__wp_iso_convert', $subject);
|
||||
$subject = preg_replace_callback('#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject);
|
||||
return $subject;
|
||||
}
|
||||
}
|
||||
@@ -1607,7 +1607,7 @@ function wp_iso_descrambler($string) {
|
||||
* @access private
|
||||
* @param $match the preg_replace_callback matches array
|
||||
*/
|
||||
function __wp_iso_convert( $match ) {
|
||||
function _wp_iso_convert( $match ) {
|
||||
return chr( hexdec( strtolower( $match[1] ) ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -546,8 +546,18 @@ function wp_kses_split($string, $allowed_html, $allowed_protocols) {
|
||||
global $pass_allowed_html, $pass_allowed_protocols;
|
||||
$pass_allowed_html = $allowed_html;
|
||||
$pass_allowed_protocols = $allowed_protocols;
|
||||
return preg_replace_callback('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%',
|
||||
create_function('$match', 'global $pass_allowed_html, $pass_allowed_protocols; return wp_kses_split2($match[1], $pass_allowed_html, $pass_allowed_protocols);'), $string);
|
||||
return preg_replace_callback( '%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%', '_wp_kses_split_callback', $string );
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for wp_kses_split.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @access private
|
||||
*/
|
||||
function _wp_kses_split_callback( $match ) {
|
||||
global $pass_allowed_html, $pass_allowed_protocols;
|
||||
return wp_kses_split2( $match[1], $pass_allowed_html, $pass_allowed_protocols );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -223,7 +223,7 @@ function get_the_content($more_link_text = null, $stripteaser = 0) {
|
||||
|
||||
}
|
||||
if ( $preview ) // preview fix for javascript bug with foreign languages
|
||||
$output = preg_replace_callback('/\%u([0-9A-F]{4})/', '__convert_urlencoded_to_entities', $output);
|
||||
$output = preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output);
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -236,8 +236,8 @@ function get_the_content($more_link_text = null, $stripteaser = 0) {
|
||||
* @param array $match Match array from preg_replace_callback
|
||||
* @returns string
|
||||
*/
|
||||
function __convert_urlencoded_to_entities($match) {
|
||||
return '&#' . base_convert($match[1], 16, 10) . ';';
|
||||
function _convert_urlencoded_to_entities( $match ) {
|
||||
return '&#' . base_convert( $match[1], 16, 10 ) . ';';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1162,7 +1162,9 @@ function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) {
|
||||
if ( !isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) )
|
||||
$object->labels['menu_name'] = $object->labels['name'];
|
||||
|
||||
$defaults = array_map( create_function( '$x', $object->hierarchical? 'return $x[1];' : 'return $x[0];' ), $nohier_vs_hier_defaults );
|
||||
foreach ( $nohier_vs_hier_defaults as $key => $value )
|
||||
$defaults[$key] = $object->hierarchical ? $value[1] : $value[0];
|
||||
|
||||
$labels = array_merge( $defaults, $object->labels );
|
||||
return (object)$labels;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user