WordPress.org

Make WordPress Core

Ticket #14671: 14671.2.diff

File 14671.2.diff, 4.5 KB (added by jacobsantos, 8 years ago)

Make default to pass all parameters and allowed_args limits.

  • default-filters.php

     
    3838
    3939// Email saves
    4040foreach ( array( 'pre_comment_author_email', 'pre_user_email' ) as $filter ) {
    41         add_filter( $filter, 'trim'           );
     41        add_filter( $filter, 'trim', null, 1  );
    4242        add_filter( $filter, 'sanitize_email' );
    4343        add_filter( $filter, 'wp_filter_kses' );
    4444}
     
    9393// Format titles
    9494foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description' ) as $filter ) {
    9595        add_filter( $filter, 'wptexturize' );
    96         add_filter( $filter, 'strip_tags'  );
     96        add_filter( $filter, 'strip_tags', null, 1  );
    9797}
    9898
    9999// Format text area for display.
     
    112112// Display filters
    113113add_filter( 'the_title', 'wptexturize'   );
    114114add_filter( 'the_title', 'convert_chars' );
    115 add_filter( 'the_title', 'trim'          );
     115add_filter( 'the_title', 'trim', null, 1 );
    116116
    117117add_filter( 'the_content', 'wptexturize'        );
    118118add_filter( 'the_content', 'convert_smilies'    );
     
    143143add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 );
    144144
    145145// RSS filters
    146 add_filter( 'the_title_rss',      'strip_tags'      );
     146add_filter( 'the_title_rss',      'strip_tags', null, 1 );
    147147add_filter( 'the_title_rss',      'ent2ncr',      8 );
    148148add_filter( 'the_title_rss',      'esc_html'        );
    149149add_filter( 'the_content_rss',    'ent2ncr',      8 );
     
    172172add_filter( 'the_posts',            '_close_comments_for_old_posts'       );
    173173add_filter( 'comments_open',        '_close_comments_for_old_post', 10, 2 );
    174174add_filter( 'pings_open',           '_close_comments_for_old_post', 10, 2 );
    175 add_filter( 'editable_slug',        'urldecode'                          );
     175add_filter( 'editable_slug',        'urldecode',                    10, 1 );
    176176add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object'    );
    177177
    178178// Atom SSL support
  • plugin.php

     
    6262 * @param int $accepted_args optional. The number of arguments the function accept (default 1).
    6363 * @return boolean true
    6464 */
    65 function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
     65function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = null) {
    6666        global $wp_filter, $merged_filters;
    6767
    6868        $idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);
     
    247247 * @param int $accepted_args optional. The number of arguments the function accpets (default: 1).
    248248 * @return boolean Whether the function existed before it was removed.
    249249 */
    250 function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
     250function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = null) {
    251251        $function_to_remove = _wp_filter_build_unique_id($tag, $function_to_remove, $priority);
    252252
    253253        $r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
     
    321321 * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
    322322 * @param int $accepted_args optional. The number of arguments the function accept (default 1).
    323323 */
    324 function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
     324function add_action($tag, $function_to_add, $priority = 10, $accepted_args = null) {
    325325        return add_filter($tag, $function_to_add, $priority, $accepted_args);
    326326}
    327327
     
    507507 * @param string $tag The action hook to which the function to be removed is hooked.
    508508 * @param callback $function_to_remove The name of the function which should be removed.
    509509 * @param int $priority optional The priority of the function (default: 10).
    510  * @param int $accepted_args optional. The number of arguments the function accpets (default: 1).
     510 * @param int $accepted_args optional. The number of arguments the function accepts (default: 1).
    511511 * @return boolean Whether the function is removed.
    512512 */
    513 function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
     513function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = null) {
    514514        return remove_filter($tag, $function_to_remove, $priority, $accepted_args);
    515515}
    516516