diff --git a/index.php b/index.php index 3e3db402e0..b1c655cd52 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,4 @@ -Categories if ( !current_user_can( 'manage_categories' ) ) - die('-1'); + die('-1'); if ( !$cat = wp_insert_category( $_POST ) ) die('0'); if ( !$cat = get_category( $cat ) ) diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php index 225119d1c9..43f0bc8b64 100644 --- a/wp-admin/admin-db.php +++ b/wp-admin/admin-db.php @@ -48,7 +48,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) { if ( ! $user->has_cap('edit_others_posts') ) { if ( $user->has_cap('edit_posts') || $exclude_zeros == false ) return array($user->id); - else + else return false; } @@ -96,7 +96,7 @@ function wp_insert_category($catarr) { $update = false; $cat_name = apply_filters('pre_category_name', $cat_name); - + if (empty ($category_nicename)) $category_nicename = sanitize_title($cat_name); else @@ -198,7 +198,7 @@ function wp_delete_category($cat_ID) { $cats = array($default_cat); else $cats = array_diff($cats, array($cat_ID)); - wp_set_post_categories($post_id, $cats); + wp_set_post_categories($post_id, $cats); } $default_link_cat = get_option('default_link_category'); @@ -209,9 +209,9 @@ function wp_delete_category($cat_ID) { $cats = array($default_link_cat); else $cats = array_diff($cats, array($cat_ID)); - wp_set_link_cats($link_id, $cats); + wp_set_link_cats($link_id, $cats); } - + wp_cache_delete($cat_ID, 'category'); wp_cache_delete('all_category_ids', 'category'); @@ -285,9 +285,9 @@ function wp_delete_user($id, $reassign = 'novalue') { function wp_revoke_user($id) { $id = (int) $id; - + $user = new WP_User($id); - $user->remove_all_caps(); + $user->remove_all_caps(); } function wp_insert_link($linkdata) { @@ -385,15 +385,15 @@ function wp_update_link($linkdata) { $link = add_magic_quotes($link); // Passed link category list overwrites existing category list if not empty. - if ( isset($linkdata['link_category']) && is_array($linkdata['link_category']) + if ( isset($linkdata['link_category']) && is_array($linkdata['link_category']) && 0 != count($linkdata['link_category']) ) - $link_cats = $linkdata['link_category']; - else - $link_cats = $link['link_category']; + $link_cats = $linkdata['link_category']; + else + $link_cats = $link['link_category']; // Merge old and new fields with new fields overwriting old ones. $linkdata = array_merge($link, $linkdata); - $linkdata['link_category'] = $link_cats; + $linkdata['link_category'] = $link_cats; return wp_insert_link($linkdata); } @@ -402,7 +402,7 @@ function wp_delete_link($link_id) { global $wpdb; do_action('delete_link', $link_id); - + $categories = wp_get_link_cats($link_id); if( is_array( $categories ) ) { foreach ( $categories as $category ) { @@ -418,9 +418,9 @@ function wp_delete_link($link_id) { function wp_get_link_cats($link_ID = 0) { global $wpdb; - $sql = "SELECT category_id - FROM $wpdb->link2cat - WHERE link_id = $link_ID + $sql = "SELECT category_id + FROM $wpdb->link2cat + WHERE link_id = $link_ID ORDER BY category_id"; $result = $wpdb->get_col($sql); @@ -441,8 +441,8 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) { // First the old categories $old_categories = $wpdb->get_col(" - SELECT category_id - FROM $wpdb->link2cat + SELECT category_id + FROM $wpdb->link2cat WHERE link_id = $link_ID"); if (!$old_categories) { @@ -457,9 +457,9 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) { if ($delete_cats) { foreach ($delete_cats as $del) { $wpdb->query(" - DELETE FROM $wpdb->link2cat - WHERE category_id = $del - AND link_id = $link_ID + DELETE FROM $wpdb->link2cat + WHERE category_id = $del + AND link_id = $link_ID "); } } @@ -470,11 +470,11 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) { if ($add_cats) { foreach ($add_cats as $new_cat) { $wpdb->query(" - INSERT INTO $wpdb->link2cat (link_id, category_id) + INSERT INTO $wpdb->link2cat (link_id, category_id) VALUES ($link_ID, $new_cat)"); } } - + // Update category counts. $all_affected_cats = array_unique(array_merge($link_categories, $old_categories)); foreach ( $all_affected_cats as $cat_id ) { diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 426a51bf27..fdbcedbf38 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1139,10 +1139,10 @@ function touch_time( $edit = 1, $for_post = 1 ) { ?> - @ - : - - + @ + : + + post_title = $popuptitle; - + $content = wp_specialchars($_REQUEST['content']); $popupurl = wp_specialchars($_REQUEST['popupurl']); - if ( !empty($content) ) { - $post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) ); - } else { - $post->post_content = ''.$popuptitle.''."\n$text"; - } +if ( !empty($content) ) { + $post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) ); +} else { + $post->post_content = ''.$popuptitle.''."\n$text"; +} - /* /big funky fixes */ +/* /big funky fixes */ ?> @@ -77,15 +77,15 @@ $popupurl = wp_specialchars($_REQUEST['popupurl']); } #wpbookmarklet .wrap { - border: 0px; + border: 0px; } #wpbookmarklet #postdiv { - margin-bottom: 0.5em; + margin-bottom: 0.5em; } #wpbookmarklet #titlediv { - margin-bottom: 1em; + margin-bottom: 1em; } --> diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 9504eefdda..bd4eae729f 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -48,10 +48,10 @@ break; case 'edit': - require_once ('admin-header.php'); - $cat_ID = (int) $_GET['cat_ID']; - $category = get_category_to_edit($cat_ID); - include('edit-category-form.php'); + require_once ('admin-header.php'); + $cat_ID = (int) $_GET['cat_ID']; + $category = get_category_to_edit($cat_ID); + include('edit-category-form.php'); break; diff --git a/wp-admin/custom-fields.js b/wp-admin/custom-fields.js index a48661fe79..ad7a2db166 100644 --- a/wp-admin/custom-fields.js +++ b/wp-admin/custom-fields.js @@ -14,10 +14,10 @@ function customFieldsAddIn() { for ( var i=0; i < inputs.length; i++ ) { if ('text' == inputs[i].type) { inputs[i].setAttribute('autocomplete', 'off'); - inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); }; + inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); }; } if ('updatemeta' == inputs[i].className) { - inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); }; + inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); }; } } diff --git a/wp-admin/dbx-admin-key-js.php b/wp-admin/dbx-admin-key-js.php index f47e53b90a..9746a8c510 100644 --- a/wp-admin/dbx-admin-key-js.php +++ b/wp-admin/dbx-admin-key-js.php @@ -9,7 +9,7 @@ switch ( $_GET['pagenow'] ) : break; case 'page.php' : case 'page-new.php' : - $man = 'pagemeta'; + $man = 'pagemeta'; break; case 'link.php' : $man = 'linkmeta'; diff --git a/wp-admin/edit-category-form.php b/wp-admin/edit-category-form.php index 2000bed15e..b029856f6c 100644 --- a/wp-admin/edit-category-form.php +++ b/wp-admin/edit-category-form.php @@ -22,8 +22,8 @@ if ( ! empty($cat_ID) ) { - - + + diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 7ff4c5c42c..488a055130 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -143,7 +143,7 @@ $start = " start='$offset'"; ++$i; $class = ''; $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); $comment_status = wp_get_comment_status($comment->comment_ID); - if ('unapproved' == $comment_status) + if ('unapproved' == $comment_status) $class .= ' unapproved'; if ($i % 2) $class .= ' alternate'; @@ -153,7 +153,7 @@ $start = " start='$offset'"; -

— [ +

— [ comment_post_ID) ) { echo " " . __('Edit') . ''; @@ -181,7 +181,7 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; ?>

-

+

- + @@ -121,7 +120,7 @@ if ( $authors && count( $authors ) > 1 ) :

:

+ +
@@ -208,7 +207,7 @@ if (current_user_can('upload_files')) {
: () - @@ -227,7 +226,7 @@ if ( ! empty($pings) )
diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php index 893e3f7802..ac20ed79f0 100644 --- a/wp-admin/edit-form-comment.php +++ b/wp-admin/edit-form-comment.php @@ -54,8 +54,8 @@ addLoadEvent(focusit); :
-
- +
+ diff --git a/wp-admin/edit-form.php b/wp-admin/edit-form.php index 2d1cef69a7..d907a629e6 100644 --- a/wp-admin/edit-form.php +++ b/wp-admin/edit-form.php @@ -54,17 +54,17 @@ edCanvas = document.getElementById('content');

(Separate multiple URLs with spaces.)
'), 'http://wordpress.org/docs/reference/post/#trackback') ?>

-

- +

+ - + '; - } ?> - + echo ''; + } ?> +

diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index c60d5fdfe1..6b7b045f75 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -30,7 +30,7 @@ function xfn_check($class, $value = '', $type = 'check') { } ?> -
+

@@ -48,7 +48,7 @@ function xfn_check($class, $value = '', $type = 'check') {
-

+

-

+

@@ -168,9 +168,9 @@ if (current_user_can('upload_files')) {

-
@@ -186,7 +186,7 @@ list_meta($metadata);
ID) ) ?> post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> /> diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index 721d5df27a..ca496ab401 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -10,12 +10,12 @@ require_once('admin-header.php');

- -
- - - -
+ +
+ + + +

+?>

- + diff --git a/wp-admin/edit.php b/wp-admin/edit.php index dffbf52f8c..395bc6b0e5 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -12,11 +12,11 @@ $drafts = get_users_drafts( $user_ID ); $other_drafts = get_others_drafts( $user_ID); if ($drafts || $other_drafts) { -?> +?>
-

- + ID' title='" . __('Edit this draft') . "'>$draft->post_title"; ++$i; } - ?> - .

+ ?> + .

- -

- +

+ ID' title='" . __('Edit this draft') . "'>$draft->post_title"; ++$i; } - ?> - .

+ ?> + .

@@ -88,7 +88,7 @@ if ( count($arc_result) ) { ?>
- yyear == 0 ) @@ -127,12 +127,12 @@ if ( count($arc_result) ) { ?> 'display name' $posts_columns = array( - 'id' => __('ID'), - 'date' => __('When'), - 'title' => __('Title'), - 'categories' => __('Categories'), - 'comments' => __('Comments'), - 'author' => __('Author') + 'id' => __('ID'), + 'date' => __('When'), + 'title' => __('Title'), + 'categories' => __('Categories'), + 'comments' => __('Comments'), + 'author' => __('Author') ); $posts_columns = apply_filters('manage_posts_columns', $posts_columns); @@ -143,7 +143,7 @@ $posts_columns['control_delete'] = ''; ?> - +
@@ -160,7 +160,7 @@ $bgcolor = ''; while (have_posts()) : the_post(); add_filter('the_title','wp_specialchars'); $class = ('alternate' == $class) ? '' : 'alternate'; -?> +?> $column_display_name) { case 'comments': ?> - + get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); if ($comments) { - ?> -

-
    + ?> +

    +
      get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); $comment_status = wp_get_comment_status($comment->comment_ID); - if ('unapproved' == $comment_status) + if ('unapproved' == $comment_status) $class .= ' unapproved'; if ($i % 2) $class .= ' alternate'; @@ -299,8 +299,8 @@ if ( current_user_can('edit_post', $comment->comment_post_ID) ) { echo '
    '; }//end if comments ?> - - - + + +?> diff --git a/wp-admin/export.php b/wp-admin/export.php index 5c86b68236..75e18de160 100644 --- a/wp-admin/export.php +++ b/wp-admin/export.php @@ -72,7 +72,7 @@ $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_dat -get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_dat post_parent; ?> post_type; ?> get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID"); +$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID"); if ( $postmeta ) { ?> @@ -119,7 +119,7 @@ if ( $postmeta ) { get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID"); +$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID"); if ( $comments ) { foreach ( $comments as $c ) { ?> comment_ID; ?> diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index 31ac32c0cf..d09df85e36 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -517,7 +517,7 @@ class Blogger_Import { $did_one = true; } $output.= "

    $archivename $status

    \n"; - } + } if ( ! $did_one ) $this->set_next_step(7); die( $this->refresher(1000) . $output ); diff --git a/wp-admin/import/blogware.php b/wp-admin/import/blogware.php index 7d2612f2ce..62b77dcae5 100644 --- a/wp-admin/import/blogware.php +++ b/wp-admin/import/blogware.php @@ -20,7 +20,7 @@ class BW_Import { $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl); } - + function greet() { echo '
    '; echo '

    '.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog. Pick a Blogware file to upload and click Import.').'

    '; @@ -30,7 +30,7 @@ class BW_Import { function import_posts() { global $wpdb, $current_user; - + set_magic_quotes_runtime(0); $importdata = file($this->file); // Read the file into an array $importdata = implode('', $importdata); // squish it @@ -39,7 +39,7 @@ class BW_Import { preg_match_all('|(]+>(.*?))|is', $importdata, $posts); $posts = $posts[1]; unset($importdata); - echo '
      '; + echo '
        '; foreach ($posts as $post) { flush(); preg_match('||is', $post, $post_type); @@ -102,7 +102,7 @@ class BW_Import { preg_match_all('|(.*?)|is', $post, $comments); $comments = $comments[1]; - + if ( $comments ) { $comment_post_ID = $post_id; $num_comments = 0; @@ -157,7 +157,7 @@ class BW_Import { $this->file = $file['file']; $this->import_posts(); wp_import_cleanup($file['id']); - + echo '

        '; printf(__('All done. Have fun!'), get_option('home')); echo '

        '; @@ -170,7 +170,7 @@ class BW_Import { $step = (int) $_GET['step']; $this->header(); - + switch ($step) { case 0 : $this->greet(); @@ -179,12 +179,12 @@ class BW_Import { $this->import(); break; } - + $this->footer(); } function BW_Import() { - // Nothing. + // Nothing. } } diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php index 026d871833..02c030f899 100644 --- a/wp-admin/import/dotclear.php +++ b/wp-admin/import/dotclear.php @@ -9,7 +9,7 @@ **/ if(!function_exists('get_catbynicename')) { - function get_catbynicename($category_nicename) + function get_catbynicename($category_nicename) { global $wpdb; @@ -60,57 +60,58 @@ if(!function_exists('link_exists')) // // This cries out for a C-implementation to be included in PHP core // - function valid_1byte($char) { - if(!is_int($char)) return false; - return ($char & 0x80) == 0x00; - } - - function valid_2byte($char) { - if(!is_int($char)) return false; - return ($char & 0xE0) == 0xC0; - } - function valid_3byte($char) { - if(!is_int($char)) return false; - return ($char & 0xF0) == 0xE0; - } +function valid_1byte($char) { + if(!is_int($char)) return false; + return ($char & 0x80) == 0x00; +} - function valid_4byte($char) { - if(!is_int($char)) return false; - return ($char & 0xF8) == 0xF0; - } - - function valid_nextbyte($char) { - if(!is_int($char)) return false; - return ($char & 0xC0) == 0x80; - } - - function valid_utf8($string) { - $len = strlen($string); - $i = 0; - while( $i < $len ) { - $char = ord(substr($string, $i++, 1)); - if(valid_1byte($char)) { // continue - continue; - } else if(valid_2byte($char)) { // check 1 byte - if(!valid_nextbyte(ord(substr($string, $i++, 1)))) - return false; - } else if(valid_3byte($char)) { // check 2 bytes - if(!valid_nextbyte(ord(substr($string, $i++, 1)))) - return false; - if(!valid_nextbyte(ord(substr($string, $i++, 1)))) - return false; - } else if(valid_4byte($char)) { // check 3 bytes - if(!valid_nextbyte(ord(substr($string, $i++, 1)))) - return false; - if(!valid_nextbyte(ord(substr($string, $i++, 1)))) - return false; - if(!valid_nextbyte(ord(substr($string, $i++, 1)))) - return false; - } // goto next char - } - return true; // done - } +function valid_2byte($char) { + if(!is_int($char)) return false; + return ($char & 0xE0) == 0xC0; +} + +function valid_3byte($char) { + if(!is_int($char)) return false; + return ($char & 0xF0) == 0xE0; +} + +function valid_4byte($char) { + if(!is_int($char)) return false; + return ($char & 0xF8) == 0xF0; +} + +function valid_nextbyte($char) { + if(!is_int($char)) return false; + return ($char & 0xC0) == 0x80; +} + +function valid_utf8($string) { + $len = strlen($string); + $i = 0; + while( $i < $len ) { + $char = ord(substr($string, $i++, 1)); + if(valid_1byte($char)) { // continue + continue; + } else if(valid_2byte($char)) { // check 1 byte + if(!valid_nextbyte(ord(substr($string, $i++, 1)))) + return false; + } else if(valid_3byte($char)) { // check 2 bytes + if(!valid_nextbyte(ord(substr($string, $i++, 1)))) + return false; + if(!valid_nextbyte(ord(substr($string, $i++, 1)))) + return false; + } else if(valid_4byte($char)) { // check 3 bytes + if(!valid_nextbyte(ord(substr($string, $i++, 1)))) + return false; + if(!valid_nextbyte(ord(substr($string, $i++, 1)))) + return false; + if(!valid_nextbyte(ord(substr($string, $i++, 1)))) + return false; + } // goto next char + } + return true; // done +} function csc ($s) { if (valid_utf8 ($s)) { @@ -151,7 +152,7 @@ class Dotclear_Import { echo '
    '; } - function get_dc_cats() + function get_dc_cats() { global $wpdb; // General Housekeeping @@ -186,7 +187,7 @@ class Dotclear_Import { // Get Posts return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie - ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); + ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); } function get_dc_comments() @@ -211,7 +212,7 @@ class Dotclear_Import { return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A); } - function cat2wp($categories='') + function cat2wp($categories='') { // General Housekeeping global $wpdb; @@ -221,7 +222,7 @@ class Dotclear_Import { if(is_array($categories)) { echo '

    '.__('Importing Categories...').'

    '; - foreach ($categories as $category) + foreach ($categories as $category) { $count++; extract($category); @@ -283,7 +284,7 @@ class Dotclear_Import { 'display_name' => $Realname) ); } - else + else { $ret_id = wp_insert_user(array( 'user_login' => $user_id, @@ -384,7 +385,7 @@ class Dotclear_Import { 'comment_count' => $post_nb_comment + $post_nb_trackback) ); } - else + else { $ret_id = wp_insert_post(array( 'post_author' => $authorid, @@ -460,7 +461,7 @@ class Dotclear_Import { 'comment_approved' => $comment_approved) ); } - else + else { // Insert comments $ret_id = wp_insert_comment(array( @@ -547,7 +548,7 @@ class Dotclear_Import { return false; } - function import_categories() + function import_categories() { // Category Import $cats = $this->get_dc_cats(); @@ -565,7 +566,7 @@ class Dotclear_Import { function import_users() { // User Import - $users = $this->get_dc_users(); + $users = $this->get_dc_users(); $this->users2wp($users); echo '
    '; @@ -655,7 +656,7 @@ class Dotclear_Import { echo '
- - + +
'; } - function dispatch() + function dispatch() { if (empty ($_GET['step'])) @@ -664,7 +665,7 @@ class Dotclear_Import { $step = (int) $_GET['step']; $this->header(); - if ( $step > 0 ) + if ( $step > 0 ) { if($_POST['dbuser']) { @@ -689,25 +690,25 @@ class Dotclear_Import { { if(get_option('dchost')) delete_option('dchost'); - add_option('dchost',$_POST['dbhost']); + add_option('dchost',$_POST['dbhost']); } if($_POST['dccharset']) { if(get_option('dccharset')) delete_option('dccharset'); - add_option('dccharset',$_POST['dccharset']); + add_option('dccharset',$_POST['dccharset']); } if($_POST['dbprefix']) { if(get_option('dcdbprefix')) delete_option('dcdbprefix'); - add_option('dcdbprefix',$_POST['dbprefix']); + add_option('dcdbprefix',$_POST['dbprefix']); } } - switch ($step) + switch ($step) { default: case 0 : @@ -736,7 +737,7 @@ class Dotclear_Import { $this->footer(); } - function Dotclear_Import() + function Dotclear_Import() { // Nothing. } diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php index 5494197f14..ea05ff2833 100644 --- a/wp-admin/import/greymatter.php +++ b/wp-admin/import/greymatter.php @@ -66,10 +66,10 @@ class GM_Import { $string = str_replace("|*|","
\n",$string); return($string); } - + function import() { global $wpdb; - + $wpvarstoreset = array('gmpath', 'archivespath', 'lastentry'); for ($i=0; $i
    mtnames))) { //a new mt author name is found ++ $this->j; - $this->mtnames[$this->j] = $author; //add that new mt author name to an array + $this->mtnames[$this->j] = $author; //add that new mt author name to an array $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user - if (!$user_id) { //banging my head against the desk now. + if (!$user_id) { //banging my head against the desk now. if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname $user_id = wp_create_user($author, $pass); $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank. @@ -399,7 +399,7 @@ class MT_Import { function import() { $this->id = (int) $_GET['id']; - + $this->file = get_attached_file($this->id); $this->get_authors_from_post(); $this->get_entries(); diff --git a/wp-admin/import/textpattern.php b/wp-admin/import/textpattern.php index e1a0339789..435a588c1f 100644 --- a/wp-admin/import/textpattern.php +++ b/wp-admin/import/textpattern.php @@ -4,7 +4,7 @@ **/ if(!function_exists('get_catbynicename')) { - function get_catbynicename($category_nicename) + function get_catbynicename($category_nicename) { global $wpdb; @@ -70,13 +70,13 @@ class Textpattern_Import { $prefix = get_option('tpre'); // Get Categories - return $txpdb->get_results('SELECT - id, - name, - title - FROM '.$prefix.'txp_category - WHERE type = "article"', - ARRAY_A); + return $txpdb->get_results('SELECT + id, + name, + title + FROM '.$prefix.'txp_category + WHERE type = "article"', + ARRAY_A); } function get_txp_users() @@ -90,12 +90,12 @@ class Textpattern_Import { // Get Users return $txpdb->get_results('SELECT - user_id, - name, - RealName, - email, - privs - FROM '.$prefix.'txp_users', ARRAY_A); + user_id, + name, + RealName, + email, + privs + FROM '.$prefix.'txp_users', ARRAY_A); } function get_txp_posts() @@ -106,22 +106,22 @@ class Textpattern_Import { $prefix = get_option('tpre'); // Get Posts - return $txpdb->get_results('SELECT - ID, - Posted, - AuthorID, - LastMod, - Title, - Body, - Excerpt, - Category1, - Category2, - Status, - Keywords, - url_title, - comments_count - FROM '.$prefix.'textpattern - ', ARRAY_A); + return $txpdb->get_results('SELECT + ID, + Posted, + AuthorID, + LastMod, + Title, + Body, + Excerpt, + Category1, + Category2, + Status, + Keywords, + url_title, + comments_count + FROM '.$prefix.'textpattern + ', ARRAY_A); } function get_txp_comments() @@ -143,18 +143,18 @@ class Textpattern_Import { set_magic_quotes_runtime(0); $prefix = get_option('tpre'); - return $txpdb->get_results('SELECT - id, - date, - category, - url, - linkname, - description - FROM '.$prefix.'txp_link', - ARRAY_A); + return $txpdb->get_results('SELECT + id, + date, + category, + url, + linkname, + description + FROM '.$prefix.'txp_link', + ARRAY_A); } - function cat2wp($categories='') + function cat2wp($categories='') { // General Housekeeping global $wpdb; @@ -164,7 +164,7 @@ class Textpattern_Import { if(is_array($categories)) { echo '

    '.__('Importing Categories...').'

    '; - foreach ($categories as $category) + foreach ($categories as $category) { $count++; extract($category); @@ -226,7 +226,7 @@ class Textpattern_Import { 'display_name' => $name) ); } - else + else { $ret_id = wp_insert_user(array( 'user_login' => $name, @@ -302,35 +302,35 @@ class Textpattern_Import { if($pinfo = post_exists($Title,$Body)) { $ret_id = wp_insert_post(array( - 'ID' => $pinfo, - 'post_date' => $Posted, - 'post_date_gmt' => $post_date_gmt, - 'post_author' => $authorid, - 'post_modified' => $LastMod, - 'post_modified_gmt' => $post_modified_gmt, - 'post_title' => $Title, - 'post_content' => $Body, - 'post_excerpt' => $Excerpt, - 'post_status' => $post_status, - 'post_name' => $url_title, - 'comment_count' => $comments_count) - ); + 'ID' => $pinfo, + 'post_date' => $Posted, + 'post_date_gmt' => $post_date_gmt, + 'post_author' => $authorid, + 'post_modified' => $LastMod, + 'post_modified_gmt' => $post_modified_gmt, + 'post_title' => $Title, + 'post_content' => $Body, + 'post_excerpt' => $Excerpt, + 'post_status' => $post_status, + 'post_name' => $url_title, + 'comment_count' => $comments_count) + ); } - else + else { $ret_id = wp_insert_post(array( - 'post_date' => $Posted, - 'post_date_gmt' => $post_date_gmt, - 'post_author' => $authorid, - 'post_modified' => $LastMod, - 'post_modified_gmt' => $post_modified_gmt, - 'post_title' => $Title, - 'post_content' => $Body, - 'post_excerpt' => $Excerpt, - 'post_status' => $post_status, - 'post_name' => $url_title, - 'comment_count' => $comments_count) - ); + 'post_date' => $Posted, + 'post_date_gmt' => $post_date_gmt, + 'post_author' => $authorid, + 'post_modified' => $LastMod, + 'post_modified_gmt' => $post_modified_gmt, + 'post_title' => $Title, + 'post_content' => $Body, + 'post_excerpt' => $Excerpt, + 'post_status' => $post_status, + 'post_name' => $url_title, + 'comment_count' => $comments_count) + ); } $txpposts2wpposts[$ID] = $ret_id; @@ -379,29 +379,29 @@ class Textpattern_Import { { // Update comments $ret_id = wp_update_comment(array( - 'comment_ID' => $cinfo, - 'comment_post_ID' => $comment_post_ID, - 'comment_author' => $name, - 'comment_author_email' => $email, - 'comment_author_url' => $web, - 'comment_date' => $posted, - 'comment_content' => $message, - 'comment_approved' => $comment_approved) - ); + 'comment_ID' => $cinfo, + 'comment_post_ID' => $comment_post_ID, + 'comment_author' => $name, + 'comment_author_email' => $email, + 'comment_author_url' => $web, + 'comment_date' => $posted, + 'comment_content' => $message, + 'comment_approved' => $comment_approved) + ); } - else + else { // Insert comments $ret_id = wp_insert_comment(array( - 'comment_post_ID' => $comment_post_ID, - 'comment_author' => $name, - 'comment_author_email' => $email, - 'comment_author_url' => $web, - 'comment_author_IP' => $ip, - 'comment_date' => $posted, - 'comment_content' => $message, - 'comment_approved' => $comment_approved) - ); + 'comment_post_ID' => $comment_post_ID, + 'comment_author' => $name, + 'comment_author_email' => $email, + 'comment_author_url' => $web, + 'comment_author_IP' => $ip, + 'comment_date' => $posted, + 'comment_content' => $message, + 'comment_approved' => $comment_approved) + ); } $txpcm2wpcm[$comment_ID] = $ret_id; } @@ -450,7 +450,7 @@ class Textpattern_Import { 'link_updated' => $date) ); } - else + else { $ret_id = wp_insert_link(array( 'link_url' => $url, @@ -472,7 +472,7 @@ class Textpattern_Import { return false; } - function import_categories() + function import_categories() { // Category Import $cats = $this->get_txp_cats(); @@ -490,7 +490,7 @@ class Textpattern_Import { function import_users() { // User Import - $users = $this->get_txp_users(); + $users = $this->get_txp_users(); $this->users2wp($users); echo ''; @@ -578,7 +578,7 @@ class Textpattern_Import { echo ''; } - function dispatch() + function dispatch() { if (empty ($_GET['step'])) @@ -587,7 +587,7 @@ class Textpattern_Import { $step = (int) $_GET['step']; $this->header(); - if ( $step > 0 ) + if ( $step > 0 ) { if($_POST['dbuser']) { @@ -612,19 +612,19 @@ class Textpattern_Import { { if(get_option('txphost')) delete_option('txphost'); - add_option('txphost',$_POST['dbhost']); + add_option('txphost',$_POST['dbhost']); } if($_POST['dbprefix']) { if(get_option('tpre')) delete_option('tpre'); - add_option('tpre',$_POST['dbprefix']); + add_option('tpre',$_POST['dbprefix']); } } - switch ($step) + switch ($step) { default: case 0 : @@ -653,7 +653,7 @@ class Textpattern_Import { $this->footer(); } - function Textpattern_Import() + function Textpattern_Import() { // Nothing. } diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php index e772ecbee1..747103a01b 100644 --- a/wp-admin/import/wordpress.php +++ b/wp-admin/import/wordpress.php @@ -58,9 +58,9 @@ class WP_Import { $pass = 'changeme'; if (!(in_array($author, $this->mtnames))) { //a new mt author name is found ++ $this->j; - $this->mtnames[$this->j] = $author; //add that new mt author name to an array + $this->mtnames[$this->j] = $author; //add that new mt author name to an array $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user - if (!$user_id) { //banging my head against the desk now. + if (!$user_id) { //banging my head against the desk now. if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname $user_id = wp_create_user($author, $pass); $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank. @@ -273,7 +273,7 @@ class WP_Import { function import() { $this->id = (int) $_GET['id']; - + $this->file = get_attached_file($this->id); $this->get_authors_from_post(); $this->get_entries(); diff --git a/wp-admin/index.php b/wp-admin/index.php index 6573931b2d..3fb5509748 100644 --- a/wp-admin/index.php +++ b/wp-admin/index.php @@ -46,11 +46,11 @@ if ( $comments || $numcomments ) :
      -' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '' . get_the_title($comment->comment_post_ID) . ''); - edit_comment_link(__("Edit"), ' (', ')'); + edit_comment_link(__("Edit"), ' (', ')'); echo ''; } } @@ -80,7 +80,7 @@ foreach ($recentposts as $post) { get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC") ) : -?> +?>

        @@ -90,7 +90,7 @@ foreach ($scheduled as $post) { $post->post_title = sprintf(__('Post #%s'), $post->ID); echo "
      • " . sprintf(__('%1$s in %2$s'), "$post->post_title", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') )) . "
      • "; } -?> +?>
      @@ -99,7 +99,7 @@ foreach ($scheduled as $post) {

      get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'"); -if (0 < $numposts) $numposts = number_format($numposts); +if (0 < $numposts) $numposts = number_format($numposts); $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"); if (0 < $numcomms) $numcomms = number_format($numcomms); diff --git a/wp-admin/install-helper.php b/wp-admin/install-helper.php index 86138db1c2..ecfc91d557 100644 --- a/wp-admin/install-helper.php +++ b/wp-admin/install-helper.php @@ -9,21 +9,21 @@ $debug = 0; ** false on error */ function maybe_create_table($table_name, $create_ddl) { - global $wpdb; - foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { - if ($table == $table_name) { - return true; - } - } - //didn't find it try to create it. - $q = $wpdb->query($create_ddl); - // we cannot directly tell that whether this succeeded! - foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { - if ($table == $table_name) { - return true; - } - } - return false; + global $wpdb; + foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { + if ($table == $table_name) { + return true; + } + } + //didn't find it try to create it. + $q = $wpdb->query($create_ddl); + // we cannot directly tell that whether this succeeded! + foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { + if ($table == $table_name) { + return true; + } + } + return false; } /** @@ -33,22 +33,22 @@ function maybe_create_table($table_name, $create_ddl) { ** false on error */ function maybe_add_column($table_name, $column_name, $create_ddl) { - global $wpdb, $debug; - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { - if ($debug) echo("checking $column == $column_name
      "); - if ($column == $column_name) { - return true; - } - } - //didn't find it try to create it. - $q = $wpdb->query($create_ddl); - // we cannot directly tell that whether this succeeded! - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { - if ($column == $column_name) { - return true; - } - } - return false; + global $wpdb, $debug; + foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { + if ($debug) echo("checking $column == $column_name
      "); + if ($column == $column_name) { + return true; + } + } + //didn't find it try to create it. + $q = $wpdb->query($create_ddl); + // we cannot directly tell that whether this succeeded! + foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { + if ($column == $column_name) { + return true; + } + } + return false; } @@ -59,21 +59,21 @@ function maybe_add_column($table_name, $column_name, $create_ddl) { ** false on error */ function maybe_drop_column($table_name, $column_name, $drop_ddl) { - global $wpdb; - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { - if ($column == $column_name) { - //found it try to drop it. - $q = $wpdb->query($drop_ddl); - // we cannot directly tell that whether this succeeded! - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { - if ($column == $column_name) { - return false; - } - } - } - } - // else didn't find it - return true; + global $wpdb; + foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { + if ($column == $column_name) { + //found it try to drop it. + $q = $wpdb->query($drop_ddl); + // we cannot directly tell that whether this succeeded! + foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { + if ($column == $column_name) { + return false; + } + } + } + } + // else didn't find it + return true; } @@ -92,45 +92,45 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) { ** Extra */ function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) { - global $wpdb, $debug; - $diffs = 0; - $results = $wpdb->get_results("DESC $table_name"); - - foreach ($results as $row ) { - if ($debug > 1) print_r($row); - if ($row->Field == $col_name) { - // got our column, check the params - if ($debug) echo ("checking $row->Type against $col_type\n"); - if (($col_type != null) && ($row->Type != $col_type)) { - ++$diffs; - } - if (($is_null != null) && ($row->Null != $is_null)) { - ++$diffs; - } - if (($key != null) && ($row->Key != $key)) { - ++$diffs; - } - if (($default != null) && ($row->Default != $default)) { - ++$diffs; - } - if (($extra != null) && ($row->Extra != $extra)) { - ++$diffs; - } - if ($diffs > 0) { - if ($debug) echo ("diffs = $diffs returning false\n"); - return false; - } - return true; - } // end if found our column - } - return false; + global $wpdb, $debug; + $diffs = 0; + $results = $wpdb->get_results("DESC $table_name"); + + foreach ($results as $row ) { + if ($debug > 1) print_r($row); + if ($row->Field == $col_name) { + // got our column, check the params + if ($debug) echo ("checking $row->Type against $col_type\n"); + if (($col_type != null) && ($row->Type != $col_type)) { + ++$diffs; + } + if (($is_null != null) && ($row->Null != $is_null)) { + ++$diffs; + } + if (($key != null) && ($row->Key != $key)) { + ++$diffs; + } + if (($default != null) && ($row->Default != $default)) { + ++$diffs; + } + if (($extra != null) && ($row->Extra != $extra)) { + ++$diffs; + } + if ($diffs > 0) { + if ($debug) echo ("diffs = $diffs returning false\n"); + return false; + } + return true; + } // end if found our column + } + return false; } - + /* echo "

      testing

      "; echo "
      ";
       
      -//check_column('wp_links', 'link_description', 'mediumtext'); 
      +//check_column('wp_links', 'link_description', 'mediumtext');
       //if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
       //    echo "ok\n";
       $error_count = 0;
      @@ -138,14 +138,14 @@ $tablename = $wpdb->links;
       // check the column
       if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
       {
      -    $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
      -    $q = $wpdb->query($ddl);
      +	$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
      +	$q = $wpdb->query($ddl);
       }
       if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
      -    $res .= $tablename . ' - ok 
      '; + $res .= $tablename . ' - ok
      '; } else { - $res .= 'There was a problem with ' . $tablename . '
      '; - ++$error_count; + $res .= 'There was a problem with ' . $tablename . '
      '; + ++$error_count; } echo "
      "; */ diff --git a/wp-admin/link-add.php b/wp-admin/link-add.php index 22dcc640fd..45c3666a6a 100644 --- a/wp-admin/link-add.php +++ b/wp-admin/link-add.php @@ -7,9 +7,9 @@ $parent_file = 'link-manager.php'; wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', - 'description', 'visible', 'target', 'category', 'link_id', - 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', - 'notes', 'linkcheck[]')); + 'description', 'visible', 'target', 'category', 'link_id', + 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', + 'notes', 'linkcheck[]')); wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') ); if ( current_user_can( 'manage_categories' ) ) diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index 5ea635361d..d12f31f9a8 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -143,8 +143,8 @@ if ($links) echo $link->link_description . ""; echo "link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url"; ?> - - + link_category as $category) { @@ -157,8 +157,8 @@ if ($links) echo implode(', ', $cat_names); ?> - link_rel; ?> - + link_rel; ?> + '.__('Edit').''; diff --git a/wp-admin/link-parse-opml.php b/wp-admin/link-parse-opml.php index 196f3cb0d5..0e5edf0d31 100644 --- a/wp-admin/link-parse-opml.php +++ b/wp-admin/link-parse-opml.php @@ -4,12 +4,12 @@ require_once('../wp-config.php'); // columns we wish to find are: link_url, link_name, link_target, link_description // we need to map XML attribute names to our columns $opml_map = array('URL' => 'link_url', - 'HTMLURL' => 'link_url', - 'TEXT' => 'link_name', - 'TITLE' => 'link_name', - 'TARGET' => 'link_target', - 'DESCRIPTION' => 'link_description', - 'XMLURL' => 'link_rss' + 'HTMLURL' => 'link_url', + 'TEXT' => 'link_name', + 'TITLE' => 'link_name', + 'TARGET' => 'link_target', + 'DESCRIPTION' => 'link_description', + 'XMLURL' => 'link_rss' ); $map = $opml_map; @@ -20,24 +20,24 @@ $map = $opml_map; **/ function startElement($parser, $tagName, $attrs) { global $updated_timestamp, $all_links, $map; - global $names, $urls, $targets, $descriptions, $feeds; + global $names, $urls, $targets, $descriptions, $feeds; if ($tagName == 'OUTLINE') { - foreach (array_keys($map) as $key) { - if (isset($attrs[$key])) { - $$map[$key] = $attrs[$key]; - } - } + foreach (array_keys($map) as $key) { + if (isset($attrs[$key])) { + $$map[$key] = $attrs[$key]; + } + } - //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]
      \n"); + //echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]
      \n"); - // save the data away. - $names[] = $link_name; - $urls[] = $link_url; - $targets[] = $link_target; + // save the data away. + $names[] = $link_name; + $urls[] = $link_url; + $targets[] = $link_target; $feeds[] = $link_rss; - $descriptions[] = $link_description; - } // end if outline + $descriptions[] = $link_description; + } // end if outline } /** @@ -55,9 +55,9 @@ $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); if (!xml_parse($xml_parser, $opml, true)) { - echo(sprintf(__('XML error: %1$s at line %2$s'), - xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser))); + echo(sprintf(__('XML error: %1$s at line %2$s'), + xml_error_string(xml_get_error_code($xml_parser)), + xml_get_current_line_number($xml_parser))); } // Free up memory used by the XML parser diff --git a/wp-admin/link.php b/wp-admin/link.php index 84f8dc9bf3..4e519d9d8a 100644 --- a/wp-admin/link.php +++ b/wp-admin/link.php @@ -29,7 +29,7 @@ switch ($action) { $deleted = 0; foreach ($linkcheck as $link_id) { $link_id = (int) $link_id; - + if ( wp_delete_link($link_id) ) $deleted++; } diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index 50b5701f80..bbdfe1a709 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -34,8 +34,8 @@ foreach ($menu as $item) { if ( isset($submenu["$parent_file"]) ) : ?>
$sub) { $_wp_submenu_nopriv[$parent][$data[2]] = true; } } - + if ( empty($submenu[$parent]) ) unset($submenu[$parent]); } // Loop over the top-level menu. // Menus for which the original parent is not acessible due to lack of privs will have the next -// submenu in line be assigned as the new menu parent. +// submenu in line be assigned as the new menu parent. foreach ( $menu as $id => $data ) { if ( empty($submenu[$data[2]]) ) continue; diff --git a/wp-admin/moderation.php b/wp-admin/moderation.php index 8017073d48..e9fc505a82 100644 --- a/wp-admin/moderation.php +++ b/wp-admin/moderation.php @@ -31,7 +31,7 @@ case 'update': foreach($comment as $key => $value) { if ($feelinglucky && 'later' == $value) $value = 'delete'; - switch($value) { + switch($value) { case 'later': // do nothing with that comment // wp_set_comment_status($key, "hold"); @@ -41,10 +41,10 @@ case 'update': wp_set_comment_status($key, 'delete'); ++$item_deleted; break; - case 'spam': - wp_set_comment_status($key, 'spam'); - ++$item_spam; - break; + case 'spam': + wp_set_comment_status($key, 'spam'); + ++$item_spam; + break; case 'approve': wp_set_comment_status($key, 'approve'); if ( get_option('comments_notify') == true ) { @@ -52,7 +52,7 @@ case 'update': } ++$item_approved; break; - } + } } $file = basename(__FILE__); @@ -85,13 +85,13 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored echo sprintf(__("%s comments deleted"), $deleted) . "
\n"; } } - if ($spam) { - if ('1' == $spam) { + if ($spam) { + if ('1' == $spam) { echo __("1 comment marked as spam") . "
\n"; - } else { - echo sprintf(__("%s comments marked as spam"), $spam) . "
\n"; - } - } + } else { + echo sprintf(__("%s comments marked as spam"), $spam) . "
\n"; + } + } if ($ignored) { if ('1' == $ignored) { echo __("1 comment unchanged") . "
\n"; @@ -151,13 +151,13 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; - +
-

+

\n"; - echo $javascript; + $wpcommentsjavascript = 1; + $javascript = "\n"; + echo $javascript; } function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') { diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 74a4c633cf..93718f786c 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -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: '); diff --git a/wp-includes/compat.php b/wp-includes/compat.php index f32f99c986..d6006a481e 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -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 "
$code
"; + echo "
$code
"; } 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('_') ) { diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 4bd76d3720..634698dda4 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -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 = '
', - $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 = '
', $between = " ", - $show_images = true, $orderby = 'id', - $show_description = true, $limit = -1, $show_updated = 0) { + $after = '
', $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 = '
', - $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 = '
', ** 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', diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 747f0099da..94d2c58844 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -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('|
\s*
|', "\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('!()!', "$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', "

$1

\n", $pee); // make paragraphs, including one at the end - $pee = preg_replace('|

\s*?

|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace + $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "

$1

\n", $pee); // make paragraphs, including one at the end + $pee = preg_replace('|

\s*?

|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace $pee = preg_replace('!

\s*(]*>)\s*

!', "$1", $pee); // don't pee all over a tag $pee = preg_replace("|

(|", "$1", $pee); // problem with nested lists $pee = preg_replace('|

]*)>|i', "

", $pee); $pee = str_replace('

', '

', $pee); $pee = preg_replace('!

\s*(]*>)!', "$1", $pee); - $pee = preg_replace('!(]*>)\s*

!', "$1", $pee); + $pee = preg_replace('!(]*>)\s*

!', "$1", $pee); if ($br) { $pee = preg_replace('/<(script|style).*?<\/\\1>/se', 'str_replace("\n", "", "\\0")', $pee); $pee = preg_replace('|(?)\s*\n|', "
\n", $pee); // optionally make line breaks @@ -86,7 +86,7 @@ function wpautop($pee, $br = 1) { $pee = preg_replace('!
(\s*]*>)!', '$1', $pee); $pee = preg_replace('!()(.*?)!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '' ", $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); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index d8d20ccc46..e325301405 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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); } diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 221403adf8..bb36b9ade6 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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"); diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index b2b099c422..b536b9206a 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -17,7 +17,7 @@ function get_locale() { return $locale; } -// Return a translated string. +// Return a translated string. function __($text, $domain = 'default') { global $l10n; diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index bba7254128..151a98641b 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -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 . ''; $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 = ''; diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 5a6b7e410a..4bb291fdbe 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -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; diff --git a/wp-includes/post.php b/wp-includes/post.php index 1d0c897144..2048e71e97 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -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) ) { diff --git a/wp-includes/query.php b/wp-includes/query.php index 32bb714d11..8c95cbcd75 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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(); diff --git a/wp-includes/registration.php b/wp-includes/registration.php index 8ec38a4015..39b931c94f 100644 --- a/wp-includes/registration.php +++ b/wp-includes/registration.php @@ -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 ); diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index dfa27f3b5c..38765a3f3f 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -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 /some-text $sub1 = $submatchbase . '/([^/]+)/'; $sub1tb = $sub1 . $trackbackregex; //add trackback regex /trackback/... @@ -626,19 +626,19 @@ class WP_Rewrite { $sub1feed2 = $sub1 . $feedregex2; //and /(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: ///attachment/some-text $sub2 = $submatchbase . '/attachment/([^/]+)/'; $sub2tb = $sub2 . $trackbackregex; //and add trackbacks /attachment/trackback $sub2feed = $sub2 . $feedregex; //feeds, /attachment/feed/(atom|...) $sub2feed2 = $sub2 . $feedregex2; //and feeds again on to this /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 /2 for /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 /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 = "\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; diff --git a/wp-includes/rss.php b/wp-includes/rss.php index 067f217194..470421283b 100644 --- a/wp-includes/rss.php +++ b/wp-includes/rss.php @@ -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 field + var $incontent = false; // if in Atom 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(""); } @@ -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 diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index c7afd2d1a7..789c9dfea8 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -73,7 +73,7 @@ class WP_Scripts { } } } - + /** * Determines dependencies of scripts @@ -159,7 +159,7 @@ class WP_Scripts { endswitch; return false; } - + } class _WP_Script { diff --git a/wp-includes/user.php b/wp-includes/user.php index 784c24d71e..9f554f7d29 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -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 ) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 9cad948477..45792b5bd0 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -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); diff --git a/wp-links-opml.php b/wp-links-opml.php index 811a5e9d42..326bfc3cf9 100644 --- a/wp-links-opml.php +++ b/wp-links-opml.php @@ -16,11 +16,11 @@ if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) { ?>\n"; ?> - - Links for <?php echo get_bloginfo('name').$cat_name ?> - GMT - - + + Links for <?php echo get_bloginfo('name').$cat_name ?> + GMT + + cat_ID}"); foreach ((array) $bookmarks as $bookmark) { ?> - + '; ?> -ID; +if ( is_single() || is_page() ) + $tb_id = $posts[0]->ID; if ( !intval( $tb_id ) ) trackback_response(1, 'I really need an ID for this to work.'); diff --git a/xmlrpc.php b/xmlrpc.php index d207525adb..edbfd51552 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -66,48 +66,48 @@ class wp_xmlrpc_server extends IXR_Server { function wp_xmlrpc_server() { $this->methods = array( - // Blogger API - 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', - 'blogger.getUserInfo' => 'this:blogger_getUserInfo', - 'blogger.getPost' => 'this:blogger_getPost', - 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts', - 'blogger.getTemplate' => 'this:blogger_getTemplate', - 'blogger.setTemplate' => 'this:blogger_setTemplate', - 'blogger.newPost' => 'this:blogger_newPost', - 'blogger.editPost' => 'this:blogger_editPost', - 'blogger.deletePost' => 'this:blogger_deletePost', + // Blogger API + 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs', + 'blogger.getUserInfo' => 'this:blogger_getUserInfo', + 'blogger.getPost' => 'this:blogger_getPost', + 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts', + 'blogger.getTemplate' => 'this:blogger_getTemplate', + 'blogger.setTemplate' => 'this:blogger_setTemplate', + 'blogger.newPost' => 'this:blogger_newPost', + 'blogger.editPost' => 'this:blogger_editPost', + 'blogger.deletePost' => 'this:blogger_deletePost', - // MetaWeblog API (with MT extensions to structs) - 'metaWeblog.newPost' => 'this:mw_newPost', - 'metaWeblog.editPost' => 'this:mw_editPost', - 'metaWeblog.getPost' => 'this:mw_getPost', - 'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts', - 'metaWeblog.getCategories' => 'this:mw_getCategories', - 'metaWeblog.newMediaObject' => 'this:mw_newMediaObject', + // MetaWeblog API (with MT extensions to structs) + 'metaWeblog.newPost' => 'this:mw_newPost', + 'metaWeblog.editPost' => 'this:mw_editPost', + 'metaWeblog.getPost' => 'this:mw_getPost', + 'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts', + 'metaWeblog.getCategories' => 'this:mw_getCategories', + 'metaWeblog.newMediaObject' => 'this:mw_newMediaObject', - // MetaWeblog API aliases for Blogger API - // see http://www.xmlrpc.com/stories/storyReader$2460 - 'metaWeblog.deletePost' => 'this:blogger_deletePost', - 'metaWeblog.getTemplate' => 'this:blogger_getTemplate', - 'metaWeblog.setTemplate' => 'this:blogger_setTemplate', - 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs', + // MetaWeblog API aliases for Blogger API + // see http://www.xmlrpc.com/stories/storyReader$2460 + 'metaWeblog.deletePost' => 'this:blogger_deletePost', + 'metaWeblog.getTemplate' => 'this:blogger_getTemplate', + 'metaWeblog.setTemplate' => 'this:blogger_setTemplate', + 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs', - // MovableType API - 'mt.getCategoryList' => 'this:mt_getCategoryList', - 'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles', - 'mt.getPostCategories' => 'this:mt_getPostCategories', - 'mt.setPostCategories' => 'this:mt_setPostCategories', - 'mt.supportedMethods' => 'this:mt_supportedMethods', - 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters', - 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings', - 'mt.publishPost' => 'this:mt_publishPost', + // MovableType API + 'mt.getCategoryList' => 'this:mt_getCategoryList', + 'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles', + 'mt.getPostCategories' => 'this:mt_getPostCategories', + 'mt.setPostCategories' => 'this:mt_setPostCategories', + 'mt.supportedMethods' => 'this:mt_supportedMethods', + 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters', + 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings', + 'mt.publishPost' => 'this:mt_publishPost', - // PingBack - 'pingback.ping' => 'this:pingback_ping', - 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks', + // PingBack + 'pingback.ping' => 'this:pingback_ping', + 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks', - 'demo.sayHello' => 'this:sayHello', - 'demo.addTwoNumbers' => 'this:addTwoNumbers' + 'demo.sayHello' => 'this:sayHello', + 'demo.addTwoNumbers' => 'this:addTwoNumbers' ); $this->methods = apply_filters('xmlrpc_methods', $this->methods); $this->IXR_Server($this->methods); @@ -124,11 +124,11 @@ class wp_xmlrpc_server extends IXR_Server { } function login_pass_ok($user_login, $user_pass) { - if (!user_pass_ok($user_login, $user_pass)) { - $this->error = new IXR_Error(403, 'Bad login/pass combination.'); - return false; - } - return true; + if (!user_pass_ok($user_login, $user_pass)) { + $this->error = new IXR_Error(403, 'Bad login/pass combination.'); + return false; + } + return true; } function escape(&$array) { @@ -181,25 +181,25 @@ class wp_xmlrpc_server extends IXR_Server { $this->escape($args); - $user_login = $args[1]; - $user_pass = $args[2]; + $user_login = $args[1]; + $user_pass = $args[2]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - $user_data = get_userdatabylogin($user_login); + $user_data = get_userdatabylogin($user_login); - $struct = array( - 'nickname' => $user_data->nickname, - 'userid' => $user_data->ID, - 'url' => $user_data->user_url, - 'email' => $user_data->user_email, - 'lastname' => $user_data->last_name, - 'firstname' => $user_data->first_name - ); + $struct = array( + 'nickname' => $user_data->nickname, + 'userid' => $user_data->ID, + 'url' => $user_data->user_url, + 'email' => $user_data->user_email, + 'lastname' => $user_data->last_name, + 'firstname' => $user_data->first_name + ); - return $struct; + return $struct; } @@ -208,81 +208,81 @@ class wp_xmlrpc_server extends IXR_Server { $this->escape($args); - $post_ID = $args[1]; - $user_login = $args[2]; - $user_pass = $args[3]; + $post_ID = $args[1]; + $user_login = $args[2]; + $user_pass = $args[3]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - $user_data = get_userdatabylogin($user_login); - $post_data = wp_get_single_post($post_ID, ARRAY_A); + $user_data = get_userdatabylogin($user_login); + $post_data = wp_get_single_post($post_ID, ARRAY_A); - $categories = implode(',', wp_get_post_categories($post_ID)); + $categories = implode(',', wp_get_post_categories($post_ID)); - $content = ''.stripslashes($post_data['post_title']).''; - $content .= ''.$categories.''; - $content .= stripslashes($post_data['post_content']); + $content = ''.stripslashes($post_data['post_title']).''; + $content .= ''.$categories.''; + $content .= stripslashes($post_data['post_content']); - $struct = array( - 'userid' => $post_data['post_author'], - 'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])), - 'content' => $content, - 'postid' => $post_data['ID'] - ); + $struct = array( + 'userid' => $post_data['post_author'], + 'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])), + 'content' => $content, + 'postid' => $post_data['ID'] + ); - return $struct; + return $struct; } /* blogger.getRecentPosts ...gets recent posts */ function blogger_getRecentPosts($args) { - global $wpdb; + global $wpdb; $this->escape($args); - $blog_ID = $args[1]; /* though we don't use it yet */ - $user_login = $args[2]; - $user_pass = $args[3]; - $num_posts = $args[4]; + $blog_ID = $args[1]; /* though we don't use it yet */ + $user_login = $args[2]; + $user_pass = $args[3]; + $num_posts = $args[4]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - $posts_list = wp_get_recent_posts($num_posts); + $posts_list = wp_get_recent_posts($num_posts); - if (!$posts_list) { - $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); - return $this->error; - } + if (!$posts_list) { + $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); + return $this->error; + } - foreach ($posts_list as $entry) { - - $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); - $categories = implode(',', wp_get_post_categories($entry['ID'])); + foreach ($posts_list as $entry) { - $content = ''.stripslashes($entry['post_title']).''; - $content .= ''.$categories.''; - $content .= stripslashes($entry['post_content']); + $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); + $categories = implode(',', wp_get_post_categories($entry['ID'])); - $struct[] = array( - 'userid' => $entry['post_author'], - 'dateCreated' => new IXR_Date($post_date), - 'content' => $content, - 'postid' => $entry['ID'], - ); + $content = ''.stripslashes($entry['post_title']).''; + $content .= ''.$categories.''; + $content .= stripslashes($entry['post_content']); - } + $struct[] = array( + 'userid' => $entry['post_author'], + 'dateCreated' => new IXR_Date($post_date), + 'content' => $content, + 'postid' => $entry['ID'], + ); - $recent_posts = array(); - for ($j=0; $jescape($args); - $blog_ID = $args[0]; - $user_login = $args[1]; - $user_pass = $args[2]; - $num_posts = $args[3]; + $blog_ID = $args[0]; + $user_login = $args[1]; + $user_pass = $args[2]; + $num_posts = $args[3]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - $posts_list = wp_get_recent_posts($num_posts); + $posts_list = wp_get_recent_posts($num_posts); - if (!$posts_list) { - $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); - return $this->error; - } + if (!$posts_list) { + $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); + return $this->error; + } - foreach ($posts_list as $entry) { - - $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); - $categories = array(); - $catids = wp_get_post_categories($entry['ID']); - foreach($catids as $catid) { - $categories[] = get_cat_name($catid); - } + foreach ($posts_list as $entry) { - $post = get_extended($entry['post_content']); - $link = post_permalink($entry['ID']); + $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); + $categories = array(); + $catids = wp_get_post_categories($entry['ID']); + foreach($catids as $catid) { + $categories[] = get_cat_name($catid); + } - $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; - $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0; + $post = get_extended($entry['post_content']); + $link = post_permalink($entry['ID']); - $struct[] = array( - 'dateCreated' => new IXR_Date($post_date), - 'userid' => $entry['post_author'], - 'postid' => $entry['ID'], - 'description' => $post['main'], - 'title' => $entry['post_title'], - 'link' => $link, - 'permaLink' => $link, + $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0; + $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0; + + $struct[] = array( + 'dateCreated' => new IXR_Date($post_date), + 'userid' => $entry['post_author'], + 'postid' => $entry['ID'], + 'description' => $post['main'], + 'title' => $entry['post_title'], + 'link' => $link, + 'permaLink' => $link, // commented out because no other tool seems to use this // 'content' => $entry['post_content'], - 'categories' => $categories, - 'mt_excerpt' => $entry['post_excerpt'], - 'mt_text_more' => $post['extended'], - 'mt_allow_comments' => $allow_comments, - 'mt_allow_pings' => $allow_pings - ); + 'categories' => $categories, + 'mt_excerpt' => $entry['post_excerpt'], + 'mt_text_more' => $post['extended'], + 'mt_allow_comments' => $allow_comments, + 'mt_allow_pings' => $allow_pings + ); - } + } - $recent_posts = array(); - for ($j=0; $jescape($args); - $blog_ID = $args[0]; - $user_login = $args[1]; - $user_pass = $args[2]; + $blog_ID = $args[0]; + $user_login = $args[1]; + $user_pass = $args[2]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - $categories_struct = array(); + $categories_struct = array(); - // FIXME: can we avoid using direct SQL there? - if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) { - foreach ($cats as $cat) { - $struct['categoryId'] = $cat['cat_ID']; - $struct['description'] = $cat['cat_name']; - $struct['categoryName'] = $cat['cat_name']; - $struct['htmlUrl'] = wp_specialchars(get_category_link($cat['cat_ID'])); - $struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat['cat_ID'], $cat['cat_name'])); + // FIXME: can we avoid using direct SQL there? + if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) { + foreach ($cats as $cat) { + $struct['categoryId'] = $cat['cat_ID']; + $struct['description'] = $cat['cat_name']; + $struct['categoryName'] = $cat['cat_name']; + $struct['htmlUrl'] = wp_specialchars(get_category_link($cat['cat_ID'])); + $struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat['cat_ID'], $cat['cat_name'])); - $categories_struct[] = $struct; - } - } + $categories_struct[] = $struct; + } + } - return $categories_struct; + return $categories_struct; } @@ -852,72 +852,72 @@ class wp_xmlrpc_server extends IXR_Server { $this->escape($args); - $blog_ID = $args[0]; - $user_login = $args[1]; - $user_pass = $args[2]; - $num_posts = $args[3]; + $blog_ID = $args[0]; + $user_login = $args[1]; + $user_pass = $args[2]; + $num_posts = $args[3]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - $posts_list = wp_get_recent_posts($num_posts); + $posts_list = wp_get_recent_posts($num_posts); - if (!$posts_list) { - $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); - return $this->error; - } + if (!$posts_list) { + $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); + return $this->error; + } - foreach ($posts_list as $entry) { - - $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); + foreach ($posts_list as $entry) { - $struct[] = array( - 'dateCreated' => new IXR_Date($post_date), - 'userid' => $entry['post_author'], - 'postid' => $entry['ID'], - 'title' => $entry['post_title'], - ); + $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); - } + $struct[] = array( + 'dateCreated' => new IXR_Date($post_date), + 'userid' => $entry['post_author'], + 'postid' => $entry['ID'], + 'title' => $entry['post_title'], + ); - $recent_posts = array(); - for ($j=0; $jescape($args); - $blog_ID = $args[0]; - $user_login = $args[1]; - $user_pass = $args[2]; + $blog_ID = $args[0]; + $user_login = $args[1]; + $user_pass = $args[2]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - $categories_struct = array(); + $categories_struct = array(); - // FIXME: can we avoid using direct SQL there? - if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) { - foreach ($cats as $cat) { - $struct['categoryId'] = $cat['cat_ID']; - $struct['categoryName'] = $cat['cat_name']; + // FIXME: can we avoid using direct SQL there? + if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) { + foreach ($cats as $cat) { + $struct['categoryId'] = $cat['cat_ID']; + $struct['categoryName'] = $cat['cat_name']; - $categories_struct[] = $struct; - } - } + $categories_struct[] = $struct; + } + } - return $categories_struct; + return $categories_struct; } @@ -926,28 +926,28 @@ class wp_xmlrpc_server extends IXR_Server { $this->escape($args); - $post_ID = $args[0]; - $user_login = $args[1]; - $user_pass = $args[2]; + $post_ID = $args[0]; + $user_login = $args[1]; + $user_pass = $args[2]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - $categories = array(); - $catids = wp_get_post_categories(intval($post_ID)); - // first listed category will be the primary category - $isPrimary = true; - foreach($catids as $catid) { - $categories[] = array( - 'categoryName' => get_cat_name($catid), - 'categoryId' => $catid, - 'isPrimary' => $isPrimary - ); - $isPrimary = false; - } - - return $categories; + $categories = array(); + $catids = wp_get_post_categories(intval($post_ID)); + // first listed category will be the primary category + $isPrimary = true; + foreach($catids as $catid) { + $categories[] = array( + 'categoryName' => get_cat_name($catid), + 'categoryId' => $catid, + 'isPrimary' => $isPrimary + ); + $isPrimary = false; + } + + return $categories; } @@ -956,81 +956,81 @@ class wp_xmlrpc_server extends IXR_Server { $this->escape($args); - $post_ID = $args[0]; - $user_login = $args[1]; - $user_pass = $args[2]; - $categories = $args[3]; + $post_ID = $args[0]; + $user_login = $args[1]; + $user_pass = $args[2]; + $categories = $args[3]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - set_current_user(0, $user_login); - if ( !current_user_can('edit_post', $post_ID) ) - return new IXR_Error(401, 'Sorry, you can not edit this post.'); + set_current_user(0, $user_login); + if ( !current_user_can('edit_post', $post_ID) ) + return new IXR_Error(401, 'Sorry, you can not edit this post.'); - foreach($categories as $cat) { - $catids[] = $cat['categoryId']; - } + foreach($categories as $cat) { + $catids[] = $cat['categoryId']; + } - wp_set_post_categories($post_ID, $catids); + wp_set_post_categories($post_ID, $catids); - return true; + return true; } /* mt.supportedMethods ...returns an array of methods supported by this server */ function mt_supportedMethods($args) { - $supported_methods = array(); - foreach($this->methods as $key=>$value) { - $supported_methods[] = $key; - } + $supported_methods = array(); + foreach($this->methods as $key=>$value) { + $supported_methods[] = $key; + } - return $supported_methods; + return $supported_methods; } /* mt.supportedTextFilters ...returns an empty array because we don't - support per-post text filters yet */ + support per-post text filters yet */ function mt_supportedTextFilters($args) { - return array(); + return array(); } /* mt.getTrackbackPings ...returns trackbacks sent to a given post */ function mt_getTrackbackPings($args) { - global $wpdb; + global $wpdb; - $post_ID = intval($args); + $post_ID = intval($args); - $actual_post = wp_get_single_post($post_ID, ARRAY_A); + $actual_post = wp_get_single_post($post_ID, ARRAY_A); - if (!$actual_post) { - return new IXR_Error(404, 'Sorry, no such post.'); - } - - $comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID"); - - if (!$comments) { - return array(); - } - - $trackback_pings = array(); - foreach($comments as $comment) { - if ( 'trackback' == $comment->comment_type ) { - $content = $comment->comment_content; - $title = substr($content, 8, (strpos($content, '') - 8)); - $trackback_pings[] = array( - 'pingTitle' => $title, - 'pingURL' => $comment->comment_author_url, - 'pingIP' => $comment->comment_author_IP - ); + if (!$actual_post) { + return new IXR_Error(404, 'Sorry, no such post.'); } - } - return $trackback_pings; + $comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID"); + + if (!$comments) { + return array(); + } + + $trackback_pings = array(); + foreach($comments as $comment) { + if ( 'trackback' == $comment->comment_type ) { + $content = $comment->comment_content; + $title = substr($content, 8, (strpos($content, '') - 8)); + $trackback_pings[] = array( + 'pingTitle' => $title, + 'pingURL' => $comment->comment_author_url, + 'pingIP' => $comment->comment_author_IP + ); + } + } + + return $trackback_pings; } @@ -1039,30 +1039,30 @@ class wp_xmlrpc_server extends IXR_Server { $this->escape($args); - $post_ID = $args[0]; - $user_login = $args[1]; - $user_pass = $args[2]; + $post_ID = $args[0]; + $user_login = $args[1]; + $user_pass = $args[2]; - if (!$this->login_pass_ok($user_login, $user_pass)) { - return $this->error; - } + if (!$this->login_pass_ok($user_login, $user_pass)) { + return $this->error; + } - set_current_user(0, $user_login); - if ( !current_user_can('edit_post', $post_ID) ) - return new IXR_Error(401, 'Sorry, you can not edit this post.'); + set_current_user(0, $user_login); + if ( !current_user_can('edit_post', $post_ID) ) + return new IXR_Error(401, 'Sorry, you can not edit this post.'); - $postdata = wp_get_single_post($post_ID,ARRAY_A); + $postdata = wp_get_single_post($post_ID,ARRAY_A); - $postdata['post_status'] = 'publish'; + $postdata['post_status'] = 'publish'; - // retain old cats - $cats = wp_get_post_categories($post_ID); - $postdata['post_category'] = $cats; + // retain old cats + $cats = wp_get_post_categories($post_ID); + $postdata['post_category'] = $cats; $this->escape($postdata); - $result = wp_update_post($postdata); + $result = wp_update_post($postdata); - return $result; + return $result; } @@ -1073,7 +1073,7 @@ class wp_xmlrpc_server extends IXR_Server { /* pingback.ping gets a pingback and registers it */ function pingback_ping($args) { - global $wpdb, $wp_version; + global $wpdb, $wp_version; $this->escape($args); @@ -1090,7 +1090,7 @@ class wp_xmlrpc_server extends IXR_Server { // Check if the page linked to is in our site $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?'); + return new IXR_Error(0, 'Is there no link to us?'); // let's find which post is linked to // FIXME: does url_to_postid() cover all these cases already? @@ -1223,8 +1223,8 @@ class wp_xmlrpc_server extends IXR_Server { /* pingback.extensions.getPingbacks returns an array of URLs - that pingbacked the given URL - specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */ + that pingbacked the given URL + specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */ function pingback_extensions_getPingbacks($args) { global $wpdb;