Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r42201 r42343  
    1515// Strip, trim, kses, special chars for string saves
    1616foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname' ) as $filter ) {
    17     add_filter( $filter, 'sanitize_text_field'  );
    18     add_filter( $filter, 'wp_filter_kses'       );
     17    add_filter( $filter, 'sanitize_text_field' );
     18    add_filter( $filter, 'wp_filter_kses' );
    1919    add_filter( $filter, '_wp_specialchars', 30 );
    2020}
     
    2424    if ( is_admin() ) {
    2525        // These are expensive. Run only on admin pages for defense in depth.
    26         add_filter( $filter, 'sanitize_text_field'  );
    27         add_filter( $filter, 'wp_kses_data'       );
     26        add_filter( $filter, 'sanitize_text_field' );
     27        add_filter( $filter, 'wp_kses_data' );
    2828    }
    2929    add_filter( $filter, '_wp_specialchars', 30 );
     
    4545// Email saves
    4646foreach ( array( 'pre_comment_author_email', 'pre_user_email' ) as $filter ) {
    47     add_filter( $filter, 'trim'           );
     47    add_filter( $filter, 'trim' );
    4848    add_filter( $filter, 'sanitize_email' );
    4949    add_filter( $filter, 'wp_filter_kses' );
     
    5353foreach ( array( 'comment_author_email', 'user_email' ) as $filter ) {
    5454    add_filter( $filter, 'sanitize_email' );
    55     if ( is_admin() )
     55    if ( is_admin() ) {
    5656        add_filter( $filter, 'wp_kses_data' );
     57    }
    5758}
    5859
    5960// Save URL
    60 foreach ( array( 'pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
    61     'pre_link_rss', 'pre_post_guid' ) as $filter ) {
     61foreach ( array(
     62    'pre_comment_author_url',
     63    'pre_user_url',
     64    'pre_link_url',
     65    'pre_link_image',
     66    'pre_link_rss',
     67    'pre_post_guid',
     68) as $filter ) {
    6269    add_filter( $filter, 'wp_strip_all_tags' );
    63     add_filter( $filter, 'esc_url_raw'       );
    64     add_filter( $filter, 'wp_filter_kses'    );
     70    add_filter( $filter, 'esc_url_raw' );
     71    add_filter( $filter, 'wp_filter_kses' );
    6572}
    6673
    6774// Display URL
    6875foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url', 'post_guid' ) as $filter ) {
    69     if ( is_admin() )
     76    if ( is_admin() ) {
    7077        add_filter( $filter, 'wp_strip_all_tags' );
    71     add_filter( $filter, 'esc_url'           );
    72     if ( is_admin() )
    73         add_filter( $filter, 'wp_kses_data'    );
     78    }
     79    add_filter( $filter, 'esc_url' );
     80    if ( is_admin() ) {
     81        add_filter( $filter, 'wp_kses_data' );
     82    }
    7483}
    7584
     
    98107// Format strings for display.
    99108foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description', 'link_notes', 'bloginfo', 'wp_title', 'widget_title' ) as $filter ) {
    100     add_filter( $filter, 'wptexturize'   );
     109    add_filter( $filter, 'wptexturize' );
    101110    add_filter( $filter, 'convert_chars' );
    102     add_filter( $filter, 'esc_html'      );
     111    add_filter( $filter, 'esc_html' );
    103112}
    104113
    105114// Format WordPress
    106 foreach ( array( 'the_content', 'the_title', 'wp_title' ) as $filter )
     115foreach ( array( 'the_content', 'the_title', 'wp_title' ) as $filter ) {
    107116    add_filter( $filter, 'capital_P_dangit', 11 );
     117}
    108118add_filter( 'comment_text', 'capital_P_dangit', 31 );
    109119
     
    111121foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description' ) as $filter ) {
    112122    add_filter( $filter, 'wptexturize' );
    113     add_filter( $filter, 'strip_tags'  );
     123    add_filter( $filter, 'strip_tags' );
    114124}
    115125
    116126// Format text area for display.
    117127foreach ( array( 'term_description', 'get_the_author_description', 'get_the_post_type_description' ) as $filter ) {
    118     add_filter( $filter, 'wptexturize'      );
    119     add_filter( $filter, 'convert_chars'    );
    120     add_filter( $filter, 'wpautop'          );
    121     add_filter( $filter, 'shortcode_unautop');
     128    add_filter( $filter, 'wptexturize' );
     129    add_filter( $filter, 'convert_chars' );
     130    add_filter( $filter, 'wpautop' );
     131    add_filter( $filter, 'shortcode_unautop' );
    122132}
    123133
     
    130140
    131141// Display filters
    132 add_filter( 'the_title', 'wptexturize'   );
     142add_filter( 'the_title', 'wptexturize' );
    133143add_filter( 'the_title', 'convert_chars' );
    134 add_filter( 'the_title', 'trim'          );
    135 
    136 add_filter( 'the_content', 'wptexturize'                       );
    137 add_filter( 'the_content', 'convert_smilies',               20 );
    138 add_filter( 'the_content', 'wpautop'                           );
    139 add_filter( 'the_content', 'shortcode_unautop'                 );
    140 add_filter( 'the_content', 'prepend_attachment'                );
     144add_filter( 'the_title', 'trim' );
     145
     146add_filter( 'the_content', 'wptexturize' );
     147add_filter( 'the_content', 'convert_smilies', 20 );
     148add_filter( 'the_content', 'wpautop' );
     149add_filter( 'the_content', 'shortcode_unautop' );
     150add_filter( 'the_content', 'prepend_attachment' );
    141151add_filter( 'the_content', 'wp_make_content_images_responsive' );
    142152
    143 add_filter( 'the_excerpt',     'wptexturize'      );
    144 add_filter( 'the_excerpt',     'convert_smilies' );
    145 add_filter( 'the_excerpt',     'convert_chars'    );
    146 add_filter( 'the_excerpt',     'wpautop'          );
    147 add_filter( 'the_excerpt',     'shortcode_unautop');
    148 add_filter( 'get_the_excerpt', 'wp_trim_excerpt'  );
    149 
    150 add_filter( 'the_post_thumbnail_caption', 'wptexturize'     );
     153add_filter( 'the_excerpt', 'wptexturize' );
     154add_filter( 'the_excerpt', 'convert_smilies' );
     155add_filter( 'the_excerpt', 'convert_chars' );
     156add_filter( 'the_excerpt', 'wpautop' );
     157add_filter( 'the_excerpt', 'shortcode_unautop' );
     158add_filter( 'get_the_excerpt', 'wp_trim_excerpt' );
     159
     160add_filter( 'the_post_thumbnail_caption', 'wptexturize' );
    151161add_filter( 'the_post_thumbnail_caption', 'convert_smilies' );
    152 add_filter( 'the_post_thumbnail_caption', 'convert_chars'   );
    153 
    154 add_filter( 'comment_text', 'wptexturize'            );
    155 add_filter( 'comment_text', 'convert_chars'          );
    156 add_filter( 'comment_text', 'make_clickable',      9 );
     162add_filter( 'the_post_thumbnail_caption', 'convert_chars' );
     163
     164add_filter( 'comment_text', 'wptexturize' );
     165add_filter( 'comment_text', 'convert_chars' );
     166add_filter( 'comment_text', 'make_clickable', 9 );
    157167add_filter( 'comment_text', 'force_balance_tags', 25 );
    158 add_filter( 'comment_text', 'convert_smilies',    20 );
    159 add_filter( 'comment_text', 'wpautop',            30 );
     168add_filter( 'comment_text', 'convert_smilies', 20 );
     169add_filter( 'comment_text', 'wpautop', 30 );
    160170
    161171add_filter( 'comment_excerpt', 'convert_chars' );
    162172
    163 add_filter( 'list_cats',         'wptexturize' );
     173add_filter( 'list_cats', 'wptexturize' );
    164174
    165175add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 );
    166176
    167 add_filter( 'widget_text',         'balanceTags'          );
     177add_filter( 'widget_text', 'balanceTags' );
    168178add_filter( 'widget_text_content', 'capital_P_dangit', 11 );
    169 add_filter( 'widget_text_content', 'wptexturize'          );
    170 add_filter( 'widget_text_content', 'convert_smilies',  20 );
    171 add_filter( 'widget_text_content', 'wpautop'              );
    172 add_filter( 'widget_text_content', 'shortcode_unautop'    );
    173 add_filter( 'widget_text_content', 'do_shortcode',     11 ); // Runs after wpautop(); note that $post global will be null when shortcodes run.
     179add_filter( 'widget_text_content', 'wptexturize' );
     180add_filter( 'widget_text_content', 'convert_smilies', 20 );
     181add_filter( 'widget_text_content', 'wpautop' );
     182add_filter( 'widget_text_content', 'shortcode_unautop' );
     183add_filter( 'widget_text_content', 'do_shortcode', 11 ); // Runs after wpautop(); note that $post global will be null when shortcodes run.
    174184
    175185add_filter( 'date_i18n', 'wp_maybe_decline_date' );
    176186
    177187// RSS filters
    178 add_filter( 'the_title_rss',      'strip_tags'                    );
    179 add_filter( 'the_title_rss',      'ent2ncr',                    8 );
    180 add_filter( 'the_title_rss',      'esc_html'                      );
    181 add_filter( 'the_content_rss',    'ent2ncr',                    8 );
    182 add_filter( 'the_content_feed',   'wp_staticize_emoji'            );
    183 add_filter( 'the_content_feed',   '_oembed_filter_feed_content'  );
    184 add_filter( 'the_excerpt_rss',    'convert_chars'                );
    185 add_filter( 'the_excerpt_rss',    'ent2ncr',                    8 );
    186 add_filter( 'comment_author_rss', 'ent2ncr',                    8 );
    187 add_filter( 'comment_text_rss',   'ent2ncr',                    8 );
    188 add_filter( 'comment_text_rss',   'esc_html'                      );
    189 add_filter( 'comment_text_rss',   'wp_staticize_emoji'            );
    190 add_filter( 'bloginfo_rss',       'ent2ncr',                    8 );
    191 add_filter( 'the_author',         'ent2ncr',                    8 );
    192 add_filter( 'the_guid',           'esc_url'                      );
     188add_filter( 'the_title_rss', 'strip_tags' );
     189add_filter( 'the_title_rss', 'ent2ncr', 8 );
     190add_filter( 'the_title_rss', 'esc_html' );
     191add_filter( 'the_content_rss', 'ent2ncr', 8 );
     192add_filter( 'the_content_feed', 'wp_staticize_emoji' );
     193add_filter( 'the_content_feed', '_oembed_filter_feed_content' );
     194add_filter( 'the_excerpt_rss', 'convert_chars' );
     195add_filter( 'the_excerpt_rss', 'ent2ncr', 8 );
     196add_filter( 'comment_author_rss', 'ent2ncr', 8 );
     197add_filter( 'comment_text_rss', 'ent2ncr', 8 );
     198add_filter( 'comment_text_rss', 'esc_html' );
     199add_filter( 'comment_text_rss', 'wp_staticize_emoji' );
     200add_filter( 'bloginfo_rss', 'ent2ncr', 8 );
     201add_filter( 'the_author', 'ent2ncr', 8 );
     202add_filter( 'the_guid', 'esc_url' );
    193203
    194204// Email filters
     
    201211
    202212// Misc filters
    203 add_filter( 'option_ping_sites',        'privacy_ping_filter'                );
    204 add_filter( 'option_blog_charset',      '_wp_specialchars'                    ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
    205 add_filter( 'option_blog_charset',      '_canonical_charset'                  );
    206 add_filter( 'option_home',              '_config_wp_home'                    );
    207 add_filter( 'option_siteurl',           '_config_wp_siteurl'                  );
    208 add_filter( 'tiny_mce_before_init',     '_mce_set_direction'                  );
    209 add_filter( 'teeny_mce_before_init',    '_mce_set_direction'                  );
    210 add_filter( 'pre_kses',                 'wp_pre_kses_less_than'              );
    211 add_filter( 'sanitize_title',           'sanitize_title_with_dashes',  10, 3 );
    212 add_action( 'check_comment_flood',      'check_comment_flood_db',      10, 4 );
    213 add_filter( 'comment_flood_filter',     'wp_throttle_comment_flood',    10, 3 );
    214 add_filter( 'pre_comment_content',      'wp_rel_nofollow',              15    );
    215 add_filter( 'comment_email',            'antispambot'                        );
    216 add_filter( 'option_tag_base',          '_wp_filter_taxonomy_base'            );
    217 add_filter( 'option_category_base',     '_wp_filter_taxonomy_base'            );
    218 add_filter( 'the_posts',                '_close_comments_for_old_posts', 10, 2);
    219 add_filter( 'comments_open',            '_close_comments_for_old_post', 10, 2 );
    220 add_filter( 'pings_open',               '_close_comments_for_old_post', 10, 2 );
    221 add_filter( 'editable_slug',            'urldecode'                          );
    222 add_filter( 'editable_slug',            'esc_textarea'                        );
    223 add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object'        );
    224 add_filter( 'pingback_ping_source_uri', 'pingback_ping_source_uri'            );
    225 add_filter( 'xmlrpc_pingback_error',    'xmlrpc_pingback_error'              );
    226 add_filter( 'title_save_pre',           'trim'                                );
     213add_filter( 'option_ping_sites', 'privacy_ping_filter' );
     214add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
     215add_filter( 'option_blog_charset', '_canonical_charset' );
     216add_filter( 'option_home', '_config_wp_home' );
     217add_filter( 'option_siteurl', '_config_wp_siteurl' );
     218add_filter( 'tiny_mce_before_init', '_mce_set_direction' );
     219add_filter( 'teeny_mce_before_init', '_mce_set_direction' );
     220add_filter( 'pre_kses', 'wp_pre_kses_less_than' );
     221add_filter( 'sanitize_title', 'sanitize_title_with_dashes', 10, 3 );
     222add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 );
     223add_filter( 'comment_flood_filter', 'wp_throttle_comment_flood', 10, 3 );
     224add_filter( 'pre_comment_content', 'wp_rel_nofollow', 15 );
     225add_filter( 'comment_email', 'antispambot' );
     226add_filter( 'option_tag_base', '_wp_filter_taxonomy_base' );
     227add_filter( 'option_category_base', '_wp_filter_taxonomy_base' );
     228add_filter( 'the_posts', '_close_comments_for_old_posts', 10, 2 );
     229add_filter( 'comments_open', '_close_comments_for_old_post', 10, 2 );
     230add_filter( 'pings_open', '_close_comments_for_old_post', 10, 2 );
     231add_filter( 'editable_slug', 'urldecode' );
     232add_filter( 'editable_slug', 'esc_textarea' );
     233add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object' );
     234add_filter( 'pingback_ping_source_uri', 'pingback_ping_source_uri' );
     235add_filter( 'xmlrpc_pingback_error', 'xmlrpc_pingback_error' );
     236add_filter( 'title_save_pre', 'trim' );
    227237
    228238add_action( 'transition_comment_status', '_clear_modified_cache_on_transition_comment_status', 10, 2 );
    229239
    230 add_filter( 'http_request_host_is_external',    'allowed_http_request_hosts', 10, 2 );
     240add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 );
    231241
    232242// REST API filters.
    233 add_action( 'xmlrpc_rsd_apis',            'rest_output_rsd' );
    234 add_action( 'wp_head',                    'rest_output_link_wp_head', 10, 0 );
    235 add_action( 'template_redirect',          'rest_output_link_header', 11, 0 );
    236 add_action( 'auth_cookie_malformed',      'rest_cookie_collect_status' );
    237 add_action( 'auth_cookie_expired',        'rest_cookie_collect_status' );
    238 add_action( 'auth_cookie_bad_username',   'rest_cookie_collect_status' );
    239 add_action( 'auth_cookie_bad_hash',       'rest_cookie_collect_status' );
    240 add_action( 'auth_cookie_valid',          'rest_cookie_collect_status' );
     243add_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
     244add_action( 'wp_head', 'rest_output_link_wp_head', 10, 0 );
     245add_action( 'template_redirect', 'rest_output_link_header', 11, 0 );
     246add_action( 'auth_cookie_malformed', 'rest_cookie_collect_status' );
     247add_action( 'auth_cookie_expired', 'rest_cookie_collect_status' );
     248add_action( 'auth_cookie_bad_username', 'rest_cookie_collect_status' );
     249add_action( 'auth_cookie_bad_hash', 'rest_cookie_collect_status' );
     250add_action( 'auth_cookie_valid', 'rest_cookie_collect_status' );
    241251add_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 );
    242252
    243253// Actions
    244 add_action( 'wp_head',             '_wp_render_title_tag',            1     );
    245 add_action( 'wp_head',             'wp_enqueue_scripts',              1     );
    246 add_action( 'wp_head',             'wp_resource_hints',               2     );
    247 add_action( 'wp_head',             'feed_links',                      2     );
    248 add_action( 'wp_head',             'feed_links_extra',                3     );
    249 add_action( 'wp_head',             'rsd_link'                               );
    250 add_action( 'wp_head',             'wlwmanifest_link'                       );
    251 add_action( 'wp_head',             'adjacent_posts_rel_link_wp_head', 10, 0 );
    252 add_action( 'wp_head',             'locale_stylesheet'                      );
    253 add_action( 'publish_future_post', 'check_and_publish_future_post',   10, 1 );
    254 add_action( 'wp_head',             'noindex',                          1    );
    255 add_action( 'wp_head',             'print_emoji_detection_script',     7    );
    256 add_action( 'wp_head',             'wp_print_styles',                  8    );
    257 add_action( 'wp_head',             'wp_print_head_scripts',            9    );
    258 add_action( 'wp_head',             'wp_generator'                           );
    259 add_action( 'wp_head',             'rel_canonical'                          );
    260 add_action( 'wp_head',             'wp_shortlink_wp_head',            10, 0 );
    261 add_action( 'wp_head',             'wp_custom_css_cb',                101   );
    262 add_action( 'wp_head',             'wp_site_icon',                    99    );
    263 add_action( 'wp_footer',           'wp_print_footer_scripts',         20    );
    264 add_action( 'template_redirect',   'wp_shortlink_header',             11, 0 );
    265 add_action( 'wp_print_footer_scripts', '_wp_footer_scripts'                 );
    266 add_action( 'init',                'check_theme_switched',            99    );
    267 add_action( 'after_switch_theme',  '_wp_menus_changed'                      );
    268 add_action( 'after_switch_theme',  '_wp_sidebars_changed'                   );
    269 add_action( 'wp_print_styles',     'print_emoji_styles'                     );
    270 
    271 if ( isset( $_GET['replytocom'] ) )
    272     add_action( 'wp_head', 'wp_no_robots' );
     254add_action( 'wp_head', '_wp_render_title_tag', 1 );
     255add_action( 'wp_head', 'wp_enqueue_scripts', 1 );
     256add_action( 'wp_head', 'wp_resource_hints', 2 );
     257add_action( 'wp_head', 'feed_links', 2 );
     258add_action( 'wp_head', 'feed_links_extra', 3 );
     259add_action( 'wp_head', 'rsd_link' );
     260add_action( 'wp_head', 'wlwmanifest_link' );
     261add_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
     262add_action( 'wp_head', 'locale_stylesheet' );
     263add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );
     264add_action( 'wp_head', 'noindex', 1 );
     265add_action( 'wp_head', 'print_emoji_detection_script', 7 );
     266add_action( 'wp_head', 'wp_print_styles', 8 );
     267add_action( 'wp_head', 'wp_print_head_scripts', 9 );
     268add_action( 'wp_head', 'wp_generator' );
     269add_action( 'wp_head', 'rel_canonical' );
     270add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
     271add_action( 'wp_head', 'wp_custom_css_cb', 101 );
     272add_action( 'wp_head', 'wp_site_icon', 99 );
     273add_action( 'wp_footer', 'wp_print_footer_scripts', 20 );
     274add_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
     275add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
     276add_action( 'init', 'check_theme_switched', 99 );
     277add_action( 'after_switch_theme', '_wp_menus_changed' );
     278add_action( 'after_switch_theme', '_wp_sidebars_changed' );
     279add_action( 'wp_print_styles', 'print_emoji_styles' );
     280
     281if ( isset( $_GET['replytocom'] ) ) {
     282    add_action( 'wp_head', 'wp_no_robots' );
     283}
    273284
    274285// Login actions
    275 add_filter( 'login_head',          'wp_resource_hints',             8    );
    276 add_action( 'login_head',          'wp_print_head_scripts',         9    );
    277 add_action( 'login_head',          'print_admin_styles',            9    );
    278 add_action( 'login_head',          'wp_site_icon',                  99    );
    279 add_action( 'login_footer',        'wp_print_footer_scripts',       20    );
    280 add_action( 'login_init',          'send_frame_options_header',    10, 0 );
     286add_filter( 'login_head', 'wp_resource_hints', 8 );
     287add_action( 'login_head', 'wp_print_head_scripts', 9 );
     288add_action( 'login_head', 'print_admin_styles', 9 );
     289add_action( 'login_head', 'wp_site_icon', 99 );
     290add_action( 'login_footer', 'wp_print_footer_scripts', 20 );
     291add_action( 'login_init', 'send_frame_options_header', 10, 0 );
    281292
    282293// Feed Generator Tags
     
    291302
    292303// WP Cron
    293 if ( !defined( 'DOING_CRON' ) )
     304if ( ! defined( 'DOING_CRON' ) ) {
    294305    add_action( 'init', 'wp_cron' );
     306}
    295307
    296308// 2 Actions 2 Furious
    297 add_action( 'do_feed_rdf',                'do_feed_rdf',                            10, 1 );
    298 add_action( 'do_feed_rss',                'do_feed_rss',                            10, 1 );
    299 add_action( 'do_feed_rss2',               'do_feed_rss2',                            10, 1 );
    300 add_action( 'do_feed_atom',               'do_feed_atom',                            10, 1 );
    301 add_action( 'do_pings',                   'do_all_pings',                            10, 1 );
    302 add_action( 'do_robots',                  'do_robots'                                      );
    303 add_action( 'set_comment_cookies',        'wp_set_comment_cookies',                  10, 2 );
    304 add_action( 'sanitize_comment_cookies',   'sanitize_comment_cookies'                      );
    305 add_action( 'admin_print_scripts',        'print_emoji_detection_script'                  );
    306 add_action( 'admin_print_scripts',        'print_head_scripts',                      20    );
    307 add_action( 'admin_print_footer_scripts', '_wp_footer_scripts'                             );
    308 add_action( 'admin_print_styles',         'print_emoji_styles'                            );
    309 add_action( 'admin_print_styles',         'print_admin_styles',                      20    );
    310 add_action( 'init',                       'smilies_init',                             5    );
    311 add_action( 'plugins_loaded',             'wp_maybe_load_widgets',                    0    );
    312 add_action( 'plugins_loaded',             'wp_maybe_load_embeds',                     0    );
    313 add_action( 'shutdown',                   'wp_ob_end_flush_all',                      1    );
     309add_action( 'do_feed_rdf', 'do_feed_rdf', 10, 1 );
     310add_action( 'do_feed_rss', 'do_feed_rss', 10, 1 );
     311add_action( 'do_feed_rss2', 'do_feed_rss2', 10, 1 );
     312add_action( 'do_feed_atom', 'do_feed_atom', 10, 1 );
     313add_action( 'do_pings', 'do_all_pings', 10, 1 );
     314add_action( 'do_robots', 'do_robots' );
     315add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 2 );
     316add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' );
     317add_action( 'admin_print_scripts', 'print_emoji_detection_script' );
     318add_action( 'admin_print_scripts', 'print_head_scripts', 20 );
     319add_action( 'admin_print_footer_scripts', '_wp_footer_scripts' );
     320add_action( 'admin_print_styles', 'print_emoji_styles' );
     321add_action( 'admin_print_styles', 'print_admin_styles', 20 );
     322add_action( 'init', 'smilies_init', 5 );
     323add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
     324add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 );
     325add_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
    314326// Create a revision whenever a post is updated.
    315 add_action( 'post_updated',               'wp_save_post_revision',                  10, 1 );
    316 add_action( 'publish_post',               '_publish_post_hook',                      5, 1 );
    317 add_action( 'transition_post_status',     '_transition_post_status',                  5, 3 );
    318 add_action( 'transition_post_status',     '_update_term_count_on_transition_post_status', 10, 3 );
    319 add_action( 'comment_form',               'wp_comment_form_unfiltered_html_nonce'          );
    320 add_action( 'admin_init',                 'send_frame_options_header',              10, 0 );
    321 add_action( 'welcome_panel',              'wp_welcome_panel'                              );
     327add_action( 'post_updated', 'wp_save_post_revision', 10, 1 );
     328add_action( 'publish_post', '_publish_post_hook', 5, 1 );
     329add_action( 'transition_post_status', '_transition_post_status', 5, 3 );
     330add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 );
     331add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' );
     332add_action( 'admin_init', 'send_frame_options_header', 10, 0 );
     333add_action( 'welcome_panel', 'wp_welcome_panel' );
    322334
    323335// Cron tasks
    324 add_action( 'wp_scheduled_delete',            'wp_scheduled_delete'      );
    325 add_action( 'wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts'     );
    326 add_action( 'importer_scheduled_cleanup',     'wp_delete_attachment'      );
    327 add_action( 'upgrader_scheduled_cleanup',     'wp_delete_attachment'      );
    328 add_action( 'delete_expired_transients',      'delete_expired_transients' );
     336add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );
     337add_action( 'wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts' );
     338add_action( 'importer_scheduled_cleanup', 'wp_delete_attachment' );
     339add_action( 'upgrader_scheduled_cleanup', 'wp_delete_attachment' );
     340add_action( 'delete_expired_transients', 'delete_expired_transients' );
    329341
    330342// Navigation menu actions
    331 add_action( 'delete_post',                '_wp_delete_post_menu_item'        );
    332 add_action( 'delete_term',                '_wp_delete_tax_menu_item',  10, 3 );
    333 add_action( 'transition_post_status',     '_wp_auto_add_pages_to_menu', 10, 3 );
    334 add_action( 'delete_post',                '_wp_delete_customize_changeset_dependent_auto_drafts' );
     343add_action( 'delete_post', '_wp_delete_post_menu_item' );
     344add_action( 'delete_term', '_wp_delete_tax_menu_item', 10, 3 );
     345add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 );
     346add_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' );
    335347
    336348// Post Thumbnail CSS class filtering
    337 add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add'    );
    338 add_action( 'end_fetch_post_thumbnail_html',   '_wp_post_thumbnail_class_filter_remove' );
     349add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add' );
     350add_action( 'end_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_remove' );
    339351
    340352// Redirect Old Slugs
    341 add_action( 'template_redirect',  'wp_old_slug_redirect'              );
    342 add_action( 'post_updated',       'wp_check_for_changed_slugs', 12, 3 );
     353add_action( 'template_redirect', 'wp_old_slug_redirect' );
     354add_action( 'post_updated', 'wp_check_for_changed_slugs', 12, 3 );
    343355add_action( 'attachment_updated', 'wp_check_for_changed_slugs', 12, 3 );
    344356
     
    350362
    351363// Timezone
    352 add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );
     364add_filter( 'pre_option_gmt_offset', 'wp_timezone_override_offset' );
    353365
    354366// Admin Color Schemes
    355 add_action( 'admin_init', 'register_admin_color_schemes', 1);
     367add_action( 'admin_init', 'register_admin_color_schemes', 1 );
    356368add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
    357369
     
    367379// Check if the user is logged out
    368380add_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
    369 add_filter( 'heartbeat_send',        'wp_auth_check' );
     381add_filter( 'heartbeat_send', 'wp_auth_check' );
    370382add_filter( 'heartbeat_nopriv_send', 'wp_auth_check' );
    371383
    372384// Default authentication filters
    373 add_filter( 'authenticate', 'wp_authenticate_username_password',  20, 3 );
    374 add_filter( 'authenticate', 'wp_authenticate_email_password',     20, 3 );
    375 add_filter( 'authenticate', 'wp_authenticate_spam_check',         99    );
    376 add_filter( 'determine_current_user', 'wp_validate_auth_cookie'          );
     385add_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
     386add_filter( 'authenticate', 'wp_authenticate_email_password', 20, 3 );
     387add_filter( 'authenticate', 'wp_authenticate_spam_check', 99 );
     388add_filter( 'determine_current_user', 'wp_validate_auth_cookie' );
    377389add_filter( 'determine_current_user', 'wp_validate_logged_in_cookie', 20 );
    378390
    379391// Split term updates.
    380 add_action( 'admin_init',        '_wp_check_for_scheduled_split_terms' );
    381 add_action( 'split_shared_term', '_wp_check_split_default_terms',  10, 4 );
     392add_action( 'admin_init', '_wp_check_for_scheduled_split_terms' );
     393add_action( 'split_shared_term', '_wp_check_split_default_terms', 10, 4 );
    382394add_action( 'split_shared_term', '_wp_check_split_terms_in_menus', 10, 4 );
    383395add_action( 'split_shared_term', '_wp_check_split_nav_menu_terms', 10, 4 );
     
    388400add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
    389401add_action( 'after_password_reset', 'wp_password_change_notification' );
    390 add_action( 'register_new_user',      'wp_send_new_user_notifications' );
     402add_action( 'register_new_user', 'wp_send_new_user_notifications' );
    391403add_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
    392404
    393405// REST API actions.
    394 add_action( 'init',          'rest_api_init' );
    395 add_action( 'rest_api_init', 'rest_api_default_filters',   10, 1 );
    396 add_action( 'rest_api_init', 'register_initial_settings',  10 );
     406add_action( 'init', 'rest_api_init' );
     407add_action( 'rest_api_init', 'rest_api_default_filters', 10, 1 );
     408add_action( 'rest_api_init', 'register_initial_settings', 10 );
    397409add_action( 'rest_api_init', 'create_initial_rest_routes', 99 );
    398410add_action( 'parse_request', 'rest_api_loaded' );
     
    423435add_action( 'admin_menu', '_add_post_type_submenus' );
    424436add_action( 'before_delete_post', '_reset_front_page_settings_for_post' );
    425 add_action( 'wp_trash_post',      '_reset_front_page_settings_for_post' );
     437add_action( 'wp_trash_post', '_reset_front_page_settings_for_post' );
    426438add_action( 'change_locale', 'create_initial_post_types' );
    427439
     
    485497
    486498// Embeds
    487 add_action( 'rest_api_init',          'wp_oembed_register_route'              );
     499add_action( 'rest_api_init', 'wp_oembed_register_route' );
    488500add_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );
    489501
    490 add_action( 'wp_head',                'wp_oembed_add_discovery_links'        );
    491 add_action( 'wp_head',                'wp_oembed_add_host_js'                );
    492 
    493 add_action( 'embed_head',             'enqueue_embed_scripts',           1    );
    494 add_action( 'embed_head',             'print_emoji_detection_script'          );
    495 add_action( 'embed_head',             'print_embed_styles'                    );
    496 add_action( 'embed_head',             'wp_print_head_scripts',          20    );
    497 add_action( 'embed_head',             'wp_print_styles',                20    );
    498 add_action( 'embed_head',             'wp_no_robots'                          );
    499 add_action( 'embed_head',             'rel_canonical'                        );
    500 add_action( 'embed_head',             'locale_stylesheet',              30    );
    501 
    502 add_action( 'embed_content_meta',     'print_embed_comments_button'          );
    503 add_action( 'embed_content_meta',     'print_embed_sharing_button'            );
    504 
    505 add_action( 'embed_footer',           'print_embed_sharing_dialog'            );
    506 add_action( 'embed_footer',           'print_embed_scripts'                  );
    507 add_action( 'embed_footer',           'wp_print_footer_scripts',        20    );
    508 
    509 add_filter( 'excerpt_more',           'wp_embed_excerpt_more',          20    );
    510 add_filter( 'the_excerpt_embed',      'wptexturize'                          );
    511 add_filter( 'the_excerpt_embed',      'convert_chars'                        );
    512 add_filter( 'the_excerpt_embed',      'wpautop'                              );
    513 add_filter( 'the_excerpt_embed',      'shortcode_unautop'                    );
    514 add_filter( 'the_excerpt_embed',      'wp_embed_excerpt_attachment'          );
    515 
    516 add_filter( 'oembed_dataparse',       'wp_filter_oembed_result',        10, 3 );
    517 add_filter( 'oembed_response_data',   'get_oembed_response_data_rich', 10, 4 );
    518 add_filter( 'pre_oembed_result',      'wp_filter_pre_oembed_result',    10, 3 );
     502add_action( 'wp_head', 'wp_oembed_add_discovery_links' );
     503add_action( 'wp_head', 'wp_oembed_add_host_js' );
     504
     505add_action( 'embed_head', 'enqueue_embed_scripts', 1 );
     506add_action( 'embed_head', 'print_emoji_detection_script' );
     507add_action( 'embed_head', 'print_embed_styles' );
     508add_action( 'embed_head', 'wp_print_head_scripts', 20 );
     509add_action( 'embed_head', 'wp_print_styles', 20 );
     510add_action( 'embed_head', 'wp_no_robots' );
     511add_action( 'embed_head', 'rel_canonical' );
     512add_action( 'embed_head', 'locale_stylesheet', 30 );
     513
     514add_action( 'embed_content_meta', 'print_embed_comments_button' );
     515add_action( 'embed_content_meta', 'print_embed_sharing_button' );
     516
     517add_action( 'embed_footer', 'print_embed_sharing_dialog' );
     518add_action( 'embed_footer', 'print_embed_scripts' );
     519add_action( 'embed_footer', 'wp_print_footer_scripts', 20 );
     520
     521add_filter( 'excerpt_more', 'wp_embed_excerpt_more', 20 );
     522add_filter( 'the_excerpt_embed', 'wptexturize' );
     523add_filter( 'the_excerpt_embed', 'convert_chars' );
     524add_filter( 'the_excerpt_embed', 'wpautop' );
     525add_filter( 'the_excerpt_embed', 'shortcode_unautop' );
     526add_filter( 'the_excerpt_embed', 'wp_embed_excerpt_attachment' );
     527
     528add_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10, 3 );
     529add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 );
     530add_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10, 3 );
    519531
    520532// Capabilities
Note: See TracChangeset for help on using the changeset viewer.