~canonical-sysadmins/wordpress/4.4.2

« back to all changes in this revision

Viewing changes to wp-includes/formatting.php

  • Committer: Barry Price
  • Date: 2016-01-07 06:09:42 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: barry.price@canonical.com-20160107060942-1ghv2tqiwm8z0j36
Merge WP4.4.1 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
216
216
 
217
217
        // Look for shortcodes and HTML elements.
218
218
 
219
 
        preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20]++)@', $text, $matches );
 
219
        preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches );
220
220
        $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
221
221
        $found_shortcodes = ! empty( $tagnames );
222
222
        $shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
233
233
                                continue;
234
234
                        } else {
235
235
                                // This is an HTML element delimiter.
 
236
 
 
237
                                // Replace each & with &#038; unless it already looks like an entity.
 
238
                                $curl = preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl );
 
239
 
236
240
                                _wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags );
237
241
                        }
238
242
 
3892
3896
 * @return The value with the callback applied to all non-arrays and non-objects inside it.
3893
3897
 */
3894
3898
function map_deep( $value, $callback ) {
3895
 
        if ( is_array( $value ) || is_object( $value ) ) {
3896
 
                foreach ( $value as &$item ) {
3897
 
                        $item = map_deep( $item, $callback );
3898
 
                }
3899
 
                return $value;
 
3899
        if ( is_array( $value ) ) {
 
3900
                foreach ( $value as $index => $item ) {
 
3901
                        $value[ $index ] = map_deep( $item, $callback );
 
3902
                }
 
3903
        } elseif ( is_object( $value ) ) {
 
3904
                $object_vars = get_object_vars( $value );
 
3905
                foreach ( $object_vars as $property_name => $property_value ) {
 
3906
                        $value->$property_name = map_deep( $property_value, $callback );
 
3907
                }
3900
3908
        } else {
3901
 
                return call_user_func( $callback, $value );
 
3909
                $value = call_user_func( $callback, $value );
3902
3910
        }
 
3911
 
 
3912
        return $value;
3903
3913
}
3904
3914
 
3905
3915
/**
4571
4581
                ?>
4572
4582
                <script type="text/javascript">
4573
4583
                        window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
4574
 
                        !function(a,b,c){function d(a){var c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return d&&d.fillText?(d.textBaseline="top",d.font="600 32px Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56806,55356,56826),0,0),c.toDataURL().length>3e3):("simple"===a?d.fillText(String.fromCharCode(55357,56835),0,0):d.fillText(String.fromCharCode(55356,57135),0,0),0!==d.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g;c.supports={simple:d("simple"),flag:d("flag"),unicode8:d("unicode8")},c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.simple&&c.supports.flag&&c.supports.unicode8||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
 
4584
                        !function(a,b,c){function d(a){var c,d=b.createElement("canvas"),e=d.getContext&&d.getContext("2d");return e&&e.fillText?(e.textBaseline="top",e.font="600 32px Arial","flag"===a?(e.fillText(String.fromCharCode(55356,56806,55356,56826),0,0),d.toDataURL().length>3e3):"diversity"===a?(e.fillText(String.fromCharCode(55356,57221),0,0),c=e.getImageData(16,16,1,1).data.toString(),e.fillText(String.fromCharCode(55356,57221,55356,57343),0,0),c!==e.getImageData(16,16,1,1).data.toString()):("simple"===a?e.fillText(String.fromCharCode(55357,56835),0,0):e.fillText(String.fromCharCode(55356,57135),0,0),0!==e.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g;c.supports={simple:d("simple"),flag:d("flag"),unicode8:d("unicode8"),diversity:d("diversity")},c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.simple&&c.supports.flag&&c.supports.unicode8&&c.supports.diversity||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
4575
4585
                </script>
4576
4586
                <?php
4577
4587
        }
4791
4801
                $short_url = substr( $short_url, 0, $length - 3 ) . '&hellip;';
4792
4802
        }
4793
4803
        return $short_url;
4794
 
}
 
 
b'\\ No newline at end of file'
 
4804
}
 
4805
 
 
4806
/**
 
4807
 * 4.4.x hotfix for hidden configure links on admin dashboard.
 
4808
 *
 
4809
 * @ignore
 
4810
 */
 
4811
function _wp_441_dashboard_display_configure_links_css() { 
 
4812
        echo '<style type="text/css">
 
4813
                .postbox .button-link .edit-box { display: none; }
 
4814
                .wp-admin .edit-box { display: block; opacity: 0; }
 
4815
                .hndle:hover .edit-box, .edit-box:focus { opacity: 1; }
 
4816
                #dashboard-widgets h2 a { text-decoration: underline; }
 
4817
                #dashboard-widgets .hndle .postbox-title-action { float: right; line-height: 1.2; }
 
4818
        </style>';
 
4819
}
 
4820
add_action( 'admin_print_styles-index.php', '_wp_441_dashboard_display_configure_links_css' );
 
 
b'\\ No newline at end of file'