diff options
Diffstat (limited to 'wp-includes')
36 files changed, 198 insertions, 598 deletions
diff --git a/wp-includes/Text/Diff.php b/wp-includes/Text/Diff.php index f8a974c..06d1c6c 100644 --- a/wp-includes/Text/Diff.php +++ b/wp-includes/Text/Diff.php @@ -49,7 +49,8 @@ class Text_Diff { $engine = basename($engine); } - require_once 'Text/Diff/Engine/' . $engine . '.php'; + // WP #7391 + require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php'; $class = 'Text_Diff_Engine_' . $engine; $diff_engine = new $class(); diff --git a/wp-includes/Text/Diff/Renderer/inline.php b/wp-includes/Text/Diff/Renderer/inline.php index b547ff2..1493eaa 100644 --- a/wp-includes/Text/Diff/Renderer/inline.php +++ b/wp-includes/Text/Diff/Renderer/inline.php @@ -14,7 +14,9 @@ */ /** Text_Diff_Renderer */ -require_once 'Text/Diff/Renderer.php'; + +// WP #7391 +require_once dirname(dirname(__FILE__)) . '/Renderer.php'; /** * "Inline" diff renderer. diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php index 9a2bd6d..b07daf2 100644 --- a/wp-includes/bookmark-template.php +++ b/wp-includes/bookmark-template.php @@ -76,7 +76,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) { if ( $show_updated ) if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) { - $title .= ' '; + $title .= ' ('; $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600))); $title .= ')'; } diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index 4c58027..4c1e365 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -165,11 +165,12 @@ function redirect_canonical($requested_url=null, $do_redirect=true) { } else { foreach ( array('single', 'category', 'page', 'day', 'month', 'year') as $type ) { $func = 'is_' . $type; - if ( call_user_func($func) ) + if ( call_user_func($func) ) { $user_ts_type = $type; break; } } + } $redirect['path'] = user_trailingslashit($redirect['path'], $user_ts_type); } elseif ( is_home() ) { $redirect['path'] = trailingslashit($redirect['path']); diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 62196ee..3c3a4db 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -110,7 +110,7 @@ class WP { $query = preg_replace("!^.+\?!", '', $query); // Substitute the substring matches into the query. - eval("\$query = \"$query\";"); + eval("\$query = \"" . addslashes($query) . "\";"); $this->matched_query = $query; // Parse the query. diff --git a/wp-includes/cron.php b/wp-includes/cron.php index 1c17c76..0c45e34 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -133,6 +133,7 @@ function wp_cron() { function wp_get_schedules() {
$schedules = array(
'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ),
+ 'twicedaily' => array( 'interval' => 43200, 'display' => __('Twice Daily') ),
'daily' => array( 'interval' => 86400, 'display' => __('Once Daily') ),
);
return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 332f831..261097e 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -620,12 +620,12 @@ function delete_option( $name ) { * @return mixed A scalar data */ function maybe_serialize( $data ) { - if ( is_string( $data ) ) - return $data; - elseif ( is_array( $data ) || is_object( $data ) ) + if ( is_array( $data ) || is_object( $data ) ) return serialize( $data ); + if ( is_serialized( $data ) ) return serialize( $data ); + return $data; } @@ -1473,15 +1473,21 @@ function path_join( $base, $path ) { function wp_upload_dir( $time = NULL ) { $siteurl = get_option( 'siteurl' ); $upload_path = get_option( 'upload_path' ); - if ( trim($upload_path) === '' ) - $upload_path = WP_CONTENT_DIR . '/uploads'; - $dir = $upload_path; + $upload_path = trim($upload_path); + if ( empty($upload_path) ) + $dir = WP_CONTENT_DIR . '/uploads'; + else + $dir = $upload_path; // $dir is absolute, $path is (maybe) relative to ABSPATH - $dir = path_join( ABSPATH, $upload_path ); - - if ( !$url = get_option( 'upload_url_path' ) ) - $url = WP_CONTENT_URL . '/uploads'; + $dir = path_join( ABSPATH, $dir ); + + if ( !$url = get_option( 'upload_url_path' ) ) { + if ( empty($upload_path) or ( $upload_path == $dir ) ) + $url = WP_CONTENT_URL . '/uploads'; + else + $url = trailingslashit( $siteurl ) . $upload_path; + } if ( defined('UPLOADS') ) { $dir = ABSPATH . UPLOADS; @@ -1509,8 +1515,9 @@ function wp_upload_dir( $time = NULL ) { $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir ); return array( 'error' => $message ); } - + $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ); + return apply_filters( 'upload_dir', $uploads ); } diff --git a/wp-includes/images/blank.gif b/wp-includes/images/blank.gif Binary files differnew file mode 100644 index 0000000..e565824 --- /dev/null +++ b/wp-includes/images/blank.gif diff --git a/wp-includes/js/jquery/jquery.dimensions.min.js b/wp-includes/js/jquery/jquery.dimensions.min.js deleted file mode 100644 index 34c06de..0000000 --- a/wp-includes/js/jquery/jquery.dimensions.min.js +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * - * $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $ - * $Rev: 4257 $ - * - * Version: 1.2 - * - * Requires: jQuery 1.2+ - */ -(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);
\ No newline at end of file diff --git a/wp-includes/js/thickbox/macFFBgHack.png b/wp-includes/js/thickbox/macFFBgHack.png Binary files differnew file mode 100644 index 0000000..c6473b3 --- /dev/null +++ b/wp-includes/js/thickbox/macFFBgHack.png diff --git a/wp-includes/js/tinymce/plugins/wordpress/popups.css b/wp-includes/js/tinymce/plugins/wordpress/popups.css deleted file mode 100644 index 2d97665..0000000 --- a/wp-includes/js/tinymce/plugins/wordpress/popups.css +++ /dev/null @@ -1,354 +0,0 @@ -/* This file contains the CSS data for all popups in TinyMCE */ - -body { - background-color: #F0F0EE; - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 11px; - scrollbar-3dlight-color: #F0F0EE; - scrollbar-arrow-color: #676662; - scrollbar-base-color: #F0F0EE; - scrollbar-darkshadow-color: #DDDDDD; - scrollbar-face-color: #E0E0DD; - scrollbar-highlight-color: #F0F0EE; - scrollbar-shadow-color: #F0F0EE; - scrollbar-track-color: #F5F5F5; - margin: 8px; -} - -td { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 11px; -} - -input { - background: #FFFFFF; - border: 1px solid #cccccc; -} - -td, input, select, textarea { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 10px; -} - -input, select, textarea { - border: 1px solid #808080; -} - -.input_noborder { - border: 0; -} - -#insert, .updateButton { - font-weight: bold; - width: 90px; - height: 21px; - border: 0; - background-image: url('../images/insert_button_bg.gif'); - cursor: pointer; -} - -#cancel { - font-weight: bold; - width: 90px; - height: 21px; - border: 0; - background-image: url('../images/cancel_button_bg.gif'); - cursor: pointer; -} - -/* Mozilla only style */ -html>body #insert, html>body #cancel { - padding-bottom: 2px; -} - -.title { - display: block; - padding-top: 5px; - padding-bottom: 5px; - padding-left: 15px; - font-size: 15px; -} - - -table.charmap { - border-style: solid; - border-width: 1px; - border-color: #AAAAAA; -} - -td.charmap, td.charmapOver { - color: #000000; - border-color: #AAAAAA; - border-style: solid; - border-width: 1px; - text-align: center; - font-size: 12px; -} - -td.charmapOver { - background-color: #CCCCCC; - cursor: default; -} - -a.charmap { - color: #000000; - text-decoration: none -} - -.wordWrapCode { - vertical-align: middle; - border: 1px none #000000; - background-color: transparent; -} - -input.radio { - border: 1px none #000000; - background-color: transparent; - vertical-align: middle; -} - -input.checkbox { - border: 1px none #000000; - background-color: transparent; - vertical-align: middle; -} - -.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected { - margin-left: 1px; -} - -.mceButtonNormal { - border-top: 1px solid; - border-left: 1px solid; - border-bottom: 1px solid; - border-right: 1px solid; - border-color: #F0F0EE; - cursor: default; -} - -.mceButtonOver { - border: 1px solid #0A246A; - cursor: default; - background-color: #B6BDD2; -} - -.mceButtonDown { - cursor: default; - border: 1px solid #0A246A; - background-color: #8592B5; -} - -.mceButtonDisabled { - filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); - -moz-opacity:0.3; - opacity: 0.3; - border-top: 1px solid; - border-left: 1px solid; - border-bottom: 1px solid; - border-right: 1px solid; - border-color: #F0F0EE; - cursor: default; -} - -.mceActionPanel { - margin-top: 5px; -} - -/* Tabs classes */ - -.tabs { - float: left; - width: 100%; - line-height: normal; - background-image: url("../images/xp/tabs_bg.gif"); -} - -.tabs ul { - margin: 0; - padding: 0 0 0; - list-style: none; -} - -.tabs li { - float: left; - background: url("../images/xp/tab_bg.gif") no-repeat left top; - margin: 0; - margin-left: 0; - margin-right: 2px; - padding: 0 0 0 10px; - line-height: 18px; -} - -.tabs li.current { - background: url("../images/xp/tab_sel_bg.gif") no-repeat left top; - margin-right: 2px; -} - -.tabs span { - float: left; - display: block; - background: url("../images/xp/tab_end.gif") no-repeat right top; - padding: 0px 10px 0 0; -} - -.tabs .current span { - background: url("../images/xp/tab_sel_end.gif") no-repeat right top; -} - -.tabs a { - text-decoration: none; - font-family: Verdana, Arial; - font-size: 10px; -} - -.tabs a:link, .tabs a:visited, .tabs a:hover { - color: black; -} - -.tabs a:hover { -} - -.tabs .current { -} - -.tabs .current a, .tabs .current a:link, .tabs .current a:visited { -} - -.panel_wrapper div.panel { - display: none; -} - -.panel_wrapper div.current { - display: block; - width: 100%; - height: 300px; - overflow: visible; /* Should be auto but that breaks Safari */ -} - -.panel_wrapper { - border: 1px solid #919B9C; - border-top: 0px; - padding: 10px; - padding-top: 5px; - clear: both; - background-color: white; -} - -fieldset { - border: 1px solid #919B9C; - font-family: Verdana, Arial; - font-size: 10px; - padding: 0; - margin: 0; - padding: 4px; -} - -legend { - color: #2B6FB6; - font-weight: bold; -} - -.properties { - width: 100%; -} - -.properties .column1 { -} - -.properties .column2 { - text-align: left; -} - -a:link, a:visited { - color: black; -} - -a:hover { - color: #2B6FB6; -} - -#plugintable thead { - font-weight: bold; - background-color: #DDDDDD; -} - -#plugintable, #about #plugintable td { - border: 1px solid #919B9C; -} - -#plugintable { - width: 99%; - margin-top: 10px; -} - -#pluginscontainer { - height: 290px; - overflow: auto; -} - -/* MSIE Specific styles */ - -* html .panel_wrapper { - width: 100%; -} - -.column { - float: left; -} - -h1, h2, h3, h4 { - color: #2B6FB6; - margin: 0; - padding: 0; - padding-top: 5px; -} - -h3 { - font-size: 14px; -} - -#link .panel_wrapper, #link div.current { - height: 125px; -} - -#image .panel_wrapper, #image div.current { - height: 190px; -} - -/* Disables the advanced tab in the table plugin. */ -/* -#table #advanced_tab { - display: none; -} -*/ - -/* Disables the border input field and label in the table plugin. */ -/* -#table #border, #table #borderlabel { - display: none; -} -*/ - -#insert, #cancel, .submitbutton { - font: 13px Verdana, Arial, Helvetica, sans-serif; - height: auto; - width: auto; - background-color: transparent; - background-image: url(../../../../../wp-admin/images/fade-butt.png); - background-repeat: repeat; - border: 3px double; - border-right-color: rgb(153, 153, 153); - border-bottom-color: rgb(153, 153, 153); - border-left-color: rgb(204, 204, 204); - border-top-color: rgb(204, 204, 204); - color: rgb(51, 51, 51); - padding: 0.25em 0.75em; -} - -#insert:active, #cancel:active, .submitbutton:active { - background: #f4f4f4; - border-left-color: #999; - border-top-color: #999; -} - - diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html b/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html index a9f1c15..55554d7 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html +++ b/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html @@ -4,11 +4,11 @@ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> -<script type="text/javascript" src="js/editimage.js?ver=311d"></script> +<script type="text/javascript" src="js/editimage.js?ver=311g"></script> <script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script> -<link rel="stylesheet" href="css/editimage.css?ver=311d" type="text/css" media="all" /> -<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-beta3" type="text/css" media="all" /> +<link rel="stylesheet" href="css/editimage.css?ver=311g" type="text/css" media="all" /> +<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6.1" type="text/css" media="all" /> <script type="text/javascript"> if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') ) document.write('<link rel="stylesheet" href="css/editimage-rtl.css?ver=311" type="text/css" media="all" />'); diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js index 7dfeca2..d0ca4ed 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js @@ -15,7 +15,7 @@ if ( ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1 || el.nodeName != 'IMG' ) return; - tb_show('', url + '/editimage.html?ver=311c&TB_iframe=true'); + tb_show('', url + '/editimage.html?ver=311g&TB_iframe=true'); tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' ); }); diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js index 1986a13..9534c64 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js @@ -79,7 +79,7 @@ var wpImage = { for ( i = 0; i < styles.length; i++ ) { var url = styles.item(i).href; - if ( url && url.indexOf('colors-') != -1 ) + if ( url && url.indexOf('colors') != -1 ) document.write( '<link rel="stylesheet" href="'+url+'" type="text/css" media="all" />' ); } }, @@ -245,10 +245,10 @@ var wpImage = { }, setup : function() { - var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = null; + var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = ''; document.dir = tinyMCEPopup.editor.getParam('directionality',''); - if ( ! tinyMCEPopup.editor.getParam('wpeditimage_do_captions', true) ) + if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) ) t.I('cap_field').style.display = 'none'; tinyMCEPopup.restoreSelection(); diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css index df1e059..0ae4155 100644 --- a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css +++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css @@ -8,8 +8,8 @@ h4 {font-size: 1em} h5 {font-size: .83em} h6 {font-size: .75em} .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;} -a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;} -img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;} +a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(../default/img/items.gif) no-repeat bottom left;} +img.mceItemAnchor {width:12px; height:12px; background:url(../default/img/items.gif) no-repeat;} img {border:0;} table {cursor:default} table td, table th {cursor:text} diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php index 5a8e4c4..757d06b 100644 --- a/wp-includes/js/tinymce/tiny_mce_config.php +++ b/wp-includes/js/tinymce/tiny_mce_config.php @@ -130,7 +130,7 @@ $mce_buttons_3 = implode($mce_buttons_3, ','); $mce_buttons_4 = apply_filters('mce_buttons_4', array()); $mce_buttons_4 = implode($mce_buttons_4, ','); -$do_captions = ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ? false : true; +$no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false; // TinyMCE init settings $initArray = array ( @@ -165,7 +165,7 @@ $initArray = array ( 'tab_focus' => ':next', 'content_css' => "$mce_css", 'save_callback' => 'switchEditors.saveCallback', - 'wpeditimage_do_captions' => $do_captions, + 'wpeditimage_disable_captions' => $no_captions, 'plugins' => "$plugins", // pass-through the settings for compression and caching, so they can be changed with "tiny_mce_before_init" 'disk_cache' => true, @@ -225,7 +225,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { // Setup cache info if ( $disk_cache ) { - $cacheKey = apply_filters('tiny_mce_version', '20080710'); + $cacheKey = apply_filters('tiny_mce_version', '20080810'); foreach ( $initArray as $v ) $cacheKey .= $v; diff --git a/wp-includes/js/tinymce/wordpress.css b/wp-includes/js/tinymce/wordpress.css index 2348d12..0bc5f55 100644 --- a/wp-includes/js/tinymce/wordpress.css +++ b/wp-includes/js/tinymce/wordpress.css @@ -76,20 +76,6 @@ pre { font: 12px/18px "Courier New", monospace; } -img.mceItemAnchor { - width: 12px; - height: 12px; - background: url(img/items.gif) no-repeat; -} - -a.mceItemAnchor { - width: 12px; - line-height: 6px; - overflow: hidden; - padding-left: 12px; - background: url(img/items.gif) no-repeat bottom left; -} - .mceIEcenter { text-align: center; } diff --git a/wp-includes/js/wp-ajax.js b/wp-includes/js/wp-ajax.js deleted file mode 100644 index e3f63f7..0000000 --- a/wp-includes/js/wp-ajax.js +++ /dev/null @@ -1,100 +0,0 @@ -var WPAjax = Class.create(); -Object.extend(WPAjax.prototype, Ajax.Request.prototype); -Object.extend(WPAjax.prototype, { - WPComplete: false, // onComplete function - WPError: false, // onWPError function - defaultUrl: '', // We get these from WPAjaxL10n - permText: '', - strangeText: '', - whoaText: '', - - initialize: function(url, responseEl) { - var tempObj = this; - this.transport = Ajax.getTransport(); - if ( !this.transport ) - return false; - this.setOptions( { - parameters: 'cookie=' + encodeURIComponent(document.cookie), - onComplete: function(transport) { // transport = XMLHttpRequest object - if ( tempObj.parseAjaxResponse() ) { - if ( 'function' == typeof tempObj.WPComplete ) - tempObj.WPComplete(transport); - } else if ( 'function' == typeof tempObj.WPError ) // if response corresponds to an error (bad data, say, not 404) - tempObj.WPError(transport); - } - }); - this.url = url ? url : this.defaultUrl; - this.getResponseElement(responseEl); - }, - addArg: function(key, value) { - var a = $H(); - a[encodeURIComponent(key)] = encodeURIComponent(value); - this.options.parameters = $H(this.options.parameters).merge(a); - }, - getResponseElement: function(r) { - var p = $(r + '-p'); - if ( !p ) { - new Insertion.Bottom(r, "<span id='" + r + "-p'></span>"); - var p = $(r + '-p'); - } - this.myResponseElement = p; - }, - parseAjaxResponse: function() { // 1 = good, 0 = strange (bad data?), -1 = you lack permission - if ( this.transport.responseXML && typeof this.transport.responseXML == 'object' && ( this.transport.responseXML.xml || 'undefined' == typeof this.transport.responseXML.xml ) ) { - var err = this.transport.responseXML.getElementsByTagName('wp_error'); - if ( err[0] ) { - var msg = $A(err).inject( '', function(a, b) { return a + '<p>' + b.firstChild.nodeValue + '</p>'; } ); - Element.update(this.myResponseElement,'<div class="error">' + msg + '</div>'); - return false; - } - return true; - } - var r = this.transport.responseText; - if ( isNaN(r) ) { - Element.update(this.myResponseElement,'<div class="error"><p>' + r + '</p></div>'); - return false; - } - var r = parseInt(r,10); - if ( -1 == r ) { - Element.update(this.myResponseElement,"<div class='error'><p>" + this.permText + "</p></div>"); - return false; - } else if ( 0 == r ) { - Element.update(this.myResponseElement,"<div class='error'><p>" + this.strangeText + "</p></div>"); - return false; - } - return true; - }, - addOnComplete: function(f) { - if ( 'function' == typeof f ) { var of = this.WPComplete; this.WPComplete = function(t) { if ( of ) of(t); f(t); } } - }, - addOnWPError: function(f) { - if ( 'function' == typeof f ) { var of = this.WPError; this.WPError = function(t) { if ( of ) of(t); f(t); } } - }, - notInitialized: function() { - return this.transport ? false : true; - } -}); - -Event.observe( window, 'load', function() { Object.extend(WPAjax.prototype, WPAjaxL10n); }, false ) - -Ajax.activeSendCount = 0; -Ajax.Responders.register( { - onCreate: function() { - Ajax.activeSendCount++; - if ( 1 != Ajax.activeSendCount ) - return; - wpBeforeUnload = window.onbeforeunload; - window.onbeforeunload = function() { - return WPAjax.whoaText; - } - }, - onLoading: function() { // Can switch to onLoaded if we lose data - Ajax.activeSendCount--; - if ( 0 != Ajax.activeSendCount ) - return; - window.onbeforeunload = wpBeforeUnload; - } -}); - -//Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax -function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; } diff --git a/wp-includes/js/wp-lists.js b/wp-includes/js/wp-lists.js index 884f02a..a4d5df3 100644 --- a/wp-includes/js/wp-lists.js +++ b/wp-includes/js/wp-lists.js @@ -88,6 +88,8 @@ var wpList = { var res = wpAjax.parseAjaxResponse(r, s.response, s.element); if ( !res || res.errors ) { return false; } + if ( true === res ) { return true; } + jQuery.each( res.responses, function() { wpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue pos: this.position || 0, diff --git a/wp-includes/kses.php b/wp-includes/kses.php index 1c9a0d7..f0111a5 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -438,6 +438,10 @@ function wp_kses_split2($string, $allowed_html, $allowed_protocols) { $string = $newstring; if ( $string == '' ) return ''; + // prevent multiple dashes in comments + $string = preg_replace('/--+/', '-', $string); + // prevent three dashes closing a comment + $string = preg_replace('/-$/', '', $string); return "<!--{$string}-->"; } # Allow HTML comments @@ -553,7 +557,8 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) { * input. It will add quotes around attribute values that don't have any quotes * or apostrophes around them, to make it easier to produce HTML code that will * conform to W3C's HTML specification. It will also remove bad URL protocols - * from attribute values. + * from attribute values. It also reduces duplicate attributes by using the + * attribute defined first (foo='bar' foo='baz' will result in foo='bar'). * * @since 1.0.0 * @@ -596,7 +601,9 @@ function wp_kses_hair($attr, $allowed_protocols) { { $working = 1; $mode = 0; - $attrarr[] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); + if(FALSE === array_key_exists($attrname, $attrarr)) { + $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); + } $attr = preg_replace('/^\s+/', '', $attr); } @@ -609,7 +616,9 @@ function wp_kses_hair($attr, $allowed_protocols) { { $thisval = ($attrname=='style') ? $match[1] : wp_kses_bad_protocol($match[1], $allowed_protocols); - $attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); + if(FALSE === array_key_exists($attrname, $attrarr)) { + $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); + } $working = 1; $mode = 0; $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr); @@ -621,7 +630,9 @@ function wp_kses_hair($attr, $allowed_protocols) { { $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); - $attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); + if(FALSE === array_key_exists($attrname, $attrarr)) { + $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); + } $working = 1; $mode = 0; $attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr); @@ -633,7 +644,9 @@ function wp_kses_hair($attr, $allowed_protocols) { { $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); - $attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); + if(FALSE === array_key_exists($attrname, $attrarr)) { + $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); + } # We add quotes to conform to W3C's HTML spec. $working = 1; $mode = 0; @@ -650,10 +663,10 @@ function wp_kses_hair($attr, $allowed_protocols) { } } # while - if ($mode == 1) + if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr)) # special case, for when the attribute list ends with a valueless # attribute like "selected" - $attrarr[] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); + $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); return $attrarr; } diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 86ceb86..35f89c5 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -242,21 +242,27 @@ function __ngettext_noop($single, $plural, $number=1, $domain = 'default') { function load_textdomain($domain, $mofile) { global $l10n; - if (isset($l10n[$domain])) - return; - if ( is_readable($mofile)) $input = new CachedFileReader($mofile); else return; - $l10n[$domain] = new gettext_reader($input); + $gettext = new gettext_reader($input); + + if (isset($l10n[$domain])) { + $l10n[$domain]->load_tables(); + $gettext->load_tables(); + $l10n[$domain]->cache_translations = array_merge($gettext->cache_translations, $l10n[$domain]->cache_translations); + } else + $l10n[$domain] = $gettext; + + unset($input, $gettext); } /** * load_default_textdomain() - Loads default translated strings based on locale * - * Loads the .mo file in LANGDIR constant path from WordPress root. + * Loads the .mo file in WP_LANG_DIR constant path from WordPress root. * The translated (.mo) file is named based off of the locale. * * @since 1.5.0 diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 8f1d27f..a1286a9 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -479,7 +479,7 @@ function get_edit_post_link( $id = 0, $context = 'display' ) { break; endswitch; - return apply_filters( 'get_edit_post_link', get_bloginfo( 'wpurl' ) . "/wp-admin/$file.php?{$action}$var=$post->ID", $post->ID ); + return apply_filters( 'get_edit_post_link', admin_url("$file.php?{$action}$var=$post->ID"), $post->ID, $context ); } function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) { @@ -509,7 +509,7 @@ function get_edit_comment_link( $comment_id = 0 ) { return; } - $location = get_bloginfo( 'wpurl' ) . '/wp-admin/comment.php?action=editcomment&c=' . $comment->comment_ID; + $location = admin_url('comment.php?action=editcomment&c=') . $comment->comment_ID; return apply_filters( 'get_edit_comment_link', $location ); } diff --git a/wp-includes/media.php b/wp-includes/media.php index dd6927b..36ca595 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -355,9 +355,6 @@ add_shortcode('caption', 'img_caption_shortcode'); function img_caption_shortcode($attr, $content = null) { - if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) - return $content; - // Allow plugins/themes to override the default caption template. $output = apply_filters('img_caption_shortcode', '', $attr, $content); if ( $output != '' ) diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 8041f28..0007633 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -1518,10 +1518,6 @@ function wp_text_diff( $left_string, $right_string, $args = null ) { $defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' ); $args = wp_parse_args( $args, $defaults ); - // PEAR Text_Diff is lame; it includes things from include_path rather than it's own path. - // Not sure of the ramifications of disttributing modified code. - ini_set('include_path', '.' . PATH_SEPARATOR . ABSPATH . WPINC ); - if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) ) require( ABSPATH . WPINC . '/wp-diff.php' ); @@ -1540,8 +1536,6 @@ function wp_text_diff( $left_string, $right_string, $args = null ) { $renderer = new WP_Text_Diff_Renderer_Table(); $diff = $renderer->render($text_diff); - ini_restore('include_path'); - if ( !$diff ) return ''; diff --git a/wp-includes/post.php b/wp-includes/post.php index 122eb83..a4a0b5e 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -511,6 +511,10 @@ function get_posts($args = null) { function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) { global $wpdb; + // make sure meta is added to the post, not a revision + if ( $the_post = wp_is_post_revision($post_id) ) + $post_id = $the_post; + // expected_slashed ($meta_key) $meta_key = stripslashes($meta_key); @@ -3113,7 +3117,6 @@ function _wp_post_revision_fields( $post = null, $autosave = false ) { // Allow these to be versioned $fields = array( 'post_title' => __( 'Title' ), - 'post_author' => __( 'Author' ), 'post_content' => __( 'Content' ), 'post_excerpt' => __( 'Excerpt' ), ); @@ -3122,7 +3125,7 @@ function _wp_post_revision_fields( $post = null, $autosave = false ) { $fields = apply_filters( '_wp_post_revision_fields', $fields ); // WP uses these internally either in versioning or elsewhere - they cannot be versioned - foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count' ) as $protect ) + foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) unset( $fields[$protect] ); } diff --git a/wp-includes/query.php b/wp-includes/query.php index 5f5cb3f..35e53f3 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -773,7 +773,7 @@ class WP_Query { $qv['post_type'] = sanitize_user($qv['post_type'], true);
if ( !empty($qv['post_status']) )
- $qv['post_status'] = sanitize_user($qv['post_status'], true);
+ $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
if ( $this->is_posts_page && !$qv['withcomments'] )
$this->is_comment_feed = false;
@@ -1123,9 +1123,9 @@ class WP_Query { $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";
$include_tags = "'" . implode("', '", $q['tag_slug__in']) . "'";
$whichcat .= " AND $wpdb->terms.slug IN ($include_tags) ";
- $reqtag = is_term( $q['tag_slug__in'][0], 'post_tag' );
+ $reqtag = get_term_by( 'slug', $q['tag_slug__in'][0], 'post_tag' );
if ( !empty($reqtag) )
- $q['tag_id'] = $reqtag['term_id'];
+ $q['tag_id'] = $reqtag->term_id;
}
if ( !empty($q['tag__not_in']) ) {
diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 8a13a33..15247d8 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -67,8 +67,10 @@ function add_rewrite_endpoint($name, $places) { * @author Mark Jaquith */ function _wp_filter_taxonomy_base( $base ) { - if ( !empty( $base ) ) - $base = preg_replace( '|^/index\.php/|', '/', $base ); + if ( !empty( $base ) ) { + $base = preg_replace( '|^/index\.php/|', '', $base ); + $base = trim( $base, '/' ); + } return $base; } @@ -150,7 +152,7 @@ function url_to_postid($url) { $query = preg_replace("!^.+\?!", '', $query); // Substitute the substring matches into the query. - eval("\$query = \"$query\";"); + eval("\$query = \"" . addslashes($query) . "\";"); // Filter out non-public query vars global $wp; parse_str($query, $query_vars); @@ -445,9 +447,9 @@ class WP_Rewrite { } if (empty($this->category_base)) - $this->category_structure = $this->front . 'category/'; + $this->category_structure = trailingslashit( $this->front . 'category' ); else - $this->category_structure = $this->category_base . '/'; + $this->category_structure = trailingslashit( '/' . $this->root . $this->category_base ); $this->category_structure .= '%category%'; @@ -465,9 +467,9 @@ class WP_Rewrite { } if (empty($this->tag_base)) - $this->tag_structure = $this->front . 'tag/'; + $this->tag_structure = trailingslashit( $this->front . 'tag' ); else - $this->tag_structure = $this->tag_base . '/'; + $this->tag_structure = trailingslashit( '/' . $this->root . $this->tag_base ); $this->tag_structure .= '%tag%'; @@ -993,8 +995,8 @@ class WP_Rewrite { if ($this->using_index_permalinks()) { $this->root = $this->index . '/'; } - $this->category_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) . get_option( 'category_base' ); - $this->tag_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) . get_option( 'tag_base' ); + $this->category_base = get_option( 'category_base' ); + $this->tag_base = get_option( 'tag_base' ); unset($this->category_structure); unset($this->author_structure); unset($this->date_structure); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 38f8d52..0d9f966 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -37,7 +37,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080710' ); // Modify this version when tinyMCE plugins are changed. - $mce_version = apply_filters('tiny_mce_version', '20080710'); + $mce_version = apply_filters('tiny_mce_version', '20080810'); $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); @@ -50,7 +50,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080622' ); - $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20080411' ); + $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20080729' ); $scripts->localize( 'wp-lists', 'wpListL10n', array( 'url' => admin_url('admin-ajax.php') ) ); @@ -125,7 +125,7 @@ function wp_default_scripts( &$scripts ) { 'pending' => __('%i% pending') // must look like: "# blah blah" ) ); $scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' ); - $scripts->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080401'); + $scripts->add( 'admin-forms', '/wp-admin/js/forms.js', array('jquery'), '20080729'); $scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' ); $scripts->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' ); $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery'), '20080128' ); @@ -194,7 +194,7 @@ function wp_default_scripts( &$scripts ) { 'count' => __('Word count: %d') )); - $scripts->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20080511' ); + $scripts->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20080721' ); $scripts->localize( 'wp-gears', 'wpGearsL10n', array( 'updateCompleted' => __('Update completed.'), 'error' => __('Error:') diff --git a/wp-includes/streams.php b/wp-includes/streams.php index 924394f..60b617d 100644 --- a/wp-includes/streams.php +++ b/wp-includes/streams.php @@ -58,21 +58,39 @@ class StringReader { function StringReader($str='') { $this->_str = $str; $this->_pos = 0; + // If string functions are overloaded, we need to use the mb versions + $this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr'); + } + + function _substr($string, $start, $length) { + if ($this->is_overloaded) { + return mb_substr($string,$start,$length,'ascii'); + } else { + return substr($string,$start,$length); + } + } + + function _strlen($string) { + if ($this->is_overloaded) { + return mb_strlen($string,'ascii'); + } else { + return strlen($string); + } } function read($bytes) { - $data = substr($this->_str, $this->_pos, $bytes); + $data = $this->_substr($this->_str, $this->_pos, $bytes); $this->_pos += $bytes; - if (strlen($this->_str)<$this->_pos) - $this->_pos = strlen($this->_str); + if ($this->_strlen($this->_str)<$this->_pos) + $this->_pos = $this->_strlen($this->_str); return $data; } function seekto($pos) { $this->_pos = $pos; - if (strlen($this->_str)<$this->_pos) - $this->_pos = strlen($this->_str); + if ($this->_strlen($this->_str)<$this->_pos) + $this->_pos = $this->_strlen($this->_str); return $this->_pos; } @@ -81,9 +99,8 @@ class StringReader { } function length() { - return strlen($this->_str); + return $this->_strlen($this->_str); } - } @@ -149,17 +166,18 @@ class FileReader { // over it (it assumes knowledge of StringReader internals) class CachedFileReader extends StringReader { function CachedFileReader($filename) { + parent::StringReader(); + if (file_exists($filename)) { $length=filesize($filename); $fd = fopen($filename,'rb'); if (!$fd) { - $this->error = 3; // Cannot read file, probably permissions - return false; + $this->error = 3; // Cannot read file, probably permissions + return false; } $this->_str = fread($fd, $length); - $this->_pos = 0; fclose($fd); } else { diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 6c6edea..b3011f3 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -761,20 +761,36 @@ function &get_terms($taxonomies, $args = '') { function is_term($term, $taxonomy = '') { global $wpdb; + $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; + $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; + if ( is_int($term) ) { if ( 0 == $term ) return 0; - $where = $wpdb->prepare( "t.term_id = %d", $term ); - } else { - if ( '' === $term = sanitize_title($term) ) - return 0; - $where = $wpdb->prepare( "t.slug = %s", $term ); + $where = 't.term_id = %d'; + if ( !empty($taxonomy) ) + return $wpdb->get_row( $wpdb->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A ); + else + return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) ); + } + + if ( '' === $slug = sanitize_title($term) ) + return 0; + + $where = 't.slug = %s'; + $else_where = 't.name = %s'; + + if ( !empty($taxonomy) ) { + if ( $result = $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $slug, $taxonomy), ARRAY_A) ) + return $result; + + return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); } - if ( !empty($taxonomy) ) - return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $taxonomy), ARRAY_A); + if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $slug) ) ) + return $result; - return $wpdb->get_var("SELECT term_id FROM $wpdb->terms as t WHERE $where"); + return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $term) ); } /** @@ -1199,6 +1215,9 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { if ( is_int($term) && 0 == $term ) return new WP_Error('invalid_term_id', __('Invalid term ID')); + if ( '' == trim($term) ) + return new WP_Error('empty_term_name', __('A name is required for this term')); + $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => ''); $args = wp_parse_args($args, $defaults); $args['name'] = $term; @@ -1472,6 +1491,9 @@ function wp_update_term( $term, $taxonomy, $args = array() ) { $name = stripslashes($name); $description = stripslashes($description); + if ( '' == trim($name) ) + return new WP_Error('empty_term_name', __('A name is required for this term')); + $empty_slug = false; if ( empty($slug) ) { $empty_slug = true; diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 6376075..2ed7335 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -486,12 +486,17 @@ function preview_theme() { if ( !current_user_can( 'switch_themes' ) ) return; - $_GET[template] = preg_replace('|[^a-z0-9_-]|i', '', $_GET[template]); + $_GET[template] = preg_replace('|[^a-z0-9_.-]|i', '', $_GET[template]); + + if ( validate_file($_GET[template]) ) + return; add_filter('template', create_function('', "return '$_GET[template]';") ); if ( isset($_GET['stylesheet']) ) { - $_GET[stylesheet] = preg_replace('|[^a-z0-9_-]|i', '', $_GET[stylesheet]); + $_GET[stylesheet] = preg_replace('|[^a-z0-9_.-]|i', '', $_GET[stylesheet]); + if ( validate_file($_GET[stylesheet]) ) + return; add_filter('stylesheet', create_function('', "return '$_GET[stylesheet]';") ); } diff --git a/wp-includes/update.php b/wp-includes/update.php index 4d94ac2..beeee9f 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -90,22 +90,17 @@ function wp_update_plugins() { if ( !function_exists('fsockopen') || defined('WP_INSTALLING') ) return false; - $current = get_option( 'update_plugins' ); - - $time_not_changed = isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ); - // If running blog-side, bail unless we've not checked in the last 12 hours - if ( !function_exists( 'get_plugins' ) ) { - if ( $time_not_changed ) - return false; + if ( !function_exists( 'get_plugins' ) ) require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); - } $plugins = get_plugins(); $active = get_option( 'active_plugins' ); + $current = get_option( 'update_plugins' ); $new_option = ''; $new_option->last_checked = time(); + $time_not_changed = isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ); $plugin_changed = false; foreach ( $plugins as $file => $p ) { @@ -120,6 +115,12 @@ function wp_update_plugins() { $plugin_changed = true; } + foreach ( (array) $current->response as $plugin_file => $update_details ) { + if ( ! isset($plugins[ $plugin_file ]) ) { + $plugin_changed = true; + } + } + // Bail if we've checked in the last 12 hours and if nothing has changed if ( $time_not_changed && !$plugin_changed ) return false; @@ -154,9 +155,19 @@ function wp_update_plugins() { update_option( 'update_plugins', $new_option ); } -if ( defined( 'WP_ADMIN' ) && WP_ADMIN ) - add_action( 'admin_init', 'wp_update_plugins' ); -else - add_action( 'init', 'wp_update_plugins' ); + +function _maybe_update_plugins() { + $current = get_option( 'update_plugins' ); + if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) ) + return; + wp_update_plugins(); +} + +add_action( 'load-plugins.php', 'wp_update_plugins' ); +add_action( 'admin_init', '_maybe_update_plugins' ); +add_action( 'wp_update_plugins', 'wp_update_plugins' ); + +if ( !wp_next_scheduled('wp_update_plugins') ) + wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); ?> diff --git a/wp-includes/vars.php b/wp-includes/vars.php index 198bc97..dcb659d 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -34,10 +34,12 @@ if ( is_admin() ) { } // Simple browser detection -$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = false; +$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = false; if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) { $is_lynx = true; +} elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit') !== false ) { + $is_safari = true; } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) { $is_gecko = true; } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false) { diff --git a/wp-includes/version.php b/wp-includes/version.php index b19e143..bcf7aa7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -8,14 +8,14 @@ * * @global string $wp_version */ -$wp_version = '2.6'; +$wp_version = '2.6.1-beta2'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * * @global int $wp_db_version */ -$wp_db_version = 8201; +$wp_db_version = 8204; -$wpmu_version = '2.6'; +$wpmu_version = '2.6-beta1'; ?> diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 6d1c5d4..2a71a02 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -57,7 +57,7 @@ function register_sidebar($args = array()) { 'after_title' => "</h2>\n", ); - $sidebar = array_merge($defaults, $args); + $sidebar = array_merge($defaults, (array) $args); $wp_registered_sidebars[$sidebar['id']] = $sidebar; @@ -1125,18 +1125,11 @@ function wp_widget_rss_output( $rss, $args = array() ) { if ( empty($title) ) $title = __('Untitled'); $desc = ''; - if ( isset( $item['description'] ) && is_string( $item['description'] ) ) - $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES)))); - elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) ) - $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES)))); - $summary = ''; if ( isset( $item['description'] ) && is_string( $item['description'] ) ) - $summary = $item['description']; + $desc = $summary = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES)))); elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) ) - $summary = $item['summary']; - - $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($summary, ENT_QUOTES)))); + $desc = $summary = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES)))); if ( $show_summary ) { $desc = ''; diff --git a/wp-includes/wp-diff.php b/wp-includes/wp-diff.php index 77f3258..e43903d 100644 --- a/wp-includes/wp-diff.php +++ b/wp-includes/wp-diff.php @@ -1,9 +1,9 @@ <?php if ( !class_exists( 'Text_Diff' ) ) { - require( 'Text/Diff.php' ); - require( 'Text/Diff/Renderer.php' ); - require( 'Text/Diff/Renderer/inline.php' ); + require( dirname(__FILE__).'/Text/Diff.php' ); + require( dirname(__FILE__).'/Text/Diff/Renderer.php' ); + require( dirname(__FILE__).'/Text/Diff/Renderer/inline.php' ); } |