diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 3ad9d317c6..c28934975b 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -189,7 +189,7 @@ class Custom_Image_Header { } function toggle_text(force) { - if(jQuery('#textcolor').val() == 'blank') { + if (jQuery('#textcolor').val() == 'blank') { //Show text jQuery( buttons.toString() ).show(); jQuery('#textcolor').val(''); diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index 58aa684bc2..9b0e929a3f 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -781,7 +781,7 @@ class Blogger_Import { // First line of headers is the HTTP response code $http_response_line = array_shift($response_header_lines); - if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; } + if (preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; } // put the rest of the headers in an array $response_header_array = array(); @@ -958,7 +958,7 @@ class AtomParser { $this->depth++; - if(!empty($this->in_content)) { + if (!empty($this->in_content)) { $attrs_prefix = array(); // resolve prefixes for attributes @@ -966,28 +966,28 @@ class AtomParser { $attrs_prefix[$this->ns_to_prefix($key)] = $this->xml_escape($value); } $attrs_str = join(' ', array_map( array( &$this, '_map_attrs_func' ), array_keys($attrs_prefix), array_values($attrs_prefix))); - if(strlen($attrs_str) > 0) { + if (strlen($attrs_str) > 0) { $attrs_str = " " . $attrs_str; } $xmlns_str = join(' ', array_map( array( &$this, '_map_xmlns_func' ), array_keys($this->ns_contexts[0]), array_values($this->ns_contexts[0]))); - if(strlen($xmlns_str) > 0) { + if (strlen($xmlns_str) > 0) { $xmlns_str = " " . $xmlns_str; } // handle self-closing tags (case: a new child found right-away, no text node) - if(count($this->in_content) == 2) { + if (count($this->in_content) == 2) { array_push($this->in_content, ">"); } array_push($this->in_content, "<". $this->ns_to_prefix($name) ."{$xmlns_str}{$attrs_str}"); - } else if(in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) { + } else if (in_array($tag, $this->ATOM_CONTENT_ELEMENTS) || in_array($tag, $this->ATOM_SIMPLE_ELEMENTS)) { $this->in_content = array(); $this->is_xhtml = $attrs['type'] == 'xhtml'; array_push($this->in_content, array($tag,$this->depth)); - } else if($tag == 'link') { + } else if ($tag == 'link') { array_push($this->entry->links, $attrs); - } else if($tag == 'category') { + } else if ($tag == 'category') { array_push($this->entry->categories, $attrs['term']); } @@ -998,11 +998,11 @@ class AtomParser { $tag = array_pop(split(":", $name)); - if(!empty($this->in_content)) { - if($this->in_content[0][0] == $tag && + if (!empty($this->in_content)) { + if ($this->in_content[0][0] == $tag && $this->in_content[0][1] == $this->depth) { array_shift($this->in_content); - if($this->is_xhtml) { + if ($this->is_xhtml) { $this->in_content = array_slice($this->in_content, 2, count($this->in_content)-3); } $this->entry->$tag = join('',$this->in_content); @@ -1035,7 +1035,7 @@ class AtomParser { function cdata($parser, $data) { #print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n"; - if(!empty($this->in_content)) { + if (!empty($this->in_content)) { // handle self-closing tags (case: text node found, need to close element started) if (strpos($this->in_content[count($this->in_content)-1], '<') !== false) { array_push($this->in_content, ">"); @@ -1053,11 +1053,11 @@ class AtomParser { $components = split(":", $qname); $name = array_pop($components); - if(!empty($components)) { + if (!empty($components)) { $ns = join(":",$components); - foreach($this->ns_contexts as $context) { - foreach($context as $mapping) { - if($mapping[1] == $ns && strlen($mapping[0]) > 0) { + foreach ($this->ns_contexts as $context) { + foreach ($context as $mapping) { + if ($mapping[1] == $ns && strlen($mapping[0]) > 0) { return "$mapping[0]:$name"; } } diff --git a/wp-admin/import/blogware.php b/wp-admin/import/blogware.php index 531ceddc7d..5497bfb6d4 100644 --- a/wp-admin/import/blogware.php +++ b/wp-admin/import/blogware.php @@ -62,7 +62,7 @@ class BW_Import { flush(); preg_match('||is', $post, $post_type); $post_type = $post_type[1]; - if($post_type == "photo") { + if ($post_type == "photo") { preg_match('|(.*?)|is', $post, $post_title); } else { preg_match('|(.*?)|is', $post, $post_title); @@ -82,7 +82,7 @@ class BW_Import { $cat_index++; } - if(strcasecmp($post_type, "photo") === 0) { + if (strcasecmp($post_type, "photo") === 0) { preg_match('|(.*?)|is', $post, $post_content); $post_content = ''; $post_content = $this->unhtmlentities($post_content); @@ -117,7 +117,7 @@ class BW_Import { echo ''; break; } - if(0 != count($categories)) + if (0 != count($categories)) wp_create_categories($categories, $post_id); } diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php index a330c62c42..c11a1dc410 100644 --- a/wp-admin/import/dotclear.php +++ b/wp-admin/import/dotclear.php @@ -12,8 +12,7 @@ Add These Functions to make our lives easier **/ -if(!function_exists('get_comment_count')) -{ +if (!function_exists('get_comment_count')) { /** * Get the comment count for posts. * @@ -30,8 +29,7 @@ if(!function_exists('get_comment_count')) } } -if(!function_exists('link_exists')) -{ +if (!function_exists('link_exists')) { /** * Check whether link already exists. * @@ -180,11 +178,9 @@ class Dotclear_Import { $count = 0; $dccat2wpcat = array(); // Do the Magic - if(is_array($categories)) - { + if (is_array($categories)) { echo '

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

'; - foreach ($categories as $category) - { + foreach ($categories as $category) { $count++; extract($category); @@ -193,12 +189,9 @@ class Dotclear_Import { $title = $wpdb->escape(csc ($cat_libelle)); $desc = $wpdb->escape(csc ($cat_desc)); - if($cinfo = category_exists($name)) - { + if ($cinfo = category_exists($name)) { $ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc)); - } - else - { + } else { $ret_id = wp_insert_category(array('category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc)); } $dccat2wpcat[$id] = $ret_id; @@ -213,19 +206,16 @@ class Dotclear_Import { return false; } - function users2wp($users='') - { + function users2wp($users='') { // General Housekeeping global $wpdb; $count = 0; $dcid2wpid = array(); // Midnight Mojo - if(is_array($users)) - { + if (is_array($users)) { echo '

'.__('Importing Users...').'

'; - foreach($users as $user) - { + foreach ($users as $user) { $count++; extract($user); @@ -233,8 +223,7 @@ class Dotclear_Import { $name = $wpdb->escape(csc ($name)); $RealName = $wpdb->escape(csc ($user_pseudo)); - if($uinfo = get_userdatabylogin($name)) - { + if ($uinfo = get_userdatabylogin($name)) { $ret_id = wp_insert_user(array( 'ID' => $uinfo->ID, @@ -244,9 +233,7 @@ class Dotclear_Import { 'user_url' => 'http://', 'display_name' => $Realname) ); - } - else - { + } else { $ret_id = wp_insert_user(array( 'user_login' => $user_id, 'user_nicename' => csc ($user_pseudo), @@ -262,12 +249,12 @@ class Dotclear_Import { // Update Usermeta Data $user = new WP_User($ret_id); $wp_perms = $user_level + 1; - if(10 == $wp_perms) { $user->set_role('administrator'); } - else if(9 == $wp_perms) { $user->set_role('editor'); } - else if(5 <= $wp_perms) { $user->set_role('editor'); } - else if(4 <= $wp_perms) { $user->set_role('author'); } - else if(3 <= $wp_perms) { $user->set_role('contributor'); } - else if(2 <= $wp_perms) { $user->set_role('contributor'); } + if (10 == $wp_perms) { $user->set_role('administrator'); } + else if (9 == $wp_perms) { $user->set_role('editor'); } + else if (5 <= $wp_perms) { $user->set_role('editor'); } + else if (4 <= $wp_perms) { $user->set_role('author'); } + else if (3 <= $wp_perms) { $user->set_role('contributor'); } + else if (2 <= $wp_perms) { $user->set_role('contributor'); } else { $user->set_role('subscriber'); } update_usermeta( $ret_id, 'wp_user_level', $wp_perms); @@ -289,8 +276,7 @@ class Dotclear_Import { }// End function user2wp() - function posts2wp($posts='') - { + function posts2wp($posts='') { // General Housekeeping global $wpdb; $count = 0; @@ -298,8 +284,7 @@ class Dotclear_Import { $cats = array(); // Do the Magic - if(is_array($posts)) - { + if (is_array($posts)) { echo '

'.__('Importing Posts...').'

'; foreach($posts as $post) { @@ -327,8 +312,7 @@ class Dotclear_Import { // Import Post data into WordPress - if($pinfo = post_exists($Title,$post_content)) - { + if ($pinfo = post_exists($Title,$post_content)) { $ret_id = wp_insert_post(array( 'ID' => $pinfo, 'post_author' => $authorid, @@ -347,9 +331,7 @@ class Dotclear_Import { ); if ( is_wp_error( $ret_id ) ) return $ret_id; - } - else - { + } else { $ret_id = wp_insert_post(array( 'post_author' => $authorid, 'post_date' => $post_dt, @@ -375,9 +357,9 @@ class Dotclear_Import { $category1 = get_category_by_slug($post_cat_name); $category1 = $category1->term_id; - if($cat1 = $category1) { $cats[1] = $cat1; } + if ($cat1 = $category1) { $cats[1] = $cat1; } - if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); } + if (!empty($cats)) { wp_set_post_categories($ret_id, $cats); } } } // Store ID translation for later use @@ -387,8 +369,7 @@ class Dotclear_Import { return true; } - function comments2wp($comments='') - { + function comments2wp($comments='') { // General Housekeeping global $wpdb; $count = 0; @@ -396,11 +377,9 @@ class Dotclear_Import { $postarr = get_option('dcposts2wpposts'); // Magic Mojo - if(is_array($comments)) - { + if (is_array($comments)) { echo '

'.__('Importing Comments...').'

'; - foreach($comments as $comment) - { + foreach ($comments as $comment) { $count++; extract($comment); @@ -449,18 +428,15 @@ class Dotclear_Import { return false; } - function links2wp($links='') - { + function links2wp($links='') { // General Housekeeping global $wpdb; $count = 0; // Deal with the links - if(is_array($links)) - { + if (is_array($links)) { echo '

'.__('Importing Links...').'

'; - foreach($links as $link) - { + foreach ($links as $link) { $count++; extract($link); @@ -475,7 +451,7 @@ class Dotclear_Import { $linkname = $wpdb->escape(csc ($label)); $description = $wpdb->escape(csc ($title)); - if($linfo = link_exists($linkname)) { + if ($linfo = link_exists($linkname)) { $ret_id = wp_insert_link(array( 'link_id' => $linfo, 'link_url' => $href, @@ -504,8 +480,7 @@ class Dotclear_Import { return false; } - function import_categories() - { + function import_categories() { // Category Import $cats = $this->get_dc_cats(); $this->cat2wp($cats); @@ -520,8 +495,7 @@ class Dotclear_Import { } - function import_users() - { + function import_users() { // User Import $users = $this->get_dc_users(); $this->users2wp($users); @@ -532,8 +506,7 @@ class Dotclear_Import { echo ''; } - function import_posts() - { + function import_posts() { // Post Import $posts = $this->get_dc_posts(); $result = $this->posts2wp($posts); @@ -546,8 +519,7 @@ class Dotclear_Import { echo ''; } - function import_comments() - { + function import_comments() { // Comment Import $comments = $this->get_dc_comments(); $this->comments2wp($comments); @@ -571,8 +543,7 @@ class Dotclear_Import { echo ''; } - function cleanup_dcimport() - { + function cleanup_dcimport() { delete_option('dcdbprefix'); delete_option('dc_cats'); delete_option('dcid2wpid'); @@ -589,8 +560,7 @@ class Dotclear_Import { $this->tips(); } - function tips() - { + function tips() { echo '

'.__('Welcome to WordPress. We hope (and expect!) that you will find this platform incredibly rewarding! As a new WordPress user coming from DotClear, there are some things that we would like to point out. Hopefully, they will help your transition go as smoothly as possible.').'

'; echo '

'.__('Users').'

'; echo '

'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn’t have that login in DotClear, why should you have it here? Instead we have taken care to import all of your users into our system. Unfortunately there is one downside. Because both WordPress and DotClear uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users. Every user has the same username, but their passwords are reset to password123. So Log in and change it.'), '/wp-login.php').'

'; @@ -608,8 +578,7 @@ class Dotclear_Import { echo '

'.sprintf(__('That’s it! What are you waiting for? Go log in!'), '../wp-login.php').'

'; } - function db_form() - { + function db_form() { echo ''; printf('', __('DotClear Database User:')); printf('', __('DotClear Database Password:')); @@ -620,8 +589,7 @@ class Dotclear_Import { echo '
'; } - function dispatch() - { + function dispatch() { if (empty ($_GET['step'])) $step = 0; @@ -629,44 +597,37 @@ class Dotclear_Import { $step = (int) $_GET['step']; $this->header(); - if ( $step > 0 ) - { + if ( $step > 0 ) { check_admin_referer('import-dotclear'); - if($_POST['dbuser']) - { + if ($_POST['dbuser']) { if(get_option('dcuser')) delete_option('dcuser'); add_option('dcuser', sanitize_user($_POST['dbuser'], true)); } - if($_POST['dbpass']) - { + if ($_POST['dbpass']) { if(get_option('dcpass')) delete_option('dcpass'); add_option('dcpass', sanitize_user($_POST['dbpass'], true)); } - if($_POST['dbname']) - { - if(get_option('dcname')) + if ($_POST['dbname']) { + if (get_option('dcname')) delete_option('dcname'); add_option('dcname', sanitize_user($_POST['dbname'], true)); } - if($_POST['dbhost']) - { + if ($_POST['dbhost']) { if(get_option('dchost')) delete_option('dchost'); add_option('dchost', sanitize_user($_POST['dbhost'], true)); } - if($_POST['dccharset']) - { - if(get_option('dccharset')) + if ($_POST['dccharset']) { + if (get_option('dccharset')) delete_option('dccharset'); add_option('dccharset', sanitize_user($_POST['dccharset'], true)); } - if($_POST['dbprefix']) - { - if(get_option('dcdbprefix')) + if ($_POST['dbprefix']) { + if (get_option('dcdbprefix')) delete_option('dcdbprefix'); add_option('dcdbprefix', sanitize_user($_POST['dbprefix'], true)); } @@ -674,8 +635,7 @@ class Dotclear_Import { } - switch ($step) - { + switch ($step) { default: case 0 : $this->greet(); @@ -705,8 +665,7 @@ class Dotclear_Import { $this->footer(); } - function Dotclear_Import() - { + function Dotclear_Import() { // Nothing. } } diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index 6b0d098169..87fae2a6c9 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -156,7 +156,7 @@ class WP_Filesystem_Base { $this->cache[ $folder ] = $folder; return $folder; } - if( $return = $this->search_for_folder($folder) ) + if ( $return = $this->search_for_folder($folder) ) $this->cache[ $folder ] = $return; return $return; } @@ -288,8 +288,8 @@ class WP_Filesystem_Base { $legal = array('', 'w', 'r', 'x', '-'); $attarray = preg_split('//', $mode); - for($i=0; $i < count($attarray); $i++) - if($key = array_search($attarray[$i], $legal)) + for ($i=0; $i < count($attarray); $i++) + if ($key = array_search($attarray[$i], $legal)) $realmode .= $legal[$key]; $mode = str_pad($realmode, 9, '-'); diff --git a/wp-admin/includes/class-wp-filesystem-ssh2.php b/wp-admin/includes/class-wp-filesystem-ssh2.php index 41cfffbde5..a3f5660a1e 100644 --- a/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -171,7 +171,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { function cwd() { $cwd = $this->run_command('pwd'); - if( $cwd ) + if ( $cwd ) $cwd = trailingslashit($cwd); return $cwd; } @@ -239,10 +239,10 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { } function copy($source, $destination, $overwrite = false ) { - if( ! $overwrite && $this->exists($destination) ) + if ( ! $overwrite && $this->exists($destination) ) return false; $content = $this->get_contents($source); - if( false === $content) + if ( false === $content) return false; return $this->put_contents($destination, $content); } diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 5a15d4cd90..98464dd6ea 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -912,7 +912,7 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { return; $this->plugin = $this->upgrader->plugin_info(); - if( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){ + if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){ show_message(__('Reactivating the plugin…')); echo ''; } diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 99dbc5ffb1..c2f0ab6b99 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -109,10 +109,10 @@ function get_real_file_to_edit( $file ) { * @return bool|array False on failure, Else array of files */ function list_files( $folder = '', $levels = 100 ) { - if( empty($folder) ) + if ( empty($folder) ) return false; - if( ! $levels ) + if ( ! $levels ) return false; $files = array(); @@ -122,7 +122,7 @@ function list_files( $folder = '', $levels = 100 ) { continue; if ( is_dir( $folder . '/' . $file ) ) { $files2 = list_files( $folder . '/' . $file, $levels - 1); - if( $files2 ) + if ( $files2 ) $files = array_merge($files, $files2 ); else $files[] = $folder . '/' . $file . '/'; @@ -621,7 +621,7 @@ function WP_Filesystem( $args = false, $context = false ) { if ( ! class_exists("WP_Filesystem_$method") ) { $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method); - if( ! file_exists($abstraction_file) ) + if ( ! file_exists($abstraction_file) ) return; require_once($abstraction_file); @@ -670,7 +670,7 @@ function WP_Filesystem( $args = false, $context = false ) { function get_filesystem_method($args = array(), $context = false) { $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' - if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ + if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ if ( !$context ) $context = WP_CONTENT_DIR; $context = trailingslashit($context); @@ -807,12 +807,12 @@ jQuery(function($){ - + - + @@ -827,7 +827,7 @@ jQuery(function($){
- diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index b6becc2d6b..b223c224ae 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -266,8 +266,8 @@ function wp_reset_vars( $vars ) { * @param unknown_type $message */ function show_message($message) { - if( is_wp_error($message) ){ - if( $message->get_error_data() ) + if ( is_wp_error($message) ){ + if ( $message->get_error_data() ) $message = $message->get_error_message() . ': ' . $message->get_error_data(); else $message = $message->get_error_message(); diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index 1646309e9f..f720e4c52a 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -3,7 +3,7 @@ function check_upload_size( $file ) { if ( get_site_option( 'upload_space_check_disabled' ) ) { return $file; } - if( $file['error'] != '0' ) // there's already an error + if ( $file['error'] != '0' ) // there's already an error return $file; if ( defined( 'WP_IMPORTING' ) ) @@ -13,14 +13,14 @@ function check_upload_size( $file ) { $space_used = get_dirsize( BLOGUPLOADDIR ); $space_left = $space_allowed - $space_used; $file_size = filesize( $file['tmp_name'] ); - if( $space_left < $file_size ) + if ( $space_left < $file_size ) $file['error'] = sprintf( __( 'Not enough space to upload. %1$s Kb needed.' ), number_format( ($file_size - $space_left) /1024 ) ); - if( $file_size > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) + if ( $file_size > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) ) $file['error'] = sprintf(__('This file is too big. Files must be less than %1$s Kb in size.'), get_site_option( 'fileupload_maxk', 1500 ) ); - if( upload_is_user_over_quota( false ) ) { + if ( upload_is_user_over_quota( false ) ) { $file['error'] = __('You have used your space quota. Please delete files before uploading.'); } - if( $file['error'] != '0' ) + if ( $file['error'] != '0' ) wp_die( $file['error'] . ' ' . __( 'Back' ) . '' ); return $file; @@ -90,7 +90,7 @@ function wpmu_delete_blog($blog_id, $drop = false) { $blogs = get_site_option( "blog_list" ); if ( is_array( $blogs ) ) { foreach( $blogs as $n => $blog ) { - if( $blog[ 'blog_id' ] == $blog_id ) { + if ( $blog[ 'blog_id' ] == $blog_id ) { unset( $blogs[ $n ] ); } } @@ -138,7 +138,7 @@ function wpmu_delete_user($id) { } function confirm_delete_users( $users ) { - if( !is_array( $users ) ) + if ( !is_array( $users ) ) return false; echo '

' . __( 'Transfer posts before deleting users:' ) . '

'; @@ -147,25 +147,25 @@ function confirm_delete_users( $users ) { echo ''; wp_nonce_field( 'allusers' ); foreach ( (array) $_POST['allusers'] as $key => $val ) { - if( $val != '' && $val != '0' ) { + if ( $val != '' && $val != '0' ) { $user = new WP_User( $val ); if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) ) { wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a site admnistrator.' ), $user->user_login ) ); } echo "\n"; $blogs = get_blogs_of_user( $val, true ); - if( !empty( $blogs ) ) { + if ( !empty( $blogs ) ) { foreach ( (array) $blogs as $key => $details ) { $blog_users = get_users_of_blog( $details->userblog_id ); - if( is_array( $blog_users ) && !empty( $blog_users ) ) { + if ( is_array( $blog_users ) && !empty( $blog_users ) ) { echo "

{$details->blogname} "; echo "\n"; @@ -182,17 +182,17 @@ function confirm_delete_users( $users ) { function wpmu_get_blog_allowedthemes( $blog_id = 0 ) { $themes = get_themes(); - if( $blog_id != 0 ) + if ( $blog_id != 0 ) switch_to_blog( $blog_id ); $blog_allowed_themes = get_option( "allowedthemes" ); - if( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes + if ( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes $blog_allowed_themes = get_option( "allowed_themes" ); - if( is_array( $blog_allowed_themes ) ) { + if ( is_array( $blog_allowed_themes ) ) { foreach( (array) $themes as $key => $theme ) { $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); - if( isset( $blog_allowed_themes[ $key ] ) == true ) { + if ( isset( $blog_allowed_themes[ $key ] ) == true ) { $blog_allowedthemes[ $theme_key ] = 1; } } @@ -202,7 +202,7 @@ function wpmu_get_blog_allowedthemes( $blog_id = 0 ) { } } - if( $blog_id != 0 ) + if ( $blog_id != 0 ) restore_current_blog(); return $blog_allowed_themes; @@ -256,9 +256,9 @@ function profile_page_email_warning_ob_content( $content ) { function update_profile_email() { global $current_user, $wpdb; - if( isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { + if ( isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { $new_email = get_option( $current_user->ID . '_new_email' ); - if( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { + if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { $user->ID = $current_user->ID; $user->user_email = wp_specialchars( trim( $new_email[ 'newemail' ] ) ); if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) { @@ -277,16 +277,16 @@ function send_confirmation_on_profile_email() { if ( ! is_object($errors) ) $errors = new WP_Error(); - if( $current_user->id != $_POST[ 'user_id' ] ) + if ( $current_user->id != $_POST[ 'user_id' ] ) return false; - if( $current_user->user_email != $_POST[ 'email' ] ) { + if ( $current_user->user_email != $_POST[ 'email' ] ) { if ( !is_email( $_POST[ 'email' ] ) ) { $errors->add( 'user_email', __( "ERROR: The e-mail address isn't correct." ), array( 'form-field' => 'email' ) ); return; } - if( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST[ 'email' ] ) ) ) { + if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST[ 'email' ] ) ) ) { $errors->add( 'user_email', __( "ERROR: The e-mail address is already used." ), array( 'form-field' => 'email' ) ); delete_option( $current_user->ID . '_new_email' ); return; @@ -327,7 +327,7 @@ add_action( 'personal_options_update', 'send_confirmation_on_profile_email' ); function new_user_email_admin_notice() { global $current_user; - if( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET[ 'updated' ] ) && $email = get_option( $current_user->ID . '_new_email' ) ) + if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET[ 'updated' ] ) && $email = get_option( $current_user->ID . '_new_email' ) ) echo "

" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email[ 'newemail' ] ) . "
"; } add_action( 'admin_notices', 'new_user_email_admin_notice' ); @@ -335,14 +335,14 @@ add_action( 'admin_notices', 'new_user_email_admin_notice' ); function get_site_allowed_themes() { $themes = get_themes(); $allowed_themes = get_site_option( 'allowedthemes' ); - if( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) { + if ( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) { $allowed_themes = get_site_option( "allowed_themes" ); // convert old allowed_themes format - if( !is_array( $allowed_themes ) ) { + if ( !is_array( $allowed_themes ) ) { $allowed_themes = array(); } else { foreach( (array) $themes as $key => $theme ) { $theme_key = wp_specialchars( $theme[ 'Stylesheet' ] ); - if( isset( $allowed_themes[ $key ] ) == true ) { + if ( isset( $allowed_themes[ $key ] ) == true ) { $allowedthemes[ $theme_key ] = 1; } } @@ -354,9 +354,9 @@ function get_site_allowed_themes() { function get_space_allowed() { $spaceAllowed = get_option("blog_upload_space"); - if( $spaceAllowed == false ) + if ( $spaceAllowed == false ) $spaceAllowed = get_site_option("blog_upload_space"); - if( empty($spaceAllowed) || !is_numeric($spaceAllowed) ) + if ( empty($spaceAllowed) || !is_numeric($spaceAllowed) ) $spaceAllowed = 50; return $spaceAllowed; @@ -369,7 +369,7 @@ function display_space_usage() { if ($used > $space) $percentused = '100'; else $percentused = ( $used / $space ) * 100; - if( $space > 1000 ) { + if ( $space > 1000 ) { $space = number_format( $space / 1024 ); $space .= __('GB'); } else { @@ -407,13 +407,13 @@ function dashboard_quota() { @@ -430,11 +430,11 @@ function update_user_status( $id, $pref, $value, $refresh = 1 ) { $wpdb->update( $wpdb->users, array( $pref => $value ), array( 'ID' => $id ) ); - if( $refresh == 1 ) + if ( $refresh == 1 ) refresh_user_details($id); - if( $pref == 'spam' ) { - if( $value == 1 ) + if ( $pref == 'spam' ) { + if ( $value == 1 ) do_action( "make_spam_user", $id ); else do_action( "make_ham_user", $id ); @@ -482,7 +482,7 @@ function wpmu_checkAvailableSpace() { $dir->close(); $size = $size / 1024 / 1024; - if( ($spaceAllowed - $size) <= 0 ) { + if ( ($spaceAllowed - $size) <= 0 ) { wp_die( __('Sorry, you must delete files before you can upload any more.') ); } } @@ -496,8 +496,8 @@ function format_code_lang( $code = '' ) { } function sync_category_tag_slugs( $term, $taxonomy ) { - if( $taxonomy == 'category' || $taxonomy == 'post_tag' ) { - if( is_object( $term ) ) { + if ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) { + if ( is_object( $term ) ) { $term->slug = sanitize_title( $term->name ); } else { $term[ 'slug' ] = sanitize_title( $term[ 'name' ] ); @@ -520,7 +520,7 @@ function redirect_user_to_blog() { $blog = get_active_blog_for_user( $current_user->ID ); $dashboard_blog = get_dashboard_blog(); - if( is_object( $blog ) ) { + if ( is_object( $blog ) ) { $protocol = ( is_ssl() ? 'https://' : 'http://' ); wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case" exit; @@ -625,17 +625,17 @@ function mu_media_buttons() { $media_title = __('Add Media'); $mu_media_buttons = get_site_option( 'mu_media_buttons' ); $out = ''; - if( $mu_media_buttons[ 'image' ] ) { + if ( $mu_media_buttons[ 'image' ] ) { $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&type=image"); $image_title = __('Add an Image'); $out .= "$image_title"; } - if( $mu_media_buttons[ 'video' ] ) { + if ( $mu_media_buttons[ 'video' ] ) { $video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&type=video"); $video_title = __('Add Video'); $out .= "$video_title"; } - if( $mu_media_buttons[ 'audio' ] ) { + if ( $mu_media_buttons[ 'audio' ] ) { $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&type=audio"); $audio_title = __('Add Audio'); $out .= "$audio_title"; @@ -648,15 +648,15 @@ remove_action( 'media_buttons', 'media_buttons' ); /* Warn the admin if SECRET SALT information is missing from wp-config.php */ function secret_salt_warning() { - if( !is_super_admin() ) + if ( !is_super_admin() ) return; $secret_keys = array( 'NONCE_KEY', 'AUTH_KEY', 'AUTH_SALT', 'LOGGED_IN_KEY', 'LOGGED_IN_SALT', 'SECURE_AUTH_KEY', 'SECURE_AUTH_SALT' ); $out = ''; foreach( $secret_keys as $key ) { - if( !defined( $key ) ) + if ( !defined( $key ) ) $out .= "define( '$key', '" . wp_generate_password() . wp_generate_password() . "' );
"; } - if( $out != '' ) { + if ( $out != '' ) { $msg = sprintf( __( 'Warning! WordPress encrypts user cookies, but you must add the following lines to %swp-config.php for it to be more secure.
Please add the code before the line, /* That\'s all, stop editing! Happy blogging. */' ), ABSPATH ); $msg .= "
$out
"; @@ -686,19 +686,19 @@ add_action ( 'myblogs_update', 'profile_update_primary_blog' ); function admin_notice_feed() { global $current_user; - if( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' ) + if ( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' ) return; - if( isset( $_GET[ 'feed_dismiss' ] ) ) + if ( isset( $_GET[ 'feed_dismiss' ] ) ) update_user_option( $current_user->id, 'admin_feed_dismiss', $_GET[ 'feed_dismiss' ], true ); $url = get_site_option( 'admin_notice_feed' ); - if( $url == '' ) + if ( $url == '' ) return; include_once( ABSPATH . 'wp-includes/rss.php' ); $rss = @fetch_rss( $url ); - if( isset($rss->items) && 1 <= count($rss->items) ) { - if( md5( $rss->items[0][ 'title' ] ) == get_user_option( 'admin_feed_dismiss', $current_user->id ) ) + if ( isset($rss->items) && 1 <= count($rss->items) ) { + if ( md5( $rss->items[0][ 'title' ] ) == get_user_option( 'admin_feed_dismiss', $current_user->id ) ) return; $item = $rss->items[0]; $msg = "

" . wp_specialchars( $item[ 'title' ] ) . "

\n"; @@ -714,7 +714,7 @@ function admin_notice_feed() { $link = clean_url( strip_tags( $item['link'] ) ); $msg .= "

" . $content . " " . __( 'Read More' ) . " " . __( "Dismiss" ) . "

"; echo "
$msg
"; - } elseif( is_super_admin() ) { + } elseif ( is_super_admin() ) { printf("
" . __("Your feed at %s is empty.") . "
", wp_specialchars( $url )); } } @@ -722,7 +722,7 @@ add_action( 'admin_notices', 'admin_notice_feed' ); function site_admin_notice() { global $current_user, $wp_db_version; - if( !is_super_admin() ) + if ( !is_super_admin() ) return false; printf("
" . __("Hi %s! You're logged in as a site administrator.") . "
", $current_user->user_login); if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) { @@ -732,13 +732,13 @@ function site_admin_notice() { add_action( 'admin_notices', 'site_admin_notice' ); function avoid_blog_page_permalink_collision( $data, $postarr ) { - if( is_subdomain_install() ) + if ( is_subdomain_install() ) return $data; - if( $data[ 'post_type' ] != 'page' ) + if ( $data[ 'post_type' ] != 'page' ) return $data; - if( !isset( $data[ 'post_name' ] ) || $data[ 'post_name' ] == '' ) + if ( !isset( $data[ 'post_name' ] ) || $data[ 'post_name' ] == '' ) return $data; - if( !is_main_blog() ) + if ( !is_main_blog() ) return $data; $post_name = $data[ 'post_name' ]; @@ -747,7 +747,7 @@ function avoid_blog_page_permalink_collision( $data, $postarr ) { $post_name .= mt_rand( 1, 10 ); $c ++; } - if( $post_name != $data[ 'post_name' ] ) { + if ( $post_name != $data[ 'post_name' ] ) { $data[ 'post_name' ] = $post_name; } return $data; @@ -1033,7 +1033,7 @@ function check_wpmu_plugins_on_bulk_activate( $plugins ) { function remove_edit_plugin_link( $action_links, $plugin_file, $plugin_data, $context ) { foreach( $action_links as $t => $link ) { - if( !strpos( $link, __( "Open this file in the Plugin Editor" ) ) ) + if ( !strpos( $link, __( "Open this file in the Plugin Editor" ) ) ) $links[ $t ] = $link; } return $links; @@ -1050,25 +1050,25 @@ function choose_primary_blog() { ID ); $primary_blog = get_usermeta($current_user->ID, 'primary_blog'); - if( count( $all_blogs ) > 1 ) { + if ( count( $all_blogs ) > 1 ) { $found = false; ?> ID, 'primary_blog', $blog->userblog_id ); } - } elseif( count( $all_blogs ) == 1 ) { + } elseif ( count( $all_blogs ) == 1 ) { $blog = array_shift( $all_blogs ); echo $blog->domain; - if( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list. + if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list. update_usermeta( $current_user->ID, 'primary_blog', $blog->userblog_id ); } else { echo "N/A"; @@ -1081,7 +1081,7 @@ function choose_primary_blog() { } add_action ( 'myblogs_allblogs_options', 'choose_primary_blog' ); -if( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) ) { +if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) ) { add_action( 'admin_init', 'update_profile_email' ); add_action( 'admin_init', 'profile_page_email_warning_ob_start' ); } @@ -1132,7 +1132,7 @@ function blogs_listing() { global $current_user; $blogs = get_blogs_of_user( $current_user->ID ); - if( !$blogs || ( is_array( $blogs ) && empty( $blogs ) ) ) { + if ( !$blogs || ( is_array( $blogs ) && empty( $blogs ) ) ) { wp_die( __( 'You must be a member of at least one blog to use this page.' ) ); } @@ -1140,7 +1140,7 @@ function blogs_listing() { $title = apply_filters( 'my_blogs_title', __( 'My Blogs' ) ); ?>
- +

diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index 7df983eea8..4886014771 100644 --- a/wp-admin/includes/plugin-install.php +++ b/wp-admin/includes/plugin-install.php @@ -28,7 +28,7 @@ */ function plugins_api($action, $args = null) { - if( is_array($args) ) + if ( is_array($args) ) $args = (object)$args; if ( !isset($args->per_page) ) @@ -325,10 +325,10 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
'; - foreach( (array) $plugins as $plugin ){ + foreach ( (array) $plugins as $plugin ){ if ( is_object($plugin) ) $plugin = (array) $plugin; @@ -349,12 +349,12 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){ $name = strip_tags($title . ' ' . $version); $author = $plugin['author']; - if( ! empty($plugin['author']) ) + if ( ! empty($plugin['author']) ) $author = ' ' . sprintf( __('By %s'), $author ) . '.'; $author = wp_kses($author, $plugins_allowedtags); - if( isset($plugin['homepage']) ) + if ( isset($plugin['homepage']) ) $title = '' . $title . ''; $action_links = array(); @@ -423,7 +423,7 @@ function install_plugin_information() { $api->$key = wp_kses($api->$key, $plugins_allowedtags); $section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English. - if( empty($section) || ! isset($api->sections[ $section ]) ) + if ( empty($section) || ! isset($api->sections[ $section ]) ) $section = array_shift( $section_titles = array_keys((array)$api->sections) ); iframe_header( __('Plugin Install') ); diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index dd48afd109..c2183babb6 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -92,8 +92,8 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) { function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) { //Translate fields - if( $translate && ! empty($plugin_data['TextDomain']) ) { - if( ! empty( $plugin_data['DomainPath'] ) ) + if ( $translate && ! empty($plugin_data['TextDomain']) ) { + if ( ! empty( $plugin_data['DomainPath'] ) ) load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file). $plugin_data['DomainPath']); else load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file)); @@ -113,7 +113,7 @@ function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = $plugin_data['Author'] = '' . $plugin_data['Author'] . ''; $plugin_data['Description'] = wptexturize( $plugin_data['Description'] ); - if( ! empty($plugin_data['Author']) ) + if ( ! empty($plugin_data['Author']) ) $plugin_data['Description'] .= ' ' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.'; } @@ -198,7 +198,7 @@ function get_plugins($plugin_folder = '') { $wp_plugins = array (); $plugin_root = WP_PLUGIN_DIR; - if( !empty($plugin_folder) ) + if ( !empty($plugin_folder) ) $plugin_root .= $plugin_folder; // Files in wp-content/plugins directory @@ -330,7 +330,7 @@ function deactivate_plugins($plugins, $silent= false) { foreach ( $plugins as $plugin ) { $plugin = plugin_basename($plugin); - if( ! is_plugin_active($plugin) ) + if ( ! is_plugin_active($plugin) ) continue; if ( ! $silent ) do_action( 'deactivate_plugin', trim( $plugin ) ); @@ -398,7 +398,7 @@ function activate_plugins($plugins, $redirect = '') { function delete_plugins($plugins, $redirect = '' ) { global $wp_filesystem; - if( empty($plugins) ) + if ( empty($plugins) ) return false; $checked = array(); @@ -410,7 +410,7 @@ function delete_plugins($plugins, $redirect = '' ) { if ( false === ($credentials = request_filesystem_credentials($url)) ) { $data = ob_get_contents(); ob_end_clean(); - if( ! empty($data) ){ + if ( ! empty($data) ){ include_once( ABSPATH . 'wp-admin/admin-header.php'); echo $data; include( ABSPATH . 'wp-admin/admin-footer.php'); @@ -423,7 +423,7 @@ function delete_plugins($plugins, $redirect = '' ) { request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again $data = ob_get_contents(); ob_end_clean(); - if( ! empty($data) ){ + if ( ! empty($data) ){ include_once( ABSPATH . 'wp-admin/admin-header.php'); echo $data; include( ABSPATH . 'wp-admin/admin-footer.php'); @@ -1064,7 +1064,7 @@ add_filter( 'whitelist_options', 'option_update_filter' ); * @return unknown */ function add_option_whitelist( $new_options, $options = '' ) { - if( $options == '' ) { + if ( $options == '' ) { global $whitelist_options; } else { $whitelist_options = $options; @@ -1094,7 +1094,7 @@ function add_option_whitelist( $new_options, $options = '' ) { * @return unknown */ function remove_option_whitelist( $del_options, $options = '' ) { - if( $options == '' ) { + if ( $options == '' ) { global $whitelist_options; } else { $whitelist_options = $options; @@ -1103,7 +1103,7 @@ function remove_option_whitelist( $del_options, $options = '' ) { foreach( $keys as $key ) { if ( isset($whitelist_options[ $page ]) && is_array($whitelist_options[ $page ]) ) { $pos = array_search( $key, $whitelist_options[ $page ] ); - if( $pos !== false ) + if ( $pos !== false ) unset( $whitelist_options[ $page ][ $pos ] ); } } diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 0378a31eb7..36df3aeb3a 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -535,7 +535,7 @@ function wp_write_post() { */ function write_post() { $result = wp_write_post(); - if( is_wp_error( $result ) ) + if ( is_wp_error( $result ) ) wp_die( $result->get_error_message() ); else return $result; diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 8a7f62a499..2aa3dcb2db 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1307,13 +1307,13 @@ function get_inline_data($post) {
' . mysql2date( 's', $post->post_date, false ) . '
' . esc_html( $post->post_password ) . '
'; - if( $post->post_type == 'page' ) + if ( $post->post_type == 'page' ) echo '
' . $post->post_parent . '
' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '
'; - if( $post->post_type == 'post' ) + if ( $post->post_type == 'post' ) echo '
' . esc_html( str_replace( ',', ', ', get_tags_to_edit($post->ID) ) ) . '
' . implode( ',', wp_get_post_categories( $post->ID ) ) . '
diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 6b0d8932a5..1f4fbefad9 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -65,7 +65,7 @@ function delete_theme($template) { request_filesystem_credentials($url, '', true); // Failed to connect, Error and request again $data = ob_get_contents(); ob_end_clean(); - if( ! empty($data) ){ + if ( ! empty($data) ) { include_once( ABSPATH . 'wp-admin/admin-header.php'); echo $data; include( ABSPATH . 'wp-admin/admin-footer.php'); diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index b784059e72..258482fd4d 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -82,7 +82,7 @@ function find_core_update( $version, $locale ) { } function core_update_footer( $msg = '' ) { - if( is_multisite() && !is_super_admin() ) + if ( is_multisite() && !is_super_admin() ) return false; if ( !current_user_can('manage_options') ) @@ -118,7 +118,7 @@ function core_update_footer( $msg = '' ) { add_filter( 'update_footer', 'core_update_footer' ); function update_nag() { - if( is_multisite() && !is_super_admin() ) + if ( is_multisite() && !is_super_admin() ) return false; global $pagenow; @@ -142,7 +142,7 @@ add_action( 'admin_notices', 'update_nag', 3 ); // Called directly from dashboard function update_right_now_message() { - if( is_multisite() && !is_super_admin() ) + if ( is_multisite() && !is_super_admin() ) return false; $cur = get_preferred_from_update_core(); @@ -205,7 +205,7 @@ function wp_plugin_update_row( $file, $plugin_data ) { } function wp_update_plugin($plugin, $feedback = '') { - if( is_multisite() && !is_super_admin() ) + if ( is_multisite() && !is_super_admin() ) return false; diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 86fb467833..94938d01f2 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -267,7 +267,7 @@ function wp_upgrade() { if ( $wp_db_version == $wp_current_db_version ) return; - if( ! is_blog_installed() ) + if ( ! is_blog_installed() ) return; wp_check_mysql_version(); @@ -631,7 +631,7 @@ function upgrade_160() { // populate comment_count field of posts table $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" ); - if( is_array( $comments ) ) + if ( is_array( $comments ) ) foreach ($comments as $comment) $wpdb->update( $wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID) ); @@ -1199,9 +1199,9 @@ function dbDelta($queries, $execute = true) { global $wpdb; // Separate individual queries into an array - if( !is_array($queries) ) { + if ( !is_array($queries) ) { $queries = explode( ';', $queries ); - if('' == $queries[count($queries) - 1]) array_pop($queries); + if ('' == $queries[count($queries) - 1]) array_pop($queries); } $cqueries = array(); // Creation Queries @@ -1210,30 +1210,26 @@ function dbDelta($queries, $execute = true) { // Create a tablename index for an array ($cqueries) of queries foreach($queries as $qry) { - if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { + if (preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) { $cqueries[trim( strtolower($matches[1]), '`' )] = $qry; $for_update[$matches[1]] = 'Created table '.$matches[1]; - } - else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) { + } else if (preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) { array_unshift($cqueries, $qry); - } - else if(preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) { + } else if (preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) { $iqueries[] = $qry; - } - else if(preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) { + } else if (preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) { $iqueries[] = $qry; - } - else { + } else { // Unrecognized query type } } // Check to see which tables and fields exist - if($tables = $wpdb->get_col('SHOW TABLES;')) { + if ($tables = $wpdb->get_col('SHOW TABLES;')) { // For every table in the database - foreach($tables as $table) { + foreach ($tables as $table) { // If a table query exists for the database table... - if( array_key_exists(strtolower($table), $cqueries) ) { + if ( array_key_exists(strtolower($table), $cqueries) ) { // Clear the field and index arrays unset($cfields); unset($indices); @@ -1247,15 +1243,14 @@ function dbDelta($queries, $execute = true) { //echo "
\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."

"; // For every field line specified in the query - foreach($flds as $fld) { + foreach ($flds as $fld) { // Extract the field name preg_match("|^([^ ]*)|", trim($fld), $fvals); $fieldname = trim( $fvals[1], '`' ); // Verify the found field name $validfield = true; - switch(strtolower($fieldname)) - { + switch (strtolower($fieldname)) { case '': case 'primary': case 'index': @@ -1269,7 +1264,7 @@ function dbDelta($queries, $execute = true) { $fld = trim($fld); // If it's a valid field, add it to the field array - if($validfield) { + if ($validfield) { $cfields[strtolower($fieldname)] = trim($fld, ", \n"); } } @@ -1278,15 +1273,15 @@ function dbDelta($queries, $execute = true) { $tablefields = $wpdb->get_results("DESCRIBE {$table};"); // For every field in the table - foreach($tablefields as $tablefield) { + foreach ($tablefields as $tablefield) { // If the table field exists in the field array... - if(array_key_exists(strtolower($tablefield->Field), $cfields)) { + if (array_key_exists(strtolower($tablefield->Field), $cfields)) { // Get the field type from the query preg_match("|".$tablefield->Field." ([^ ]*( unsigned)?)|i", $cfields[strtolower($tablefield->Field)], $matches); $fieldtype = $matches[1]; // Is actual field type different from the field type in query? - if($tablefield->Type != $fieldtype) { + if ($tablefield->Type != $fieldtype) { // Add a query to change the column type $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)]; $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}"; @@ -1294,10 +1289,9 @@ function dbDelta($queries, $execute = true) { // Get the default value from the array //echo "{$cfields[strtolower($tablefield->Field)]}
"; - if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) { + if (preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) { $default_value = $matches[1]; - if($tablefield->Default != $default_value) - { + if ($tablefield->Default != $default_value) { // Add a query to change the column's default value $cqueries[] = "ALTER TABLE {$table} ALTER COLUMN {$tablefield->Field} SET DEFAULT '{$default_value}'"; $for_update[$table.'.'.$tablefield->Field] = "Changed default value of {$table}.{$tablefield->Field} from {$tablefield->Default} to {$default_value}"; @@ -1306,14 +1300,13 @@ function dbDelta($queries, $execute = true) { // Remove the field from the array (so it's not added) unset($cfields[strtolower($tablefield->Field)]); - } - else { + } else { // This field exists in the table, but not in the creation queries? } } // For every remaining field specified for the table - foreach($cfields as $fieldname => $fielddef) { + foreach ($cfields as $fieldname => $fielddef) { // Push a query line into $cqueries that adds the field to that table $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef"; $for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname; @@ -1323,12 +1316,12 @@ function dbDelta($queries, $execute = true) { // Fetch the table index structure from the database $tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};"); - if($tableindices) { + if ($tableindices) { // Clear the index array unset($index_ary); // For every index in the table - foreach($tableindices as $tableindex) { + foreach ($tableindices as $tableindex) { // Add the index to the index data array $keyname = $tableindex->Key_name; $index_ary[$keyname]['columns'][] = array('fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part); @@ -1336,32 +1329,31 @@ function dbDelta($queries, $execute = true) { } // For each actual index in the index array - foreach($index_ary as $index_name => $index_data) { + foreach ($index_ary as $index_name => $index_data) { // Build a create string to compare to the query $index_string = ''; - if($index_name == 'PRIMARY') { + if ($index_name == 'PRIMARY') { $index_string .= 'PRIMARY '; - } - else if($index_data['unique']) { + } else if($index_data['unique']) { $index_string .= 'UNIQUE '; } $index_string .= 'KEY '; - if($index_name != 'PRIMARY') { + if ($index_name != 'PRIMARY') { $index_string .= $index_name; } $index_columns = ''; // For each column in the index - foreach($index_data['columns'] as $column_data) { - if($index_columns != '') $index_columns .= ','; + foreach ($index_data['columns'] as $column_data) { + if ($index_columns != '') $index_columns .= ','; // Add the field to the column list string $index_columns .= $column_data['fieldname']; - if($column_data['subpart'] != '') { + if ($column_data['subpart'] != '') { $index_columns .= '('.$column_data['subpart'].')'; } } // Add the column list to the index create string $index_string .= ' ('.$index_columns.')'; - if(!(($aindex = array_search($index_string, $indices)) === false)) { + if (!(($aindex = array_search($index_string, $indices)) === false)) { unset($indices[$aindex]); //echo "
{$table}:
Found index:".$index_string."
\n"; } @@ -1386,8 +1378,8 @@ function dbDelta($queries, $execute = true) { } $allqueries = array_merge($cqueries, $iqueries); - if($execute) { - foreach($allqueries as $query) { + if ($execute) { + foreach ($allqueries as $query) { //echo "
".print_r($query, true)."
\n"; $wpdb->query($query); } diff --git a/wp-admin/ms-edit.php b/wp-admin/ms-edit.php index 3f22cb9c68..7a23d1f185 100644 --- a/wp-admin/ms-edit.php +++ b/wp-admin/ms-edit.php @@ -204,10 +204,10 @@ switch ( $_GET['action'] ) { } if ( $_POST['update_home_url'] == 'update' ) { - if( get_option( 'siteurl' ) != 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ) + if ( get_option( 'siteurl' ) != 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ) update_option( 'siteurl', 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ); - if( get_option( 'home' ) != 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ) + if ( get_option( 'home' ) != 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ) update_option( 'home', 'http://' . $_POST['blog']['domain'] . $_POST['blog']['path'] ); } @@ -245,7 +245,7 @@ switch ( $_GET['action'] ) { } // remove user - if( is_array( $_POST[ 'blogusers' ] ) ) { + if ( is_array( $_POST[ 'blogusers' ] ) ) { reset( $_POST[ 'blogusers' ] ); foreach ( (array) $_POST[ 'blogusers' ] as $key => $val ) remove_user_from_blog( $key, $id ); diff --git a/wp-admin/ms-options.php b/wp-admin/ms-options.php index 6f641034f2..5ebc1ed8f5 100644 --- a/wp-admin/ms-options.php +++ b/wp-admin/ms-options.php @@ -46,7 +46,7 @@ if (isset($_GET['updated'])) { @@ -64,7 +64,7 @@ if (isset($_GET['updated'])) { - @@ -231,7 +231,7 @@ if (isset($_GET['updated'])) {
" size="40" />" size="40" />
size="40" /> size="40" />

size="40" />
size="40" /> +

size="40" />
size="40" />
', __('No plugins match your request.'), '
@@ -55,7 +55,7 @@ if (isset($_GET['updated'])) {

- " . __('If registration is disabled, please set "NOBLOGREDIRECT" in wp-config.php to a url you will redirect visitors to if they visit a non existant blog.') . "

"; } ?>
@@ -201,16 +201,16 @@ if (isset($_GET['updated'])) {

-
-
+

+
+
-
-
+
+


- domain . $current_site->path . 'feed/' ) + domain . $current_site->path . 'feed/' ) echo __( "A good one to use would be the feed from your main blog: " ) . 'http://' . $current_site->domain . $current_site->path . 'feed/'; ?>
@@ -251,12 +251,12 @@ if (isset($_GET['updated'])) {

(These settings may be overridden by blog owners)') ?>

diff --git a/wp-admin/ms-sites.php b/wp-admin/ms-sites.php index ea99b29284..0230998267 100644 --- a/wp-admin/ms-sites.php +++ b/wp-admin/ms-sites.php @@ -95,7 +95,7 @@ switch( $_GET['action'] ) { +
/> @@ -108,36 +108,36 @@ switch( $_GET['action'] ) {
-
/>
- /> - /> + /> + />
- /> - /> + /> + />
- /> - /> + /> + />
- /> - /> + /> + />
- /> - /> + /> + />
@@ -151,7 +151,7 @@ switch( $_GET['action'] ) { $val ) { - if( $val['option_name'] == 'default_role' ) { + if ( $val['option_name'] == 'default_role' ) { $editblog_default_role = $val['option_value']; } $disabled = ''; @@ -191,13 +191,13 @@ switch( $_GET['action'] ) { $themes = get_themes(); $blog_allowed_themes = wpmu_get_blog_allowedthemes( $id ); $allowed_themes = get_site_option( "allowedthemes" ); - if( $allowed_themes == false ) { + if ( $allowed_themes == false ) { $allowed_themes = array_keys( $themes ); } $out = ''; foreach( $themes as $key => $theme ) { $theme_key = wp_specialchars( $theme['Stylesheet'] ); - if( isset($allowed_themes[$theme_key] ) == false ) { + if ( isset($allowed_themes[$theme_key] ) == false ) { $checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : ''; $out .= ' '.$key.' @@ -222,19 +222,19 @@ switch( $_GET['action'] ) {

' . __('Blog Users') . '

'; echo ''; echo ""; reset($blogusers); foreach ( (array) $blogusers as $key => $val ) { $t = @unserialize( $val->meta_value ); - if( is_array( $t ) ) { + if ( is_array( $t ) ) { reset( $t ); $existing_role = key( $t ); } echo ''; - if( $val->user_id != $current_user->data->ID ) { + if ( $val->user_id != $current_user->data->ID ) { ?> $column_display_name) { $column_link = " $col ) { - if( get_blog_status( $blog['blog_id'], $status ) == 1 ) { + if ( get_blog_status( $blog['blog_id'], $status ) == 1 ) { $bgcolour = "style='background: $col'"; } } @@ -479,17 +479,17 @@ switch( $_GET['action'] ) { $controlActions[] = '' . __('Edit') . ''; $controlActions[] = "" . __('Backend') . ''; - if( get_blog_status( $blog['blog_id'], "deleted" ) == '1' ) + if ( get_blog_status( $blog['blog_id'], "deleted" ) == '1' ) $controlActions[] = '' . __('Activate') . ''; else $controlActions[] = '' . __('Deactivate') . ''; - if( get_blog_status( $blog['blog_id'], "archived" ) == '1' ) + if ( get_blog_status( $blog['blog_id'], "archived" ) == '1' ) $controlActions[] = '' . __('Unarchive') . ''; else $controlActions[] = '' . __('Archive') . ''; - if( get_blog_status( $blog['blog_id'], "spam" ) == '1' ) + if ( get_blog_status( $blog['blog_id'], "spam" ) == '1' ) $controlActions[] = '' . __('Not Spam') . ''; else $controlActions[] = '' . __("Spam") . ''; @@ -534,7 +534,7 @@ switch( $_GET['action'] ) { foreach ( $blogusers as $key => $val ) { echo '' . $val->user_login . ' ('.$val->user_email.')
'; } - if( $blogusers_warning != '' ) { + if ( $blogusers_warning != '' ) { echo '' . $blogusers_warning . '
'; } } @@ -544,7 +544,7 @@ switch( $_GET['action'] ) { break; case 'plugins': ?> - + @@ -552,7 +552,7 @@ switch( $_GET['action'] ) { - + diff --git a/wp-admin/ms-upgrade-site.php b/wp-admin/ms-upgrade-site.php index af095af7cd..4a0e6666a7 100644 --- a/wp-admin/ms-upgrade-site.php +++ b/wp-admin/ms-upgrade-site.php @@ -25,14 +25,14 @@ switch( $_GET['action'] ) { } $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A ); - if( is_array( $blogs ) ) { + if ( is_array( $blogs ) ) { echo " $column_display_name) { - if( $column_id == 'blogs' ) { + if ( $column_id == 'blogs' ) { echo ''; - } elseif( $column_id == 'checkbox') { + } elseif ( $column_id == 'checkbox') { echo ''; } else { ?> - + @@ -163,7 +163,7 @@ if ( $_GET['updated'] == 'true' ) { $bgcolour = ""; foreach ( $status_list as $status => $col ) { - if( $user[$status] ) { + if ( $user[$status] ) { $bgcolour = "style='background: $col'"; } } @@ -216,7 +216,7 @@ if ( $_GET['updated'] == 'true' ) { ?> diff --git a/wp-admin/options.php b/wp-admin/options.php index 7d6bca6845..51fd0b3394 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -40,7 +40,7 @@ if ( !current_user_can('manage_options') ) if ( is_multisite() && is_super_admin() && $_GET[ 'adminhash' ] ) { $new_admin_details = get_option( 'adminhash' ); - if( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && $new_admin_details[ 'newemail' ] != '' ) { + if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && $new_admin_details[ 'newemail' ] != '' ) { update_option( "admin_email", $new_admin_details[ 'newemail' ] ); delete_option( "adminhash" ); delete_option( "new_admin_email" ); @@ -130,7 +130,7 @@ $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name foreach ( (array) $options as $option) : $disabled = ''; $option->option_name = esc_attr($option->option_name); - if( $option->option_name == '' ) + if ( $option->option_name == '' ) continue; if ( is_serialized($option->option_value) ) { if ( is_serialized_string($option->option_value) ) { diff --git a/wp-admin/plugin-install.php b/wp-admin/plugin-install.php index 1164e53efb..89b5718341 100644 --- a/wp-admin/plugin-install.php +++ b/wp-admin/plugin-install.php @@ -36,11 +36,11 @@ $tabs = apply_filters('install_plugins_tabs', $tabs ); $nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs); //If a non-valid menu tab has been selected, And its not a non-menu action. -if( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) { +if ( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) { $tab_actions = array_keys($tabs); $tab = $tab_actions[0]; } -if( empty($paged) ) +if ( empty($paged) ) $paged = 1; wp_enqueue_style( 'plugin-install' ); diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 58e893e446..5568d7c289 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -165,12 +165,12 @@ if ( !empty($action) ) { foreach ( (array) $plugins as $plugin ) { if ( '.' == dirname($plugin) ) { $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin; - if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) + if ( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) $plugin_info[ $plugin ] = $data; } else { //Locate all the files in that folder: $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) ); - if( $files ) { + if ( $files ) { $files_to_delete = array_merge($files_to_delete, $files); } //Get plugins list from that folder @@ -505,7 +505,7 @@ function print_plugin_actions($context, $field_name = 'action' ) { - + diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index e911b65453..a8bede6a63 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -38,7 +38,7 @@ function press_it() { $content = isset($_POST['content']) ? $_POST['content'] : ''; $upload = false; - if( !empty($_POST['photo_src']) && current_user_can('upload_files') ) { + if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) { foreach( (array) $_POST['photo_src'] as $key => $image) { // see if files exist in content - we don't want to upload non-used selected files. if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) { @@ -46,7 +46,7 @@ function press_it() { $upload = media_sideload_image($image, $post_ID, $desc); // Replace the POSTED content with correct uploaded ones. Regex contains fix for Magic Quotes - if( !is_wp_error($upload) ) + if ( !is_wp_error($upload) ) $content = preg_replace('/]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content); } } @@ -184,7 +184,7 @@ if ( !empty($_REQUEST['ajax']) ) { */ function get_images_from_uri($uri) { $uri = preg_replace('/\/#.+?$/','', $uri); - if( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') ) + if ( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') ) return "'" . esc_attr( html_entity_decode($uri) ) . "'"; $content = wp_remote_fopen($uri); if ( false === $content ) @@ -198,9 +198,9 @@ if ( !empty($_REQUEST['ajax']) ) { $sources = array(); foreach ($matches[3] as $src) { // if no http in url - if(strpos($src, 'http') === false) + if (strpos($src, 'http') === false) // if it doesn't have a relative uri - if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0) + if ( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0) $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); else $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src); @@ -553,7 +553,7 @@ var photostorage = false;
  • <?php _e('Embed a Video'); ?>
  • - +
  • diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index f50844630b..8a818b817b 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -158,7 +158,7 @@ if ($allowed_files) : // If we have two files of the same name prefer the one in the Template Directory // This means that we display the correct files for child themes which overload Templates as well as Styles - if( array_key_exists($description, $template_mapping ) ) { + if ( array_key_exists($description, $template_mapping ) ) { if ( false !== strpos( $template_file, $template_dir ) ) { $template_mapping[ $description ] = array( _get_template_edit_filename($template_file, $template_dir), $filedesc ); } diff --git a/wp-admin/theme-install.php b/wp-admin/theme-install.php index 844866151b..fea431fae2 100644 --- a/wp-admin/theme-install.php +++ b/wp-admin/theme-install.php @@ -41,11 +41,11 @@ $tabs = apply_filters('install_themes_tabs', $tabs ); $nonmenu_tabs = apply_filters('install_themes_nonmenu_tabs', $nonmenu_tabs); //If a non-valid menu tab has been selected, And its not a non-menu action. -if( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) { +if ( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) { $tab_actions = array_keys($tabs); $tab = $tab_actions[0]; } -if( empty($paged) ) +if ( empty($paged) ) $paged = 1; $body_id = $tab; diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 1b245c4ef2..895afc4e18 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -16,21 +16,21 @@ if ( is_multisite() ) { $themes = get_themes(); $ct = current_theme_info(); $allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes() ); - if( $allowed_themes == false ) + if ( $allowed_themes == false ) $allowed_themes = array(); $blog_allowed_themes = wpmu_get_blog_allowedthemes(); - if( is_array( $blog_allowed_themes ) ) + if ( is_array( $blog_allowed_themes ) ) $allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes ); - if( $blog_id != 1 ) + if ( $blog_id != 1 ) unset( $allowed_themes[ "h3" ] ); - if( isset( $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] ) == false ) + if ( isset( $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] ) == false ) $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] = true; reset( $themes ); - foreach( $themes as $key => $theme ) { - if( isset( $allowed_themes[ wp_specialchars( $theme[ 'Stylesheet' ] ) ] ) == false ) { + foreach ( $themes as $key => $theme ) { + if ( isset( $allowed_themes[ wp_specialchars( $theme[ 'Stylesheet' ] ) ] ) == false ) { unset( $themes[ $key ] ); } } @@ -67,7 +67,7 @@ add_thickbox(); wp_enqueue_script( 'theme-preview' ); require_once('admin-header.php'); -if( is_multisite() && is_super_admin() ) { +if ( is_multisite() && is_super_admin() ) { ?>

    Themes Admin page before they appear here.'); ?>

    diff --git a/wp-admin/update.php b/wp-admin/update.php index 304c81f8b9..4eab8ac0bf 100644 --- a/wp-admin/update.php +++ b/wp-admin/update.php @@ -40,17 +40,17 @@ if ( isset($_GET['action']) ) { wp_die(__('You do not have sufficient permissions to update plugins for this blog.')); check_admin_referer('activate-plugin_' . $plugin); - if( ! isset($_GET['failure']) && ! isset($_GET['success']) ) { + if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) { wp_redirect( 'update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] ); activate_plugin($plugin); wp_redirect( 'update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] ); die(); } iframe_header( __('Plugin Reactivation'), true ); - if( isset($_GET['success']) ) + if ( isset($_GET['success']) ) echo '

    ' . __('Plugin reactivated successfully.') . '

    '; - if( isset($_GET['failure']) ){ + if ( isset($_GET['failure']) ){ echo '

    ' . __('Plugin failed to reactivate due to a fatal error.') . '

    '; if ( defined('E_RECOVERABLE_ERROR') ) diff --git a/wp-admin/upgrade.php b/wp-admin/upgrade.php index 5e5f8f0614..3cee5a14c2 100644 --- a/wp-admin/upgrade.php +++ b/wp-admin/upgrade.php @@ -85,7 +85,7 @@ switch ( $step ) : $backto = !empty($_GET['backto']) ? stripslashes( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/'; $backto = esc_url_raw( $backto ); $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/'); - if( $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = '{$wpdb->blogid}'" ) ) { + if ( $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = '{$wpdb->blogid}'" ) ) { $wpdb->query( "UPDATE {$wpdb->blog_versions} SET db_version = '{$wp_db_version}' WHERE blog_id = '{$wpdb->blogid}'" ); } else { $wpdb->query( "INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());" ); diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index bd0a66d8f7..1001ccbc04 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -92,16 +92,16 @@ if ( !is_multisite() ) { // WPMU must delete the user from the current blog if WP added him after editing. $delete_role = false; $blog_prefix = $wpdb->get_blog_prefix(); - if( $user_id != $current_user->ID ) { + if ( $user_id != $current_user->ID ) { $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" ); - if( null == $cap && $_POST[ 'role' ] == '' ) { + if ( null == $cap && $_POST[ 'role' ] == '' ) { $_POST[ 'role' ] = 'contributor'; $delete_role = true; } } if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) ) $errors = edit_user($user_id); - if( $delete_role ) // stops users being added to current blog when they are edited + if ( $delete_role ) // stops users being added to current blog when they are edited update_usermeta( $user_id, $blog_prefix . 'capabilities' , '' ); } diff --git a/wp-admin/user-new.php b/wp-admin/user-new.php index 28cdba06cd..532fa94ed6 100644 --- a/wp-admin/user-new.php +++ b/wp-admin/user-new.php @@ -53,13 +53,13 @@ if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) { } else { $user_login = preg_replace( "/\s+/", '', sanitize_user( $_REQUEST[ 'user_login' ], true ) ); $user_details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE user_login = %s AND user_email = %s", $user_login, $_REQUEST[ 'email' ] ) ); - if( $user_details ) { + if ( $user_details ) { // Adding an existing user to this blog $new_user_email = wp_specialchars(trim($_REQUEST['email'])); $redirect = 'user-new.php'; $username = $user_details->user_login; $user_id = $user_details->ID; - if( ($username != null && is_site_admin( $username ) == false ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) { + if ( ($username != null && is_site_admin( $username ) == false ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) { $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' ); } else { if ( isset( $_POST[ 'noconfirmation' ] ) && is_site_admin() ) { diff --git a/wp-admin/users.php b/wp-admin/users.php index c75b963076..eefaa44663 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -92,7 +92,7 @@ case 'dodelete': if ( ! current_user_can('delete_user', $id) ) wp_die(__('You can’t delete that user.')); - if($id == $current_user->ID) { + if ($id == $current_user->ID) { $update = 'err_admin_del'; continue; } diff --git a/wp-app.php b/wp-app.php index 0290ebbaa7..c2875266b3 100644 --- a/wp-app.php +++ b/wp-app.php @@ -284,7 +284,7 @@ class AtomServer { } // redirect to /service in case no path is found. - if(strlen($path) == 0 || $path == '/') + if (strlen($path) == 0 || $path == '/') $this->redirect($this->get_service_url()); // check to see if AtomPub is enabled @@ -663,7 +663,7 @@ EOD; $this->get_accepted_content_type($this->atom_content_types); $parser = new AtomParser(); - if(!$parser->parse()) { + if (!$parser->parse()) { $this->bad_request(); } @@ -805,7 +805,7 @@ EOD; $location = "{$upload_dir['basedir']}/{$location}"; - if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext'])) + if (!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext'])) $this->internal_error(__('Error ocurred while accessing post metadata for file location.')); $fp = fopen("php://input", "rb"); @@ -899,7 +899,7 @@ EOD; */ function get_attachments_url($page = null) { $url = $this->app_base . $this->MEDIA_PATH; - if(isset($page) && is_int($page)) { + if (isset($page) && is_int($page)) { $url .= "/$page"; } return $url; @@ -936,7 +936,7 @@ EOD; * @return string */ function get_entry_url($postID = null) { - if(!isset($postID)) { + if (!isset($postID)) { global $post; $postID = (int) $post->ID; } @@ -967,7 +967,7 @@ EOD; * @return string */ function get_media_url($postID = null) { - if(!isset($postID)) { + if (!isset($postID)) { global $post; $postID = (int) $post->ID; } @@ -1000,14 +1000,14 @@ EOD; global $entry; log_app('function',"set_current_entry($postID)"); - if(!isset($postID)) { + if (!isset($postID)) { // $this->bad_request(); $this->not_found(); } $entry = wp_get_single_post($postID,ARRAY_A); - if(!isset($entry) || !isset($entry['ID'])) + if (!isset($entry) || !isset($entry['ID'])) $this->not_found(); return; @@ -1058,7 +1058,7 @@ EOD; $this->ENTRY_PATH = $post_type; - if(!isset($page)) { + if (!isset($page)) { $page = 1; } $page = (int) $page; @@ -1087,10 +1087,10 @@ EOD; <?php bloginfo_rss('name') ?> - + - + @@ -1171,7 +1171,7 @@ EOD; -post_type == 'attachment') { ?> +post_type == 'attachment') { ?> @@ -1364,7 +1364,7 @@ EOD; break; } header("Content-Type: $this->ATOM_CONTENT_TYPE"); - if(isset($ctloc)) + if (isset($ctloc)) header('Content-Location: ' . $ctloc); header('Location: ' . $edit); status_header('201'); @@ -1419,7 +1419,7 @@ EOD; header('Content-Type: ' . $ctype); header('Content-Disposition: attachment; filename=atom.xml'); header('Date: '. date('r')); - if($this->do_output) + if ($this->do_output) echo $xml; log_app('function', "output:\n$xml"); exit; @@ -1458,7 +1458,7 @@ EOD; // if using mod_rewrite/ENV hack // http://www.besthostratings.com/articles/http-auth-php-cgi.html - if(isset($_SERVER['HTTP_AUTHORIZATION'])) { + if (isset($_SERVER['HTTP_AUTHORIZATION'])) { list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); } else if (isset($_SERVER['REDIRECT_REMOTE_USER'])) { @@ -1469,7 +1469,7 @@ EOD; } // If Basic Auth is working... - if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { + if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']); $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); @@ -1493,11 +1493,11 @@ EOD; */ function get_accepted_content_type($types = null) { - if(!isset($types)) { + if (!isset($types)) { $types = $this->media_content_types; } - if(!isset($_SERVER['CONTENT_LENGTH']) || !isset($_SERVER['CONTENT_TYPE'])) { + if (!isset($_SERVER['CONTENT_LENGTH']) || !isset($_SERVER['CONTENT_TYPE'])) { $this->length_required(); } @@ -1508,8 +1508,8 @@ EOD; foreach($types as $t) { list($acceptedType,$acceptedSubtype) = explode('/',$t); - if($acceptedType == '*' || $acceptedType == $type) { - if($acceptedSubtype == '*' || $acceptedSubtype == $subtype) + if ($acceptedType == '*' || $acceptedType == $type) { + if ($acceptedSubtype == '*' || $acceptedSubtype == $subtype) return $type . "/" . $subtype; } } @@ -1524,8 +1524,8 @@ EOD; */ function process_conditionals() { - if(empty($this->params)) return; - if($_SERVER['REQUEST_METHOD'] == 'DELETE') return; + if (empty($this->params)) return; + if ($_SERVER['REQUEST_METHOD'] == 'DELETE') return; switch($this->params[0]) { case $this->ENTRY_PATH: @@ -1576,10 +1576,10 @@ EOD; function rfc3339_str2time($str) { $match = false; - if(!preg_match("/(\d{4}-\d{2}-\d{2})T(\d{2}\:\d{2}\:\d{2})\.?\d{0,3}(Z|[+-]+\d{2}\:\d{2})/", $str, $match)) + if (!preg_match("/(\d{4}-\d{2}-\d{2})T(\d{2}\:\d{2}\:\d{2})\.?\d{0,3}(Z|[+-]+\d{2}\:\d{2})/", $str, $match)) return false; - if($match[3] == 'Z') + if ($match[3] == 'Z') $match[3] == '+0000'; return strtotime($match[1] . " " . $match[2] . " " . $match[3]); @@ -1597,7 +1597,7 @@ EOD; $pubtime = $this->rfc3339_str2time($published); - if(!$pubtime) { + if (!$pubtime) { return array(current_time('mysql'),current_time('mysql',1)); } else { return array(date("Y-m-d H:i:s", $pubtime), gmdate("Y-m-d H:i:s", $pubtime)); diff --git a/wp-signup.php b/wp-signup.php index 2710889659..395eeccf1f 100644 --- a/wp-signup.php +++ b/wp-signup.php @@ -390,7 +390,7 @@ if ( $active_signup == "none" ) { } else { switch ($_POST['stage']) { case 'validate-user-signup' : - if( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) + if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' ) validate_user_signup(); else _e( "User registration has been disabled." ); @@ -409,9 +409,9 @@ if ( $active_signup == "none" ) { do_action( "preprocess_signup_form" ); // populate the form from invites, elsewhere? if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) signup_another_blog($newblogname); - elseif( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) + elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) signup_user( $newblogname, $user_email ); - elseif( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) + elseif ( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) _e( "I'm sorry. We're not accepting new registrations at this time." ); else _e( "You're logged in already. No need to register again!" ); diff --git a/xmlrpc.php b/xmlrpc.php index 00d30cfc87..7528f81882 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -2241,7 +2241,7 @@ class wp_xmlrpc_server extends IXR_Server { $post_type = 'page'; if ( !empty( $content_struct['wp_page_template'] ) ) $page_template = $content_struct['wp_page_template']; - } elseif( $content_struct['post_type'] == 'post' ) { + } elseif ( $content_struct['post_type'] == 'post' ) { // This is the default, no changes needed } else { // No other post_type values are allowed here @@ -2827,7 +2827,7 @@ class wp_xmlrpc_server extends IXR_Server { } foreach ($posts_list as $entry) { - if( !current_user_can( 'edit_post', $entry['ID'] ) ) + if ( !current_user_can( 'edit_post', $entry['ID'] ) ) continue; $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
  • " . __('User') . "" . __('Role') . "" . __('Password') . "" . __('Remove') . "
    ' . $val->user_login . '
    '.__('Blogs').'apage=">apage=">
    $val ) { $path = ($val->path == '/') ? '' : $val->path; echo '' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . ''; @@ -227,7 +227,7 @@ if ( $_GET['updated'] == 'true' ) { // View echo 'userblog_id, 'spam' ) == 1 ) + if ( get_blog_status( $val->userblog_id, 'spam' ) == 1 ) echo 'style="background-color: #f66" '; echo 'target="_new" href="http://'.$val->domain . $val->path.'">' . __('View') . ''; @@ -275,7 +275,7 @@ if ( $_GET['updated'] == 'true' ) {

    diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index 0cb605d5a9..c043926a89 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -294,11 +294,11 @@ endfor;