Fixed several instances in WordPress where PHP Notices are not being handled correctly.
Fixes supplied by Aaron Jensen (aaron@visualprose.com). git-svn-id: http://svn.automattic.com/wordpress/trunk@559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3e120068f9
commit
a5ab0fc858
|
@ -293,14 +293,14 @@ function convert_gmcode($content) {
|
||||||
function convert_smilies($text) {
|
function convert_smilies($text) {
|
||||||
global $smilies_directory, $use_smilies;
|
global $smilies_directory, $use_smilies;
|
||||||
global $b2_smiliessearch, $b2_smiliesreplace;
|
global $b2_smiliessearch, $b2_smiliesreplace;
|
||||||
|
$output = '';
|
||||||
if ($use_smilies) {
|
if ($use_smilies) {
|
||||||
// HTML loop taken from texturize function, could possible be consolidated
|
// 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
|
$textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
|
||||||
$stop = count($textarr);// loop stuff
|
$stop = count($textarr);// loop stuff
|
||||||
for ($i = 0; $i < $stop; $i++) {
|
for ($i = 0; $i < $stop; $i++) {
|
||||||
$content = $textarr[$i];
|
$content = $textarr[$i];
|
||||||
if ('<' != $content{0}) { // If it's not a tag
|
if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
|
||||||
$content = str_replace($b2_smiliessearch, $b2_smiliesreplace, $content);
|
$content = str_replace($b2_smiliessearch, $b2_smiliesreplace, $content);
|
||||||
}
|
}
|
||||||
$output .= $content;
|
$output .= $content;
|
||||||
|
@ -1628,7 +1628,10 @@ function apply_filters($tag, $string) {
|
||||||
global $b2_filter;
|
global $b2_filter;
|
||||||
if (isset($b2_filter['all'])) {
|
if (isset($b2_filter['all'])) {
|
||||||
$b2_filter['all'] = (is_string($b2_filter['all'])) ? array($b2_filter['all']) : $b2_filter['all'];
|
$b2_filter['all'] = (is_string($b2_filter['all'])) ? array($b2_filter['all']) : $b2_filter['all'];
|
||||||
$b2_filter[$tag] = array_merge($b2_filter['all'], $b2_filter[$tag]);
|
if (isset($b2_filter[$tag]))
|
||||||
|
$b2_filter[$tag] = array_merge($b2_filter['all'], $b2_filter[$tag]);
|
||||||
|
else
|
||||||
|
$b2_filter[$tag] = array_merge($b2_filter['all'], array());
|
||||||
$b2_filter[$tag] = array_unique($b2_filter[$tag]);
|
$b2_filter[$tag] = array_unique($b2_filter[$tag]);
|
||||||
}
|
}
|
||||||
if (isset($b2_filter[$tag])) {
|
if (isset($b2_filter[$tag])) {
|
||||||
|
|
|
@ -919,6 +919,7 @@ function the_excerpt_rss($cut = 0, $encode_html = 0) {
|
||||||
$output = strip_tags($output);
|
$output = strip_tags($output);
|
||||||
}
|
}
|
||||||
if ($cut) {
|
if ($cut) {
|
||||||
|
$excerpt = '';
|
||||||
$blah = explode(' ', $output);
|
$blah = explode(' ', $output);
|
||||||
if (count($blah) > $cut) {
|
if (count($blah) > $cut) {
|
||||||
$k = $cut;
|
$k = $cut;
|
||||||
|
@ -970,6 +971,7 @@ function get_the_excerpt($fakeit = false) {
|
||||||
$k = count($blah);
|
$k = count($blah);
|
||||||
$use_dotdotdot = 0;
|
$use_dotdotdot = 0;
|
||||||
}
|
}
|
||||||
|
$excerpt = '';
|
||||||
for ($i=0; $i<$k; $i++) {
|
for ($i=0; $i<$k; $i++) {
|
||||||
$excerpt .= $blah[$i].' ';
|
$excerpt .= $blah[$i].' ';
|
||||||
}
|
}
|
||||||
|
@ -1227,6 +1229,9 @@ function get_category_link($echo = false, $file='') {
|
||||||
if ($file == '') {
|
if ($file == '') {
|
||||||
$file = "$siteurl/$blogfilename";
|
$file = "$siteurl/$blogfilename";
|
||||||
}
|
}
|
||||||
|
if ('http:' != substr($file,0,5)) {
|
||||||
|
$file = "$siteurl/$file";
|
||||||
|
}
|
||||||
$link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID;
|
$link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID;
|
||||||
if ($echo)
|
if ($echo)
|
||||||
echo($link);
|
echo($link);
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment_author = trim($HTTP_COOKIE_VARS["comment_author_".$cookiehash]);
|
$comment_author = (isset($HTTP_COOKIE_VARS['comment_author_'.$cookiehash])) ? trim($HTTP_COOKIE_VARS['comment_author_'.$cookiehash]) : '';
|
||||||
$comment_author_email = trim($HTTP_COOKIE_VARS["comment_author_email_".$cookiehash]);
|
$comment_author_email = (isset($HTTP_COOKIE_VARS['comment_author_email_'.$cookiehash])) ? trim($HTTP_COOKIE_VARS['comment_author_email_'.$cookiehash]) : '';
|
||||||
$comment_author_url = trim($HTTP_COOKIE_VARS["comment_author_url_".$cookiehash]);
|
$comment_author_url = (isset($HTTP_COOKIE_VARS['comment_author_url_'.$cookiehash])) ? trim($HTTP_COOKIE_VARS['comment_author_url_'.$cookiehash]) : '';
|
||||||
|
|
||||||
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date");
|
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date");
|
||||||
++$querycount;
|
++$querycount;
|
||||||
|
|
|
@ -41,9 +41,9 @@ $b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search
|
||||||
@header ("X-Pingback: $siteurl/xmlrpc.php");
|
@header ("X-Pingback: $siteurl/xmlrpc.php");
|
||||||
|
|
||||||
/* Getting settings from db */
|
/* Getting settings from db */
|
||||||
if ($doing_rss == 1)
|
if (isset($doing_rss) && $doing_rss == 1)
|
||||||
$posts_per_page=get_settings('posts_per_rss');
|
$posts_per_page=get_settings('posts_per_rss');
|
||||||
if ($posts_per_page == 0)
|
if (!isset($posts_per_page) || $posts_per_page == 0)
|
||||||
$posts_per_page = get_settings('posts_per_page');
|
$posts_per_page = get_settings('posts_per_page');
|
||||||
$what_to_show = get_settings('what_to_show');
|
$what_to_show = get_settings('what_to_show');
|
||||||
$archive_mode = get_settings('archive_mode');
|
$archive_mode = get_settings('archive_mode');
|
||||||
|
@ -61,7 +61,7 @@ $distinct = '';
|
||||||
|
|
||||||
if ($pagenow != 'wp-post.php') { timer_start(); }
|
if ($pagenow != 'wp-post.php') { timer_start(); }
|
||||||
|
|
||||||
if ($showposts) {
|
if (isset($showposts) && $showposts) {
|
||||||
$showposts = (int)$showposts;
|
$showposts = (int)$showposts;
|
||||||
$posts_per_page = $showposts;
|
$posts_per_page = $showposts;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,10 @@ if ($pagenow != 'wp-post.php') {
|
||||||
$where .= ' AND (post_status = "publish"';
|
$where .= ' AND (post_status = "publish"';
|
||||||
|
|
||||||
// Get private posts
|
// Get private posts
|
||||||
if ('' != intval($user_ID)) $where .= " OR post_author = $user_ID AND post_status != 'draft')"; else $where .= ')';
|
if (isset($user_ID) && ('' != intval($user_ID)))
|
||||||
|
$where .= " OR post_author = $user_ID AND post_status != 'draft')";
|
||||||
|
else
|
||||||
|
$where .= ')';
|
||||||
$request = " SELECT $distinct * FROM $tableposts WHERE 1=1".$where." ORDER BY post_$orderby $limits";
|
$request = " SELECT $distinct * FROM $tableposts WHERE 1=1".$where." ORDER BY post_$orderby $limits";
|
||||||
|
|
||||||
|
|
||||||
|
|
29
wp-rss.php
29
wp-rss.php
|
@ -1,25 +1,23 @@
|
||||||
<?php /* These first lines are the first part of a CafeLog template.
|
<?php /* These first lines are the first part of a CafeLog template.
|
||||||
In every template you do, you got to copy them before the CafeLog 'loop' */
|
In every template you do, you got to copy them before the CafeLog 'loop' */
|
||||||
$blog = 1; // enter your blog's ID
|
$blog = 1; // enter your blog's ID
|
||||||
$doing_rss=1;
|
$doing_rss = 1;
|
||||||
header('Content-type: text/xml',true);
|
header('Content-type: text/xml',true);
|
||||||
include('blog.header.php');
|
include('blog.header.php');
|
||||||
|
|
||||||
// Handle Conditional GET
|
// Handle Conditional GET
|
||||||
|
|
||||||
// Get the time of the most recent article
|
// Get the time of the most recent article
|
||||||
$sql = "SELECT max(post_date) FROM $tableposts";
|
$maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts");
|
||||||
|
|
||||||
$maxdate = $wpdb->get_var($sql);
|
|
||||||
++$querycount;
|
++$querycount;
|
||||||
$unixtime = strtotime($maxdate);
|
$unixtime = strtotime($maxdate);
|
||||||
|
|
||||||
// format timestamp for Last-Modified header
|
// format timestamp for Last-Modified header
|
||||||
$clast = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
|
$clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime);
|
||||||
$cetag = md5($last);
|
$cetag = (isset($last)) ? md5($last) : '';
|
||||||
|
|
||||||
$slast = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
$slast = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : '' ;
|
||||||
$setag = $_SERVER['HTTP_IF_NONE_MATCH'];
|
$setag = (isset($_SERVER['HTTP_IF_NONE_MATCH'])) ? $_SERVER['HTTP_IF_NONE_MATCH'] : '';
|
||||||
|
|
||||||
// send it in a Last-Modified header
|
// send it in a Last-Modified header
|
||||||
header("Last-Modified: " . $clast, true);
|
header("Last-Modified: " . $clast, true);
|
||||||
|
@ -32,10 +30,17 @@ header("Etag: " . $cetag, true);
|
||||||
// but if both headers exist, they *both* must match up with the locally
|
// but if both headers exist, they *both* must match up with the locally
|
||||||
// generated values.
|
// generated values.
|
||||||
//if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
|
//if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
|
||||||
if (($slast && $setag)?(($slast == $clast) && ($setag == $cetag)):(($slast == $clast) || ($setag == $cetag))) {
|
if (($slast != '') && ($setag != '')) {
|
||||||
header("HTTP/1.1 304 Not Modified");
|
if (($slast == $clast) && ($setag == $cetag)) {
|
||||||
echo "\r\n\r\n";
|
header("HTTP/1.1 304 Not Modified");
|
||||||
exit;
|
echo "\r\n\r\n";
|
||||||
|
exit;
|
||||||
|
} else if (($slast == $clast)
|
||||||
|
|| ($setag == $cetag)) {
|
||||||
|
header("HTTP/1.1 304 Not Modified");
|
||||||
|
echo "\r\n\r\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($rss_language)) { $rss_language = 'en'; }
|
if (!isset($rss_language)) { $rss_language = 'en'; }
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// We should eventually migrate to either calling
|
// We should eventually migrate to either calling
|
||||||
// get_settings() wherever these are needed OR
|
// get_settings() wherever these are needed OR
|
||||||
// accessing a single global $all_settings var
|
// accessing a single global $all_settings var
|
||||||
if (!$_wp_installing) {
|
if (!isset($_wp_installing) || !$_wp_installing) {
|
||||||
$siteurl = get_settings('siteurl');
|
$siteurl = get_settings('siteurl');
|
||||||
// "When trying to design a foolproof system,
|
// "When trying to design a foolproof system,
|
||||||
// never underestimate the ingenuity of the fools :)"
|
// never underestimate the ingenuity of the fools :)"
|
||||||
|
|
Loading…
Reference in New Issue