Changeset 873

Show
Ignore:
Timestamp:
01/30/07 17:46:07 (2 years ago)
Author:
donncha
Message:

WP Merge to rev 3834 and reverted to novalueindb option code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/custom-header.php

    r830 r873  
    224224                if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) { 
    225225                        set_theme_mod('header_image', $url); 
    226                         $header = apply_filters('wp_create_file_in_uploads', $header); // For replication 
     226                        $header = apply_filters('wp_create_file_in_uploads', $file, $id); // For replication 
    227227                        return $this->finished(); 
    228228                } elseif ( $width > HEADER_IMAGE_WIDTH ) { 
    229229                        $oitar = $width / HEADER_IMAGE_WIDTH; 
    230230                        $image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); 
    231                         $image = apply_filters('wp_create_file_in_uploads', $image); // For replication 
     231                        $image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication 
    232232 
    233233                        $url = str_replace(basename($url), basename($image), $url); 
  • trunk/wp-admin/options-reading.php

    r810 r873  
    5151</div> 
    5252<?php endif; ?> 
    53 </fieldset> 
    5453</td>  
    5554</tr>  
     
    6564<td> 
    6665<input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" size="3" /> <?php _e('posts') ?> 
    67 </select> 
    6866</td>  
    6967</tr>  
     
    8381<p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?>     /> <?php _e('Full text') ?></label><br /> 
    8482<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label></p> 
    85 <p><?php _e('Note: If you use the <code>&lt;--more--&gt;</code> feature, it will cut off posts in RSS feeds.'); ?></p> 
     83<p><?php _e('Note: If you use the <code>&lt;!--more--&gt;</code> feature, it will cut off posts in RSS feeds.'); ?></p> 
    8684</td> 
    8785</tr>  
     
    9795<p class="submit">  
    9896<input type="hidden" name="action" value="update" />  
    99 <input type="hidden" name="page_options" value="posts_per_page,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression,show_on_front,page_on_front,page_for_posts" />  
    10097<input type="hidden" name="page_options" value="posts_per_page,posts_per_rss,rss_use_excerpt,blog_charset,show_on_front,page_on_front,page_for_posts" />  
    10198<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />  
  • trunk/wp-admin/wp-admin.css

    r865 r873  
    889889        letter-spacing: -.05em; 
    890890        margin: 0; 
    891         font-family: Georgia, "Times New Roman", Times, serif 
     891        font-family: Georgia, "Times New Roman", Times, serif; 
    892892} 
    893893 
  • trunk/wp-includes/capabilities.php

    r810 r873  
    5656                unset($this->role_names[$role]); 
    5757                unset($this->roles[$role]); 
    58                  
     58 
    5959                if ( $this->use_db ) 
    6060                        update_option($this->role_key, $this->roles); 
     
    428428 
    429429                $author_data = get_userdata($user_id); 
    430                 $page_author_data = get_userdata($post->post_author); 
     430                $page_author_data = get_userdata($page->post_author); 
    431431                if ($user_id == $page_author_data->ID) 
    432432                        $caps[] = 'read'; 
  • trunk/wp-includes/cron.php

    r797 r873  
    9494 
    9595function wp_cron() { 
     96        // Prevent infinite loops caused by lack of wp-cron.php 
     97        if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false ) 
     98                return; 
     99 
    96100        $crons = _get_cron_array(); 
    97101         
  • trunk/wp-includes/functions.php

    r868 r873  
    204204        global $wpdb, $switched, $current_blog; 
    205205 
     206        $pre = apply_filters( 'pre_option_' . $setting, false );  
     207        if ( $pre )  
     208                return $pre;  
     209 
    206210        if ( $switched == false && defined('WP_INSTALLING') == false ) { 
    207         // prevent non-existent options from triggering multiple queries 
    208         if ( true === wp_cache_get($setting, 'notoptions') ) 
    209                 return false; 
    210211                $value = wp_cache_get($setting, 'options'); 
    211212        } else { 
     
    213214                wp_cache_delete($setting, 'options'); 
    214215        } 
     216 
     217// Uncomment if we get any page not found or rewrite errors      
     218//      if( $setting == 'rewrite_rules' ) 
     219//              $value = false; 
    215220 
    216221        if ( $value == 'novalueindb' ) 
     
    228233                if( is_object( $row) ) { // Has to be get_row instead of get_var because of funkiness with 0, false, null values 
    229234                        $value = $row->option_value; 
    230                         wp_cache_set($setting, $value, 'options'); 
    231                 } else { // option does not exist, so we must cache its non-existence 
    232                         wp_cache_set($setting, true, 'notoptions'); 
     235                        wp_cache_set($setting, ($value=='')?'emptystringindb':$value, 'options'); 
     236                } else { 
     237                        wp_cache_set($setting, 'novalueindb', 'options'); 
    233238                        return false; 
    234239                } 
     
    290295                return true; 
    291296        } 
    292  
    293         if ( true === wp_cache_get($option_name, 'notoptions') ) 
    294                 wp_cache_delete($option_name, 'notoptions'); 
    295297 
    296298        $_newvalue = $newvalue; 
     
    12121214        $adminurl = get_option('siteurl') . '/wp-admin'; 
    12131215        if ( wp_get_referer() ) 
    1214                 $adminurl = wp_get_referer(); 
     1216                $adminurl = wp_specialchars(wp_get_referer(), 1); 
    12151217 
    12161218        $title = __('WordPress Confirmation'); 
  • trunk/wp-includes/post.php

    r854 r873  
    7575function get_extended($post) { 
    7676        //Match the new style more links 
    77         if (preg_match('/<!--more(.+?)?-->/', $post, $matches)) { 
    78                 list($main,$extended) = explode($matches[0],$post,2); 
     77        if ( preg_match('/<!--more(.*?)-->/', $post, $matches) ) { 
     78                list($main, $extended) = explode($matches[0], $post, 2); 
    7979        } else { 
    8080                $main = $post; 
     
    8383         
    8484        // Strip leading and trailing whitespace 
    85         $main = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$main); 
    86         $extended = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$extended); 
     85        $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main); 
     86        $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended); 
    8787 
    8888        return array('main' => $main, 'extended' => $extended); 
  • trunk/xmlrpc.php

    r868 r873  
    2323    <homePageLink><?php bloginfo_rss('url') ?></homePageLink> 
    2424    <apis> 
     25      <api name="WordPress" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
    2526      <api name="Movable Type" blogID="1" preferred="true" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
    2627      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('url') ?>/xmlrpc.php" /> 
     
    184185                        $link = post_permalink($page->ID); 
    185186 
     187                        // Get info the page parent if there is one. 
     188                        $parent_title = ""; 
     189                        if(!empty($page->post_parent)) { 
     190                                $parent = get_page($page->post_parent); 
     191                                $parent_title = $parent->post_title; 
     192                        } 
     193 
    186194                        // Determine comment and ping settings. 
    187195                        $allow_comments = ("open" == $page->comment_status) ? 1 : 0; 
     
    197205                        } 
    198206 
    199                         // Get the users nicename
    200                         $nicename = get_profile("user_nicename", $username); 
     207                        // Get the author info
     208                        $author = get_userdata($page->post_author); 
    201209 
    202210                        $page_struct = array( 
    203                                 "dateCreated"           => new IXR_Date($page_date), 
    204                                 "userid"                        => $page->post_author, 
    205                                 "page_id"                       => $page->ID, 
    206                                 "page_status"           => $page->post_status, 
    207                                 "description"           => $full_page["main"], 
    208                                 "title"                         => $page->post_title, 
    209                                 "link"                          => $link, 
    210                                 "permaLink"                     => $link, 
    211                                 "categories"            => $categories, 
    212                                 "excerpt"                       => $page->post_excerpt, 
    213                                 "text_more"                     => $full_page["extended"], 
    214                                 "mt_allow_comments"     => $allow_comments, 
    215                                 "mt_allow_pings"        => $allow_pings, 
    216                                 "wp_slug"                       => $page->post_name, 
    217                                 "wp_password"           => $page->post_password, 
    218                                 "wp_author"                     => $nicename, 
    219                                 "wp_page_parent_id"     => $page->post_parent, 
    220                                 "wp_page_order"         => $page->menu_order 
     211                                "dateCreated"                   => new IXR_Date($page_date), 
     212                                "userid"                                => $page->post_author, 
     213                                "page_id"                               => $page->ID, 
     214                                "page_status"                   => $page->post_status, 
     215                                "description"                   => $full_page["main"], 
     216                                "title"                                 => $page->post_title, 
     217                                "link"                                  => $link, 
     218                                "permaLink"                             => $link, 
     219                                "categories"                    => $categories, 
     220                                "excerpt"                               => $page->post_excerpt, 
     221                                "text_more"                             => $full_page["extended"], 
     222                                "mt_allow_comments"             => $allow_comments, 
     223                                "mt_allow_pings"                => $allow_pings, 
     224                                "wp_slug"                               => $page->post_name, 
     225                                "wp_password"                   => $page->post_password, 
     226                                "wp_author"                             => $author->user_nicename, 
     227                                "wp_page_parent_id"             => $page->post_parent, 
     228                                "wp_page_parent_title"  => $parent_title, 
     229                                "wp_page_order"                 => $page->menu_order, 
     230                                "wp_author_username"    => $author->user_login 
    221231                        ); 
    222232 
     
    409419                $page_list = $wpdb->get_results(" 
    410420                        SELECT ID page_id, 
    411                                 post_title page_title 
     421                                post_title page_title, 
     422                                post_parent page_parent_id 
    412423                        FROM {$wpdb->posts} 
    413424                        WHERE post_type = 'page' 
     
    10751086                } 
    10761087 
    1077                 // Only ste the menu_order if it was given. 
     1088                // Only set the menu_order if it was given. 
    10781089                if(!empty($content_struct["wp_page_order"])) { 
    10791090                        $menu_order = $content_struct["wp_page_order"]; 
     1091                } 
     1092 
     1093                // Only set the post_author if one is set. 
     1094                if(!empty($content_struct["wp_author"])) { 
     1095                        $post_author = $content_struct["wp_author"]; 
    10801096                } 
    10811097 
     
    11221138 
    11231139          // We've got all the data -- post it: 
    1124           $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order'); 
     1140          $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author'); 
    11251141 
    11261142          $result = wp_update_post($newpost); 
     
    11651181            $post = get_extended($postdata['post_content']); 
    11661182            $link = post_permalink($postdata['ID']); 
     1183 
     1184                // Get the author info. 
     1185                $author = get_userdata($postdata['post_author']); 
    11671186 
    11681187            $allow_comments = ('open' == $postdata['comment_status']) ? 1 : 0; 
     
    11831202              'mt_text_more' => $post['extended'], 
    11841203              'mt_allow_comments' => $allow_comments, 
    1185               'mt_allow_pings' => $allow_pings 
     1204              'mt_allow_pings' => $allow_pings, 
     1205          'wp_slug' => $postdata['post_name'], 
     1206          'wp_password' => $postdata['post_password'], 
     1207          'wp_author' => $author->user_nicename, 
     1208          'wp_author_username'  => $author->user_login 
    11861209            ); 
    11871210 
     
    12251248                        $post = get_extended($entry['post_content']); 
    12261249                        $link = post_permalink($entry['ID']); 
     1250 
     1251                        // Get the post author info. 
     1252                        $author = get_userdata($entry['ID']); 
    12271253 
    12281254                        $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; 
     
    12431269                                'mt_text_more' => $post['extended'], 
    12441270                                'mt_allow_comments' => $allow_comments, 
    1245                                 'mt_allow_pings' => $allow_pings 
     1271                                'mt_allow_pings' => $allow_pings, 
     1272                                'wp_slug' => $entry['post_name'], 
     1273                                'wp_password' => $entry['post_password'], 
     1274                                'wp_author' => $author->user_nicename, 
     1275                                'wp_author_username' => $author->user_login 
    12461276                        ); 
    12471277 
     
    12751305 
    12761306                // FIXME: can we avoid using direct SQL there? 
    1277                 if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) { 
     1307                if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name,category_parent FROM $wpdb->categories", ARRAY_A)) { 
    12781308                        foreach ($cats as $cat) { 
    12791309                                $struct['categoryId'] = $cat['cat_ID']; 
     1310                                $struct['parentId'] = $cat['category_parent']; 
    12801311                                $struct['description'] = $cat['cat_name']; 
    12811312                                $struct['categoryName'] = $cat['cat_name'];