WordPress.org

Make WordPress Core

Ticket #8723: plugin.diff

File plugin.diff, 2.3 KB (added by wnorris, 9 years ago)
  • wp-includes/plugin.php

     
    664664 * @since 2.2.3
    665665 * @link http://trac.wordpress.org/ticket/3875
    666666 *
    667  * @global array $wp_filter Storage for all of the filters and actions
    668667 * @param string $tag Used in counting how many hooks were applied
    669668 * @param callback $function Used for creating unique id
    670  * @param int|bool $priority Used in counting how many hooks were applied.  If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise.
    671  * @param string $type filter or action
    672  * @return string|bool Unique ID for usage as array key or false if $priority === false and $function is an object reference, and it does not already have a uniqe id.
     669 * @param mixed $deprecated Optional, not used
     670 *
     671 * @return string Unique ID for usage as array key
    673672 */
    674 function _wp_filter_build_unique_id($tag, $function, $priority) {
    675         global $wp_filter;
     673function _wp_filter_build_unique_id($tag, $function, $deprecated = null) {
    676674        static $filter_id_count = 0;
    677675
    678         // If function then just skip all of the tests and not overwrite the following.
    679         if ( is_string($function) )
     676        // Simple Function
     677        if ( is_string($function) ) {
    680678                return $function;
    681         // Object Class Calling
    682         else if (is_object($function[0]) ) {
    683                 $obj_idx = get_class($function[0]).$function[1];
    684                 if ( !isset($function[0]->wp_filter_id) ) {
    685                         if ( false === $priority )
    686                                 return false;
    687                         $obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : 0;
    688                         $function[0]->wp_filter_id = $filter_id_count++;
    689                 } else
    690                         $obj_idx .= $function[0]->wp_filter_id;
    691                 return $obj_idx;
    692679        }
    693         // Static Calling
    694         else if ( is_string($function[0]) )
    695                 return $function[0].$function[1];
     680
     681        if ( is_array($function) ) {
     682                // Object Method
     683                if ( is_object($function[0]) ) {
     684                        if ( !isset($function[0]->wp_filter_id) ) {
     685                                $function[0]->wp_filter_id = $filter_id_count++;
     686                        }
     687                        return get_class($function[0]) . $function[1] . $function[0]->wp_filter_id;
     688                }
     689
     690                // Static Class Method
     691                if ( is_string($function[0]) ) {
     692                        return $function[0] . $function[1];
     693                }
     694        }
    696695}
    697696
    698697?>