WordPress.org

Make WordPress Core

Ticket #6237: tabs6.r7315.diff

File tabs6.r7315.diff, 8.8 KB (added by hansengel, 7 years ago)
  • wp-includes/post.php

     
    20712071                $post_date_gmt = current_time('mysql', 1); 
    20722072 
    20732073        if ( empty($post_modified) ) 
    2074                 $post_modified = $post_date; 
     2074                $post_modified = $post_date; 
    20752075        if ( empty($post_modified_gmt) ) 
    2076                 $post_modified_gmt = $post_date_gmt; 
     2076                $post_modified_gmt = $post_date_gmt; 
    20772077 
    20782078        if ( empty($comment_status) ) { 
    20792079                if ( $update ) 
     
    29372937// 
    29382938 
    29392939function _get_post_ancestors(&$_post) { 
    2940     global $wpdb; 
     2940        global $wpdb; 
    29412941 
    2942     if ( !empty($_post->ancestors) ) 
    2943         return; 
     2942        if ( !empty($_post->ancestors) ) 
     2943                return; 
    29442944 
    2945     $_post->ancestors = array(); 
     2945        $_post->ancestors = array(); 
    29462946 
    2947     if ( empty($_post->post_parent) || $_post->ID == $_post->post_parent ) 
    2948         return; 
     2947        if ( empty($_post->post_parent) || $_post->ID == $_post->post_parent ) 
     2948                return; 
    29492949 
    2950     $id = $_post->ancestors[] = $_post->post_parent; 
    2951     while ( $ancestor = $wpdb->get_var("SELECT `post_parent` FROM $wpdb->posts WHERE ID= '{$id}' LIMIT 1") ) { 
    2952         if ( $id == $ancestor ) 
    2953                 break; 
    2954         $id = $_post->ancestors[] = $ancestor; 
    2955     } 
     2950        $id = $_post->ancestors[] = $_post->post_parent; 
     2951        while ( $ancestor = $wpdb->get_var("SELECT `post_parent` FROM $wpdb->posts WHERE ID= '{$id}' LIMIT 1") ) { 
     2952                if ( $id == $ancestor ) 
     2953                        break; 
     2954                $id = $_post->ancestors[] = $ancestor; 
     2955        } 
    29562956} 
    29572957 
    29582958?> 
  • wp-includes/formatting.php

     
    682682 
    683683function convert_smilies($text) { 
    684684        global $wp_smiliessearch, $wp_smiliesreplace; 
    685     $output = ''; 
     685        $output = ''; 
    686686        if ( get_option('use_smilies') && !empty($wp_smiliessearch) && !empty($wp_smiliesreplace) ) { 
    687687                // HTML loop taken from texturize function, could possible be consolidated 
    688688                $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between 
     
    717717 
    718718// used by wp-mail to handle charsets in email subjects 
    719719function wp_iso_descrambler($string) { 
    720   /* this may only work with iso-8859-1, I'm afraid */ 
    721   if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) { 
    722     return $string; 
    723   } else { 
    724     $subject = str_replace('_', ' ', $matches[2]); 
    725     $subject = preg_replace('#\=([0-9a-f]{2})#ei', "chr(hexdec(strtolower('$1')))", $subject); 
    726     return $subject; 
    727   } 
     720        /* this may only work with iso-8859-1, I'm afraid */ 
     721        if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) { 
     722                return $string; 
     723        } else { 
     724                $subject = str_replace('_', ' ', $matches[2]); 
     725                $subject = preg_replace('#\=([0-9a-f]{2})#ei', "chr(hexdec(strtolower('$1')))", $subject); 
     726                return $subject; 
     727        } 
    728728} 
    729729 
    730730 
    731731// give it a date, it will give you the same date as GMT 
    732732function get_gmt_from_date($string) { 
    733   // note: this only substracts $time_difference from the given date 
    734   preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); 
    735   $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 
    736   $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_option('gmt_offset') * 3600); 
    737   return $string_gmt; 
     733        // note: this only substracts $time_difference from the given date 
     734        preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); 
     735        $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 
     736        $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_option('gmt_offset') * 3600); 
     737        return $string_gmt; 
    738738} 
    739739 
    740740// give it a GMT date, it will give you the same date with $time_difference added 
    741741function get_date_from_gmt($string) { 
    742   // note: this only adds $time_difference to the given date 
    743   preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); 
    744   $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 
    745   $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_option('gmt_offset')*3600); 
    746   return $string_localtime; 
     742        // note: this only adds $time_difference to the given date 
     743        preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); 
     744        $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 
     745        $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_option('gmt_offset')*3600); 
     746        return $string_localtime; 
    747747} 
    748748 
    749749// computes an offset in seconds from an iso8601 timezone 
    750750function iso8601_timezone_to_offset($timezone) { 
    751   // $timezone is either 'Z' or '[+|-]hhmm' 
    752   if ($timezone == 'Z') { 
    753     $offset = 0; 
    754   } else { 
    755     $sign    = (substr($timezone, 0, 1) == '+') ? 1 : -1; 
    756     $hours   = intval(substr($timezone, 1, 2)); 
    757     $minutes = intval(substr($timezone, 3, 4)) / 60; 
    758     $offset  = $sign * 3600 * ($hours + $minutes); 
    759   } 
    760   return $offset; 
     751        // $timezone is either 'Z' or '[+|-]hhmm' 
     752        if ($timezone == 'Z') { 
     753                $offset = 0; 
     754        } else { 
     755                $sign    = (substr($timezone, 0, 1) == '+') ? 1 : -1; 
     756                $hours   = intval(substr($timezone, 1, 2)); 
     757                $minutes = intval(substr($timezone, 3, 4)) / 60; 
     758                $offset  = $sign * 3600 * ($hours + $minutes); 
     759        } 
     760        return $offset; 
    761761} 
    762762 
    763763// converts an iso8601 date to MySQL DateTime format used by post_date[_gmt] 
    764764function iso8601_to_datetime($date_string, $timezone = USER) { 
    765   if ($timezone == GMT) { 
    766     preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits); 
    767     if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset 
    768       $offset = iso8601_timezone_to_offset($date_bits[7]); 
    769     } else { // we don't have a timezone, so we assume user local timezone (not server's!) 
    770       $offset = 3600 * get_option('gmt_offset'); 
    771     } 
    772     $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]); 
    773     $timestamp -= $offset; 
    774     return gmdate('Y-m-d H:i:s', $timestamp); 
    775   } elseif ($timezone == USER) { 
    776     return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string); 
    777   } 
     765        if ($timezone == GMT) { 
     766                preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits); 
     767                if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset 
     768                  $offset = iso8601_timezone_to_offset($date_bits[7]); 
     769                } else { // we don't have a timezone, so we assume user local timezone (not server's!) 
     770                  $offset = 3600 * get_option('gmt_offset'); 
     771                } 
     772                $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]); 
     773                $timestamp -= $offset; 
     774                return gmdate('Y-m-d H:i:s', $timestamp); 
     775        } elseif ($timezone == USER) { 
     776                return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string); 
     777        } 
    778778} 
    779779 
    780780function popuplinks($text) { 
  • wp-content/themes/default/functions.php

     
    11<?php 
    22if ( function_exists('register_sidebar') ) 
    3     register_sidebar(array( 
    4         'before_widget' => '<li id="%1$s" class="widget %2$s">', 
    5         'after_widget' => '</li>', 
    6         'before_title' => '<h2 class="widgettitle">', 
    7         'after_title' => '</h2>', 
    8     )); 
     3        register_sidebar(array( 
     4                'before_widget' => '<li id="%1$s" class="widget %2$s">', 
     5                'after_widget' => '</li>', 
     6                'before_title' => '<h2 class="widgettitle">', 
     7                'after_title' => '</h2>', 
     8        )); 
    99 
    1010function kubrick_head() { 
    1111        $head = "<style type='text/css'>\n<!--"; 
  • wp-content/themes/default/comments-popup.php

     
    66<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    77<html xmlns="http://www.w3.org/1999/xhtml"> 
    88<head> 
    9      <title><?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?></title> 
     9        <title><?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?></title> 
    1010 
    1111        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> 
    1212        <style type="text/css" media="screen">