Trailing whitespace cleanup

git-svn-id: http://svn.automattic.com/wordpress/trunk@11013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-20 18:18:39 +00:00
parent 79c63cfe7d
commit a61bc0ec8a
30 changed files with 175 additions and 175 deletions

View File

@ -5,8 +5,8 @@
* @package WordPress * @package WordPress
* @subpackage Administration * @subpackage Administration
*/ */
define('WP_ADMIN', true); define('WP_ADMIN', true);
if ( defined('ABSPATH') ) if ( defined('ABSPATH') )
require_once(ABSPATH . 'wp-load.php'); require_once(ABSPATH . 'wp-load.php');

View File

@ -232,7 +232,7 @@ class Custom_Image_Header {
var ratio = xinit / yinit; var ratio = xinit / yinit;
var ximg = jQuery('#upload').width(); var ximg = jQuery('#upload').width();
var yimg = jQuery('#upload').height(); var yimg = jQuery('#upload').height();
//set up default values //set up default values
jQuery( '#x1' ).val(0); jQuery( '#x1' ).val(0);
jQuery( '#y1' ).val(0); jQuery( '#y1' ).val(0);
@ -240,7 +240,7 @@ class Custom_Image_Header {
jQuery( '#y2' ).val(yinit); jQuery( '#y2' ).val(yinit);
jQuery( '#width' ).val(xinit); jQuery( '#width' ).val(xinit);
jQuery( '#height' ).val(yinit); jQuery( '#height' ).val(yinit);
if ( yimg < yinit || ximg < xinit ) { if ( yimg < yinit || ximg < xinit ) {
if ( ximg / yimg > ratio ) { if ( ximg / yimg > ratio ) {
yinit = yimg; yinit = yimg;

View File

@ -6,9 +6,9 @@
* @subpackage Administration * @subpackage Administration
*/ */
/** /**
* Disable error reporting * Disable error reporting
* *
* Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
*/ */
error_reporting(0); error_reporting(0);

View File

@ -19,7 +19,7 @@ class WP_Upgrader {
var $strings = array(); var $strings = array();
var $skin = null; var $skin = null;
var $result = array(); var $result = array();
function WP_Upgrader(&$skin = null) { function WP_Upgrader(&$skin = null) {
return __construct($skin); return __construct($skin);
} }
@ -30,7 +30,7 @@ class WP_Upgrader {
$this->skin = $skin; $this->skin = $skin;
$this->skin->set_upgrader($this); $this->skin->set_upgrader($this);
} }
function generic_strings() { function generic_strings() {
$this->strings['bad_request'] = __('Invalid Data provided.'); $this->strings['bad_request'] = __('Invalid Data provided.');
$this->strings['fs_unavailable'] = __('Could not access filesystem.'); $this->strings['fs_unavailable'] = __('Could not access filesystem.');
@ -46,17 +46,17 @@ class WP_Upgrader {
$this->strings['folder_exists'] = __('Destination folder already exists.'); $this->strings['folder_exists'] = __('Destination folder already exists.');
$this->strings['mkdir_failed'] = __('Could not create directory.'); $this->strings['mkdir_failed'] = __('Could not create directory.');
$this->strings['bad_package'] = __('Incompatible Archive'); $this->strings['bad_package'] = __('Incompatible Archive');
$this->strings['maintenance_start'] = __('Enabling Maintenance mode.'); $this->strings['maintenance_start'] = __('Enabling Maintenance mode.');
$this->strings['maintenance_end'] = __('Disabling Maintenance mode.'); $this->strings['maintenance_end'] = __('Disabling Maintenance mode.');
} }
function fs_connect( $directories = array() ) { function fs_connect( $directories = array() ) {
global $wp_filesystem; global $wp_filesystem;
if ( false === ($credentials = $this->skin->request_filesystem_credentials()) ) if ( false === ($credentials = $this->skin->request_filesystem_credentials()) )
return false; return false;
if ( ! WP_Filesystem($credentials) ) { if ( ! WP_Filesystem($credentials) ) {
$error = true; $error = true;
if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() ) if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() )
@ -67,7 +67,7 @@ class WP_Upgrader {
if ( ! is_object($wp_filesystem) ) if ( ! is_object($wp_filesystem) )
return new WP_Error('fs_unavailable', $this->strings['fs_unavailable'] ); return new WP_Error('fs_unavailable', $this->strings['fs_unavailable'] );
if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
return new WP_Error('fs_error', $this->strings['fs_error'], $wp_filesystem->errors); return new WP_Error('fs_error', $this->strings['fs_error'], $wp_filesystem->errors);
@ -94,23 +94,23 @@ class WP_Upgrader {
if ( ! preg_match('!^(http|https|ftp)://!i', $package) && file_exists($package) ) //Local file or remote? if ( ! preg_match('!^(http|https|ftp)://!i', $package) && file_exists($package) ) //Local file or remote?
return $package; //must be a local file.. return $package; //must be a local file..
if ( empty($package) ) if ( empty($package) )
return new WP_Error('no_package', $this->strings['no_package']); return new WP_Error('no_package', $this->strings['no_package']);
$this->skin->feedback('downloading_package', $package); $this->skin->feedback('downloading_package', $package);
$download_file = download_url($package); $download_file = download_url($package);
if ( is_wp_error($download_file) ) if ( is_wp_error($download_file) )
return new WP_Error('download_failed', $this->strings['download_failed'], $download_file->get_error_message()); return new WP_Error('download_failed', $this->strings['download_failed'], $download_file->get_error_message());
return $download_file; return $download_file;
} }
function unpack_package($package, $delete_package = true) { function unpack_package($package, $delete_package = true) {
global $wp_filesystem; global $wp_filesystem;
$this->skin->feedback('unpack_package'); $this->skin->feedback('unpack_package');
$upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/'; $upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/';
@ -140,10 +140,10 @@ class WP_Upgrader {
$wp_filesystem->delete($working_dir, true); $wp_filesystem->delete($working_dir, true);
return $result; return $result;
} }
return $working_dir; return $working_dir;
} }
function install_package($args = array()) { function install_package($args = array()) {
global $wp_filesystem; global $wp_filesystem;
$defaults = array( 'source' => '', 'destination' => '', //Please always pass these $defaults = array( 'source' => '', 'destination' => '', //Please always pass these
@ -157,7 +157,7 @@ class WP_Upgrader {
if ( empty($source) || empty($destination) ) if ( empty($source) || empty($destination) )
return new WP_Error('bad_request', $this->strings['bad_request']); return new WP_Error('bad_request', $this->strings['bad_request']);
$this->skin->feedback('installing_package'); $this->skin->feedback('installing_package');
$res = apply_filters('upgrader_pre_install', true, $hook_extra); $res = apply_filters('upgrader_pre_install', true, $hook_extra);
@ -167,7 +167,7 @@ class WP_Upgrader {
//Retain the Original source and destinations //Retain the Original source and destinations
$remote_source = $source; $remote_source = $source;
$local_destination = $destination; $local_destination = $destination;
$source_files = array_keys( $wp_filesystem->dirlist($remote_source) ); $source_files = array_keys( $wp_filesystem->dirlist($remote_source) );
$remote_destination = $wp_filesystem->find_folder($local_destination); $remote_destination = $wp_filesystem->find_folder($local_destination);
@ -177,16 +177,16 @@ class WP_Upgrader {
elseif ( count($source_files) == 0 ) elseif ( count($source_files) == 0 )
return new WP_Error('bad_package', $this->strings['bad_package']); //There are no files? return new WP_Error('bad_package', $this->strings['bad_package']); //There are no files?
//else //Its only a single file, The upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename. //else //Its only a single file, The upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename.
//Hook ability to change the source file location.. //Hook ability to change the source file location..
$source = apply_filters('upgrader_source_selection', $source, $remote_source, $this); $source = apply_filters('upgrader_source_selection', $source, $remote_source, $this);
if ( is_wp_error($source) ) if ( is_wp_error($source) )
return $source; return $source;
//Has the source location changed? If so, we need a new source_files list. //Has the source location changed? If so, we need a new source_files list.
if ( $source !== $remote_source ) if ( $source !== $remote_source )
$source_files = array_keys( $wp_filesystem->dirlist($source) ); $source_files = array_keys( $wp_filesystem->dirlist($source) );
//Protection against deleting files in any important base directories. //Protection against deleting files in any important base directories.
if ( in_array( $destination, array(ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes') ) ) { if ( in_array( $destination, array(ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes') ) ) {
$remote_destination = trailingslashit($remote_destination) . trailingslashit(basename($source)); $remote_destination = trailingslashit($remote_destination) . trailingslashit(basename($source));
@ -212,12 +212,12 @@ class WP_Upgrader {
else if ( ! $removed ) else if ( ! $removed )
return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']);
} }
//Create destination if needed //Create destination if needed
if ( !$wp_filesystem->exists($remote_destination) ) if ( !$wp_filesystem->exists($remote_destination) )
if ( !$wp_filesystem->mkdir($remote_destination, FS_CHMOD_DIR) ) if ( !$wp_filesystem->mkdir($remote_destination, FS_CHMOD_DIR) )
return new WP_Error('mkdir_failed', $this->strings['mkdir_failed'], $remote_destination); return new WP_Error('mkdir_failed', $this->strings['mkdir_failed'], $remote_destination);
// Copy new version of item into place. // Copy new version of item into place.
$result = copy_dir($source, $remote_destination); $result = copy_dir($source, $remote_destination);
if ( is_wp_error($result) ) { if ( is_wp_error($result) ) {
@ -225,11 +225,11 @@ class WP_Upgrader {
$wp_filesystem->delete($remote_source, true); $wp_filesystem->delete($remote_source, true);
return $result; return $result;
} }
//Clear the Working folder? //Clear the Working folder?
if ( $clear_working ) if ( $clear_working )
$wp_filesystem->delete($remote_source, true); $wp_filesystem->delete($remote_source, true);
$destination_name = basename( str_replace($local_destination, '', $destination) ); $destination_name = basename( str_replace($local_destination, '', $destination) );
if ( '.' == $destination_name ) if ( '.' == $destination_name )
$destination_name = ''; $destination_name = '';
@ -245,7 +245,7 @@ class WP_Upgrader {
//Bombard the calling function will all the info which we've just used. //Bombard the calling function will all the info which we've just used.
return $this->result; return $this->result;
} }
function run($options) { function run($options) {
$defaults = array( 'package' => '', //Please always pass this. $defaults = array( 'package' => '', //Please always pass this.
@ -277,7 +277,7 @@ class WP_Upgrader {
$this->skin->error($download); $this->skin->error($download);
return $download; return $download;
} }
//Unzip's the file into a temporary directory //Unzip's the file into a temporary directory
$working_dir = $this->unpack_package( $download ); $working_dir = $this->unpack_package( $download );
if ( is_wp_error($working_dir) ) { if ( is_wp_error($working_dir) ) {
@ -286,7 +286,7 @@ class WP_Upgrader {
} }
//With the given options, this installs it to the destination directory. //With the given options, this installs it to the destination directory.
$result = $this->install_package( array( $result = $this->install_package( array(
'source' => $working_dir, 'source' => $working_dir,
'destination' => $destination, 'destination' => $destination,
'clear_destination' => $clear_destination, 'clear_destination' => $clear_destination,
@ -305,7 +305,7 @@ class WP_Upgrader {
$this->skin->footer(); $this->skin->footer();
return $result; return $result;
} }
function maintenance_mode($enable = false) { function maintenance_mode($enable = false) {
global $wp_filesystem; global $wp_filesystem;
$file = $wp_filesystem->abspath() . '.maintenance'; $file = $wp_filesystem->abspath() . '.maintenance';
@ -320,13 +320,13 @@ class WP_Upgrader {
$wp_filesystem->delete($file); $wp_filesystem->delete($file);
} }
} }
} }
class Plugin_Upgrader extends WP_Upgrader { class Plugin_Upgrader extends WP_Upgrader {
var $result; var $result;
function upgrade_strings() { function upgrade_strings() {
$this->generic_strings(); $this->generic_strings();
$this->strings['up_to_date'] = __('The plugin is at the latest version.'); $this->strings['up_to_date'] = __('The plugin is at the latest version.');
@ -351,7 +351,7 @@ class Plugin_Upgrader extends WP_Upgrader {
} }
function install($package) { function install($package) {
$this->install_strings(); $this->install_strings();
$this->run(array( $this->run(array(
@ -361,16 +361,16 @@ class Plugin_Upgrader extends WP_Upgrader {
'clear_working' => true, 'clear_working' => true,
'hook_extra' => array() 'hook_extra' => array()
)); ));
// Force refresh of plugin update information // Force refresh of plugin update information
delete_transient('update_plugins'); delete_transient('update_plugins');
} }
function upgrade($plugin) { function upgrade($plugin) {
$this->upgrade_strings(); $this->upgrade_strings();
$current = get_transient( 'update_plugins' ); $current = get_transient( 'update_plugins' );
if ( !isset( $current->response[ $plugin ] ) ) { if ( !isset( $current->response[ $plugin ] ) ) {
$this->skin->error('up_to_date'); $this->skin->error('up_to_date');
@ -380,7 +380,7 @@ class Plugin_Upgrader extends WP_Upgrader {
// Get the URL to the zip file // Get the URL to the zip file
$r = $current->response[ $plugin ]; $r = $current->response[ $plugin ];
add_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'), 10, 2); add_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'), 10, 2);
add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4); add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4);
//'source_selection' => array(&$this, 'source_selection'), //theres a track ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins. //'source_selection' => array(&$this, 'source_selection'), //theres a track ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
@ -405,13 +405,13 @@ class Plugin_Upgrader extends WP_Upgrader {
// Force refresh of plugin update information // Force refresh of plugin update information
delete_transient('update_plugins'); delete_transient('update_plugins');
} }
//return plugin info. //return plugin info.
function plugin_info() { function plugin_info() {
if ( ! is_array($this->result) ) if ( ! is_array($this->result) )
return false; return false;
if ( empty($this->result['destination_name']) ) if ( empty($this->result['destination_name']) )
return false; return false;
$plugin = get_plugins('/' . $this->result['destination_name']); //Ensure to pass with leading slash $plugin = get_plugins('/' . $this->result['destination_name']); //Ensure to pass with leading slash
if ( empty($plugin) ) if ( empty($plugin) )
@ -419,7 +419,7 @@ class Plugin_Upgrader extends WP_Upgrader {
$pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
return $this->result['destination_name'] . '/' . $pluginfiles[0]; return $this->result['destination_name'] . '/' . $pluginfiles[0];
} }
//Hooked to pre_install //Hooked to pre_install
@ -436,26 +436,26 @@ class Plugin_Upgrader extends WP_Upgrader {
$this->skin->feedback('deactivate_plugin'); $this->skin->feedback('deactivate_plugin');
//Deactivate the plugin silently, Prevent deactivation hooks from running. //Deactivate the plugin silently, Prevent deactivation hooks from running.
deactivate_plugins($plugin, true); deactivate_plugins($plugin, true);
} }
} }
//Hooked to upgrade_clear_destination //Hooked to upgrade_clear_destination
function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) { function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) {
global $wp_filesystem; global $wp_filesystem;
if ( is_wp_error($removed) ) if ( is_wp_error($removed) )
return $removed; //Pass errors through. return $removed; //Pass errors through.
$plugin = isset($plugin['plugin']) ? $plugin['plugin'] : ''; $plugin = isset($plugin['plugin']) ? $plugin['plugin'] : '';
if ( empty($plugin) ) if ( empty($plugin) )
return new WP_Error('bad_request', $this->strings['bad_request']); return new WP_Error('bad_request', $this->strings['bad_request']);
$plugins_dir = $wp_filesystem->wp_plugins_dir(); $plugins_dir = $wp_filesystem->wp_plugins_dir();
$this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) ); $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) );
if ( ! $wp_filesystem->exists($this_plugin_dir) ) //If its already vanished. if ( ! $wp_filesystem->exists($this_plugin_dir) ) //If its already vanished.
return $removed; return $removed;
// If plugin is in its own directory, recursively delete the directory. // If plugin is in its own directory, recursively delete the directory.
if ( strpos($plugin, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder if ( strpos($plugin, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
$deleted = $wp_filesystem->delete($this_plugin_dir, true); $deleted = $wp_filesystem->delete($this_plugin_dir, true);
@ -464,7 +464,7 @@ class Plugin_Upgrader extends WP_Upgrader {
if ( ! $deleted ) if ( ! $deleted )
return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']); return new WP_Error('remove_old_failed', $this->strings['remove_old_failed']);
return $removed; return $removed;
} }
} }
@ -497,7 +497,7 @@ class Theme_Upgrader extends WP_Upgrader {
} }
function install($package) { function install($package) {
$this->install_strings(); $this->install_strings();
$options = array( $options = array(
@ -506,30 +506,30 @@ class Theme_Upgrader extends WP_Upgrader {
'clear_destination' => false, //Do not overwrite files. 'clear_destination' => false, //Do not overwrite files.
'clear_working' => true 'clear_working' => true
); );
$this->run($options); $this->run($options);
if ( ! $this->result || is_wp_error($this->result) ) if ( ! $this->result || is_wp_error($this->result) )
return $this->result; return $this->result;
// Force refresh of theme update information // Force refresh of theme update information
delete_transient('update_themes'); delete_transient('update_themes');
if ( empty($result['destination_name']) ) if ( empty($result['destination_name']) )
return false; return false;
else else
return $result['destination_name']; return $result['destination_name'];
} }
function upgrade($theme) { function upgrade($theme) {
$this->upgrade_strings(); $this->upgrade_strings();
// Is an update available? // Is an update available?
$current = get_transient( 'update_themes' ); $current = get_transient( 'update_themes' );
if ( !isset( $current->response[ $theme ] ) ) if ( !isset( $current->response[ $theme ] ) )
return new WP_Error('up_to_date', $this->strings['up_to_date']); return new WP_Error('up_to_date', $this->strings['up_to_date']);
$r = $current->response[ $theme ]; $r = $current->response[ $theme ];
add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2); add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
@ -545,7 +545,7 @@ class Theme_Upgrader extends WP_Upgrader {
'theme' => $theme 'theme' => $theme
) )
); );
$this->run($options); $this->run($options);
if ( ! $this->result || is_wp_error($this->result) ) if ( ! $this->result || is_wp_error($this->result) )
@ -556,9 +556,9 @@ class Theme_Upgrader extends WP_Upgrader {
return true; return true;
} }
function current_before($return, $theme) { function current_before($return, $theme) {
if ( is_wp_error($return) ) if ( is_wp_error($return) )
return $return; return $return;
@ -592,22 +592,22 @@ class Theme_Upgrader extends WP_Upgrader {
$this->maintenance_mode(false); $this->maintenance_mode(false);
return $return; return $return;
} }
function delete_old_theme($removed, $local_destination, $remote_destination, $theme) { function delete_old_theme($removed, $local_destination, $remote_destination, $theme) {
global $wp_filesystem; global $wp_filesystem;
$theme = isset($theme['theme']) ? $theme['theme'] : ''; $theme = isset($theme['theme']) ? $theme['theme'] : '';
if ( is_wp_error($removed) || empty($theme) ) if ( is_wp_error($removed) || empty($theme) )
return $removed; //Pass errors through. return $removed; //Pass errors through.
$themes_dir = $wp_filesystem->wp_themes_dir(); $themes_dir = $wp_filesystem->wp_themes_dir();
if ( $wp_filesystem->exists( trailingslashit($themes_dir) . $theme ) ) if ( $wp_filesystem->exists( trailingslashit($themes_dir) . $theme ) )
if ( ! $wp_filesystem->delete( trailingslashit($themes_dir) . $theme, true ) ) if ( ! $wp_filesystem->delete( trailingslashit($themes_dir) . $theme, true ) )
return false; return false;
return true; return true;
} }
function theme_info() { function theme_info() {
if ( empty($this->result['destination_name']) ) if ( empty($this->result['destination_name']) )
return false; return false;
@ -631,11 +631,11 @@ class Core_Upgrader extends WP_Upgrader {
function upgrade($current) { function upgrade($current) {
global $wp_filesystem; global $wp_filesystem;
$this->upgrade_strings(); $this->upgrade_strings();
if ( !empty($feedback) ) if ( !empty($feedback) )
add_filter('update_feedback', $feedback); add_filter('update_feedback', $feedback);
// Is an update available? // Is an update available?
if ( !isset( $current->response ) || $current->response == 'latest' ) if ( !isset( $current->response ) || $current->response == 'latest' )
return new WP_Error('up_to_date', $this->strings['up_to_date']); return new WP_Error('up_to_date', $this->strings['up_to_date']);
@ -643,13 +643,13 @@ class Core_Upgrader extends WP_Upgrader {
$res = $this->fs_connect( array(ABSPATH, WP_CONTENT_DIR) ); $res = $this->fs_connect( array(ABSPATH, WP_CONTENT_DIR) );
if ( is_wp_error($res) ) if ( is_wp_error($res) )
return $res; return $res;
$wp_dir = trailingslashit($wp_filesystem->abspath()); $wp_dir = trailingslashit($wp_filesystem->abspath());
$download = $this->download_package( $current->package ); $download = $this->download_package( $current->package );
if ( is_wp_error($download) ) if ( is_wp_error($download) )
return $download; return $download;
$working_dir = $this->unpack_package( $download ); $working_dir = $this->unpack_package( $download );
if ( is_wp_error($working_dir) ) if ( is_wp_error($working_dir) )
return $working_dir; return $working_dir;
@ -660,9 +660,9 @@ class Core_Upgrader extends WP_Upgrader {
return new WP_Error('copy_failed', $this->strings['copy_failed']); return new WP_Error('copy_failed', $this->strings['copy_failed']);
} }
$wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE); $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
require(ABSPATH . 'wp-admin/includes/update-core.php'); require(ABSPATH . 'wp-admin/includes/update-core.php');
return update_core($working_dir, $wp_dir); return update_core($working_dir, $wp_dir);
} }
@ -677,10 +677,10 @@ class Core_Upgrader extends WP_Upgrader {
*/ */
class WP_Upgrader_Skin { class WP_Upgrader_Skin {
var $upgrader; var $upgrader;
var $done_header = false; var $done_header = false;
function WP_Upgrader_Skin($args = array()) { function WP_Upgrader_Skin($args = array()) {
return __construct($args); return __construct($args);
} }
@ -688,7 +688,7 @@ class WP_Upgrader_Skin {
$defaults = array( 'url' => '', 'nonce' => '', 'title' => '' ); $defaults = array( 'url' => '', 'nonce' => '', 'title' => '' );
$this->options = wp_parse_args($args, $defaults); $this->options = wp_parse_args($args, $defaults);
} }
function set_upgrader(&$upgrader) { function set_upgrader(&$upgrader) {
if ( is_object($upgrader) ) if ( is_object($upgrader) )
$this->upgrader =& $upgrader; $this->upgrader =& $upgrader;
@ -696,26 +696,26 @@ class WP_Upgrader_Skin {
function set_result($result) { function set_result($result) {
$this->result = $result; $this->result = $result;
} }
function request_filesystem_credentials($error = false) { function request_filesystem_credentials($error = false) {
$url = $this->options['url']; $url = $this->options['url'];
if ( !empty($this->options['nonce']) ) if ( !empty($this->options['nonce']) )
$url = wp_nonce_url($url, $this->options['nonce']); $url = wp_nonce_url($url, $this->options['nonce']);
return request_filesystem_credentials($url, '', $error); //Possible to bring inline, Leaving as0is for now. return request_filesystem_credentials($url, '', $error); //Possible to bring inline, Leaving as0is for now.
} }
function header() { function header() {
if ( $this->done_header ) if ( $this->done_header )
return; return;
$this->done_header = true; $this->done_header = true;
echo '<div class="wrap">'; echo '<div class="wrap">';
echo screen_icon(); echo screen_icon();
echo '<h2>' . $this->options['title'] . '</h2>'; echo '<h2>' . $this->options['title'] . '</h2>';
} }
function footer() { function footer() {
echo '</div>'; echo '</div>';
} }
function error($errors) { function error($errors) {
if ( ! $this->done_header ) if ( ! $this->done_header )
$this->header(); $this->header();
@ -738,10 +738,10 @@ class WP_Upgrader_Skin {
if ( empty($string) ) if ( empty($string) )
return; return;
show_message($string); show_message($string);
} }
function before() {} function before() {}
function after() {} function after() {}
} }
class Plugin_Upgrader_Skin extends WP_Upgrader_Skin { class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
@ -759,10 +759,10 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
$this->plugin = $args['plugin']; $this->plugin = $args['plugin'];
$this->plugin_active = is_plugin_active($this->plugin); $this->plugin_active = is_plugin_active($this->plugin);
parent::__construct($args); parent::__construct($args);
} }
function after() { function after() {
$this->plugin = $this->upgrader->plugin_info(); $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 ){
@ -796,10 +796,10 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
function __construct($args = array()) { function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' ); $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args($args, $defaults); $args = wp_parse_args($args, $defaults);
$this->type = $args['type']; $this->type = $args['type'];
$this->api = isset($args['api']) ? $args['api'] : array(); $this->api = isset($args['api']) ? $args['api'] : array();
parent::__construct($args); parent::__construct($args);
} }
@ -807,7 +807,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
if ( !empty($this->api) ) if ( !empty($this->api) )
$this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version); $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
} }
function after() { function after() {
$plugin_file = $this->upgrader->plugin_info(); $plugin_file = $this->upgrader->plugin_info();
@ -842,10 +842,10 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
function __construct($args = array()) { function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' ); $defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args($args, $defaults); $args = wp_parse_args($args, $defaults);
$this->type = $args['type']; $this->type = $args['type'];
$this->api = isset($args['api']) ? $args['api'] : array(); $this->api = isset($args['api']) ? $args['api'] : array();
parent::__construct($args); parent::__construct($args);
} }
@ -853,7 +853,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
if ( !empty($this->api) ) if ( !empty($this->api) )
$this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the theme <strong>%s %s</strong>.'), $this->api->name, $this->api->version); $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the theme <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
} }
function after() { function after() {
if ( empty($this->upgrader->result['destination_name']) ) if ( empty($this->upgrader->result['destination_name']) )
return; return;
@ -864,10 +864,10 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$name = $theme_info['Name']; $name = $theme_info['Name'];
$stylesheet = $this->upgrader->result['destination_name']; $stylesheet = $this->upgrader->result['destination_name'];
$template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet; $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
$preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(clean_url(get_option('home'))) ) ); $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(clean_url(get_option('home'))) ) );
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template); $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
$install_actions = array( $install_actions = array(
'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . attribute_escape(sprintf(__('Preview "%s"'), $name)) . '">' . __('Preview') . '</a>', 'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . attribute_escape(sprintf(__('Preview "%s"'), $name)) . '">' . __('Preview') . '</a>',
'activate' => '<a href="' . $activate_link . '" class="activatelink" title="' . attribute_escape( sprintf( __('Activate "%s"'), $name ) ) . '">' . __('Activate') . '</a>' 'activate' => '<a href="' . $activate_link . '" class="activatelink" title="' . attribute_escape( sprintf( __('Activate "%s"'), $name ) ) . '">' . __('Activate') . '</a>'
@ -899,10 +899,10 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
$args = wp_parse_args($args, $defaults); $args = wp_parse_args($args, $defaults);
$this->theme = $args['theme']; $this->theme = $args['theme'];
parent::__construct($args); parent::__construct($args);
} }
function after() { function after() {
if ( empty($this->upgrader->result['destination_name']) ) if ( empty($this->upgrader->result['destination_name']) )
@ -914,7 +914,7 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
$name = $theme_info['Name']; $name = $theme_info['Name'];
$stylesheet = $this->upgrader->result['destination_name']; $stylesheet = $this->upgrader->result['destination_name'];
$template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet; $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
$preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(clean_url(get_option('home'))) ) ); $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(clean_url(get_option('home'))) ) );
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template); $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
@ -925,7 +925,7 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
); );
if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() ) if ( ( ! $this->result || is_wp_error($this->result) ) || $stylesheet == get_stylesheet() )
unset($update_actions['preview'], $update_actions['activate']); unset($update_actions['preview'], $update_actions['activate']);
$update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme); $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme);
if ( ! empty($update_actions) ) if ( ! empty($update_actions) )
$this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions)); $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$update_actions));
@ -942,10 +942,10 @@ class File_Upload_Upgrader {
function __construct($form, $urlholder) { function __construct($form, $urlholder) {
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
wp_die($uploads['error']); wp_die($uploads['error']);
if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) ) if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) )
wp_die(__('Please select a file')); wp_die(__('Please select a file'));
if ( !empty($_FILES) ) if ( !empty($_FILES) )
$this->filename = $_FILES[$form]['name']; $this->filename = $_FILES[$form]['name'];
else if ( isset($_GET[$urlholder]) ) else if ( isset($_GET[$urlholder]) )
@ -955,7 +955,7 @@ class File_Upload_Upgrader {
if ( !empty($_FILES) ) { if ( !empty($_FILES) ) {
$this->filename = wp_unique_filename( $uploads['basedir'], $this->filename ); $this->filename = wp_unique_filename( $uploads['basedir'], $this->filename );
$this->package = $uploads['basedir'] . '/' . $this->filename; $this->package = $uploads['basedir'] . '/' . $this->filename;
// Move the file to the uploads dir // Move the file to the uploads dir
if ( false === @ move_uploaded_file( $_FILES[$form]['tmp_name'], $this->package) ) if ( false === @ move_uploaded_file( $_FILES[$form]['tmp_name'], $this->package) )
wp_die( sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'])); wp_die( sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path']));

View File

@ -1565,8 +1565,8 @@ jQuery(function($){
<a href="#" id="hideall" class="toggle" style="display:none;"><?php _e('Hide'); ?></a> <a href="#" id="hideall" class="toggle" style="display:none;"><?php _e('Hide'); ?></a>
</span> </span>
<?php _e('Sort Order:'); ?> <?php _e('Sort Order:'); ?>
<a href="#" id="asc"><?php _e('Ascending'); ?></a> | <a href="#" id="asc"><?php _e('Ascending'); ?></a> |
<a href="#" id="desc"><?php _e('Descending'); ?></a> | <a href="#" id="desc"><?php _e('Descending'); ?></a> |
<a href="#" id="clear"><?php _e('Clear'); ?></a> <a href="#" id="clear"><?php _e('Clear'); ?></a>
</div> </div>
<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form"> <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">

View File

@ -201,7 +201,7 @@ add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
/** /**
* Upload from zip * Upload from zip
* @since 2.8.0 * @since 2.8.0
* *
* @param string $page * @param string $page
*/ */
function install_plugins_upload( $page = 1 ) { function install_plugins_upload( $page = 1 ) {

View File

@ -1569,13 +1569,13 @@ function display_page_row( $page, $level = 0 ) {
$find_main_page = (int)$page->post_parent; $find_main_page = (int)$page->post_parent;
while ( $find_main_page > 0 ) { while ( $find_main_page > 0 ) {
$parent = get_page($find_main_page); $parent = get_page($find_main_page);
if ( is_null($parent) ) if ( is_null($parent) )
break; break;
$level++; $level++;
$find_main_page = (int)$parent->post_parent; $find_main_page = (int)$parent->post_parent;
if ( !isset($parent_name) ) if ( !isset($parent_name) )
$parent_name = $parent->post_title; $parent_name = $parent->post_title;
} }

View File

@ -403,10 +403,10 @@ function display_themes($themes, $page = 1, $totalpages = 1) {
<?php <?php
$rows = ceil(count($themes) / 3); $rows = ceil(count($themes) / 3);
$table = array(); $table = array();
$theme_keys = array_keys($themes); $theme_keys = array_keys($themes);
for ( $row = 1; $row <= $rows; $row++ ) for ( $row = 1; $row <= $rows; $row++ )
for ( $col = 1; $col <= 3; $col++ ) for ( $col = 1; $col <= 3; $col++ )
$table[$row][$col] = array_shift($theme_keys); $table[$row][$col] = array_shift($theme_keys);
foreach ( $table as $row => $cols ) { foreach ( $table as $row => $cols ) {
?> ?>
@ -421,8 +421,8 @@ function display_themes($themes, $page = 1, $totalpages = 1) {
if ( $col == 3 ) $class[] = 'right'; if ( $col == 3 ) $class[] = 'right';
?> ?>
<td class="<?php echo join(' ', $class); ?>"><?php <td class="<?php echo join(' ', $class); ?>"><?php
if ( isset($themes[$theme_index]) ) if ( isset($themes[$theme_index]) )
display_theme($themes[$theme_index]); display_theme($themes[$theme_index]);
?></td> ?></td>
<?php } // end foreach $cols ?> <?php } // end foreach $cols ?>
</tr> </tr>

View File

@ -177,7 +177,7 @@ function wp_update_plugin($plugin, $feedback = '') {
} }
function wp_update_theme($theme, $feedback = '') { function wp_update_theme($theme, $feedback = '') {
if ( !empty($feedback) ) if ( !empty($feedback) )
add_filter('update_feedback', $feedback); add_filter('update_feedback', $feedback);
@ -188,7 +188,7 @@ function wp_update_theme($theme, $feedback = '') {
function wp_update_core($current, $feedback = '') { function wp_update_core($current, $feedback = '') {
if ( !empty($feedback) ) if ( !empty($feedback) )
add_filter('update_feedback', $feedback); add_filter('update_feedback', $feedback);

View File

@ -412,7 +412,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
global $wpdb; global $wpdb;
$id = (int) $id; $id = (int) $id;
$user = new WP_User($id); $user = new WP_User($id);
// allow for transaction statement // allow for transaction statement
do_action('delete_user', $id); do_action('delete_user', $id);
@ -448,7 +448,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
wp_cache_delete($user->user_login, 'userlogins'); wp_cache_delete($user->user_login, 'userlogins');
wp_cache_delete($user->user_email, 'useremail'); wp_cache_delete($user->user_email, 'useremail');
wp_cache_delete($user->user_nicename, 'userslugs'); wp_cache_delete($user->user_nicename, 'userslugs');
// allow for commit transaction // allow for commit transaction
do_action('deleted_user', $id); do_action('deleted_user', $id);

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* Disable error reporting * Disable error reporting
* *
* Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
*/ */
error_reporting(0); error_reporting(0);

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* Disable error reporting * Disable error reporting
* *
* Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
*/ */
error_reporting(0); error_reporting(0);

View File

@ -463,7 +463,7 @@ print_plugin_actions($status);
<?php <?php
if ( $total_this_page > $plugins_per_page ) if ( $total_this_page > $plugins_per_page )
$plugins = array_slice($plugins, $start, $plugins_per_page); $plugins = array_slice($plugins, $start, $plugins_per_page);
print_plugins_table($plugins, $status); print_plugins_table($plugins, $status);
?> ?>
<div class="tablenav"> <div class="tablenav">

View File

@ -58,7 +58,7 @@ function press_it() {
if( strpos($_REQUEST['content'], $image) !== false ) { if( strpos($_REQUEST['content'], $image) !== false ) {
$desc = isset($_REQUEST['photo_description'][$key]) ? $_REQUEST['photo_description'][$key] : ''; $desc = isset($_REQUEST['photo_description'][$key]) ? $_REQUEST['photo_description'][$key] : '';
$upload = media_sideload_image($image, $post_ID, $desc); $upload = media_sideload_image($image, $post_ID, $desc);
// Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes // Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes
if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote($image, '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content); if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote($image, '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content);
} }
@ -450,7 +450,7 @@ var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
<!-- This div holds the photo metadata --> <!-- This div holds the photo metadata -->
<div class="photolist"></div> <div class="photolist"></div>
<div id="submitdiv" class="stuffbox"> <div id="submitdiv" class="stuffbox">
<h3><?php _e('Publish') ?></h3> <h3><?php _e('Publish') ?></h3>
<div class="inside"> <div class="inside">
@ -465,7 +465,7 @@ var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
</p> </p>
</div> </div>
</div> </div>
<div id="categorydiv" class="stuffbox"> <div id="categorydiv" class="stuffbox">
<h3><?php _e('Categories') ?></h3> <h3><?php _e('Categories') ?></h3>
<div class="inside"> <div class="inside">
@ -524,7 +524,7 @@ var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
<div class="postdivrich"> <div class="postdivrich">
<ul id="actions"> <ul id="actions">
<li id="photo_button"> <li id="photo_button">
Add: <?php if ( current_user_can('upload_files') ) { ?><a title="<?php _e('Insert an Image'); ?>" href="#"> Add: <?php if ( current_user_can('upload_files') ) { ?><a title="<?php _e('Insert an Image'); ?>" href="#">
<img alt="<?php _e('Insert an Image'); ?>" src="images/media-button-image.gif"/></a> <img alt="<?php _e('Insert an Image'); ?>" src="images/media-button-image.gif"/></a>

View File

@ -34,7 +34,7 @@ if ( isset($_GET['action']) ) {
$upgrader->upgrade($plugin); $upgrader->upgrade($plugin);
include('admin-footer.php'); include('admin-footer.php');
} elseif ('activate-plugin' == $action ) { } elseif ('activate-plugin' == $action ) {
if ( ! current_user_can('update_plugins') ) if ( ! current_user_can('update_plugins') )
wp_die(__('You do not have sufficient permissions to update plugins for this blog.')); wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
@ -63,18 +63,18 @@ if ( isset($_GET['action']) ) {
wp_die(__('You do not have sufficient permissions to install plugins for this blog.')); wp_die(__('You do not have sufficient permissions to install plugins for this blog.'));
include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api.. include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api..
check_admin_referer('install-plugin_' . $plugin); check_admin_referer('install-plugin_' . $plugin);
$api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth. $api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.
if ( is_wp_error($api) ) if ( is_wp_error($api) )
wp_die($api); wp_die($api);
$title = __('Plugin Install'); $title = __('Plugin Install');
$parent_file = 'plugins.php'; $parent_file = 'plugins.php';
$submenu_file = 'plugin-install.php'; $submenu_file = 'plugin-install.php';
require_once('admin-header.php'); require_once('admin-header.php');
$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version ); $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
$nonce = 'install-plugin_' . $plugin; $nonce = 'install-plugin_' . $plugin;
$url = 'update.php?action=install-plugin&plugin=' . $plugin; $url = 'update.php?action=install-plugin&plugin=' . $plugin;
@ -82,7 +82,7 @@ if ( isset($_GET['action']) ) {
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) ); $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
$upgrader->install($api->download_link); $upgrader->install($api->download_link);
include('admin-footer.php'); include('admin-footer.php');
} elseif ( 'upload-plugin' == $action ) { } elseif ( 'upload-plugin' == $action ) {
@ -98,7 +98,7 @@ if ( isset($_GET['action']) ) {
$parent_file = 'plugins.php'; $parent_file = 'plugins.php';
$submenu_file = 'plugin-install.php'; $submenu_file = 'plugin-install.php';
require_once('admin-header.php'); require_once('admin-header.php');
$title = sprintf( __('Installing Plugin from uploaded file: %s'), basename( $file_upload->filename ) ); $title = sprintf( __('Installing Plugin from uploaded file: %s'), basename( $file_upload->filename ) );
$nonce = 'plugin-upload'; $nonce = 'plugin-upload';
$url = add_query_arg(array('package' => $file_upload->filename ), 'update.php?action=upload-plugin'); $url = add_query_arg(array('package' => $file_upload->filename ), 'update.php?action=upload-plugin');
@ -130,14 +130,14 @@ if ( isset($_GET['action']) ) {
$upgrader->upgrade($theme); $upgrader->upgrade($theme);
include('admin-footer.php'); include('admin-footer.php');
} elseif ( 'install-theme' == $action ) { } elseif ( 'install-theme' == $action ) {
if ( ! current_user_can('install_themes') ) if ( ! current_user_can('install_themes') )
wp_die(__('You do not have sufficient permissions to install themes for this blog.')); wp_die(__('You do not have sufficient permissions to install themes for this blog.'));
include_once ABSPATH . 'wp-admin/includes/theme-install.php'; //for themes_api.. include_once ABSPATH . 'wp-admin/includes/theme-install.php'; //for themes_api..
check_admin_referer('install-theme_' . $theme); check_admin_referer('install-theme_' . $theme);
$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth. $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.
@ -150,17 +150,17 @@ if ( isset($_GET['action']) ) {
$parent_file = 'themes.php'; $parent_file = 'themes.php';
$submenu_file = 'theme-install.php'; $submenu_file = 'theme-install.php';
require_once('admin-header.php'); require_once('admin-header.php');
$title = sprintf( __('Installing theme: %s'), $api->name . ' ' . $api->version ); $title = sprintf( __('Installing theme: %s'), $api->name . ' ' . $api->version );
$nonce = 'install-theme_' . $theme; $nonce = 'install-theme_' . $theme;
$url = 'update.php?action=install-theme&theme=' . $theme; $url = 'update.php?action=install-theme&theme=' . $theme;
$type = 'web'; //Install theme type, From Web or an Upload. $type = 'web'; //Install theme type, From Web or an Upload.
$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) ); $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
$upgrader->install($api->download_link); $upgrader->install($api->download_link);
include('admin-footer.php'); include('admin-footer.php');
} elseif ( 'upload-theme' == $action ) { } elseif ( 'upload-theme' == $action ) {
if ( ! current_user_can('install_themes') ) if ( ! current_user_can('install_themes') )

View File

@ -49,7 +49,7 @@
</li> </li>
<?php }?> <?php }?>
</ul> </ul>
<ul role="navigation"> <ul role="navigation">
<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?> <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>

View File

@ -1184,8 +1184,8 @@ class Walker_Page extends Walker {
} elseif ( $page->ID == get_option('page_for_posts') ) { } elseif ( $page->ID == get_option('page_for_posts') ) {
$css_class[] = 'current_page_parent'; $css_class[] = 'current_page_parent';
} }
$css_class = implode(' ', apply_filters('page_css_class', $css_class, $page)); $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));
$output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>'; $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';

View File

@ -908,12 +908,12 @@ function comments_popup_script($width=400, $height=400, $file='') {
*/ */
function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post; global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
if ( false === $zero ) $zero = __( 'No Comments' ); if ( false === $zero ) $zero = __( 'No Comments' );
if ( false === $one ) $one = __( '1 Comment' ); if ( false === $one ) $one = __( '1 Comment' );
if ( false === $more ) $more = __( '% Comments' ); if ( false === $more ) $more = __( '% Comments' );
if ( false === $none ) $none = __( 'Comments Off' ); if ( false === $none ) $none = __( 'Comments Off' );
$number = get_comments_number( $id ); $number = get_comments_number( $id );
if ( 0 == $number && !comments_open() && !pings_open() ) { if ( 0 == $number && !comments_open() && !pings_open() ) {
@ -1115,7 +1115,7 @@ function comment_id_fields() {
*/ */
function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = TRUE ) { function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = TRUE ) {
global $comment; global $comment;
if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' ); if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' ); if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' );

View File

@ -40,7 +40,7 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" /> <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
<id><?php bloginfo_rss('comments_atom_url'); ?></id> <id><?php bloginfo_rss('comments_atom_url'); ?></id>
<?php } ?> <?php } ?>
<?php do_action('comments_atom_head'); ?> <?php do_action('comments_atom_head'); ?>
<?php <?php
if ( have_comments() ) : while ( have_comments() ) : the_comment(); if ( have_comments() ) : while ( have_comments() ) : the_comment();
$comment_post = get_post($comment->comment_post_ID); $comment_post = get_post($comment->comment_post_ID);

View File

@ -46,7 +46,7 @@ function wptexturize($text) {
$static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn&#8211;', '...', '``', '\'s', '\'\'', ' (tm)'), $cockney); $static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn&#8211;', '...', '``', '\'s', '\'\'', ' (tm)'), $cockney);
$static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', ' &#8211; ', 'xn--', '&#8230;', '&#8220;', '&#8217;s', '&#8221;', ' &#8482;'), $cockneyreplace); $static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', ' &#8211; ', 'xn--', '&#8230;', '&#8220;', '&#8217;s', '&#8221;', ' &#8482;'), $cockneyreplace);
$dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/'); $dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/');
$dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1&#8220;$2', '&#8221;$1', '&#8217;$1', '$1&#215;$2'); $dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1&#8220;$2', '&#8221;$1', '&#8217;$1', '$1&#215;$2');

View File

@ -96,11 +96,11 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
// specially computed timestamp // specially computed timestamp
$gmt = true; $gmt = true;
} }
// store original value for language with untypical grammars // store original value for language with untypical grammars
// see http://core.trac.wordpress.org/ticket/9396 // see http://core.trac.wordpress.org/ticket/9396
$req_format = $dateformatstring; $req_format = $dateformatstring;
$datefunc = $gmt? 'gmdate' : 'date'; $datefunc = $gmt? 'gmdate' : 'date';
if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
@ -1683,7 +1683,7 @@ function is_blog_installed() {
// If siteurl is not set to autoload, check it specifically // If siteurl is not set to autoload, check it specifically
if ( !isset( $alloptions['siteurl'] ) ) if ( !isset( $alloptions['siteurl'] ) )
$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
else else
$installed = $alloptions['siteurl']; $installed = $alloptions['siteurl'];
$wpdb->suppress_errors( $suppress ); $wpdb->suppress_errors( $suppress );

View File

@ -934,7 +934,7 @@ function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $ex
$post->post_title = $previous ? __('Previous Post') : __('Next Post'); $post->post_title = $previous ? __('Previous Post') : __('Next Post');
$date = mysql2date(get_option('date_format'), $post->post_date); $date = mysql2date(get_option('date_format'), $post->post_date);
$title = str_replace('%title', $post->post_title, $title); $title = str_replace('%title', $post->post_title, $title);
$title = str_replace('%date', $date, $title); $title = str_replace('%date', $date, $title);
$title = apply_filters('the_title', $title, $post); $title = apply_filters('the_title', $title, $post);
@ -1050,8 +1050,8 @@ function get_boundary_post($in_same_cat = false, $excluded_categories = '', $sta
*/ */
function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
$posts = get_boundary_post($in_same_cat,$excluded_categories,$start); $posts = get_boundary_post($in_same_cat,$excluded_categories,$start);
// Even though we limited get_posts to return only 1 item it still returns an array of objects. // Even though we limited get_posts to return only 1 item it still returns an array of objects.
$post = $posts[0]; $post = $posts[0];
if ( empty($post) ) if ( empty($post) )
return; return;
@ -1104,7 +1104,7 @@ function get_index_rel_link() {
* @since 2.8.0 * @since 2.8.0
*/ */
function index_rel_link() { function index_rel_link() {
echo get_index_rel_link(); echo get_index_rel_link();
} }
/** /**

View File

@ -414,7 +414,7 @@ function get_body_class( $class = '' ) {
} }
} elseif ( is_page() ) { } elseif ( is_page() ) {
$classes[] = 'page'; $classes[] = 'page';
$wp_query->post = $wp_query->posts[0]; $wp_query->post = $wp_query->posts[0];
setup_postdata($wp_query->post); setup_postdata($wp_query->post);

View File

@ -2006,7 +2006,7 @@ class WP_Query {
$q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'"); $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
$q['author'] = get_user_by('slug', $q['author_name']); $q['author'] = get_user_by('slug', $q['author_name']);
if ( $q['author'] ) if ( $q['author'] )
$q['author'] = $q['author']->ID; $q['author'] = $q['author']->ID;
$whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')'; $whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')';
} }

View File

@ -187,7 +187,7 @@ function wp_insert_user($userdata) {
} }
$user_nicename = $alt_user_nicename; $user_nicename = $alt_user_nicename;
} }
$data = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' ); $data = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' );
$data = stripslashes_deep( $data ); $data = stripslashes_deep( $data );

View File

@ -168,7 +168,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add_data( 'thickbox', 'group', 1 ); $scripts->add_data( 'thickbox', 'group', 1 );
$scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.5-1'); $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.5-1');
if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) { if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) {
$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031'); $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031');
$scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload'), '2.2.0-20081031'); $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload'), '2.2.0-20081031');

View File

@ -23,7 +23,7 @@ function create_initial_taxonomies() {
$wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories')); $wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories'));
$wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags')); $wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Post Tags'));
$wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false); $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false);
} }
add_action( 'init', 'create_initial_taxonomies' ); add_action( 'init', 'create_initial_taxonomies' );
@ -1078,7 +1078,7 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
* *
* The $args 'default' will only override the terms found, if there is only one * The $args 'default' will only override the terms found, if there is only one
* term found. Any other and the found terms are used. * term found. Any other and the found terms are used.
* *
* The $args 'force_default' will force the term supplied as default to be * The $args 'force_default' will force the term supplied as default to be
* assigned even if the object was not going to be termless * assigned even if the object was not going to be termless
* @package WordPress * @package WordPress
@ -1413,7 +1413,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
* @uses $wpdb * @uses $wpdb
* *
* @param int $object_id The object to relate to. * @param int $object_id The object to relate to.
* @param array|int|string $term The slug or id of the term, will replace all existing * @param array|int|string $term The slug or id of the term, will replace all existing
* related terms in this taxonomy. * related terms in this taxonomy.
* @param array|string $taxonomy The context in which to relate the term to the object. * @param array|string $taxonomy The context in which to relate the term to the object.
* @param bool $append If false will delete difference of terms. * @param bool $append If false will delete difference of terms.

View File

@ -186,12 +186,12 @@ function get_theme_data( $theme_file ) {
if ( preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri ) ) if ( preg_match( '|Theme URI:(.*)$|mi', $theme_data, $theme_uri ) )
$theme_uri = clean_url( trim( $theme_uri[1] ) ); $theme_uri = clean_url( trim( $theme_uri[1] ) );
else else
$theme_uri = ''; $theme_uri = '';
if ( preg_match( '|Description:(.*)$|mi', $theme_data, $description ) ) if ( preg_match( '|Description:(.*)$|mi', $theme_data, $description ) )
$description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) ); $description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) );
else else
$description = ''; $description = '';
if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) ) if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
@ -374,7 +374,7 @@ function get_themes() {
} }
@ $stylesheet_dir->close(); @ $stylesheet_dir->close();
} }
$template_dir = @ dir("$theme_root/$template"); $template_dir = @ dir("$theme_root/$template");
if ( $template_dir ) { if ( $template_dir ) {
while ( ($file = $template_dir->read()) !== false ) { while ( ($file = $template_dir->read()) !== false ) {
@ -393,7 +393,7 @@ function get_themes() {
@ $template_subdir->close(); @ $template_subdir->close();
} }
} }
@ $template_dir->close(); @ $template_dir->close();
} }
$template_dir = dirname($template_files[0]); $template_dir = dirname($template_files[0]);
@ -1150,7 +1150,7 @@ function theme_basename($file) {
$file = preg_replace('|/+|','/', $file); // remove any duplicate slash $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
$theme_dir = str_replace('\\','/', get_theme_root()); // sanitize for Win32 installs $theme_dir = str_replace('\\','/', get_theme_root()); // sanitize for Win32 installs
$theme_dir = preg_replace('|/+|','/', $theme_dir); // remove any duplicate slash $theme_dir = preg_replace('|/+|','/', $theme_dir); // remove any duplicate slash
$file = preg_replace('|^.*/themes/.*?/|','',$file); // get relative path from theme dir $file = preg_replace('|^.*/themes/.*?/|','',$file); // get relative path from theme dir
return $file; return $file;
} }

View File

@ -35,7 +35,7 @@ class WP_Widget {
// Member functions that you must over-ride. // Member functions that you must over-ride.
/** Echo the widget content. /** Echo the widget content.
* *
* Subclasses should over-ride this function to generate their widget code. * Subclasses should over-ride this function to generate their widget code.
* *
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
@ -46,7 +46,7 @@ class WP_Widget {
} }
/** Update a particular instance. /** Update a particular instance.
* *
* This function should check that $new_instance is set correctly. * This function should check that $new_instance is set correctly.
* The newly calculated value of $instance should be returned. * The newly calculated value of $instance should be returned.
* If "false" is returned, the instance won't be saved/updated. * If "false" is returned, the instance won't be saved/updated.
@ -60,7 +60,7 @@ class WP_Widget {
} }
/** Echo the settings update form /** Echo the settings update form
* *
* @param array $instance Current settings * @param array $instance Current settings
*/ */
function form($instance) { function form($instance) {
@ -96,9 +96,9 @@ class WP_Widget {
} }
/** Constructs name attributes for use in form() fields /** Constructs name attributes for use in form() fields
* *
* This function should be used in form() methods to create name attributes for fields to be saved by update() * This function should be used in form() methods to create name attributes for fields to be saved by update()
* *
* @param string $field_name Field name * @param string $field_name Field name
* @return string Name attribute for $field_name * @return string Name attribute for $field_name
*/ */
@ -107,9 +107,9 @@ class WP_Widget {
} }
/** Constructs id attributes for use in form() fields /** Constructs id attributes for use in form() fields
* *
* This function should be used in form() methods to create id attributes for fields to be saved by update() * This function should be used in form() methods to create id attributes for fields to be saved by update()
* *
* @param string $field_name Field name * @param string $field_name Field name
* @return string ID attribute for $field_name * @return string ID attribute for $field_name
*/ */

View File

@ -751,7 +751,7 @@ class wpdb {
return $this->query( $this->prepare( $sql, $data) ); return $this->query( $this->prepare( $sql, $data) );
} }
/** /**
* Update a row in the table * Update a row in the table
* *