Coding standards, space after if

git-svn-id: https://develop.svn.wordpress.org/trunk@12752 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-01-18 20:34:48 +00:00
parent 333b3c517c
commit e2adfc832a
38 changed files with 349 additions and 398 deletions

View File

@ -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('<?php echo HEADER_TEXTCOLOR; ?>');

View File

@ -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";
}
}

View File

@ -62,7 +62,7 @@ class BW_Import {
flush();
preg_match('|<item type=\"(.*?)\">|is', $post, $post_type);
$post_type = $post_type[1];
if($post_type == "photo") {
if ($post_type == "photo") {
preg_match('|<photoFilename>(.*?)</photoFilename>|is', $post, $post_title);
} else {
preg_match('|<title>(.*?)</title>|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('|<sizedPhotoUrl>(.*?)</sizedPhotoUrl>|is', $post, $post_content);
$post_content = '<img src="'.trim($post_content[1]).'" />';
$post_content = $this->unhtmlentities($post_content);
@ -117,7 +117,7 @@ class BW_Import {
echo '</li>';
break;
}
if(0 != count($categories))
if (0 != count($categories))
wp_create_categories($categories, $post_id);
}

View File

@ -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 '<p>'.__('Importing Categories...').'<br /><br /></p>';
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 '<p>'.__('Importing Users...').'<br /><br /></p>';
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 '<p>'.__('Importing Posts...').'<br /><br /></p>';
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 '<p>'.__('Importing Comments...').'<br /><br /></p>';
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 '<p>'.__('Importing Links...').'<br /><br /></p>';
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 '</form>';
}
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 '</form>';
}
function import_comments()
{
function import_comments() {
// Comment Import
$comments = $this->get_dc_comments();
$this->comments2wp($comments);
@ -571,8 +543,7 @@ class Dotclear_Import {
echo '</form>';
}
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 '<p>'.__('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.').'</p>';
echo '<h3>'.__('Users').'</h3>';
echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password. Forget it. You didn&#8217;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. <strong>Every user has the same username, but their passwords are reset to password123.</strong> So <a href="%1$s">Log in</a> and change it.'), '/wp-login.php').'</p>';
@ -608,8 +578,7 @@ class Dotclear_Import {
echo '<p>'.sprintf(__('That&#8217;s it! What are you waiting for? Go <a href="%1$s">log in</a>!'), '../wp-login.php').'</p>';
}
function db_form()
{
function db_form() {
echo '<table class="form-table">';
printf('<tr><th><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('DotClear Database User:'));
printf('<tr><th><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('DotClear Database Password:'));
@ -620,8 +589,7 @@ class Dotclear_Import {
echo '</table>';
}
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.
}
}

View File

@ -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, '-');

View File

@ -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);
}

View File

@ -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&#8230;'));
echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $this->plugin, 'activate-plugin_' . $this->plugin) .'"></iframe>';
}

View File

@ -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($){
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>
<td><input name="hostname" type="text" id="hostname" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
<td><input name="hostname" type="text" id="hostname" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php if ( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="username"><?php _e('Username') ?></label></th>
<td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
<td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php if ( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
</tr>
<tr valign="top">
@ -827,7 +827,7 @@ jQuery(function($){
<label for="public_key"><?php _e('Public Key:') ?></label ><br />
<label for="private_key"><?php _e('Private Key:') ?></label>
</div></th>
<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo esc_attr($public_key) ?>"<?php if( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php if( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo esc_attr($public_key) ?>"<?php if ( defined('FTP_PUBKEY') ) echo ' disabled="disabled"' ?> size="40" /><br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php if ( defined('FTP_PRIKEY') ) echo ' disabled="disabled"' ?> size="40" />
<div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
</tr>
<?php endif; ?>

View File

@ -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();

View File

@ -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'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' );
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 '<p>' . __( 'Transfer posts before deleting users:' ) . '</p>';
@ -147,25 +147,25 @@ function confirm_delete_users( $users ) {
echo '<input type="hidden" name="alluser_transfer_delete" />';
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 "<input type='hidden' name='user[]' value='{$val}'/>\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 "<p><a href='http://{$details->domain}{$details->path}'>{$details->blogname}</a> ";
echo "<select name='blog[$val][{$key}]'>";
$out = '';
foreach( $blog_users as $user ) {
if( $user->user_id != $val )
if ( $user->user_id != $val )
$out .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
}
if( $out == '' )
if ( $out == '' )
$out = "<option value='1'>admin</option>";
echo $out;
echo "</select>\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', __( "<strong>ERROR</strong>: 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', __( "<strong>ERROR</strong>: 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 "<div id='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email[ 'newemail' ] ) . "</div>";
}
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() {
</div>
<?php
}
if( current_user_can('edit_posts') )
if ( current_user_can('edit_posts') )
add_action('activity_box_end', 'dashboard_quota');
// Edit blog upload space setting on Edit Blog page
function upload_space_setting( $id ) {
$quota = get_blog_option($id, "blog_upload_space");
if( !$quota )
if ( !$quota )
$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&amp;type=image");
$image_title = __('Add an Image');
$out .= "<a href='{$image_upload_iframe_src}&amp;TB_iframe=true' id='add_image' class='thickbox' title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>";
}
if( $mu_media_buttons[ 'video' ] ) {
if ( $mu_media_buttons[ 'video' ] ) {
$video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&amp;type=video");
$video_title = __('Add Video');
$out .= "<a href='{$video_upload_iframe_src}&amp;TB_iframe=true' id='add_video' class='thickbox' title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>";
}
if( $mu_media_buttons[ 'audio' ] ) {
if ( $mu_media_buttons[ 'audio' ] ) {
$audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&amp;type=audio");
$audio_title = __('Add Audio');
$out .= "<a href='{$audio_upload_iframe_src}&amp;TB_iframe=true' id='add_audio' class='thickbox' title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>";
@ -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() . "' );<br />";
}
if( $out != '' ) {
if ( $out != '' ) {
$msg = sprintf( __( 'Warning! WordPress encrypts user cookies, but you must add the following lines to <strong>%swp-config.php</strong> for it to be more secure.<br />Please add the code before the line, <code>/* That\'s all, stop editing! Happy blogging. */</code>' ), ABSPATH );
$msg .= "<blockquote>$out</blockquote>";
@ -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 = "<h3>" . wp_specialchars( $item[ 'title' ] ) . "</h3>\n";
@ -714,7 +714,7 @@ function admin_notice_feed() {
$link = clean_url( strip_tags( $item['link'] ) );
$msg .= "<p>" . $content . " <a href='$link'>" . __( 'Read More' ) . "</a> <a href='index.php?feed_dismiss=" . md5( $item[ 'title' ] ) . "'>" . __( "Dismiss" ) . "</a></p>";
echo "<div class='updated fade'>$msg</div>";
} elseif( is_super_admin() ) {
} elseif ( is_super_admin() ) {
printf("<div id='update-nag'>" . __("Your feed at %s is empty.") . "</div>", 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("<div id='update-nag'>" . __("Hi %s! You're logged in as a site administrator.") . "</div>", $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() {
<?php
$all_blogs = get_blogs_of_user( $current_user->ID );
$primary_blog = get_usermeta($current_user->ID, 'primary_blog');
if( count( $all_blogs ) > 1 ) {
if ( count( $all_blogs ) > 1 ) {
$found = false;
?>
<select name="primary_blog">
<?php foreach( (array) $all_blogs as $blog ) {
if( $primary_blog == $blog->userblog_id )
if ( $primary_blog == $blog->userblog_id )
$found = true;
?><option value='<?php echo $blog->userblog_id ?>'<?php if( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>>http://<?php echo $blog->domain.$blog->path ?></option><?php
?><option value='<?php echo $blog->userblog_id ?>'<?php if ( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>>http://<?php echo $blog->domain.$blog->path ?></option><?php
} ?>
</select>
<?php
if( !$found ) {
if ( !$found ) {
$blog = array_shift( $all_blogs );
update_usermeta( $current_user->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' ) );
?>
<div class="wrap">
<?php if( $_GET[ 'updated' ] ) { ?>
<?php if ( $_GET[ 'updated' ] ) { ?>
<div id="message" class="updated fade"><p><strong><?php _e( 'Your blog options have been updated.' ); ?></strong></p></div>
<?php } ?>
<?php screen_icon(); ?>

View File

@ -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){
<tbody class="plugins">
<?php
if( empty($plugins) )
if ( empty($plugins) )
echo '<tr><td colspan="5">', __('No plugins match your request.'), '</td></tr>';
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 = ' <cite>' . sprintf( __('By %s'), $author ) . '.</cite>';
$author = wp_kses($author, $plugins_allowedtags);
if( isset($plugin['homepage']) )
if ( isset($plugin['homepage']) )
$title = '<a target="_blank" href="' . esc_attr($plugin['homepage']) . '">' . $title . '</a>';
$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') );

View File

@ -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'] = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>';
$plugin_data['Description'] = wptexturize( $plugin_data['Description'] );
if( ! empty($plugin_data['Author']) )
if ( ! empty($plugin_data['Author']) )
$plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
}
@ -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 ] );
}
}

View File

@ -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;

View File

@ -1307,13 +1307,13 @@ function get_inline_data($post) {
<div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div>
<div class="post_password">' . esc_html( $post->post_password ) . '</div>';
if( $post->post_type == 'page' )
if ( $post->post_type == 'page' )
echo '
<div class="post_parent">' . $post->post_parent . '</div>
<div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>
<div class="menu_order">' . $post->menu_order . '</div>';
if( $post->post_type == 'post' )
if ( $post->post_type == 'post' )
echo '
<div class="tags_input">' . esc_html( str_replace( ',', ', ', get_tags_to_edit($post->ID) ) ) . '</div>
<div class="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>

View File

@ -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');

View File

@ -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;

View File

@ -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 "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
// 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)]}<br>";
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 "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\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 "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($query, true)."</pre>\n";
$wpdb->query($query);
}

View File

@ -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 );

View File

@ -46,7 +46,7 @@ if (isset($_GET['updated'])) {
<tr valign="top">
<th scope="row"><?php _e('Allow new registrations') ?></th>
<?php
if( !get_site_option('registration') )
if ( !get_site_option('registration') )
update_site_option( 'registration', 'all' );
?>
<td>
@ -55,7 +55,7 @@ if (isset($_GET['updated'])) {
<label><input name="registration" type="radio" id="registration3" value='user' <?php echo get_site_option('registration') == 'user' ? 'checked="checked"' : ''; ?> /> <?php _e('Only user account can be created.'); ?></label><br />
<label><input name="registration" type="radio" id="registration4" value='blog' <?php echo get_site_option('registration') == 'blog' ? 'checked="checked"' : ''; ?> /> <?php _e('Only logged in users can create new blogs.'); ?></label><br />
<p><?php _e('Disable or enable registration and who or what can be registered. (Default=all)'); ?></p>
<?php if( is_subdomain_install() ) {
<?php if ( is_subdomain_install() ) {
echo "<p>" . __('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.') . "</p>";
} ?>
</td>
@ -64,7 +64,7 @@ if (isset($_GET['updated'])) {
<tr valign="top">
<th scope="row"><?php _e('Registration notification') ?></th>
<?php
if( !get_site_option('registrationnotification') )
if ( !get_site_option('registrationnotification') )
update_site_option( 'registrationnotification', 'yes' );
?>
<td>
@ -201,16 +201,16 @@ if (isset($_GET['updated'])) {
<tr valign="top">
<th scope="row"><?php _e('Upload media button') ?></th>
<?php $mu_media_buttons = get_site_option( 'mu_media_buttons', array() ); ?>
<td><label><input type='checkbox' id="mu_media_buttons_image" name="mu_media_buttons[image]" value='1' <?php if( $mu_media_buttons[ 'image' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Images' ); ?></label><br />
<label><input type='checkbox' id="mu_media_buttons_video" name="mu_media_buttons[video]" value='1' <?php if( $mu_media_buttons[ 'video' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Videos' ); ?></label><br />
<label><input type='checkbox' id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value='1' <?php if( $mu_media_buttons[ 'audio' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Music' ); ?></label><br />
<td><label><input type='checkbox' id="mu_media_buttons_image" name="mu_media_buttons[image]" value='1' <?php if ( $mu_media_buttons[ 'image' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Images' ); ?></label><br />
<label><input type='checkbox' id="mu_media_buttons_video" name="mu_media_buttons[video]" value='1' <?php if ( $mu_media_buttons[ 'video' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Videos' ); ?></label><br />
<label><input type='checkbox' id="mu_media_buttons_audio" name="mu_media_buttons[audio]" value='1' <?php if ( $mu_media_buttons[ 'audio' ] ) { echo 'checked=checked '; } ?>/> <?php _e( 'Music' ); ?></label><br />
<?php _e( 'The media upload buttons to display on the "Write Post" page. Make sure you update the "Upload File Types" below as well.' ); ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Blog upload space check') ?></th>
<td>
<label><input type='radio' id="upload_space_check_disabled" name="upload_space_check_disabled" value='0' <?php if( !get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?>/> <?php _e( 'Enabled' ); ?></label><br />
<label><input type='radio' id="upload_space_check_disabled" name="upload_space_check_disabled" value='1' <?php if( get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?>/> <?php _e( 'Disabled' ); ?></label><br />
<label><input type='radio' id="upload_space_check_disabled" name="upload_space_check_disabled" value='0' <?php if ( !get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?>/> <?php _e( 'Enabled' ); ?></label><br />
<label><input type='radio' id="upload_space_check_disabled" name="upload_space_check_disabled" value='1' <?php if ( get_site_option( 'upload_space_check_disabled' ) ) { echo 'checked=checked '; } ?>/> <?php _e( 'Disabled' ); ?></label><br />
<?php _e( 'By default there is a limit on the total size of files uploaded but it can be disabled here.' ); ?></td>
</tr>
<tr valign="top">
@ -231,7 +231,7 @@ if (isset($_GET['updated'])) {
<th scope="row"><?php _e('Admin Notice Feed') ?></th>
<td><input name="admin_notice_feed" style="width: 95%" type="text" id="admin_notice_feed" value="<?php echo esc_attr( get_site_option( 'admin_notice_feed' ) ) ?>" size="80" /><br />
<?php _e( 'Display the latest post from this RSS or Atom feed on all blog dashboards. Leave blank to disable.' ); ?><br />
<?php if( get_site_option( 'admin_notice_feed' ) != 'http://' . $current_site->domain . $current_site->path . 'feed/' )
<?php if ( get_site_option( 'admin_notice_feed' ) != 'http://' . $current_site->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/'; ?></td>
</tr>
</table>
@ -251,12 +251,12 @@ if (isset($_GET['updated'])) {
<h3><?php _e('Site Wide Settings <em>(These settings may be overridden by blog owners)</em>') ?></h3>
<table class="form-table">
<?php
if( is_dir( ABSPATH . LANGDIR ) && $dh = opendir( ABSPATH . LANGDIR ) )
if ( is_dir( ABSPATH . LANGDIR ) && $dh = opendir( ABSPATH . LANGDIR ) )
while( ( $lang_file = readdir( $dh ) ) !== false )
if( substr( $lang_file, -3 ) == '.mo' )
if ( substr( $lang_file, -3 ) == '.mo' )
$lang_files[] = $lang_file;
$lang = get_site_option('WPLANG');
if( is_array($lang_files) && !empty($lang_files) ) {
if ( is_array($lang_files) && !empty($lang_files) ) {
?>
<tr valign="top">
<th width="33%"><?php _e('Default Language') ?></th>

View File

@ -95,7 +95,7 @@ switch( $_GET['action'] ) {
<tr class="form-field form-required">
<th scope="row"><?php _e('Path') ?></th>
<td><input name="blog[path]" type="text" id="path" value="<?php echo esc_attr($details['path']) ?>" size="40" style='margin-bottom:5px;' />
<br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if( get_blog_option( $id, 'siteurl' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) || get_blog_option( $id, 'home' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td>
<br /><input type='checkbox' style='width:20px;' name='update_home_url' value='update' <?php if ( get_blog_option( $id, 'siteurl' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) || get_blog_option( $id, 'home' ) == preg_replace('|/+$|', '', 'http://' . $details['domain'] . $details['path']) ) echo 'checked="checked"'; ?> /> <?php _e( "Update 'siteurl' and 'home' as well." ); ?></td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e('Registered') ?></th>
@ -108,36 +108,36 @@ switch( $_GET['action'] ) {
<tr class="form-field">
<th scope="row"><?php _e('Public') ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if( $details['public'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if( $details['public'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
<input type='radio' style='width:20px;' name='blog[public]' value='1' <?php if ( $details['public'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[public]' value='0' <?php if ( $details['public'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e( 'Archived' ); ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if( $details['archived'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if( $details['archived'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
<input type='radio' style='width:20px;' name='blog[archived]' value='1' <?php if ( $details['archived'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[archived]' value='0' <?php if ( $details['archived'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e( 'Mature' ); ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if( $details['mature'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if( $details['mature'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
<input type='radio' style='width:20px;' name='blog[mature]' value='1' <?php if ( $details['mature'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[mature]' value='0' <?php if ( $details['mature'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e( 'Spam' ); ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if( $details['spam'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if( $details['spam'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
<input type='radio' style='width:20px;' name='blog[spam]' value='1' <?php if ( $details['spam'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[spam]' value='0' <?php if ( $details['spam'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
<tr class="form-field">
<th scope="row"><?php _e( 'Deleted' ); ?></th>
<td>
<input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if( $details['deleted'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if( $details['deleted'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
<input type='radio' style='width:20px;' name='blog[deleted]' value='1' <?php if ( $details['deleted'] == '1' ) echo 'checked="checked"'; ?> /> <?php _e('Yes') ?>
<input type='radio' style='width:20px;' name='blog[deleted]' value='0' <?php if ( $details['deleted'] == '0' ) echo 'checked="checked"'; ?> /> <?php _e('No') ?>
</td>
</tr>
</table>
@ -151,7 +151,7 @@ switch( $_GET['action'] ) {
<?php
$editblog_default_role = 'subscriber';
foreach ( $options as $key => $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 .= '<tr class="form-field form-required">
<th title="'.htmlspecialchars( $theme["Description"] ).'" scope="row">'.$key.'</th>
@ -222,19 +222,19 @@ switch( $_GET['action'] ) {
<?php
// Blog users
$blogusers = get_users_of_blog( $id );
if( is_array( $blogusers ) ) {
if ( is_array( $blogusers ) ) {
echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __('Blog Users') . '</span></h3><div class="inside">';
echo '<table class="form-table">';
echo "<tr><th>" . __('User') . "</th><th>" . __('Role') . "</th><th>" . __('Password') . "</th><th>" . __('Remove') . "</th></tr>";
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 '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>';
if( $val->user_id != $current_user->data->ID ) {
if ( $val->user_id != $current_user->data->ID ) {
?>
<td>
<select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
@ -316,11 +316,11 @@ switch( $_GET['action'] ) {
$query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
if( isset($_GET['blog_name']) ) {
if ( isset($_GET['blog_name']) ) {
$query .= " AND ( {$wpdb->blogs}.domain LIKE '%{$like_s}%' OR {$wpdb->blogs}.path LIKE '%{$like_s}%' ) ";
} elseif( isset($_GET['blog_id']) ) {
} elseif ( isset($_GET['blog_id']) ) {
$query .= " AND blog_id = '". absint( $_GET['blog_id'] )."' ";
} elseif( isset($_GET['blog_ip']) ) {
} elseif ( isset($_GET['blog_ip']) ) {
$query = "SELECT *
FROM {$wpdb->blogs}, {$wpdb->registration_log}
WHERE site_id = '{$wpdb->siteid}'
@ -328,23 +328,23 @@ switch( $_GET['action'] ) {
AND {$wpdb->registration_log}.IP LIKE ('%{$like_s}%')";
}
if( isset( $_GET['sortby'] ) == false ) {
if ( isset( $_GET['sortby'] ) == false ) {
$_GET['sortby'] = 'id';
}
if( $_GET['sortby'] == 'registered' ) {
if ( $_GET['sortby'] == 'registered' ) {
$query .= ' ORDER BY registered ';
} elseif( $_GET['sortby'] == 'id' ) {
} elseif ( $_GET['sortby'] == 'id' ) {
$query .= ' ORDER BY ' . $wpdb->blogs . '.blog_id ';
} elseif( $_GET['sortby'] == 'lastupdated' ) {
} elseif ( $_GET['sortby'] == 'lastupdated' ) {
$query .= ' ORDER BY last_updated ';
} elseif( $_GET['sortby'] == 'blogname' ) {
} elseif ( $_GET['sortby'] == 'blogname' ) {
$query .= ' ORDER BY domain ';
}
$query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
if( !empty($s) ) {
if ( !empty($s) ) {
$total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(blog_id)', $query) );
} else {
$total = $wpdb->get_var( "SELECT COUNT(blog_id) FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ");
@ -355,7 +355,7 @@ switch( $_GET['action'] ) {
// Pagination
$url2 = "&amp;order=" . $_GET['order'] . "&amp;sortby=" . $_GET['sortby'] . "&amp;s=";
if( $_GET[ 'blog_ip' ] ) {
if ( $_GET[ 'blog_ip' ] ) {
$url2 .= "&amp;ip_address=" . urlencode( $s );
} else {
$url2 .= $s . "&amp;ip_address=" . urlencode( $s );
@ -395,7 +395,7 @@ switch( $_GET['action'] ) {
<br class="clear" />
<?php if( isset($_GET['s']) && !empty($_GET['s']) ) : ?>
<?php if ( isset($_GET['s']) && !empty($_GET['s']) ) : ?>
<p><a href="ms-users.php?action=users&s=<?php echo urlencode( stripslashes( $s ) ) ?>"><?php _e('Search Users:') ?> <strong><?php echo stripslashes( $s ); ?></strong></a></p>
<?php endif; ?>
@ -410,13 +410,13 @@ switch( $_GET['action'] ) {
'users' => __('Users')
);
if( has_filter( 'wpmublogsaction' ) )
if ( has_filter( 'wpmublogsaction' ) )
$posts_columns['plugins'] = __('Actions');
$posts_columns = apply_filters('wpmu_blogs_columns', $posts_columns);
$sortby_url = "s=";
if( $_GET[ 'blog_ip' ] ) {
if ( $_GET[ 'blog_ip' ] ) {
$sortby_url .= "&ip_address=" . urlencode( $s );
} else {
$sortby_url .= urlencode( $s ) . "&ip_address=" . urlencode( $s );
@ -429,7 +429,7 @@ switch( $_GET['action'] ) {
<th scope="col" class="check-column"></th>
<?php foreach($posts_columns as $column_id => $column_display_name) {
$column_link = "<a href='ms-sites.php?{$sortby_url}&amp;sortby={$column_id}&amp;";
if( $_GET['sortby'] == $column_id ) {
if ( $_GET['sortby'] == $column_id ) {
$column_link .= $_GET[ 'order' ] == 'DESC' ? 'order=ASC&amp;' : 'order=DESC&amp;';
}
$column_link .= "apage={$apage}'>{$column_display_name}</a>";
@ -451,7 +451,7 @@ switch( $_GET['action'] ) {
$bgcolour = "";
foreach ( $status_list as $status => $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[] = '<a href="ms-sites.php?action=editblog&amp;id=' . $blog['blog_id'] . '" class="edit">' . __('Edit') . '</a>';
$controlActions[] = "<a href='{$protocol}{$blog['domain']}{$blog['path']}wp-admin/' class='edit'>" . __('Backend') . '</a>';
if( get_blog_status( $blog['blog_id'], "deleted" ) == '1' )
if ( get_blog_status( $blog['blog_id'], "deleted" ) == '1' )
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=activateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to activate the blog %s" ), $blogname ) ) . '">' . __('Activate') . '</a>';
else
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=deactivateblog&amp;ref=' . urlencode( $_SERVER['REQUEST_URI'] ) . '&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to deactivate the blog %s" ), $blogname ) ) . '">' . __('Deactivate') . '</a>';
if( get_blog_status( $blog['blog_id'], "archived" ) == '1' )
if ( get_blog_status( $blog['blog_id'], "archived" ) == '1' )
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unarchive the blog %s" ), $blogname ) ) . '">' . __('Unarchive') . '</a>';
else
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to archive the blog %s" ), $blogname ) ) . '">' . __('Archive') . '</a>';
if( get_blog_status( $blog['blog_id'], "spam" ) == '1' )
if ( get_blog_status( $blog['blog_id'], "spam" ) == '1' )
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to unspam the blog %s" ), $blogname ) ) . '">' . __('Not Spam') . '</a>';
else
$controlActions[] = '<a class="delete" href="ms-edit.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( "You are about to mark the blog %s as spam" ), $blogname ) ) . '">' . __("Spam") . '</a>';
@ -534,7 +534,7 @@ switch( $_GET['action'] ) {
foreach ( $blogusers as $key => $val ) {
echo '<a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a> ('.$val->user_email.')<br />';
}
if( $blogusers_warning != '' ) {
if ( $blogusers_warning != '' ) {
echo '<strong>' . $blogusers_warning . '</strong><br />';
}
}
@ -544,7 +544,7 @@ switch( $_GET['action'] ) {
break;
case 'plugins': ?>
<?php if( has_filter( 'wpmublogsaction' ) ) { ?>
<?php if ( has_filter( 'wpmublogsaction' ) ) { ?>
<td valign="top">
<?php do_action( "wpmublogsaction", $blog['blog_id'] ); ?>
</td>
@ -552,7 +552,7 @@ switch( $_GET['action'] ) {
<?php break;
default: ?>
<?php if( has_filter( 'manage_blogs_custom_column' ) ) { ?>
<?php if ( has_filter( 'manage_blogs_custom_column' ) ) { ?>
<td valign="top">
<?php do_action('manage_blogs_custom_column', $column_name, $blog['blog_id']); ?>
</td>

View File

@ -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 "<ul>";
foreach( (array) $blogs as $details ) {
if( $details['spam'] == 0 && $details['deleted'] == 0 && $details['archived'] == 0 ) {
if ( $details['spam'] == 0 && $details['deleted'] == 0 && $details['archived'] == 0 ) {
$siteurl = $wpdb->get_var("SELECT option_value from {$wpdb->base_prefix}{$details['blog_id']}_options WHERE option_name = 'siteurl'");
echo "<li>$siteurl</li>";
$response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/upgrade.php?step=1", array( 'timeout' => 120, 'httpversion' => '1.1' ) );
if( is_wp_error( $response ) ) {
if ( is_wp_error( $response ) ) {
wp_die( "<strong>Warning!</strong> Problem upgrading {$siteurl}. Your server may not be able to connect to blogs running on it.<br /> Error message: <em>" . $response->get_error_message() ."</em>" );
}
do_action( 'after_mu_upgrade', $response );

View File

@ -49,30 +49,30 @@ if ( $_GET['updated'] == 'true' ) {
$query = "SELECT * FROM {$wpdb->users}";
if( !empty( $s ) ) {
if ( !empty( $s ) ) {
$search = '%' . trim( $s ) . '%';
$query .= " WHERE user_login LIKE '$search' OR user_email LIKE '$search'";
}
if( !isset($_GET['sortby']) ) {
if ( !isset($_GET['sortby']) ) {
$_GET['sortby'] = 'id';
}
if( $_GET['sortby'] == 'email' ) {
if ( $_GET['sortby'] == 'email' ) {
$query .= ' ORDER BY user_email ';
} elseif( $_GET['sortby'] == 'id' ) {
} elseif ( $_GET['sortby'] == 'id' ) {
$query .= ' ORDER BY ID ';
} elseif( $_GET['sortby'] == 'login' ) {
} elseif ( $_GET['sortby'] == 'login' ) {
$query .= ' ORDER BY user_login ';
} elseif( $_GET['sortby'] == 'name' ) {
} elseif ( $_GET['sortby'] == 'name' ) {
$query .= ' ORDER BY display_name ';
} elseif( $_GET['sortby'] == 'registered' ) {
} elseif ( $_GET['sortby'] == 'registered' ) {
$query .= ' ORDER BY user_registered ';
}
$query .= ( $_GET['order'] == 'DESC' ) ? 'DESC' : 'ASC';
if( !empty( $s )) {
if ( !empty( $s )) {
$total = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(ID)', $query) );
} else {
$total = $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->users}");
@ -123,7 +123,7 @@ if ( $_GET['updated'] == 'true' ) {
</div>
</div>
<?php if( isset($_GET['s']) && $_GET['s'] != '' ) : ?>
<?php if ( isset($_GET['s']) && $_GET['s'] != '' ) : ?>
<p><a href="ms-sites.php?action=blogs&amp;s=<?php echo urlencode( stripslashes( $s ) ); ?>&blog_name=Search+blogs+by+name"><?php _e('Search Blogs for') ?> <strong><?php echo stripslashes( $s ) ?></strong></a></p>
<?php endif; ?>
@ -143,12 +143,12 @@ if ( $_GET['updated'] == 'true' ) {
<thead>
<tr>
<?php foreach( (array) $posts_columns as $column_id => $column_display_name) {
if( $column_id == 'blogs' ) {
if ( $column_id == 'blogs' ) {
echo '<th scope="col">'.__('Blogs').'</th>';
} elseif( $column_id == 'checkbox') {
} elseif ( $column_id == 'checkbox') {
echo '<th scope="col" class="check-column"><input type="checkbox" /></th>';
} else { ?>
<th scope="col"><a href="ms-users.php?sortby=<?php echo $column_id ?>&amp;<?php if( $_GET['sortby'] == $column_id ) { if( $_GET['order'] == 'DESC' ) { echo "order=ASC&amp;" ; } else { echo "order=DESC&amp;"; } } ?>apage=<?php echo $apage ?>"><?php echo $column_display_name; ?></a></th>
<th scope="col"><a href="ms-users.php?sortby=<?php echo $column_id ?>&amp;<?php if ( $_GET['sortby'] == $column_id ) { if ( $_GET['order'] == 'DESC' ) { echo "order=ASC&amp;" ; } else { echo "order=DESC&amp;"; } } ?>apage=<?php echo $apage ?>"><?php echo $column_display_name; ?></a></th>
<?php } ?>
<?php } ?>
</tr>
@ -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' ) {
?>
<td>
<?php
if( is_array( $blogs ) ) {
if ( is_array( $blogs ) ) {
foreach ( (array) $blogs as $key => $val ) {
$path = ($val->path == '/') ? '' : $val->path;
echo '<a href="ms-sites.php?action=editblog&amp;id=' . $val->userblog_id . '">' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . '</a>';
@ -227,7 +227,7 @@ if ( $_GET['updated'] == 'true' ) {
// View
echo '<a ';
if( get_blog_status( $val->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') . '</a>';
@ -275,7 +275,7 @@ if ( $_GET['updated'] == 'true' ) {
</div>
<?php
if( apply_filters('show_adduser_fields', true) ) :
if ( apply_filters('show_adduser_fields', true) ) :
?>
<div class="wrap">
<h2><?php _e('Add user') ?></h2>

View File

@ -294,11 +294,11 @@ endfor;
<?php
if ( is_multisite() && is_dir( ABSPATH . LANGDIR ) && $dh = opendir( ABSPATH . LANGDIR ) )
while( ( $lang_file = readdir( $dh ) ) !== false )
if( substr( $lang_file, -3 ) == '.mo' )
if ( substr( $lang_file, -3 ) == '.mo' )
$lang_files[] = $lang_file;
$lang = get_option('WPLANG');
if( is_array($lang_files) && !empty($lang_files) ) {
if ( is_array($lang_files) && !empty($lang_files) ) {
?>
<tr valign="top">
<th width="33%" scope="row"><?php _e('Blog language:') ?></th>

View File

@ -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) ) {

View File

@ -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' );

View File

@ -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' ) {
<?php endif; ?>
</select>
<input type="submit" name="doaction_active" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary action" />
<?php if( 'recent' == $context ) : ?>
<?php if ( 'recent' == $context ) : ?>
<input type="submit" name="clear-recent-list" value="<?php esc_attr_e('Clear List') ?>" class="button-secondary" />
<?php endif; ?>
</div>

View File

@ -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 <img> with correct uploaded ones. Regex contains fix for Magic Quotes
if( !is_wp_error($upload) )
if ( !is_wp_error($upload) )
$content = preg_replace('/<img ([^>]*)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;
<li id="video_button">
<a title="<?php _e('Embed a Video'); ?>" href="#"><img alt="<?php _e('Embed a Video'); ?>" src="images/media-button-video.gif"/></a>
</li>
<?php if( user_can_richedit() ) { ?>
<?php if ( user_can_richedit() ) { ?>
<li id="switcher">
<?php wp_print_scripts( 'quicktags' ); ?>
<?php add_filter('the_editor_content', 'wp_richedit_pre'); ?>

View File

@ -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 );
}

View File

@ -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;

View File

@ -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() ) {
?><div id="message0" class="updated fade"><p><?php _e('Administrator: new themes must be activated in the <a href="wpmu-themes.php">Themes Admin</a> page before they appear here.'); ?></p></div><?php
}
?>

View File

@ -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 '<p>' . __('Plugin reactivated successfully.') . '</p>';
if( isset($_GET['failure']) ){
if ( isset($_GET['failure']) ){
echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
if ( defined('E_RECOVERABLE_ERROR') )

View File

@ -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());" );

View File

@ -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' , '' );
}

View File

@ -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() ) {

View File

@ -92,7 +92,7 @@ case 'dodelete':
if ( ! current_user_can('delete_user', $id) )
wp_die(__('You can&#8217;t delete that user.'));
if($id == $current_user->ID) {
if ($id == $current_user->ID) {
$update = 'err_admin_del';
continue;
}

View File

@ -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;
<title type="text"><?php bloginfo_rss('name') ?></title>
<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
<link rel="first" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url() ?>" />
<?php if(isset($prev_page)): ?>
<?php if (isset($prev_page)): ?>
<link rel="previous" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($prev_page) ?>" />
<?php endif; ?>
<?php if(isset($next_page)): ?>
<?php if (isset($next_page)): ?>
<link rel="next" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($next_page) ?>" />
<?php endif; ?>
<link rel="last" type="<?php echo $this->ATOM_CONTENT_TYPE ?>" href="<?php $this->the_entries_url($last_page) ?>" />
@ -1171,7 +1171,7 @@ EOD;
<uri><?php the_author_meta('url') ?></uri>
<?php } ?>
</author>
<?php if($GLOBALS['post']->post_type == 'attachment') { ?>
<?php if ($GLOBALS['post']->post_type == 'attachment') { ?>
<link rel="edit-media" href="<?php $this->the_media_url() ?>" />
<content type="<?php echo $GLOBALS['post']->post_mime_type ?>" src="<?php the_guid(); ?>"/>
<?php } else { ?>
@ -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));

View File

@ -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!" );

View File

@ -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);