X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0459461f9ea42e0b090759ff6fe5f48360bef750..refs/tags/wordpress-4.5:/wp-includes/formatting.php?ds=sidebyside diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 65758680..14f3852b 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -374,7 +374,7 @@ function wptexturize_primes( $haystack, $needle, $prime, $open_quote, $close_quo */ function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) { // Is it an opening tag or closing tag? - if ( '/' !== $text[1] ) { + if ( isset( $text[1] ) && '/' !== $text[1] ) { $opening_tag = true; $name_offset = 1; } elseif ( 0 == count( $stack ) ) { @@ -1584,12 +1584,12 @@ function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'displa } $title = strtolower($title); - $title = preg_replace('/&.+?;/', '', $title); // kill entities - $title = str_replace('.', '-', $title); if ( 'save' == $context ) { // Convert nbsp, ndash and mdash to hyphens $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title ); + // Convert nbsp, ndash and mdash HTML entities to hyphens + $title = str_replace( array( ' ', ' ', '–', '–', '—', '—' ), '-', $title ); // Strip these characters entirely $title = str_replace( array( @@ -1612,6 +1612,9 @@ function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'displa $title = str_replace( '%c3%97', 'x', $title ); } + $title = preg_replace('/&.+?;/', '', $title); // kill entities + $title = str_replace('.', '-', $title); + $title = preg_replace('/[^%a-z0-9 _-]/', '', $title); $title = preg_replace('/\s+/', '-', $title); $title = preg_replace('|-+|', '-', $title); @@ -2199,9 +2202,9 @@ function make_clickable( $text ) { $nested_code_pre = 0; // Keep track of how many levels link is nested inside
or
foreach ( $textarr as $piece ) {
- if ( preg_match( '|^]|i', $piece ) || preg_match( '|^]|i', $piece ) )
+ if ( preg_match( '|^]|i', $piece ) || preg_match( '|^]|i', $piece ) || preg_match( '|^' === strtolower( $piece ) || '' === strtolower( $piece ) ) )
$nested_code_pre--;
if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
@@ -2336,7 +2339,14 @@ function wp_rel_nofollow( $text ) {
function wp_rel_nofollow_callback( $matches ) {
$text = $matches[1];
$atts = shortcode_parse_atts( $matches[1] );
- $rel = 'nofollow';
+ $rel = 'nofollow';
+
+ if ( preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'http' ) ) . ')%i', $text ) ||
+ preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text )
+ ) {
+ return "";
+ }
+
if ( ! empty( $atts['rel'] ) ) {
$parts = array_map( 'trim', explode( ' ', $atts['rel'] ) );
if ( false === array_search( 'nofollow', $parts ) ) {
@@ -2695,23 +2705,6 @@ function iso8601_to_datetime( $date_string, $timezone = 'user' ) {
}
}
-/**
- * Adds a element attributes to open links in new windows.
- *
- * Comment text in popup windows should be filtered through this. Right now it's
- * a moderately dumb function, ideally it would detect whether a target or rel
- * attribute was already there and adjust its actions accordingly.
- *
- * @since 0.71
- *
- * @param string $text Content to replace links to open in a new window.
- * @return string Content that has filtered links.
- */
-function popuplinks( $text ) {
- $text = preg_replace('//i', "", $text);
- return $text;
-}
-
/**
* Strips out all characters that are not allowable in an email.
*
@@ -3289,7 +3282,11 @@ function ent2ncr( $text ) {
*
* @since 4.3.0
*
- * @param string $text The text to be formatted.
+ * @see _WP_Editors::editor()
+ *
+ * @param string $text The text to be formatted.
+ * @param string $default_editor The default editor for the current user.
+ * It is usually either 'html' or 'tinymce'.
* @return string The formatted text after filter is applied.
*/
function format_for_editor( $text, $default_editor = null ) {
@@ -3302,7 +3299,9 @@ function format_for_editor( $text, $default_editor = null ) {
*
* @since 4.3.0
*
- * @param string $text The formatted text.
+ * @param string $text The formatted text.
+ * @param string $default_editor The default editor for the current user.
+ * It is usually either 'html' or 'tinymce'.
*/
return apply_filters( 'format_for_editor', $text, $default_editor );
}
@@ -3710,7 +3709,6 @@ function sanitize_option( $option, $value ) {
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
- $value = wp_kses_post( $value );
$value = esc_html( $value );
}
break;
@@ -3893,7 +3891,7 @@ function sanitize_option( $option, $value ) {
*
* @param mixed $value The array, object, or scalar.
* @param callable $callback The function to map onto $value.
- * @return The value with the callback applied to all non-arrays and non-objects inside it.
+ * @return mixed The value with the callback applied to all non-arrays and non-objects inside it.
*/
function map_deep( $value, $callback ) {
if ( is_array( $value ) ) {
@@ -4313,6 +4311,9 @@ function wp_basename( $path, $suffix = '' ) {
* @since 3.0.0
*
* @staticvar string|false $dblq
+ *
+ * @param string $text The text to be modified.
+ * @return string The modified text.
*/
function capital_P_dangit( $text ) {
// Simple replacement for titles
@@ -4581,7 +4582,7 @@ function print_emoji_detection_script() {
?>
- .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; }
- ';
-}
-add_action( 'admin_print_styles-index.php', '_wp_441_dashboard_display_configure_links_css' );
\ No newline at end of file