diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-08-31 14:55:29 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-08-31 14:55:29 +0000 |
commit | b764f60728be1d4e026f9d7ae618ab47e23322f8 (patch) | |
tree | 1f1b45c4f1c1cf027b3240f605346e56209be8ff | |
parent | dad010666b767a1d06588d1d09c771c62f67c387 (diff) | |
download | wordpress-mu-b764f60728be1d4e026f9d7ae618ab47e23322f8.tar.gz wordpress-mu-b764f60728be1d4e026f9d7ae618ab47e23322f8.tar.xz wordpress-mu-b764f60728be1d4e026f9d7ae618ab47e23322f8.zip |
WP Merge to rev #4147
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@729 7be80a69-a1ef-0310-a953-fb0f7c49ff36
89 files changed, 895 insertions, 647 deletions
diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php index 1f7c952..c037b14 100644 --- a/wp-admin/admin-db.php +++ b/wp-admin/admin-db.php @@ -297,23 +297,55 @@ function wp_insert_link($linkdata) { extract($linkdata); $update = false; + if ( !empty($link_id) ) $update = true; + if( trim( $link_name ) == '' ) + return 0; + $link_name = apply_filters('pre_link_name', $link_name); + + if( trim( $link_url ) == '' ) + return 0; + $link_url = apply_filters('pre_link_url', $link_url); + if ( empty($link_rating) ) $link_rating = 0; + else + $link_rating = (int) $link_rating; + + if ( empty($link_image) ) + $link_image = ''; + $link_image = apply_filters('pre_link_image', $link_image); if ( empty($link_target) ) $link_target = ''; + $link_target = apply_filters('pre_link_target', $link_target); if ( empty($link_visible) ) $link_visible = 'Y'; + $link_visibile = preg_replace('/[^YNyn]/', '', $link_visible); if ( empty($link_owner) ) $link_owner = $current_user->id; + else + $link_owner = (int) $link_owner; if ( empty($link_notes) ) $link_notes = ''; + $link_notes = apply_filters('pre_link_notes', $link_notes); + + if ( empty($link_description) ) + $link_description = ''; + $link_description = apply_filters('pre_link_description', $link_description); + + if ( empty($link_rss) ) + $link_rss = ''; + $link_rss = apply_filters('pre_link_rss', $link_rss); + + if ( empty($link_rel) ) + $link_rel = ''; + $link_rel = apply_filters('pre_link_rel', $link_rel); // Make sure we set a valid category if (0 == count($link_category) || !is_array($link_category)) { diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 63e9107..bb86180 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -301,6 +301,8 @@ function get_post_to_edit($id) { $post->post_title = format_to_edit($post->post_title); $post->post_title = apply_filters('title_edit_pre', $post->post_title); + $post->post_password = format_to_edit($post->post_password); + if ($post->post_type == 'page') $post->page_template = get_post_meta($id, '_wp_page_template', true); @@ -333,10 +335,10 @@ function get_default_post_to_edit() { $post_excerpt = ''; $post->post_status = 'draft'; - $post->comment_status = get_settings('default_comment_status'); - $post->ping_status = get_settings('default_ping_status'); - $post->post_pingback = get_settings('default_pingback_flag'); - $post->post_category = get_settings('default_category'); + $post->comment_status = get_option('default_comment_status'); + $post->ping_status = get_option('default_ping_status'); + $post->post_pingback = get_option('default_pingback_flag'); + $post->post_category = get_option('default_category'); $post->post_content = apply_filters('default_content', $post_content); $post->post_title = apply_filters('default_title', $post_title); $post->post_excerpt = apply_filters('default_excerpt', $post_excerpt); @@ -381,6 +383,23 @@ function wp_dropdown_roles( $default = false ) { } +function get_user_to_edit($user_id) { + $user = new WP_User($user_id); + $user->user_login = wp_specialchars($user->user_login, 1); + $user->user_email = wp_specialchars($user->user_email, 1); + $user->user_url = wp_specialchars($user->user_url, 1); + $user->first_name = wp_specialchars($user->first_name, 1); + $user->last_name = wp_specialchars($user->last_name, 1); + $user->display_name = wp_specialchars($user->display_name, 1); + $user->nickname = wp_specialchars($user->nickname, 1); + $user->aim = wp_specialchars($user->aim, 1); + $user->yim = wp_specialchars($user->yim, 1); + $user->jabber = wp_specialchars($user->jabber, 1); + $user->description = wp_specialchars($user->description); + + return $user; +} + // Creates a new user from the "Users" form using $_POST information. function add_user() { @@ -441,7 +460,7 @@ function edit_user($user_id = 0) { if (isset ($_POST['display_name'])) $user->display_name = wp_specialchars(trim($_POST['display_name'])); if (isset ($_POST['description'])) - $user->description = wp_specialchars(trim($_POST['description'])); + $user->description = trim($_POST['description']); if (isset ($_POST['jabber'])) $user->jabber = wp_specialchars(trim($_POST['jabber'])); if (isset ($_POST['aim'])) @@ -509,9 +528,11 @@ function get_link_to_edit($link_id) { $link->link_url = wp_specialchars($link->link_url, 1); $link->link_name = wp_specialchars($link->link_name, 1); - $link->link_description = wp_specialchars($link->link_description); + $link->link_image = wp_specialchars($link->link_image, 1); + $link->link_description = wp_specialchars($link->link_description, 1); $link->link_notes = wp_specialchars($link->link_notes); - $link->link_rss = wp_specialchars($link->link_rss); + $link->link_rss = wp_specialchars($link->link_rss, 1); + $link->link_rel = wp_specialchars($link->link_rel, 1); $link->post_category = $link->link_category; return $link; @@ -973,7 +994,7 @@ function list_meta($meta) { $style = ''; if ('_' == $entry['meta_key'] { 0 }) $style .= ' hidden'; - $key_js = addslashes(wp_specialchars( $entry['meta_key'], 'double' )); + $key_js = js_escape($entry['meta_key']); $entry['meta_key'] = wp_specialchars( $entry['meta_key'], true ); $entry['meta_value'] = wp_specialchars( $entry['meta_value'], true ); $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>"; @@ -1025,6 +1046,7 @@ function meta_form() { <?php foreach ($keys as $key) { + $key = wp_specialchars($key, 1); echo "\n\t<option value='$key'>$key</option>"; } ?> @@ -1098,7 +1120,7 @@ function touch_time($edit = 1, $for_post = 1) { echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" /> <label for="timestamp">'.__('Edit timestamp').'</label></legend>'; - $time_adj = time() + (get_settings('gmt_offset') * 3600); + $time_adj = time() + (get_option('gmt_offset') * 3600); $post_date = ($for_post) ? $post->post_date : $comment->comment_date; $jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj); $mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj); @@ -1616,8 +1638,8 @@ function validate_file_to_edit($file, $allowed_files = '') { } function get_home_path() { - $home = get_settings('home'); - if ($home != '' && $home != get_settings('siteurl')) { + $home = get_option('home'); + if ($home != '' && $home != get_option('siteurl')) { $home_path = parse_url($home); $home_path = $home_path['path']; $root = str_replace($_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"]); diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index f8322b1..2487f28 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -10,13 +10,14 @@ if ( $editing ) { } get_admin_page_title(); + ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> -<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> +<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> <title><?php bloginfo('name') ?> › <?php echo $title; ?> — WordPress</title> -<link rel="stylesheet" href="<?php echo get_settings('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" /> +<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" /> <script type="text/javascript"> //<![CDATA[ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}} @@ -24,13 +25,25 @@ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}el </script> <?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') ) : ?> <style type="text/css">* html { overflow-x: hidden; }</style> -<?php endif; wp_print_scripts(); do_action('admin_head'); ?> +<?php endif; +if ( isset($page_hook) ) + do_action('admin_print_scripts-' . $page_hook); +else if ( isset($plugin_page) ) + do_action('admin_print_scripts-' . $plugin_page); +do_action('admin_print_scripts'); + +if ( isset($page_hook) ) + do_action('admin_head-' . $page_hook); +else if ( isset($plugin_page) ) + do_action('admin_head-' . $plugin_page); +do_action('admin_head'); +?> </head> <body> <div id="wphead"> -<h1><?php echo wptexturize(get_settings(('blogname'))); ?> <span>(<a href="<?php echo get_settings('home') . '/'; ?>"><?php _e('View site »') ?></a>)</span></h1> +<h1><?php echo wptexturize(get_option(('blogname'))); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site »') ?></a>)</span></h1> </div> -<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_settings('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Sign Out'); ?></a>, <a href="profile.php"><?php _e('My Profile'); ?></a>] </p></div> +<div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Sign Out'); ?></a>, <a href="profile.php"><?php _e('My Profile'); ?></a>] </p></div> <?php require(ABSPATH . '/wp-admin/menu-header.php'); diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 91196b0..8458440 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -28,10 +28,10 @@ update_category_cache(); wp_get_current_user(); -$posts_per_page = get_settings('posts_per_page'); -$what_to_show = get_settings('what_to_show'); -$date_format = get_settings('date_format'); -$time_format = get_settings('time_format'); +$posts_per_page = get_option('posts_per_page'); +$what_to_show = get_option('what_to_show'); +$date_format = get_option('date_format'); +$time_format = get_option('time_format'); wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback')); @@ -51,6 +51,7 @@ if (isset($plugin_page)) { $page_hook = get_plugin_page_hook($plugin_page, $pagenow); if ( $page_hook ) { + do_action('load-' . $page_hook); if (! isset($_GET['noheader'])) require_once(ABSPATH . '/wp-admin/admin-header.php'); @@ -63,6 +64,8 @@ if (isset($plugin_page)) { if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page") && ! file_exists(ABSPATH . "wp-content/mu-plugins/$plugin_page")) wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); + do_action('load-' . $plugin_page); + if (! isset($_GET['noheader'])) require_once(ABSPATH . '/wp-admin/admin-header.php'); diff --git a/wp-admin/bookmarklet.php b/wp-admin/bookmarklet.php index 04e13cd..417d910 100644 --- a/wp-admin/bookmarklet.php +++ b/wp-admin/bookmarklet.php @@ -50,7 +50,7 @@ $popupurl = wp_specialchars($_REQUEST['popupurl']); <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php bloginfo('name') ?> › Bookmarklet — WordPress</title> -<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> +<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> <link rel="stylesheet" href="wp-admin.css" type="text/css" /> <style type="text/css"> diff --git a/wp-admin/cat-js.php b/wp-admin/cat-js.php index 08393b7..c286168 100644 --- a/wp-admin/cat-js.php +++ b/wp-admin/cat-js.php @@ -1,6 +1,6 @@ <?php require_once('../wp-config.php'); -header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true); +cache_javascript_headers(); ?> addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;}); addLoadEvent(newCatAddIn); diff --git a/wp-admin/comment.php b/wp-admin/comment.php index 95bee96..27652aa 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -62,7 +62,7 @@ case 'mailapprovecomment': echo "</table>\n"; echo "<p>" . __('Are you sure you want to do that?') . "</p>\n"; - echo "<form action='".get_settings('siteurl')."/wp-admin/comment.php' method='get'>\n"; + echo "<form action='".get_option('siteurl')."/wp-admin/comment.php' method='get'>\n"; wp_nonce_field($nonce_action); echo "<input type='hidden' name='action' value='$formaction' />\n"; if ( 'spam' == $_GET['delete_type'] ) @@ -72,7 +72,7 @@ case 'mailapprovecomment': echo "<input type='hidden' name='noredir' value='1' />\n"; echo "<input type='submit' value='" . __('Yes') . "' />"; echo " "; - echo "<input type='button' value='" . __('No') . "' onclick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit-comments.php';\" />\n"; + echo "<input type='button' value='" . __('No') . "' onclick=\"self.location='". get_option('siteurl') ."/wp-admin/edit-comments.php';\" />\n"; echo "</form>\n"; echo "</div>\n"; @@ -106,7 +106,7 @@ case 'deletecomment': if ((wp_get_referer() != '') && (false == $noredir)) { wp_redirect(wp_get_referer()); } else { - wp_redirect(get_settings('siteurl') .'/wp-admin/edit-comments.php'); + wp_redirect(get_option('siteurl') .'/wp-admin/edit-comments.php'); } exit(); break; @@ -133,7 +133,7 @@ case 'unapprovecomment': if ((wp_get_referer() != "") && (false == $noredir)) { wp_redirect(wp_get_referer()); } else { - wp_redirect(get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); + wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); } exit(); break; @@ -156,7 +156,7 @@ case 'approvecomment': wp_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); wp_set_comment_status($comment->comment_ID, "approve"); - if (get_settings("comments_notify") == true) { + if (get_option("comments_notify") == true) { wp_notify_postauthor($comment->comment_ID); } @@ -164,7 +164,7 @@ case 'approvecomment': if ((wp_get_referer() != "") && (false == $noredir)) { wp_redirect(wp_get_referer()); } else { - wp_redirect(get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); + wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); } exit(); break; diff --git a/wp-admin/dbx-admin-key-js.php b/wp-admin/dbx-admin-key-js.php index bca04ce..f47e53b 100644 --- a/wp-admin/dbx-admin-key-js.php +++ b/wp-admin/dbx-admin-key-js.php @@ -1,6 +1,6 @@ <?php require_once('admin.php'); -header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true); +cache_javascript_headers(); switch ( $_GET['pagenow'] ) : case 'post.php' : diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 4edcb68..8f4c24c 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -45,7 +45,7 @@ function getNumChecked(form) <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" /> <input type="submit" name="submit" value="<?php _e('Search') ?>" /> <input type="hidden" name="mode" value="<?php echo $mode; ?>" /> - <?php _e('(Searches within comment text, e-mail, URI, and IP address.)') ?> + <?php _e('(Searches within comment text, e-mail, URL, and IP address.)') ?> </fieldset> </form> <p><a href="?mode=view"><?php _e('View Mode') ?></a> | <a href="?mode=edit"><?php _e('Mass Edit Mode') ?></a></p> diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index ef8120d..ca69129 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -39,7 +39,7 @@ if ('' != $post->pinged) { $pings = '<p>'. __('Already pinged:') . '</p><ul>'; $already_pinged = explode("\n", trim($post->pinged)); foreach ($already_pinged as $pinged_url) { - $pings .= "\n\t<li>$pinged_url</li>"; + $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>"; } $pings .= '</ul>'; } @@ -80,7 +80,7 @@ addLoadEvent(focusit); <div id="searchresults" class="autocomplete"></div> <?php autocomplete_textbox( "wpmu-edit.php?action=searchcategories&search=", "newcat", "searchresults" ); ?> <?php endif; ?> -<ul id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></ul></div> +<ul id="categorychecklist"><?php dropdown_categories(get_option('default_category')); ?></ul></div> </fieldset> <fieldset id="commentstatusdiv" class="dbx-box"> @@ -100,7 +100,7 @@ addLoadEvent(focusit); </fieldset> <fieldset id="slugdiv" class="dbx-box"> -<h3 class="dbx-handle"><?php _e('Post slug') ?></h3> +<h3 class="dbx-handle"><?php _e('Post Slug') ?></h3> <div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div> </fieldset> @@ -122,7 +122,7 @@ addLoadEvent(focusit); <?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?> <fieldset id="authordiv" class="dbx-box"> -<h3 class="dbx-handle"><?php _e('Post author'); ?>:</h3> +<h3 class="dbx-handle"><?php _e('Post Author'); ?>:</h3> <div class="dbx-content"> <select name="post_author_override" id="post_author_override"> <?php diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php index 46d9447..bbcac0b 100644 --- a/wp-admin/edit-form-comment.php +++ b/wp-admin/edit-form-comment.php @@ -30,7 +30,7 @@ addLoadEvent(focusit); </div> </fieldset> <fieldset id="uridiv"> - <legend><label for="URL"><?php _e('URI:') ?></label></legend> + <legend><label for="URL"><?php _e('URL:') ?></label></legend> <div> <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" /> </div> diff --git a/wp-admin/edit-form.php b/wp-admin/edit-form.php index fd5efce..2d1cef6 100644 --- a/wp-admin/edit-form.php +++ b/wp-admin/edit-form.php @@ -34,7 +34,7 @@ addLoadEvent(focusit); <legend><a href="http://wordpress.org/docs/reference/post/#post" title="<?php _e('Help with post field') ?>"><?php _e('Post') ?></a></legend> <?php the_quicktags(); ?> <?php - $rows = get_settings('default_post_edit_rows'); + $rows = get_option('default_post_edit_rows'); if (($rows < 3) || ($rows > 100)) { $rows = 10; } @@ -51,7 +51,7 @@ edCanvas = document.getElementById('content'); <input type="hidden" name="post_pingback" value="<?php echo get_option('default_pingback_flag') ?>" id="post_pingback" /> -<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?> +<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?> <input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p> <p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" /> diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index 30002e6..ac9c831 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -48,7 +48,7 @@ function xfn_check($class, $value = '', $type = 'check') { <div id="searchresults" class="autocomplete"></div>
<?php autocomplete_textbox( "wpmu-edit.php?action=searchcategories&search=", "newcat", "searchresults" ); ?>
<?php endif; ?>
-<ul id="categorychecklist"><?php dropdown_categories(get_settings('default_link_category')); ?></ul>
+<ul id="categorychecklist"><?php dropdown_categories(get_option('default_link_category')); ?></ul>
</div>
</fieldset>
diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index 24b402a..aea02c8 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -95,13 +95,13 @@ addLoadEvent(focusit); <?php } ?> <fieldset id="slugdiv" class="dbx-box"> -<h3 class="dbx-handle"><?php _e('Page slug') ?></h3> +<h3 class="dbx-handle"><?php _e('Page Slug') ?></h3> <div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div> </fieldset> <?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?> <fieldset id="authordiv" class="dbx-box"> -<h3 class="dbx-handle"><?php _e('Page author'); ?>:</h3> +<h3 class="dbx-handle"><?php _e('Page Author'); ?>:</h3> <div class="dbx-content"> <select name="post_author_override" id="post_author_override"> <?php diff --git a/wp-admin/edit.php b/wp-admin/edit.php index a39338d..c473e46 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -112,6 +112,14 @@ if ( count($arc_result) ) { ?> <?php } ?> +<form name="viewcat" action="" method="get" style="float: left; width: 30em; margin-bottom: 1em;"> + <fieldset> + <legend><?php _e('Browse Category…') ?></legend> + <?php wp_dropdown_categories('show_option_all=All&hide_empty=0&hierarchical=1&show_count=1&selected='.$cat);?> + <input type="submit" name="submit" value="<?php _e('Show Category') ?>" /> + </fieldset> +</form> + <br style="clear:both;" /> <?php diff --git a/wp-admin/export.php b/wp-admin/export.php index 755dba8..300d6c9 100644 --- a/wp-admin/export.php +++ b/wp-admin/export.php @@ -27,7 +27,7 @@ function export_wp() { header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header("Content-Disposition: attachment; filename=$filename");
-header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true);
+header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
//$posts = query_posts('');
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts ORDER BY post_date_gmt ASC");
?>
diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index 68541b0..6328f16 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -24,7 +24,7 @@ class Blogger_Import { function reencode($text) {
return $text;
- return mb_convert_encoding($text, get_setting('blog_charset'), $this->import['blogs'][$_GET['blog']]['options']['blog-formatting']['backup']['encoding']);
+ return mb_convert_encoding($text, get_option('blog_charset'), $this->import['blogs'][$_GET['blog']]['options']['blog-formatting']['backup']['encoding']);
}
// Deletes saved data and redirect.
@@ -609,7 +609,7 @@ class Blogger_Import { if ( isset($_GET['noheader']) ) {
header('Content-Type: text/html; charset=utf-8');
- $this->import = get_settings('import-blogger');
+ $this->import = get_option('import-blogger');
if ( false === $this->import ) {
$step = 0;
diff --git a/wp-admin/inline-uploading.php b/wp-admin/inline-uploading.php index bd2a2b9..d65f450 100644 --- a/wp-admin/inline-uploading.php +++ b/wp-admin/inline-uploading.php @@ -286,7 +286,7 @@ wp_die(__('This script was not meant to be called directly.')); <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title></title>
<meta http-equiv="imagetoolbar" content="no" />
<script type="text/javascript">
diff --git a/wp-admin/link-add.php b/wp-admin/link-add.php index 713a8d5..087fc45 100644 --- a/wp-admin/link-add.php +++ b/wp-admin/link-add.php @@ -27,7 +27,7 @@ require('admin-header.php'); ?> <div class="wrap"> -<?php printf(__('<p>You can drag <a href="%s" title="Link add bookmarklet">Link This</a> to your toolbar and when you click it a window will pop up that will allow you to add whatever site you’re on to your bookmarks! Right now this only works on Mozilla or Netscape, but we’re working on it.</p>'), "javascript:void(linkmanpopup=window.open('" . get_settings('siteurl') . "/wp-admin/link-add.php?action=popup&linkurl='+escape(location.href)+'&name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();") ?> +<?php printf(__('<p>You can drag <a href="%s" title="Link add bookmarklet">Link This</a> to your toolbar and when you click it a window will pop up that will allow you to add whatever site you’re on to your bookmarks! Right now this only works on Mozilla or Netscape, but we’re working on it.</p>'), "javascript:void(linkmanpopup=window.open('" . get_option('siteurl') . "/wp-admin/link-add.php?action=popup&linkurl='+escape(location.href)+'&name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();") ?> </div> <?php diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index 337e7b5..7a15323 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -105,7 +105,7 @@ printf(__('Currently showing %1$s links ordered by %2$s'), $select_cat, $select_ <thead> <tr> <th width="15%" style="text-align: left"><?php _e('Name') ?></th> - <th style="text-align: left"><?php _e('URI') ?></th> + <th style="text-align: left"><?php _e('URL') ?></th> <th style="text-align: left"><?php _e('Categories') ?></th> <th><?php _e('rel') ?></th> <th><?php _e('Visible') ?></th> diff --git a/wp-admin/list-manipulation-js.php b/wp-admin/list-manipulation-js.php index 8711b28..288ec1e 100644 --- a/wp-admin/list-manipulation-js.php +++ b/wp-admin/list-manipulation-js.php @@ -1,7 +1,7 @@ <?php require_once('admin.php'); -header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true); -$handler = get_settings( 'siteurl' ) . '/wp-admin/admin-ajax.php'; +cache_javascript_headers(); +$handler = get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php'; ?> addLoadEvent(function(){theList=new listMan();}); function deleteSomething(what,id,message,obj){if(!obj)obj=theList;if(!message)message="<?php printf(__('Are you sure you want to delete this %s?'),"'+what+'"); ?>";if(confirm(message))return obj.ajaxDelete(what,id);else return false;} diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index 416a229..64aa41f 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -13,9 +13,9 @@ foreach ($menu as $item) { if ( !empty($submenu[$item[2]]) || current_user_can($item[1]) ) { if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") ) - echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; + echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; else - echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>"; + echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>"; } } @@ -42,11 +42,11 @@ $menu_hook = get_plugin_page_hook($item[2], $parent_file); if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") || ! empty($menu_hook)) { if ( 'admin.php' == $pagenow ) - echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; + echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>"; else - echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>"; + echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>"; } else { - echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>"; + echo "\n\t<li><a href='" . get_option('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>"; } endforeach; ?> diff --git a/wp-admin/moderation.php b/wp-admin/moderation.php index 799fd0d..9fae674 100644 --- a/wp-admin/moderation.php +++ b/wp-admin/moderation.php @@ -47,7 +47,7 @@ case 'update': break; case 'approve': wp_set_comment_status($key, 'approve'); - if ( get_settings('comments_notify') == true ) { + if ( get_option('comments_notify') == true ) { wp_notify_postauthor($key); } ++$item_approved; @@ -125,7 +125,7 @@ if ($comments) { $i = 0; foreach($comments as $comment) { ++$i; - $comment_date = mysql2date(get_settings("date_format") . " @ " . get_settings("time_format"), $comment->comment_date); + $comment_date = mysql2date(get_option("date_format") . " @ " . get_option("time_format"), $comment->comment_date); $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID='$comment->comment_post_ID'"); if ($i % 2) $class = 'js-unapproved alternate'; else $class = 'js-unapproved'; diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php index 8776664..e7317ce 100644 --- a/wp-admin/options-discussion.php +++ b/wp-admin/options-discussion.php @@ -27,17 +27,17 @@ if ($action == 'retrospam') { <ul> <li> <label for="default_pingback_flag"> -<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_settings('default_pingback_flag')); ?> /> +<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> /> <?php _e('Attempt to notify any Weblogs linked to from the article (slows down posting.)') ?></label> </li> <li> <label for="default_ping_status"> -<input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_settings('default_ping_status')); ?> /> +<input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_option('default_ping_status')); ?> /> <?php _e('Allow link notifications from other Weblogs (pingbacks and trackbacks.)') ?></label> </li> <li> <label for="default_comment_status"> -<input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_settings('default_comment_status')); ?> /> +<input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> /> <?php _e('Allow people to post comments on the article') ?></label> </li> </ul> @@ -47,12 +47,12 @@ if ($action == 'retrospam') { <ul> <li> <label for="comments_notify"> -<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_settings('comments_notify')); ?> /> +<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> /> <?php _e('Anyone posts a comment') ?> </label> </li> <li> <label for="moderation_notify"> -<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_settings('moderation_notify')); ?> /> +<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> /> <?php _e('A comment is held for moderation') ?> </label> </li> </ul> @@ -62,18 +62,18 @@ if ($action == 'retrospam') { <ul> <li> <label for="comment_moderation"> -<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_settings('comment_moderation')); ?> /> +<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> /> <?php _e('An administrator must approve the comment (regardless of any matches below)') ?> </label> </li> -<li><label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_settings('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label></li> -<li><label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_settings('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label></li> +<li><label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label></li> +<li><label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label></li> </ul> </fieldset> <fieldset class="options"> <legend><?php _e('Comment Moderation') ?></legend> -<p><?php printf(__('Hold a comment in the queue if it contains more than %s links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_settings('comment_max_links'). '" />' ) ?></p> +<p><?php printf(__('Hold a comment in the queue if it contains more than %s links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></p> -<p><?php _e('When a comment contains any of these words in its content, name, URI, e-mail, or IP, hold it in the moderation queue: (Separate multiple words with new lines.) <a href="http://codex.wordpress.org/Spam_Words">Common spam words</a>.') ?></p> +<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, hold it in the moderation queue: (Separate multiple words with new lines.) <a href="http://codex.wordpress.org/Spam_Words">Common spam words</a>.') ?></p> <p> <textarea name="moderation_keys" cols="60" rows="4" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('moderation_keys'); ?></textarea> </p> diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index 91ac1d7..a39cdbe 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -27,11 +27,10 @@ include('./admin-header.php'); <td><label><input type="checkbox" name="blog_public" value="1" <?php checked('1', $current_blog->public); ?> /> <?php _e('I would like my blog to appear in search engines like Google and Technorati, and in public listings around WordPress.com.'); ?></label> (<a href="http://wordpress.com/blog/2006/01/29/a-little-privacy/">more</a>) </td> </tr> - <tr valign="top"> <th scope="row"><?php _e('Membership:') ?></th> <td> <label for="comment_registration"> -<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_settings('comment_registration')); ?> /> +<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> /> <?php _e('Users must be registered and logged in to comment') ?> </label> </td> @@ -87,12 +86,12 @@ if( is_array( $lang_files ) && count($lang_files) > 1 ) { <tr> <th scope="row"><?php _e('Default date format:') ?></th> <td><input name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br /> -<?php _e('Output:') ?> <strong><?php echo mysql2date(get_settings('date_format'), current_time('mysql')); ?></strong></td> +<?php _e('Output:') ?> <strong><?php echo mysql2date(get_option('date_format'), current_time('mysql')); ?></strong></td> </tr> <tr> <th scope="row"><?php _e('Default time format:') ?></th> <td><input name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br /> -<?php _e('Output:') ?> <strong><?php echo gmdate(get_settings('time_format'), current_time('timestamp')); ?></strong></td> +<?php _e('Output:') ?> <strong><?php echo gmdate(get_option('time_format'), current_time('timestamp')); ?></strong></td> </tr> <tr> <th scope="row"> </th> @@ -103,7 +102,7 @@ if( is_array( $lang_files ) && count($lang_files) > 1 ) { <td><select name="start_of_week" id="start_of_week"> <?php for ($day_index = 0; $day_index <= 6; $day_index++) : - $selected = (get_settings('start_of_week') == $day_index) ? 'selected="selected"' : ''; + $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : ''; echo "\n\t<option value='$day_index' $selected>" . $wp_locale->get_weekday($day_index) . '</option>'; endfor; ?> diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php index 3dd1120..1989f33 100644 --- a/wp-admin/options-misc.php +++ b/wp-admin/options-misc.php @@ -18,7 +18,7 @@ include('admin-header.php'); <table class="editform optiontable"> <tr valign="top"> <th scope="row"><?php _e('Store uploads in this folder'); ?>:</th> -<td><input name="upload_path" type="text" id="upload_path" class="code" value="<?php echo str_replace(ABSPATH, '', get_settings('upload_path')); ?>" size="40" /> +<td><input name="upload_path" type="text" id="upload_path" class="code" value="<?php echo wp_specialchars(str_replace(ABSPATH, '', get_option('upload_path')), 1); ?>" size="40" /> <br /> <?php _e('Default is <code>wp-content/uploads</code>'); ?> </td> @@ -27,7 +27,7 @@ include('admin-header.php'); <td></td> <td> <label for="uploads_use_yearmonth_folders"> -<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1" <?php checked('1', get_settings('uploads_use_yearmonth_folders')); ?> /> +<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1" <?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> /> <?php _e('Organize my uploads into month- and year-based folders'); ?> </label> </td> @@ -35,10 +35,10 @@ include('admin-header.php'); </table> </fieldset> -<p><input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1" <?php checked('1', get_settings('use_linksupdate')); ?> /> +<p><input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1" <?php checked('1', get_option('use_linksupdate')); ?> /> <label for="use_linksupdate"><?php _e('Track Bookmarks’ Update Times') ?></label></p> <p> -<label><input type="checkbox" name="hack_file" value="1" <?php checked('1', get_settings('hack_file')); ?> /> <?php _e('Use legacy <code>my-hacks.php</code> file support') ?></label> +<label><input type="checkbox" name="hack_file" value="1" <?php checked('1', get_option('hack_file')); ?> /> <?php _e('Use legacy <code>my-hacks.php</code> file support') ?></label> </p> <p class="submit"> diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index 5b48a8f..68898a9 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -81,8 +81,8 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { } } -$permalink_structure = get_settings('permalink_structure'); -$category_base = get_settings('category_base'); +$permalink_structure = get_option('permalink_structure'); +$category_base = get_option('category_base'); if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') ) $writable = true; @@ -108,7 +108,7 @@ else <div class="wrap"> <h2><?php _e('Customize Permalink Structure') ?></h2> - <p><?php _e('By default WordPress uses web URIs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URI structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p> + <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p> <?php $prefix = ''; @@ -128,19 +128,19 @@ $structures = array( <p> <label> <input name="selection" type="radio" value="" class="tog" <?php checked('', $permalink_structure); ?> /> -<?php _e('Default'); ?><br /> <span> » <code><?php echo get_settings('home'); ?>/?p=123</code></span> +<?php _e('Default'); ?><br /> <span> » <code><?php echo get_option('home'); ?>/?p=123</code></span> </label> </p> <p> <label> <input name="selection" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $permalink_structure); ?> /> -<?php _e('Date and name based'); ?><br /> <span> » <code><?php echo get_settings('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></span> +<?php _e('Date and name based'); ?><br /> <span> » <code><?php echo get_option('home') . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/sample-post/'; ?></code></span> </label> </p> <p> <label> <input name="selection" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $permalink_structure); ?> /> -<?php _e('Numeric'); ?><br /> <span> » <code><?php echo get_settings('home') . $prefix ; ?>/archives/123</code></span> +<?php _e('Numeric'); ?><br /> <span> » <code><?php echo get_option('home') . $prefix ; ?>/archives/123</code></span> </label> </p> <p> @@ -158,9 +158,9 @@ checked="checked" <h3><?php _e('Optional'); ?></h3> <?php if ($is_apache) : ?> - <p><?php _e('If you like, you may enter a custom prefix for your category URIs here. For example, <code>/taxonomy/tags</code> would make your category links like <code>http://example.org/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p> + <p><?php _e('If you like, you may enter a custom prefix for your category <abbr title="Universal Resource Locator">URL</abbr>s here. For example, <code>/taxonomy/tags</code> would make your category links like <code>http://example.org/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p> <?php else : ?> - <p><?php _e('If you like, you may enter a custom prefix for your category URIs here. For example, <code>/index.php/taxonomy/tags</code> would make your category links like <code>http://example.org/index.php/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p> + <p><?php _e('If you like, you may enter a custom prefix for your category <abbr title="Universal Resource Locator">URL</abbr>s here. For example, <code>/index.php/taxonomy/tags</code> would make your category links like <code>http://example.org/index.php/taxonomy/tags/uncategorized/</code>. If you leave this blank the default will be used.') ?></p> <?php endif; ?> <p> <?php _e('Category base'); ?>: <?php if( $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $category_base = str_replace( "/blog", "", $category_base ); }?><input name="category_base" type="text" class="code" value="<?php echo $category_base; ?>" size="30" /> diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php index ef0b6cf..232c90a 100644 --- a/wp-admin/options-reading.php +++ b/wp-admin/options-reading.php @@ -54,8 +54,8 @@ include('admin-header.php'); <td> <input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" size="3" /> <select name="what_to_show" id="what_to_show" > -<option value="days" <?php selected('days', get_settings('what_to_show')); ?>><?php _e('days') ?></option> -<option value="posts" <?php selected('posts', get_settings('what_to_show')); ?>><?php _e('posts') ?></option> +<option value="days" <?php selected('days', get_option('what_to_show')); ?>><?php _e('days') ?></option> +<option value="posts" <?php selected('posts', get_option('what_to_show')); ?>><?php _e('posts') ?></option> </select> </td> </tr> @@ -72,8 +72,8 @@ include('admin-header.php'); <tr valign="top"> <th scope="row"><?php _e('For each article, show:') ?> </th> <td> -<label><input name="rss_use_excerpt" type="radio" value="0" <?php checked(0, get_settings('rss_use_excerpt')); ?> /> <?php _e('Full text') ?></label><br /> -<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_settings('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label> +<label><input name="rss_use_excerpt" type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?> /> <?php _e('Full text') ?></label><br /> +<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary') ?></label> </td> </tr> </table> diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index 4f362d3..4cd82ae 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -21,9 +21,9 @@ include('admin-header.php'); <th scope="row"><?php _e('Formatting:') ?></th> <td> <label for="use_smilies"> -<input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_settings('use_smilies')); ?> /> +<input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_option('use_smilies')); ?> /> <?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br /> -<label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_settings('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label> +<label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_option('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label> </td> </tr> <tr valign="top"> @@ -32,7 +32,7 @@ include('admin-header.php'); <?php $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); foreach ($categories as $category) : -if ($category->cat_ID == get_settings('default_category')) $selected = " selected='selected'"; +if ($category->cat_ID == get_option('default_category')) $selected = " selected='selected'"; else $selected = ''; echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>"; endforeach; @@ -44,7 +44,7 @@ endforeach; <td><select name="default_link_category" id="default_link_category"> <?php foreach ($categories as $category) : -if ($category->cat_ID == get_settings('default_link_category')) $selected = " selected='selected'"; +if ($category->cat_ID == get_option('default_link_category')) $selected = " selected='selected'"; else $selected = ''; echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>"; endforeach; diff --git a/wp-admin/options.php b/wp-admin/options.php index b6a8c50..c521d54 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -10,6 +10,67 @@ wp_reset_vars(array('action')); if ( !current_user_can('manage_options') ) wp_die(__('Cheatin’ uh?')); +function sanitize_option($option, $value) { + + switch ($option) { + case 'admin_email': + $value = sanitize_email($value); + break; + + case 'default_post_edit_rows': + case 'mailserver_port': + case 'comment_max_links': + $value = abs((int) $value); + break; + + case 'posts_per_page': + case 'posts_per_rss': + $value = (int) $value; + if ( empty($value) ) $value = 1; + if ( $value < -1 ) $value = abs($value); + break; + + case 'default_ping_status': + case 'default_comment_status': + // Options that if not there have 0 value but need to be something like "closed" + if ( $value == '0' || $value == '') + $value = 'closed'; + break; + + case 'blogdescription': + case 'blogname': + if (current_user_can('unfiltered_html') == false) + $value = wp_filter_post_kses( $value ); + break; + + case 'blog_charset': + $value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); + break; + + case 'date_format': + case 'time_format': + case 'mailserver_url': + case 'mailserver_login': + case 'mailserver_pass': + case 'ping_sites': + case 'upload_path': + $value = strip_tags($value); + $value = wp_filter_kses($value); + break; + + case 'gmt_offset': + $value = preg_replace('/[^0-9:.-]/', '', $value); + break; + + case 'siteurl': + case 'home': + $value = clean_url($value); + break; + } + + return $value; +} + if( $_GET[ 'adminhash' ] ) { $new_admin_details = get_option( 'new_admin_email' ); if( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && $new_admin_details[ 'newemail' ] != '' ) { @@ -36,8 +97,8 @@ case 'update': } // Save for later. - $old_siteurl = get_settings('siteurl'); - $old_home = get_settings('home'); + $old_siteurl = get_option('siteurl'); + $old_home = get_option('home'); // HACK // Options that if not there have 0 value but need to be something like "closed" @@ -46,7 +107,8 @@ case 'update': foreach ($options as $option) { $option = trim($option); $value = trim(stripslashes($_POST[$option])); - if( in_array($option, $nonbools) && ( $value == '0' || $value == '') ) + $value = sanitize_option($option, $value); + if( in_array($option, $nonbools) && ( $value == '0' || $value == '') ) $value = 'closed'; if( $option == 'blogdescription' || $option == 'blogname' ) @@ -93,13 +155,13 @@ This email has been sent to '{$value}' if ($any_changed) { // If siteurl or home changed, reset cookies. - if ( get_settings('siteurl') != $old_siteurl || get_settings('home') != $old_home ) { + if ( get_option('siteurl') != $old_siteurl || get_option('home') != $old_home ) { // If home changed, write rewrite rules to new location. $wp_rewrite->flush_rules(); // Clear cookies for old paths. wp_clearcookie(); // Set cookies for new paths. - wp_setcookie($user_login, $user_pass_md5, true, get_settings('home'), get_settings('siteurl')); + wp_setcookie($user_login, $user_pass_md5, true, get_option('home'), get_option('siteurl')); } //$message = sprintf(__('%d setting(s) saved... '), $any_changed); diff --git a/wp-admin/page.php b/wp-admin/page.php index 74f144e..78f17d2 100644 --- a/wp-admin/page.php +++ b/wp-admin/page.php @@ -149,8 +149,8 @@ case 'delete': } $sendback = wp_get_referer(); - if (strstr($sendback, 'page.php')) $sendback = get_settings('siteurl') .'/wp-admin/page.php'; - elseif (strstr($sendback, 'attachments.php')) $sendback = get_settings('siteurl') .'/wp-admin/attachments.php'; + if (strstr($sendback, 'page.php')) $sendback = get_option('siteurl') .'/wp-admin/page.php'; + elseif (strstr($sendback, 'attachments.php')) $sendback = get_option('siteurl') .'/wp-admin/attachments.php'; $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); wp_redirect($sendback); exit(); diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index 690baaf..c604d19 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -42,10 +42,11 @@ break; default: - require_once('admin-header.php'); if ( !current_user_can('edit_plugins') ) wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>'); + require_once('admin-header.php'); + update_recently_edited("wp-content/plugins/$file"); if (!is_file($real_file)) diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index c5bef8b..55f6bb5 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -11,7 +11,7 @@ if( $menu_perms[ 'plugins' ] != 1 ) if ( isset($_GET['action']) ) { if ('activate' == $_GET['action']) { check_admin_referer('activate-plugin_' . $_GET['plugin']); - $current = get_settings('active_plugins'); + $current = get_option('active_plugins'); if (!in_array($_GET['plugin'], $current)) { $current[] = trim( $_GET['plugin'] ); sort($current); @@ -22,7 +22,7 @@ if ( isset($_GET['action']) ) { wp_redirect('plugins.php?activate=true'); } else if ('deactivate' == $_GET['action']) { check_admin_referer('deactivate-plugin_' . $_GET['plugin']); - $current = get_settings('active_plugins'); + $current = get_option('active_plugins'); array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu! update_option('active_plugins', $current); do_action('deactivate_' . trim( $_GET['plugin'] )); @@ -37,7 +37,7 @@ require_once('admin-header.php'); // Clean up options // If any plugins don't exist, axe 'em -$check_plugins = get_settings('active_plugins'); +$check_plugins = get_option('active_plugins'); // Sanity check. If the active plugin list is not an array, make it an // empty array. @@ -50,7 +50,7 @@ if ( !is_array($check_plugins) ) { // plugins. foreach ($check_plugins as $check_plugin) { if (!file_exists(ABSPATH . 'wp-content/plugins/' . $check_plugin)) { - $current = get_settings('active_plugins'); + $current = get_option('active_plugins'); $key = array_search($check_plugin, $current); if ( false !== $key && NULL !== $key ) { unset($current[$key]); @@ -74,8 +74,8 @@ foreach ($check_plugins as $check_plugin) { <p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p> <?php -if ( get_settings('active_plugins') ) - $current_plugins = get_settings('active_plugins'); +if ( get_option('active_plugins') ) + $current_plugins = get_option('active_plugins'); $plugins = get_plugins(); diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php index 9aa49c7..45a5a5e 100644 --- a/wp-admin/post-new.php +++ b/wp-admin/post-new.php @@ -11,7 +11,7 @@ if ( ! current_user_can('edit_posts') ) { ?> <div class="wrap"> <p><?php printf(__('Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br /> You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br /> -When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_settings('admin_email')); ?> +When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_option('admin_email')); ?> </p> </div> <?php @@ -62,11 +62,11 @@ include('edit-form-advanced.php'); <?php if ($is_NS4 || $is_gecko) { ?> -<a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='<?php echo get_settings('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), wp_specialchars(get_settings('blogname'))); ?></a> +<a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), wp_specialchars(get_option('blogname'))); ?></a> <?php } else if ($is_winIE) { ?> -<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;location.href='<?php echo get_settings('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a> +<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;location.href='<?php echo get_option('siteurl') ?>/wp-admin/post-new.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a> <script type="text/javascript"> <!-- function oneclickbookmarklet(blah) { @@ -81,11 +81,11 @@ window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=50 <?php } else if ($is_opera) { ?> -<a href="javascript:location.href='<?php echo get_settings('siteurl'); ?>/wp-admin/post-new.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a> +<a href="javascript:location.href='<?php echo get_option('siteurl'); ?>/wp-admin/post-new.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a> <?php } else if ($is_macIE) { ?> -<a href="javascript:Q='';location.href='<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a> +<a href="javascript:Q='';location.href='<?php echo get_option('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_option('blogname')); ?></a> <?php } ?> diff --git a/wp-admin/post.php b/wp-admin/post.php index 0ba14e4..7b1c71c 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -157,8 +157,8 @@ case 'delete': } $sendback = wp_get_referer(); - if (strstr($sendback, 'post.php')) $sendback = get_settings('siteurl') .'/wp-admin/post-new.php'; - elseif (strstr($sendback, 'attachments.php')) $sendback = get_settings('siteurl') .'/wp-admin/attachments.php'; + if (strstr($sendback, 'post.php')) $sendback = get_option('siteurl') .'/wp-admin/post-new.php'; + elseif (strstr($sendback, 'attachments.php')) $sendback = get_option('siteurl') .'/wp-admin/attachments.php'; $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); wp_redirect($sendback); exit(); diff --git a/wp-admin/profile.php b/wp-admin/profile.php index bee9487..9b90d10 100644 --- a/wp-admin/profile.php +++ b/wp-admin/profile.php @@ -8,7 +8,7 @@ if ( current_user_can('edit_users') ) else $parent_file = 'profile.php'; include_once('admin-header.php'); -$profileuser = new WP_User($user_ID); +$profileuser = get_user_to_edit($user_ID); $bookmarklet_height= 440; ?> @@ -31,7 +31,7 @@ $bookmarklet_height= 440; <h3><?php _e('Personal Options'); ?></h3> <p><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="true" <?php checked('true', get_user_option('rich_editing')); ?> /> -<?php _e('Use the visual rich editor when writing') ?></label></p> +<?php _e('Use the visual editor when writing') ?></label></p> <?php do_action('profile_personal_options'); ?> diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index 18c143c..037cc91 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -56,10 +56,11 @@ break; default: - require_once('admin-header.php'); if ( !current_user_can('edit_themes') ) wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>'); + require_once('admin-header.php'); + update_recently_edited($file); if (!is_file($real_file)) diff --git a/wp-admin/update-links.php b/wp-admin/update-links.php index 4aa8a84..0ecbdd3 100644 --- a/wp-admin/update-links.php +++ b/wp-admin/update-links.php @@ -16,7 +16,7 @@ $query_string = "uris=$link_uris"; $http_request = "POST /updated-batch/ HTTP/1.0\r\n"; $http_request .= "Host: api.pingomatic.com\r\n"; -$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_settings('blog_charset')."\r\n"; +$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_option('blog_charset')."\r\n"; $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n"; $http_request .= 'User-Agent: WordPress/' . $wp_version . "\r\n"; $http_request .= "\r\n"; diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index 1731520..9583ddf 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -44,7 +44,7 @@ if( !is_wp_error( $errors ) ) { default: include ('admin-header.php'); -$profileuser = new WP_User($user_id); +$profileuser = get_user_to_edit($user_id); if ( !current_user_can('edit_user', $user_id) ) if ( !is_wp_error( $errors ) ) diff --git a/wp-admin/users.php b/wp-admin/users.php index 8f61d45..beee060 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -323,7 +323,7 @@ case 'adduser': check_admin_referer('add-user'); if ( ! current_user_can('create_users') ) - die(__('You can’t create users.')); + wp_die(__('You can’t create users.')); $user_id = add_user(); $update = 'add'; diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index 080614f..1ea420a 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -907,12 +907,17 @@ table .vers { border: 1px solid #ccc; } +#your-profile #rich_editing { + border: none; + background: #fff; +} + #your-profile fieldset { border: 1px solid #ccc; float: left; width: 40%; padding: .5em 2em; - margin: 1em; + margin: 1em 1em 1em 0; } #your-profile fieldset input { diff --git a/wp-admin/wpmu-edit.php b/wp-admin/wpmu-edit.php index 323d9ad..abf2732 100644 --- a/wp-admin/wpmu-edit.php +++ b/wp-admin/wpmu-edit.php @@ -133,7 +133,7 @@ switch( $_REQUEST[ 'action' ] ) { $blog_id = wpmu_create_blog($newdomain, $path, wp_specialchars( $blog['title'] ), $user_id ,'', $current_site->id); $wpdb->show_errors(); if( !is_wp_error($blog_id) ) { - @wp_mail( get_settings('admin_email'), sprintf(__('[%s] New Blog Created'), $current_site->site_name), "New blog created by {$current_user->user_login}\n\nAddress: http://{$newdomain}{$path}\nName: ".wp_specialchars( $blog['title'] ) ); + @wp_mail( get_option('admin_email'), sprintf(__('[%s] New Blog Created'), $current_site->site_name), "New blog created by {$current_user->user_login}\n\nAddress: http://{$newdomain}{$path}\nName: ".wp_specialchars( $blog['title'] ) ); wp_redirect( add_query_arg( "updated", "blogadded", $_SERVER[ 'HTTP_REFERER' ] ) ); die(); } else { diff --git a/wp-atom.php b/wp-atom.php index feb2845..2069bdf 100644 --- a/wp-atom.php +++ b/wp-atom.php @@ -5,11 +5,11 @@ if (empty($wp)) { wp('feed=atom'); } -header('Content-type: application/atom+xml; charset=' . get_settings('blog_charset'), true); +header('Content-type: application/atom+xml; charset=' . get_option('blog_charset'), true); $more = 1; ?> -<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?> +<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" @@ -35,11 +35,11 @@ $more = 1; <issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued> <?php the_category_rss('rdf') ?> <summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary> -<?php if ( !get_settings('rss_use_excerpt') ) : ?> +<?php if ( !get_option('rss_use_excerpt') ) : ?> <content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content> <?php endif; ?> <?php rss_enclosure(); ?> <?php do_action('atom_entry'); ?> </entry> - <?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?> + <?php $items_count++; if (($items_count == get_option('posts_per_rss')) && empty($m)) { break; } } } ?> </feed> diff --git a/wp-comments-post.php b/wp-comments-post.php index f2954f2..0563e0f 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -36,7 +36,7 @@ endif; $comment_type = ''; -if ( get_settings('require_name_email') && !$user->ID ) { +if ( get_option('require_name_email') && !$user->ID ) { if ( 6 > strlen($comment_author_email) || '' == $comment_author ) wp_die( __('Error: please fill the required fields (name, email).') ); elseif ( !is_email($comment_author_email)) diff --git a/wp-commentsrss2.php b/wp-commentsrss2.php index e62e7dc..3a5d7bf 100644 --- a/wp-commentsrss2.php +++ b/wp-commentsrss2.php @@ -5,9 +5,9 @@ if (empty($wp)) { wp('feed=rss2&withcomments=1'); } -header('Content-type: text/xml;charset=' . get_settings('blog_charset'), true); +header('Content-type: text/xml;charset=' . get_option('blog_charset'), true); -echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; +echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <!-- generator="wordpress/<?php echo $wp_version ?>" --> <rss version="2.0" @@ -34,14 +34,14 @@ if (have_posts()) : LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '" . get_the_ID() . "' AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' - ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') ); + ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') ); } else { // if no post id passed in, we'll just ue the last 10 comments. $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' - ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') ); + ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss') ); } // this line is WordPress' motor, do not delete it. if ($comments) { @@ -78,7 +78,7 @@ if (have_posts()) : ?> </item> <?php - } + } } } endwhile; endif; diff --git a/wp-content/themes/classic/comments-popup.php b/wp-content/themes/classic/comments-popup.php index 49ffe3c..b39c8c5 100644 --- a/wp-content/themes/classic/comments-popup.php +++ b/wp-content/themes/classic/comments-popup.php @@ -6,9 +6,9 @@ foreach ($posts as $post) { start_wp(); <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title><?php echo get_settings('blogname'); ?> - <?php echo sprintf(__("Comments on %s"), the_title('','',false)); ?></title> + <title><?php echo get_option('blogname'); ?> - <?php echo sprintf(__("Comments on %s"), the_title('','',false)); ?></title> - <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> + <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> <style type="text/css" media="screen"> @import url( <?php bloginfo('stylesheet_url'); ?> ); body { margin: 3px; } @@ -17,14 +17,14 @@ foreach ($posts as $post) { start_wp(); </head> <body id="commentspopup"> -<h1 id="header"><a href="" title="<?php echo get_settings('blogname'); ?>"><?php echo get_settings('blogname'); ?></a></h1> +<h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1> <h2 id="comments"><?php _e("Comments"); ?></h2> -<p><a href="<?php echo get_settings('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><?php _e("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post."); ?></a></p> +<p><a href="<?php echo get_option('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><?php _e("<abbr title=\"Really Simple Syndication\">RSS</abbr> feed for comments on this post."); ?></a></p> <?php if ('open' == $post->ping_status) { ?> -<p><?php _e("The <acronym title=\"Uniform Resource Identifier\">URI</acronym> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p> +<p><?php _e("The <abbr title=\"Universal Resource Locator\">URL</abbr> to TrackBack this entry is:"); ?> <em><?php trackback_url() ?></em></p> <?php } ?> <?php @@ -55,7 +55,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH <h2><?php _e("Leave a comment"); ?></h2> <p><?php _e("Line and paragraph breaks automatic, e-mail address never displayed, <acronym title=\"Hypertext Markup Language\">HTML</acronym> allowed:"); ?> <code><?php echo allowed_tags(); ?></code></p> -<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> +<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <p> <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" /> <label for="author"><?php _e("Name"); ?></label> @@ -70,7 +70,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH <p> <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" /> - <label for="url"><?php _e("<acronym title=\"Uniform Resource Identifier\">URI</acronym>"); ?></label> + <label for="url"><?php _e("<abbr title=\"Universal Resource Locator\">URL</abbr>"); ?></label> </p> <p> diff --git a/wp-content/themes/classic/comments.php b/wp-content/themes/classic/comments.php index 6222f1a..860e634 100644 --- a/wp-content/themes/classic/comments.php +++ b/wp-content/themes/classic/comments.php @@ -27,7 +27,7 @@ <p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?> <?php if ( pings_open() ) : ?> - <a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Uniform Resource Identifier">URI</abbr>'); ?></a> + <a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>'); ?></a> <?php endif; ?> </p> diff --git a/wp-content/themes/default/comments-popup.php b/wp-content/themes/default/comments-popup.php index 3cd58a6..42c9bc5 100644 --- a/wp-content/themes/default/comments-popup.php +++ b/wp-content/themes/default/comments-popup.php @@ -6,9 +6,9 @@ foreach ($posts as $post) { start_wp(); <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title><?php echo get_settings('blogname'); ?> - Comments on <?php the_title(); ?></title> + <title><?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?></title> - <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> + <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> <style type="text/css" media="screen"> @import url( <?php bloginfo('stylesheet_url'); ?> ); body { margin: 3px; } @@ -17,14 +17,14 @@ foreach ($posts as $post) { start_wp(); </head> <body id="commentspopup"> -<h1 id="header"><a href="" title="<?php echo get_settings('blogname'); ?>"><?php echo get_settings('blogname'); ?></a></h1> +<h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1> <h2 id="comments">Comments</h2> -<p><a href="<?php echo get_settings('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p> +<p><a href="<?php echo get_option('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p> <?php if ('open' == $post->ping_status) { ?> -<p>The <acronym title="Uniform Resource Identifier">URI</acronym> to TrackBack this entry is: <em><?php trackback_url() ?></em></p> +<p>The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em><?php trackback_url() ?></em></p> <?php } ?> <?php @@ -55,7 +55,7 @@ if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $pos <h2>Leave a comment</h2> <p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p> -<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> +<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <p> <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" /> <label for="author">Name</label> @@ -70,7 +70,7 @@ if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $pos <p> <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="28" tabindex="3" /> - <label for="url"><acronym title="Uniform Resource Identifier">URI</acronym></label> + <label for="url"><abbr title="Universal Resource Locator">URL</abbr></label> </p> <p> diff --git a/wp-content/themes/default/functions.php b/wp-content/themes/default/functions.php index 4558241..a6b09ef 100644 --- a/wp-content/themes/default/functions.php +++ b/wp-content/themes/default/functions.php @@ -4,13 +4,13 @@ function kubrick_head() { $head = "<style type='text/css'>\n<!--";
$output = '';
if ( kubrick_header_image() ) {
- $url = strip_tags( kubrick_header_image_url() );
+ $url = kubrick_header_image_url() ;
$output .= "#header { background: url('$url') no-repeat bottom center; }\n";
}
- if ( false !== ( $color = strip_tags( kubrick_header_color() ) ) ) {
+ if ( false !== ( $color = kubrick_header_color() ) ) {
$output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
}
- if ( false !== ( $display = strip_tags( kubrick_header_display() ) ) ) {
+ if ( false !== ( $display = kubrick_header_display() ) ) {
$output .= "#headerimg { display: $display }\n";
}
$foot = "--></style>\n";
@@ -21,7 +21,7 @@ function kubrick_head() { add_action('wp_head', 'kubrick_head');
function kubrick_header_image() {
- return apply_filters('kubrick_header_image', get_settings('kubrick_header_image'));
+ return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
}
function kubrick_upper_color() {
@@ -50,7 +50,7 @@ function kubrick_header_image_url() { }
function kubrick_header_color() {
- return apply_filters('kubrick_header_color', get_settings('kubrick_header_color'));
+ return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
}
function kubrick_header_color_string() {
@@ -62,7 +62,7 @@ function kubrick_header_color_string() { }
function kubrick_header_display() {
- return apply_filters('kubrick_header_display', get_settings('kubrick_header_display'));
+ return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
}
function kubrick_header_display_string() {
@@ -93,7 +93,7 @@ function kubrick_add_theme_page() { }
if ( isset($_REQUEST['toggledisplay']) ) {
- if ( false === get_settings('kubrick_header_display') )
+ if ( false === get_option('kubrick_header_display') )
update_option('kubrick_header_display', 'none');
else
delete_option('kubrick_header_display');
diff --git a/wp-content/themes/default/header.php b/wp-content/themes/default/header.php index 434adcb..e642de4 100644 --- a/wp-content/themes/default/header.php +++ b/wp-content/themes/default/header.php @@ -13,32 +13,16 @@ <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <style type="text/css" media="screen"> -/* To accomodate differing install paths of WordPress, images are referred only here, - and not in the wp-layout.css file. If you prefer to use only CSS for colors and what - not, then go right ahead and delete the following lines, and the image files. */ - body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); } -<?php /* Checks to see whether it needs a sidebar or not */ if ((! $withcomments) && (! is_single())) { ?> +<?php +// Checks to see whether it needs a sidebar or not +if ( !$withcomments && !is_single() ) { +?> #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; } <?php } else { // No sidebar ?> #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; } <?php } ?> - #header { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickheader.jpg") no-repeat bottom center; } - #footer { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickfooter.jpg") no-repeat bottom; border: none;} - -/* Because the template is slightly different, size-wise, with images, this needs to be set here - If you don't want to use the template's images, you can also delete the following two lines. */ - - #header { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; } - #headerimg { margin: 7px 9px 0; height: 192px; width: 740px; } - -/* To ease the insertion of a personal header image, I have done it in such a way, - that you simply drop in an image called 'personalheader.jpg' into your /images/ - directory. Dimensions should be at least 760px x 200px. Anything above that will - get cropped off of the image. */ - /* - #headerimg { background: url('<?php bloginfo('stylesheet_directory'); ?>/images/personalheader.jpg') no-repeat top;} - */ + </style> <?php wp_head(); ?> @@ -49,7 +33,7 @@ <div id="header"> <div id="headerimg"> - <h1><a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a></h1> + <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1> <div class="description"><?php bloginfo('description'); ?></div> </div> </div> diff --git a/wp-content/themes/home/comments-popup.php b/wp-content/themes/home/comments-popup.php index f01e3eb..24a4eb9 100644 --- a/wp-content/themes/home/comments-popup.php +++ b/wp-content/themes/home/comments-popup.php @@ -6,9 +6,9 @@ foreach ($posts as $post) { start_wp(); <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title><?php echo get_settings('blogname'); ?> - Comments on <?php the_title(); ?></title> + <title><?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?></title> - <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> + <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> <style type="text/css" media="screen"> @import url( <?php bloginfo('stylesheet_url'); ?> ); body { margin: 3px; } @@ -17,11 +17,11 @@ foreach ($posts as $post) { start_wp(); </head> <body id="commentspopup"> -<h1 id="header"><a href="" title="<?php echo get_settings('blogname'); ?>"><?php echo get_settings('blogname'); ?></a></h1> +<h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1> <h2 id="comments">Comments</h2> -<p><a href="<?php echo get_settings('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p> +<p><a href="<?php echo get_option('siteurl'); ?>/wp-commentsrss2.php?p=<?php echo $post->ID; ?>"><abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.</a></p> <?php if ('open' == $post->ping_status) { ?> <p>The <acronym title="Uniform Resource Identifier">URI</acronym> to TrackBack this entry is: <em><?php trackback_url() ?></em></p> @@ -56,7 +56,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH <h2>Leave a comment</h2> <p>Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code><?php echo allowed_tags(); ?></code></p> -<form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> +<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> <p> <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" /> <label for="author">Name</label> diff --git a/wp-content/themes/home/header.php b/wp-content/themes/home/header.php index cb69360..ad96a89 100644 --- a/wp-content/themes/home/header.php +++ b/wp-content/themes/home/header.php @@ -50,7 +50,7 @@ <div id="header">
<div id="headerimg">
- <h1><a href="<?php echo get_settings('home'); ?>"><?php bloginfo('name'); ?></a></h1>
+ <h1><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1>
<div class="description"><?php bloginfo('description'); ?></div>
</div>
</div>
diff --git a/wp-content/themes/home/sidebar.php b/wp-content/themes/home/sidebar.php index e74ecf7..eb58ca2 100644 --- a/wp-content/themes/home/sidebar.php +++ b/wp-content/themes/home/sidebar.php @@ -17,23 +17,23 @@ <p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p> <?php /* If this is a yearly archive */ } elseif (is_day()) { ?> - <p>You are currently browsing the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives + <p>You are currently browsing the <a href="<?php echo get_option('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives for the day <?php the_time('l, F jS, Y'); ?>.</p> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> - <p>You are currently browsing the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives + <p>You are currently browsing the <a href="<?php echo get_option('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives for <?php the_time('F, Y'); ?>.</p> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> - <p>You are currently browsing the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives + <p>You are currently browsing the <a href="<?php echo get_option('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives for the year <?php the_time('Y'); ?>.</p> <?php /* If this is a monthly archive */ } elseif (is_search()) { ?> - <p>You have searched the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives + <p>You have searched the <a href="<?php echo get_option('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p> <?php /* If this is a monthly archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> - <p>You are currently browsing the <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives.</p> + <p>You are currently browsing the <a href="<?php echo get_option('siteurl'); ?>"><?php echo bloginfo('name'); ?></a> weblog archives.</p> <?php } ?> </li> diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index c52a17e..a98bc63 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -1,14 +1,15 @@ <?php -function get_the_author($idmode = '') { +function get_the_author($deprecated = '') { global $authordata; return apply_filters('the_author', $authordata->display_name); } -function the_author($idmode = '', $echo = true) { - if ( $echo ) - echo get_the_author($idmode); - return get_the_author($idmode); +// Using echo = false is deprecated. Use get_the_author instead. +function the_author($deprecated = '', $deprecated_echo = true) { + if ( $deprecated_echo ) + echo get_the_author(); + return get_the_author(); } function get_the_author_description() { @@ -80,6 +81,14 @@ function the_author_url() { echo get_the_author_url(); } +function the_author_link() { + if (get_the_author_url()) { + echo '<a href="' . get_the_author_url() . '" title="' . sprintf(__("Visit %s's website"), get_the_author()) . '" rel="external">' . get_the_author() . '</a>'; + } else { + the_author(); + } +} + function get_the_author_icq() { global $authordata; return $authordata->icq; @@ -126,20 +135,20 @@ function the_author_posts() { echo get_the_author_posts(); } -/* the_author_posts_link() requires no get_, use get_author_link() */ -function the_author_posts_link($idmode='') { +/* the_author_posts_link() requires no get_, use get_author_posts_url() */ +function the_author_posts_link($deprecated = '') { global $authordata; - echo '<a href="' . get_author_link(0, $authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars(the_author($idmode, false))) . '">' . the_author($idmode, false) . '</a>'; + echo '<a href="' . get_author_posts_url($authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars(get_the_author())) . '">' . get_the_author() . '</a>'; } -function get_author_link($echo = false, $author_id, $author_nicename = '') { +function get_author_posts_url($author_id, $author_nicename = '') { global $wpdb, $wp_rewrite, $post, $cache_userdata; $auth_ID = $author_id; $link = $wp_rewrite->get_author_permastruct(); if ( empty($link) ) { - $file = get_settings('home') . '/'; + $file = get_option('home') . '/'; $link = $file . '?author=' . $auth_ID; } else { if ( '' == $author_nicename ) { @@ -148,13 +157,11 @@ function get_author_link($echo = false, $author_id, $author_nicename = '') { $author_nicename = $user->user_nicename; } $link = str_replace('%author%', $author_nicename, $link); - $link = get_settings('home') . trailingslashit($link); + $link = get_option('home') . trailingslashit($link); } $link = apply_filters('author_link', $link, $author_id, $author_nicename); - if ( $echo ) - echo $link; return $link; } @@ -195,7 +202,7 @@ function wp_list_authors($args = '') { if ( !$hide_empty ) $link = $name; } else { - $link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>'; + $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>'; if ( (! empty($feed_image)) || (! empty($feed)) ) { $link .= ' '; diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php index 1e762e0..da3626b 100644 --- a/wp-includes/bookmark-template.php +++ b/wp-includes/bookmark-template.php @@ -20,17 +20,17 @@ function wp_get_links($args = '') { parse_str($args); - if (! isset($category)) $category = -1; - if (! isset($before)) $before = ''; - if (! isset($after)) $after = '<br />'; - if (! isset($between)) $between = ' '; - if (! isset($show_images)) $show_images = true; - if (! isset($orderby)) $orderby = 'name'; - if (! isset($show_description)) $show_description = true; - if (! isset($show_rating)) $show_rating = false; - if (! isset($limit)) $limit = -1; - if (! isset($show_updated)) $show_updated = 1; - if (! isset($echo)) $echo = true; + if ( !isset($category) ) $category = -1; + if ( !isset($before) ) $before = ''; + if ( !isset($after) ) $after = '<br />'; + if ( !isset($between) ) $between = ' '; + if ( !isset($show_images) ) $show_images = true; + if ( !isset($orderby) ) $orderby = 'name'; + if ( !isset($show_description) ) $show_description = true; + if ( !isset($show_rating) ) $show_rating = false; + if ( !isset($limit) ) $limit = -1; + if ( !isset($show_updated) ) $show_updated = 1; + if ( !isset($echo) ) $echo = true; return get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo); } // end wp_get_links @@ -73,89 +73,76 @@ function get_links($category = -1, global $wpdb; $order = 'ASC'; - if (substr($orderby, 0, 1) == '_') { + if ( substr($orderby, 0, 1) == '_' ) { $order = 'DESC'; $orderby = substr($orderby, 1); } - - if ($category == -1) { //get_bookmarks uses '' to signify all categories + + if ( $category == -1 ) //get_bookmarks uses '' to signify all categories $category = ''; - } $results = get_bookmarks("category=$category&orderby=$orderby&order=$order&show_updated=$show_updated&limit=$limit"); - if (!$results) { + if ( !$results ) return; - } - $output = ''; - foreach ($results as $row) { - if (!isset($row->recently_updated)) $row->recently_updated = false; - $output .= $before; - if ($show_updated && $row->recently_updated) { - $output .= get_settings('links_recently_updated_prepend'); - } - + foreach ( (array) $results as $row ) { + if ( !isset($row->recently_updated) ) + $row->recently_updated = false; + $output .= $before; + if ( $show_updated && $row->recently_updated ) + $output .= get_option('links_recently_updated_prepend'); $the_link = '#'; - if (!empty($row->link_url)) + if ( !empty($row->link_url) ) $the_link = wp_specialchars($row->link_url); - $rel = $row->link_rel; - if ($rel != '') { + if ( '' != $rel ) $rel = ' rel="' . $rel . '"'; - } $desc = wp_specialchars($row->link_description, ENT_QUOTES); $name = wp_specialchars($row->link_name, ENT_QUOTES); $title = $desc; - if ($show_updated) { - if (substr($row->link_updated_f, 0, 2) != '00') { - $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $row->link_updated_f + (get_settings('gmt_offset') * 3600)) . ')'; - } - } + if ( $show_updated ) + if (substr($row->link_updated_f, 0, 2) != '00') + $title .= ' (Last updated ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * 3600)) . ')'; - if ('' != $title) { + if ( '' != $title ) $title = ' title="' . $title . '"'; - } $alt = ' alt="' . $name . '"'; $target = $row->link_target; - if ('' != $target) { + if ( '' != $target ) $target = ' target="' . $target . '"'; - } $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; - if (($row->link_image != null) && $show_images) { - if (strstr($row->link_image, 'http')) + if ( $row->link_image != null && $show_images ) { + if ( strpos($row->link_image, 'http') !== false ) $output .= "<img src=\"$row->link_image\" $alt $title />"; else // If it's a relative path - $output .= "<img src=\"" . get_settings('siteurl') . "$row->link_image\" $alt $title />"; + $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />"; } else { $output .= $name; } $output .= '</a>'; - if ($show_updated && $row->recently_updated) { - $output .= get_settings('links_recently_updated_append'); - } + if ( $show_updated && $row->recently_updated ) + $output .= get_option('links_recently_updated_append'); - if ($show_description && ($desc != '')) { + if ( $show_description && '' != $desc ) $output .= $between . $desc; - } + $output .= "$after\n"; } // end while - if ($echo) { - echo $output; - } else { + if ( !$echo ) return $output; - } + echo $output; } function get_linkrating($link) { @@ -170,9 +157,9 @@ function get_linkrating($link) { function get_linkcatname($id = 0) { $id = (int) $id; - if ( empty($id) ) - return ''; - + if ( empty($id) ) + return ''; + $cats = wp_get_link_cats($id); if ( empty($cats) || ! is_array($cats) ) @@ -194,24 +181,18 @@ function get_linkcatname($id = 0) { ** file (default linkspopup.php) - the page to open in the popup window ** count (default true) - the number of links in the db */ -function links_popup_script($text = 'Links', $width=400, $height=400, - $file='links.all.php', $count = true) { - if ($count == true) { - $counts = $wpdb->get_var("SELECT count(*) FROM $wpdb->links"); - } - - $javascript = "<a href=\"#\" " . - " onclick=\"javascript:window.open('$file?popup=1', '_blank', " . - "'width=$width,height=$height,scrollbars=yes,status=no'); " . - " return false\">"; - $javascript .= $text; - - if ($count == true) { - $javascript .= " ($counts)"; - } - - $javascript .="</a>\n\n"; - echo $javascript; +function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { + if ( $count ) + $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links"); + + $javascript = "<a href=\"#\" onclick=\"javascript:window.open('$file?popup=1', '_blank', 'width=$width,height=$height,scrollbars=yes,status=no'); return false\">"; + $javascript .= $text; + + if ( $count ) + $javascript .= " ($counts)"; + + $javascript .= "</a>\n\n"; + echo $javascript; } @@ -233,25 +214,25 @@ function get_links_list($order = 'name', $hide_if_empty = 'obsolete') { // Handle link category sorting $direction = 'ASC'; - if (substr($order,0,1) == '_') { + if ( '_' == substr($order,0,1) ) { $direction = 'DESC'; $order = substr($order,1); } - if (!isset($direction)) $direction = ''; + if ( !isset($direction) ) + $direction = ''; $cats = get_categories("type=link&orderby=$order&order=$direction&hierarchical=0"); // Display each category - if ($cats) { - foreach ($cats as $cat) { + if ( $cats ) { + foreach ( (array) $cats as $cat ) { // Handle each category. // Display the category name echo ' <li id="linkcat-' . $cat->cat_ID . '"><h2>' . $cat->cat_name . "</h2>\n\t<ul>\n"; // Call get_links() with all the appropriate params - get_links($cat->cat_ID, - '<li>',"</li>","\n", true, 'name', false); + get_links($cat->cat_ID, '<li>', "</li>", "\n", true, 'name', false); // Close the last category echo "\n\t</ul>\n</li>\n"; @@ -271,62 +252,55 @@ function _walk_bookmarks($bookmarks, $args = '' ) { extract($r); foreach ( (array) $bookmarks as $bookmark ) { - if (!isset($bookmark->recently_updated)) $bookmark->recently_updated = false; - $output .= $before; - if ($show_updated && $bookmark->recently_updated) { - $output .= get_settings('links_recently_updated_prepend'); - } + if ( !isset($bookmark->recently_updated) ) + $bookmark->recently_updated = false; + $output .= $before; + if ( $show_updated && $bookmark->recently_updated ) + $output .= get_option('links_recently_updated_prepend'); $the_link = '#'; - if (!empty($bookmark->link_url)) + if ( !empty($bookmark->link_url) ) $the_link = wp_specialchars($bookmark->link_url); $rel = $bookmark->link_rel; - if ($rel != '') { + if ( '' != $rel ) $rel = ' rel="' . $rel . '"'; - } $desc = wp_specialchars($bookmark->link_description, ENT_QUOTES); $name = wp_specialchars($bookmark->link_name, ENT_QUOTES); $title = $desc; - if ($show_updated) { - if (substr($bookmark->link_updated_f, 0, 2) != '00') { - $title .= ' (Last updated ' . date(get_settings('links_updated_date_format'), $bookmark->link_updated_f + (get_settings('gmt_offset') * 3600)) . ')'; - } - } + if ( $show_updated ) + if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) + $title .= ' (Last updated ' . date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600)) . ')'; - if ('' != $title) { + if ( '' != $title ) $title = ' title="' . $title . '"'; - } $alt = ' alt="' . $name . '"'; $target = $bookmark->link_target; - if ('' != $target) { + if ( '' != $target ) $target = ' target="' . $target . '"'; - } $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; - if (($bookmark->link_image != null) && $show_images) { - if (strstr($bookmark->link_image, 'http')) + if ( $bookmark->link_image != null && $show_images ) { + if ( strpos($bookmark->link_image, 'http') !== false ) $output .= "<img src=\"$bookmark->link_image\" $alt $title />"; else // If it's a relative path - $output .= "<img src=\"" . get_settings('siteurl') . "$bookmark->link_image\" $alt $title />"; + $output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />"; } else { $output .= $name; } $output .= '</a>'; - if ($show_updated && $bookmark->recently_updated) { - $output .= get_settings('links_recently_updated_append'); - } + if ( $show_updated && $bookmark->recently_updated ) + $output .= get_option('links_recently_updated_append'); - if ($show_description && ($desc != '')) { + if ( $show_description && '' != $desc ) $output .= $between . $desc; - } $output .= "$after\n"; } // end while @@ -345,10 +319,10 @@ function wp_list_bookmarks($args = '') { 'category_orderby' => 'name', 'category_order' => 'ASC'); $r = array_merge($defaults, $r); extract($r); - + // TODO: The rest of it. // If $categorize, group links by category with the category name being the - // title of each li, otherwise just list them with title_li as the li title. + // title of each li, otherwise just list them with title_li as the li title. // If $categorize and $category or $category_name, list links for the given category // with the category name as the title li. If not $categorize, use title_li. // When using each category's name as a title li, use before and after args for specifying @@ -369,10 +343,9 @@ function wp_list_bookmarks($args = '') { } } - if ($echo) - echo $output; - - return $output; + if ( !$echo ) + return $output; + echo $output; } ?> diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index 350d91e..306a33f 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -91,8 +91,8 @@ function get_bookmarks($args = '') { $join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) "; } - if (get_settings('links_recently_updated_time')) { - $recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL " . get_settings('links_recently_updated_time') . " MINUTE) >= NOW(), 1,0) as recently_updated "; + if (get_option('links_recently_updated_time')) { + $recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL " . get_option('links_recently_updated_time') . " MINUTE) >= NOW(), 1,0) as recently_updated "; } else { $recently_updated_test = ''; } @@ -131,4 +131,4 @@ function get_bookmarks($args = '') { return apply_filters('get_bookmarks', $results, $r); } -?>
\ No newline at end of file +?> diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index 3e85e4f..b2d2662 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -6,6 +6,7 @@ class WP_Roles { var $role_objects = array(); var $role_names = array(); var $role_key; + var $use_db = true; function WP_Roles() { $this->_init(); @@ -13,9 +14,14 @@ class WP_Roles { function _init () { global $wpdb; + global $wp_user_roles; $this->role_key = $wpdb->prefix . 'user_roles'; - - $this->roles = get_option($this->role_key); + if ( ! empty($wp_user_roles) ) { + $this->roles = $wp_user_roles; + $this->use_db = false; + } else { + $this->roles = get_option($this->role_key); + } if ( empty($this->roles) ) return; @@ -35,7 +41,8 @@ class WP_Roles { $this->roles[$role] = array( 'name' => $display_name, 'capabilities' => $capabilities); - update_option($this->role_key, $this->roles); + if ( $this->use_db ) + update_option($this->role_key, $this->roles); $this->role_objects[$role] = new WP_Role($role, $capabilities); $this->role_names[$role] = $display_name; return $this->role_objects[$role]; @@ -48,18 +55,21 @@ class WP_Roles { unset($this->role_objects[$role]); unset($this->role_names[$role]); unset($this->roles[$role]); - - update_option($this->role_key, $this->roles); + + if ( $this->use_db ) + update_option($this->role_key, $this->roles); } function add_cap($role, $cap, $grant = true) { $this->roles[$role]['capabilities'][$cap] = $grant; - update_option($this->role_key, $this->roles); + if ( $this->use_db ) + update_option($this->role_key, $this->roles); } function remove_cap($role, $cap) { unset($this->roles[$role]['capabilities'][$cap]); - update_option($this->role_key, $this->roles); + if ( $this->use_db ) + update_option($this->role_key, $this->roles); } function &get_role($role) { diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 0ca0e62..2c7db3a 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -23,7 +23,7 @@ function get_category_link($category_id) { $catlink = $wp_rewrite->get_category_permastruct(); if ( empty($catlink) ) { - $file = get_settings('home') . '/'; + $file = get_option('home') . '/'; $catlink = $file . '?cat=' . $category_id; } else { $category = &get_category($category_id); @@ -33,7 +33,7 @@ function get_category_link($category_id) { $category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename . '/'; $catlink = str_replace('%category%', $category_nicename, $catlink); - $catlink = get_settings('home') . trailingslashit($catlink); + $catlink = get_option('home') . trailingslashit($catlink); } return apply_filters('category_link', $catlink, $category_id); } diff --git a/wp-includes/classes.php b/wp-includes/classes.php index f2d823f..bf6caba 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -8,7 +8,7 @@ class retrospam_mgr { function retrospam_mgr() { global $wpdb; - $list = explode("\n", get_settings('moderation_keys') ); + $list = explode("\n", get_option('moderation_keys') ); $list = array_unique( $list ); $this->spam_words = $list; @@ -94,7 +94,9 @@ class WP { $this->query_vars = array(); - if (! empty($extra_query_vars)) + if ( is_array($extra_query_vars) ) + $this->extra_query_vars = & $extra_query_vars; + else if (! empty($extra_query_vars)) parse_str($extra_query_vars, $this->extra_query_vars); // Process PATH_INFO, REQUEST_URI, and 404 for permalinks. @@ -114,7 +116,7 @@ class WP { $req_uri_array = explode('?', $req_uri); $req_uri = $req_uri_array[0]; $self = $_SERVER['PHP_SELF']; - $home_path = parse_url(get_settings('home')); + $home_path = parse_url(get_option('home')); $home_path = $home_path['path']; $home_path = trim($home_path, '/'); @@ -212,19 +214,20 @@ class WP { $this->query_vars[$wpvar] = $_GET[$wpvar]; elseif (!empty($perma_query_vars[$wpvar])) $this->query_vars[$wpvar] = $perma_query_vars[$wpvar]; - else - $this->query_vars[$wpvar] = ''; } - for ($i=0; $i<count($this->private_query_vars); $i += 1) { - $wpvar = $this->private_query_vars[$i]; - if (isset($this->extra_query_vars[$wpvar])) - $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar]; + foreach ($this->private_query_vars as $var) { + if (isset($this->extra_query_vars[$var])) + $this->query_vars[$var] = $this->extra_query_vars[$var]; + elseif (isset($GLOBALS[$var]) && '' != $GLOBALS[$var]) + $this->query_vars[$var] = $GLOBALS[$var]; } if ( isset($error) ) $this->query_vars['error'] = $error; + $this->query_vars = apply_filters('request', $this->query_vars); + do_action('parse_request', array(&$this)); } @@ -272,7 +275,6 @@ class WP { function build_query_string() { $this->query_string = ''; - foreach (array_keys($this->query_vars) as $wpvar) { if ( '' != $this->query_vars[$wpvar] ) { $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&'; @@ -280,14 +282,12 @@ class WP { } } - foreach ($this->private_query_vars as $wpvar) { - if (isset($GLOBALS[$wpvar]) && '' != $GLOBALS[$wpvar] && ! isset($this->extra_query_vars[$wpvar]) ) { - $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&'; - $this->query_string .= $wpvar . '=' . rawurlencode($GLOBALS[$wpvar]); - } + // query_string filter deprecated. Use request filter instead. + global $wp_filter; + if ( isset($wp_filter['query_string']) ) { // Don't bother filtering and parsing if no plugins are hooked in. + $this->query_string = apply_filters('query_string', $this->query_string); + parse_str($this->query_string, $this->query_vars); } - - $this->query_string = apply_filters('query_string', $this->query_string); } function register_globals() { @@ -314,7 +314,7 @@ class WP { function query_posts() { $this->build_query_string(); - query_posts($this->query_string); + query_posts($this->query_vars); } function handle_404() { @@ -348,10 +348,16 @@ class WP { class WP_Error { var $errors = array(); + var $error_data = array(); + + function WP_Error($code = '', $message = '', $data = '') { + if ( empty($code) ) + return; + + $this->errors[$code][] = $message; - function WP_Error($code = '', $message = '') { - if ( ! empty($code) ) - $this->errors[$code][] = $message; + if ( ! empty($data) ) + $this->error_data[$code] = $data; } function get_error_codes() { @@ -395,8 +401,26 @@ class WP_Error { return $messages[0]; } - function add($code, $message) { - $this->errors[$code][] = $message; + function get_error_data($code = '') { + if ( empty($code) ) + $code = $this->get_error_code(); + + if ( isset($this->error_data[$code]) ) + return $this->error_data[$code]; + return null; + } + + function add($code, $message, $data = '') { + $this->errors[$code][] = $message; + if ( ! empty($data) ) + $this->error_data[$code] = $data; + } + + function add_data($data, $code = '') { + if ( empty($code) ) + $code = $this->get_error_code(); + + $this->error_data[$code] = $data; } } diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 1172bdf..8e8d457 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -90,7 +90,7 @@ function comment_author_url_link( $linktext = '', $before = '', $after = '' ) { function get_comment_date( $d = '' ) { global $comment; if ( '' == $d ) - $date = mysql2date( get_settings('date_format'), $comment->comment_date); + $date = mysql2date( get_option('date_format'), $comment->comment_date); else $date = mysql2date($d, $comment->comment_date); return apply_filters('get_comment_date', $date); @@ -187,7 +187,7 @@ function get_comment_time( $d = '', $gmt = false ) { global $comment; $comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date; if ( '' == $d ) - $date = mysql2date(get_settings('time_format'), $comment_date); + $date = mysql2date(get_option('time_format'), $comment_date); else $date = mysql2date($d, $comment_date); return apply_filters('get_comment_time', $date); @@ -222,9 +222,9 @@ function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pin function get_trackback_url() { global $id; - $tb_url = get_settings('siteurl') . '/wp-trackback.php?p=' . $id; + $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . $id; - if ( '' != get_settings('permalink_structure') ) + if ( '' != get_option('permalink_structure') ) $tb_url = trailingslashit(get_permalink()) . 'trackback/'; return $tb_url; @@ -276,7 +276,7 @@ function comments_template( $file = '/comments.php' ) { if ( ! (is_single() || is_page() || $withcomments) ) return; - $req = get_settings('require_name_email'); + $req = get_option('require_name_email'); $commenter = wp_get_current_commenter(); extract($commenter); @@ -334,9 +334,9 @@ function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Com echo '<a href="'; if ($wpcommentsjavascript) { if ( empty($wpcommentspopupfile) ) - $home = get_settings('home'); + $home = get_option('home'); else - $home = get_settings('siteurl'); + $home = get_option('siteurl'); echo $home . '/' . $wpcommentspopupfile.'?comments_popup='.$id; echo '" onclick="wpopen(this.href); return false"'; } else { // if comments_popup_script() is not in the template, display simple comment link diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 69ff8a9..514197f 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -3,12 +3,12 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) { global $wpdb; - if (1 == get_settings('comment_moderation')) return false; // If moderation is set to manual + if (1 == get_option('comment_moderation')) return false; // If moderation is set to manual - if ( (count(explode('http:', $comment)) - 1) >= get_settings('comment_max_links') ) + if ( (count(explode('http:', $comment)) - 1) >= get_option('comment_max_links') ) return false; // Check # of external links - $mod_keys = trim( get_settings('moderation_keys') ); + $mod_keys = trim( get_option('moderation_keys') ); if ( !empty($mod_keys) ) { $words = explode("\n", $mod_keys ); @@ -33,7 +33,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $ } // Comment whitelisting: - if ( 1 == get_settings('comment_whitelist')) { + if ( 1 == get_option('comment_whitelist')) { if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll $uri = parse_url($url); $domain = $uri['host']; @@ -124,7 +124,7 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals function get_lastcommentmodified($timezone = 'server') { global $cache_lastcommentmodified, $pagenow, $wpdb; - $add_seconds_blog = get_settings('gmt_offset') * 3600; + $add_seconds_blog = get_option('gmt_offset') * 3600; $add_seconds_server = date('Z'); $now = current_time('mysql', 1); if ( !isset($cache_lastcommentmodified[$timezone]) ) { @@ -233,7 +233,7 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age } } - $mod_keys = trim( get_settings('blacklist_keys') ); + $mod_keys = trim( get_option('blacklist_keys') ); if ('' == $mod_keys ) return false; // If moderation keys are empty $words = explode("\n", $mod_keys ); @@ -386,7 +386,7 @@ function wp_new_comment( $commentdata ) { $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment - if ( get_settings('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] ) + if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] ) wp_notify_postauthor($comment_ID, $commentdata['comment_type']); } @@ -553,7 +553,7 @@ function discover_pingback_server_uri($url, $timeout_bytes = 2048) { $pingback_href_end = @strpos($contents, $quote, $pingback_href_start); $pingback_server_url_len = $pingback_href_end - $pingback_href_start; $pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len); - // We may find rel="pingback" but an incomplete pingback URI + // We may find rel="pingback" but an incomplete pingback URL if ($pingback_server_url_len > 0) { // We got it! return $pingback_server_url; @@ -616,7 +616,7 @@ function do_trackbacks($post_id) { $excerpt = str_replace(']]>', ']]>', $excerpt); $excerpt = strip_tags($excerpt); if ( function_exists('mb_strcut') ) // For international trackbacks - $excerpt = mb_strcut($excerpt, 0, 252, get_settings('blog_charset')) . '...'; + $excerpt = mb_strcut($excerpt, 0, 252, get_option('blog_charset')) . '...'; else $excerpt = substr($excerpt, 0, 252) . '...'; @@ -635,7 +635,7 @@ function do_trackbacks($post_id) { } function generic_ping($post_id = 0) { - $services = get_settings('ping_sites'); + $services = get_option('ping_sites'); $services = preg_replace("|(\s)+|", '$1', $services); // Kill dupe lines $services = trim($services); if ( '' != $services ) { @@ -745,14 +745,14 @@ function trackback($trackback_url, $title, $excerpt, $ID) { $title = urlencode($title); $excerpt = urlencode($excerpt); - $blog_name = urlencode(get_settings('blogname')); + $blog_name = urlencode(get_option('blogname')); $tb_url = $trackback_url; $url = urlencode(get_permalink($ID)); $query_string = "title=$title&url=$url&blog_name=$blog_name&excerpt=$excerpt"; $trackback_url = parse_url($trackback_url); $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?'.$trackback_url['query'] : '') . " HTTP/1.0\r\n"; $http_request .= 'Host: '.$trackback_url['host']."\r\n"; - $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_settings('blog_charset')."\r\n"; + $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_option('blog_charset')."\r\n"; $http_request .= 'Content-Length: '.strlen($query_string)."\r\n"; $http_request .= "User-Agent: WordPress/" . $wp_version; $http_request .= "\r\n\r\n"; @@ -790,8 +790,8 @@ function weblog_ping($server = '', $path = '') { // when set to true, this outputs debug messages by itself $client->debug = false; $home = trailingslashit( get_option('home') ); - if ( !$client->query('weblogUpdates.extendedPing', get_settings('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping - $client->query('weblogUpdates.ping', get_settings('blogname'), $home); + if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping + $client->query('weblogUpdates.ping', get_option('blogname'), $home); } ?> diff --git a/wp-includes/cron.php b/wp-includes/cron.php index 116a24a..6f3d6b0 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -80,7 +80,7 @@ function spawn_cron() { if ( array_shift( $keys ) > time() )
return;
- $cron_url = get_settings( 'siteurl' ) . '/wp-cron.php';
+ $cron_url = get_option( 'siteurl' ) . '/wp-cron.php';
$parts = parse_url( $cron_url );
$argyle = @ fsockopen( $parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01 );
diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 2cdd211..61afd0a 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -55,6 +55,31 @@ add_filter('pre_category_name', 'wp_filter_kses'); add_filter('pre_category_name', 'wp_specialchars', 30); add_filter('pre_category_description', 'wp_filter_kses'); +//Links +add_filter('pre_link_name', 'strip_tags'); +add_filter('pre_link_name', 'trim'); +add_filter('pre_link_name', 'wp_filter_kses'); +add_filter('pre_link_name', 'wp_specialchars', 30); +add_filter('pre_link_description', 'wp_filter_kses'); +add_filter('pre_link_notes', 'wp_filter_kses'); +add_filter('pre_link_url', 'strip_tags'); +add_filter('pre_link_url', 'trim'); +add_filter('pre_link_url', 'clean_url'); +add_filter('pre_link_image', 'strip_tags'); +add_filter('pre_link_image', 'trim'); +add_filter('pre_link_image', 'clean_url'); +add_filter('pre_link_rss', 'strip_tags'); +add_filter('pre_link_rss', 'trim'); +add_filter('pre_link_rss', 'clean_url'); +add_filter('pre_link_target', 'strip_tags'); +add_filter('pre_link_target', 'trim'); +add_filter('pre_link_target', 'wp_filter_kses'); +add_filter('pre_link_target', 'wp_specialchars', 30); +add_filter('pre_link_rel', 'strip_tags'); +add_filter('pre_link_rel', 'trim'); +add_filter('pre_link_rel', 'wp_filter_kses'); +add_filter('pre_link_rel', 'wp_specialchars', 30); + // Users add_filter('pre_user_display_name', 'strip_tags'); add_filter('pre_user_display_name', 'trim'); @@ -115,6 +140,7 @@ add_filter('the_author', 'ent2ncr', 8); // Misc filters add_filter('option_ping_sites', 'privacy_ping_filter'); +add_filter('option_blog_charset', 'wp_specialchars'); // Actions add_action('wp_head', 'rsd_link'); @@ -130,4 +156,5 @@ add_action('do_feed_atom', 'do_feed_atom', 10, 1); add_action('do_pings', 'do_all_pings', 10, 1); add_action('do_robots', 'do_robots'); add_action('sanitize_comment_cookies', 'sanitize_comment_cookies'); +add_action('admin_print_scripts', 'wp_print_scripts', 20); ?> diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index bd8d21a..b75e07a 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -477,4 +477,22 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after return wp_get_archives($args);
}
+// Deprecated. Use get_author_posts_url().
+function get_author_link($echo = false, $author_id, $author_nicename = '') {
+ $link = get_author_posts_url($author_id, $author_nicename);
+
+ if ( $echo )
+ echo $link;
+ return $link;
+}
+
+function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') {
+ $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
+ return wp_link_pages($args);
+}
+
+function get_settings($option) {
+ return get_option($option);
+}
+
?>
diff --git a/wp-includes/feed.php b/wp-includes/feed.php index c406b7b..fd8b8a0 100644 --- a/wp-includes/feed.php +++ b/wp-includes/feed.php @@ -87,20 +87,20 @@ function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = ' function comments_rss($commentsrssfilename = '') { global $id; - if ('' != get_settings('permalink_structure')) + if ('' != get_option('permalink_structure')) $url = trailingslashit( get_permalink() ) . 'feed/'; else - $url = get_settings('home') . "/$commentsrssfilename?feed=rss2&p=$id"; + $url = get_option('home') . "/$commentsrssfilename?feed=rss2&p=$id"; return apply_filters('post_comments_feed_link', $url); } function get_author_rss_link($echo = false, $author_id, $author_nicename) { $auth_ID = $author_id; - $permalink_structure = get_settings('permalink_structure'); + $permalink_structure = get_option('permalink_structure'); if ('' == $permalink_structure) { - $link = get_settings('home') . '?feed=rss2&author=' . $author_id; + $link = get_option('home') . '?feed=rss2&author=' . $author_id; } else { $link = get_author_link(0, $author_id, $author_nicename); $link = $link . "feed/"; @@ -113,10 +113,10 @@ function get_author_rss_link($echo = false, $author_id, $author_nicename) { } function get_category_rss_link($echo = false, $cat_ID, $category_nicename) { - $permalink_structure = get_settings('permalink_structure'); + $permalink_structure = get_option('permalink_structure'); if ('' == $permalink_structure) { - $link = get_settings('home') . '?feed=rss2&cat=' . $cat_ID; + $link = get_option('home') . '?feed=rss2&cat=' . $cat_ID; } else { $link = get_category_link($cat_ID); $link = $link . "feed/"; @@ -161,4 +161,4 @@ function rss_enclosure() { } } -?>
\ No newline at end of file +?> diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index f027869..1be7f1e 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -598,7 +598,7 @@ function wp_rel_nofollow( $text ) { global $wpdb; // This is a pre save filter, so text is already escaped. $text = stripslashes($text); - $text = preg_replace('|<a (.+?)>|i', '<a $1 rel="nofollow">', $text); + $text = preg_replace('|<a (.+?)>|ie', "'<a ' . str_replace(' rel=\"nofollow\"','',stripslashes('$1')) . ' rel=\"nofollow\">'", $text); $text = $wpdb->escape($text); return $text; } @@ -606,7 +606,7 @@ function wp_rel_nofollow( $text ) { function convert_smilies($text) { global $wp_smiliessearch, $wp_smiliesreplace; $output = ''; - if (get_settings('use_smilies')) { + if (get_option('use_smilies')) { // HTML loop taken from texturize function, could possible be consolidated $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between $stop = count($textarr);// loop stuff @@ -656,7 +656,7 @@ function get_gmt_from_date($string) { // note: this only substracts $time_difference from the given date preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); - $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_settings('gmt_offset') * 3600); + $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_option('gmt_offset') * 3600); return $string_gmt; } @@ -665,7 +665,7 @@ function get_date_from_gmt($string) { // note: this only adds $time_difference to the given date preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches); $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); - $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_settings('gmt_offset')*3600); + $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_option('gmt_offset')*3600); return $string_localtime; } @@ -690,7 +690,7 @@ function iso8601_to_datetime($date_string, $timezone = USER) { if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset $offset = iso8601_timezone_to_offset($date_bits[7]); } else { // we don't have a timezone, so we assume user local timezone (not server's!) - $offset = 3600 * get_settings('gmt_offset'); + $offset = 3600 * get_option('gmt_offset'); } $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]); $timestamp -= $offset; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 8719f7e..68e9427 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -45,12 +45,12 @@ function current_time($type, $gmt = 0) { switch ($type) { case 'mysql': if ( $gmt ) $d = gmdate('Y-m-d H:i:s'); - else $d = gmdate('Y-m-d H:i:s', (time() + (get_settings('gmt_offset') * 3600))); + else $d = gmdate('Y-m-d H:i:s', (time() + (get_option('gmt_offset') * 3600))); return $d; break; case 'timestamp': if ( $gmt ) $d = time(); - else $d = time() + (get_settings('gmt_offset') * 3600); + else $d = time() + (get_option('gmt_offset') * 3600); return $d; break; } @@ -88,13 +88,13 @@ function get_weekstartend($mysqlstring, $start_of_week) { $weekday = date('w',$day); $i = 86400; - if ( $weekday < get_settings('start_of_week') ) - $weekday = 7 - (get_settings('start_of_week') - $weekday); + if ( $weekday < get_option('start_of_week') ) + $weekday = 7 - (get_option('start_of_week') - $weekday); - while ($weekday > get_settings('start_of_week')) { + while ($weekday > get_option('start_of_week')) { $weekday = date('w',$day); - if ( $weekday < get_settings('start_of_week') ) - $weekday = 7 - (get_settings('start_of_week') - $weekday); + if ( $weekday < get_option('start_of_week') ) + $weekday = 7 - (get_option('start_of_week') - $weekday); $day = $day - 86400; $i = 0; @@ -107,7 +107,7 @@ function get_weekstartend($mysqlstring, $start_of_week) { function get_lastpostdate($timezone = 'server') { global $cache_lastpostdate, $pagenow, $wpdb; - $add_seconds_blog = get_settings('gmt_offset') * 3600; + $add_seconds_blog = get_option('gmt_offset') * 3600; $add_seconds_server = date('Z'); if ( !isset($cache_lastpostdate[$timezone]) ) { switch(strtolower($timezone)) { @@ -130,7 +130,7 @@ function get_lastpostdate($timezone = 'server') { function get_lastpostmodified($timezone = 'server') { global $cache_lastpostmodified, $pagenow, $wpdb; - $add_seconds_blog = get_settings('gmt_offset') * 3600; + $add_seconds_blog = get_option('gmt_offset') * 3600; $add_seconds_server = date('Z'); if ( !isset($cache_lastpostmodified[$timezone]) ) { switch(strtolower($timezone)) { @@ -174,7 +174,7 @@ function is_switched( $setting = 'N/A' ) { } -function get_settings($setting) { +function get_option($setting) { global $wpdb, $switched, $current_blog; if ( is_switched() == false ) { @@ -211,7 +211,7 @@ function get_settings($setting) { // If home is not set use siteurl. if ( 'home' == $setting && '' == $value ) - return get_settings('siteurl'); + return get_option('siteurl'); if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting ) $value = preg_replace('|/+$|', '', $value); @@ -221,12 +221,8 @@ function get_settings($setting) { return apply_filters( 'option_' . $setting, maybe_unserialize($value) ); } -function get_option($option) { - return get_settings($option); -} - function form_option($option) { - echo htmlspecialchars( get_option($option), ENT_QUOTES ); + echo wp_specialchars( get_option($option), 1 ); } function get_alloptions() { @@ -273,7 +269,7 @@ function update_option($option_name, $newvalue) { if ( is_array($newvalue) || is_object($newvalue) ) $newvalue = serialize($newvalue); - wp_cache_delete($option_name, 'options'); + wp_cache_set($option_name, $newvalue, 'options'); $newvalue = $wpdb->escape($newvalue); $option_name = $wpdb->escape($option_name); @@ -296,7 +292,7 @@ function add_option($name, $value = '', $description = '', $autoload = 'yes') { if ( is_array($value) || is_object($value) ) $value = serialize($value); - wp_cache_delete($name, 'options'); + wp_cache_set($name, $value, 'options'); $name = $wpdb->escape($name); $value = $wpdb->escape($value); @@ -317,7 +313,7 @@ function delete_option($name) { } function gzip_compression() { - if ( !get_settings('gzipcompression') ) return false; + if ( !get_option('gzipcompression') ) return false; if ( extension_loaded('zlib') ) { ob_start('ob_gzhandler'); @@ -351,7 +347,7 @@ function make_url_footnote($content) { $link_url = $matches[2][$i]; $link_text = $matches[4][$i]; $content = str_replace($link_match, $link_text.' '.$link_number, $content); - $link_url = ((strtolower(substr($link_url,0,7)) != 'http://') && (strtolower(substr($link_url,0,8)) != 'https://')) ? get_settings('home') . $link_url : $link_url; + $link_url = ((strtolower(substr($link_url,0,7)) != 'http://') && (strtolower(substr($link_url,0,8)) != 'https://')) ? get_option('home') . $link_url : $link_url; $links_summary .= "\n".$link_number.' '.$link_url; } $content = strip_tags($content); @@ -637,6 +633,11 @@ function add_query_arg() { $uri = @func_get_arg(2); } + if ( $frag = strstr($uri, '#') ) + $uri = substr($uri, 0, -strlen($frag)); + else + $frag = ''; + if ( preg_match('|^https?://|i', $uri, $matches) ) { $protocol = $matches[0]; $uri = substr($uri, strlen($protocol)); @@ -676,7 +677,7 @@ function add_query_arg() { $ret .= "$k=$v"; } } - $ret = $protocol . $base . $ret; + $ret = $protocol . $base . $ret . $frag; if ( get_magic_quotes_gpc() ) $ret = stripslashes($ret); // parse_str() adds slashes if magicquotes is on. See: http://php.net/parse_str return trim($ret, '?'); @@ -768,6 +769,13 @@ function nocache_headers() { @ header('Pragma: no-cache'); } +function cache_javascript_headers() { + $expiresOffset = 864000; // 10 days + header("Content-type: text/javascript; charset=" . get_bloginfo('charset')); + header("Vary: Accept-Encoding"); // Handle proxies + header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); +} + function get_num_queries() { global $wpdb; return $wpdb->num_queries; @@ -788,7 +796,7 @@ function do_feed() { $feed = 'rss2'; $for_comments = false; - if ( is_single() || (get_query_var('withcomments') == 1) ) { + if ( is_singular() || get_query_var('withcomments') == 1 || $feed == 'comments-rss2' ) { $feed = 'rss2'; $for_comments = true; } @@ -901,9 +909,9 @@ function wp_mkdir_p($target) { // Returns an array containing the current upload directory's path and url, or an error message. function wp_upload_dir() { - $siteurl = get_settings('siteurl'); + $siteurl = get_option('siteurl'); //prepend ABSPATH to $dir and $siteurl to $url if they're not already there - $path = str_replace(ABSPATH, '', trim(get_settings('upload_path'))); + $path = str_replace(ABSPATH, '', trim(get_option('upload_path'))); $dir = ABSPATH . $path; $url = trailingslashit($siteurl) . $path; @@ -916,7 +924,7 @@ function wp_upload_dir() { $url = trailingslashit($siteurl) . UPLOADS; } - if ( get_settings('uploads_use_yearmonth_folders')) { + if ( get_option('uploads_use_yearmonth_folders')) { // Generate the yearly and monthly dirs $time = current_time( 'mysql' ); $y = substr( $time, 0, 4 ); @@ -1121,7 +1129,7 @@ function wp_explain_nonce($action) { function wp_nonce_ays($action) { global $pagenow, $menu, $submenu, $parent_file, $submenu_file; - $adminurl = get_settings('siteurl') . '/wp-admin'; + $adminurl = get_option('siteurl') . '/wp-admin'; if ( wp_get_referer() ) $adminurl = wp_get_referer(); @@ -1196,7 +1204,7 @@ function wp_die($message, $title = '') { </style> </head> <body> - <h1 id="logo"><img alt="WordPress" src="<?php echo get_settings('siteurl'); ?>/wp-admin/images/wordpress-logo.png" /></h1> + <h1 id="logo"><img alt="WordPress" src="<?php echo get_option('siteurl'); ?>/wp-admin/images/wordpress-logo.png" /></h1> <p><?php echo $message; ?></p> </body> </html> diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 643aa06..34ed1c3 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -28,9 +28,9 @@ function get_sidebar() { function wp_loginout() { if ( ! is_user_logged_in() ) - $link = '<a href="' . get_settings('siteurl') . '/wp-login.php">' . __('Login') . '</a>'; + $link = '<a href="' . get_option('siteurl') . '/wp-login.php">' . __('Login') . '</a>'; else - $link = '<a href="' . get_settings('siteurl') . '/wp-login.php?action=logout">' . __('Logout') . '</a>'; + $link = '<a href="' . get_option('siteurl') . '/wp-login.php?action=logout">' . __('Logout') . '</a>'; echo apply_filters('loginout', $link); } @@ -39,12 +39,12 @@ function wp_loginout() { function wp_register( $before = '<li>', $after = '</li>' ) { if ( ! is_user_logged_in() ) { - if ( get_settings('users_can_register') ) - $link = $before . '<a href="' . get_settings('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after; + if ( get_option('users_can_register') ) + $link = $before . '<a href="' . get_option('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after; else $link = ''; } else { - $link = $before . '<a href="' . get_settings('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after; + $link = $before . '<a href="' . get_option('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after; } echo apply_filters('register', $link); @@ -75,13 +75,13 @@ function get_bloginfo($show='') { case 'url' : case 'home' : case 'siteurl' : - $output = get_settings('home'); + $output = get_option('home'); break; case 'wpurl' : - $output = get_settings('siteurl'); + $output = get_option('siteurl'); break; case 'description': - $output = get_settings('blogdescription'); + $output = get_option('blogdescription'); break; case 'rdf_url': $output = get_feed_link('rdf'); @@ -99,7 +99,7 @@ function get_bloginfo($show='') { $output = get_feed_link('comments_rss2'); break; case 'pingback_url': - $output = get_settings('siteurl') .'/xmlrpc.php'; + $output = get_option('siteurl') .'/xmlrpc.php'; break; case 'stylesheet_url': $output = get_stylesheet_uri(); @@ -112,10 +112,10 @@ function get_bloginfo($show='') { $output = get_template_directory_uri(); break; case 'admin_email': - $output = get_settings('admin_email'); + $output = get_option('admin_email'); break; case 'charset': - $output = get_settings('blog_charset'); + $output = get_option('blog_charset'); if ('' == $output) $output = 'UTF-8'; break; case 'html_type' : @@ -127,7 +127,7 @@ function get_bloginfo($show='') { break; case 'name': default: - $output = get_settings('blogname'); + $output = get_option('blogname'); break; } return $output; @@ -149,7 +149,7 @@ function wp_title($sep = '»', $display = true) { if ( !empty($cat) ) { // category exclusion if ( !stristr($cat,'-') ) - $title = get_the_category_by_ID($cat); + $title = apply_filters('single_cat_title', get_the_category_by_ID($cat)); } if ( !empty($category_name) ) { if ( stristr($category_name,'/') ) { @@ -160,6 +160,7 @@ function wp_title($sep = '»', $display = true) { $category_name = $category_name[count($category_name)-2]; // there was a trailling slash } $title = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'"); + $title = apply_filters('single_cat_title', $title); } // If there's an author @@ -230,7 +231,7 @@ function single_post_title($prefix = '', $display = true) { function single_cat_title($prefix = '', $display = true ) { $cat = intval( get_query_var('cat') ); if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) { - $my_cat_name = get_the_category_by_ID($cat); + $my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat)); if ( !empty($my_cat_name) ) { if ( $display ) echo $prefix.strip_tags($my_cat_name); @@ -308,13 +309,13 @@ function wp_get_archives($args = '') { $archive_week_end_date_format = 'Y/m/d'; if ( !$archive_date_format_over_ride ) { - $archive_day_date_format = get_settings('date_format'); - $archive_week_start_date_format = get_settings('date_format'); - $archive_week_end_date_format = get_settings('date_format'); + $archive_day_date_format = get_option('date_format'); + $archive_week_start_date_format = get_option('date_format'); + $archive_week_end_date_format = get_option('date_format'); } - $add_hours = intval(get_settings('gmt_offset')); - $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); + $add_hours = intval(get_option('gmt_offset')); + $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours)); if ( 'monthly' == $type ) { $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); @@ -331,6 +332,21 @@ function wp_get_archives($args = '') { echo get_archives_link($url, $text, $format, $before, $after); } } + } elseif ('yearly' == $type) { + $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type ='post' AND post_status = 'publish' GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit); + if ($arcresults) { + $afterafter = $after; + foreach ($arcresults as $arcresult) { + $url = get_year_link($arcresult->year); + if ($show_post_count) { + $text = sprintf('%d', $arcresult->year); + $after = ' ('.$arcresult->posts.')' . $afterafter; + } else { + $text = sprintf('%d', $arcresult->year); + } + echo get_archives_link($url, $text, $format, $before, $after); + } + } } elseif ( 'daily' == $type ) { $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); if ( $arcresults ) { @@ -342,7 +358,7 @@ function wp_get_archives($args = '') { } } } elseif ( 'weekly' == $type ) { - $start_of_week = get_settings('start_of_week'); + $start_of_week = get_option('start_of_week'); $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); $arc_w_last = ''; if ( $arcresults ) { @@ -350,10 +366,10 @@ function wp_get_archives($args = '') { if ( $arcresult->week != $arc_w_last ) { $arc_year = $arcresult->yr; $arc_w_last = $arcresult->week; - $arc_week = get_weekstartend($arcresult->yyyymmdd, get_settings('start_of_week')); + $arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week')); $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']); $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); - $url = sprintf('%s/%s%sm%s%s%sw%s%d', get_settings('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week); + $url = sprintf('%s/%s%sm%s%s%sw%s%d', get_option('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week); $text = $arc_week_start . $archive_week_separator . $arc_week_end; echo get_archives_link($url, $text, $format, $before, $after); } @@ -400,9 +416,9 @@ function get_calendar($initial = true) { $w = ''.intval($_GET['w']); // week_begins = 0 stands for Sunday - $week_begins = intval(get_settings('start_of_week')); - $add_hours = intval(get_settings('gmt_offset')); - $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); + $week_begins = intval(get_option('start_of_week')); + $add_hours = intval(get_option('gmt_offset')); + $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours)); // Let's figure out when we are if ( !empty($monthnum) && !empty($year) ) { @@ -421,8 +437,8 @@ function get_calendar($initial = true) { else $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2); } else { - $thisyear = gmdate('Y', current_time('timestamp') + get_settings('gmt_offset') * 3600); - $thismonth = gmdate('m', current_time('timestamp') + get_settings('gmt_offset') * 3600); + $thisyear = gmdate('Y', current_time('timestamp') + get_option('gmt_offset') * 3600); + $thismonth = gmdate('m', current_time('timestamp') + get_option('gmt_offset') * 3600); } $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear); @@ -542,7 +558,7 @@ function get_calendar($initial = true) { echo "\n\t</tr>\n\t<tr>\n\t\t"; $newrow = false; - if ( $day == gmdate('j', (time() + (get_settings('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_settings('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_settings('gmt_offset') * 3600)) ) + if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) ) echo '<td id="today">'; else echo '<td>'; @@ -597,7 +613,7 @@ function the_date($d='', $before='', $after='', $echo = true) { if ( $day != $previousday ) { $the_date .= $before; if ( $d=='' ) - $the_date .= mysql2date(get_settings('date_format'), $post->post_date); + $the_date .= mysql2date(get_option('date_format'), $post->post_date); else $the_date .= mysql2date($d, $post->post_date); $the_date .= $after; @@ -611,6 +627,20 @@ function the_date($d='', $before='', $after='', $echo = true) { } +function the_modified_date($d = '') { + echo apply_filters('the_modified_date', get_the_modified_date($d), $d); +} + + +function get_the_modified_date($d = '') { + if ( '' == $d ) + $the_time = get_post_modified_time(get_option('date_format')); + else + $the_time = get_post_modified_time($d); + return apply_filters('get_the_modified_date', $the_time, $d); +} + + function the_time( $d = '' ) { echo apply_filters('the_time', get_the_time( $d ), $d); } @@ -618,7 +648,7 @@ function the_time( $d = '' ) { function get_the_time( $d = '' ) { if ( '' == $d ) - $the_time = get_post_time(get_settings('time_format')); + $the_time = get_post_time(get_option('time_format')); else $the_time = get_post_time($d); return apply_filters('get_the_time', $the_time, $d); @@ -644,7 +674,7 @@ function the_modified_time($d = '') { function get_the_modified_time($d = '') { if ( '' == $d ) - $the_time = get_post_modified_time(get_settings('time_format')); + $the_time = get_post_modified_time(get_option('time_format')); else $the_time = get_post_modified_time($d); return apply_filters('get_the_modified_time', $the_time, $d); @@ -712,7 +742,7 @@ function noindex() { * @param string (optional) Previous form field's ID (for tabbing support) */ function the_editor($content, $id = 'content', $prev_id = 'title') { - $rows = get_settings('default_post_edit_rows'); + $rows = get_option('default_post_edit_rows'); if (($rows < 3) || ($rows > 100)) $rows = 12; diff --git a/wp-includes/js/autosave.js.php b/wp-includes/js/autosave.js.php index f0c3520..4db6ff9 100644 --- a/wp-includes/js/autosave.js.php +++ b/wp-includes/js/autosave.js.php @@ -1,11 +1,5 @@ <?php @require_once('../../wp-config.php'); -$expiresOffset = 3600 * 24 * 10; // 10 days util client cache expires - -header("Content-type: text/javascript; charset: UTF-8"); -header("Vary: Accept-Encoding"); // Handle proxies -header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); - - +cache_javascript_headers(); ?> var autosaveLast = ''; function autosave_timer() { @@ -50,7 +44,7 @@ function autosave_update_post_ID() { nonceAjax.setVar("post_ID", res); nonceAjax.setVar("cookie", document.cookie); nonceAjax.setVar("post_type", $('post_type').value); - nonceAjax.requestFile = "<?php echo get_bloginfo('siteurl'); ?>/wp-admin/admin-ajax.php"; + nonceAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php"; nonceAjax.onCompletion = autosave_update_nonce; nonceAjax.method = "POST"; nonceAjax.runAJAX(); @@ -119,7 +113,7 @@ function autosave() { autosaveAjax.setVar("content", form.content.value); } - autosaveAjax.requestFile = "<?php echo get_bloginfo('siteurl'); ?>/wp-admin/admin-ajax.php"; + autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php"; autosaveAjax.method = "POST"; autosaveAjax.element = null; autosaveAjax.onLoading = autosave_loading; diff --git a/wp-includes/js/tinymce/wp-mce-help.php b/wp-includes/js/tinymce/wp-mce-help.php index ffe385f..bdb5119 100644 --- a/wp-includes/js/tinymce/wp-mce-help.php +++ b/wp-includes/js/tinymce/wp-mce-help.php @@ -7,7 +7,7 @@ require_once('../../../wp-config.php'); <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php _e('Rich Editor Help') ?></title> -<link rel="stylesheet" href="<?php echo get_settings('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" /> +<link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/wp-admin.css?version=<?php bloginfo('version'); ?>" type="text/css" /> <style type="text/css"> #wphead { padding-top: 5px; diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 81f4d7c..965c4e4 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -47,7 +47,7 @@ function get_permalink($id = 0) { elseif ($post->post_type == 'attachment') return get_attachment_link($post->ID); - $permalink = get_settings('permalink_structure'); + $permalink = get_option('permalink_structure'); if ( '' != $permalink && 'draft' != $post->post_status ) { $unixtime = strtotime($post->post_date); @@ -77,9 +77,9 @@ function get_permalink($id = 0) { $author, $post->post_name, ); - return apply_filters('post_link', get_settings('home') . str_replace($rewritecode, $rewritereplace, $permalink), $post); + return apply_filters('post_link', get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink), $post); } else { // if they're not using the fancy permalink option - $permalink = get_settings('home') . '/?p=' . $post->ID; + $permalink = get_option('home') . '/?p=' . $post->ID; return apply_filters('post_link', $permalink, $post); } } @@ -100,13 +100,13 @@ function get_page_link($id = false) { if ( '' != $pagestruct && 'draft' != $post->post_status ) { $link = get_page_uri($id); $link = str_replace('%pagename%', $link, $pagestruct); - $link = get_settings('home') . "/$link/"; + $link = get_option('home') . "/$link/"; } else { - $link = get_settings('home') . "/?page_id=$id"; + $link = get_option('home') . "/?page_id=$id"; } if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) - $link = get_settings('home'); + $link = get_option('home'); return apply_filters('page_link', $link, $id); } @@ -138,56 +138,56 @@ function get_attachment_link($id = false) { function get_year_link($year) { global $wp_rewrite; if ( !$year ) - $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600)); + $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600)); $yearlink = $wp_rewrite->get_year_permastruct(); if ( !empty($yearlink) ) { $yearlink = str_replace('%year%', $year, $yearlink); - return apply_filters('year_link', get_settings('home') . trailingslashit($yearlink), $year); + return apply_filters('year_link', get_option('home') . trailingslashit($yearlink), $year); } else { - return apply_filters('year_link', get_settings('home') . '/?m=' . $year, $year); + return apply_filters('year_link', get_option('home') . '/?m=' . $year, $year); } } function get_month_link($year, $month) { global $wp_rewrite; if ( !$year ) - $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600)); + $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600)); if ( !$month ) - $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600)); + $month = gmdate('m', time()+(get_option('gmt_offset') * 3600)); $monthlink = $wp_rewrite->get_month_permastruct(); if ( !empty($monthlink) ) { $monthlink = str_replace('%year%', $year, $monthlink); $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); - return apply_filters('month_link', get_settings('home') . trailingslashit($monthlink), $year, $month); + return apply_filters('month_link', get_option('home') . trailingslashit($monthlink), $year, $month); } else { - return apply_filters('month_link', get_settings('home') . '/?m=' . $year . zeroise($month, 2), $year, $month); + return apply_filters('month_link', get_option('home') . '/?m=' . $year . zeroise($month, 2), $year, $month); } } function get_day_link($year, $month, $day) { global $wp_rewrite; if ( !$year ) - $year = gmdate('Y', time()+(get_settings('gmt_offset') * 3600)); + $year = gmdate('Y', time()+(get_option('gmt_offset') * 3600)); if ( !$month ) - $month = gmdate('m', time()+(get_settings('gmt_offset') * 3600)); + $month = gmdate('m', time()+(get_option('gmt_offset') * 3600)); if ( !$day ) - $day = gmdate('j', time()+(get_settings('gmt_offset') * 3600)); + $day = gmdate('j', time()+(get_option('gmt_offset') * 3600)); $daylink = $wp_rewrite->get_day_permastruct(); if ( !empty($daylink) ) { $daylink = str_replace('%year%', $year, $daylink); $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink); $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink); - return apply_filters('day_link', get_settings('home') . trailingslashit($daylink), $year, $month, $day); + return apply_filters('day_link', get_option('home') . trailingslashit($daylink), $year, $month, $day); } else { - return apply_filters('day_link', get_settings('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day); + return apply_filters('day_link', get_option('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day); } } function get_feed_link($feed='rss2') { global $wp_rewrite; $do_perma = 0; - $feed_url = get_settings('siteurl'); + $feed_url = get_option('siteurl'); $comment_feed_url = $feed_url; $permalink = $wp_rewrite->get_feed_permastruct(); @@ -202,12 +202,12 @@ function get_feed_link($feed='rss2') { $permalink = str_replace('%feed%', $feed, $permalink); $permalink = preg_replace('#/+#', '/', "/$permalink/"); - $output = get_settings('home') . $permalink; + $output = get_option('home') . $permalink; } else { if ( false !== strpos($feed, 'comments_') ) $feed = str_replace('comments_', 'comments-', $feed); - $output = get_settings('home') . "/?feed={$feed}"; + $output = get_option('home') . "/?feed={$feed}"; } return apply_filters('feed_link', $output, $feed); @@ -229,7 +229,7 @@ function edit_post_link($link = 'Edit This', $before = '', $after = '') { $file = 'post'; } - $location = get_settings('siteurl') . "/wp-admin/{$file}.php?action=edit&post=$post->ID"; + $location = get_option('siteurl') . "/wp-admin/{$file}.php?action=edit&post=$post->ID"; echo $before . "<a href=\"$location\">$link</a>" . $after; } @@ -244,7 +244,7 @@ function edit_comment_link($link = 'Edit This', $before = '', $after = '') { return; } - $location = get_settings('siteurl') . "/wp-admin/comment.php?action=editcomment&comment=$comment->comment_ID"; + $location = get_option('siteurl') . "/wp-admin/comment.php?action=editcomment&comment=$comment->comment_ID"; echo $before . "<a href='$location'>$link</a>" . $after; } @@ -362,7 +362,7 @@ function get_pagenum_link($pagenum = 1) { $page_modregex = "page/?"; $permalink = 0; - $home_root = parse_url(get_settings('home')); + $home_root = parse_url(get_option('home')); $home_root = $home_root['path']; $home_root = trailingslashit($home_root); $qstr = preg_replace('|^'. $home_root . '|', '', $qstr); @@ -390,7 +390,7 @@ function get_pagenum_link($pagenum = 1) { // so append the query string (using &, since we already have ?) $qstr .= '&' . $page_querystring . '=' . $pagenum; // otherwise, it could be rewritten, OR just the default index ... - } elseif( '' != get_settings('permalink_structure') && ! is_admin() ) { + } elseif( '' != get_option('permalink_structure') && ! is_admin() ) { $permalink = 1; $index = $wp_rewrite->index; // If it's not a path info permalink structure, trim the index. @@ -398,7 +398,7 @@ function get_pagenum_link($pagenum = 1) { $qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr); } else { // If using path info style permalinks, make sure the index is in - // the URI. + // the URL. if ( strpos($qstr, $index) === false ) $qstr = '/' . $index . $qstr; } @@ -412,14 +412,14 @@ function get_pagenum_link($pagenum = 1) { $qstr = preg_replace('|^/+|', '', $qstr); if ( $permalink ) $qstr = trailingslashit($qstr); - $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr ); + $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_option('home') ) . $qstr ); // showing /page/1/ or ?paged=1 is redundant if ( 1 === $pagenum ) { $qstr = str_replace('page/1/', '', $qstr); // for mod_rewrite style $qstr = remove_query_arg('paged', $qstr); // for query style } - return str_replace( "wp-inst/", "", $qstr ); + return $qstr; } function next_posts($max_page = 0) { // original by cfactor at cooltux.org @@ -476,17 +476,19 @@ function _max_num_pages() { global $wpdb, $wp_query; if (isset($max_num_pages)) return $max_num_pages; - + $posts_per = (int) get_option('posts_per_page'); + if ( empty($posts_per) ) $posts_per = 1; + if ( 'posts' == get_query_var('what_to_show') ) { preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches); $fromwhere = $matches[1]; $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere"); - $max_num_pages = ceil($numposts / get_option('posts_per_page')); + $max_num_pages = ceil($numposts / $posts_per); } else { preg_match('#FROM\s(.*)\sORDER BY#siU', $wp_query->request, $matches); $fromwhere = preg_replace('/( AND )?post_date >= (\'|\")(.*?)(\'|\")( AND post_date <= (\'\")(.*?)(\'\"))?/siU', '', $matches[1]); $num_days = $wpdb->query("SELECT DISTINCT post_date FROM $fromwhere GROUP BY year(post_date), month(post_date), dayofmonth(post_date)"); - $max_num_pages = ceil($num_days / get_option('posts_per_page')); + $max_num_pages = ceil($num_days / $posts_per); } return $max_num_pages; diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index d2e7137..93294a4 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -168,8 +168,8 @@ if ( !function_exists('wp_mail') ) : function wp_mail($to, $subject, $message, $headers = '') { if( $headers == '' ) { $headers = "MIME-Version: 1.0\n" . - "From: " . get_settings('admin_email') . "\n" . - "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; + "From: " . get_option('admin_email') . "\n" . + "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; } return @mail($to, $subject, $message, $headers); @@ -227,7 +227,7 @@ function auth_redirect() { (empty($_COOKIE[USER_COOKIE])) ) { nocache_headers(); - wp_redirect(get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); + wp_redirect(get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI'])); exit(); } } @@ -235,7 +235,7 @@ endif; if ( !function_exists('check_admin_referer') ) : function check_admin_referer($action = -1) { - $adminurl = strtolower(get_settings('siteurl')).'/wp-admin'; + $adminurl = strtolower(get_option('siteurl')).'/wp-admin'; $referer = strtolower(wp_get_referer()); if ( !wp_verify_nonce($_REQUEST['_wpnonce'], $action) && !(-1 == $action && strstr($referer, $adminurl)) ) { @@ -343,7 +343,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') { $comment_author_domain = gethostbyaddr($comment->comment_author_IP); - $blogname = get_settings('blogname'); + $blogname = get_option('blogname'); if ( empty( $comment_type ) ) $comment_type = 'comment'; @@ -351,7 +351,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') { $notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; - $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; $notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n"; $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; $notify_message .= __('You can see all comments on this post here: ') . "\r\n"; @@ -359,23 +359,23 @@ function wp_notify_postauthor($comment_id, $comment_type='') { } elseif ('trackback' == $comment_type) { $notify_message = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; - $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n"; $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title ); } elseif ('pingback' == $comment_type) { $notify_message = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; - $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; $notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n"; $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n"; $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); } $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; - $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; - $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; - $admin_email = get_settings('admin_email'); + $admin_email = get_option('admin_email'); if ( '' == $comment->comment_author ) { $from = "From: \"$blogname\" <$admin_email>"; @@ -389,7 +389,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') { $message_headers = "MIME-Version: 1.0\n" . "$from\n" - . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; + . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; if ( isset($reply_to) ) $message_headers .= $reply_to . "\n"; @@ -413,7 +413,7 @@ if ( !function_exists('wp_notify_moderator') ) : function wp_notify_moderator($comment_id) { global $wpdb; - if( get_settings( "moderation_notify" ) == 0 ) + if( get_option( "moderation_notify" ) == 0 ) return true; $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); @@ -426,17 +426,17 @@ function wp_notify_moderator($comment_id) { $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n"; $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; - $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; $notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n"; $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; - $notify_message .= sprintf( __('To approve this comment, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; - $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; - $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_settings('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + $notify_message .= sprintf( __('To approve this comment, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_option('siteurl').'/wp-admin/comment.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; $notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n"; - $notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n"; + $notify_message .= get_option('siteurl') . "/wp-admin/moderation.php\r\n"; - $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_settings('blogname'), $post->post_title ); - $admin_email = get_settings('admin_email'); + $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title ); + $admin_email = get_option('admin_email'); $notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id); $subject = apply_filters('comment_moderation_subject', $subject, $comment_id); @@ -454,20 +454,20 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') { $user_login = stripslashes($user->user_login); $user_email = stripslashes($user->user_email); - $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; + $message = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; - @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); + @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message); if ( empty($plaintext_pass) ) return; $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; - $message .= get_settings('siteurl') . "/wp-login.php\r\n"; + $message .= get_option('siteurl') . "/wp-login.php\r\n"; - wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message); + wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message); } endif; diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 58ba562..d339c7f 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -127,70 +127,66 @@ function get_the_excerpt($fakeit = true) { function wp_link_pages($args = '') { - parse_str($args, $r); - if ( !isset($r['before']) ) - $r['before'] = '<p>' . __('Pages:'); - if ( !isset($r['after']) ) - $r['after'] = '</p>'; - if ( !isset($r['next_or_number']) ) - $r['next_or_number'] = 'number'; - if ( !isset($r['nextpagelink']) ) - $r['nextpagelink'] = 'Next page'; - if ( !isset($r['previouspagelink']) ) - $r['previouspagelink'] = 'Previous page'; - if ( !isset($r['pagelink']) ) - $r['pagelink'] = '%'; - if ( !isset($r['more_file']) ) - $r['more_file'] = ''; - - link_pages($r['before'], $r['after'], $r['next_or_number'], $r['nextpagelink'], $r['previouspagelink'], $r['pagelink'], $r['more_file']); -} + if ( is_array($args) ) + $r = &$args; + else + parse_str($args, $r); + $defaults = array('before' => '<p>' . __('Pages:'), 'after' => '</p>', 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), + 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 'more_file' => '', 'echo' => 1); + $r = array_merge($defaults, $r); + extract($r); -function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='') { global $id, $page, $numpages, $multipage, $more, $pagenow; if ( $more_file != '' ) $file = $more_file; else $file = $pagenow; + + $output = ''; if ( $multipage ) { if ( 'number' == $next_or_number ) { - echo $before; + $output .= $before; for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) { $j = str_replace('%',"$i",$pagelink); - echo ' '; + $output .= ' '; if ( ($i != $page) || ((!$more) && ($page==1)) ) { - if ( '' == get_settings('permalink_structure') ) - echo '<a href="' . get_permalink() . '&page=' . $i . '">'; + if ( '' == get_option('permalink_structure') ) + $output .= '<a href="' . get_permalink() . '&page=' . $i . '">'; else - echo '<a href="' . trailingslashit( get_permalink() ) . $i . '/">'; + $output .= '<a href="' . trailingslashit( get_permalink() ) . $i . '/">'; } - echo $j; + $output .= $j; if ( ($i != $page) || ((!$more) && ($page==1)) ) - echo '</a>'; + $output .= '</a>'; } - echo $after; + $output .= $after; } else { if ( $more ) { - echo $before; + $output .= $before; $i = $page - 1; if ( $i && $more ) { - if ( '' == get_settings('permalink_structure') ) - echo '<a href="' . get_permalink() . '&page=' . $i . '">'.$previouspagelink.'</a>'; + if ( '' == get_option('permalink_structure') ) + $output .= '<a href="' . get_permalink() . '&page=' . $i . '">'.$previouspagelink.'</a>'; else - echo '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>'; + $output .= '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>'; } $i = $page + 1; if ( $i <= $numpages && $more ) { - if ( '' == get_settings('permalink_structure') ) - echo '<a href="'.get_permalink() . '&page=' . $i . '">'.$nextpagelink.'</a>'; + if ( '' == get_option('permalink_structure') ) + $output .= '<a href="'.get_permalink() . '&page=' . $i . '">'.$nextpagelink.'</a>'; else - echo '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>'; + $output .= '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>'; } - echo $after; + $output .= $after; } } } + + if ( $echo ) + echo $output; + + return $output; } @@ -268,7 +264,7 @@ function wp_list_pages($args = '') { else parse_str($args, $r); - $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_settings('date_format'), + $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), 'child_of' => 0, 'title_li' => __('Pages'), 'echo' => 1); $r = array_merge($defaults, $r); @@ -444,7 +440,7 @@ function prepend_attachment($content) { // function get_the_password_form() { - $output = '<form action="' . get_settings('siteurl') . '/wp-pass.php" method="post"> + $output = '<form action="' . get_option('siteurl') . '/wp-pass.php" method="post"> <p>' . __("This post is password protected. To view it please enter your password below:") . '</p> <p><label>' . __("Password:") . ' <input name="post_password" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . __("Submit") . '" /></p> </form> diff --git a/wp-includes/post.php b/wp-includes/post.php index 45af008..ebb1799 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -507,6 +507,9 @@ function wp_insert_post($postarr = array()) { $ping_status = apply_filters('ping_status_pre', $ping_status); } + if ( ('' == $post_content) && ('' == $post_title) ) + return 0; + // Make sure we set a valid category if (0 == count($post_category) || !is_array($post_category)) { $post_category = array(get_option('default_category')); @@ -557,10 +560,10 @@ function wp_insert_post($postarr = array()) { if ( $update ) $comment_status = 'closed'; else - $comment_status = get_settings('default_comment_status'); + $comment_status = get_option('default_comment_status'); } if ( empty($ping_status) ) - $ping_status = get_settings('default_ping_status'); + $ping_status = get_option('default_ping_status'); if ( empty($post_pingback) ) $post_pingback = get_option('default_pingback_flag'); @@ -661,6 +664,8 @@ function wp_insert_post($postarr = array()) { if ($post_status == 'publish' && $post_type == 'post') { do_action('publish_post', $post_ID); + if ( defined('XMLRPC_REQUEST') ) + do_action('xmlrpc_publish_post', $post_ID); if ( !defined('WP_IMPORTING') ) { if ( $post_pingback ) @@ -756,7 +761,7 @@ function wp_publish_post($post_id) { function wp_set_post_categories($post_ID = 0, $post_categories = array()) { global $wpdb; // If $post_categories isn't already an array, make it one: - if (!is_array($post_categories) || 0 == count($post_categories)) + if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories)) $post_categories = array(get_option('default_category')); $post_categories = array_unique($post_categories); @@ -791,9 +796,10 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) { if ($add_cats) { foreach ($add_cats as $new_cat) { - $wpdb->query(" - INSERT INTO $wpdb->post2cat (post_id, category_id) - VALUES ($post_ID, $new_cat)"); + if ( !empty($new_cat) ) + $wpdb->query(" + INSERT INTO $wpdb->post2cat (post_id, category_id) + VALUES ($post_ID, $new_cat)"); } } @@ -810,7 +816,7 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) { // Trackback and ping functions // -function add_ping($post_id, $uri) { // Add a URI to those already pung +function add_ping($post_id, $uri) { // Add a URL to those already pung global $wpdb; $pung = $wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_id"); $pung = trim($pung); @@ -840,7 +846,7 @@ function get_enclosed($post_id) { // Get enclosures already enclosed for a post return $pung; } -function get_pung($post_id) { // Get URIs already pung for a post +function get_pung($post_id) { // Get URLs already pung for a post global $wpdb; $pung = $wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_id"); $pung = trim($pung); @@ -849,7 +855,7 @@ function get_pung($post_id) { // Get URIs already pung for a post return $pung; } -function get_to_ping($post_id) { // Get any URIs in the todo list +function get_to_ping($post_id) { // Get any URLs in the todo list global $wpdb; $to_ping = $wpdb->get_var("SELECT to_ping FROM $wpdb->posts WHERE ID = $post_id"); $to_ping = trim($to_ping); @@ -1105,7 +1111,7 @@ function generate_page_uri_index() { foreach ($posts as $id => $post) { - // URI => page name + // URL => page name $uri = get_page_uri($id); $attachments = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$id'"); if ( $attachments ) { @@ -1195,10 +1201,10 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) { if ( $update ) $comment_status = 'closed'; else - $comment_status = get_settings('default_comment_status'); + $comment_status = get_option('default_comment_status'); } if ( empty($ping_status) ) - $ping_status = get_settings('default_ping_status'); + $ping_status = get_option('default_ping_status'); if ( empty($post_pingback) ) $post_pingback = get_option('default_pingback_flag'); diff --git a/wp-includes/query.php b/wp-includes/query.php index f94c79f..925eff5 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -190,6 +190,12 @@ function is_single ($post = '') { return false;
}
+function is_singular() {
+ global $wp_query;
+
+ return $wp_query->is_singular;
+}
+
function is_time () {
global $wp_query;
@@ -278,6 +284,7 @@ class WP_Query { var $is_comments_popup = false;
var $is_admin = false;
var $is_attachment = false;
+ var $is_singular = false;
var $is_robots = false;
var $is_posts_page = false;
@@ -300,6 +307,7 @@ class WP_Query { $this->is_paged = false;
$this->is_admin = false;
$this->is_attachment = false;
+ $this->is_singular = false;
$this->is_robots = false;
$this->is_posts_page = false;
}
@@ -326,7 +334,10 @@ class WP_Query { function parse_query ($query) {
if ( !empty($query) || !isset($this->query) ) {
$this->init();
- parse_str($query, $qv);
+ if ( is_array($query) )
+ $qv = & $query;
+ else
+ parse_str($query, $qv);
$this->query = $query;
$this->query_vars = $qv;
}
@@ -364,7 +375,7 @@ class WP_Query { // If year, month, day, hour, minute, and second are set, a single
// post is being queried.
$this->is_single = true;
- } elseif ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) {
+ } elseif ('' != $qv['static'] || '' != $qv['pagename'] || (int) $qv['page_id']) {
$this->is_page = true;
$this->is_single = false;
} elseif (!empty($qv['s'])) {
@@ -479,7 +490,10 @@ class WP_Query { $this->is_admin = true;
}
- if ( ! ($this->is_attachment || $this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {
+ if ( $this->is_single || $this->is_page || $this->is_attachment )
+ $this->is_singular = true;
+
+ if ( ! ($this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) {
$this->is_home = true;
}
@@ -531,9 +545,9 @@ class WP_Query { $q['post_type'] = 'post';
$post_type = $q['post_type'];
if ( !isset($q['posts_per_page']) || $q['posts_per_page'] == 0 )
- $q['posts_per_page'] = get_settings('posts_per_page');
+ $q['posts_per_page'] = get_option('posts_per_page');
if ( !isset($q['what_to_show']) )
- $q['what_to_show'] = get_settings('what_to_show');
+ $q['what_to_show'] = get_option('what_to_show');
if ( isset($q['showposts']) && $q['showposts'] ) {
$q['showposts'] = (int) $q['showposts'];
$q['posts_per_page'] = $q['showposts'];
@@ -548,9 +562,14 @@ class WP_Query { }
}
if ( $this->is_feed ) {
- $q['posts_per_page'] = get_settings('posts_per_rss');
+ $q['posts_per_page'] = get_option('posts_per_rss');
$q['what_to_show'] = 'posts';
}
+ $q['posts_per_page'] = (int) $q['posts_per_page'];
+ if ( $q['posts_per_page'] < -1 )
+ $q['posts_per_page'] = abs($q['posts_per_page']);
+ else if ( $q['posts_per_page'] == 0 )
+ $q['posts_per_page'] = 1;
if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
$this->is_page = true;
@@ -564,8 +583,8 @@ class WP_Query { $q['page'] = abs($q['page']);
}
- $add_hours = intval(get_settings('gmt_offset'));
- $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
+ $add_hours = intval(get_option('gmt_offset'));
+ $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours));
$wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
// If a month is specified in the querystring, load that month
@@ -745,7 +764,7 @@ class WP_Query { $distinct = 'DISTINCT';
}
- // Category stuff for nice URIs
+ // Category stuff for nice URLs
global $cache_categories;
if ('' != $q['category_name']) {
@@ -804,7 +823,7 @@ class WP_Query { $whichauthor .= ')';
}
- // Author stuff for nice URIs
+ // Author stuff for nice URLs
if ('' != $q['author_name']) {
if (stristr($q['author_name'],'/')) {
diff --git a/wp-includes/registration.php b/wp-includes/registration.php index 97797cc..8ec38a4 100644 --- a/wp-includes/registration.php +++ b/wp-includes/registration.php @@ -102,14 +102,14 @@ function wp_insert_user($userdata) { update_usermeta( $user_id, 'aim', $aim ); update_usermeta( $user_id, 'yim', $yim ); - if ( $update && !empty($role) ) { + if ( $update && isset($role) ) { $user = new WP_User($user_id); $user->set_role($role); } if ( !$update ) { $user = new WP_User($user_id); - $user->set_role(get_settings('default_role')); + $user->set_role(get_option('default_role')); } wp_cache_delete($user_id, 'users'); diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 178ee07..7865351 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -84,28 +84,28 @@ function url_to_postid($url) { $url_split = explode('#', $url);
$url = $url_split[0];
- // Get rid of URI ?query=string
+ // Get rid of URL ?query=string
$url_split = explode('?', $url);
$url = $url_split[0];
// Add 'www.' if it is absent and should be there
- if ( false !== strpos(get_settings('home'), '://www.') && false === strpos($url, '://www.') )
+ if ( false !== strpos(get_option('home'), '://www.') && false === strpos($url, '://www.') )
$url = str_replace('://', '://www.', $url);
// Strip 'www.' if it is present and shouldn't be
- if ( false === strpos(get_settings('home'), '://www.') )
+ if ( false === strpos(get_option('home'), '://www.') )
$url = str_replace('://www.', '://', $url);
// Strip 'index.php/' if we're not using path info permalinks
if ( false === strpos($rewrite, 'index.php/') )
$url = str_replace('index.php/', '', $url);
- if ( false !== strpos($url, get_settings('home')) ) {
+ if ( false !== strpos($url, get_option('home')) ) {
// Chop off http://domain.com
- $url = str_replace(get_settings('home'), '', $url);
+ $url = str_replace(get_option('home'), '', $url);
} else {
// Chop off /path/to/blog
- $home_path = parse_url(get_settings('home'));
+ $home_path = parse_url(get_option('home'));
$home_path = $home_path['path'];
$url = str_replace($home_path, '', $url);
}
@@ -259,8 +259,8 @@ class WP_Rewrite { }
function page_rewrite_rules() {
- $uris = get_settings('page_uris');
- $attachment_uris = get_settings('page_attachment_uris');
+ $uris = get_option('page_uris');
+ $attachment_uris = get_option('page_attachment_uris');
$rewrite_rules = array();
$page_structure = $this->get_page_permastruct();
@@ -757,10 +757,10 @@ class WP_Rewrite { return '';
}
- $site_root = parse_url(get_settings('siteurl'));
+ $site_root = parse_url(get_option('siteurl'));
$site_root = trailingslashit($site_root['path']);
- $home_root = parse_url(get_settings('home'));
+ $home_root = parse_url(get_option('home'));
$home_root = trailingslashit($home_root['path']);
$rules = "<IfModule mod_rewrite.c>\n";
@@ -853,13 +853,13 @@ class WP_Rewrite { function init() {
$this->extra_rules = $this->non_wp_rules = $this->endpoints = array();
- $this->permalink_structure = get_settings('permalink_structure');
+ $this->permalink_structure = get_option('permalink_structure');
$this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%'));
$this->root = '';
if ($this->using_index_permalinks()) {
$this->root = $this->index . '/';
}
- $this->category_base = get_settings('category_base');
+ $this->category_base = get_option('category_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 06330e4..d5a8986 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -18,7 +18,7 @@ class WP_Scripts { $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '08152006' ); $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '04162006' ); $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0'); - $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4102'); + $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4107'); if ( is_admin() ) { $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); $this->add( 'listman', '/wp-admin/list-manipulation-js.php', array('sack', 'fat'), '4042' ); // Make changeset # the correct one @@ -65,7 +65,7 @@ class WP_Scripts { $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version; if ( isset($this->args[$handle]) ) $ver .= '&' . $this->args[$handle]; - $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_settings( 'siteurl' ) . $this->scripts[$handle]->src; + $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src; echo "<script type='text/javascript' src='$src?ver=$ver'></script>\n"; $this->printed[] = $handle; } diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 9130394..36f001d 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -4,7 +4,7 @@ */ function get_stylesheet() { - return apply_filters('stylesheet', get_settings('stylesheet')); + return apply_filters('stylesheet', get_option('stylesheet')); } function get_stylesheet_directory() { @@ -26,7 +26,7 @@ function get_stylesheet_uri() { } function get_template() { - return apply_filters('template', get_settings('template')); + return apply_filters('template', get_option('template')); } function get_template_directory() { @@ -237,8 +237,8 @@ function get_theme($theme) { function get_current_theme() { $themes = get_themes(); $theme_names = array_keys($themes); - $current_template = get_settings('template'); - $current_stylesheet = get_settings('stylesheet'); + $current_template = get_option('template'); + $current_stylesheet = get_option('stylesheet'); $current_theme = 'WordPress Default'; if ( $themes ) { @@ -259,7 +259,7 @@ function get_theme_root() { } function get_theme_root_uri() { - return apply_filters('theme_root_uri', get_settings('siteurl') . "/wp-content/themes", get_settings('siteurl')); + return apply_filters('theme_root_uri', get_option('siteurl') . "/wp-content/themes", get_option('siteurl')); } function get_query_template($type) { diff --git a/wp-includes/vars.php b/wp-includes/vars.php index beec34c..62253c1 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -89,7 +89,7 @@ if (!isset($wpsmiliestrans)) { foreach($wpsmiliestrans as $smiley => $img) { $wp_smiliessearch[] = $smiley; $smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES); - $wp_smiliesreplace[] = " <img src='" . get_settings('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> "; + $wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> "; } ?> diff --git a/wp-links-opml.php b/wp-links-opml.php index cfbb274..7a2c220 100644 --- a/wp-links-opml.php +++ b/wp-links-opml.php @@ -5,7 +5,7 @@ if (empty($wp)) { wp(); } -header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true); +header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); $link_cat = $_GET['link_cat']; if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) { $link_cat = ''; diff --git a/wp-login.php b/wp-login.php index fbf332b..b363114 100644 --- a/wp-login.php +++ b/wp-login.php @@ -16,7 +16,7 @@ if ( defined('RELOCATE') ) { // Move flag is set $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] ); $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; - if ( dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_settings('siteurl') ) + if ( dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_option('siteurl') ) update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) ); } @@ -43,9 +43,9 @@ do_action('lost_password'); <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title><?php _e('WordPress »') ?> <?php _e('Lost Password') ?></title> + <title>WordPress » <?php _e('Lost Password') ?></title> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> - <link rel="stylesheet" href="<?php echo get_settings('siteurl'); ?>/wp-admin/wp-admin.css" type="text/css" /> + <link rel="stylesheet" href="<?php echo get_option('siteurl'); ?>/wp-admin/wp-admin.css" type="text/css" /> <script type="text/javascript"> function focusit() { // focus on first input field @@ -80,7 +80,7 @@ if ($error) </form> <ul> <li><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Are you lost?') ?>">« <?php _e('Back to blog') ?></a></li> -<?php if (get_settings('users_can_register')) : ?> +<?php if (get_option('users_can_register')) : ?> <li><a href="<?php bloginfo('wpurl'); ?>/wp-signup.php"><?php _e('Register') ?></a></li> <?php endif; ?> <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Login') ?></a></li> @@ -111,9 +111,9 @@ do_action('retrieve_password', $user_login); $message .= get_option('siteurl') . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n"; - $message .= get_settings('siteurl') . "/wp-login.php?action=rp&key=$key\r\n"; + $message .= get_option('siteurl') . "/wp-login.php?action=rp&key=$key\r\n"; - $m = wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_settings('blogname')), $message); + $m = wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message); if ($m == false) { echo '<p>' . __('The e-mail could not be sent.') . "<br />\n"; @@ -145,9 +145,9 @@ case 'rp' : wp_cache_delete($user->user_login, 'userlogins'); $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n"; - $message .= get_settings('siteurl') . "/wp-login.php\r\n"; + $message .= get_option('siteurl') . "/wp-login.php\r\n"; - $m = wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_settings('blogname')), $message); + $m = wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_option('blogname')), $message); if ($m == false) { echo '<p>' . __('The e-mail could not be sent.') . "<br />\n"; @@ -158,7 +158,7 @@ case 'rp' : echo "<a href='wp-login.php' title='" . __('Check your e-mail first, of course') . "'>" . __('Click here to login!') . '</a></p>'; // send a copy of password change notification to the admin $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; - wp_mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), $message); + wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), get_option('blogname')), $message); die(); } break; @@ -195,7 +195,7 @@ default: // If the user can't edit posts, send them to their profile. if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) ) - $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php'; + $redirect_to = get_option('siteurl') . '/wp-admin/profile.php'; if ( wp_login($user_login, $user_pass, $using_cookie) ) { if ( !$using_cookie ) @@ -217,7 +217,7 @@ default: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title><?php _e('WordPress ›'); ?> <?php _e('Login') ?></title> + <title>WordPress › <?php _e('Login') ?></title> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <link rel="stylesheet" href="<?php bloginfo('wpurl'); ?>/wp-admin/wp-admin.css" type="text/css" /> <script type="text/javascript"> @@ -251,7 +251,7 @@ if ( $error ) { </form> <ul> <li><a href="<?php bloginfo('home'); ?>/" title="<?php _e('Are you lost?') ?>">« <?php _e('Back to blog') ?></a></li> -<?php if (get_settings('users_can_register')) : ?> +<?php if (get_option('users_can_register')) : ?> <li><a href="<?php bloginfo('wpurl'); ?>/wp-signup.php"><?php _e('Register') ?></a></li> <?php endif; ?> <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a></li> diff --git a/wp-mail.php b/wp-mail.php index 920beff..ded37bd 100644 --- a/wp-mail.php +++ b/wp-mail.php @@ -5,16 +5,16 @@ require_once(ABSPATH.WPINC.'/class-pop3.php'); error_reporting(2037); -$time_difference = get_settings('gmt_offset') * 3600; +$time_difference = get_option('gmt_offset') * 3600; $phone_delim = '::'; $pop3 = new POP3(); -if (!$pop3->connect(get_settings('mailserver_url'), get_settings('mailserver_port'))) +if (!$pop3->connect(get_option('mailserver_url'), get_option('mailserver_port'))) wp_die($pop3->ERROR); -$count = $pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass')); +$count = $pop3->login(get_option('mailserver_login'), get_option('mailserver_pass')); if (0 == $count) wp_die(__('There doesn’t seem to be any new mail.')); @@ -102,7 +102,7 @@ for ($i=1; $i <= $count; $i++) : } endforeach; - $subject = trim(str_replace(get_settings('subjectprefix'), '', $subject)); + $subject = trim(str_replace(get_option('subjectprefix'), '', $subject)); if ($content_type == 'multipart/alternative') { $content = explode('--'.$boundary, $content); @@ -126,7 +126,7 @@ for ($i=1; $i <= $count; $i++) : if ($post_title == '') $post_title = $subject; - if (empty($post_categories)) $post_categories[] = get_settings('default_email_category'); + if (empty($post_categories)) $post_categories[] = get_option('default_email_category'); $post_category = $post_categories; @@ -5,11 +5,11 @@ if (empty($wp)) { wp('feed=rdf'); } -header('Content-type: application/rdf+xml; charset=' . get_settings('blog_charset'), true); +header('Content-type: application/rdf+xml; charset=' . get_option('blog_charset'), true); $more = 1; ?> -<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?> +<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <!-- generator="wordpress/<?php echo $wp_version ?>" --> <rdf:RDF xmlns="http://purl.org/rss/1.0/" @@ -45,10 +45,10 @@ $more = 1; <dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date> <dc:creator><?php the_author() ?></dc:creator> <?php the_category_rss('rdf') ?> -<?php if (get_settings('rss_use_excerpt')) : ?> +<?php if (get_option('rss_use_excerpt')) : ?> <description><?php the_excerpt_rss() ?></description> <?php else : ?> - <description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length'), 2) ?></description> + <description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length'), 2) ?></description> <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded> <?php endif; ?> <?php do_action('rdf_item'); ?> @@ -5,11 +5,11 @@ if (empty($wp)) { wp('feed=rss'); } -header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true); +header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); $more = 1; ?> -<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?> +<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <!-- generator="wordpress/<?php echo $wp_version ?>" --> <rss version="0.92"> <channel> @@ -24,14 +24,14 @@ $more = 1; <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?> <item> <title><?php the_title_rss() ?></title> -<?php if (get_settings('rss_use_excerpt')) { ?> +<?php if (get_option('rss_use_excerpt')) { ?> <description><![CDATA[<?php the_excerpt_rss() ?>]]></description> <?php } else { // use content ?> - <description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length')) ?></description> + <description><?php the_content_rss('', 0, '', get_option('rss_excerpt_length')) ?></description> <?php } ?> <link><?php permalink_single_rss() ?></link> <?php do_action('rss_item'); ?> </item> -<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?> +<?php $items_count++; if (($items_count == get_option('posts_per_rss')) && empty($m)) { break; } } } ?> </channel> </rss> diff --git a/wp-rss2.php b/wp-rss2.php index 4316ceb..ecbe721 100644 --- a/wp-rss2.php +++ b/wp-rss2.php @@ -5,11 +5,11 @@ if (empty($wp)) { wp('feed=rss2'); } -header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true); +header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); $more = 1; ?> -<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?> +<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" --> <rss version="2.0" @@ -37,7 +37,7 @@ $more = 1; <?php the_category_rss() ?> <guid isPermaLink="false"><?php the_guid(); ?></guid> -<?php if (get_settings('rss_use_excerpt')) : ?> +<?php if (get_option('rss_use_excerpt')) : ?> <description><![CDATA[<?php the_excerpt_rss() ?>]]></description> <?php else : ?> <description><![CDATA[<?php the_excerpt_rss() ?>]]></description> @@ -51,6 +51,6 @@ $more = 1; <?php rss_enclosure(); ?> <?php do_action('rss2_item'); ?> </item> - <?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && !is_date()) { break; } } } ?> + <?php $items_count++; if (($items_count == get_option('posts_per_rss')) && !is_date()) { break; } } } ?> </channel> </rss> diff --git a/wp-settings.php b/wp-settings.php index de93772..a79773a 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -50,10 +50,10 @@ if ( empty($PHP_SELF) ) $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); if ( !(phpversion() >= '4.1') ) - die(sprintf(__('Your server is running PHP version %s but WordPress requires at least 4.1'), phpversion())); + die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' ); if ( !extension_loaded('mysql') ) - die(__('Your PHP installation appears to be missing the MySQL which is required for WordPress.')); + die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' ); function timer_start() { global $timestart; @@ -74,6 +74,7 @@ if ( defined('WP_CACHE') ) define('WPINC', 'wp-includes'); require_once (ABSPATH . WPINC . '/wp-db.php'); +// Table names $wpdb->blogs = $table_prefix . 'blogs'; $wpdb->users = $table_prefix . 'users'; $wpdb->usermeta = $table_prefix . 'usermeta'; @@ -211,16 +212,16 @@ if ( !defined('USER_COOKIE') ) if ( !defined('PASS_COOKIE') ) define('PASS_COOKIE', 'wordpresspass'); if ( !defined('COOKIEPATH') ) - define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('home') . '/' ) ); + define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); if ( !defined('SITECOOKIEPATH') ) - define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_settings('siteurl') . '/' ) ); + define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); if ( !defined('COOKIE_DOMAIN') ) define('COOKIE_DOMAIN', '.' . $current_site->domain); require (ABSPATH . WPINC . '/vars.php'); -if ( get_settings('active_plugins') ) { - $current_plugins = get_settings('active_plugins'); +if ( get_option('active_plugins') ) { + $current_plugins = get_option('active_plugins'); if ( is_array($current_plugins) ) { foreach ($current_plugins as $plugin) { if ('' != $plugin && file_exists(ABSPATH . 'wp-content/plugins/' . $plugin)) @@ -258,6 +259,7 @@ $wp = new WP(); if( defined( "WP_INSTALLING" ) == false ) validate_current_theme(); define('TEMPLATEPATH', get_template_directory()); +define('STYLESHEETPATH', get_stylesheet_directory()); // Load the default text localization domain. load_default_textdomain(); @@ -268,8 +270,10 @@ require_once(ABSPATH . WPINC . '/locale.php'); $wp_locale = new WP_Locale(); // Load functions for active theme. -if ( file_exists(TEMPLATEPATH . "/functions.php") ) - include(TEMPLATEPATH . "/functions.php"); +if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') ) + include(STYLESHEETPATH . '/functions.php'); +if ( file_exists(TEMPLATEPATH . '/functions.php') ) + include(TEMPLATEPATH . '/functions.php'); function shutdown_action_hook() { do_action('shutdown'); diff --git a/wp-trackback.php b/wp-trackback.php index cf93844..daa16c1 100644 --- a/wp-trackback.php +++ b/wp-trackback.php @@ -42,9 +42,9 @@ else $charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS'; if ( function_exists('mb_convert_encoding') ) { // For international trackbacks - $title = mb_convert_encoding($title, get_settings('blog_charset'), $charset); - $excerpt = mb_convert_encoding($excerpt, get_settings('blog_charset'), $charset); - $blog_name = mb_convert_encoding($blog_name, get_settings('blog_charset'), $charset); + $title = mb_convert_encoding($title, get_option('blog_charset'), $charset); + $excerpt = mb_convert_encoding($excerpt, get_option('blog_charset'), $charset); + $blog_name = mb_convert_encoding($blog_name, get_option('blog_charset'), $charset); } if ( is_single() || is_page() ) @@ -70,8 +70,8 @@ if ( !empty($tb_url) && !empty($title) && !empty($tb_url) ) { $title = wp_specialchars( strip_tags( $title ) ); $excerpt = strip_tags($excerpt); if ( function_exists('mb_strcut') ) { // For international trackbacks - $excerpt = mb_strcut($excerpt, 0, 252, get_settings('blog_charset')) . '...'; - $title = mb_strcut($title, 0, 250, get_settings('blog_charset')) . '...'; + $excerpt = mb_strcut($excerpt, 0, 252, get_option('blog_charset')) . '...'; + $title = mb_strcut($title, 0, 250, get_option('blog_charset')) . '...'; } else { $excerpt = (strlen($excerpt) > 255) ? substr($excerpt, 0, 252) . '...' : $excerpt; $title = (strlen($title) > 250) ? substr($title, 0, 250) . '...' : $title; @@ -86,7 +86,7 @@ if ( !empty($tb_url) && !empty($title) && !empty($tb_url) ) { $dupe = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_author_url = '$comment_author_url'"); if ( $dupe ) - trackback_response(1, 'We already have a ping from that URI for this post.'); + trackback_response(1, 'We already have a ping from that URL for this post.'); $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type'); @@ -12,10 +12,10 @@ if ( isset($HTTP_RAW_POST_DATA) ) include('./wp-config.php'); if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd -header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true); +header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); ?> -<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?> +<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> <service> <engineName>WordPress</engineName> @@ -190,9 +190,9 @@ class wp_xmlrpc_server extends IXR_Server { $struct = array( 'isAdmin' => $is_admin, - 'url' => get_settings('home') . '/', + 'url' => get_option('home') . '/', 'blogid' => '1', - 'blogName' => get_settings('blogname') + 'blogName' => get_option('blogname') ); return array($struct); @@ -328,8 +328,8 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error(401, 'Sorry, this user can not edit the template.'); } - /* warning: here we make the assumption that the weblog's URI is on the same server */ - $filename = get_settings('home') . '/'; + /* warning: here we make the assumption that the weblog's URL is on the same server */ + $filename = get_option('home') . '/'; $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); $f = fopen($filename, 'r'); @@ -363,8 +363,8 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error(401, 'Sorry, this user can not edit the template.'); } - /* warning: here we make the assumption that the weblog's URI is on the same server */ - $filename = get_settings('home') . '/'; + /* warning: here we make the assumption that the weblog's URL is on the same server */ + $filename = get_option('home') . '/'; $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); if ($f = fopen($filename, 'w+')) { @@ -544,11 +544,11 @@ class wp_xmlrpc_server extends IXR_Server { $post_more = $content_struct['mt_text_more']; $comment_status = (empty($content_struct['mt_allow_comments'])) ? - get_settings('default_comment_status') + get_option('default_comment_status') : $content_struct['mt_allow_comments']; $ping_status = (empty($content_struct['mt_allow_pings'])) ? - get_settings('default_ping_status') + get_option('default_ping_status') : $content_struct['mt_allow_pings']; if ($post_more) { @@ -641,11 +641,11 @@ class wp_xmlrpc_server extends IXR_Server { $to_ping = $content_struct['mt_tb_ping_urls']; $comment_status = (empty($content_struct['mt_allow_comments'])) ? - get_settings('default_comment_status') + get_option('default_comment_status') : $content_struct['mt_allow_comments']; $ping_status = (empty($content_struct['mt_allow_pings'])) ? - get_settings('default_ping_status') + get_option('default_ping_status') : $content_struct['mt_allow_pings']; // Do some timestamp voodoo @@ -1111,7 +1111,7 @@ class wp_xmlrpc_server extends IXR_Server { $error_code = -1; // Check if the page linked to is in our site - $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_settings('home'))); + $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home'))); if( !$pos1 ) return new IXR_Error(0, 'Is there no link to us?'); @@ -1153,24 +1153,24 @@ class wp_xmlrpc_server extends IXR_Server { } } else { // TODO: Attempt to extract a post ID from the given URL - return new IXR_Error(33, 'The specified target URI cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); + return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); } $post_ID = (int) $post_ID; - logIO("O","(PB) URI='$pagelinkedto' ID='$post_ID' Found='$way'"); + logIO("O","(PB) URL='$pagelinkedto' ID='$post_ID' Found='$way'"); $post = get_post($post_ID); if ( !$post ) // Post_ID not found - return new IXR_Error(33, 'The specified target URI cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); + return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); if ( $post_ID == url_to_postid($pagelinkedfrom) ) - return new IXR_Error(0, 'The source URI and the target URI cannot both point to the same resource.'); + return new IXR_Error(0, 'The source URL and the target URL cannot both point to the same resource.'); // Check if pings are on if ( 'closed' == $post->ping_status ) - return new IXR_Error(33, 'The specified target URI cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); + return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); // Let's check that the remote site didn't already pingback this entry $result = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_ID' AND comment_author_url = '$pagelinkedfrom'"); @@ -1184,7 +1184,7 @@ class wp_xmlrpc_server extends IXR_Server { // Let's check the remote site $linea = wp_remote_fopen( $pagelinkedfrom ); if ( !$linea ) - return new IXR_Error(16, 'The source URI does not exist.'); + return new IXR_Error(16, 'The source URL does not exist.'); // Work around bug in strip_tags(): $linea = str_replace('<!DOC', '<DOC', $linea); @@ -1219,7 +1219,7 @@ class wp_xmlrpc_server extends IXR_Server { } if ( empty($context) ) // URL pattern not found - return new IXR_Error(17, 'The source URI does not contain a link to the target URI, and so cannot be used as a source.'); + return new IXR_Error(17, 'The source URL does not contain a link to the target URL, and so cannot be used as a source.'); $pagelinkedfrom = preg_replace('#&([^amp\;])#is', '&$1', $pagelinkedfrom); @@ -1259,14 +1259,14 @@ class wp_xmlrpc_server extends IXR_Server { $post_ID = url_to_postid($url); if (!$post_ID) { // We aren't sure that the resource is available and/or pingback enabled - return new IXR_Error(33, 'The specified target URI cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); + return new IXR_Error(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); } $actual_post = wp_get_single_post($post_ID, ARRAY_A); if (!$actual_post) { // No such post = resource not found - return new IXR_Error(32, 'The specified target URI does not exist.'); + return new IXR_Error(32, 'The specified target URL does not exist.'); } $comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID"); |