Make WordPress Core

Ticket #29803: 29803.diff

File 29803.diff, 2.5 KB (added by leewillis77, 12 years ago)
  • wp-includes/class-wp-embed.php

     
    9797         * @param string $regex The regex that will be used to see if this handler should be used for a URL.
    9898         * @param callback $callback The callback function that will be called if the regex is matched.
    9999         * @param int $priority Optional. Used to specify the order in which the registered handlers will be tested (default: 10). Lower numbers correspond with earlier testing, and handlers with the same priority are tested in the order in which they were added to the action.
     100         * @return bool True if the callback is currently callable, false otherwise. Note - the callback will be registered regardless.
    100101         */
    101102        public function register_handler( $id, $regex, $callback, $priority = 10 ) {
    102103                $this->handlers[$priority][$id] = array(
    103104                        'regex'    => $regex,
    104105                        'callback' => $callback,
    105106                );
     107                return is_callable( $callback );
    106108        }
    107109
    108110        /**
  • wp-includes/media.php

     
    20582058/**
    20592059 * Register an embed handler. This function should probably only be used for sites that do not support oEmbed.
    20602060 *
     2061 * This function will always register the requested handler, but will return false if the requested callback
     2062 * is currently uncallable.
     2063 *
    20612064 * @since 2.9.0
    20622065 * @see WP_Embed::register_handler()
     2066 *
     2067 * @param string $id An internal ID/name for the handler. Needs to be unique.
     2068 * @param string $regex The regex that will be used to see if this handler should be used for a URL.
     2069 * @param callback $callback The callback function that will be called if the regex is matched.
     2070 * @param int $priority Optional. Used to specify the order in which the registered handlers will be tested (default: 10). Lower numbers correspond with earlier testing, and handlers with the same priority are tested in the order in which they were added to the action.
     2071 * @return bool True if the callback is currently callable, false otherwise. Note - the callback will be registered regardless.
    20632072 */
    20642073function wp_embed_register_handler( $id, $regex, $callback, $priority = 10 ) {
    20652074        global $wp_embed;
    2066         $wp_embed->register_handler( $id, $regex, $callback, $priority );
     2075        return $wp_embed->register_handler( $id, $regex, $callback, $priority );
    20672076}
    20682077
    20692078/**