Make WordPress Core


Ignore:
Timestamp:
02/28/2015 10:35:27 AM (10 years ago)
Author:
ocean90
Message:

Press This: Backwards compatibility enhancements.

  • Add missing actions for printing styles/scripts.
  • Since $hook_suffix is null, hardcode press-this.php.
  • Restore body classes, add filter.
  • Use boolean value instead of __return_false().
  • Use wp_json_encode().
  • Update docs for filters in script-loader.php.
  • Make <a href="%1$s">%2$s</a> not translatable.

see #31373.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-press-this.php

    r31577 r31588  
    5353             * @param bool $redir_in_parent Whether to redirect in parent window or not. Default false.
    5454             */
    55             'redir_in_parent' => apply_filters( 'press_this_redirect_in_parent', __return_false() ),
     55            'redir_in_parent' => apply_filters( 'press_this_redirect_in_parent', false ),
    5656        );
    5757    }
     
    378378        }
    379379
    380         if ( preg_match_all( '/<meta ([^>]+)[\s]?\/?>/  ', $source_content, $matches ) ) {
     380        if ( preg_match_all( '/<meta ([^>]+)[\s]?\/?>/', $source_content, $matches ) ) {
    381381            if ( ! empty( $matches[0] ) ) {
    382382                foreach ( $matches[0] as $key => $value ) {
     
    666666     */
    667667    public function html() {
    668         global $wp_locale, $hook_suffix;
     668        global $wp_locale, $wp_version;
    669669
    670670        // Get data, new (POST) and old (GET).
     
    699699
    700700    <script>
    701         window.wpPressThisData   = <?php echo json_encode( $data ) ?>;
    702         window.wpPressThisConfig = <?php echo json_encode( $site_settings ) ?>;
     701        window.wpPressThisData   = <?php echo wp_json_encode( $data ) ?>;
     702        window.wpPressThisConfig = <?php echo wp_json_encode( $site_settings ) ?>;
    703703    </script>
    704704
     
    710710            thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
    711711            decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
    712             isRtl = <?php echo esc_js( (int) is_rtl() ); ?>;
     712            isRtl = <?php echo (int) is_rtl(); ?>;
    713713    </script>
    714714
     
    739739
    740740        /** This action is documented in wp-admin/admin-header.php */
    741         do_action( 'admin_enqueue_scripts', $hook_suffix );
     741        do_action( 'admin_enqueue_scripts', 'press-this.php' );
     742
     743        /** This action is documented in wp-admin/admin-header.php */
     744        do_action( 'admin_print_styles-press-this.php' );
    742745
    743746        /** This action is documented in wp-admin/admin-header.php */
     
    745748
    746749        /** This action is documented in wp-admin/admin-header.php */
     750        do_action( 'admin_print_scripts-press-this.php' );
     751
     752        /** This action is documented in wp-admin/admin-header.php */
    747753        do_action( 'admin_print_scripts' );
    748754
     755        /** This action is documented in wp-admin/admin-header.php */
     756        do_action( 'admin_head-press-this.php' );
     757
     758        /** This action is documented in wp-admin/admin-header.php */
     759        do_action( 'admin_head' );
    749760    ?>
    750761</head>
    751 <body>
     762<?php
     763$admin_body_class  = 'press-this';
     764$admin_body_class .= ( is_rtl() ) ? ' rtl' : '';
     765$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
     766$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
     767$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
     768$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
     769
     770/** This filter is documented in wp-admin/admin-header.php */
     771$admin_body_classes = apply_filters( 'admin_body_class', '' );
     772?>
     773<body class="wp-admin wp-core-ui <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
    752774    <div id="adminbar" class="adminbar">
    753775        <h1 id="current-site" class="current-site">
     
    895917    /** This action is documented in wp-admin/admin-footer.php */
    896918    do_action( 'admin_footer' );
     919
    897920    /** This action is documented in wp-admin/admin-footer.php */
    898921    do_action( 'admin_print_footer_scripts' );
     922
     923    /** This action is documented in wp-admin/admin-footer.php */
     924    do_action( 'admin_footer-press-this.php' );
    899925    ?>
    900926</body>
Note: See TracChangeset for help on using the changeset viewer.