]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/formatting.php
WordPress 4.4.2
[autoinstalls/wordpress.git] / wp-includes / formatting.php
index ff4167d2273e8a175d3d0bca675be400e3f0400f..65758680c810eeb0bf39eed7139ca7f6b7e24050 100644 (file)
@@ -216,7 +216,7 @@ function wptexturize( $text, $reset = false ) {
 
        // Look for shortcodes and HTML elements.
 
-       preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20]++)@', $text, $matches );
+       preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches );
        $tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
        $found_shortcodes = ! empty( $tagnames );
        $shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
@@ -233,6 +233,10 @@ function wptexturize( $text, $reset = false ) {
                                continue;
                        } else {
                                // This is an HTML element delimiter.
+
+                               // Replace each & with &#038; unless it already looks like an entity.
+                               $curl = preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl );
+
                                _wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags );
                        }
 
@@ -3892,14 +3896,20 @@ function sanitize_option( $option, $value ) {
  * @return The value with the callback applied to all non-arrays and non-objects inside it.
  */
 function map_deep( $value, $callback ) {
-       if ( is_array( $value ) || is_object( $value ) ) {
-               foreach ( $value as &$item ) {
-                       $item = map_deep( $item, $callback );
+       if ( is_array( $value ) ) {
+               foreach ( $value as $index => $item ) {
+                       $value[ $index ] = map_deep( $item, $callback );
+               }
+       } elseif ( is_object( $value ) ) {
+               $object_vars = get_object_vars( $value );
+               foreach ( $object_vars as $property_name => $property_value ) {
+                       $value->$property_name = map_deep( $property_value, $callback );
                }
-               return $value;
        } else {
-               return call_user_func( $callback, $value );
+               $value = call_user_func( $callback, $value );
        }
+
+       return $value;
 }
 
 /**
@@ -4524,7 +4534,7 @@ function print_emoji_detection_script() {
                 *
                 * @param string The emoji base URL.
                 */
-               'baseUrl' => apply_filters( 'emoji_url', set_url_scheme( '//s.w.org/images/core/emoji/72x72/' ) ),
+               'baseUrl' => apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/72x72/' ),
 
                /**
                 * Filter the extension of the emoji files.
@@ -4571,7 +4581,7 @@ function print_emoji_detection_script() {
                ?>
                <script type="text/javascript">
                        window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
-                       !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);
+                       !function(a,b,c){function d(a){var c,d=b.createElement("canvas"),e=d.getContext&&d.getContext("2d"),f=String.fromCharCode;return e&&e.fillText?(e.textBaseline="top",e.font="600 32px Arial","flag"===a?(e.fillText(f(55356,56806,55356,56826),0,0),d.toDataURL().length>3e3):"diversity"===a?(e.fillText(f(55356,57221),0,0),c=e.getImageData(16,16,1,1).data.toString(),e.fillText(f(55356,57221,55356,57343),0,0),c!==e.getImageData(16,16,1,1).data.toString()):("simple"===a?e.fillText(f(55357,56835),0,0):e.fillText(f(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);
                </script>
                <?php
        }
@@ -4636,7 +4646,7 @@ function wp_staticize_emoji( $text ) {
        $text = wp_encode_emoji( $text );
 
        /** This filter is documented in wp-includes/formatting.php */
-       $cdn_url = apply_filters( 'emoji_url', set_url_scheme( '//s.w.org/images/core/emoji/72x72/' ) );
+       $cdn_url = apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/72x72/' );
 
        /** This filter is documented in wp-includes/formatting.php */
        $ext = apply_filters( 'emoji_ext', '.png' );
@@ -4791,4 +4801,20 @@ function url_shorten( $url, $length = 35 ) {
                $short_url = substr( $short_url, 0, $length - 3 ) . '&hellip;';
        }
        return $short_url;
-}
\ No newline at end of file
+}
+
+/**
+ * 4.4.x hotfix for hidden configure links on admin dashboard.
+ *
+ * @ignore
+ */
+function _wp_441_dashboard_display_configure_links_css() { 
+       echo '<style type="text/css">
+               .postbox .button-link .edit-box { display: none; }
+               .wp-admin .edit-box { display: block; opacity: 0; }
+               .hndle:hover .edit-box, .edit-box:focus { opacity: 1; }
+               #dashboard-widgets h2 a { text-decoration: underline; }
+               #dashboard-widgets .hndle .postbox-title-action { float: right; line-height: 1.2; }
+       </style>';
+}
+add_action( 'admin_print_styles-index.php', '_wp_441_dashboard_display_configure_links_css' );
\ No newline at end of file