Ticket #5418: 5418.wp-includes.root.diff

File 5418.wp-includes.root.diff, 61.2 kB (added by DD32, 10 months ago)

/wp-includes/*.php + /*.php variable cleanup + indenting + typos

  • wp-app.php

    old new  
    215215         * Create Post (No arguments) 
    216216         */ 
    217217        function create_post() { 
    218                 global $blog_id, $wpdb
     218                global $blog_id, $user_ID
    219219                $this->get_accepted_content_type($this->atom_content_types); 
    220220 
    221221                $parser = new AtomParser(); 
     
    249249 
    250250                $blog_ID = (int ) $blog_id; 
    251251                $post_status = ($publish) ? 'publish' : 'draft'; 
    252                 $post_author = (int) $user->ID; 
     252                $post_author = (int) $user_ID; 
    253253                $post_title = $entry->title[1]; 
    254254                $post_content = $entry->content[1]; 
    255255                $post_excerpt = $entry->summary[1]; 
     
    269269                if ( is_wp_error( $postID ) ) 
    270270                        $this->internal_error($postID->get_error_message()); 
    271271 
    272                 if (!$postID) { 
     272                if (!$postID) 
    273273                        $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.')); 
    274                 } 
    275274 
    276275                // getting warning here about unable to set headers 
    277276                // because something in the cache is printing to the buffer 
     
    296295        } 
    297296 
    298297        function put_post($postID) { 
    299                 global $wpdb; 
    300  
    301298                // checked for valid content-types (atom+xml) 
    302299                // quick check and exit 
    303300                $this->get_accepted_content_type($this->atom_content_types); 
     
    313310 
    314311                // check for not found 
    315312                global $entry; 
    316                 $entry = $GLOBALS['entry']; 
    317313                $this->set_current_entry($postID); 
    318314 
    319315                if(!current_user_can('edit_post', $entry['ID'])) 
     
    376372        } 
    377373 
    378374        function get_attachment($postID = NULL) { 
    379  
    380                 global $entry; 
    381375                if (!isset($postID)) { 
    382376                        $this->get_attachments(); 
    383377                } else { 
     
    389383        } 
    390384 
    391385        function create_attachment() { 
    392                 global $wp, $wpdb, $wp_query, $blog_id; 
    393386 
    394387                $type = $this->get_accepted_content_type(); 
    395388 
     
    418411 
    419412                $url = $file['url']; 
    420413                $file = $file['file']; 
    421                 $filename = basename($file); 
    422414 
    423                 $header = apply_filters('wp_create_file_in_uploads', $file); // replicate 
     415                apply_filters('wp_create_file_in_uploads', $file); // replicate 
    424416 
    425417                // Construct the attachment array 
    426418                $attachment = array( 
     
    433425                        ); 
    434426 
    435427                // Save the data 
    436                 $postID = wp_insert_attachment($attachment, $file, $post); 
     428                $postID = wp_insert_attachment($attachment, $file); 
    437429 
    438                 if (!$postID) { 
     430                if (!$postID) 
    439431                        $this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.')); 
    440                 } 
    441432 
    442433                $output = $this->get_entry($postID, 'attachment'); 
    443434 
     
    446437        } 
    447438 
    448439        function put_attachment($postID) { 
    449                 global $wpdb; 
    450  
    451440                // checked for valid content-types (atom+xml) 
    452441                // quick check and exit 
    453442                $this->get_accepted_content_type($this->atom_content_types); 
     
    466455                if(!current_user_can('edit_post', $entry['ID'])) 
    467456                        $this->auth_required(__('Sorry, you do not have the right to edit this post.')); 
    468457 
    469                 $publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true; 
    470  
    471458                extract($entry); 
    472459 
    473460                $post_title = $parsed->title[1]; 
     
    546533 
    547534        function put_file($postID) { 
    548535 
    549                 $type = $this->get_accepted_content_type(); 
    550  
    551536                // first check if user can upload 
    552537                if(!current_user_can('upload_files')) 
    553538                        $this->auth_required(__('You do not have permission to upload files.')); 
     
    605590        } 
    606591 
    607592        function the_entries_url($page = NULL) { 
    608                 $url = $this->get_entries_url($page); 
    609                 echo $url; 
     593                echo $this->get_entries_url($page); 
    610594        } 
    611595 
    612         function get_categories_url($page = NULL) { 
     596        function get_categories_url($deprecated = '') { 
    613597                return $this->app_base . $this->CATEGORIES_PATH; 
    614598        } 
    615599 
    616600        function the_categories_url() { 
    617                 $url = $this->get_categories_url(); 
    618                 echo $url; 
     601                echo $this->get_categories_url(); 
    619602        } 
    620603 
    621604        function get_attachments_url($page = NULL) { 
     
    627610        } 
    628611 
    629612        function the_attachments_url($page = NULL) { 
    630                 $url = $this->get_attachments_url($page); 
    631                 echo $url; 
     613                echo $this->get_attachments_url($page); 
    632614        } 
    633615 
    634616        function get_service_url() { 
     
    638620        function get_entry_url($postID = NULL) { 
    639621                if(!isset($postID)) { 
    640622                        global $post; 
    641                         $postID = (int) $GLOBALS['post']->ID; 
     623                        $postID = (int) $post->ID; 
    642624                } 
    643625 
    644626                $url = $this->app_base . $this->ENTRY_PATH . "/$postID"; 
     
    648630        } 
    649631 
    650632        function the_entry_url($postID = NULL) { 
    651                 $url = $this->get_entry_url($postID); 
    652                 echo $url; 
     633                echo $this->get_entry_url($postID); 
    653634        } 
    654635 
    655636        function get_media_url($postID = NULL) { 
    656637                if(!isset($postID)) { 
    657638                        global $post; 
    658                         $postID = (int) $GLOBALS['post']->ID; 
     639                        $postID = (int) $post->ID; 
    659640                } 
    660641 
    661642                $url = $this->app_base . $this->MEDIA_SINGLE_PATH ."/file/$postID"; 
     
    665646        } 
    666647 
    667648        function the_media_url($postID = NULL) { 
    668                 $url = $this->get_media_url($postID); 
    669                 echo $url; 
     649                echo $this->get_media_url($postID); 
    670650        } 
    671651 
    672652        function set_current_entry($postID) { 
     
    759739        function get_entry($postID, $post_type = 'post') { 
    760740                log_app('function',"get_entry($postID, '$post_type')"); 
    761741                ob_start(); 
    762                 global $posts, $post, $wp_query, $wp, $wpdb, $blog_id; 
    763742                switch($post_type) { 
    764743                        case 'post': 
    765744                                $varname = 'p'; 
  • wp-includes/author-template.php

    old new  
    316316 * @return string The URL to the author's page. 
    317317 */ 
    318318function get_author_posts_url($author_id, $author_nicename = '') { 
    319         global $wpdb, $wp_rewrite, $post
     319        global $wp_rewrite
    320320        $auth_ID = (int) $author_id; 
    321321        $link = $wp_rewrite->get_author_permastruct(); 
    322322 
  • wp-includes/canonical.php

    old new  
    22// Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference" by Mark Jaquith 
    33 
    44function redirect_canonical($requested_url=NULL, $do_redirect=true) { 
    5         global $wp_rewrite, $posts, $is_IIS; 
     5        global $wp_rewrite, $is_IIS; 
    66 
    77        if ( is_feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() ) 
    88                return; 
     
    176176} 
    177177 
    178178function redirect_guess_404_permalink() { 
    179         global $wp_query, $wpdb; 
     179        global $wpdb; 
    180180        if ( !get_query_var('name') ) 
    181181                return false; 
    182182 
  • wp-includes/capabilities.php

    old new  
    138138        var $allcaps = array(); 
    139139 
    140140        function WP_User($id, $name = '') { 
    141                 global $wpdb; 
    142141 
    143142                if ( empty($id) && empty($name) ) 
    144143                        return; 
  • wp-includes/category-template.php

    old new  
    6666} 
    6767 
    6868function get_the_category($id = false) { 
    69         global $post, $term_cache, $blog_id
     69        global $post, $term_cache
    7070 
    7171        $id = (int) $id; 
    7272        if ( !$id ) 
     
    168168} 
    169169 
    170170function in_category( $category ) { // Check if the current post is in the given category 
    171         global $post, $blog_id
     171        global $post
    172172 
    173173        $categories = get_object_term_cache($post->ID, 'category'); 
    174174        if ( false === $categories ) 
  • wp-includes/category.php

    old new  
    11<?php 
    22 
    33function get_all_category_ids() { 
    4         global $wpdb; 
    5  
    64        if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) { 
    75                $cat_ids = get_terms('category', 'fields=ids&get=all'); 
    86                wp_cache_add('all_category_ids', $cat_ids, 'category'); 
     
    3937} 
    4038 
    4139function get_category_by_path($category_path, $full_match = true, $output = OBJECT) { 
    42         global $wpdb; 
    4340        $category_path = rawurlencode(urldecode($category_path)); 
    4441        $category_path = str_replace('%2F', '/', $category_path); 
    4542        $category_path = str_replace('%20', ' ', $category_path); 
     
    8683 
    8784// Get the ID of a category from its name 
    8885function get_cat_ID($cat_name='General') { 
    89         global $wpdb; 
    90  
    9186        $cat = get_term_by('name', $cat_name, 'category'); 
    9287        if ($cat) 
    9388                return $cat->term_id; 
     
    132127// Tags 
    133128 
    134129function &get_tags($args = '') { 
    135         global $wpdb, $category_links; 
    136  
    137130        $key = md5( serialize( $args ) ); 
    138131        if ( $cache = wp_cache_get( 'get_tags', 'category' ) ) 
    139132                if ( isset( $cache[ $key ] ) ) 
  • wp-includes/comment-template.php

    old new  
    3838} 
    3939 
    4040function get_comment_author_link() { 
    41         global $comment; 
    4241        $url    = get_comment_author_url(); 
    4342        $author = get_comment_author(); 
    4443 
     
    7271} 
    7372 
    7473function get_comment_author_url_link( $linktext = '', $before = '', $after = '' ) { 
    75         global $comment; 
    7674        $url = get_comment_author_url(); 
    7775        $display = ($linktext != '') ? $linktext : $url; 
    7876        $display = str_replace( 'http://www.', '', $display ); 
     
    146144} 
    147145 
    148146function get_comments_number( $post_id = 0 ) { 
    149         global $wpdb, $id; 
    150147        $post_id = (int) $post_id; 
    151148 
    152149        if ( !$post_id ) 
     
    237234} 
    238235 
    239236function trackback_rdf($timezone = 0) { 
    240         global $id; 
    241237        if (stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') === false) { 
    242238                echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    243239                                xmlns:dc="http://purl.org/dc/elements/1.1/" 
     
    309305} 
    310306 
    311307function comments_popup_script($width=400, $height=400, $file='') { 
    312                 global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript; 
     308                global $wpcommentspopupfile, $wpcommentsjavascript; 
    313309 
    314310                if (empty ($file)) { 
    315311                        $wpcommentspopupfile = '';  // Use the index. 
     
    323319} 
    324320 
    325321function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') { 
    326         global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb
     322        global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post
    327323 
    328324        if ( is_single() || is_page() ) 
    329325                return; 
  • wp-includes/comment.php

    old new  
    105105 
    106106// Deprecate in favor of get_comment()? 
    107107function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { // less flexible, but saves DB queries 
    108         global $postc, $id, $commentdata, $wpdb; 
     108        global $postc, $id, $wpdb; 
    109109        if ( $no_cache ) { 
    110110                $query = $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d", $comment_ID); 
    111111                if ( false == $include_unapproved ) 
     
    129129 
    130130 
    131131function get_lastcommentmodified($timezone = 'server') { 
    132         global $cache_lastcommentmodified, $pagenow, $wpdb; 
     132        global $cache_lastcommentmodified, $wpdb; 
    133133        $add_seconds_blog = get_option('gmt_offset') * 3600; 
    134134        $add_seconds_server = date('Z'); 
    135135        $now = current_time('mysql', 1); 
     
    228228} 
    229229 
    230230function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) { 
    231         global $wpdb; 
    232  
    233231        do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent); 
    234232 
    235233        if ( preg_match_all('/&#(\d+);/', $comment . $author . $url, $chars) ) { 
     
    293291 
    294292 
    295293function wp_get_comment_status($comment_id) { 
    296         global $wpdb; 
    297  
    298294        $comment = get_comment($comment_id); 
    299295        if ( !$comment ) 
    300296                return false; 
     
    686682 
    687683 
    688684function pingback($content, $post_ID) { 
    689         global $wp_version, $wpdb
     685        global $wp_version
    690686        include_once(ABSPATH . WPINC . '/class-IXR.php'); 
    691687 
    692688        // original code by Mort (http://mort.mine.nu:8080) 
  • wp-includes/feed.php

    old new  
    9898} 
    9999 
    100100 
    101 function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = 'nolongerused') { 
     101function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') { 
    102102        $url = get_post_comments_feed_link(); 
    103103        echo "<a href='$url'>$link_text</a>"; 
    104104} 
    105105 
    106106 
    107 function comments_rss($commentsrssfilename = 'nolongerused') { 
     107function comments_rss($deprecated = '') { 
    108108        return get_post_comments_feed_link(); 
    109109} 
    110110 
    111111 
    112112function get_author_rss_link($echo = false, $author_id, $author_nicename) { 
    113         $auth_ID = (int) $author_id; 
     113        $author_id = (int) $author_id; 
    114114        $permalink_structure = get_option('permalink_structure'); 
    115115 
    116116        if ( '' == $permalink_structure ) { 
     
    168168} 
    169169 
    170170 
    171 function get_category_rss_link($echo = false, $cat_ID, $category_nicename) { 
    172         $link = get_category_feed_link($cat_ID, $feed = 'rss2'); 
     171function get_category_rss_link($echo = false, $cat_ID, $deprecated = '') { 
     172        $link = get_category_feed_link($cat_ID, 'rss2'); 
    173173 
    174174        if ( $echo ) 
    175175                echo $link; 
     
    180180function get_the_category_rss($type = 'rss') { 
    181181        $categories = get_the_category(); 
    182182        $tags = get_the_tags(); 
    183         $home = get_bloginfo_rss('home'); 
    184183        $the_list = ''; 
    185184        $cat_names = array(); 
    186185 
     
    252251 
    253252 
    254253function rss_enclosure() { 
    255         global $id, $post; 
     254        global $post; 
    256255        if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) 
    257256                return; 
    258257 
     
    267266} 
    268267 
    269268function atom_enclosure() { 
    270         global $id, $post; 
     269        global $post; 
    271270        if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) 
    272271                return; 
    273272 
  • wp-includes/formatting.php

    old new  
    363363        return $title; 
    364364} 
    365365 
    366 function convert_chars($content, $flag = 'obsolete') { 
     366function convert_chars($content, $deprecated = '') { 
    367367        // Translation of invalid Unicode references range to valid range 
    368368        $wp_htmltranswinuni = array( 
    369369        '&#128;' => '&#8364;', // the Euro sign 
     
    560560} 
    561561 
    562562function format_to_post($content) { 
    563         global $wpdb; 
    564563        $content = apply_filters('format_to_post', $content); 
    565564        return $content; 
    566565} 
     
    783782        } else if (($diff <= 86400) && ($diff > 3600)) { 
    784783                $hours = round($diff / 3600); 
    785784                if ($hours <= 1) { 
    786                         $hour = 1; 
     785                        $hours = 1; 
    787786                } 
    788787                $since = sprintf(__ngettext('%s hour', '%s hours', $hours), $hours); 
    789788        } elseif ($diff >= 86400) { 
     
    797796} 
    798797 
    799798function wp_trim_excerpt($text) { // Fakes an excerpt if needed 
    800         global $post; 
    801799        if ( '' == $text ) { 
    802800                $text = get_the_content(''); 
    803801                $text = apply_filters('the_content', $text); 
  • wp-includes/functions.php

    old new  
    108108} 
    109109 
    110110 
    111 function get_weekstartend( $mysqlstring, $start_of_week ) { 
     111function get_weekstartend( $mysqlstring, $start_of_week = '' ) { 
    112112        $my = substr( $mysqlstring, 0, 4 ); 
    113113        $mm = substr( $mysqlstring, 8, 2 ); 
    114114        $md = substr( $mysqlstring, 5, 2 ); 
    115115        $day = mktime( 0, 0, 0, $md, $mm, $my ); 
    116116        $weekday = date( 'w', $day ); 
    117117        $i = 86400; 
     118        if( !is_numeric($a) ) 
     119                $start_of_week = get_option( 'start_of_week' ); 
    118120 
    119         if ( $weekday < get_option( 'start_of_week' )
    120                 $weekday = 7 - ( get_option( 'start_of_week' ) - $weekday )
     121        if ( $weekday < $start_of_week
     122                $weekday = 7 - $start_of_week - $weekday
    121123 
    122         while ( $weekday > get_option( 'start_of_week' ) ) { 
     124        while ( $weekday > $start_of_week ) { 
    123125                $weekday = date( 'w', $day ); 
    124                 if ( $weekday < get_option( 'start_of_week' )
    125                         $weekday = 7 - ( get_option( 'start_of_week' ) - $weekday )
     126                if ( $weekday < $start_of_week
     127                        $weekday = 7 - $start_of_week - $weekday
    126128 
    127                 $day = $day - 86400; 
     129                $day -= 86400; 
    128130                $i = 0; 
    129131        } 
    130132        $week['start'] = $day + 86400 - $i; 
     
    488490} 
    489491 
    490492function do_enclose( $content, $post_ID ) { 
    491         global $wp_version, $wpdb; 
     493        global $wpdb; 
    492494        include_once( ABSPATH . WPINC . '/class-IXR.php' ); 
    493495 
    494496        $log = debug_fopen( ABSPATH . 'enclosures.log', 'a' ); 
     
    10281030        return apply_filters( 'upload_dir', $uploads ); 
    10291031} 
    10301032 
    1031 function wp_upload_bits( $name, $type, $bits ) { 
     1033function wp_upload_bits( $name, $deprecated, $bits ) { 
    10321034        if ( empty( $name ) ) 
    10331035                return array( 'error' => __( "Empty filename" ) ); 
    10341036 
     
    10661068        if ( ! $ifp ) 
    10671069                return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) ); 
    10681070 
    1069         $success = @fwrite( $ifp, $bits ); 
     1071        @fwrite( $ifp, $bits ); 
    10701072        fclose( $ifp ); 
    10711073        // Set correct file permissions 
    10721074        $stat = @ stat( dirname( $new_file ) ); 
     
    12111213 
    12121214 
    12131215function wp_nonce_ays( $action ) { 
    1214         global $pagenow, $menu, $submenu, $parent_file, $submenu_file
     1216        global $pagenow
    12151217 
    12161218        $adminurl = get_option( 'siteurl' ) . '/wp-admin'; 
    12171219        if ( wp_get_referer() ) 
     
    14991501                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    15001502                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    15011503 
    1502                  $data = curl_exec ($ch); 
     1504                 curl_exec($ch); 
    15031505 
    15041506                 $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); 
    15051507                 curl_close ($ch); 
  • wp-includes/general-template.php

    old new  
    164164 
    165165        $cat = get_query_var('cat'); 
    166166        $tag = get_query_var('tag_id'); 
    167         $p = get_query_var('p'); 
    168         $name = get_query_var('name'); 
    169167        $category_name = get_query_var('category_name'); 
    170168        $author = get_query_var('author'); 
    171169        $author_name = get_query_var('author_name'); 
     
    386384                $archive_week_end_date_format = get_option('date_format'); 
    387385        } 
    388386 
    389         $add_hours = intval(get_option('gmt_offset')); 
    390         $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours)); 
    391  
    392387        //filters 
    393388        $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r ); 
    394389        $join = apply_filters('getarchives_join', "", $r); 
     
    524519 
    525520 
    526521function get_calendar($initial = true) { 
    527         global $wpdb, $m, $monthnum, $year, $timedifference, $wp_locale, $posts; 
     522        global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; 
    528523 
    529524        $key = md5( $m . $monthnum . $year ); 
    530525        if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) { 
     
    547542 
    548543        // week_begins = 0 stands for Sunday 
    549544        $week_begins = intval(get_option('start_of_week')); 
    550         $add_hours = intval(get_option('gmt_offset')); 
    551         $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours)); 
    552545 
    553546        // Let's figure out when we are 
    554547        if ( !empty($monthnum) && !empty($year) ) { 
     
    560553                $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's 
    561554                $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')"); 
    562555        } elseif ( !empty($m) ) { 
    563                 $calendar = substr($m, 0, 6); 
    564556                $thisyear = ''.intval(substr($m, 0, 4)); 
    565557                if ( strlen($m) < 6 ) 
    566558                                $thismonth = '01'; 
     
    755747 
    756748 
    757749function the_date($d='', $before='', $after='', $echo = true) { 
    758         global $id, $post, $day, $previousday; 
     750        global $post, $day, $previousday; 
    759751        $the_date = ''; 
    760752        if ( $day != $previousday ) { 
    761753                $the_date .= $before; 
     
    842834 
    843835 
    844836function the_weekday() { 
    845         global $wp_locale, $id, $post; 
     837        global $wp_locale, $post; 
    846838        $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date)); 
    847839        $the_weekday = apply_filters('the_weekday', $the_weekday); 
    848840        echo $the_weekday; 
     
    850842 
    851843 
    852844function the_weekday_date($before='',$after='') { 
    853         global $wp_locale, $id, $post, $day, $previousweekday; 
     845        global $wp_locale, $post, $day, $previousweekday; 
    854846        $the_weekday_date = ''; 
    855847        if ( $day != $previousweekday ) { 
    856848                $the_weekday_date .= $before; 
  • wp-includes/l10n.php

    old new  
    7575} 
    7676 
    7777function load_default_textdomain() { 
    78         global $l10n; 
    79  
    8078        $locale = get_locale(); 
    8179        if ( empty($locale) ) 
    8280                $locale = 'en_US'; 
  • wp-includes/link-template.php

    old new  
    232232 
    233233function get_feed_link($feed='rss2') { 
    234234        global $wp_rewrite; 
    235         $do_perma = 0; 
    236         $feed_url = get_option('siteurl'); 
    237         $comment_feed_url = $feed_url; 
    238235 
    239236        $permalink = $wp_rewrite->get_feed_permastruct(); 
    240237        if ( '' != $permalink ) { 
     
    494491} 
    495492 
    496493function get_next_posts_page_link($max_page = 0) { 
    497         global $paged, $pagenow
     494        global $paged
    498495 
    499496        if ( !is_single() ) { 
    500497                if ( !$paged ) 
     
    510507} 
    511508 
    512509function next_posts_link($label='Next Page &raquo;', $max_page=0) { 
    513         global $paged, $wpdb, $wp_query; 
     510        global $paged, $wp_query; 
    514511        if ( !$max_page ) { 
    515512                $max_page = $wp_query->max_num_pages; 
    516513        } 
     
    525522} 
    526523 
    527524function get_previous_posts_page_link() { 
    528         global $paged, $pagenow
     525        global $paged
    529526 
    530527        if ( !is_single() ) { 
    531528                $nextpage = intval($paged) - 1; 
  • wp-includes/pluggable.php

    old new  
    528528 
    529529if ( ! function_exists('wp_notify_postauthor') ) : 
    530530function wp_notify_postauthor($comment_id, $comment_type='') { 
    531         global $wpdb; 
    532  
    533531        $comment = get_comment($comment_id); 
    534532        $post    = get_post($comment->comment_post_ID); 
    535533        $user    = get_userdata( $post->post_author ); 
  • wp-includes/post-template.php

    old new  
    8181 
    8282 
    8383function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { 
    84         global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages; 
    85         global $preview; 
    86         global $pagenow; 
     84        global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow; 
     85 
    8786        $output = ''; 
    8887 
    8988        if ( !empty($post->post_password) ) { // if there's a password 
     
    137136} 
    138137 
    139138 
    140 function get_the_excerpt($deprecated = true) { 
    141         global $id, $post; 
     139function get_the_excerpt($deprecated = '') { 
     140        global $post; 
    142141        $output = ''; 
    143142        $output = $post->post_excerpt; 
    144143        if ( !empty($post->post_password) ) { // if there's a password 
     
    167166        $r = wp_parse_args( $args, $defaults ); 
    168167        extract( $r, EXTR_SKIP ); 
    169168 
    170         global $post, $id, $page, $numpages, $multipage, $more, $pagenow; 
     169        global $post, $page, $numpages, $multipage, $more, $pagenow; 
    171170        if ( $more_file != '' ) 
    172171                $file = $more_file; 
    173172        else 
     
    249248 
    250249// this will probably change at some point... 
    251250function the_meta() { 
    252         global $id; 
    253  
    254251        if ( $keys = get_post_custom_keys() ) { 
    255252                echo "<ul class='post-meta'>\n"; 
    256253                foreach ( $keys as $key ) { 
     
    386383        if ( !$post = & get_post($id) ) 
    387384                return false; 
    388385 
    389         $imagedata = wp_get_attachment_metadata( $post->ID ); 
    390  
    391386        $file = get_attached_file( $post->ID ); 
    392387 
    393388        if ( !$fullsize && $thumbfile = wp_get_attachment_thumb_file( $post->ID ) ) { 
  • wp-includes/post.php

    old new  
    2626} 
    2727 
    2828function &get_children($args = '', $output = OBJECT) { 
    29         global $wpdb; 
    30  
    3129        if ( empty( $args ) ) { 
    3230                if ( isset( $GLOBALS['post'] ) ) { 
    3331                        $args = 'post_parent=' . (int) $GLOBALS['post']->post_parent; 
     
    163161} 
    164162 
    165163function get_post_type($post = false) { 
    166         global $wpdb, $posts; 
     164        global $posts; 
    167165 
    168166        if ( false === $post ) 
    169167                $post = $posts[0]; 
     
    310308} 
    311309 
    312310function get_post_meta($post_id, $key, $single = false) { 
    313         global $wpdb; 
    314  
    315311        $post_id = (int) $post_id; 
    316312 
    317313        $meta_cache = wp_cache_get($post_id, 'post_meta'); 
     
    342338function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') { 
    343339        global $wpdb; 
    344340 
    345         $original_value = $meta_value; 
    346341        $meta_value = maybe_serialize($meta_value); 
    347  
    348         $original_prev = $prev_value; 
    349342        $prev_value = maybe_serialize($prev_value); 
    350343 
    351344        // expected_slashed ($meta_key) 
     
    378371 
    379372 
    380373function get_post_custom($post_id = 0) { 
    381         global $id, $wpdb
     374        global $id
    382375 
    383376        if ( !$post_id ) 
    384377                $post_id = (int) $id; 
     
    577570} 
    578571 
    579572function wp_get_single_post($postid = 0, $mode = OBJECT) { 
    580         global $wpdb; 
    581  
    582573        $postid = (int) $postid; 
    583574 
    584575        $post = get_post($postid, $mode); 
     
    597588} 
    598589 
    599590function wp_insert_post($postarr = array()) { 
    600         global $wpdb, $wp_rewrite, $allowedtags, $user_ID; 
     591        global $wpdb, $wp_rewrite, $user_ID; 
    601592 
    602593        $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, 
    603594                'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, 
     
    768759} 
    769760 
    770761function wp_update_post($postarr = array()) { 
    771         global $wpdb; 
    772  
    773762        if ( is_object($postarr) ) 
    774763                $postarr = get_object_vars($postarr); 
    775764 
     
    835824 
    836825function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { 
    837826        /* $append - true = don't delete existing tags, just add on, false = replace the tags with the new tags */ 
    838         global $wpdb; 
    839827 
    840828        $post_id = (int) $post_id; 
    841829 
     
    849837} 
    850838 
    851839function wp_set_post_categories($post_ID = 0, $post_categories = array()) { 
    852         global $wpdb; 
    853  
    854840        $post_ID = (int) $post_ID; 
    855841        // If $post_categories isn't already an array, make it one: 
    856842        if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories)) 
     
    890876} 
    891877 
    892878function get_enclosed($post_id) { // Get enclosures already enclosed for a post 
    893         global $wpdb; 
    894879        $custom_fields = get_post_custom( $post_id ); 
    895880        $pung = array(); 
    896881        if ( !is_array( $custom_fields ) ) 
     
    12261211                $post_name = sanitize_title($post_name); 
    12271212 
    12281213        // expected_slashed ($post_name) 
    1229         $post_name_check = 
    1230                 $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'inherit' AND ID != %d LIMIT 1", $post_ID)); 
     1214        $post_name_check = $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'inherit' AND ID != %d LIMIT 1", $post_ID)); 
    12311215 
    12321216        if ($post_name_check) { 
    12331217                $suffix = 2; 
     
    15471531} 
    15481532 
    15491533function get_lastpostdate($timezone = 'server') { 
    1550         global $cache_lastpostdate, $pagenow, $wpdb, $blog_id; 
    1551         $add_seconds_blog = get_option('gmt_offset') * 3600; 
     1534        global $cache_lastpostdate, $wpdb, $blog_id; 
    15521535        $add_seconds_server = date('Z'); 
    15531536        if ( !isset($cache_lastpostdate[$blog_id][$timezone]) ) { 
    15541537                switch(strtolower($timezone)) { 
     
    15701553} 
    15711554 
    15721555function get_lastpostmodified($timezone = 'server') { 
    1573         global $cache_lastpostmodified, $pagenow, $wpdb, $blog_id; 
    1574         $add_seconds_blog = get_option('gmt_offset') * 3600; 
     1556        global $cache_lastpostmodified, $wpdb, $blog_id; 
    15751557        $add_seconds_server = date('Z'); 
    15761558        if ( !isset($cache_lastpostmodified[$blog_id][$timezone]) ) { 
    15771559                switch(strtolower($timezone)) { 
     
    16331615} 
    16341616 
    16351617function update_post_caches(&$posts) { 
    1636         global $wpdb; 
    1637  
    16381618        // No point in doing all this work if we didn't match any posts. 
    16391619        if ( !$posts ) 
    16401620                return; 
     
    17381718        if ( defined('WP_IMPORTING') ) 
    17391719                return; 
    17401720 
    1741         $post = get_post($post_id); 
    1742  
    17431721        $data = array( 'post_id' => $post_id, 'meta_value' => '1' ); 
    17441722        if ( get_option('default_pingback_flag') ) 
    17451723                $wpdb->insert( $wpdb->postmeta, $data + array( 'meta_key' => '_pingme' ) ); 
  • wp-includes/query.php

    old new  
    728728        } 
    729729 
    730730        function &get_posts() { 
    731                 global $wpdb, $pagenow, $user_ID; 
     731                global $wpdb, $user_ID; 
    732732 
    733733                do_action_ref_array('pre_get_posts', array(&$this)); 
    734734 
     
    741741                $distinct = ''; 
    742742                $whichcat = ''; 
    743743                $whichauthor = ''; 
    744                 $whichpage = ''; 
    745                 $result = ''; 
    746744                $where = ''; 
    747745                $limits = ''; 
    748746                $join = ''; 
     
    789787                        $q['page'] = abs($q['page']); 
    790788                } 
    791789 
    792                 $add_hours = intval(get_option('gmt_offset')); 
    793                 $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours)); 
    794                 $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; 
    795  
    796790                // If a month is specified in the querystring, load that month 
    797791                if ( $q['m'] ) { 
    798792                        $q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']); 
     
    14951489 
    14961490// Setup global post data. 
    14971491function setup_postdata($post) { 
    1498         global $id, $postdata, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages, $wp_query; 
    1499         global $pagenow; 
     1492        global $id, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages; 
    15001493 
    15011494        $id = (int) $post->ID; 
    15021495 
  • wp-includes/rewrite.php

    old new  
    311311        } 
    312312 
    313313        function page_rewrite_rules() { 
    314                 global $wpdb; 
    315  
    316314                $rewrite_rules = array(); 
    317315                $page_structure = $this->get_page_permastruct(); 
    318316 
  • wp-includes/taxonomy.php

    old new  
    773773 * @return mixed sanitized field 
    774774 */ 
    775775function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) { 
    776         if ( 'parent' == $field  || 'term_id' == $field || 'count' == $field 
    777                 || 'term_group' == $field ) 
     776        if ( 'parent' == $field  || 'term_id' == $field || 'count' == $field || 'term_group' == $field ) 
    778777                $value = (int) $value; 
    779778 
    780779        if ( 'raw' == $context ) 
     
    12091208        if ( !empty($args['term_id']) ) 
    12101209                $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $args['term_id'] ); 
    12111210        else 
    1212                 $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s $where", $slug ); 
     1211                $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug ); 
    12131212 
    12141213        if ( $wpdb->get_var( $query ) ) { 
    12151214                $num = 2; 
     
    14711470 * @return null|array Null value is given with empty $object_ids. 
    14721471 */ 
    14731472function update_object_term_cache($object_ids, $object_type) { 
    1474         global $wpdb; 
    1475  
    14761473        if ( empty($object_ids) )