mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Remove trailing spaces and convert spaces to tabs. Props Nazgul. fixes #986
git-svn-id: https://develop.svn.wordpress.org/trunk@4495 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -146,7 +146,7 @@ function get_links($category = -1,
|
||||
}
|
||||
|
||||
function get_linkrating($link) {
|
||||
return apply_filters('link_rating', $link->link_rating);
|
||||
return apply_filters('link_rating', $link->link_rating);
|
||||
}
|
||||
|
||||
/** function get_linkcatname()
|
||||
|
||||
@@ -19,7 +19,7 @@ function get_bookmark($bookmark_id, $output = OBJECT) {
|
||||
|
||||
// Deprecate
|
||||
function get_link($bookmark_id, $output = OBJECT) {
|
||||
return get_bookmark($bookmark_id, $output);
|
||||
return get_bookmark($bookmark_id, $output);
|
||||
}
|
||||
|
||||
function get_bookmarks($args = '') {
|
||||
@@ -50,7 +50,7 @@ function get_bookmarks($args = '') {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($inclusions))
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
|
||||
$exclusions = '';
|
||||
@@ -65,9 +65,9 @@ function get_bookmarks($args = '') {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($exclusions))
|
||||
if (!empty($exclusions))
|
||||
$exclusions .= ')';
|
||||
|
||||
|
||||
if ( ! empty($category_name) ) {
|
||||
if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") )
|
||||
$category = $cat_id;
|
||||
@@ -87,7 +87,7 @@ function get_bookmarks($args = '') {
|
||||
}
|
||||
}
|
||||
if (!empty($category_query)) {
|
||||
$category_query .= ')';
|
||||
$category_query .= ')';
|
||||
$join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) ";
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class WP_Object_Cache {
|
||||
var $secret = '';
|
||||
|
||||
function acquire_lock() {
|
||||
// Acquire a write lock.
|
||||
// Acquire a write lock.
|
||||
$this->mutex = @fopen($this->cache_dir.$this->flock_filename, 'w');
|
||||
if ( false == $this->mutex)
|
||||
return false;
|
||||
@@ -237,11 +237,11 @@ class WP_Object_Cache {
|
||||
while ($index < count($stack)) {
|
||||
# Get indexed directory from stack
|
||||
$dir = $stack[$index];
|
||||
|
||||
|
||||
$dh = @ opendir($dir);
|
||||
if (!$dh)
|
||||
return false;
|
||||
|
||||
|
||||
while (($file = @ readdir($dh)) !== false) {
|
||||
if ($file == '.' or $file == '..')
|
||||
continue;
|
||||
|
||||
@@ -221,18 +221,18 @@ class WP_User {
|
||||
}
|
||||
|
||||
function level_reduction($max, $item) {
|
||||
if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
|
||||
$level = intval($matches[1]);
|
||||
return max($max, $level);
|
||||
} else {
|
||||
return $max;
|
||||
}
|
||||
if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
|
||||
$level = intval($matches[1]);
|
||||
return max($max, $level);
|
||||
} else {
|
||||
return $max;
|
||||
}
|
||||
}
|
||||
|
||||
function update_user_level_from_caps() {
|
||||
global $wpdb;
|
||||
$this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0);
|
||||
update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level);
|
||||
global $wpdb;
|
||||
$this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0);
|
||||
update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level);
|
||||
}
|
||||
|
||||
function add_cap($cap, $grant = true) {
|
||||
@@ -298,7 +298,7 @@ function map_meta_cap($cap, $user_id) {
|
||||
$post = get_post($args[0]);
|
||||
if ( 'page' == $post->post_type ) {
|
||||
$args = array_merge(array('delete_page', $user_id), $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
}
|
||||
$post_author_data = get_userdata($post->post_author);
|
||||
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>";
|
||||
@@ -352,7 +352,7 @@ function map_meta_cap($cap, $user_id) {
|
||||
$post = get_post($args[0]);
|
||||
if ( 'page' == $post->post_type ) {
|
||||
$args = array_merge(array('edit_page', $user_id), $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
}
|
||||
$post_author_data = get_userdata($post->post_author);
|
||||
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>";
|
||||
@@ -402,7 +402,7 @@ function map_meta_cap($cap, $user_id) {
|
||||
$post = get_post($args[0]);
|
||||
if ( 'page' == $post->post_type ) {
|
||||
$args = array_merge(array('read_page', $user_id), $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
}
|
||||
|
||||
if ( 'private' != $post->post_status ) {
|
||||
|
||||
@@ -187,8 +187,8 @@ function wp_dropdown_categories($args = '') {
|
||||
$output .= "\t<option value='0'>$show_option_all</option>\n";
|
||||
}
|
||||
|
||||
if ( $show_option_none) {
|
||||
$show_option_none = apply_filters('list_cats', $show_option_none);
|
||||
if ( $show_option_none) {
|
||||
$show_option_none = apply_filters('list_cats', $show_option_none);
|
||||
$output .= "\t<option value='-1'>$show_option_none</option>\n";
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ function wp_list_categories($args = '') {
|
||||
extract($r);
|
||||
|
||||
$categories = get_categories($r);
|
||||
|
||||
|
||||
$output = '';
|
||||
if ( $title_li && 'list' == $style )
|
||||
$output = '<li class="categories">' . $r['title_li'] . '<ul>';
|
||||
@@ -249,7 +249,7 @@ function wp_list_categories($args = '') {
|
||||
|
||||
if ( $title_li && 'list' == $style )
|
||||
$output .= '</ul></li>';
|
||||
|
||||
|
||||
echo apply_filters('list_cats', $output);
|
||||
}
|
||||
|
||||
|
||||
+48
-48
@@ -12,7 +12,7 @@ class WP {
|
||||
var $matched_rule;
|
||||
var $matched_query;
|
||||
var $did_permalink = false;
|
||||
|
||||
|
||||
function add_query_var($qv) {
|
||||
$this->public_query_vars[] = $qv;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ class WP {
|
||||
preg_match("!^$match!", urldecode($request_match), $matches)) {
|
||||
// Got a match.
|
||||
$this->matched_rule = $match;
|
||||
|
||||
|
||||
// Trim the query of everything up to the '?'.
|
||||
$query = preg_replace("!^.+\?!", '', $query);
|
||||
|
||||
@@ -190,14 +190,14 @@ class WP {
|
||||
)
|
||||
)
|
||||
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
|
||||
else
|
||||
else
|
||||
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
|
||||
$wp_etag = '"' . md5($wp_last_modified) . '"';
|
||||
@header("Last-Modified: $wp_last_modified");
|
||||
@header("ETag: $wp_etag");
|
||||
|
||||
// Support for Conditional GET
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
|
||||
$client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
|
||||
else $client_etag = false;
|
||||
|
||||
@@ -321,7 +321,7 @@ class WP_Error {
|
||||
if ( empty($codes) )
|
||||
return '';
|
||||
|
||||
return $codes[0];
|
||||
return $codes[0];
|
||||
}
|
||||
|
||||
function get_error_messages($code = '') {
|
||||
@@ -337,7 +337,7 @@ class WP_Error {
|
||||
if ( isset($this->errors[$code]) )
|
||||
return $this->errors[$code];
|
||||
else
|
||||
return array();
|
||||
return array();
|
||||
}
|
||||
|
||||
function get_error_message($code = '') {
|
||||
@@ -381,29 +381,29 @@ function is_wp_error($thing) {
|
||||
|
||||
// A class for displaying various tree-like structures. Extend the Walker class to use it, see examples at the bottom
|
||||
|
||||
class Walker {
|
||||
class Walker {
|
||||
var $tree_type;
|
||||
var $db_fields;
|
||||
|
||||
|
||||
//abstract callbacks
|
||||
function start_lvl($output) { return $output; }
|
||||
function end_lvl($output) { return $output; }
|
||||
function start_el($output) { return $output; }
|
||||
function end_el($output) { return $output; }
|
||||
|
||||
|
||||
function walk($elements, $to_depth) {
|
||||
$args = array_slice(func_get_args(), 2); $parents = array(); $depth = 1; $previous_element = ''; $output = '';
|
||||
|
||||
|
||||
//padding at the end
|
||||
$last_element->post_parent = 0;
|
||||
$last_element->post_id = 0;
|
||||
$elements[] = $last_element;
|
||||
|
||||
|
||||
$id_field = $this->db_fields['id'];
|
||||
$parent_field = $this->db_fields['parent'];
|
||||
|
||||
|
||||
$flat = ($to_depth == -1) ? true : false;
|
||||
|
||||
|
||||
foreach ( $elements as $element ) {
|
||||
// If flat, start and end the element and skip the level checks.
|
||||
if ( $flat) {
|
||||
@@ -443,7 +443,7 @@ class Walker {
|
||||
$cb_args = array_merge( array($output, $previous_element, $depth - 1), $args);
|
||||
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
|
||||
}
|
||||
|
||||
|
||||
while ( $parent = array_shift($parents) ) {
|
||||
$depth--;
|
||||
if ( !$to_depth || ($depth < $to_depth) ) {
|
||||
@@ -463,7 +463,7 @@ class Walker {
|
||||
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Start the element.
|
||||
if ( !$to_depth || ($depth <= $to_depth) ) {
|
||||
if ( $element->$id_field != 0 ) {
|
||||
@@ -471,10 +471,10 @@ class Walker {
|
||||
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$previous_element = $element;
|
||||
}
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -482,19 +482,19 @@ class Walker {
|
||||
class Walker_Page extends Walker {
|
||||
var $tree_type = 'page';
|
||||
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
|
||||
|
||||
|
||||
function start_lvl($output, $depth) {
|
||||
$indent = str_repeat("\t", $depth);
|
||||
$output .= "$indent<ul>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function end_lvl($output, $depth) {
|
||||
$indent = str_repeat("\t", $depth);
|
||||
$output .= "$indent</ul>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function start_el($output, $page, $depth, $current_page, $show_date, $date_format) {
|
||||
if ( $depth )
|
||||
$indent = str_repeat("\t", $depth);
|
||||
@@ -530,45 +530,45 @@ class Walker_PageDropdown extends Walker {
|
||||
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
|
||||
|
||||
function start_el($output, $page, $depth, $args) {
|
||||
$pad = str_repeat(' ', $depth * 3);
|
||||
$pad = str_repeat(' ', $depth * 3);
|
||||
|
||||
$output .= "\t<option value=\"$page->ID\"";
|
||||
if ( $page->ID == $args['selected'] )
|
||||
$output .= ' selected="selected"';
|
||||
$output .= '>';
|
||||
$title = wp_specialchars($page->post_title);
|
||||
$output .= "$pad$title";
|
||||
$output .= "</option>\n";
|
||||
$output .= "\t<option value=\"$page->ID\"";
|
||||
if ( $page->ID == $args['selected'] )
|
||||
$output .= ' selected="selected"';
|
||||
$output .= '>';
|
||||
$title = wp_specialchars($page->post_title);
|
||||
$output .= "$pad$title";
|
||||
$output .= "</option>\n";
|
||||
|
||||
return $output;
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
class Walker_Category extends Walker {
|
||||
var $tree_type = 'category';
|
||||
var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
|
||||
|
||||
|
||||
function start_lvl($output, $depth, $args) {
|
||||
if ( 'list' != $args['style'] )
|
||||
return $output;
|
||||
|
||||
|
||||
$indent = str_repeat("\t", $depth);
|
||||
$output .= "$indent<ul class='children'>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function end_lvl($output, $depth, $args) {
|
||||
if ( 'list' != $args['style'] )
|
||||
return $output;
|
||||
|
||||
|
||||
$indent = str_repeat("\t", $depth);
|
||||
$output .= "$indent</ul>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function start_el($output, $category, $depth, $args) {
|
||||
extract($args);
|
||||
|
||||
|
||||
$link = '<a href="' . get_category_link($category->cat_ID) . '" ';
|
||||
if ( $use_desc_for_title == 0 || empty($category->category_description) )
|
||||
$link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name, 1)) . '"';
|
||||
@@ -576,24 +576,24 @@ class Walker_Category extends Walker {
|
||||
$link .= 'title="' . wp_specialchars(apply_filters('category_description',$category->category_description,$category),1) . '"';
|
||||
$link .= '>';
|
||||
$link .= apply_filters('list_cats', $category->cat_name, $category).'</a>';
|
||||
|
||||
|
||||
if ( (! empty($feed_image)) || (! empty($feed)) ) {
|
||||
$link .= ' ';
|
||||
|
||||
|
||||
if ( empty($feed_image) )
|
||||
$link .= '(';
|
||||
|
||||
|
||||
$link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"';
|
||||
|
||||
|
||||
if ( !empty($feed) ) {
|
||||
$title = ' title="' . $feed . '"';
|
||||
$alt = ' alt="' . $feed . '"';
|
||||
$name = $feed;
|
||||
$link .= $title;
|
||||
}
|
||||
|
||||
|
||||
$link .= '>';
|
||||
|
||||
|
||||
if ( !empty($feed_image) )
|
||||
$link .= "<img src='$feed_image' $alt$title" . ' />';
|
||||
else
|
||||
@@ -618,14 +618,14 @@ class Walker_Category extends Walker {
|
||||
} else {
|
||||
$output .= "\t$link<br />\n";
|
||||
}
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function end_el($output, $page, $depth, $args) {
|
||||
if ( 'list' != $args['style'] )
|
||||
return $output;
|
||||
|
||||
|
||||
$output .= "</li>\n";
|
||||
return $output;
|
||||
}
|
||||
@@ -635,10 +635,10 @@ class Walker_Category extends Walker {
|
||||
class Walker_CategoryDropdown extends Walker {
|
||||
var $tree_type = 'category';
|
||||
var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
|
||||
|
||||
function start_el($output, $category, $depth, $args) {
|
||||
|
||||
function start_el($output, $category, $depth, $args) {
|
||||
$pad = str_repeat(' ', $depth * 3);
|
||||
|
||||
|
||||
$cat_name = apply_filters('list_cats', $category->cat_name, $category);
|
||||
$output .= "\t<option value=\"".$category->cat_ID."\"";
|
||||
if ( $category->cat_ID == $args['selected'] )
|
||||
@@ -652,7 +652,7 @@ class Walker_CategoryDropdown extends Walker {
|
||||
$output .= ' ' . gmdate($format, $category->last_update_timestamp);
|
||||
}
|
||||
$output .= "</option>\n";
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ function get_comments_link() {
|
||||
}
|
||||
|
||||
function comments_link( $file = '', $echo = true ) {
|
||||
echo get_comments_link();
|
||||
echo get_comments_link();
|
||||
}
|
||||
|
||||
function get_comments_number( $post_id = 0 ) {
|
||||
@@ -240,9 +240,9 @@ function trackback_url( $display = true ) {
|
||||
function trackback_rdf($timezone = 0) {
|
||||
global $id;
|
||||
if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
|
||||
echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
|
||||
echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
|
||||
<rdf:Description rdf:about="';
|
||||
the_permalink();
|
||||
echo '"'."\n";
|
||||
@@ -265,7 +265,7 @@ function comments_open() {
|
||||
|
||||
function pings_open() {
|
||||
global $post;
|
||||
if ( 'open' == $post->ping_status )
|
||||
if ( 'open' == $post->ping_status )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -299,7 +299,7 @@ function comments_template( $file = '/comments.php' ) {
|
||||
}
|
||||
|
||||
function comments_popup_script($width=400, $height=400, $file='') {
|
||||
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
|
||||
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
|
||||
|
||||
if (empty ($file)) {
|
||||
$wpcommentspopupfile = ''; // Use the index.
|
||||
@@ -307,9 +307,9 @@ function comments_popup_script($width=400, $height=400, $file='') {
|
||||
$wpcommentspopupfile = $file;
|
||||
}
|
||||
|
||||
$wpcommentsjavascript = 1;
|
||||
$javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n";
|
||||
echo $javascript;
|
||||
$wpcommentsjavascript = 1;
|
||||
$javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n";
|
||||
echo $javascript;
|
||||
}
|
||||
|
||||
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
|
||||
|
||||
+21
-21
@@ -18,11 +18,11 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
|
||||
// Skip empty lines
|
||||
if (empty($word)) { continue; }
|
||||
|
||||
// Do some escaping magic so that '#' chars in the
|
||||
// Do some escaping magic so that '#' chars in the
|
||||
// spam words don't break things:
|
||||
$word = preg_quote($word, '#');
|
||||
|
||||
$pattern = "#$word#i";
|
||||
$pattern = "#$word#i";
|
||||
if ( preg_match($pattern, $author) ) return false;
|
||||
if ( preg_match($pattern, $email) ) return false;
|
||||
if ( preg_match($pattern, $url) ) return false;
|
||||
@@ -103,9 +103,9 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
|
||||
if ($no_cache) {
|
||||
$query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
|
||||
if (false == $include_unapproved) {
|
||||
$query .= " AND comment_approved = '1'";
|
||||
$query .= " AND comment_approved = '1'";
|
||||
}
|
||||
$myrow = $wpdb->get_row($query, ARRAY_A);
|
||||
$myrow = $wpdb->get_row($query, ARRAY_A);
|
||||
} else {
|
||||
$myrow['comment_ID'] = $postc->comment_ID;
|
||||
$myrow['comment_post_ID'] = $postc->comment_post_ID;
|
||||
@@ -157,7 +157,7 @@ function sanitize_comment_cookies() {
|
||||
if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
|
||||
$comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
|
||||
$comment_author_email = stripslashes($comment_author_email);
|
||||
$comment_author_email = wp_specialchars($comment_author_email, true);
|
||||
$comment_author_email = wp_specialchars($comment_author_email, true);
|
||||
$_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
|
||||
}
|
||||
|
||||
@@ -243,11 +243,11 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
|
||||
// Skip empty lines
|
||||
if ( empty($word) ) { continue; }
|
||||
|
||||
// Do some escaping magic so that '#' chars in the
|
||||
// Do some escaping magic so that '#' chars in the
|
||||
// spam words don't break things:
|
||||
$word = preg_quote($word, '#');
|
||||
|
||||
$pattern = "#$word#i";
|
||||
$pattern = "#$word#i";
|
||||
if ( preg_match($pattern, $author ) ) return true;
|
||||
if ( preg_match($pattern, $email ) ) return true;
|
||||
if ( preg_match($pattern, $url ) ) return true;
|
||||
@@ -328,9 +328,9 @@ function wp_insert_comment($commentdata) {
|
||||
if ( ! isset($user_id) )
|
||||
$user_id = 0;
|
||||
|
||||
$result = $wpdb->query("INSERT INTO $wpdb->comments
|
||||
$result = $wpdb->query("INSERT INTO $wpdb->comments
|
||||
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id)
|
||||
VALUES
|
||||
VALUES
|
||||
('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')
|
||||
");
|
||||
|
||||
@@ -397,26 +397,26 @@ function wp_new_comment( $commentdata ) {
|
||||
}
|
||||
|
||||
function wp_set_comment_status($comment_id, $comment_status) {
|
||||
global $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
switch($comment_status) {
|
||||
switch($comment_status) {
|
||||
case 'hold':
|
||||
$query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||
break;
|
||||
case 'approve':
|
||||
$query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||
break;
|
||||
case 'spam':
|
||||
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||
break;
|
||||
case 'spam':
|
||||
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||
break;
|
||||
case 'delete':
|
||||
return wp_delete_comment($comment_id);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($wpdb->query($query)) {
|
||||
}
|
||||
|
||||
if ($wpdb->query($query)) {
|
||||
do_action('wp_set_comment_status', $comment_id, $comment_status);
|
||||
|
||||
$comment = get_comment($comment_id);
|
||||
@@ -425,9 +425,9 @@ function wp_set_comment_status($comment_id, $comment_status) {
|
||||
if( is_object( $c ) )
|
||||
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
|
||||
return true;
|
||||
} else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wp_update_comment($commentarr) {
|
||||
@@ -582,7 +582,7 @@ function do_all_pings() {
|
||||
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
|
||||
pingback($ping->post_content, $ping->ID);
|
||||
}
|
||||
|
||||
|
||||
// Do Enclosures
|
||||
while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
|
||||
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
|
||||
@@ -705,7 +705,7 @@ function pingback($content, $post_ID) {
|
||||
$pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048);
|
||||
|
||||
if ($pingback_server_url) {
|
||||
@ set_time_limit( 60 );
|
||||
@ set_time_limit( 60 );
|
||||
// Now, the RPC call
|
||||
debug_fwrite($log, "Page Linked To: $pagelinkedto \n");
|
||||
debug_fwrite($log, 'Page Linked From: ');
|
||||
|
||||
+29
-29
@@ -36,13 +36,13 @@ if (!function_exists('ob_clean')) {
|
||||
/* Added in PHP 4.3.0 */
|
||||
|
||||
function printr($var, $do_not_echo = false) {
|
||||
// from php.net/print_r user contributed notes
|
||||
// from php.net/print_r user contributed notes
|
||||
ob_start();
|
||||
print_r($var);
|
||||
$code = htmlentities(ob_get_contents());
|
||||
ob_clean();
|
||||
if (!$do_not_echo) {
|
||||
echo "<pre>$code</pre>";
|
||||
echo "<pre>$code</pre>";
|
||||
}
|
||||
ob_end_clean();
|
||||
return $code;
|
||||
@@ -57,11 +57,11 @@ if ( !function_exists('file_get_contents') ) {
|
||||
}
|
||||
|
||||
if (!defined('CASE_LOWER')) {
|
||||
define('CASE_LOWER', 0);
|
||||
define('CASE_LOWER', 0);
|
||||
}
|
||||
|
||||
if (!defined('CASE_UPPER')) {
|
||||
define('CASE_UPPER', 1);
|
||||
define('CASE_UPPER', 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,38 +78,38 @@ if (!defined('CASE_UPPER')) {
|
||||
* @require PHP 4.0.0 (user_error)
|
||||
*/
|
||||
if (!function_exists('array_change_key_case')) {
|
||||
function array_change_key_case($input, $case = CASE_LOWER)
|
||||
{
|
||||
if (!is_array($input)) {
|
||||
user_error('array_change_key_case(): The argument should be an array',
|
||||
E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
function array_change_key_case($input, $case = CASE_LOWER)
|
||||
{
|
||||
if (!is_array($input)) {
|
||||
user_error('array_change_key_case(): The argument should be an array',
|
||||
E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
$output = array ();
|
||||
$keys = array_keys($input);
|
||||
$casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
|
||||
$output = array ();
|
||||
$keys = array_keys($input);
|
||||
$casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$output[$casefunc($key)] = $input[$key];
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$output[$casefunc($key)] = $input[$key];
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
// From php.net
|
||||
if(!function_exists('http_build_query')) {
|
||||
function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
|
||||
$res = array();
|
||||
foreach ((array)$formdata as $k=>$v) {
|
||||
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
|
||||
if ($key) $tmp_key = $key.'['.$tmp_key.']';
|
||||
$res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) );
|
||||
}
|
||||
$separator = ini_get('arg_separator.output');
|
||||
return implode($separator, $res);
|
||||
}
|
||||
function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
|
||||
$res = array();
|
||||
foreach ((array)$formdata as $k=>$v) {
|
||||
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
|
||||
if ($key) $tmp_key = $key.'['.$tmp_key.']';
|
||||
$res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) );
|
||||
}
|
||||
$separator = ini_get('arg_separator.output');
|
||||
return implode($separator, $res);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !function_exists('_') ) {
|
||||
|
||||
+69
-69
@@ -129,8 +129,8 @@ function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
|
||||
$post_author_data = get_userdata($post->post_author);
|
||||
|
||||
if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
|
||||
|| ($author_data->user_level > $post_author_data->user_level)
|
||||
|| ($author_data->user_level >= 10) ) {
|
||||
|| ($author_data->user_level > $post_author_data->user_level)
|
||||
|| ($author_data->user_level >= 10) ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -199,19 +199,19 @@ function user_can_edit_user($user_id, $other_user) {
|
||||
** show_updated (default 0) - whether to show last updated timestamp
|
||||
*/
|
||||
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
|
||||
$between = " ", $show_images = true, $orderby = 'id',
|
||||
$show_description = true, $show_rating = false,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
$results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_ID;
|
||||
}
|
||||
}
|
||||
get_links($cat_id, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, $show_rating, $limit, $show_updated);
|
||||
$between = " ", $show_images = true, $orderby = 'id',
|
||||
$show_description = true, $show_rating = false,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
$results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_ID;
|
||||
}
|
||||
}
|
||||
get_links($cat_id, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, $show_rating, $limit, $show_updated);
|
||||
}
|
||||
|
||||
/** function wp_get_linksbyname()
|
||||
@@ -252,16 +252,16 @@ function wp_get_linksbyname($category, $args = '') {
|
||||
**/
|
||||
// Deprecate in favor of get_linkz().
|
||||
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
//$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
|
||||
// TODO: Fix me.
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_id;
|
||||
}
|
||||
}
|
||||
return get_linkobjects($cat_id, $orderby, $limit);
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
//$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
|
||||
// TODO: Fix me.
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_id;
|
||||
}
|
||||
}
|
||||
return get_linkobjects($cat_id, $orderby, $limit);
|
||||
}
|
||||
|
||||
/** function get_linkobjects()
|
||||
@@ -301,40 +301,40 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
|
||||
**/
|
||||
// Deprecate in favor of get_linkz().
|
||||
function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
|
||||
global $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
|
||||
if ($category != -1) {
|
||||
$sql .= " AND link_category = $category ";
|
||||
}
|
||||
if ($orderby == '')
|
||||
$orderby = 'id';
|
||||
if (substr($orderby,0,1) == '_') {
|
||||
$direction = ' DESC';
|
||||
$orderby = substr($orderby,1);
|
||||
}
|
||||
if (strcasecmp('rand',$orderby) == 0) {
|
||||
$orderby = 'rand()';
|
||||
} else {
|
||||
$orderby = " link_" . $orderby;
|
||||
}
|
||||
$sql .= ' ORDER BY ' . $orderby;
|
||||
$sql .= $direction;
|
||||
/* The next 2 lines implement LIMIT TO processing */
|
||||
if ($limit != -1)
|
||||
$sql .= " LIMIT $limit";
|
||||
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
|
||||
if ($category != -1) {
|
||||
$sql .= " AND link_category = $category ";
|
||||
}
|
||||
if ($orderby == '')
|
||||
$orderby = 'id';
|
||||
if (substr($orderby,0,1) == '_') {
|
||||
$direction = ' DESC';
|
||||
$orderby = substr($orderby,1);
|
||||
}
|
||||
if (strcasecmp('rand',$orderby) == 0) {
|
||||
$orderby = 'rand()';
|
||||
} else {
|
||||
$orderby = " link_" . $orderby;
|
||||
}
|
||||
$sql .= ' ORDER BY ' . $orderby;
|
||||
$sql .= $direction;
|
||||
/* The next 2 lines implement LIMIT TO processing */
|
||||
if ($limit != -1)
|
||||
$sql .= " LIMIT $limit";
|
||||
|
||||
$results = $wpdb->get_results($sql);
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$result->link_url = $result->link_url;
|
||||
$result->link_name = $result->link_name;
|
||||
$result->link_description = $result->link_description;
|
||||
$result->link_notes = $result->link_notes;
|
||||
$newresults[] = $result;
|
||||
}
|
||||
}
|
||||
return $newresults;
|
||||
$results = $wpdb->get_results($sql);
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$result->link_url = $result->link_url;
|
||||
$result->link_name = $result->link_name;
|
||||
$result->link_description = $result->link_description;
|
||||
$result->link_notes = $result->link_notes;
|
||||
$newresults[] = $result;
|
||||
}
|
||||
}
|
||||
return $newresults;
|
||||
}
|
||||
|
||||
/** function get_linksbyname_withrating()
|
||||
@@ -359,12 +359,12 @@ function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
|
||||
** show_updated (default 0) - whether to show last updated timestamp
|
||||
*/
|
||||
function get_linksbyname_withrating($cat_name = "noname", $before = '',
|
||||
$after = '<br />', $between = " ",
|
||||
$show_images = true, $orderby = 'id',
|
||||
$show_description = true, $limit = -1, $show_updated = 0) {
|
||||
$after = '<br />', $between = " ",
|
||||
$show_images = true, $orderby = 'id',
|
||||
$show_description = true, $limit = -1, $show_updated = 0) {
|
||||
|
||||
get_linksbyname($cat_name, $before, $after, $between, $show_images,
|
||||
$orderby, $show_description, true, $limit, $show_updated);
|
||||
get_linksbyname($cat_name, $before, $after, $between, $show_images,
|
||||
$orderby, $show_description, true, $limit, $show_updated);
|
||||
}
|
||||
|
||||
/** function get_links_withrating()
|
||||
@@ -389,12 +389,12 @@ function get_linksbyname_withrating($cat_name = "noname", $before = '',
|
||||
** show_updated (default 0) - whether to show last updated timestamp
|
||||
*/
|
||||
function get_links_withrating($category = -1, $before = '', $after = '<br />',
|
||||
$between = " ", $show_images = true,
|
||||
$orderby = 'id', $show_description = true,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
$between = " ", $show_images = true,
|
||||
$orderby = 'id', $show_description = true,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
|
||||
get_links($category, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, true, $limit, $show_updated);
|
||||
get_links($category, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, true, $limit, $show_updated);
|
||||
}
|
||||
|
||||
/** function get_get_autotoggle()
|
||||
@@ -403,7 +403,7 @@ function get_links_withrating($category = -1, $before = '', $after = '<br />',
|
||||
** uses 0
|
||||
*/
|
||||
function get_autotoggle($id = 0) {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) {
|
||||
@@ -433,7 +433,7 @@ function wp_list_cats($args = '') {
|
||||
$r['style'] = 'break';
|
||||
$r['title_li'] = '';
|
||||
|
||||
return wp_list_categories($r);
|
||||
return wp_list_categories($r);
|
||||
}
|
||||
|
||||
function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
|
||||
|
||||
+48
-48
@@ -65,18 +65,18 @@ function wpautop($pee, $br = 1) {
|
||||
$pee = $pee . "\n"; // just to make things a little easier, pad the end
|
||||
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
|
||||
// Space things out a little
|
||||
$pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
|
||||
$pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
|
||||
$pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n\n", $pee);
|
||||
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
|
||||
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
|
||||
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
|
||||
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
|
||||
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
|
||||
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
|
||||
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
|
||||
$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
|
||||
$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
|
||||
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);
|
||||
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
|
||||
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
|
||||
if ($br) {
|
||||
$pee = preg_replace('/<(script|style).*?<\/\\1>/se', 'str_replace("\n", "<WPPreserveNewline />", "\\0")', $pee);
|
||||
$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
|
||||
@@ -86,7 +86,7 @@ function wpautop($pee, $br = 1) {
|
||||
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
|
||||
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
|
||||
|
||||
return $pee;
|
||||
return $pee;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,35 +126,35 @@ function wp_specialchars( $text, $quotes = 0 ) {
|
||||
}
|
||||
|
||||
function utf8_uri_encode( $utf8_string ) {
|
||||
$unicode = '';
|
||||
$values = array();
|
||||
$num_octets = 1;
|
||||
|
||||
for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
|
||||
$unicode = '';
|
||||
$values = array();
|
||||
$num_octets = 1;
|
||||
|
||||
$value = ord( $utf8_string[ $i ] );
|
||||
|
||||
if ( $value < 128 ) {
|
||||
$unicode .= chr($value);
|
||||
} else {
|
||||
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
|
||||
|
||||
$values[] = $value;
|
||||
|
||||
if ( count( $values ) == $num_octets ) {
|
||||
for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
|
||||
|
||||
$value = ord( $utf8_string[ $i ] );
|
||||
|
||||
if ( $value < 128 ) {
|
||||
$unicode .= chr($value);
|
||||
} else {
|
||||
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
|
||||
|
||||
$values[] = $value;
|
||||
|
||||
if ( count( $values ) == $num_octets ) {
|
||||
if ($num_octets == 3) {
|
||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
|
||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
|
||||
} else {
|
||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
|
||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
|
||||
}
|
||||
|
||||
$values = array();
|
||||
$num_octets = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $unicode;
|
||||
return $unicode;
|
||||
}
|
||||
|
||||
function remove_accents($string) {
|
||||
@@ -339,7 +339,7 @@ function sanitize_title_with_dashes($title) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
function convert_chars($content, $flag = 'obsolete') {
|
||||
function convert_chars($content, $flag = 'obsolete') {
|
||||
// Translation of invalid Unicode references range to valid range
|
||||
$wp_htmltranswinuni = array(
|
||||
'€' => '€', // the Euro sign
|
||||
@@ -405,22 +405,22 @@ function funky_javascript_fix($text) {
|
||||
|
||||
/*
|
||||
balanceTags
|
||||
|
||||
|
||||
Balances Tags of string using a modified stack.
|
||||
|
||||
|
||||
@param text Text to be balanced
|
||||
@return Returns balanced text
|
||||
@author Leonard Lin (leonard@acm.org)
|
||||
@version v1.1
|
||||
@date November 4, 2001
|
||||
@license GPL v2.0
|
||||
@notes
|
||||
@changelog
|
||||
@notes
|
||||
@changelog
|
||||
--- Modified by Scott Reilly (coffee2code) 02 Aug 2004
|
||||
1.2 ***TODO*** Make better - change loop condition to $text
|
||||
1.1 Fixed handling of append/stack pop order of end text
|
||||
Added Cleaning Hooks
|
||||
1.0 First Version
|
||||
1.2 ***TODO*** Make better - change loop condition to $text
|
||||
1.1 Fixed handling of append/stack pop order of end text
|
||||
Added Cleaning Hooks
|
||||
1.0 First Version
|
||||
*/
|
||||
function balanceTags($text, $is_comment = 0, $force = false) {
|
||||
|
||||
@@ -446,7 +446,7 @@ function balanceTags($text, $is_comment = 0, $force = false) {
|
||||
if ($regex[1][0] == "/") { // End Tag
|
||||
$tag = strtolower(substr($regex[1],1));
|
||||
// if too many closing tags
|
||||
if($stacksize <= 0) {
|
||||
if($stacksize <= 0) {
|
||||
$tag = '';
|
||||
//or close to be safe $tag = '/' . $tag;
|
||||
}
|
||||
@@ -503,7 +503,7 @@ function balanceTags($text, $is_comment = 0, $force = false) {
|
||||
}
|
||||
$newtext .= substr($text,0,$i) . $tag;
|
||||
$text = substr($text,$i+$l);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear Tag Queue
|
||||
$newtext .= $tagqueue;
|
||||
@@ -552,10 +552,10 @@ function backslashit($string) {
|
||||
}
|
||||
|
||||
function trailingslashit($string) {
|
||||
if ( '/' != substr($string, -1)) {
|
||||
$string .= '/';
|
||||
}
|
||||
return $string;
|
||||
if ( '/' != substr($string, -1)) {
|
||||
$string .= '/';
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function addslashes_gpc($gpc) {
|
||||
@@ -571,11 +571,11 @@ function addslashes_gpc($gpc) {
|
||||
|
||||
function stripslashes_deep($value)
|
||||
{
|
||||
$value = is_array($value) ?
|
||||
array_map('stripslashes_deep', $value) :
|
||||
stripslashes($value);
|
||||
$value = is_array($value) ?
|
||||
array_map('stripslashes_deep', $value) :
|
||||
stripslashes($value);
|
||||
|
||||
return $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
function antispambot($emailaddy, $mailto=0) {
|
||||
@@ -731,7 +731,7 @@ function sanitize_email($email) {
|
||||
return preg_replace('/[^a-z0-9+_.@-]/i', '', $email);
|
||||
}
|
||||
|
||||
function human_time_diff( $from, $to = '' ) {
|
||||
function human_time_diff( $from, $to = '' ) {
|
||||
if ( empty($to) )
|
||||
$to = time();
|
||||
$diff = (int) abs($to - $from);
|
||||
@@ -745,7 +745,7 @@ function human_time_diff( $from, $to = '' ) {
|
||||
$hours = round($diff / 3600);
|
||||
if ($hours <= 1)
|
||||
$since = __('1 hour');
|
||||
else
|
||||
else
|
||||
$since = sprintf( __('%s hours'), $hours );
|
||||
} elseif ($diff >= 86400) {
|
||||
$days = round($diff / 86400);
|
||||
|
||||
@@ -12,7 +12,7 @@ function mysql2date($dateformatstring, $mysqlstring, $translate = true) {
|
||||
|
||||
if( 'U' == $dateformatstring )
|
||||
return $i;
|
||||
|
||||
|
||||
if ( -1 == $i || false == $i )
|
||||
$i = 0;
|
||||
|
||||
@@ -462,7 +462,7 @@ function wp_get_http_headers( $url, $red = 1 ) {
|
||||
@set_time_limit( 60 );
|
||||
|
||||
if ( $red > 5 )
|
||||
return false;
|
||||
return false;
|
||||
|
||||
$parts = parse_url( $url );
|
||||
$file = $parts['path'] . ($parts['query'] ? '?'.$parts['query'] : '');
|
||||
@@ -491,9 +491,9 @@ function wp_get_http_headers( $url, $red = 1 ) {
|
||||
preg_match('/.*([0-9]{3}).*/', $response, $return);
|
||||
$headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
|
||||
|
||||
$code = $headers['response'];
|
||||
if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
|
||||
return wp_get_http_headers( $headers['location'], ++$red );
|
||||
$code = $headers['response'];
|
||||
if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
|
||||
return wp_get_http_headers( $headers['location'], ++$red );
|
||||
|
||||
return $headers;
|
||||
}
|
||||
@@ -801,8 +801,8 @@ function get_num_queries() {
|
||||
}
|
||||
|
||||
function bool_from_yn($yn) {
|
||||
if ($yn == 'Y') return 1;
|
||||
return 0;
|
||||
if ($yn == 'Y') return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function do_feed() {
|
||||
@@ -957,7 +957,7 @@ function wp_upload_dir() {
|
||||
return array('error' => $message);
|
||||
}
|
||||
|
||||
$uploads = array('path' => $dir, 'url' => $url, 'error' => false);
|
||||
$uploads = array('path' => $dir, 'url' => $url, 'error' => false);
|
||||
return apply_filters('upload_dir', $uploads);
|
||||
}
|
||||
|
||||
|
||||
@@ -471,7 +471,7 @@ function get_calendar($initial = true) {
|
||||
FROM $wpdb->posts
|
||||
WHERE post_date > '$thisyear-$thismonth-01'
|
||||
AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
|
||||
AND post_type = 'post' AND post_status = 'publish'
|
||||
AND post_type = 'post' AND post_status = 'publish'
|
||||
ORDER BY post_date ASC
|
||||
LIMIT 1");
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ function get_locale() {
|
||||
return $locale;
|
||||
}
|
||||
|
||||
// Return a translated string.
|
||||
// Return a translated string.
|
||||
function __($text, $domain = 'default') {
|
||||
global $l10n;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ function get_permalink($id = 0) {
|
||||
$authordata = get_userdata($post->post_author);
|
||||
$author = $authordata->user_nicename;
|
||||
$date = explode(" ",date('Y m d H i s', $unixtime));
|
||||
$rewritereplace =
|
||||
$rewritereplace =
|
||||
array(
|
||||
$date[0],
|
||||
$date[1],
|
||||
@@ -282,7 +282,7 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') {
|
||||
for ( $i = 1; $i < (count($cat_array)); $i++ ) {
|
||||
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
|
||||
}
|
||||
$join .= ')';
|
||||
$join .= ')';
|
||||
}
|
||||
|
||||
$sql_exclude_cats = '';
|
||||
@@ -315,7 +315,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
|
||||
for ( $i = 1; $i < (count($cat_array)); $i++ ) {
|
||||
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
|
||||
}
|
||||
$join .= ')';
|
||||
$join .= ')';
|
||||
}
|
||||
|
||||
$sql_exclude_cats = '';
|
||||
@@ -350,7 +350,7 @@ function previous_post_link($format='« %link', $link='%title', $in_same_ca
|
||||
|
||||
$format = str_replace('%link', $link, $format);
|
||||
|
||||
echo $format;
|
||||
echo $format;
|
||||
}
|
||||
|
||||
function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') {
|
||||
@@ -365,7 +365,7 @@ function next_post_link($format='%link »', $link='%title', $in_same_cat =
|
||||
$link = $string . $link . '</a>';
|
||||
$format = str_replace('%link', $link, $format);
|
||||
|
||||
echo $format;
|
||||
echo $format;
|
||||
}
|
||||
|
||||
function get_pagenum_link($pagenum = 1) {
|
||||
@@ -373,7 +373,7 @@ function get_pagenum_link($pagenum = 1) {
|
||||
|
||||
$qstr = wp_specialchars($_SERVER['REQUEST_URI']);
|
||||
|
||||
$page_querystring = "paged";
|
||||
$page_querystring = "paged";
|
||||
$page_modstring = "page/";
|
||||
$page_modregex = "page/?";
|
||||
$permalink = 0;
|
||||
@@ -492,7 +492,7 @@ function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nx
|
||||
if ( !is_singular() ) {
|
||||
$max_num_pages = $wp_query->max_num_pages;
|
||||
$paged = get_query_var('paged');
|
||||
|
||||
|
||||
//only have sep if there's both prev and next results
|
||||
if ($paged < 2 || $paged >= $max_num_pages) {
|
||||
$sep = '';
|
||||
|
||||
@@ -46,7 +46,7 @@ function get_currentuserinfo() {
|
||||
if ( ! empty($current_user) )
|
||||
return;
|
||||
|
||||
if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) ||
|
||||
if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) ||
|
||||
!wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) {
|
||||
wp_set_current_user(0);
|
||||
return false;
|
||||
@@ -212,7 +212,7 @@ endif;
|
||||
if ( !function_exists('auth_redirect') ) :
|
||||
function auth_redirect() {
|
||||
// Checks if a user is logged in, if not redirects them to the login page
|
||||
if ( (!empty($_COOKIE[USER_COOKIE]) &&
|
||||
if ( (!empty($_COOKIE[USER_COOKIE]) &&
|
||||
!wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) ||
|
||||
(empty($_COOKIE[USER_COOKIE])) ) {
|
||||
nocache_headers();
|
||||
@@ -331,7 +331,7 @@ endif;
|
||||
if ( ! function_exists('wp_notify_postauthor') ) :
|
||||
function wp_notify_postauthor($comment_id, $comment_type='') {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
$comment = get_comment($comment_id);
|
||||
$post = get_post($comment->comment_post_ID);
|
||||
$user = get_userdata( $post->post_author );
|
||||
@@ -378,11 +378,11 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
|
||||
$from = "From: \"$blogname\" <$wp_email>";
|
||||
if ( '' != $comment->comment_author_email )
|
||||
$reply_to = "Reply-To: $comment->comment_author_email";
|
||||
} else {
|
||||
} else {
|
||||
$from = "From: \"$comment->comment_author\" <$wp_email>";
|
||||
if ( '' != $comment->comment_author_email )
|
||||
$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
|
||||
}
|
||||
}
|
||||
|
||||
$message_headers = "MIME-Version: 1.0\n"
|
||||
. "$from\n"
|
||||
@@ -439,7 +439,7 @@ function wp_notify_moderator($comment_id) {
|
||||
$subject = apply_filters('comment_moderation_subject', $subject, $comment_id);
|
||||
|
||||
@wp_mail($admin_email, $subject, $notify_message);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
endif;
|
||||
@@ -489,7 +489,7 @@ function wp_create_nonce($action = -1) {
|
||||
$uid = $user->id;
|
||||
|
||||
$i = ceil(time() / 43200);
|
||||
|
||||
|
||||
return substr(wp_hash($i . $action . $uid), -12, 10);
|
||||
}
|
||||
endif;
|
||||
|
||||
+39
-39
@@ -166,8 +166,8 @@ function get_posts($args) {
|
||||
$inclusions = '';
|
||||
if ( !empty($include) ) {
|
||||
$offset = 0; //ignore offset, category, exclude, meta_key, and meta_value params if using include
|
||||
$category = '';
|
||||
$exclude = '';
|
||||
$category = '';
|
||||
$exclude = '';
|
||||
$meta_key = '';
|
||||
$meta_value = '';
|
||||
$incposts = preg_split('/[\s,]+/',$include);
|
||||
@@ -181,8 +181,8 @@ function get_posts($args) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
|
||||
$exclusions = '';
|
||||
if ( !empty($exclude) ) {
|
||||
@@ -196,12 +196,12 @@ function get_posts($args) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($exclusions))
|
||||
if (!empty($exclusions))
|
||||
$exclusions .= ')';
|
||||
|
||||
$query ="SELECT DISTINCT * FROM $wpdb->posts " ;
|
||||
$query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ;
|
||||
$query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;
|
||||
$query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ;
|
||||
$query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;
|
||||
$query .= " WHERE (post_type = 'post' AND post_status = 'publish') $exclusions $inclusions " ;
|
||||
$query .= ( empty( $category ) ? "" : "AND ($wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $category. ") " ) ;
|
||||
$query .= ( empty( $meta_key ) | empty($meta_value) ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ;
|
||||
@@ -400,9 +400,9 @@ function wp_get_post_categories($post_ID = 0) {
|
||||
|
||||
$post_ID = (int) $post_ID;
|
||||
|
||||
$sql = "SELECT category_id
|
||||
FROM $wpdb->post2cat
|
||||
WHERE post_id = '$post_ID'
|
||||
$sql = "SELECT category_id
|
||||
FROM $wpdb->post2cat
|
||||
WHERE post_id = '$post_ID'
|
||||
ORDER BY category_id";
|
||||
|
||||
$result = $wpdb->get_col($sql);
|
||||
@@ -435,7 +435,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
|
||||
// Set categories
|
||||
if($mode == OBJECT) {
|
||||
$post->post_category = wp_get_post_categories($postid);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$post['post_category'] = wp_get_post_categories($postid);
|
||||
}
|
||||
@@ -635,13 +635,13 @@ function wp_insert_post($postarr = array()) {
|
||||
if ( !defined('WP_IMPORTING') ) {
|
||||
if ( $post_pingback )
|
||||
$result = $wpdb->query("
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value)
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value)
|
||||
VALUES ('$post_ID','_pingme','1')
|
||||
");
|
||||
$result = $wpdb->query("
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value)
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value)
|
||||
VALUES ('$post_ID','_encloseme','1')
|
||||
");
|
||||
wp_schedule_single_event(time(), 'do_pings');
|
||||
@@ -653,7 +653,7 @@ function wp_insert_post($postarr = array()) {
|
||||
if ( !empty($page_template) )
|
||||
if ( ! update_post_meta($post_ID, '_wp_page_template', $page_template))
|
||||
add_post_meta($post_ID, '_wp_page_template', $page_template, true);
|
||||
|
||||
|
||||
if ( $post_status == 'publish' )
|
||||
do_action('publish_page', $post_ID);
|
||||
}
|
||||
@@ -684,22 +684,22 @@ function wp_update_post($postarr = array()) {
|
||||
$post = add_magic_quotes($post);
|
||||
|
||||
// Passed post category list overwrites existing category list if not empty.
|
||||
if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
|
||||
if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
|
||||
&& 0 != count($postarr['post_category']) )
|
||||
$post_cats = $postarr['post_category'];
|
||||
else
|
||||
$post_cats = $post['post_category'];
|
||||
$post_cats = $postarr['post_category'];
|
||||
else
|
||||
$post_cats = $post['post_category'];
|
||||
|
||||
// Drafts shouldn't be assigned a date unless explicitly done so by the user
|
||||
if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
|
||||
('0000-00-00 00:00:00' == $post['post_date']) )
|
||||
if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
|
||||
('0000-00-00 00:00:00' == $post['post_date']) )
|
||||
$clear_date = true;
|
||||
else
|
||||
$clear_date = false;
|
||||
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$postarr = array_merge($post, $postarr);
|
||||
$postarr['post_category'] = $post_cats;
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$postarr = array_merge($post, $postarr);
|
||||
$postarr['post_category'] = $post_cats;
|
||||
if ( $clear_date ) {
|
||||
$postarr['post_date'] = '';
|
||||
$postarr['post_date_gmt'] = '';
|
||||
@@ -733,8 +733,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
|
||||
// First the old categories
|
||||
$old_categories = $wpdb->get_col("
|
||||
SELECT category_id
|
||||
FROM $wpdb->post2cat
|
||||
SELECT category_id
|
||||
FROM $wpdb->post2cat
|
||||
WHERE post_id = $post_ID");
|
||||
|
||||
if (!$old_categories) {
|
||||
@@ -749,9 +749,9 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
if ($delete_cats) {
|
||||
foreach ($delete_cats as $del) {
|
||||
$wpdb->query("
|
||||
DELETE FROM $wpdb->post2cat
|
||||
WHERE category_id = $del
|
||||
AND post_id = $post_ID
|
||||
DELETE FROM $wpdb->post2cat
|
||||
WHERE category_id = $del
|
||||
AND post_id = $post_ID
|
||||
");
|
||||
}
|
||||
}
|
||||
@@ -848,10 +848,10 @@ function trackback_url_list($tb_list, $post_id) {
|
||||
|
||||
$trackback_urls = explode(',', $tb_list);
|
||||
foreach($trackback_urls as $tb_url) {
|
||||
$tb_url = trim($tb_url);
|
||||
trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
|
||||
$tb_url = trim($tb_url);
|
||||
trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -928,7 +928,7 @@ function get_page_by_path($page_path, $output = OBJECT) {
|
||||
|
||||
$pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = '$leaf_path' AND post_type='page'");
|
||||
|
||||
if ( empty($pages) )
|
||||
if ( empty($pages) )
|
||||
return NULL;
|
||||
|
||||
foreach ($pages as $page) {
|
||||
@@ -1018,8 +1018,8 @@ function &get_pages($args = '') {
|
||||
|
||||
$inclusions = '';
|
||||
if ( !empty($include) ) {
|
||||
$child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
|
||||
$exclude = '';
|
||||
$child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
|
||||
$exclude = '';
|
||||
$meta_key = '';
|
||||
$meta_value = '';
|
||||
$incpages = preg_split('/[\s,]+/',$include);
|
||||
@@ -1032,8 +1032,8 @@ function &get_pages($args = '') {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
|
||||
$exclusions = '';
|
||||
if ( !empty($exclude) ) {
|
||||
@@ -1196,7 +1196,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
|
||||
|
||||
if (empty($post_date))
|
||||
$post_date = current_time('mysql');
|
||||
if (empty($post_date_gmt))
|
||||
if (empty($post_date_gmt))
|
||||
$post_date_gmt = current_time('mysql', 1);
|
||||
|
||||
if ( empty($comment_status) ) {
|
||||
|
||||
+11
-11
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* The Big Query.
|
||||
*/
|
||||
|
||||
|
||||
function get_query_var($var) {
|
||||
global $wp_query;
|
||||
|
||||
@@ -224,7 +224,7 @@ function is_404 () {
|
||||
/*
|
||||
* The Loop. Post loop control.
|
||||
*/
|
||||
|
||||
|
||||
function have_posts() {
|
||||
global $wp_query;
|
||||
|
||||
@@ -416,8 +416,8 @@ class WP_Query {
|
||||
} elseif ( $qv['p'] ) {
|
||||
$this->is_single = true;
|
||||
} elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
|
||||
// If year, month, day, hour, minute, and second are set, a single
|
||||
// post is being queried.
|
||||
// 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'] || (int) $qv['page_id']) {
|
||||
$this->is_page = true;
|
||||
@@ -493,7 +493,7 @@ class WP_Query {
|
||||
if ('' != $qv['category_name']) {
|
||||
$this->is_category = true;
|
||||
}
|
||||
|
||||
|
||||
if ((empty($qv['author'])) || ($qv['author'] == '0')) {
|
||||
$this->is_author = false;
|
||||
} else {
|
||||
@@ -771,7 +771,7 @@ class WP_Query {
|
||||
|
||||
// Category stuff
|
||||
|
||||
if ((empty($q['cat'])) || ($q['cat'] == '0') ||
|
||||
if ((empty($q['cat'])) || ($q['cat'] == '0') ||
|
||||
// Bypass cat checks if fetching specific posts
|
||||
( $this->is_single || $this->is_page )) {
|
||||
$whichcat='';
|
||||
@@ -788,7 +788,7 @@ class WP_Query {
|
||||
if ( $in )
|
||||
$in_cats .= "$cat, " . get_category_children($cat, '', ', ');
|
||||
else
|
||||
$out_cats .= "$cat, " . get_category_children($cat, '', ', ');
|
||||
$out_cats .= "$cat, " . get_category_children($cat, '', ', ');
|
||||
}
|
||||
$in_cats = substr($in_cats, 0, -2);
|
||||
$out_cats = substr($out_cats, 0, -2);
|
||||
@@ -831,7 +831,7 @@ class WP_Query {
|
||||
$reqcat = 0;
|
||||
|
||||
$q['cat'] = $reqcat;
|
||||
|
||||
|
||||
$tables = ", $wpdb->post2cat, $wpdb->categories";
|
||||
$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
|
||||
$whichcat = " AND category_id IN ({$q['cat']}, ";
|
||||
@@ -922,7 +922,7 @@ class WP_Query {
|
||||
|
||||
if ( is_admin() )
|
||||
$where .= " OR post_status = 'future' OR post_status = 'draft'";
|
||||
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
if ( 'post' == $post_type )
|
||||
$cap = 'edit_private_posts';
|
||||
@@ -1024,7 +1024,7 @@ class WP_Query {
|
||||
}
|
||||
|
||||
function next_post() {
|
||||
|
||||
|
||||
$this->current_post++;
|
||||
|
||||
$this->post = $this->posts[$this->current_post];
|
||||
@@ -1060,7 +1060,7 @@ class WP_Query {
|
||||
$this->post = $this->posts[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function &query($query) {
|
||||
$this->parse_query($query);
|
||||
return $this->get_posts();
|
||||
|
||||
@@ -85,9 +85,9 @@ function wp_insert_user($userdata) {
|
||||
$wpdb->query( $query );
|
||||
$user_id = $ID;
|
||||
} else {
|
||||
$query = "INSERT INTO $wpdb->users
|
||||
$query = "INSERT INTO $wpdb->users
|
||||
(user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name)
|
||||
VALUES
|
||||
VALUES
|
||||
('$user_login', '$user_pass', '$user_email', '$user_url', '$user_registered', '$user_nicename', '$display_name')";
|
||||
$query = apply_filters('create_user_query', $query);
|
||||
$wpdb->query( $query );
|
||||
|
||||
+36
-36
@@ -16,15 +16,15 @@ function add_rewrite_tag($tagname, $regex) {
|
||||
if (strlen($tagname) < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$qv = trim($tagname, '%');
|
||||
|
||||
|
||||
global $wp_rewrite, $wp;
|
||||
$wp->add_query_var($qv);
|
||||
$wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
|
||||
}
|
||||
|
||||
//Add a new feed type like /atom1/
|
||||
//Add a new feed type like /atom1/
|
||||
function add_feed($feedname, $function) {
|
||||
global $wp_rewrite;
|
||||
if (!in_array($feedname, $wp_rewrite->feeds)) { //override the file if it is
|
||||
@@ -169,7 +169,7 @@ class WP_Rewrite {
|
||||
var $non_wp_rules; //rules that don't redirect to WP's index.php
|
||||
var $endpoints;
|
||||
var $use_verbose_rules = false;
|
||||
var $rewritecode =
|
||||
var $rewritecode =
|
||||
array(
|
||||
'%year%',
|
||||
'%monthnum%',
|
||||
@@ -185,7 +185,7 @@ class WP_Rewrite {
|
||||
'%search%'
|
||||
);
|
||||
|
||||
var $rewritereplace =
|
||||
var $rewritereplace =
|
||||
array(
|
||||
'([0-9]{4})',
|
||||
'([0-9]{1,2})',
|
||||
@@ -201,7 +201,7 @@ class WP_Rewrite {
|
||||
'(.+)'
|
||||
);
|
||||
|
||||
var $queryreplace =
|
||||
var $queryreplace =
|
||||
array (
|
||||
'year=',
|
||||
'monthnum=',
|
||||
@@ -218,7 +218,7 @@ class WP_Rewrite {
|
||||
);
|
||||
|
||||
var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
|
||||
|
||||
|
||||
function using_permalinks() {
|
||||
if (empty($this->permalink_structure))
|
||||
return false;
|
||||
@@ -235,7 +235,7 @@ class WP_Rewrite {
|
||||
if (preg_match('#^/*' . $this->index . '#', $this->permalink_structure)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -251,11 +251,11 @@ class WP_Rewrite {
|
||||
$match_suffix = '';
|
||||
|
||||
if (! empty($this->matches)) {
|
||||
$match_prefix = '$' . $this->matches . '[';
|
||||
$match_prefix = '$' . $this->matches . '[';
|
||||
$match_suffix = ']';
|
||||
}
|
||||
}
|
||||
|
||||
return "$match_prefix$number$match_suffix";
|
||||
return "$match_prefix$number$match_suffix";
|
||||
}
|
||||
|
||||
function page_rewrite_rules() {
|
||||
@@ -301,13 +301,13 @@ class WP_Rewrite {
|
||||
$date_endian= $endian;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty($date_endian) )
|
||||
$date_endian = '%year%/%monthnum%/%day%';
|
||||
|
||||
// Do not allow the date tags and %post_id% to overlap in the permalink
|
||||
// structure. If they do, move the date tags to $front/date/.
|
||||
// structure. If they do, move the date tags to $front/date/.
|
||||
$front = $this->front;
|
||||
preg_match_all('/%.+?%/', $this->permalink_structure, $tokens);
|
||||
$tok_index = 1;
|
||||
@@ -482,11 +482,11 @@ class WP_Rewrite {
|
||||
//build a regex to match the trackback and page/xx parts of URLs
|
||||
$trackbackregex = 'trackback/?$';
|
||||
$pageregex = 'page/?([0-9]{1,})/?$';
|
||||
|
||||
|
||||
//build up an array of endpoint regexes to append => queries to append
|
||||
if ($endpoints) {
|
||||
$ep_query_append = array ();
|
||||
foreach ($this->endpoints as $endpoint) {
|
||||
foreach ($this->endpoints as $endpoint) {
|
||||
//match everything after the endpoint name, but allow for nothing to appear there
|
||||
$epmatch = $endpoint[1] . '(/(.*))?/?$';
|
||||
//this will be appended on to the rest of the query for each dir
|
||||
@@ -511,7 +511,7 @@ class WP_Rewrite {
|
||||
if (0 < $i) {
|
||||
$queries[$i] = $queries[$i - 1] . '&';
|
||||
}
|
||||
|
||||
|
||||
$query_token = str_replace($this->rewritecode, $this->queryreplace, $tokens[0][$i]) . $this->preg_index($i+1);
|
||||
$queries[$i] .= $query_token;
|
||||
}
|
||||
@@ -548,7 +548,7 @@ class WP_Rewrite {
|
||||
$num_toks = preg_match_all('/%.+?%/', $struct, $toks);
|
||||
//get the 'tagname=$matches[i]'
|
||||
$query = $queries[$num_toks - 1];
|
||||
|
||||
|
||||
//set up $ep_mask_specific which is used to match more specific URL types
|
||||
switch ($dirs[$j]) {
|
||||
case '%year%': $ep_mask_specific = EP_YEAR; break;
|
||||
@@ -580,15 +580,15 @@ class WP_Rewrite {
|
||||
$rewrite = array($feedmatch => $feedquery, $feedmatch2 => $feedquery2);
|
||||
if ($paged) //...and /page/xx ones
|
||||
$rewrite = array_merge($rewrite, array($pagematch => $pagequery));
|
||||
|
||||
|
||||
//if we've got some tags in this dir
|
||||
if ($num_toks) {
|
||||
$post = false;
|
||||
$page = false;
|
||||
|
||||
//check to see if this dir is permalink-level: i.e. the structure specifies an
|
||||
|
||||
//check to see if this dir is permalink-level: i.e. the structure specifies an
|
||||
//individual post. Do this by checking it contains at least one of 1) post name,
|
||||
//2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
|
||||
//2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
|
||||
//minute all present). Set these flags now as we need them for the endpoints.
|
||||
if (strstr($struct, '%postname%') || strstr($struct, '%post_id%')
|
||||
|| strstr($struct, '%pagename%')
|
||||
@@ -597,7 +597,7 @@ class WP_Rewrite {
|
||||
if ( strstr($struct, '%pagename%') )
|
||||
$page = true;
|
||||
}
|
||||
|
||||
|
||||
//do endpoints
|
||||
if ($endpoints) {
|
||||
foreach ($ep_query_append as $regex => $ep) {
|
||||
@@ -607,7 +607,7 @@ class WP_Rewrite {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if we're creating rules for a permalink, do all the endpoints like attachments etc
|
||||
if ($post) {
|
||||
$post = true;
|
||||
@@ -618,7 +618,7 @@ class WP_Rewrite {
|
||||
$match = rtrim($match, '/');
|
||||
//get rid of brackets
|
||||
$submatchbase = str_replace(array('(',')'),'',$match);
|
||||
|
||||
|
||||
//add a rule for at attachments, which take the form of <permalink>/some-text
|
||||
$sub1 = $submatchbase . '/([^/]+)/';
|
||||
$sub1tb = $sub1 . $trackbackregex; //add trackback regex <permalink>/trackback/...
|
||||
@@ -626,19 +626,19 @@ class WP_Rewrite {
|
||||
$sub1feed2 = $sub1 . $feedregex2; //and <permalink>/(feed|atom...)
|
||||
//add an ? as we don't have to match that last slash, and finally a $ so we
|
||||
//match to the end of the URL
|
||||
|
||||
|
||||
//add another rule to match attachments in the explicit form:
|
||||
//<permalink>/attachment/some-text
|
||||
$sub2 = $submatchbase . '/attachment/([^/]+)/';
|
||||
$sub2tb = $sub2 . $trackbackregex; //and add trackbacks <permalink>/attachment/trackback
|
||||
$sub2feed = $sub2 . $feedregex; //feeds, <permalink>/attachment/feed/(atom|...)
|
||||
$sub2feed2 = $sub2 . $feedregex2; //and feeds again on to this <permalink>/attachment/(feed|atom...)
|
||||
|
||||
|
||||
//create queries for these extra tag-ons we've just dealt with
|
||||
$subquery = $index . '?attachment=' . $this->preg_index(1);
|
||||
$subtbquery = $subquery . '&tb=1';
|
||||
$subfeedquery = $subquery . '&feed=' . $this->preg_index(2);
|
||||
|
||||
|
||||
//do endpoints for attachments
|
||||
if ($endpoint) { foreach ($ep_query_append as $regex => $ep) {
|
||||
if ($ep[0] & EP_ATTACHMENT) {
|
||||
@@ -646,11 +646,11 @@ class WP_Rewrite {
|
||||
$rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
|
||||
}
|
||||
} }
|
||||
|
||||
|
||||
//now we've finished with endpoints, finish off the $sub1 and $sub2 matches
|
||||
$sub1 .= '?$';
|
||||
$sub2 .= '?$';
|
||||
|
||||
|
||||
//allow URLs like <permalink>/2 for <permalink>/page/2
|
||||
$match = $match . '(/[0-9]+)?/?$';
|
||||
$query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1);
|
||||
@@ -659,7 +659,7 @@ class WP_Rewrite {
|
||||
$match .= '?$';
|
||||
$query = $index . '?' . $query;
|
||||
}
|
||||
|
||||
|
||||
//create the final array for this dir by joining the $rewrite array (which currently
|
||||
//only contains rules/queries for trackback, pages etc) to the main regex/query for
|
||||
//this dir
|
||||
@@ -669,7 +669,7 @@ class WP_Rewrite {
|
||||
if ($post) {
|
||||
//add trackback
|
||||
$rewrite = array_merge(array($trackbackmatch => $trackbackquery), $rewrite);
|
||||
|
||||
|
||||
//add regexes/queries for attachments, attachment trackbacks and so on
|
||||
if ( ! $page ) //require <permalink>/attachment/stuff form for pages because of confusion with subpages
|
||||
$rewrite = array_merge($rewrite, array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery));
|
||||
@@ -763,11 +763,11 @@ class WP_Rewrite {
|
||||
|
||||
$home_root = parse_url(get_option('home'));
|
||||
$home_root = trailingslashit($home_root['path']);
|
||||
|
||||
|
||||
$rules = "<IfModule mod_rewrite.c>\n";
|
||||
$rules .= "RewriteEngine On\n";
|
||||
$rules .= "RewriteBase $home_root\n";
|
||||
|
||||
|
||||
//add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)
|
||||
foreach ($this->non_wp_rules as $match => $query) {
|
||||
// Apache 1.3 does not support the reluctant (non-greedy) modifier.
|
||||
@@ -819,7 +819,7 @@ class WP_Rewrite {
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
||||
//Add a straight rewrite rule
|
||||
function add_rule($regex, $redirect) {
|
||||
//get everything up to the first ?
|
||||
@@ -831,12 +831,12 @@ class WP_Rewrite {
|
||||
$this->extra_rules[$regex] = $redirect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//add a rule that doesn't redirect to index.php
|
||||
function add_external_rule($regex, $redirect) {
|
||||
$this->non_wp_rules[$regex] = $redirect;
|
||||
}
|
||||
|
||||
|
||||
//add an endpoint, like /trackback/, to be inserted after certain URL types (specified in $places)
|
||||
function add_endpoint($name, $places) {
|
||||
global $wp;
|
||||
|
||||
+44
-44
@@ -11,7 +11,7 @@ define('RSS', 'RSS');
|
||||
define('ATOM', 'Atom');
|
||||
define('MAGPIE_USER_AGENT', 'WordPress/' . $wp_version);
|
||||
|
||||
class MagpieRSS {
|
||||
class MagpieRSS {
|
||||
var $parser;
|
||||
var $current_item = array(); // item currently being parsed
|
||||
var $items = array(); // collection of parsed items
|
||||
@@ -25,7 +25,7 @@ class MagpieRSS {
|
||||
var $stack = array(); // parser stack
|
||||
var $inchannel = false;
|
||||
var $initem = false;
|
||||
var $incontent = false; // if in Atom <content mode="xml"> field
|
||||
var $incontent = false; // if in Atom <content mode="xml"> field
|
||||
var $intextinput = false;
|
||||
var $inimage = false;
|
||||
var $current_field = '';
|
||||
@@ -54,10 +54,10 @@ class MagpieRSS {
|
||||
# setup handlers
|
||||
#
|
||||
xml_set_object( $this->parser, $this );
|
||||
xml_set_element_handler($this->parser,
|
||||
xml_set_element_handler($this->parser,
|
||||
'feed_start_element', 'feed_end_element' );
|
||||
|
||||
xml_set_character_data_handler( $this->parser, 'feed_cdata' );
|
||||
xml_set_character_data_handler( $this->parser, 'feed_cdata' );
|
||||
|
||||
$status = xml_parse( $this->parser, $source );
|
||||
|
||||
@@ -85,7 +85,7 @@ class MagpieRSS {
|
||||
// check for a namespace, and split if found
|
||||
$ns = false;
|
||||
if ( strpos( $element, ':' ) ) {
|
||||
list($ns, $el) = split( ':', $element, 2);
|
||||
list($ns, $el) = split( ':', $element, 2);
|
||||
}
|
||||
if ( $ns and $ns != 'rdf' ) {
|
||||
$this->current_namespace = $ns;
|
||||
@@ -111,11 +111,11 @@ class MagpieRSS {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $el == 'channel' )
|
||||
if ( $el == 'channel' )
|
||||
{
|
||||
$this->inchannel = true;
|
||||
}
|
||||
elseif ($el == 'item' or $el == 'entry' )
|
||||
elseif ($el == 'item' or $el == 'entry' )
|
||||
{
|
||||
$this->initem = true;
|
||||
if ( isset($attrs['rdf:about']) ) {
|
||||
@@ -125,18 +125,18 @@ class MagpieRSS {
|
||||
|
||||
// if we're in the default namespace of an RSS feed,
|
||||
// record textinput or image fields
|
||||
elseif (
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'textinput' )
|
||||
elseif (
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'textinput' )
|
||||
{
|
||||
$this->intextinput = true;
|
||||
}
|
||||
|
||||
elseif (
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'image' )
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'image' )
|
||||
{
|
||||
$this->inimage = true;
|
||||
}
|
||||
@@ -155,12 +155,12 @@ class MagpieRSS {
|
||||
}
|
||||
|
||||
// if inside an Atom content construct (e.g. content or summary) field treat tags as text
|
||||
elseif ($this->feed_type == ATOM and $this->incontent )
|
||||
elseif ($this->feed_type == ATOM and $this->incontent )
|
||||
{
|
||||
// if tags are inlined, then flatten
|
||||
$attrs_str = join(' ',
|
||||
array_map('map_attrs',
|
||||
array_keys($attrs),
|
||||
$attrs_str = join(' ',
|
||||
array_map('map_attrs',
|
||||
array_keys($attrs),
|
||||
array_values($attrs) ) );
|
||||
|
||||
$this->append_content( "<$element $attrs_str>" );
|
||||
@@ -172,9 +172,9 @@ class MagpieRSS {
|
||||
// Magpie treats link elements of type rel='alternate'
|
||||
// as being equivalent to RSS's simple link element.
|
||||
//
|
||||
elseif ($this->feed_type == ATOM and $el == 'link' )
|
||||
elseif ($this->feed_type == ATOM and $el == 'link' )
|
||||
{
|
||||
if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
|
||||
if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
|
||||
{
|
||||
$link_el = 'link';
|
||||
}
|
||||
@@ -194,7 +194,7 @@ class MagpieRSS {
|
||||
|
||||
function feed_cdata ($p, $text) {
|
||||
|
||||
if ($this->feed_type == ATOM and $this->incontent)
|
||||
if ($this->feed_type == ATOM and $this->incontent)
|
||||
{
|
||||
$this->append_content( $text );
|
||||
}
|
||||
@@ -207,17 +207,17 @@ class MagpieRSS {
|
||||
function feed_end_element ($p, $el) {
|
||||
$el = strtolower($el);
|
||||
|
||||
if ( $el == 'item' or $el == 'entry' )
|
||||
if ( $el == 'item' or $el == 'entry' )
|
||||
{
|
||||
$this->items[] = $this->current_item;
|
||||
$this->current_item = array();
|
||||
$this->initem = false;
|
||||
}
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
|
||||
{
|
||||
$this->intextinput = false;
|
||||
}
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
|
||||
{
|
||||
$this->inimage = false;
|
||||
}
|
||||
@@ -225,14 +225,14 @@ class MagpieRSS {
|
||||
{
|
||||
$this->incontent = false;
|
||||
}
|
||||
elseif ($el == 'channel' or $el == 'feed' )
|
||||
elseif ($el == 'channel' or $el == 'feed' )
|
||||
{
|
||||
$this->inchannel = false;
|
||||
}
|
||||
elseif ($this->feed_type == ATOM and $this->incontent ) {
|
||||
// balance tags properly
|
||||
// note: i don't think this is actually neccessary
|
||||
if ( $this->stack[0] == $el )
|
||||
if ( $this->stack[0] == $el )
|
||||
{
|
||||
$this->append_content("</$el>");
|
||||
}
|
||||
@@ -270,7 +270,7 @@ class MagpieRSS {
|
||||
if (!$el) {
|
||||
return;
|
||||
}
|
||||
if ( $this->current_namespace )
|
||||
if ( $this->current_namespace )
|
||||
{
|
||||
if ( $this->initem ) {
|
||||
$this->concat(
|
||||
@@ -395,7 +395,7 @@ function fetch_rss ($url) {
|
||||
// error("Failed to fetch $url and cache is off");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// else cache is ON
|
||||
else {
|
||||
// Flow
|
||||
@@ -472,7 +472,7 @@ function fetch_rss ($url) {
|
||||
if ( $resp->error ) {
|
||||
# compensate for Snoopy's annoying habbit to tacking
|
||||
# on '\n'
|
||||
$http_error = substr($resp->error, 0, -2);
|
||||
$http_error = substr($resp->error, 0, -2);
|
||||
$errormsg .= "(HTTP Error: $http_error)";
|
||||
}
|
||||
else {
|
||||
@@ -613,28 +613,28 @@ function init () {
|
||||
}
|
||||
}
|
||||
|
||||
function is_info ($sc) {
|
||||
return $sc >= 100 && $sc < 200;
|
||||
function is_info ($sc) {
|
||||
return $sc >= 100 && $sc < 200;
|
||||
}
|
||||
|
||||
function is_success ($sc) {
|
||||
return $sc >= 200 && $sc < 300;
|
||||
function is_success ($sc) {
|
||||
return $sc >= 200 && $sc < 300;
|
||||
}
|
||||
|
||||
function is_redirect ($sc) {
|
||||
return $sc >= 300 && $sc < 400;
|
||||
function is_redirect ($sc) {
|
||||
return $sc >= 300 && $sc < 400;
|
||||
}
|
||||
|
||||
function is_error ($sc) {
|
||||
return $sc >= 400 && $sc < 600;
|
||||
function is_error ($sc) {
|
||||
return $sc >= 400 && $sc < 600;
|
||||
}
|
||||
|
||||
function is_client_error ($sc) {
|
||||
return $sc >= 400 && $sc < 500;
|
||||
function is_client_error ($sc) {
|
||||
return $sc >= 400 && $sc < 500;
|
||||
}
|
||||
|
||||
function is_server_error ($sc) {
|
||||
return $sc >= 500 && $sc < 600;
|
||||
function is_server_error ($sc) {
|
||||
return $sc >= 500 && $sc < 600;
|
||||
}
|
||||
|
||||
class RSSCache {
|
||||
@@ -685,7 +685,7 @@ class RSSCache {
|
||||
$cache_option = 'rss_' . $this->file_name( $url );
|
||||
|
||||
if ( ! get_option( $cache_option ) ) {
|
||||
$this->debug(
|
||||
$this->debug(
|
||||
"Cache doesn't contain: $url (cache option: $cache_option)"
|
||||
);
|
||||
return 0;
|
||||
@@ -757,7 +757,7 @@ class RSSCache {
|
||||
\*=======================================================================*/
|
||||
function error ($errormsg, $lvl=E_USER_WARNING) {
|
||||
// append PHP's error message if track_errors enabled
|
||||
if ( isset($php_errormsg) ) {
|
||||
if ( isset($php_errormsg) ) {
|
||||
$errormsg .= " ($php_errormsg)";
|
||||
}
|
||||
$this->ERROR = $errormsg;
|
||||
@@ -781,7 +781,7 @@ function parse_w3cdtf ( $date_str ) {
|
||||
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
|
||||
|
||||
if ( preg_match( $pat, $date_str, $match ) ) {
|
||||
list( $year, $month, $day, $hours, $minutes, $seconds) =
|
||||
list( $year, $month, $day, $hours, $minutes, $seconds) =
|
||||
array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
|
||||
|
||||
# calc epoch for current date assuming GMT
|
||||
|
||||
@@ -73,7 +73,7 @@ class WP_Scripts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Determines dependencies of scripts
|
||||
@@ -159,7 +159,7 @@ class WP_Scripts {
|
||||
endswitch;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class _WP_Script {
|
||||
|
||||
@@ -152,7 +152,7 @@ function setup_userdata($user_id = '') {
|
||||
|
||||
if ( '' == $user_id )
|
||||
$user = wp_get_current_user();
|
||||
else
|
||||
else
|
||||
$user = new WP_User($user_id);
|
||||
|
||||
if ( 0 == $user->ID )
|
||||
|
||||
@@ -90,7 +90,7 @@ class wpdb {
|
||||
function print_error($str = '') {
|
||||
global $EZSQL_ERROR;
|
||||
if (!$str) $str = mysql_error();
|
||||
$EZSQL_ERROR[] =
|
||||
$EZSQL_ERROR[] =
|
||||
array ('query' => $this->last_query, 'error_str' => $str);
|
||||
|
||||
$str = htmlspecialchars($str, ENT_QUOTES);
|
||||
|
||||
Reference in New Issue
Block a user