!
bulk_actions(); ?>
";
! echo call_user_func( array( &$this, 'column_' . $column_name ), $item );
echo "";
}
else {
--- 867,873 ----
}
elseif ( method_exists( $this, 'column_' . $column_name ) ) {
echo "
";
! echo call_user_func( array( $this, 'column_' . $column_name ), $item );
echo " ";
}
else {
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-media-list-table.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-media-list-table.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-media-list-table.php 2013-06-01 04:40:00.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-media-list-table.php 2013-10-23 09:40:10.000000000 -0500
***************
*** 301,311 ****
break;
case 'parent':
! if ( $post->post_parent > 0 && get_post( $post->post_parent ) ) {
$title = _draft_or_post_title( $post->post_parent );
?>
>
! post_parent ) ) { ?>
post_parent > 0 )
! $parent = get_post( $post->post_parent );
! else
! $parent = false;
!
! if ( $parent ) {
$title = _draft_or_post_title( $post->post_parent );
+ $parent_type = get_post_type_object( $parent->post_type );
?>
>
! post_parent ) && $parent_type->show_ui ) { ?>
+
+
items = array_reverse( $this->items );
} else {
! uasort( $this->items, array( &$this, '_order_callback' ) );
}
}
--- 108,114 ----
if ( 'ASC' == $order )
$this->items = array_reverse( $this->items );
} else {
! uasort( $this->items, array( $this, '_order_callback' ) );
}
}
***************
*** 284,291 ****
if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $stylesheet != get_option( 'stylesheet' ) && $stylesheet != get_option( 'template' ) )
$actions['delete'] = '' . __( 'Delete' ) . ' ';
! $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $stylesheet, $theme, $context );
! $actions = apply_filters( "theme_action_links_$stylesheet", $actions, $stylesheet, $theme, $context );
$class = ! $allowed ? 'inactive' : 'active';
$checkbox_id = "checkbox_" . md5( $theme->get('Name') );
--- 284,291 ----
if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $stylesheet != get_option( 'stylesheet' ) && $stylesheet != get_option( 'template' ) )
$actions['delete'] = '' . __( 'Delete' ) . ' ';
! $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme, $context );
! $actions = apply_filters( "theme_action_links_$stylesheet", $actions, $theme, $context );
$class = ! $allowed ? 'inactive' : 'active';
$checkbox_id = "checkbox_" . md5( $theme->get('Name') );
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-plugin-install-list-table.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-plugin-install-list-table.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-plugin-install-list-table.php 2013-03-01 11:00:25.000000000 -0600
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-plugin-install-list-table.php 2013-09-25 21:48:09.000000000 -0500
***************
*** 37,43 ****
--- 37,59 ----
$nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
+ /**
+ * Filter the tabs shown on the Plugin Install screen.
+ *
+ * @since 2.7.0
+ *
+ * @param array $tabs The tabs shown on the Plugin Install screen. Defaults are 'dashboard', 'search',
+ * 'upload', 'featured', 'popular', 'new', and 'favorites'.
+ */
$tabs = apply_filters( 'install_plugins_tabs', $tabs );
+
+ /**
+ * Filter tabs not associated with a menu item on the Plugin Install screen.
+ *
+ * @since 2.7.0
+ *
+ * @param array $nonmenu_tabs The tabs that don't have a Menu item on the Plugin Install screen.
+ */
$nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs );
// If a non-valid menu tab has been selected, And it's not a non-menu action.
***************
*** 85,92 ****
--- 101,122 ----
default:
$args = false;
+ break;
}
+ /**
+ * Filter API request arguments for each Plugin Install screen tab.
+ *
+ * The dynamic portion of the hook name, $tab, refers to the plugin install tabs.
+ * Default tabs are 'dashboard', 'search', 'upload', 'featured', 'popular', 'new',
+ * and 'favorites'.
+ *
+ * @since 3.7.0
+ *
+ * @param array|bool $args Plugin Install API arguments.
+ */
+ $args = apply_filters( "install_plugins_table_api_args_$tab", $args );
+
if ( !$args )
return;
***************
*** 124,130 ****
if ( 'top' == $which ) { ?>
!
pagination( $which ); ?>
--- 154,166 ----
if ( 'top' == $which ) { ?>
!
pagination( $which ); ?>
***************
*** 218,223 ****
--- 254,267 ----
}
}
+ /**
+ * Filter the install action links for a plugin.
+ *
+ * @since 2.7.0
+ *
+ * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now.
+ * @param array $plugin The plugin currently being listed.
+ */
$action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
?>
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-plugins-list-table.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-plugins-list-table.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-plugins-list-table.php 2013-07-08 08:04:07.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-plugins-list-table.php 2013-09-13 04:37:10.000000000 -0500
***************
*** 99,105 ****
if ( $s ) {
$status = 'search';
! $plugins['search'] = array_filter( $plugins['all'], array( &$this, '_search_callback' ) );
}
$totals = array();
--- 99,105 ----
if ( $s ) {
$status = 'search';
! $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) );
}
$totals = array();
***************
*** 121,127 ****
$orderby = ucfirst( $orderby );
$order = strtoupper( $order );
! uasort( $this->items, array( &$this, '_order_callback' ) );
}
$plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 );
--- 121,127 ----
$orderby = ucfirst( $orderby );
$order = strtoupper( $order );
! uasort( $this->items, array( $this, '_order_callback' ) );
}
$plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 );
***************
*** 321,327 ****
if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
$is_active = true;
$description = '' . $dropins[ $plugin_file ][0] . '
';
! } elseif ( constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
$is_active = true;
$description = '' . $dropins[ $plugin_file ][0] . '
';
} else {
--- 321,327 ----
if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
$is_active = true;
$description = '' . $dropins[ $plugin_file ][0] . '
';
! } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
$is_active = true;
$description = '' . $dropins[ $plugin_file ][0] . '
';
} else {
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-posts-list-table.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-posts-list-table.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-posts-list-table.php 2013-07-23 10:04:55.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-posts-list-table.php 2013-10-22 12:22:11.000000000 -0500
***************
*** 57,65 ****
$post_type_object = get_post_type_object( $post_type );
if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
$this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
SELECT COUNT( 1 ) FROM $wpdb->posts
! WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
AND post_author = %d
", $post_type, get_current_user_id() ) );
--- 57,66 ----
$post_type_object = get_post_type_object( $post_type );
if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
+ $exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false ) );
$this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
SELECT COUNT( 1 ) FROM $wpdb->posts
! WHERE post_type = %s AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
AND post_author = %d
", $post_type, get_current_user_id() ) );
***************
*** 69,75 ****
if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
! $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) );
}
}
--- 70,76 ----
if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
! $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) );
}
}
***************
*** 417,428 ****
*
* @since 3.1.0 (Standalone function exists since 2.6.0)
*
! * @param unknown_type $children_pages
! * @param unknown_type $count
! * @param unknown_type $parent
! * @param unknown_type $level
! * @param unknown_type $pagenum
! * @param unknown_type $per_page
*/
function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
--- 418,429 ----
*
* @since 3.1.0 (Standalone function exists since 2.6.0)
*
! * @param array $children_pages
! * @param int $count
! * @param int $parent
! * @param int $level
! * @param int $pagenum
! * @param int $per_page
*/
function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
***************
*** 539,546 ****
$level++;
$find_main_page = (int) $parent->post_parent;
! if ( !isset( $parent_name ) )
$parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
}
}
}
--- 540,549 ----
$level++;
$find_main_page = (int) $parent->post_parent;
! if ( !isset( $parent_name ) ) {
! /** This filter is documented in wp-includes/post-template.php */
$parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
+ }
}
}
}
***************
*** 1034,1039 ****
--- 1037,1069 ----
+
+ post_type, 'post-formats' ) ) {
+ $all_post_formats = get_post_format_strings();
+
+ ?>
+
+
+
+
+ $format ) {
+ ?>
+
+
+
+
+
+ post_type, 'author' ) ) { ?>
+
+
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-terms-list-table.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-terms-list-table.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-terms-list-table.php 2013-05-27 23:53:46.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-terms-list-table.php 2013-07-28 16:06:19.000000000 -0500
***************
*** 259,265 ****
}
if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
$actions['delete'] = "term_id ) . "'>" . __( 'Delete' ) . " ";
! $actions['view'] = '' . __( 'View' ) . ' ';
$actions = apply_filters( 'tag_row_actions', $actions, $tag );
$actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
--- 259,266 ----
}
if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
$actions['delete'] = "term_id ) . "'>" . __( 'Delete' ) . " ";
! if ( $tax->public )
! $actions['view'] = '' . __( 'View' ) . ' ';
$actions = apply_filters( 'tag_row_actions', $actions, $tag );
$actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-theme-install-list-table.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-theme-install-list-table.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-theme-install-list-table.php 2013-06-05 11:51:07.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-theme-install-list-table.php 2013-08-21 01:52:12.000000000 -0500
***************
*** 90,97 ****
--- 90,100 ----
default:
$args = false;
+ break;
}
+ $args = apply_filters( 'install_themes_table_api_args_' . $tab, $args );
+
if ( ! $args )
return;
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-themes-list-table.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-themes-list-table.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-themes-list-table.php 2013-03-01 11:00:25.000000000 -0600
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-themes-list-table.php 2013-09-11 19:03:10.000000000 -0500
***************
*** 114,119 ****
--- 114,129 ----
return array();
}
+ function display_rows_or_placeholder() {
+ if ( $this->has_items() ) {
+ $this->display_rows();
+ } else {
+ echo '';
+ $this->no_items();
+ echo '
';
+ }
+ }
+
function display_rows() {
$themes = $this->items;
***************
*** 149,154 ****
--- 159,165 ----
. "' );" . '">' . __( 'Delete' ) . '';
$actions = apply_filters( 'theme_action_links', $actions, $theme );
+ $actions = apply_filters( "theme_action_links_$stylesheet", $actions, $theme );
$delete_action = isset( $actions['delete'] ) ? '' . $actions['delete'] . '
' : '';
unset( $actions['delete'] );
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-upgrader.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-upgrader.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-upgrader.php 2013-06-21 00:54:40.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-upgrader.php 2013-10-23 21:00:09.000000000 -0500
***************
*** 11,21 ****
* @since 2.8.0
*/
/**
* WordPress Upgrader class for Upgrading/Installing a local set of files via the Filesystem Abstraction classes from a Zip file.
*
- * @TODO More Detailed docs, for methods as well.
- *
* @package WordPress
* @subpackage Upgrader
* @since 2.8.0
--- 11,21 ----
* @since 2.8.0
*/
+ require ABSPATH . 'wp-admin/includes/class-wp-upgrader-skins.php';
+
/**
* WordPress Upgrader class for Upgrading/Installing a local set of files via the Filesystem Abstraction classes from a Zip file.
*
* @package WordPress
* @subpackage Upgrader
* @since 2.8.0
***************
*** 93,100 ****
if ( ! $wp_filesystem->wp_plugins_dir() )
return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']);
break;
! case WP_CONTENT_DIR . '/themes':
! if ( ! $wp_filesystem->find_folder(WP_CONTENT_DIR . '/themes') )
return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']);
break;
default:
--- 93,100 ----
if ( ! $wp_filesystem->wp_plugins_dir() )
return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']);
break;
! case get_theme_root():
! if ( ! $wp_filesystem->wp_themes_dir() )
return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']);
break;
default:
***************
*** 108,113 ****
--- 108,126 ----
function download_package($package) {
+ /**
+ * Filter whether to return the package.
+ *
+ * @since 3.7.0
+ *
+ * @param bool $reply Whether to bail without returning the package. Default is false.
+ * @param string $package The package file name.
+ * @param object $this The WP_Upgrader instance.
+ */
+ $reply = apply_filters( 'upgrader_pre_download', false, $package, $this );
+ if ( false !== $reply )
+ return $reply;
+
if ( ! preg_match('!^(http|https|ftp)://!i', $package) && file_exists($package) ) //Local file or remote?
return $package; //must be a local file..
***************
*** 146,152 ****
$wp_filesystem->delete($working_dir, true);
// Unzip package to working directory
! $result = unzip_file($package, $working_dir); //TODO optimizations, Copy when Move/Rename would suffice?
// Once extracted, delete the package if required.
if ( $delete_package )
--- 159,165 ----
$wp_filesystem->delete($working_dir, true);
// Unzip package to working directory
! $result = unzip_file( $package, $working_dir );
// Once extracted, delete the package if required.
if ( $delete_package )
***************
*** 163,174 ****
return $working_dir;
}
! function install_package($args = array()) {
! global $wp_filesystem;
! $defaults = array( 'source' => '', 'destination' => '', //Please always pass these
! 'clear_destination' => false, 'clear_working' => false,
! 'abort_if_destination_exists' => true,
! 'hook_extra' => array());
$args = wp_parse_args($args, $defaults);
extract($args);
--- 176,192 ----
return $working_dir;
}
! function install_package( $args = array() ) {
! global $wp_filesystem, $wp_theme_directories;
!
! $defaults = array(
! 'source' => '', // Please always pass this
! 'destination' => '', // and this
! 'clear_destination' => false,
! 'clear_working' => false,
! 'abort_if_destination_exists' => true,
! 'hook_extra' => array()
! );
$args = wp_parse_args($args, $defaults);
extract($args);
***************
*** 195,201 ****
if ( 1 == count($source_files) && $wp_filesystem->is_dir( trailingslashit($source) . $source_files[0] . '/') ) //Only one folder? Then we want its contents.
$source = trailingslashit($source) . trailingslashit($source_files[0]);
elseif ( count($source_files) == 0 )
! return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $this->strings['no_files'] ); //There are no files?
else //It's only a single file, the upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename.
$source = trailingslashit($source);
--- 213,219 ----
if ( 1 == count($source_files) && $wp_filesystem->is_dir( trailingslashit($source) . $source_files[0] . '/') ) //Only one folder? Then we want its contents.
$source = trailingslashit($source) . trailingslashit($source_files[0]);
elseif ( count($source_files) == 0 )
! return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files?
else //It's only a single file, the upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename.
$source = trailingslashit($source);
***************
*** 208,215 ****
if ( $source !== $remote_source )
$source_files = array_keys( $wp_filesystem->dirlist($source) );
! //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') ) ) {
$remote_destination = trailingslashit($remote_destination) . trailingslashit(basename($source));
$destination = trailingslashit($destination) . trailingslashit(basename($source));
}
--- 226,238 ----
if ( $source !== $remote_source )
$source_files = array_keys( $wp_filesystem->dirlist($source) );
! // Protection against deleting files in any important base directories.
! // Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the destination directory (WP_PLUGIN_DIR / wp-content/themes)
! // intending to copy the directory into the directory, whilst they pass the source as the actual files to copy.
! $protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
! if ( is_array( $wp_theme_directories ) )
! $protected_directories = array_merge( $protected_directories, $wp_theme_directories );
! if ( in_array( $destination, $protected_directories ) ) {
$remote_destination = trailingslashit($remote_destination) . trailingslashit(basename($source));
$destination = trailingslashit($destination) . trailingslashit(basename($source));
}
***************
*** 239,245 ****
//Create destination if needed
if ( !$wp_filesystem->exists($remote_destination) )
if ( !$wp_filesystem->mkdir($remote_destination, FS_CHMOD_DIR) )
! return new WP_Error('mkdir_failed', $this->strings['mkdir_failed'], $remote_destination);
// Copy new version of item into place.
$result = copy_dir($source, $remote_destination);
--- 262,268 ----
//Create destination if needed
if ( !$wp_filesystem->exists($remote_destination) )
if ( !$wp_filesystem->mkdir($remote_destination, FS_CHMOD_DIR) )
! return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
// Copy new version of item into place.
$result = copy_dir($source, $remote_destination);
***************
*** 271,308 ****
function run($options) {
! $defaults = array( 'package' => '', //Please always pass this.
! 'destination' => '', //And this
! 'clear_destination' => false,
! 'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
! 'clear_working' => true,
! 'is_multi' => false,
! 'hook_extra' => array() //Pass any extra $hook_extra args here, this will be passed to any hooked filters.
! );
$options = wp_parse_args($options, $defaults);
extract($options);
! //Connect to the Filesystem first.
$res = $this->fs_connect( array(WP_CONTENT_DIR, $destination) );
! if ( ! $res ) //Mainly for non-connected filesystem.
return false;
if ( is_wp_error($res) ) {
$this->skin->error($res);
return $res;
}
- if ( !$is_multi ) // call $this->header separately if running multiple times
- $this->skin->header();
-
- $this->skin->before();
-
//Download the package (Note, This just returns the filename of the file if the package is a local file)
$download = $this->download_package( $package );
if ( is_wp_error($download) ) {
$this->skin->error($download);
$this->skin->after();
return $download;
}
--- 294,341 ----
function run($options) {
! $defaults = array(
! 'package' => '', // Please always pass this.
! 'destination' => '', // And this
! 'clear_destination' => false,
! 'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
! 'clear_working' => true,
! 'is_multi' => false,
! 'hook_extra' => array() // Pass any extra $hook_extra args here, this will be passed to any hooked filters.
! );
$options = wp_parse_args($options, $defaults);
extract($options);
! if ( ! $is_multi ) // call $this->header separately if running multiple times
! $this->skin->header();
!
! // Connect to the Filesystem first.
$res = $this->fs_connect( array(WP_CONTENT_DIR, $destination) );
! // Mainly for non-connected filesystem.
! if ( ! $res ) {
! if ( ! $is_multi )
! $this->skin->footer();
return false;
+ }
+
+ $this->skin->before();
if ( is_wp_error($res) ) {
$this->skin->error($res);
+ $this->skin->after();
+ if ( ! $is_multi )
+ $this->skin->footer();
return $res;
}
//Download the package (Note, This just returns the filename of the file if the package is a local file)
$download = $this->download_package( $package );
if ( is_wp_error($download) ) {
$this->skin->error($download);
$this->skin->after();
+ if ( ! $is_multi )
+ $this->skin->footer();
return $download;
}
***************
*** 313,330 ****
if ( is_wp_error($working_dir) ) {
$this->skin->error($working_dir);
$this->skin->after();
return $working_dir;
}
//With the given options, this installs it to the destination directory.
$result = $this->install_package( array(
! 'source' => $working_dir,
! 'destination' => $destination,
! 'clear_destination' => $clear_destination,
! 'abort_if_destination_exists' => $abort_if_destination_exists,
! 'clear_working' => $clear_working,
! 'hook_extra' => $hook_extra
! ) );
$this->skin->set_result($result);
if ( is_wp_error($result) ) {
$this->skin->error($result);
--- 346,366 ----
if ( is_wp_error($working_dir) ) {
$this->skin->error($working_dir);
$this->skin->after();
+ if ( ! $is_multi )
+ $this->skin->footer();
return $working_dir;
}
//With the given options, this installs it to the destination directory.
$result = $this->install_package( array(
! 'source' => $working_dir,
! 'destination' => $destination,
! 'clear_destination' => $clear_destination,
! 'abort_if_destination_exists' => $abort_if_destination_exists,
! 'clear_working' => $clear_working,
! 'hook_extra' => $hook_extra
! ) );
!
$this->skin->set_result($result);
if ( is_wp_error($result) ) {
$this->skin->error($result);
***************
*** 333,342 ****
//Install Succeeded
$this->skin->feedback('process_success');
}
$this->skin->after();
! if ( !$is_multi )
$this->skin->footer();
return $result;
}
--- 369,381 ----
//Install Succeeded
$this->skin->feedback('process_success');
}
+
$this->skin->after();
! if ( ! $is_multi ) {
! do_action( 'upgrader_process_complete', $this, $hook_extra );
$this->skin->footer();
+ }
return $result;
}
***************
*** 361,368 ****
/**
* Plugin Upgrader class for WordPress Plugins, It is designed to upgrade/install plugins from a local zip, remote zip URL, or uploaded zip file.
*
- * @TODO More Detailed docs, for methods as well.
- *
* @package WordPress
* @subpackage Upgrader
* @since 2.8.0
--- 400,405 ----
***************
*** 394,428 ****
$this->strings['process_success'] = __('Plugin installed successfully.');
}
! function install($package) {
$this->init();
$this->install_strings();
! add_filter('upgrader_source_selection', array(&$this, 'check_package') );
! $this->run(array(
! 'package' => $package,
! 'destination' => WP_PLUGIN_DIR,
! 'clear_destination' => false, //Do not overwrite files.
! 'clear_working' => true,
! 'hook_extra' => array()
! ));
! remove_filter('upgrader_source_selection', array(&$this, 'check_package') );
if ( ! $this->result || is_wp_error($this->result) )
return $this->result;
// Force refresh of plugin update information
! delete_site_transient('update_plugins');
! wp_cache_delete( 'plugins', 'plugins' );
! do_action( 'upgrader_process_complete', $this, array( 'action' => 'install', 'type' => 'plugin' ), $package );
return true;
}
! function upgrade($plugin) {
$this->init();
$this->upgrade_strings();
--- 431,476 ----
$this->strings['process_success'] = __('Plugin installed successfully.');
}
! function install( $package, $args = array() ) {
!
! $defaults = array(
! 'clear_update_cache' => true,
! );
! $parsed_args = wp_parse_args( $args, $defaults );
$this->init();
$this->install_strings();
! add_filter('upgrader_source_selection', array($this, 'check_package') );
! $this->run( array(
! 'package' => $package,
! 'destination' => WP_PLUGIN_DIR,
! 'clear_destination' => false, // Do not overwrite files.
! 'clear_working' => true,
! 'hook_extra' => array(
! 'type' => 'plugin',
! 'action' => 'install',
! )
! ) );
! remove_filter('upgrader_source_selection', array($this, 'check_package') );
if ( ! $this->result || is_wp_error($this->result) )
return $this->result;
// Force refresh of plugin update information
! wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
return true;
}
! function upgrade( $plugin, $args = array() ) {
!
! $defaults = array(
! 'clear_update_cache' => true,
! );
! $parsed_args = wp_parse_args( $args, $defaults );
$this->init();
$this->upgrade_strings();
***************
*** 439,472 ****
// Get the URL to the zip file
$r = $current->response[ $plugin ];
! 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);
! //'source_selection' => array(&$this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
!
! $this->run(array(
! 'package' => $r->package,
! 'destination' => WP_PLUGIN_DIR,
! 'clear_destination' => true,
! 'clear_working' => true,
! 'hook_extra' => array(
! 'plugin' => $plugin
! )
! ));
// Cleanup our hooks, in case something else does a upgrade on this connection.
! remove_filter('upgrader_pre_install', array(&$this, 'deactivate_plugin_before_upgrade'));
! remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
if ( ! $this->result || is_wp_error($this->result) )
return $this->result;
// Force refresh of plugin update information
! delete_site_transient('update_plugins');
! wp_cache_delete( 'plugins', 'plugins' );
! do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin' ), $plugin );
}
! function bulk_upgrade($plugins) {
$this->init();
$this->bulk = true;
--- 487,527 ----
// Get the URL to the zip file
$r = $current->response[ $plugin ];
! 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);
! //'source_selection' => array($this, 'source_selection'), //there's a trac ticket to move up the directory for zip's which are made a bit differently, useful for non-.org plugins.
!
! $this->run( array(
! 'package' => $r->package,
! 'destination' => WP_PLUGIN_DIR,
! 'clear_destination' => true,
! 'clear_working' => true,
! 'hook_extra' => array(
! 'plugin' => $plugin,
! 'type' => 'plugin',
! 'action' => 'update',
! ),
! ) );
// Cleanup our hooks, in case something else does a upgrade on this connection.
! remove_filter('upgrader_pre_install', array($this, 'deactivate_plugin_before_upgrade'));
! remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'));
if ( ! $this->result || is_wp_error($this->result) )
return $this->result;
// Force refresh of plugin update information
! wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
!
! return true;
}
! function bulk_upgrade( $plugins, $args = array() ) {
!
! $defaults = array(
! 'clear_update_cache' => true,
! );
! $parsed_args = wp_parse_args( $args, $defaults );
$this->init();
$this->bulk = true;
***************
*** 474,480 ****
$current = get_site_transient( 'update_plugins' );
! add_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'), 10, 4);
$this->skin->header();
--- 529,535 ----
$current = get_site_transient( 'update_plugins' );
! add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4);
$this->skin->header();
***************
*** 487,496 ****
$this->skin->bulk_header();
! // Only start maintenance mode if running in Multisite OR the plugin is in use
! $maintenance = is_multisite(); // @TODO: This should only kick in for individual sites if at all possible.
foreach ( $plugins as $plugin )
! $maintenance = $maintenance || (is_plugin_active($plugin) && isset($current->response[ $plugin ]) ); // Only activate Maintenance mode if a plugin is active AND has an update available
if ( $maintenance )
$this->maintenance_mode(true);
--- 542,554 ----
$this->skin->bulk_header();
! // Only start maintenance mode if:
! // - running Multisite and there are one or more plugins specified, OR
! // - a plugin with an update available is currently active.
! // @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
! $maintenance = ( is_multisite() && ! empty( $plugins ) );
foreach ( $plugins as $plugin )
! $maintenance = $maintenance || ( is_plugin_active( $plugin ) && isset( $current->response[ $plugin] ) );
if ( $maintenance )
$this->maintenance_mode(true);
***************
*** 516,531 ****
$this->skin->plugin_active = is_plugin_active($plugin);
! $result = $this->run(array(
! 'package' => $r->package,
! 'destination' => WP_PLUGIN_DIR,
! 'clear_destination' => true,
! 'clear_working' => true,
! 'is_multi' => true,
! 'hook_extra' => array(
! 'plugin' => $plugin
! )
! ));
$results[$plugin] = $this->result;
--- 574,589 ----
$this->skin->plugin_active = is_plugin_active($plugin);
! $result = $this->run( array(
! 'package' => $r->package,
! 'destination' => WP_PLUGIN_DIR,
! 'clear_destination' => true,
! 'clear_working' => true,
! 'is_multi' => true,
! 'hook_extra' => array(
! 'plugin' => $plugin
! )
! ) );
$results[$plugin] = $this->result;
***************
*** 536,552 ****
$this->maintenance_mode(false);
$this->skin->bulk_footer();
$this->skin->footer();
// Cleanup our hooks, in case something else does a upgrade on this connection.
! remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_plugin'));
// Force refresh of plugin update information
! delete_site_transient('update_plugins');
! wp_cache_delete( 'plugins', 'plugins' );
! do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin', 'bulk' => true ), $plugins );
return $results;
}
--- 594,615 ----
$this->maintenance_mode(false);
+ do_action( 'upgrader_process_complete', $this, array(
+ 'action' => 'update',
+ 'type' => 'plugin',
+ 'bulk' => true,
+ 'plugins' => $plugins,
+ ) );
+
$this->skin->bulk_footer();
$this->skin->footer();
// Cleanup our hooks, in case something else does a upgrade on this connection.
! remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'));
// Force refresh of plugin update information
! wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
return $results;
}
***************
*** 572,578 ****
}
if ( ! $plugins_found )
! return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('No valid plugins were found.') );
return $source;
}
--- 635,641 ----
}
if ( ! $plugins_found )
! return new WP_Error( 'incompatible_archive_no_plugins', $this->strings['incompatible_archive'], __( 'No valid plugins were found.' ) );
return $source;
}
***************
*** 599,604 ****
--- 662,671 ----
if ( is_wp_error($return) ) //Bypass.
return $return;
+ // When in cron (background updates) don't deactivate the plugin, as we require a browser to reactivate it
+ if ( defined( 'DOING_CRON' ) && DOING_CRON )
+ return $return;
+
$plugin = isset($plugin['plugin']) ? $plugin['plugin'] : '';
if ( empty($plugin) )
return new WP_Error('bad_request', $this->strings['bad_request']);
***************
*** 642,649 ****
/**
* Theme Upgrader class for WordPress Themes, It is designed to upgrade/install themes from a local zip, remote zip URL, or uploaded zip file.
*
- * @TODO More Detailed docs, for methods as well.
- *
* @package WordPress
* @subpackage Upgrader
* @since 2.8.0
--- 709,714 ----
***************
*** 705,711 ****
if ( ! $api || is_wp_error($api) ) {
$this->skin->feedback( 'parent_theme_not_found', $theme_info->get('Template') );
// Don't show activate or preview actions after install
! add_filter('install_theme_complete_actions', array(&$this, 'hide_activate_preview_actions') );
return $install_result;
}
--- 770,776 ----
if ( ! $api || is_wp_error($api) ) {
$this->skin->feedback( 'parent_theme_not_found', $theme_info->get('Template') );
// Don't show activate or preview actions after install
! add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') );
return $install_result;
}
***************
*** 724,736 ****
// Install the parent theme
$parent_result = $this->run( array(
'package' => $api->download_link,
! 'destination' => WP_CONTENT_DIR . '/themes',
'clear_destination' => false, //Do not overwrite files.
'clear_working' => true
) );
if ( is_wp_error($parent_result) )
! add_filter('install_theme_complete_actions', array(&$this, 'hide_activate_preview_actions') );
// Start cleaning up after the parents installation
remove_filter('install_theme_complete_actions', '__return_false', 999);
--- 789,801 ----
// Install the parent theme
$parent_result = $this->run( array(
'package' => $api->download_link,
! 'destination' => get_theme_root(),
'clear_destination' => false, //Do not overwrite files.
'clear_working' => true
) );
if ( is_wp_error($parent_result) )
! add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') );
// Start cleaning up after the parents installation
remove_filter('install_theme_complete_actions', '__return_false', 999);
***************
*** 748,784 ****
return $actions;
}
! function install($package) {
$this->init();
$this->install_strings();
! add_filter('upgrader_source_selection', array(&$this, 'check_package') );
! add_filter('upgrader_post_install', array(&$this, 'check_parent_theme_filter'), 10, 3);
!
! $options = array(
! 'package' => $package,
! 'destination' => WP_CONTENT_DIR . '/themes',
! 'clear_destination' => false, //Do not overwrite files.
! 'clear_working' => true
! );
! $this->run($options);
! remove_filter('upgrader_source_selection', array(&$this, 'check_package') );
! remove_filter('upgrader_post_install', array(&$this, 'check_parent_theme_filter'));
if ( ! $this->result || is_wp_error($this->result) )
return $this->result;
! // Force refresh of theme update information
! wp_clean_themes_cache();
! do_action( 'upgrader_process_complete', $this, array( 'action' => 'install', 'type' => 'theme' ), $package );
return true;
}
! function upgrade($theme) {
$this->init();
$this->upgrade_strings();
--- 813,860 ----
return $actions;
}
! function install( $package, $args = array() ) {
!
! $defaults = array(
! 'clear_update_cache' => true,
! );
! $parsed_args = wp_parse_args( $args, $defaults );
$this->init();
$this->install_strings();
! add_filter('upgrader_source_selection', array($this, 'check_package') );
! add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3);
! $this->run( array(
! 'package' => $package,
! 'destination' => get_theme_root(),
! 'clear_destination' => false, //Do not overwrite files.
! 'clear_working' => true,
! 'hook_extra' => array(
! 'type' => 'theme',
! 'action' => 'install',
! ),
! ) );
! remove_filter('upgrader_source_selection', array($this, 'check_package') );
! remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'));
if ( ! $this->result || is_wp_error($this->result) )
return $this->result;
! // Refresh the Theme Update information
! wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
return true;
}
! function upgrade( $theme, $args = array() ) {
!
! $defaults = array(
! 'clear_update_cache' => true,
! );
! $parsed_args = wp_parse_args( $args, $defaults );
$this->init();
$this->upgrade_strings();
***************
*** 795,831 ****
$r = $current->response[ $theme ];
! add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
! add_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
! add_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
!
! $options = array(
! 'package' => $r['package'],
! 'destination' => WP_CONTENT_DIR . '/themes',
! 'clear_destination' => true,
! 'clear_working' => true,
! 'hook_extra' => array(
! 'theme' => $theme
! )
! );
!
! $this->run($options);
!
! remove_filter('upgrader_pre_install', array(&$this, 'current_before'));
! remove_filter('upgrader_post_install', array(&$this, 'current_after'));
! remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'));
if ( ! $this->result || is_wp_error($this->result) )
return $this->result;
! // Force refresh of theme update information
! wp_clean_themes_cache();
! do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme' ), $theme );
return true;
}
! function bulk_upgrade($themes) {
$this->init();
$this->bulk = true;
--- 871,910 ----
$r = $current->response[ $theme ];
! add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
! add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
! add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
!
! $this->run( array(
! 'package' => $r['package'],
! 'destination' => get_theme_root( $theme ),
! 'clear_destination' => true,
! 'clear_working' => true,
! 'hook_extra' => array(
! 'theme' => $theme,
! 'type' => 'theme',
! 'action' => 'update',
! ),
! ) );
!
! remove_filter('upgrader_pre_install', array($this, 'current_before'));
! remove_filter('upgrader_post_install', array($this, 'current_after'));
! remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
if ( ! $this->result || is_wp_error($this->result) )
return $this->result;
! wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
return true;
}
! function bulk_upgrade( $themes, $args = array() ) {
!
! $defaults = array(
! 'clear_update_cache' => true,
! );
! $parsed_args = wp_parse_args( $args, $defaults );
$this->init();
$this->bulk = true;
***************
*** 833,841 ****
$current = get_site_transient( 'update_themes' );
! add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
! add_filter('upgrader_post_install', array(&$this, 'current_after'), 10, 2);
! add_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'), 10, 4);
$this->skin->header();
--- 912,920 ----
$current = get_site_transient( 'update_themes' );
! add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
! add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
! add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
$this->skin->header();
***************
*** 848,855 ****
$this->skin->bulk_header();
! // Only start maintenance mode if running in Multisite OR the theme is in use
! $maintenance = is_multisite(); // @TODO: This should only kick in for individual sites if at all possible.
foreach ( $themes as $theme )
$maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
if ( $maintenance )
--- 927,937 ----
$this->skin->bulk_header();
! // Only start maintenance mode if:
! // - running Multisite and there are one or more themes specified, OR
! // - a theme with an update available is currently in use.
! // @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
! $maintenance = ( is_multisite() && ! empty( $themes ) );
foreach ( $themes as $theme )
$maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
if ( $maintenance )
***************
*** 876,892 ****
// Get the URL to the zip file
$r = $current->response[ $theme ];
! $options = array(
! 'package' => $r['package'],
! 'destination' => WP_CONTENT_DIR . '/themes',
! 'clear_destination' => true,
! 'clear_working' => true,
! 'hook_extra' => array(
! 'theme' => $theme
! )
! );
!
! $result = $this->run($options);
$results[$theme] = $this->result;
--- 958,972 ----
// Get the URL to the zip file
$r = $current->response[ $theme ];
! $result = $this->run( array(
! 'package' => $r['package'],
! 'destination' => get_theme_root( $theme ),
! 'clear_destination' => true,
! 'clear_working' => true,
! 'hook_extra' => array(
! 'theme' => $theme
! ),
! ) );
$results[$theme] = $this->result;
***************
*** 897,914 ****
$this->maintenance_mode(false);
$this->skin->bulk_footer();
$this->skin->footer();
// Cleanup our hooks, in case something else does a upgrade on this connection.
! remove_filter('upgrader_pre_install', array(&$this, 'current_before'));
! remove_filter('upgrader_post_install', array(&$this, 'current_after'));
! remove_filter('upgrader_clear_destination', array(&$this, 'delete_old_theme'));
!
! // Force refresh of theme update information
! wp_clean_themes_cache();
! do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme', 'bulk' => true ), $themes );
return $results;
}
--- 977,1000 ----
$this->maintenance_mode(false);
+ do_action( 'upgrader_process_complete', $this, array(
+ 'action' => 'update',
+ 'type' => 'plugin',
+ 'bulk' => true,
+ 'themes' => $themes,
+ ) );
+
$this->skin->bulk_footer();
$this->skin->footer();
// Cleanup our hooks, in case something else does a upgrade on this connection.
! remove_filter('upgrader_pre_install', array($this, 'current_before'));
! remove_filter('upgrader_post_install', array($this, 'current_after'));
! remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
!
! // Refresh the Theme Update information
! wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
return $results;
}
***************
*** 926,941 ****
// A proper archive should have a style.css file in the single subdirectory
if ( ! file_exists( $working_directory . 'style.css' ) )
! return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('The theme is missing the style.css
stylesheet.') );
$info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Template' => 'Template' ) );
if ( empty( $info['Name'] ) )
! return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __("The style.css
stylesheet doesn't contain a valid theme header.") );
// If it's not a child theme, it must have at least an index.php to be legit.
if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) )
! return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], __('The theme is missing the index.php
file.') );
return $source;
}
--- 1012,1027 ----
// A proper archive should have a style.css file in the single subdirectory
if ( ! file_exists( $working_directory . 'style.css' ) )
! return new WP_Error( 'incompatible_archive_theme_no_style', $this->strings['incompatible_archive'], __( 'The theme is missing the style.css
stylesheet.' ) );
$info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Template' => 'Template' ) );
if ( empty( $info['Name'] ) )
! return new WP_Error( 'incompatible_archive_theme_no_name', $this->strings['incompatible_archive'], __( "The style.css
stylesheet doesn't contain a valid theme header." ) );
// If it's not a child theme, it must have at least an index.php to be legit.
if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) )
! return new WP_Error( 'incompatible_archive_theme_no_index', $this->strings['incompatible_archive'], __( 'The theme is missing the index.php
file.' ) );
return $source;
}
***************
*** 978,995 ****
return $return;
}
! function delete_old_theme($removed, $local_destination, $remote_destination, $theme) {
global $wp_filesystem;
! $theme = isset($theme['theme']) ? $theme['theme'] : '';
! if ( is_wp_error($removed) || empty($theme) )
! return $removed; //Pass errors through.
! $themes_dir = $wp_filesystem->wp_themes_dir();
! if ( $wp_filesystem->exists( trailingslashit($themes_dir) . $theme ) )
! if ( ! $wp_filesystem->delete( trailingslashit($themes_dir) . $theme, true ) )
return false;
return true;
}
--- 1064,1085 ----
return $return;
}
! function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
global $wp_filesystem;
! if ( is_wp_error( $removed ) )
! return $removed; // Pass errors through.
! if ( ! isset( $theme['theme'] ) )
! return $removed;
! $theme = $theme['theme'];
! $themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) );
! if ( $wp_filesystem->exists( $themes_dir . $theme ) ) {
! if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) )
return false;
+ }
+
return true;
}
***************
*** 1001,1015 ****
else
return false;
}
! return wp_get_theme( $theme, WP_CONTENT_DIR . '/themes/' );
}
}
/**
! * Core Upgrader class for WordPress. It allows for WordPress to upgrade itself in combination with the wp-admin/includes/update-core.php file
*
! * @TODO More Detailed docs, for methods as well.
*
* @package WordPress
* @subpackage Upgrader
--- 1091,1300 ----
else
return false;
}
! return wp_get_theme( $theme );
}
}
+ add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
+
/**
! * Language pack upgrader, for updating translations of plugins, themes, and core.
*
! * @package WordPress
! * @subpackage Upgrader
! * @since 3.7.0
! */
! class Language_Pack_Upgrader extends WP_Upgrader {
!
! var $result;
! var $bulk = true;
!
! static function async_upgrade( $upgrader = false ) {
! // Avoid recursion.
! if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader )
! return;
!
! // Nothing to do?
! $language_updates = wp_get_translation_updates();
! if ( ! $language_updates )
! return;
!
! $skin = new Language_Pack_Upgrader_Skin( array(
! 'skip_header_footer' => true,
! ) );
!
! $lp_upgrader = new Language_Pack_Upgrader( $skin );
! $lp_upgrader->upgrade();
! }
!
! function upgrade_strings() {
! $this->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while we update them as well.' );
! $this->strings['up_to_date'] = __( 'The translation is up to date.' ); // We need to silently skip this case
! $this->strings['no_package'] = __( 'Update package not available.' );
! $this->strings['downloading_package'] = __( 'Downloading translation from %s …' );
! $this->strings['unpack_package'] = __( 'Unpacking the update…' );
! $this->strings['process_failed'] = __( 'Translation update failed.' );
! $this->strings['process_success'] = __( 'Translation updated successfully.' );
! }
!
! function upgrade( $update = false, $args = array() ) {
! if ( $update )
! $update = array( $update );
! $results = $this->bulk_upgrade( $update, $args );
! return $results[0];
! }
!
! function bulk_upgrade( $language_updates = array(), $args = array() ) {
! global $wp_filesystem;
!
! $defaults = array(
! 'clear_update_cache' => true,
! );
! $parsed_args = wp_parse_args( $args, $defaults );
!
! $this->init();
! $this->upgrade_strings();
!
! if ( ! $language_updates )
! $language_updates = wp_get_translation_updates();
!
! if ( empty( $language_updates ) ) {
! $this->skin->header();
! $this->skin->before();
! $this->skin->set_result( true );
! $this->skin->feedback( 'up_to_date' );
! $this->skin->after();
! $this->skin->bulk_footer();
! $this->skin->footer();
! return true;
! }
!
! if ( 'upgrader_process_complete' == current_filter() )
! $this->skin->feedback( 'starting_upgrade' );
!
! add_filter( 'upgrader_source_selection', array( &$this, 'check_package' ), 10, 3 );
!
! $this->skin->header();
!
! // Connect to the Filesystem first.
! $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
! if ( ! $res ) {
! $this->skin->footer();
! return false;
! }
!
! $results = array();
!
! $this->update_count = count( $language_updates );
! $this->update_current = 0;
!
! // The filesystem's mkdir() is not recursive. Make sure WP_LANG_DIR exists,
! // as we then may need to create a /plugins or /themes directory inside of it.
! $remote_destination = $wp_filesystem->find_folder( WP_LANG_DIR );
! if ( ! $wp_filesystem->exists( $remote_destination ) )
! if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) )
! return new WP_Error( 'mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination );
!
! foreach ( $language_updates as $language_update ) {
!
! $this->skin->language_update = $language_update;
!
! $destination = WP_LANG_DIR;
! if ( 'plugin' == $language_update->type )
! $destination .= '/plugins';
! elseif ( 'theme' == $language_update->type )
! $destination .= '/themes';
!
! $this->update_current++;
!
! $options = array(
! 'package' => $language_update->package,
! 'destination' => $destination,
! 'clear_destination' => false,
! 'abort_if_destination_exists' => false, // We expect the destination to exist.
! 'clear_working' => true,
! 'is_multi' => true,
! 'hook_extra' => array(
! 'language_update_type' => $language_update->type,
! 'language_update' => $language_update,
! )
! );
!
! $result = $this->run( $options );
!
! $results[] = $this->result;
!
! // Prevent credentials auth screen from displaying multiple times.
! if ( false === $result )
! break;
! }
!
! $this->skin->bulk_footer();
!
! $this->skin->footer();
!
! // Clean up our hooks, in case something else does an upgrade on this connection.
! remove_filter( 'upgrader_source_selection', array( &$this, 'check_package' ), 10, 2 );
!
! if ( $parsed_args['clear_update_cache'] ) {
! wp_clean_themes_cache( true );
! wp_clean_plugins_cache( true );
! delete_site_transient( 'update_core' );
! }
!
! return $results;
! }
!
! function check_package( $source, $remote_source ) {
! global $wp_filesystem;
!
! if ( is_wp_error( $source ) )
! return $source;
!
! // Check that the folder contains a valid language.
! $files = $wp_filesystem->dirlist( $remote_source );
!
! // Check to see if a .po and .mo exist in the folder.
! $po = $mo = false;
! foreach ( (array) $files as $file => $filedata ) {
! if ( '.po' == substr( $file, -3 ) )
! $po = true;
! elseif ( '.mo' == substr( $file, -3 ) )
! $mo = true;
! }
!
! if ( ! $mo || ! $po )
! return new WP_Error( 'incompatible_archive_pomo', $this->strings['incompatible_archive'],
! __( 'The language pack is missing either the .po
or .mo
files.' ) );
!
! return $source;
! }
!
! function get_name_for_update( $update ) {
! switch ( $update->type ) {
! case 'core':
! return 'WordPress'; // Not translated
! break;
! case 'theme':
! $theme = wp_get_theme( $update->slug );
! if ( $theme->exists() )
! return $theme->Get( 'Name' );
! break;
! case 'plugin':
! $plugin_data = get_plugins( '/' . $update->slug );
! $plugin_data = array_shift( $plugin_data );
! if ( $plugin_data )
! return $plugin_data['Name'];
! break;
! }
! return '';
! }
!
! }
!
! /**
! * Core Upgrader class for WordPress. It allows for WordPress to upgrade itself in combination with the wp-admin/includes/update-core.php file
*
* @package WordPress
* @subpackage Upgrader
***************
*** 1024,1034 ****
$this->strings['unpack_package'] = __('Unpacking the update…');
$this->strings['copy_failed'] = __('Could not copy files.');
$this->strings['copy_failed_space'] = __('Could not copy files. You may have run out of disk space.' );
}
! function upgrade($current) {
global $wp_filesystem, $wp_version;
$this->init();
$this->upgrade_strings();
--- 1309,1330 ----
$this->strings['unpack_package'] = __('Unpacking the update…');
$this->strings['copy_failed'] = __('Could not copy files.');
$this->strings['copy_failed_space'] = __('Could not copy files. You may have run out of disk space.' );
+ $this->strings['start_rollback'] = __( 'Attempting to roll back to previous version.' );
+ $this->strings['rollback_was_required'] = __( 'Due to an error during updating, WordPress has rolled back to your previous version.' );
}
! function upgrade( $current, $args = array() ) {
global $wp_filesystem, $wp_version;
+ $start_time = time();
+
+ $defaults = array(
+ 'pre_check_md5' => true,
+ 'attempt_rollback' => false,
+ 'do_rollback' => false,
+ );
+ $parsed_args = wp_parse_args( $args, $defaults );
+
$this->init();
$this->upgrade_strings();
***************
*** 1042,1052 ****
$wp_dir = trailingslashit($wp_filesystem->abspath());
// If partial update is returned from the API, use that, unless we're doing a reinstall.
// If we cross the new_bundled version number, then use the new_bundled zip.
// Don't though if the constant is set to skip bundled items.
// If the API returns a no_content zip, go with it. Finally, default to the full zip.
! if ( $current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version )
$to_download = 'partial';
elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' )
&& ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) )
--- 1338,1356 ----
$wp_dir = trailingslashit($wp_filesystem->abspath());
+ $partial = true;
+ if ( $parsed_args['do_rollback'] )
+ $partial = false;
+ elseif ( $parsed_args['pre_check_md5'] && ! $this->check_files() )
+ $partial = false;
+
// If partial update is returned from the API, use that, unless we're doing a reinstall.
// If we cross the new_bundled version number, then use the new_bundled zip.
// Don't though if the constant is set to skip bundled items.
// If the API returns a no_content zip, go with it. Finally, default to the full zip.
! if ( $parsed_args['do_rollback'] && $current->packages->rollback )
! $to_download = 'rollback';
! elseif ( $current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version && $partial )
$to_download = 'partial';
elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' )
&& ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) )
***************
*** 1067,1691 ****
// Copy update-core.php from the new version into place.
if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) {
$wp_filesystem->delete($working_dir, true);
! return new WP_Error('copy_failed', $this->strings['copy_failed']);
}
$wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
! require(ABSPATH . 'wp-admin/includes/update-core.php');
if ( ! function_exists( 'update_core' ) )
return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] );
$result = update_core( $working_dir, $wp_dir );
- do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core' ), $result );
- return $result;
- }
! }
! /**
! * Generic Skin for the WordPress Upgrader classes. This skin is designed to be extended for specific purposes.
! *
! * @TODO More Detailed docs, for methods as well.
! *
! * @package WordPress
! * @subpackage Upgrader
! * @since 2.8.0
! */
! class WP_Upgrader_Skin {
! var $upgrader;
! var $done_header = false;
! var $result = false;
! function __construct($args = array()) {
! $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
! $this->options = wp_parse_args($args, $defaults);
! }
! function set_upgrader(&$upgrader) {
! if ( is_object($upgrader) )
! $this->upgrader =& $upgrader;
! $this->add_strings();
! }
! function add_strings() {
! }
! function set_result($result) {
! $this->result = $result;
! }
! function request_filesystem_credentials($error = false) {
! $url = $this->options['url'];
! $context = $this->options['context'];
! if ( !empty($this->options['nonce']) )
! $url = wp_nonce_url($url, $this->options['nonce']);
! return request_filesystem_credentials($url, '', $error, $context); //Possible to bring inline, Leaving as is for now.
}
! function header() {
! if ( $this->done_header )
! return;
! $this->done_header = true;
! echo '';
! screen_icon();
! echo '
' . $this->options['title'] . ' ';
! }
! function footer() {
! echo '';
! }
!
! function error($errors) {
! if ( ! $this->done_header )
! $this->header();
! if ( is_string($errors) ) {
! $this->feedback($errors);
! } elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
! foreach ( $errors->get_error_messages() as $message ) {
! if ( $errors->get_error_data() )
! $this->feedback($message . ' ' . esc_html( $errors->get_error_data() ) );
! else
! $this->feedback($message);
}
}
- }
! function feedback($string) {
! if ( isset( $this->upgrader->strings[$string] ) )
! $string = $this->upgrader->strings[$string];
! if ( strpos($string, '%') !== false ) {
! $args = func_get_args();
! $args = array_splice($args, 1);
! if ( $args ) {
! $args = array_map( 'strip_tags', $args );
! $args = array_map( 'esc_html', $args );
! $string = vsprintf($string, $args);
! }
}
! if ( empty($string) )
! return;
! show_message($string);
}
- function before() {}
- function after() {}
}
/**
! * Plugin Upgrader Skin for WordPress Plugin Upgrades.
! *
! * @TODO More Detailed docs, for methods as well.
*
* @package WordPress
* @subpackage Upgrader
* @since 2.8.0
*/
! class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
! var $plugin = '';
! var $plugin_active = false;
! var $plugin_network_active = false;
! function __construct($args = array()) {
! $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') );
! $args = wp_parse_args($args, $defaults);
! $this->plugin = $args['plugin'];
! $this->plugin_active = is_plugin_active( $this->plugin );
! $this->plugin_network_active = is_plugin_active_for_network( $this->plugin );
! parent::__construct($args);
! }
! function after() {
! $this->plugin = $this->upgrader->plugin_info();
! if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
! echo '';
! }
! $update_actions = array(
! 'activate_plugin' => '' . __('Activate Plugin') . ' ',
! 'plugins_page' => '' . __('Return to Plugins page') . ' '
! );
! if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) )
! unset( $update_actions['activate_plugin'] );
! $update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $this->plugin);
! if ( ! empty($update_actions) )
! $this->feedback(implode(' | ', (array)$update_actions));
! }
! function before() {
! if ( $this->upgrader->show_before ) {
! echo $this->upgrader->show_before;
! $this->upgrader->show_before = '';
}
}
}
/**
! * Plugin Upgrader Skin for WordPress Plugin Upgrades.
*
* @package WordPress
* @subpackage Upgrader
! * @since 3.0.0
*/
! class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
! var $in_loop = false;
! var $error = false;
! function __construct($args = array()) {
! $defaults = array( 'url' => '', 'nonce' => '' );
! $args = wp_parse_args($args, $defaults);
! parent::__construct($args);
! }
! function add_strings() {
! $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take a while on some hosts, so please be patient.');
! $this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while updating %1$s: %2$s ');
! $this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.');
! $this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully.').' '.__('Show Details').' '.__('Hide Details').' . ';
! $this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.');
! }
! function feedback($string) {
! if ( isset( $this->upgrader->strings[$string] ) )
! $string = $this->upgrader->strings[$string];
! if ( strpos($string, '%') !== false ) {
! $args = func_get_args();
! $args = array_splice($args, 1);
! if ( $args ) {
! $args = array_map( 'strip_tags', $args );
! $args = array_map( 'esc_html', $args );
! $string = vsprintf($string, $args);
}
}
- if ( empty($string) )
- return;
- if ( $this->in_loop )
- echo "$string \n";
- else
- echo "$string
\n";
- }
! function header() {
! // Nothing, This will be displayed within a iframe.
! }
! function footer() {
! // Nothing, This will be displayed within a iframe.
! }
! function error($error) {
! if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
! $this->error = $this->upgrader->strings[$error];
! if ( is_wp_error($error) ) {
! foreach ( $error->get_error_messages() as $emessage ) {
! if ( $error->get_error_data() )
! $messages[] = $emessage . ' ' . esc_html( $error->get_error_data() );
! else
! $messages[] = $emessage;
! }
! $this->error = implode(', ', $messages);
}
- echo '';
- }
! function bulk_header() {
! $this->feedback('skin_upgrade_start');
! }
!
! function bulk_footer() {
! $this->feedback('skin_upgrade_end');
! }
! function before($title = '') {
! $this->in_loop = true;
! printf( '' . $this->upgrader->strings['skin_before_update_header'] . ' ', $title, $this->upgrader->update_current, $this->upgrader->update_count);
! echo '';
! echo '';
! $this->flush_output();
! }
! function after($title = '') {
! echo '
';
! if ( $this->error || ! $this->result ) {
! if ( $this->error )
! echo '' . sprintf($this->upgrader->strings['skin_update_failed_error'], $title, $this->error) . '
';
else
! echo '' . sprintf($this->upgrader->strings['skin_update_failed'], $title) . '
';
! echo '';
! }
! if ( $this->result && ! is_wp_error( $this->result ) ) {
! if ( ! $this->error )
! echo '' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '
';
! echo '';
}
! $this->reset();
! $this->flush_output();
! }
!
! function reset() {
! $this->in_loop = false;
! $this->error = false;
! }
!
! function flush_output() {
! wp_ob_end_flush_all();
! flush();
}
- }
-
- class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
- var $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
! function __construct($args = array()) {
! parent::__construct($args);
! }
! function add_strings() {
! parent::add_strings();
! $this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)');
! }
! function before($title = '') {
! parent::before($this->plugin_info['Title']);
! }
! function after($title = '') {
! parent::after($this->plugin_info['Title']);
! }
! function bulk_footer() {
! parent::bulk_footer();
! $update_actions = array(
! 'plugins_page' => '' . __('Return to Plugins page') . ' ',
! 'updates_page' => '' . __('Return to WordPress Updates') . ' '
! );
! if ( ! current_user_can( 'activate_plugins' ) )
! unset( $update_actions['plugins_page'] );
! $update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
! if ( ! empty($update_actions) )
! $this->feedback(implode(' | ', (array)$update_actions));
}
- }
! class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
! var $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
! function __construct($args = array()) {
! parent::__construct($args);
! }
! function add_strings() {
! parent::add_strings();
! $this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
! }
! function before($title = '') {
! parent::before( $this->theme_info->display('Name') );
! }
! function after($title = '') {
! parent::after( $this->theme_info->display('Name') );
! }
! function bulk_footer() {
! parent::bulk_footer();
! $update_actions = array(
! 'themes_page' => '' . __('Return to Themes page') . ' ',
! 'updates_page' => '' . __('Return to WordPress Updates') . ' '
);
- if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
- unset( $update_actions['themes_page'] );
! $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
! if ( ! empty($update_actions) )
! $this->feedback(implode(' | ', (array)$update_actions));
}
- }
-
- /**
- * Plugin Installer Skin for WordPress Plugin Installer.
- *
- * @TODO More Detailed docs, for methods as well.
- *
- * @package WordPress
- * @subpackage Upgrader
- * @since 2.8.0
- */
- class Plugin_Installer_Skin extends WP_Upgrader_Skin {
- var $api;
- var $type;
-
- function __construct($args = array()) {
- $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
- $args = wp_parse_args($args, $defaults);
! $this->type = $args['type'];
! $this->api = isset($args['api']) ? $args['api'] : array();
! parent::__construct($args);
! }
!
! function before() {
! if ( !empty($this->api) )
! $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin %s %s .'), $this->api->name, $this->api->version);
! }
!
! function after() {
! $plugin_file = $this->upgrader->plugin_info();
! $install_actions = array();
! $from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
! if ( 'import' == $from )
! $install_actions['activate_plugin'] = '' . __('Activate Plugin & Run Importer') . ' ';
! else
! $install_actions['activate_plugin'] = '' . __('Activate Plugin') . ' ';
! if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
! $install_actions['network_activate'] = '' . __('Network Activate') . ' ';
! unset( $install_actions['activate_plugin'] );
}
! if ( 'import' == $from )
! $install_actions['importers_page'] = '' . __('Return to Importers') . ' ';
! else if ( $this->type == 'web' )
! $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . ' ';
! else
! $install_actions['plugins_page'] = '' . __('Return to Plugins page') . ' ';
!
! if ( ! $this->result || is_wp_error($this->result) ) {
! unset( $install_actions['activate_plugin'], $install_actions['network_activate'] );
! } elseif ( ! current_user_can( 'activate_plugins' ) ) {
! unset( $install_actions['activate_plugin'] );
}
! $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file);
! if ( ! empty($install_actions) )
! $this->feedback(implode(' | ', (array)$install_actions));
! }
! }
!
! /**
! * Theme Installer Skin for the WordPress Theme Installer.
! *
! * @TODO More Detailed docs, for methods as well.
! *
! * @package WordPress
! * @subpackage Upgrader
! * @since 2.8.0
! */
! class Theme_Installer_Skin extends WP_Upgrader_Skin {
! var $api;
! var $type;
! function __construct($args = array()) {
! $defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
! $args = wp_parse_args($args, $defaults);
! $this->type = $args['type'];
! $this->api = isset($args['api']) ? $args['api'] : array();
! parent::__construct($args);
! }
! function before() {
! if ( !empty($this->api) )
! $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version);
! }
!
! function after() {
! if ( empty($this->upgrader->result['destination_name']) )
return;
! $theme_info = $this->upgrader->theme_info();
! if ( empty( $theme_info ) )
! return;
!
! $name = $theme_info->display('Name');
! $stylesheet = $this->upgrader->result['destination_name'];
! $template = $theme_info->get_template();
!
! $preview_link = add_query_arg( array(
! 'preview' => 1,
! 'template' => urlencode( $template ),
! 'stylesheet' => urlencode( $stylesheet ),
! ), trailingslashit( home_url() ) );
!
! $activate_link = add_query_arg( array(
! 'action' => 'activate',
! 'template' => urlencode( $template ),
! 'stylesheet' => urlencode( $stylesheet ),
! ), admin_url('themes.php') );
! $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
!
! $install_actions = array();
! $install_actions['preview'] = '' . __('Preview') . ' ';
! $install_actions['preview'] .= '' . __('Live Preview') . ' ';
! $install_actions['activate'] = '' . __('Activate') . ' ';
!
! if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
! $install_actions['network_enable'] = '' . __( 'Network Enable' ) . ' ';
!
! if ( $this->type == 'web' )
! $install_actions['themes_page'] = '' . __('Return to Theme Installer') . ' ';
! elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
! $install_actions['themes_page'] = '' . __('Return to Themes page') . ' ';
!
! if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) )
! unset( $install_actions['activate'], $install_actions['preview'] );
!
! $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info);
! if ( ! empty($install_actions) )
! $this->feedback(implode(' | ', (array)$install_actions));
! }
! }
!
! /**
! * Theme Upgrader Skin for WordPress Theme Upgrades.
! *
! * @TODO More Detailed docs, for methods as well.
! *
! * @package WordPress
! * @subpackage Upgrader
! * @since 2.8.0
! */
! class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
! var $theme = '';
! function __construct($args = array()) {
! $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
! $args = wp_parse_args($args, $defaults);
! $this->theme = $args['theme'];
! parent::__construct($args);
}
! function after() {
! $update_actions = array();
! if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
! $name = $theme_info->display('Name');
! $stylesheet = $this->upgrader->result['destination_name'];
! $template = $theme_info->get_template();
! $preview_link = add_query_arg( array(
! 'preview' => 1,
! 'template' => urlencode( $template ),
! 'stylesheet' => urlencode( $stylesheet ),
! ), trailingslashit( home_url() ) );
! $activate_link = add_query_arg( array(
! 'action' => 'activate',
! 'template' => urlencode( $template ),
! 'stylesheet' => urlencode( $stylesheet ),
! ), admin_url('themes.php') );
! $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
! if ( get_stylesheet() == $stylesheet ) {
! if ( current_user_can( 'edit_theme_options' ) )
! $update_actions['preview'] = '' . __('Customize') . ' ';
! } elseif ( current_user_can( 'switch_themes' ) ) {
! $update_actions['preview'] = '' . __('Preview') . ' ';
! $update_actions['preview'] .= '' . __('Live Preview') . ' ';
! $update_actions['activate'] = '' . __('Activate') . ' ';
! }
! if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
! unset( $update_actions['preview'], $update_actions['activate'] );
}
! $update_actions['themes_page'] = '' . __('Return to Themes page') . ' ';
! $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme);
! if ( ! empty($update_actions) )
! $this->feedback(implode(' | ', (array)$update_actions));
! }
! }
! /**
! * Upgrade Skin helper for File uploads. This class handles the upload process and passes it as if it's a local file to the Upgrade/Installer functions.
! *
! * @TODO More Detailed docs, for methods as well.
! *
! * @package WordPress
! * @subpackage Upgrader
! * @since 2.8.0
! */
! class File_Upload_Upgrader {
! var $package;
! var $filename;
! var $id = 0;
! function __construct($form, $urlholder) {
! if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) )
! wp_die(__('Please select a file'));
! //Handle a newly uploaded file, Else assume it's already been uploaded
! if ( ! empty($_FILES) ) {
! $overrides = array( 'test_form' => false, 'test_type' => false );
! $file = wp_handle_upload( $_FILES[$form], $overrides );
! if ( isset( $file['error'] ) )
! wp_die( $file['error'] );
! $this->filename = $_FILES[$form]['name'];
! $this->package = $file['file'];
! // Construct the object array
! $object = array(
! 'post_title' => $this->filename,
! 'post_content' => $file['url'],
! 'post_mime_type' => $file['type'],
! 'guid' => $file['url'],
! 'context' => 'upgrader',
! 'post_status' => 'private'
! );
! // Save the data
! $this->id = wp_insert_attachment( $object, $file['file'] );
! // schedule a cleanup for 2 hours from now in case of failed install
! wp_schedule_single_event( time() + 7200, 'upgrader_scheduled_cleanup', array( $this->id ) );
! } elseif ( is_numeric( $_GET[$urlholder] ) ) {
! // Numeric Package = previously uploaded file, see above.
! $this->id = (int) $_GET[$urlholder];
! $attachment = get_post( $this->id );
! if ( empty($attachment) )
! wp_die(__('Please select a file'));
! $this->filename = $attachment->post_title;
! $this->package = get_attached_file( $attachment->ID );
} else {
! // Else, It's set to something, Back compat for plugins using the old (pre-3.3) File_Uploader handler.
! if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
! wp_die( $uploads['error'] );
!
! $this->filename = $_GET[$urlholder];
! $this->package = $uploads['basedir'] . '/' . $this->filename;
}
- }
! function cleanup() {
! if ( $this->id )
! wp_delete_attachment( $this->id );
! elseif ( file_exists( $this->package ) )
! return @unlink( $this->package );
! return true;
}
}
--- 1371,2401 ----
// Copy update-core.php from the new version into place.
if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) {
$wp_filesystem->delete($working_dir, true);
! return new WP_Error( 'copy_failed_for_update_core_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-admin/includes/update-core.php' );
}
$wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
! require_once( ABSPATH . 'wp-admin/includes/update-core.php' );
if ( ! function_exists( 'update_core' ) )
return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] );
$result = update_core( $working_dir, $wp_dir );
! // In the event of an issue, we may be able to roll back.
! if ( $parsed_args['attempt_rollback'] && $current->packages->rollback && ! $parsed_args['do_rollback'] ) {
! $try_rollback = false;
! if ( is_wp_error( $result ) ) {
! $error_code = $result->get_error_code();
! // Not all errors are equal. These codes are critical: copy_failed__copy_dir,
! // mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full.
! // do_rollback allows for update_core() to trigger a rollback if needed.
! if ( false !== strpos( $error_code, 'do_rollback' ) )
! $try_rollback = true;
! elseif ( false !== strpos( $error_code, '__copy_dir' ) )
! $try_rollback = true;
! elseif ( 'disk_full' === $error_code )
! $try_rollback = true;
! }
! if ( $try_rollback ) {
! apply_filters( 'update_feedback', $result );
! apply_filters( 'update_feedback', $this->strings['start_rollback'] );
! $rollback_result = $this->upgrade( $current, array_merge( $parsed_args, array( 'do_rollback' => true ) ) );
! $original_result = $result;
! $result = new WP_Error( 'rollback_was_required', $this->strings['rollback_was_required'], (object) array( 'update' => $original_result, 'rollback' => $rollback_result ) );
! }
! }
! do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core' ) );
! // Clear the current updates
! delete_site_transient( 'update_core' );
! if ( ! $parsed_args['do_rollback'] ) {
! $stats = array(
! 'update_type' => $current->response,
! 'success' => true,
! 'fs_method' => $wp_filesystem->method,
! 'fs_method_forced' => defined( 'FS_METHOD' ) || has_filter( 'filesystem_method' ),
! 'time_taken' => time() - $start_time,
! 'attempted' => $current->version,
! );
!
! if ( is_wp_error( $result ) ) {
! $stats['success'] = false;
! // Did a rollback occur?
! if ( ! empty( $try_rollback ) ) {
! $stats['error_code'] = $original_result->get_error_code();
! $stats['error_data'] = $original_result->get_error_data();
! // Was the rollback successful? If not, collect its error too.
! $stats['rollback'] = ! is_wp_error( $rollback_result );
! if ( is_wp_error( $rollback_result ) ) {
! $stats['rollback_code'] = $rollback_result->get_error_code();
! $stats['rollback_data'] = $rollback_result->get_error_data();
! }
! } else {
! $stats['error_code'] = $result->get_error_code();
! $stats['error_data'] = $result->get_error_data();
! }
! }
!
! wp_version_check( $stats );
! }
! return $result;
}
! // Determines if this WordPress Core version should update to $offered_ver or not
! static function should_update_to_version( $offered_ver /* x.y.z */ ) {
! include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
!
! $current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); // x.y
! $new_branch = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); // x.y
! $current_is_development_version = (bool) strpos( $wp_version, '-' );
!
! // Defaults:
! $upgrade_dev = true;
! $upgrade_minor = true;
! $upgrade_major = false;
!
! // WP_AUTO_UPDATE_CORE = true (all), 'minor', false.
! if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
! if ( false === WP_AUTO_UPDATE_CORE ) {
! // Defaults to turned off, unless a filter allows it
! $upgrade_dev = $upgrade_minor = $upgrade_major = false;
! } elseif ( true === WP_AUTO_UPDATE_CORE ) {
! // ALL updates for core
! $upgrade_dev = $upgrade_minor = $upgrade_major = true;
! } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) {
! // Only minor updates for core
! $upgrade_dev = $upgrade_major = false;
! $upgrade_minor = true;
}
}
! // 1: If we're already on that version, not much point in updating?
! if ( $offered_ver == $wp_version )
! return false;
! // 2: If we're running a newer version, that's a nope
! if ( version_compare( $wp_version, $offered_ver, '>' ) )
! return false;
!
! $failure_data = get_site_option( 'auto_core_update_failed' );
! if ( $failure_data ) {
! // If this was a critical update failure, cannot update.
! if ( ! empty( $failure_data['critical'] ) )
! return false;
!
! // Don't claim we can update on update-core.php if we have a non-critical failure logged.
! if ( $wp_version == $failure_data['current'] && false !== strpos( $offered_ver, '.1.next.minor' ) )
! return false;
!
! // Cannot update if we're retrying the same A to B update that caused a non-critical failure.
! // Some non-critical failures do allow retries, like download_failed.
! // 3.7.1 => 3.7.2 resulted in files_not_writable, if we are still on 3.7.1 and still trying to update to 3.7.2.
! if ( empty( $failure_data['retry'] ) && $wp_version == $failure_data['current'] && $offered_ver == $failure_data['attempted'] )
! return false;
}
!
! // 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2
! if ( $current_is_development_version ) {
! if ( ! apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ) )
! return false;
! // else fall through to minor + major branches below
! }
!
! // 4: Minor In-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4)
! if ( $current_branch == $new_branch )
! return apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor );
!
! // 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1)
! if ( version_compare( $new_branch, $current_branch, '>' ) )
! return apply_filters( 'allow_major_auto_core_updates', $upgrade_major );
!
! // If we're not sure, we don't want it
! return false;
}
+ function check_files() {
+ global $wp_version, $wp_local_package;
+
+ $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
+
+ if ( ! is_array( $checksums ) )
+ return false;
+
+ foreach ( $checksums as $file => $checksum ) {
+ // Skip files which get updated
+ if ( 'wp-content' == substr( $file, 0, 10 ) )
+ continue;
+ if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum )
+ return false;
+ }
+
+ return true;
+ }
}
/**
! * Upgrade Skin helper for File uploads. This class handles the upload process and passes it as if it's a local file to the Upgrade/Installer functions.
*
* @package WordPress
* @subpackage Upgrader
* @since 2.8.0
*/
! class File_Upload_Upgrader {
! var $package;
! var $filename;
! var $id = 0;
! function __construct($form, $urlholder) {
! if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) )
! wp_die(__('Please select a file'));
! //Handle a newly uploaded file, Else assume it's already been uploaded
! if ( ! empty($_FILES) ) {
! $overrides = array( 'test_form' => false, 'test_type' => false );
! $file = wp_handle_upload( $_FILES[$form], $overrides );
! if ( isset( $file['error'] ) )
! wp_die( $file['error'] );
! $this->filename = $_FILES[$form]['name'];
! $this->package = $file['file'];
! // Construct the object array
! $object = array(
! 'post_title' => $this->filename,
! 'post_content' => $file['url'],
! 'post_mime_type' => $file['type'],
! 'guid' => $file['url'],
! 'context' => 'upgrader',
! 'post_status' => 'private'
! );
! // Save the data
! $this->id = wp_insert_attachment( $object, $file['file'] );
!
! // schedule a cleanup for 2 hours from now in case of failed install
! wp_schedule_single_event( time() + 7200, 'upgrader_scheduled_cleanup', array( $this->id ) );
!
! } elseif ( is_numeric( $_GET[$urlholder] ) ) {
! // Numeric Package = previously uploaded file, see above.
! $this->id = (int) $_GET[$urlholder];
! $attachment = get_post( $this->id );
! if ( empty($attachment) )
! wp_die(__('Please select a file'));
! $this->filename = $attachment->post_title;
! $this->package = get_attached_file( $attachment->ID );
! } else {
! // Else, It's set to something, Back compat for plugins using the old (pre-3.3) File_Uploader handler.
! if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
! wp_die( $uploads['error'] );
!
! $this->filename = $_GET[$urlholder];
! $this->package = $uploads['basedir'] . '/' . $this->filename;
}
}
+
+ function cleanup() {
+ if ( $this->id )
+ wp_delete_attachment( $this->id );
+
+ elseif ( file_exists( $this->package ) )
+ return @unlink( $this->package );
+
+ return true;
+ }
}
/**
! * The WordPress automatic background updater.
*
* @package WordPress
* @subpackage Upgrader
! * @since 3.7.0
*/
! class WP_Automatic_Updater {
! /**
! * Tracks update results during processing.
! *
! * @var array
! */
! protected $update_results = array();
!
! /**
! * Whether the entire automatic updater is disabled.
! *
! * @since 3.7.0
! */
! public function is_disabled() {
! // Background updates are disabled if you don't want file changes.
! if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
! return true;
!
! if ( defined( 'WP_INSTALLING' ) )
! return true;
!
! // More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters.
! $disabled = defined( 'AUTOMATIC_UPDATER_DISABLED' ) && AUTOMATIC_UPDATER_DISABLED;
!
! /**
! * Filter whether to entirely disable background updates.
! *
! * There are more fine-grained filters and controls for selective disabling.
! * This filter parallels the AUTOMATIC_UPDATER_DISABLED constant in name.
! *
! * This also disables update notification emails. That may change in the future.
! *
! * @since 3.7.0
! * @param bool $disabled Whether the updater should be disabled.
! */
! return apply_filters( 'automatic_updater_disabled', $disabled );
! }
!
! /**
! * Check for version control checkouts.
! *
! * Checks for Subversion, Git, Mercurial, and Bazaar. It recursively looks up the
! * filesystem to the top of the drive, erring on the side of detecting a VCS
! * checkout somewhere.
! *
! * ABSPATH is always checked in addition to whatever $context is (which may be the
! * wp-content directory, for example). The underlying assumption is that if you are
! * using version control *anywhere*, then you should be making decisions for
! * how things get updated.
! *
! * @since 3.7.0
! *
! * @param string $context The filesystem path to check, in addition to ABSPATH.
! */
! public function is_vcs_checkout( $context ) {
! $context_dirs = array( untrailingslashit( $context ) );
! if ( $context !== ABSPATH )
! $context_dirs[] = untrailingslashit( ABSPATH );
!
! $vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' );
! $check_dirs = array();
!
! foreach ( $context_dirs as $context_dir ) {
! // Walk up from $context_dir to the root.
! do {
! $check_dirs[] = $context_dir;
! // Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here.
! if ( $context_dir == dirname( $context_dir ) )
! break;
! // Continue one level at a time.
! } while ( $context_dir = dirname( $context_dir ) );
! }
! $check_dirs = array_unique( $check_dirs );
! // Search all directories we've found for evidence of version control.
! foreach ( $vcs_dirs as $vcs_dir ) {
! foreach ( $check_dirs as $check_dir ) {
! if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) )
! break 2;
}
}
! /**
! * Filter whether the automatic updater should consider a filesystem location to be potentially
! * managed by a version control system.
! *
! * @since 3.7.0
! *
! * @param bool $checkout Whether a VCS checkout was discovered at $context or ABSPATH, or anywhere higher.
! * @param string $context The filesystem context (a path) against which filesystem status should be checked.
! */
! return apply_filters( 'automatic_updates_is_vcs_checkout', $checkout, $context );
! }
!
! /**
! * Tests to see if we can and should update a specific item.
! *
! * @since 3.7.0
! *
! * @param string $type The type of update being checked: 'core', 'theme', 'plugin', 'translation'.
! * @param object $item The update offer.
! * @param string $context The filesystem context (a path) against which filesystem access and status
! * should be checked.
! */
! public function should_update( $type, $item, $context ) {
! // Used to see if WP_Filesystem is set up to allow unattended updates.
! $skin = new Automatic_Upgrader_Skin;
! if ( $this->is_disabled() )
! return false;
! // If we can't do an auto core update, we may still be able to email the user.
! if ( ! $skin->request_filesystem_credentials( false, $context ) || $this->is_vcs_checkout( $context ) ) {
! if ( 'core' == $type )
! $this->send_core_update_notification_email( $item );
! return false;
}
! // Next up, is this an item we can update?
! if ( 'core' == $type )
! $update = Core_Upgrader::should_update_to_version( $item->current );
! else
! $update = ! empty( $item->autoupdate );
! /**
! * Filter whether to automatically update core, a plugin, a theme, or a language.
! *
! * The dynamic portion of the hook name, $type, refers to the type of update
! * being checked. Can be 'core', 'theme', 'plugin', or 'translation'.
! *
! * Generally speaking, plugins, themes, and major core versions are not updated by default,
! * while translations and minor and development versions for core are updated by default.
! *
! * See the filters allow_dev_auto_core_updates, allow_minor_auto_core_updates, and
! * allow_major_auto_core_updates more straightforward filters to adjust core updates.
! *
! * @since 3.7.0
! *
! * @param bool $update Whether to update.
! * @param object $item The update offer.
! */
! $update = apply_filters( 'auto_update_' . $type, $update, $item );
!
! if ( ! $update ) {
! if ( 'core' == $type )
! $this->send_core_update_notification_email( $item );
! return false;
! }
! // If it's a core update, are we actually compatible with its requirements?
! if ( 'core' == $type ) {
! global $wpdb;
!
! $php_compat = version_compare( phpversion(), $item->php_version, '>=' );
! if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
! $mysql_compat = true;
else
! $mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' );
! if ( ! $php_compat || ! $mysql_compat )
! return false;
}
! return true;
}
! /**
! * Notifies an administrator of a core update.
! *
! * @since 3.7.0
! *
! * @param object $item The update offer.
! */
! protected function send_core_update_notification_email( $item ) {
! $notify = true;
! $notified = get_site_option( 'auto_core_update_notified' );
! // Don't notify if we've already notified the same email address of the same version.
! if ( $notified && $notified['email'] == get_site_option( 'admin_email' ) && $notified['version'] == $item->current )
! return false;
! // See if we need to notify users of a core update.
! $notify = ! empty( $item->notify_email );
! /**
! * Whether to notify the site administrator of a new core update.
! *
! * By default, administrators are notified when the update offer received from WordPress.org
! * sets a particular flag. This allows for discretion in if and when to notify.
! *
! * This filter only fires once per release -- if the same email address was already
! * notified of the same new version, we won't repeatedly email the administrator.
! *
! * This filter is also used on about.php to check if a plugin has disabled these notifications.
! *
! * @since 3.7.0
! *
! * @param bool $notify Whether the site administrator is notified.
! * @param object $item The update offer.
! */
! if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) )
! return false;
! $this->send_email( 'manual', $item );
! return true;
}
! /**
! * Update an item, if appropriate.
! *
! * @since 3.7.0
! *
! * @param string $type The type of update being checked: 'core', 'theme', 'plugin', 'translation'.
! * @param object $item The update offer.
! */
! public function update( $type, $item ) {
! $skin = new Automatic_Upgrader_Skin;
!
! switch ( $type ) {
! case 'core':
! // The Core upgrader doesn't use the Upgrader's skin during the actual main part of the upgrade, instead, firing a filter.
! add_filter( 'update_feedback', array( $skin, 'feedback' ) );
! $upgrader = new Core_Upgrader( $skin );
! $context = ABSPATH;
! break;
! case 'plugin':
! $upgrader = new Plugin_Upgrader( $skin );
! $context = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR
! break;
! case 'theme':
! $upgrader = new Theme_Upgrader( $skin );
! $context = get_theme_root( $item );
! break;
! case 'translation':
! $upgrader = new Language_Pack_Upgrader( $skin );
! $context = WP_CONTENT_DIR; // WP_LANG_DIR;
! break;
! }
! // Determine whether we can and should perform this update.
! if ( ! $this->should_update( $type, $item, $context ) )
! return false;
! switch ( $type ) {
! case 'core':
! $skin->feedback( __( 'Updating to WordPress %s' ), $item->version );
! $item_name = sprintf( __( 'WordPress %s' ), $item->version );
! break;
! case 'theme':
! $theme = wp_get_theme( $item );
! $item_name = $theme->Get( 'Name' );
! $skin->feedback( __( 'Updating theme: %s' ), $item_name );
! break;
! case 'plugin':
! $plugin_data = get_plugin_data( $context . '/' . $item );
! $item_name = $plugin_data['Name'];
! $skin->feedback( __( 'Updating plugin: %s' ), $item_name );
! break;
! case 'translation':
! $language_item_name = $upgrader->get_name_for_update( $item );
! $item_name = sprintf( __( 'Translations for %s' ), $language_item_name );
! $skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)…' ), $language_item_name, $item->language ) );
! break;
! }
! // Boom, This sites about to get a whole new splash of paint!
! $upgrade_result = $upgrader->upgrade( $item, array(
! 'clear_update_cache' => false,
! 'pre_check_md5' => false, /* always use partial builds if possible for core updates */
! 'attempt_rollback' => true, /* only available for core updates */
! ) );
! // Core doesn't output this, so lets append it so we don't get confused
! if ( 'core' == $type ) {
! if ( is_wp_error( $upgrade_result ) ) {
! $skin->error( __( 'Installation Failed' ), $upgrade_result );
! } else {
! $skin->feedback( __( 'WordPress updated successfully' ) );
! }
! }
! $this->update_results[ $type ][] = (object) array(
! 'item' => $item,
! 'result' => $upgrade_result,
! 'name' => $item_name,
! 'messages' => $skin->get_upgrade_messages()
);
! return $upgrade_result;
}
! /**
! * Kicks off the background update process, looping through all pending updates.
! *
! * @since 3.7.0
! */
! public function run() {
! global $wpdb, $wp_version;
! if ( $this->is_disabled() )
! return;
! if ( ! is_main_network() || ! is_main_site() )
! return;
! $lock_name = 'auto_updater.lock';
! // Try to lock
! $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time() ) );
! if ( ! $lock_result ) {
! $lock_result = get_option( $lock_name );
! // If we couldn't create a lock, and there isn't a lock, bail
! if ( ! $lock_result )
! return;
!
! // Check to see if the lock is still valid
! if ( $lock_result > ( time() - HOUR_IN_SECONDS ) )
! return;
! }
!
! // Update the lock, as by this point we've definately got a lock, just need to fire the actions
! update_option( $lock_name, time() );
!
! // Don't automatically run these thins, as we'll handle it ourselves
! remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
! remove_action( 'upgrader_process_complete', 'wp_version_check' );
! remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
! remove_action( 'upgrader_process_complete', 'wp_update_themes' );
!
! // Next, Plugins
! wp_update_plugins(); // Check for Plugin updates
! $plugin_updates = get_site_transient( 'update_plugins' );
! if ( $plugin_updates && !empty( $plugin_updates->response ) ) {
! foreach ( array_keys( $plugin_updates->response ) as $plugin ) {
! $this->update( 'plugin', $plugin );
! }
! // Force refresh of plugin update information
! wp_clean_plugins_cache();
}
! // Next, those themes we all love
! wp_update_themes(); // Check for Theme updates
! $theme_updates = get_site_transient( 'update_themes' );
! if ( $theme_updates && !empty( $theme_updates->response ) ) {
! foreach ( array_keys( $theme_updates->response ) as $theme ) {
! $this->update( 'theme', $theme );
! }
! // Force refresh of theme update information
! wp_clean_themes_cache();
}
! // Next, Process any core update
! wp_version_check(); // Check for Core updates
! $core_update = find_core_auto_update();
!
! if ( $core_update )
! $this->update( 'core', $core_update );
!
! // Clean up, and check for any pending translations
! // (Core_Upgrader checks for core updates)
! wp_update_themes(); // Check for Theme updates
! wp_update_plugins(); // Check for Plugin updates
!
! // Finally, Process any new translations
! $language_updates = wp_get_translation_updates();
! if ( $language_updates ) {
! foreach ( $language_updates as $update ) {
! $this->update( 'translation', $update );
! }
! // Clear existing caches
! wp_clean_plugins_cache();
! wp_clean_themes_cache();
! delete_site_transient( 'update_core' );
! wp_version_check(); // check for Core updates
! wp_update_themes(); // Check for Theme updates
! wp_update_plugins(); // Check for Plugin updates
! }
!
! // Send debugging email to all development installs.
! if ( ! empty( $this->update_results ) ) {
! $development_version = false !== strpos( $wp_version, '-' );
! /**
! * Filter whether to send a debugging email for each automatic background update.
! *
! * @since 3.7.0
! * @param bool $development_version By default, emails are sent if the install is a development version.
! * Return false to avoid the email.
! */
! if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) )
! $this->send_debug_email();
!
! if ( ! empty( $this->update_results['core'] ) )
! $this->after_core_update( $this->update_results['core'][0] );
! }
!
! // Clear the lock
! delete_option( $lock_name );
! }
!
! /**
! * If we tried to perform a core update, check if we should send an email,
! * and if we need to avoid processing future updates.
! *
! * @param object $update_result The result of the core update. Includes the update offer and result.
! */
! protected function after_core_update( $update_result ) {
! global $wp_version;
! $core_update = $update_result->item;
! $result = $update_result->result;
! if ( ! is_wp_error( $result ) ) {
! $this->send_email( 'success', $core_update );
return;
+ }
! $error_code = $result->get_error_code();
! // Any of these WP_Error codes are critical failures, as in they occurred after we started to copy core files.
! // We should not try to perform a background update again until there is a successful one-click update performed by the user.
! $critical = false;
! if ( $error_code === 'disk_full' || false !== strpos( $error_code, '__copy_dir' ) ) {
! $critical = true;
! } elseif ( $error_code === 'rollback_was_required' && is_wp_error( $result->get_error_data()->rollback ) ) {
! // A rollback is only critical if it failed too.
! $critical = true;
! $rollback_result = $result->get_error_data()->rollback;
! } elseif ( false !== strpos( $error_code, 'do_rollback' ) ) {
! $critical = true;
! }
!
! if ( $critical ) {
! $critical_data = array(
! 'attempted' => $core_update->current,
! 'current' => $wp_version,
! 'error_code' => $error_code,
! 'error_data' => $result->get_error_data(),
! 'timestamp' => time(),
! 'critical' => true,
! );
! if ( isset( $rollback_result ) ) {
! $critical_data['rollback_code'] = $rollback_result->get_error_code();
! $critical_data['rollback_data'] = $rollback_result->get_error_data();
! }
! update_site_option( 'auto_core_update_failed', $critical_data );
! $this->send_email( 'critical', $core_update, $result );
! return;
! }
! /*
! * Any other WP_Error code (like download_failed or files_not_writable) occurs before
! * we tried to copy over core files. Thus, the failures are early and graceful.
! *
! * We should avoid trying to perform a background update again for the same version.
! * But we can try again if another version is released.
! *
! * For certain 'transient' failures, like download_failed, we should allow retries.
! * In fact, let's schedule a special update for an hour from now. (It's possible
! * the issue could actually be on WordPress.org's side.) If that one fails, then email.
! */
! $send = true;
! $transient_failures = array( 'incompatible_archive', 'download_failed', 'insane_distro' );
! if ( in_array( $error_code, $transient_failures ) && ! get_site_option( 'auto_core_update_failed' ) ) {
! wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update' );
! $send = false;
! }
!
! $n = get_site_option( 'auto_core_update_notified' );
! // Don't notify if we've already notified the same email address of the same version of the same notification type.
! if ( $n && 'fail' == $n['type'] && $n['email'] == get_site_option( 'admin_email' ) && $n['version'] == $core_update->current )
! $send = false;
!
! update_site_option( 'auto_core_update_failed', array(
! 'attempted' => $core_update->current,
! 'current' => $wp_version,
! 'error_code' => $error_code,
! 'error_data' => $result->get_error_data(),
! 'timestamp' => time(),
! 'retry' => in_array( $error_code, $transient_failures ),
! ) );
! if ( $send )
! $this->send_email( 'fail', $core_update, $result );
}
! /**
! * Sends an email upon the completion or failure of a background core update.
! *
! * @since 3.7.0
! *
! * @param string $type The type of email to send. Can be one of 'success', 'fail', 'manual', 'critical'.
! * @param object $core_update The update offer that was attempted.
! * @param mixed $result Optional. The result for the core update. Can be WP_Error.
! */
! protected function send_email( $type, $core_update, $result = null ) {
! update_site_option( 'auto_core_update_notified', array(
! 'type' => $type,
! 'email' => get_site_option( 'admin_email' ),
! 'version' => $core_update->current,
! 'timestamp' => time(),
! ) );
! $next_user_core_update = get_preferred_from_update_core();
! // If the update transient is empty, use the update we just performed
! if ( ! $next_user_core_update )
! $next_user_core_update = $core_update;
! $newer_version_available = ( 'upgrade' == $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update, '>' ) );
!
! /**
! * Filter whether to send an email following an automatic background core update.
! *
! * @since 3.7.0
! *
! * @param bool $send Whether to send the email. Default true.
! * @param string $type The type of email to send. Can be one of 'success', 'fail', 'critical'.
! * @param object $core_update The update offer that was attempted.
! * @param mixed $result The result for the core update. Can be WP_Error.
! */
! if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) )
! return;
! switch ( $type ) {
! case 'success' : // We updated.
! /* translators: 1: Site name, 2: WordPress version number. */
! $subject = __( '[%1$s] Your site has updated to WordPress %2$s' );
! break;
! case 'fail' : // We tried to update but couldn't.
! case 'manual' : // We can't update (and made no attempt).
! /* translators: 1: Site name, 2: WordPress version number. */
! $subject = __( '[%1$s] WordPress %2$s is available. Please update!' );
! break;
! case 'critical' : // We tried to update, started to copy files, then things went wrong.
! /* translators: 1: Site name. */
! $subject = __( '[%1$s] URGENT: Your site may be down due to a failed update' );
! break;
! default :
! return;
}
! // If the auto update is not to the latest version, say that the current version of WP is available instead.
! $version = 'success' === $type ? $core_update->current : $next_user_core_update->current;
! $subject = sprintf( $subject, wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $version );
!
! $body = '';
!
! switch ( $type ) {
! case 'success' :
! $body .= sprintf( __( 'Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.' ), home_url(), $core_update->current );
! $body .= "\n\n";
! if ( ! $newer_version_available )
! $body .= __( 'No further action is needed on your part.' ) . ' ';
!
! // Can only reference the About screen if their update was successful.
! list( $about_version ) = explode( '-', $core_update->current, 2 );
! $body .= sprintf( __( "For more on version %s, see the About WordPress screen:" ), $about_version );
! $body .= "\n" . admin_url( 'about.php' );
!
! if ( $newer_version_available ) {
! $body .= "\n\n" . sprintf( __( 'WordPress %s is also now available.' ), $next_user_core_update->current ) . ' ';
! $body .= __( 'Updating is easy and only takes a few moments:' );
! $body .= "\n" . network_admin_url( 'update-core.php' );
! }
! break;
! case 'fail' :
! case 'manual' :
! $body .= sprintf( __( 'Please update your site at %1$s to WordPress %2$s.' ), home_url(), $next_user_core_update->current );
!
! $body .= "\n\n";
!
! // Don't show this message if there is a newer version available.
! // Potential for confusion, and also not useful for them to know at this point.
! if ( 'fail' == $type && ! $newer_version_available )
! $body .= __( 'We tried but were unable to update your site automatically.' ) . ' ';
! $body .= __( 'Updating is easy and only takes a few moments:' );
! $body .= "\n" . network_admin_url( 'update-core.php' );
! break;
! case 'critical' :
! if ( $newer_version_available )
! $body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.' ), home_url(), $core_update->current );
! else
! $body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.' ), home_url(), $core_update->current );
! $body .= "\n\n" . __( "This means your site may be offline or broken. Don't panic; this can be fixed." );
! $body .= "\n\n" . __( "Please check out your site now. It's possible that everything is working. If it says you need to update, you should do so:" );
! $body .= "\n" . network_admin_url( 'update-core.php' );
! break;
! }
! // Updates are important!
! if ( $type != 'success' || $newer_version_available )
! $body .= "\n\n" . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' );
!
! // Add a note about the support forums to all emails.
! $body .= "\n\n" . __( 'If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.' );
! $body .= "\n" . __( 'http://wordpress.org/support/' );
!
! // If things are successful and we're now on the latest, mention plugins and themes if any are out of date.
! if ( $type == 'success' && ! $newer_version_available && ( get_plugin_updates() || get_theme_updates() ) ) {
! $body .= "\n\n" . __( 'You also have some plugins or themes with updates available. Update them now:' );
! $body .= "\n" . network_admin_url();
! }
!
! $body .= "\n\n" . __( 'The WordPress Team' ) . "\n";
!
! if ( 'critical' == $type && is_wp_error( $result ) ) {
! $body .= "\n***\n\n";
! $body .= sprintf( __( 'Your site was running version %s.' ), $GLOBALS['wp_version'] );
! $body .= ' ' . __( 'We have some data that describes the error your site encountered.' );
! $body .= ' ' . __( 'Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:' );
!
! // If we had a rollback and we're still critical, then the rollback failed too.
! // Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc.
! if ( 'rollback_was_required' == $result->get_error_code() )
! $errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback );
! else
! $errors = array( $result );
! foreach ( $errors as $error ) {
! if ( ! is_wp_error( $error ) )
! continue;
! $error_code = $error->get_error_code();
! $body .= "\n\n" . sprintf( __( "Error code: %s" ), $error_code );
! if ( 'rollback_was_required' == $error_code )
! continue;
! if ( $error->get_error_message() )
! $body .= "\n" . $error->get_error_message();
! $error_data = $error->get_error_data();
! if ( $error_data )
! $body .= "\n" . implode( ', ', (array) $error_data );
! }
! $body .= "\n";
! }
! $to = get_site_option( 'admin_email' );
! $headers = '';
! $email = compact( 'to', 'subject', 'body', 'headers' );
! /**
! * Filter the email sent following an automatic background core update.
! *
! * @since 3.7.0
! *
! * @param array $email {
! * Array of email arguments that will be passed to wp_mail().
! *
! * @type string $to The email recipient. An array of emails can be returned, as handled by wp_mail().
! * @type string $subject The email's subject.
! * @type string $body The email message body.
! * @type string $headers Any email headers, defaults to no headers.
! * }
! * @param string $type The type of email being sent. Can be one of 'success', 'fail', 'manual', 'critical'.
! * @param object $core_update The update offer that was attempted.
! * @param mixed $result The result for the core update. Can be WP_Error.
! */
! $email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result );
!
! wp_mail( $email['to'], $email['subject'], $email['body'], $email['headers'] );
! }
!
! /**
! * Prepares and sends an email of a full log of background update results, useful for debugging and geekery.
! *
! * @since 3.7.0
! */
! protected function send_debug_email() {
! $update_count = 0;
! foreach ( $this->update_results as $type => $updates )
! $update_count += count( $updates );
!
! $body = array();
! $failures = 0;
!
! $body[] = 'WordPress site: ' . network_home_url( '/' );
!
! // Core
! if ( isset( $this->update_results['core'] ) ) {
! $result = $this->update_results['core'][0];
! if ( $result->result && ! is_wp_error( $result->result ) ) {
! $body[] = sprintf( 'SUCCESS: WordPress was successfully updated to %s', $result->name );
! } else {
! $body[] = sprintf( 'FAILED: WordPress failed to update to %s', $result->name );
! $failures++;
! }
! $body[] = '';
! }
! // Plugins, Themes, Translations
! foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
! if ( ! isset( $this->update_results[ $type ] ) )
! continue;
! $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
! if ( $success_items ) {
! $body[] = "The following {$type}s were successfully updated:";
! foreach ( wp_list_pluck( $success_items, 'name' ) as $name )
! $body[] = ' * SUCCESS: ' . $name;
! }
! if ( $success_items != $this->update_results[ $type ] ) {
! // Failed updates
! $body[] = "The following {$type}s failed to update:";
! foreach ( $this->update_results[ $type ] as $item ) {
! if ( ! $item->result || is_wp_error( $item->result ) ) {
! $body[] = ' * FAILED: ' . $item->name;
! $failures++;
! }
! }
! }
! $body[] = '';
! }
! if ( $failures ) {
! $body[] = '';
! $body[] = 'BETA TESTING?';
! $body[] = '=============';
! $body[] = '';
! $body[] = 'This debugging email is sent when you are using a development version of WordPress.';
! $body[] = '';
! $body[] = 'If you think these failures might be due to a bug in WordPress, could you report it?';
! $body[] = ' * Open a thread in the support forums: http://wordpress.org/support/forum/alphabeta';
! $body[] = " * Or, if you're comfortable writing a bug report: http://core.trac.wordpress.org/";
! $body[] = '';
! $body[] = 'Thanks! -- The WordPress Team';
! $body[] = '';
! $subject = sprintf( '[%s] There were failures during background updates', get_bloginfo( 'name' ) );
} else {
! $subject = sprintf( '[%s] Background updates have finished', get_bloginfo( 'name' ) );
}
! $body[] = 'UPDATE LOG';
! $body[] = '==========';
! $body[] = '';
! foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) {
! if ( ! isset( $this->update_results[ $type ] ) )
! continue;
! foreach ( $this->update_results[ $type ] as $update ) {
! $body[] = $update->name;
! $body[] = str_repeat( '-', strlen( $update->name ) );
! foreach ( $update->messages as $message )
! $body[] = " " . html_entity_decode( str_replace( '…', '...', $message ) );
! if ( is_wp_error( $update->result ) ) {
! $results = array( 'update' => $update->result );
! // If we rolled back, we want to know an error that occurred then too.
! if ( 'rollback_was_required' === $update->result->get_error_code() )
! $results = (array) $update->result->get_error_data();
! foreach ( $results as $result_type => $result ) {
! if ( ! is_wp_error( $result ) )
! continue;
! $body[] = ' ' . ( 'rollback' === $result_type ? 'Rollback ' : '' ) . 'Error: [' . $result->get_error_code() . '] ' . $result->get_error_message();
! if ( $result->get_error_data() )
! $body[] = ' ' . implode( ', ', (array) $result->get_error_data() );
! }
! }
! $body[] = '';
! }
! }
! //echo "\n$subject\n \n";
! //echo "\n" . implode( "\n", $body ) . "\n ";
!
! wp_mail( get_site_option( 'admin_email' ), $subject, implode( "\n", $body ) );
}
}
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-upgrader-skins.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-upgrader-skins.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/class-wp-upgrader-skins.php 1969-12-31 18:00:00.000000000 -0600
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/class-wp-upgrader-skins.php 2013-10-23 09:40:10.000000000 -0500
***************
*** 0 ****
--- 1,662 ----
+ '', 'nonce' => '', 'title' => '', 'context' => false );
+ $this->options = wp_parse_args($args, $defaults);
+ }
+
+ function set_upgrader(&$upgrader) {
+ if ( is_object($upgrader) )
+ $this->upgrader =& $upgrader;
+ $this->add_strings();
+ }
+
+ function add_strings() {
+ }
+
+ function set_result($result) {
+ $this->result = $result;
+ }
+
+ function request_filesystem_credentials($error = false) {
+ $url = $this->options['url'];
+ $context = $this->options['context'];
+ if ( !empty($this->options['nonce']) )
+ $url = wp_nonce_url($url, $this->options['nonce']);
+ return request_filesystem_credentials($url, '', $error, $context); //Possible to bring inline, Leaving as is for now.
+ }
+
+ function header() {
+ if ( $this->done_header )
+ return;
+ $this->done_header = true;
+ echo '';
+ screen_icon();
+ echo '
' . $this->options['title'] . ' ';
+ }
+ function footer() {
+ echo '';
+ }
+
+ function error($errors) {
+ if ( ! $this->done_header )
+ $this->header();
+ if ( is_string($errors) ) {
+ $this->feedback($errors);
+ } elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
+ foreach ( $errors->get_error_messages() as $message ) {
+ if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) )
+ $this->feedback($message . ' ' . esc_html( $errors->get_error_data() ) );
+ else
+ $this->feedback($message);
+ }
+ }
+ }
+
+ function feedback($string) {
+ if ( isset( $this->upgrader->strings[$string] ) )
+ $string = $this->upgrader->strings[$string];
+
+ if ( strpos($string, '%') !== false ) {
+ $args = func_get_args();
+ $args = array_splice($args, 1);
+ if ( $args ) {
+ $args = array_map( 'strip_tags', $args );
+ $args = array_map( 'esc_html', $args );
+ $string = vsprintf($string, $args);
+ }
+ }
+ if ( empty($string) )
+ return;
+ show_message($string);
+ }
+ function before() {}
+ function after() {}
+
+ }
+
+ /**
+ * Plugin Upgrader Skin for WordPress Plugin Upgrades.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
+ var $plugin = '';
+ var $plugin_active = false;
+ var $plugin_network_active = false;
+
+ function __construct($args = array()) {
+ $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') );
+ $args = wp_parse_args($args, $defaults);
+
+ $this->plugin = $args['plugin'];
+
+ $this->plugin_active = is_plugin_active( $this->plugin );
+ $this->plugin_network_active = is_plugin_active_for_network( $this->plugin );
+
+ parent::__construct($args);
+ }
+
+ function after() {
+ $this->plugin = $this->upgrader->plugin_info();
+ if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
+ echo '';
+ }
+
+ $update_actions = array(
+ 'activate_plugin' => '' . __('Activate Plugin') . ' ',
+ 'plugins_page' => '' . __('Return to Plugins page') . ' '
+ );
+ if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) )
+ unset( $update_actions['activate_plugin'] );
+
+ $update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $this->plugin);
+ if ( ! empty($update_actions) )
+ $this->feedback(implode(' | ', (array)$update_actions));
+ }
+
+ function before() {
+ if ( $this->upgrader->show_before ) {
+ echo $this->upgrader->show_before;
+ $this->upgrader->show_before = '';
+ }
+ }
+ }
+
+ /**
+ * Plugin Upgrader Skin for WordPress Plugin Upgrades.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 3.0.0
+ */
+ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
+ var $in_loop = false;
+ var $error = false;
+
+ function __construct($args = array()) {
+ $defaults = array( 'url' => '', 'nonce' => '' );
+ $args = wp_parse_args($args, $defaults);
+
+ parent::__construct($args);
+ }
+
+ function add_strings() {
+ $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take a while on some hosts, so please be patient.');
+ $this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while updating %1$s: %2$s ');
+ $this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.');
+ $this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully.').' '.__('Show Details').' '.__('Hide Details').' . ';
+ $this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.');
+ }
+
+ function feedback($string) {
+ if ( isset( $this->upgrader->strings[$string] ) )
+ $string = $this->upgrader->strings[$string];
+
+ if ( strpos($string, '%') !== false ) {
+ $args = func_get_args();
+ $args = array_splice($args, 1);
+ if ( $args ) {
+ $args = array_map( 'strip_tags', $args );
+ $args = array_map( 'esc_html', $args );
+ $string = vsprintf($string, $args);
+ }
+ }
+ if ( empty($string) )
+ return;
+ if ( $this->in_loop )
+ echo "$string \n";
+ else
+ echo "$string
\n";
+ }
+
+ function header() {
+ // Nothing, This will be displayed within a iframe.
+ }
+
+ function footer() {
+ // Nothing, This will be displayed within a iframe.
+ }
+ function error($error) {
+ if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
+ $this->error = $this->upgrader->strings[$error];
+
+ if ( is_wp_error($error) ) {
+ foreach ( $error->get_error_messages() as $emessage ) {
+ if ( $error->get_error_data() && is_string( $error->get_error_data() ) )
+ $messages[] = $emessage . ' ' . esc_html( $error->get_error_data() );
+ else
+ $messages[] = $emessage;
+ }
+ $this->error = implode(', ', $messages);
+ }
+ echo '';
+ }
+
+ function bulk_header() {
+ $this->feedback('skin_upgrade_start');
+ }
+
+ function bulk_footer() {
+ $this->feedback('skin_upgrade_end');
+ }
+
+ function before($title = '') {
+ $this->in_loop = true;
+ printf( '' . $this->upgrader->strings['skin_before_update_header'] . ' ', $title, $this->upgrader->update_current, $this->upgrader->update_count);
+ echo '';
+ echo '';
+ $this->flush_output();
+ }
+
+ function after($title = '') {
+ echo '
';
+ if ( $this->error || ! $this->result ) {
+ if ( $this->error )
+ echo '' . sprintf($this->upgrader->strings['skin_update_failed_error'], $title, $this->error) . '
';
+ else
+ echo '' . sprintf($this->upgrader->strings['skin_update_failed'], $title) . '
';
+
+ echo '';
+ }
+ if ( $this->result && ! is_wp_error( $this->result ) ) {
+ if ( ! $this->error )
+ echo '' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '
';
+ echo '';
+ }
+
+ $this->reset();
+ $this->flush_output();
+ }
+
+ function reset() {
+ $this->in_loop = false;
+ $this->error = false;
+ }
+
+ function flush_output() {
+ wp_ob_end_flush_all();
+ flush();
+ }
+ }
+
+ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
+ var $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
+
+ function __construct($args = array()) {
+ parent::__construct($args);
+ }
+
+ function add_strings() {
+ parent::add_strings();
+ $this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)');
+ }
+
+ function before($title = '') {
+ parent::before($this->plugin_info['Title']);
+ }
+
+ function after($title = '') {
+ parent::after($this->plugin_info['Title']);
+ }
+ function bulk_footer() {
+ parent::bulk_footer();
+ $update_actions = array(
+ 'plugins_page' => '' . __('Return to Plugins page') . ' ',
+ 'updates_page' => '' . __('Return to WordPress Updates') . ' '
+ );
+ if ( ! current_user_can( 'activate_plugins' ) )
+ unset( $update_actions['plugins_page'] );
+
+ $update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
+ if ( ! empty($update_actions) )
+ $this->feedback(implode(' | ', (array)$update_actions));
+ }
+ }
+
+ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
+ var $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
+
+ function __construct($args = array()) {
+ parent::__construct($args);
+ }
+
+ function add_strings() {
+ parent::add_strings();
+ $this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
+ }
+
+ function before($title = '') {
+ parent::before( $this->theme_info->display('Name') );
+ }
+
+ function after($title = '') {
+ parent::after( $this->theme_info->display('Name') );
+ }
+
+ function bulk_footer() {
+ parent::bulk_footer();
+ $update_actions = array(
+ 'themes_page' => '' . __('Return to Themes page') . ' ',
+ 'updates_page' => '' . __('Return to WordPress Updates') . ' '
+ );
+ if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
+ unset( $update_actions['themes_page'] );
+
+ $update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
+ if ( ! empty($update_actions) )
+ $this->feedback(implode(' | ', (array)$update_actions));
+ }
+ }
+
+ /**
+ * Plugin Installer Skin for WordPress Plugin Installer.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
+ var $api;
+ var $type;
+
+ function __construct($args = array()) {
+ $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
+ $args = wp_parse_args($args, $defaults);
+
+ $this->type = $args['type'];
+ $this->api = isset($args['api']) ? $args['api'] : array();
+
+ parent::__construct($args);
+ }
+
+ function before() {
+ if ( !empty($this->api) )
+ $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin %s %s .'), $this->api->name, $this->api->version);
+ }
+
+ function after() {
+
+ $plugin_file = $this->upgrader->plugin_info();
+
+ $install_actions = array();
+
+ $from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
+
+ if ( 'import' == $from )
+ $install_actions['activate_plugin'] = '' . __('Activate Plugin & Run Importer') . ' ';
+ else
+ $install_actions['activate_plugin'] = '' . __('Activate Plugin') . ' ';
+
+ if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
+ $install_actions['network_activate'] = '' . __('Network Activate') . ' ';
+ unset( $install_actions['activate_plugin'] );
+ }
+
+ if ( 'import' == $from )
+ $install_actions['importers_page'] = '' . __('Return to Importers') . ' ';
+ else if ( $this->type == 'web' )
+ $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . ' ';
+ else
+ $install_actions['plugins_page'] = '' . __('Return to Plugins page') . ' ';
+
+ if ( ! $this->result || is_wp_error($this->result) ) {
+ unset( $install_actions['activate_plugin'], $install_actions['network_activate'] );
+ } elseif ( ! current_user_can( 'activate_plugins' ) ) {
+ unset( $install_actions['activate_plugin'] );
+ }
+
+ $install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file);
+ if ( ! empty($install_actions) )
+ $this->feedback(implode(' | ', (array)$install_actions));
+ }
+ }
+
+ /**
+ * Theme Installer Skin for the WordPress Theme Installer.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+ class Theme_Installer_Skin extends WP_Upgrader_Skin {
+ var $api;
+ var $type;
+
+ function __construct($args = array()) {
+ $defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
+ $args = wp_parse_args($args, $defaults);
+
+ $this->type = $args['type'];
+ $this->api = isset($args['api']) ? $args['api'] : array();
+
+ parent::__construct($args);
+ }
+
+ function before() {
+ if ( !empty($this->api) )
+ $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version);
+ }
+
+ function after() {
+ if ( empty($this->upgrader->result['destination_name']) )
+ return;
+
+ $theme_info = $this->upgrader->theme_info();
+ if ( empty( $theme_info ) )
+ return;
+
+ $name = $theme_info->display('Name');
+ $stylesheet = $this->upgrader->result['destination_name'];
+ $template = $theme_info->get_template();
+
+ $preview_link = add_query_arg( array(
+ 'preview' => 1,
+ 'template' => urlencode( $template ),
+ 'stylesheet' => urlencode( $stylesheet ),
+ ), trailingslashit( home_url() ) );
+
+ $activate_link = add_query_arg( array(
+ 'action' => 'activate',
+ 'template' => urlencode( $template ),
+ 'stylesheet' => urlencode( $stylesheet ),
+ ), admin_url('themes.php') );
+ $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
+
+ $install_actions = array();
+ $install_actions['preview'] = '' . __('Preview') . ' ';
+ $install_actions['preview'] .= '' . __('Live Preview') . ' ';
+ $install_actions['activate'] = '' . __('Activate') . ' ';
+
+ if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
+ $install_actions['network_enable'] = '' . __( 'Network Enable' ) . ' ';
+
+ if ( $this->type == 'web' )
+ $install_actions['themes_page'] = '' . __('Return to Theme Installer') . ' ';
+ elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
+ $install_actions['themes_page'] = '' . __('Return to Themes page') . ' ';
+
+ if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) )
+ unset( $install_actions['activate'], $install_actions['preview'] );
+
+ $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info);
+ if ( ! empty($install_actions) )
+ $this->feedback(implode(' | ', (array)$install_actions));
+ }
+ }
+
+ /**
+ * Theme Upgrader Skin for WordPress Theme Upgrades.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
+ var $theme = '';
+
+ function __construct($args = array()) {
+ $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
+ $args = wp_parse_args($args, $defaults);
+
+ $this->theme = $args['theme'];
+
+ parent::__construct($args);
+ }
+
+ function after() {
+
+ $update_actions = array();
+ if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
+ $name = $theme_info->display('Name');
+ $stylesheet = $this->upgrader->result['destination_name'];
+ $template = $theme_info->get_template();
+
+ $preview_link = add_query_arg( array(
+ 'preview' => 1,
+ 'template' => urlencode( $template ),
+ 'stylesheet' => urlencode( $stylesheet ),
+ ), trailingslashit( home_url() ) );
+
+ $activate_link = add_query_arg( array(
+ 'action' => 'activate',
+ 'template' => urlencode( $template ),
+ 'stylesheet' => urlencode( $stylesheet ),
+ ), admin_url('themes.php') );
+ $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
+
+ if ( get_stylesheet() == $stylesheet ) {
+ if ( current_user_can( 'edit_theme_options' ) )
+ $update_actions['preview'] = '' . __('Customize') . ' ';
+ } elseif ( current_user_can( 'switch_themes' ) ) {
+ $update_actions['preview'] = '' . __('Preview') . ' ';
+ $update_actions['preview'] .= '' . __('Live Preview') . ' ';
+ $update_actions['activate'] = '' . __('Activate') . ' ';
+ }
+
+ if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
+ unset( $update_actions['preview'], $update_actions['activate'] );
+ }
+
+ $update_actions['themes_page'] = '' . __('Return to Themes page') . ' ';
+
+ $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme);
+ if ( ! empty($update_actions) )
+ $this->feedback(implode(' | ', (array)$update_actions));
+ }
+ }
+
+ /**
+ * Translation Upgrader Skin for WordPress Translation Upgrades.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 3.7.0
+ */
+ class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
+ var $language_update = null;
+ var $done_header = false;
+ var $display_footer_actions = true;
+
+ function __construct( $args = array() ) {
+ $defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false );
+ $args = wp_parse_args( $args, $defaults );
+ if ( $args['skip_header_footer'] ) {
+ $this->done_header = true;
+ $this->display_footer_actions = false;
+ }
+ parent::__construct( $args );
+ }
+
+ function before() {
+ $name = $this->upgrader->get_name_for_update( $this->language_update );
+
+ echo '';
+
+ printf( '
' . __( 'Updating translations for %1$s (%2$s)…' ) . ' ', $name, $this->language_update->language );
+ }
+
+ function error( $error ) {
+ echo '
';
+ parent::error( $error );
+ echo '
';
+ }
+
+ function after() {
+ echo '
';
+ }
+
+ function bulk_footer() {
+ $update_actions = array();
+ $update_actions['updates_page'] = '' . __( 'Return to WordPress Updates' ) . ' ';
+ $update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
+
+ if ( $update_actions && $this->display_footer_actions )
+ $this->feedback( implode( ' | ', $update_actions ) );
+
+ parent::footer();
+ }
+ }
+
+ /**
+ * Upgrader Skin for Automatic WordPress Upgrades
+ *
+ * This skin is designed to be used when no output is intended, all output
+ * is captured and stored for the caller to process and log/email/discard.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 3.7.0
+ */
+ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
+ protected $messages = array();
+
+ function request_filesystem_credentials( $error = false, $context = '' ) {
+ if ( $context )
+ $this->options['context'] = $context;
+ // TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version
+ // This will output a credentials form in event of failure, We don't want that, so just hide with a buffer
+ ob_start();
+ $result = parent::request_filesystem_credentials( $error );
+ ob_end_clean();
+ return $result;
+ }
+
+ function get_upgrade_messages() {
+ return $this->messages;
+ }
+
+ function feedback( $data ) {
+ if ( is_wp_error( $data ) )
+ $string = $data->get_error_message();
+ else if ( is_array( $data ) )
+ return;
+ else
+ $string = $data;
+
+ if ( ! empty( $this->upgrader->strings[ $string ] ) )
+ $string = $this->upgrader->strings[ $string ];
+
+ if ( strpos( $string, '%' ) !== false ) {
+ $args = func_get_args();
+ $args = array_splice( $args, 1 );
+ if ( ! empty( $args ) )
+ $string = vsprintf( $string, $args );
+ }
+
+ $string = trim( $string );
+
+ // Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output.
+ $string = wp_kses( $string, array(
+ 'a' => array(
+ 'href' => true
+ ),
+ 'br' => true,
+ 'em' => true,
+ 'strong' => true,
+ ) );
+
+ if ( empty( $string ) )
+ return;
+
+ $this->messages[] = $string;
+ }
+
+ function header() {
+ ob_start();
+ }
+
+ function footer() {
+ $output = ob_get_contents();
+ if ( ! empty( $output ) )
+ $this->feedback( $output );
+ ob_end_clean();
+ }
+
+ function bulk_header() {}
+ function bulk_footer() {}
+ function before() {}
+ function after() {}
+ }
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/comment.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/comment.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/comment.php 2013-03-01 10:28:40.000000000 -0600
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/comment.php 2013-09-13 20:01:08.000000000 -0500
***************
*** 36,47 ****
if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) )
wp_die ( __( 'You are not allowed to edit comments on this post.' ) );
! $_POST['comment_author'] = $_POST['newcomment_author'];
! $_POST['comment_author_email'] = $_POST['newcomment_author_email'];
! $_POST['comment_author_url'] = $_POST['newcomment_author_url'];
! $_POST['comment_approved'] = $_POST['comment_status'];
! $_POST['comment_content'] = $_POST['content'];
! $_POST['comment_ID'] = (int) $_POST['comment_ID'];
foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
--- 36,53 ----
if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) )
wp_die ( __( 'You are not allowed to edit comments on this post.' ) );
! if ( isset( $_POST['newcomment_author'] ) )
! $_POST['comment_author'] = $_POST['newcomment_author'];
! if ( isset( $_POST['newcomment_author_email'] ) )
! $_POST['comment_author_email'] = $_POST['newcomment_author_email'];
! if ( isset( $_POST['newcomment_author_url'] ) )
! $_POST['comment_author_url'] = $_POST['newcomment_author_url'];
! if ( isset( $_POST['comment_status'] ) )
! $_POST['comment_approved'] = $_POST['comment_status'];
! if ( isset( $_POST['content'] ) )
! $_POST['comment_content'] = $_POST['content'];
! if ( isset( $_POST['comment_ID'] ) )
! $_POST['comment_ID'] = (int) $_POST['comment_ID'];
foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
***************
*** 83,89 ****
$comment->comment_post_ID = (int) $comment->comment_post_ID;
$comment->comment_content = format_to_edit( $comment->comment_content );
! $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content);
$comment->comment_author = format_to_edit( $comment->comment_author );
$comment->comment_author_email = format_to_edit( $comment->comment_author_email );
--- 89,102 ----
$comment->comment_post_ID = (int) $comment->comment_post_ID;
$comment->comment_content = format_to_edit( $comment->comment_content );
! /**
! * Filter the comment content before editing.
! *
! * @since 2.0.0
! *
! * @param string $comment->comment_content Comment content.
! */
! $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content );
$comment->comment_author = format_to_edit( $comment->comment_author );
$comment->comment_author_email = format_to_edit( $comment->comment_author_email );
***************
*** 148,154 ****
*/
function floated_admin_avatar( $name ) {
global $comment;
! $avatar = get_avatar( $comment, 32 );
return "$avatar $name";
}
--- 161,167 ----
*/
function floated_admin_avatar( $name ) {
global $comment;
! $avatar = get_avatar( $comment, 32, 'mystery' );
return "$avatar $name";
}
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/dashboard.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/dashboard.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/dashboard.php 2013-05-22 16:01:57.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/dashboard.php 2013-10-22 12:22:11.000000000 -0500
***************
*** 142,152 ****
if ( $update )
update_option( 'dashboard_widget_options', $widget_options );
do_action('do_meta_boxes', $screen->id, 'normal', '');
do_action('do_meta_boxes', $screen->id, 'side', '');
}
! function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {
$screen = get_current_screen();
global $wp_dashboard_control_callbacks;
--- 142,154 ----
if ( $update )
update_option( 'dashboard_widget_options', $widget_options );
+ /** This action is documented in wp-admin/edit-form-advanced.php */
do_action('do_meta_boxes', $screen->id, 'normal', '');
+ /** This action is documented in wp-admin/edit-form-advanced.php */
do_action('do_meta_boxes', $screen->id, 'side', '');
}
! function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) {
$screen = get_current_screen();
global $wp_dashboard_control_callbacks;
***************
*** 177,183 ****
if ( 'dashboard_browser_nag' === $widget_id )
$priority = 'high';
! add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority );
}
function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
--- 179,185 ----
if ( 'dashboard_browser_nag' === $widget_id )
$priority = 'high';
! add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args );
}
function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
***************
*** 366,372 ****
if ( $theme->errors() ) {
if ( ! is_multisite() || is_super_admin() )
! echo '' . __('ERROR: The themes directory is either empty or doesn’t exist. Please check your installation.') . ' ';
} elseif ( ! empty($wp_registered_sidebars) ) {
$sidebars_widgets = wp_get_sidebars_widgets();
$num_widgets = 0;
--- 368,374 ----
if ( $theme->errors() ) {
if ( ! is_multisite() || is_super_admin() )
! echo '' . sprintf( __( 'ERROR: %s' ), $theme->errors()->get_error_message() ) . ' ';
} elseif ( ! empty($wp_registered_sidebars) ) {
$sidebars_widgets = wp_get_sidebars_widgets();
$num_widgets = 0;
***************
*** 710,716 ****
--- 1064,1071 ----
! size="40" />
!
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/image-edit.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/image-edit.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/image-edit.php 2013-07-05 10:45:43.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/image-edit.php 2013-10-22 12:22:11.000000000 -0500
***************
*** 467,474 ****
$h = $size['height'];
$ratio = _image_get_preview_ratio( $w, $h );
! $w2 = $w * $ratio;
! $h2 = $h * $ratio;
if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
return false;
--- 467,474 ----
$h = $size['height'];
$ratio = _image_get_preview_ratio( $w, $h );
! $w2 = max ( 1, $w * $ratio );
! $h2 = max ( 1, $h * $ratio );
if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
return false;
***************
*** 499,504 ****
--- 499,505 ----
if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
// delete only if it's edited image
if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) {
+ /** This filter is documented in wp-admin/custom-header.php */
$delpath = apply_filters('wp_delete_file', $file);
@unlink($delpath);
}
***************
*** 522,527 ****
--- 523,529 ----
if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
// delete only if it's edited image
if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) {
+ /** This filter is documented in wp-admin/custom-header.php */
$delpath = apply_filters( 'wp_delete_file', path_join($parts['dirname'], $meta['sizes'][$default_size]['file']) );
@unlink($delpath);
}
***************
*** 722,727 ****
--- 724,730 ----
}
if ( $delete ) {
+ /** This filter is documented in wp-admin/custom-header.php */
$delpath = apply_filters('wp_delete_file', $new_path);
@unlink( $delpath );
}
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/import.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/import.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/import.php 2013-05-27 22:53:59.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/import.php 2013-09-14 14:31:08.000000000 -0500
***************
*** 108,117 ****
$popular_importers = get_site_transient( 'popular_importers_' . $locale );
if ( ! $popular_importers ) {
! $url = add_query_arg( 'locale', get_locale(), 'http://api.wordpress.org/core/importers/1.0/' );
$options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() );
$response = wp_remote_get( $url, $options );
! $popular_importers = maybe_unserialize( wp_remote_retrieve_body( $response ) );
if ( is_array( $popular_importers ) )
set_site_transient( 'popular_importers_' . $locale, $popular_importers, 2 * DAY_IN_SECONDS );
--- 108,117 ----
$popular_importers = get_site_transient( 'popular_importers_' . $locale );
if ( ! $popular_importers ) {
! $url = add_query_arg( 'locale', get_locale(), 'http://api.wordpress.org/core/importers/1.1/' );
$options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() );
$response = wp_remote_get( $url, $options );
! $popular_importers = json_decode( wp_remote_retrieve_body( $response ), true );
if ( is_array( $popular_importers ) )
set_site_transient( 'popular_importers_' . $locale, $popular_importers, 2 * DAY_IN_SECONDS );
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/list-table.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/list-table.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/list-table.php 2012-11-25 21:39:29.000000000 -0600
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/list-table.php 2013-09-05 11:34:09.000000000 -0500
***************
*** 95,101 ****
if ( !empty( $columns ) ) {
$this->_columns = $columns;
! add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
}
}
--- 95,101 ----
if ( !empty( $columns ) ) {
$this->_columns = $columns;
! add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 );
}
}
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/media.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/media.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/media.php 2013-07-24 00:47:00.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/media.php 2013-10-08 10:32:10.000000000 -0500
***************
*** 914,931 ****
* @param array $attachment {@internal $attachment not used}}
* @return array
*/
! function image_attachment_fields_to_save($post, $attachment) {
! if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {
! if ( strlen(trim($post['post_title'])) == 0 ) {
! $post['post_title'] = preg_replace('/\.\w+$/', '', basename($post['guid']));
! $post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.');
}
}
return $post;
}
! add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2);
/**
* {@internal Missing Short Description}}
--- 914,932 ----
* @param array $attachment {@internal $attachment not used}}
* @return array
*/
! function image_attachment_fields_to_save( $post, $attachment ) {
! if ( substr( $post['post_mime_type'], 0, 5 ) == 'image' ) {
! if ( strlen( trim( $post['post_title'] ) ) == 0 ) {
! $attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid'];
! $post['post_title'] = preg_replace( '/\.\w+$/', '', wp_basename( $attachment_url ) );
! $post['errors']['post_title']['errors'][] = __( 'Empty Title filled from filename.' );
}
}
return $post;
}
! add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 );
/**
* {@internal Missing Short Description}}
***************
*** 1499,1505 ****
* @param unknown_type $errors
*/
function media_upload_form( $errors = null ) {
! global $type, $tab, $pagenow, $is_IE, $is_opera;
if ( ! _device_can_upload() ) {
echo '
' . sprintf( __('The web browser on your device cannot be used to upload files. You may be able to use the native app for your device instead.'), 'http://wordpress.org/mobile/' ) . '
';
--- 1500,1506 ----
* @param unknown_type $errors
*/
function media_upload_form( $errors = null ) {
! global $type, $tab, $is_IE, $is_opera;
if ( ! _device_can_upload() ) {
echo '
' . sprintf( __('The web browser on your device cannot be used to upload files. You may be able to use the native app for your device instead.'), 'http://wordpress.org/mobile/' ) . '
';
***************
*** 2077,2093 ****
$arc_result = $wpdb->get_results( $arc_query );
$month_count = count($arc_result);
if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
! value='0'>
yyear == 0 )
continue;
$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
! if ( isset($_GET['m']) && ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] ) )
$default = ' selected="selected"';
else
$default = '';
--- 2078,2095 ----
$arc_result = $wpdb->get_results( $arc_query );
$month_count = count($arc_result);
+ $selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0;
if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
! value='0'>
yyear == 0 )
continue;
$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
! if ( $arc_row->yyear . $arc_row->mmonth == $selected_month )
$default = ' selected="selected"';
else
$default = '';
***************
*** 2432,2445 ****
$att_url = wp_get_attachment_url( $post->ID );
?>
!
!
!
ID ), $matches ) )
echo esc_html( strtoupper( $matches[1] ) );
--- 2434,2447 ----
$att_url = wp_get_attachment_url( $post->ID );
?>
!
!
!
ID ), $matches ) )
echo esc_html( strtoupper( $matches[1] ) );
***************
*** 2448,2466 ****
?>
! post_mime_type ) ):
! $fields = array(
! 'mime_type' => __( 'Mime-type:' ),
! 'year' => __( 'Year:' ),
! 'genre' => __( 'Genre:' ),
'length_formatted' => __( 'Length:' ),
! );
foreach ( $fields as $key => $label ):
if ( ! empty( $meta[$key] ) ) : ?>
!
! ID );
! $file_size = false;
!
! if ( isset( $meta['filesize'] ) )
! $file_size = $meta['filesize'];
! elseif ( file_exists( $file ) )
! $file_size = filesize( $file );
!
! if ( ! empty( $file_size ) ) : ?>
!
!
!
! post_mime_type ) ):
!
! /**
! * Audio and video metadata fields to be shown in the publish meta box.
! *
! * The key for each item in the array should correspond to an attachment
! * metadata key, and the value should be the desired label.
! *
! * @since 3.7.0
! *
! * @param array $fields {
! * An array of the attachment metadata keys and labels.
! *
! * @type string 'mime_type' Label to be shown before the field mime_type.
! * @type string 'year' Label to be shown before the field year.
! * @type string 'genre' Label to be shown before the field genre.
! * @type string 'length_formatted' Label to be shown before the field length_formatted.
! * }
! */
! $fields = apply_filters( 'media_submitbox_misc_sections', array(
! 'mime_type' => __( 'Mime-type:' ),
! 'year' => __( 'Year:' ),
! 'genre' => __( 'Genre:' ),
'length_formatted' => __( 'Length:' ),
! ) );
foreach ( $fields as $key => $label ):
if ( ! empty( $meta[$key] ) ) : ?>
!
!
!
__( 'Audio Format:' ),
! 'codec' => __( 'Audio Codec:' )
! );
foreach ( $audio_fields as $key => $label ):
if ( ! empty( $meta['audio'][$key] ) ) : ?>
!
__( 'Audio Format:' ),
! 'codec' => __( 'Audio Codec:' )
! ) );
foreach ( $audio_fields as $key => $label ):
if ( ! empty( $meta['audio'][$key] ) ) : ?>
!
!
!
!
post_status ) {
--- 55,61 ----
!
post_status ) {
***************
*** 105,111 ****
!
post_status ) {
--- 105,111 ----
!
post_status ) {
***************
*** 138,144 ****
ID ) ); ?> />
/>
!
/>
--- 138,144 ----
ID ) ); ?> />
/>
!
/>
***************
*** 174,180 ****
if ( ! empty( $args['args']['revisions_count'] ) ) :
$revisions_to_keep = wp_revisions_to_keep( $post );
?>
!
0 && $revisions_to_keep <= $args['args']['revisions_count'] ) {
echo '
0 && $revisions_to_keep <= $args['args']['revisions_count'] ) {
echo '
--- 190,196 ----
!
***************
*** 278,284 ****
$stamp = __('Uploaded on:
%1$s ');
$date = date_i18n( $datef, strtotime( $post->post_date ) );
?>
!
--- 278,284 ----
$stamp = __('Uploaded on:
%1$s ');
$date = date_i18n( $datef, strtotime( $post->post_date ) );
?>
!
***************
*** 506,512 ****
unset( $metadata[ $key ] );
}
list_meta( $metadata );
! meta_form(); ?>
use in your theme.'); ?>
use in your theme.'); ?>
--- 702,708 ----
***************
*** 962,972 ****
!
!
--- 962,972 ----
!
!
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/misc.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/misc.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/misc.php 2013-07-22 00:09:49.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/misc.php 2013-10-15 14:51:10.000000000 -0500
***************
*** 7,24 ****
*/
/**
! * {@internal Missing Short Description}}
*
* @since 2.0.0
*
! * @return unknown
*/
function got_mod_rewrite() {
$got_rewrite = apache_mod_loaded('mod_rewrite', true);
return apply_filters('got_rewrite', $got_rewrite);
}
/**
* {@internal Missing Short Description}}
*
* @since 1.5.0
--- 7,57 ----
*/
/**
! * Returns whether the server is running Apache with the mod_rewrite module loaded.
*
* @since 2.0.0
*
! * @return bool
*/
function got_mod_rewrite() {
$got_rewrite = apache_mod_loaded('mod_rewrite', true);
+
+ /**
+ * Filter whether Apache and mod_rewrite are present.
+ *
+ * This filter was previously used to force URL rewriting for other servers,
+ * like nginx. Use the got_url_rewrite filter in got_url_rewrite() instead.
+ *
+ * @see got_url_rewrite()
+ *
+ * @since 2.5.0
+ * @param bool $got_rewrite Whether Apache and mod_rewrite are present.
+ */
return apply_filters('got_rewrite', $got_rewrite);
}
/**
+ * Returns whether the server supports URL rewriting.
+ *
+ * Detects Apache's mod_rewrite, IIS 7.0+ permalink support, and nginx.
+ *
+ * @since 3.7.0
+ *
+ * @return bool Whether the server supports URL rewriting.
+ */
+ function got_url_rewrite() {
+ $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() );
+
+ /**
+ * Filter whether URL rewriting is available.
+ *
+ * @since 3.7.0
+ * @param bool $got_url_rewrite Whether URL rewriting is available.
+ */
+ return apply_filters( 'got_url_rewrite', $got_url_rewrite );
+ }
+
+ /**
* {@internal Missing Short Description}}
*
* @since 1.5.0
***************
*** 263,269 ****
*/
function show_message($message) {
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();
--- 296,302 ----
*/
function show_message($message) {
if ( is_wp_error($message) ){
! if ( $message->get_error_data() && is_string( $message->get_error_data() ) )
$message = $message->get_error_message() . ': ' . $message->get_error_data();
else
$message = $message->get_error_message();
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/ms.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/ms.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/ms.php 2013-07-29 13:18:58.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/ms.php 2013-10-23 09:40:10.000000000 -0500
***************
*** 61,67 ****
}
$blog = get_blog_details( $blog_id );
!
do_action( 'delete_blog', $blog_id, $drop );
$users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
--- 61,74 ----
}
$blog = get_blog_details( $blog_id );
! /**
! * Fires before a blog is deleted.
! *
! * @since MU
! *
! * @param int $blog_id The blog ID.
! * @param bool $drop True if blog's table should be dropped. Default is false.
! */
do_action( 'delete_blog', $blog_id, $drop );
$users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
***************
*** 80,86 ****
$drop = false;
if ( $drop ) {
! $drop_tables = apply_filters( 'wpmu_drop_tables', $wpdb->tables( 'blog' ), $blog_id );
foreach ( (array) $drop_tables as $table ) {
$wpdb->query( "DROP TABLE IF EXISTS `$table`" );
--- 87,102 ----
$drop = false;
if ( $drop ) {
! $tables = $wpdb->tables( 'blog' );
! /**
! * Filter the tables to drop when the blog is deleted.
! *
! * @since MU
! *
! * @param array $tables The blog tables to be dropped.
! * @param int $blog_id The ID of the blog to drop tables for.
! */
! $drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $blog_id );
foreach ( (array) $drop_tables as $table ) {
$wpdb->query( "DROP TABLE IF EXISTS `$table`" );
***************
*** 89,94 ****
--- 105,118 ----
$wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) );
$uploads = wp_upload_dir();
+ /**
+ * Filter the upload base directory to delete when the blog is deleted.
+ *
+ * @since MU
+ *
+ * @param string $uploads['basedir'] Uploads path without subdirectory. @see wp_upload_dir()
+ * @param int $blog_id The blog ID.
+ */
$dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id );
$dir = rtrim( $dir, DIRECTORY_SEPARATOR );
$top_dir = $dir;
***************
*** 137,143 ****
if ( !$user->exists() )
return false;
!
do_action( 'wpmu_delete_user', $id );
$blogs = get_blogs_of_user( $id );
--- 161,173 ----
if ( !$user->exists() )
return false;
! /**
! * Fires before a user is deleted from the network.
! *
! * @since MU
! *
! * @param int $id ID of the user about to be deleted from the network.
! */
do_action( 'wpmu_delete_user', $id );
$blogs = get_blogs_of_user( $id );
***************
*** 172,178 ****
clean_user_cache( $user );
! // allow for commit transaction
do_action( 'deleted_user', $id );
return true;
--- 202,214 ----
clean_user_cache( $user );
! /**
! * Fires after the user is deleted from the network.
! *
! * @since 2.8.0
! *
! * @param int $id ID of the user that was deleted from the network.
! */
do_action( 'deleted_user', $id );
return true;
***************
*** 190,196 ****
);
update_option( 'adminhash', $new_admin_email );
! $content = apply_filters( 'new_admin_email_content', __( "Dear user,
You recently requested to have the administration email address on
your site changed.
--- 226,232 ----
);
update_option( 'adminhash', $new_admin_email );
! $email_text = __( 'Dear user,
You recently requested to have the administration email address on
your site changed.
***************
*** 204,210 ****
Regards,
All at ###SITENAME###
! ###SITEURL### "), $new_admin_email );
$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content );
$content = str_replace( '###EMAIL###', $value, $content );
--- 240,262 ----
Regards,
All at ###SITENAME###
! ###SITEURL###' );
!
! /**
! * Filter the email text sent when the site admin email is changed.
! *
! * The following strings have a special meaning and will get replaced dynamically:
! * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break.
! * ###EMAIL### The new email.
! * ###SITENAME### The name of the site.
! * ###SITEURL### The URL to the site.
! *
! * @since MU
! *
! * @param string $email_text Text in the email.
! * @param string $new_admin_email New admin email that the current administration email was changed to.
! */
! $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content );
$content = str_replace( '###EMAIL###', $value, $content );
***************
*** 244,250 ****
);
update_option( $current_user->ID . '_new_email', $new_user_email );
! $content = apply_filters( 'new_user_email_content', __( "Dear user,
You recently requested to have the email address on your account changed.
If this is correct, please click on the following link to change it:
--- 296,302 ----
);
update_option( $current_user->ID . '_new_email', $new_user_email );
! $email_text = __( 'Dear user,
You recently requested to have the email address on your account changed.
If this is correct, please click on the following link to change it:
***************
*** 257,263 ****
Regards,
All at ###SITENAME###
! ###SITEURL###" ), $new_user_email );
$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content );
$content = str_replace( '###EMAIL###', $_POST['email'], $content);
--- 309,331 ----
Regards,
All at ###SITENAME###
! ###SITEURL###' );
!
! /**
! * Filter the email text sent when a user changes emails.
! *
! * The following strings have a special meaning and will get replaced dynamically:
! * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break.
! * ###EMAIL### The new email.
! * ###SITENAME### The name of the site.
! * ###SITEURL### The URL to the site.
! *
! * @since MU
! *
! * @param string $email_text Text in the email.
! * @param string $new_user_email New user email that the current user has changed to.
! */
! $content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );
$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content );
$content = str_replace( '###EMAIL###', $_POST['email'], $content);
***************
*** 377,386 ****
clean_user_cache( $user );
if ( $pref == 'spam' ) {
! if ( $value == 1 )
do_action( 'make_spam_user', $id );
! else
do_action( 'make_ham_user', $id );
}
return $value;
--- 445,469 ----
clean_user_cache( $user );
if ( $pref == 'spam' ) {
! if ( $value == 1 ) {
! /**
! * Fires after the user is marked as a SPAM user.
! *
! * @since 3.0.0
! *
! * @param int $id ID of the user marked as SPAM.
! */
do_action( 'make_spam_user', $id );
! } else {
! /**
! * Fires after the user is marked as a HAM user. Opposite of SPAM.
! *
! * @since 3.0.0
! *
! * @param int $id ID of the user marked as HAM.
! */
do_action( 'make_ham_user', $id );
+ }
}
return $value;
***************
*** 411,416 ****
--- 494,508 ----
'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili',
'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',
've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
+
+ /**
+ * Filter the language codes.
+ *
+ * @since MU
+ *
+ * @param array $lang_codes Key/value pair of language codes where key is the short version.
+ * @param string $code A two-letter designation of the language.
+ */
$lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
return strtr( $code, $lang_codes );
}
***************
*** 498,528 ****
// Order by name
uksort( $output, 'strnatcasecmp' );
!
$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
echo implode( "\n\t", $output );
}
- /* Warn the admin if SECRET SALT information is missing from wp-config.php */
- function secret_salt_warning() {
- if ( !is_super_admin() )
- return;
- $secret_keys = array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' );
- $out = '';
- foreach( $secret_keys as $key ) {
- if ( ! defined( $key ) )
- $out .= "define( '$key', '" . esc_html( wp_generate_password( 64, true, true ) ) . "' ); ";
- }
- if ( $out != '' ) {
- $msg = __( 'Warning! WordPress encrypts user cookies, but you must add the following lines to wp-config.php for it to be more secure.' );
- $msg .= ' ' . __( "Before the line /* That's all, stop editing! Happy blogging. */
please add this code:" );
- $msg .= "$out
";
-
- echo "$msg
";
- }
- }
- add_action( 'network_admin_notices', 'secret_salt_warning' );
-
function site_admin_notice() {
global $wp_db_version;
if ( !is_super_admin() )
--- 590,608 ----
// Order by name
uksort( $output, 'strnatcasecmp' );
! /**
! * Filter the languages available in the dropdown.
! *
! * @since MU
! *
! * @param array $output HTML output of the dropdown.
! * @param array $lang_files Available language files.
! * @param string $current The current language code.
! */
$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
echo implode( "\n\t", $output );
}
function site_admin_notice() {
global $wp_db_version;
if ( !is_super_admin() )
***************
*** 595,601 ****
!
--- 675,685 ----
!
!
***************
*** 604,621 ****
}
/**
! * Grants super admin privileges.
*
* @since 3.0.0
! * @param int $user_id
*/
function grant_super_admin( $user_id ) {
global $super_admins;
// If global super_admins override is defined, there is nothing to do here.
! if ( isset($super_admins) )
return false;
do_action( 'grant_super_admin', $user_id );
// Directly fetch site_admins instead of using get_super_admins()
--- 688,712 ----
}
/**
! * Grants Super Admin privileges.
*
* @since 3.0.0
! * @param int $user_id ID of the user to be granted Super Admin privileges.
*/
function grant_super_admin( $user_id ) {
global $super_admins;
// If global super_admins override is defined, there is nothing to do here.
! if ( isset( $super_admins ) )
return false;
+ /**
+ * Fires before the user is granted Super Admin privileges.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id ID of the user that is about to be granted Super Admin privileges.
+ */
do_action( 'grant_super_admin', $user_id );
// Directly fetch site_admins instead of using get_super_admins()
***************
*** 625,630 ****
--- 716,729 ----
if ( $user && ! in_array( $user->user_login, $super_admins ) ) {
$super_admins[] = $user->user_login;
update_site_option( 'site_admins' , $super_admins );
+
+ /**
+ * Fires after the user is granted Super Admin privileges.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id ID of the user that was granted Super Admin privileges.
+ */
do_action( 'granted_super_admin', $user_id );
return true;
}
***************
*** 632,649 ****
}
/**
! * Revokes super admin privileges.
*
* @since 3.0.0
! * @param int $user_id
*/
function revoke_super_admin( $user_id ) {
global $super_admins;
// If global super_admins override is defined, there is nothing to do here.
! if ( isset($super_admins) )
return false;
do_action( 'revoke_super_admin', $user_id );
// Directly fetch site_admins instead of using get_super_admins()
--- 731,755 ----
}
/**
! * Revokes Super Admin privileges.
*
* @since 3.0.0
! * @param int $user_id ID of the user Super Admin privileges to be revoked from.
*/
function revoke_super_admin( $user_id ) {
global $super_admins;
// If global super_admins override is defined, there is nothing to do here.
! if ( isset( $super_admins ) )
return false;
+ /**
+ * Fires before the user's Super Admin privileges are revoked.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id ID of the user Super Admin privileges are being revoked from.
+ */
do_action( 'revoke_super_admin', $user_id );
// Directly fetch site_admins instead of using get_super_admins()
***************
*** 654,659 ****
--- 760,773 ----
if ( false !== ( $key = array_search( $user->user_login, $super_admins ) ) ) {
unset( $super_admins[$key] );
update_site_option( 'site_admins', $super_admins );
+
+ /**
+ * Fires after the user's Super Admin privileges are revoked.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id ID of the user Super Admin privileges were revoked from.
+ */
do_action( 'revoked_super_admin', $user_id );
return true;
}
***************
*** 667,682 ****
* By default editing of network is restricted to the Network Admin for that site_id this allows for this to be overridden
*
* @since 3.1.0
! * @param integer $site_id The network/site id to check.
*/
function can_edit_network( $site_id ) {
global $wpdb;
! if ($site_id == $wpdb->siteid )
$result = true;
else
$result = false;
return apply_filters( 'can_edit_network', $result, $site_id );
}
--- 781,804 ----
* By default editing of network is restricted to the Network Admin for that site_id this allows for this to be overridden
*
* @since 3.1.0
! * @param integer $site_id The network/site ID to check.
*/
function can_edit_network( $site_id ) {
global $wpdb;
! if ( $site_id == $wpdb->siteid )
$result = true;
else
$result = false;
+ /**
+ * Filter whether this network can be edited from this page.
+ *
+ * @since 3.1.0
+ *
+ * @param bool $result Whether the network can be edited from this page.
+ * @param int $site_id The network/site ID to check.
+ */
return apply_filters( 'can_edit_network', $result, $site_id );
}
diff -crBPN --exclude=htaccess-dist --exclude=wp-config.php --exclude=wordpress.sql --exclude=wp-cache-config.php --exclude=wp-config.php --exclude=wordpress.sql --exclude=.htaccess-dist --exclude=wp-cache-config.php --exclude=1.html --exclude=2.html --exclude=editor_plugin.js --exclude=jetpack --exclude=.files.list --exclude=wordpress-3.7.pl /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/nav-menu.php /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/nav-menu.php
*** /home/packages/code/qi/SOURCES/wordpress-3.6.1/wp-admin/includes/nav-menu.php 2013-07-27 01:50:59.000000000 -0500
--- /home/packages/code/qi/SOURCES/wordpress-3.7/wp-admin/includes/nav-menu.php 2013-10-22 12:22:11.000000000 -0500
***************
*** 9,44 ****
*/
class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
/**
* @see Walker_Nav_Menu::start_lvl()
* @since 3.0.0
*
* @param string $output Passed by reference.
*/
function start_lvl( &$output, $depth = 0, $args = array() ) {}
/**
* @see Walker_Nav_Menu::end_lvl()
* @since 3.0.0
*
* @param string $output Passed by reference.
*/
function end_lvl( &$output, $depth = 0, $args = array() ) {}
/**
! * @see Walker::start_el()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
! * @param object $item Menu item data object.
! * @param int $depth Depth of menu item. Used for padding.
! * @param object $args
*/
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
global $_wp_nav_menu_max_depth;
$_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
- $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
-
ob_start();
$item_id = esc_attr( $item->ID );
$removed_args = array(
--- 9,55 ----
*/
class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
/**
+ * Starts the list before the elements are added.
+ *
* @see Walker_Nav_Menu::start_lvl()
+ *
* @since 3.0.0
*
* @param string $output Passed by reference.
+ * @param int $depth Depth of menu item. Used for padding.
+ * @param array $args Not used.
*/
function start_lvl( &$output, $depth = 0, $args = array() ) {}
/**
+ * Ends the list of after the elements are added.
+ *
* @see Walker_Nav_Menu::end_lvl()
+ *
* @since 3.0.0
*
* @param string $output Passed by reference.
+ * @param int $depth Depth of menu item. Used for padding.
+ * @param array $args Not used.
*/
function end_lvl( &$output, $depth = 0, $args = array() ) {}
/**
! * Start the element output.
! *
! * @see Walker_Nav_Menu::start_el()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
! * @param object $item Menu item data object.
! * @param int $depth Depth of menu item. Used for padding.
! * @param array $args Not used.
! * @param int $id Not used.
*/
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
global $_wp_nav_menu_max_depth;
$_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
ob_start();
$item_id = esc_attr( $item->ID );
$removed_args = array(
***************
*** 57,63 ****
$original_title = false;
} elseif ( 'post_type' == $item->type ) {
$original_object = get_post( $item->object_id );
! $original_title = $original_object->post_title;
}
$classes = array(
--- 68,74 ----
$original_title = false;
} elseif ( 'post_type' == $item->type ) {
$original_object = get_post( $item->object_id );
! $original_title = get_the_title( $original_object->ID );
}
$classes = array(
***************
*** 214,220 ****
\n";
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent";
}
/**
! * @see Walker::start_el()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
! * @param object $item Menu item data object.
! * @param int $depth Depth of menu item. Used for padding.
! * @param object $args
*/
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
global $_nav_menu_placeholder;
--- 242,291 ----
}
}
+ /**
+ * Starts the list before the elements are added.
+ *
+ * @see Walker_Nav_Menu::start_lvl()
+ *
+ * @since 3.0.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param int $depth Depth of page. Used for padding.
+ * @param array $args Not used.
+ */
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent\n";
}
+ /**
+ * Ends the list of after the elements are added.
+ *
+ * @see Walker_Nav_Menu::end_lvl()
+ *
+ * @since 3.0.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param int $depth Depth of page. Used for padding.
+ * @param array $args Not used.
+ */
function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent ";
}
/**
! * Start the element output.
! *
! * @see Walker_Nav_Menu::start_el()
! *
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
! * @param object $item Menu item data object.
! * @param int $depth Depth of menu item. Used for padding.
! * @param array $args Not used.
! * @param int $id Not used.
*/
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
global $_nav_menu_placeholder;
***************
*** 261,275 ****
$output .= $indent . '';
$output .= '';
// Menu item hidden fields
$output .= '';
--- 299,321 ----
$output .= $indent . ' ';
$output .= '';
// Menu item hidden fields
$output .= '';
***************
*** 283,289 ****
$output .= '';
$output .= '';
}
! }
/**
* Prints the appropriate response to a menu quick search.
--- 329,336 ----
$output .= '';
$output .= '';
}
!
! } // Walker_Nav_Menu_Checklist
/**
* Prints the appropriate response to a menu quick search.
***************
*** 487,537 ****
}
/**
- * Displays a metabox for the nav menu theme locations.
- *
- * @since 3.0.0
- */
- function wp_nav_menu_locations_meta_box() {
- global $nav_menu_selected_id;
-
- if ( ! current_theme_supports( 'menus' ) ) {
- // We must only support widgets. Leave a message and bail.
- echo '' . __('The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.') . '
';
- return;
- }
-
- $locations = get_registered_nav_menus();
- $menus = wp_get_nav_menus();
- $menu_locations = get_nav_menu_locations();
- $num_locations = count( array_keys($locations) );
-
- echo '' . _n( 'Select a menu to use within your theme.', 'Select the menus you will use in your theme.', $num_locations ) . '
';
-
- foreach ( $locations as $location => $description ) {
- ?>
-
-
-
-
-
-
- term_id ); ?>
- value="term_id; ?>">name, 40, '…' ); ?>
-
-
-
-
-
-
-
-
-
- per_page) )
$args->per_page = 24;
! // Allows a plugin to override the WordPress.org API entirely.
! // Use the filter 'plugins_api_result' to merely add results.
! // Please ensure that a object is returned from the following filters.
! $args = apply_filters('plugins_api_args', $args, $action);
! $res = apply_filters('plugins_api', false, $action, $args);
if ( false === $res ) {
! $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) );
if ( is_wp_error($request) ) {
$res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums .' ), $request->get_error_message() );
} else {
--- 34,77 ----
if ( !isset($args->per_page) )
$args->per_page = 24;
! /**
! * Override the Plugin Install API arguments.
! *
! * Please ensure that an object is returned.
! *
! * @since 2.7.0
! *
! * @param object $args Plugin API arguments.
! * @param string $action The type of information being requested from the Plugin Install API.
! */
! $args = apply_filters( 'plugins_api_args', $args, $action );
!
! /**
! * Allows a plugin to override the WordPress.org Plugin Install API entirely.
! *
! * Please ensure that an object is returned.
! *
! * @since 2.7.0
! *
! * @param bool|object The result object. Default is false.
! * @param string $action The type of information being requested from the Plugin Install API.
! * @param object $args Plugin API arguments.
! */
! $res = apply_filters( 'plugins_api', false, $action, $args );
if ( false === $res ) {
! $url = 'http://api.wordpress.org/plugins/info/1.0/';
! if ( wp_http_supports( array( 'ssl' ) ) )
! $url = set_url_scheme( $url, 'https' );
!
! $request = wp_remote_post( $url, array(
! 'timeout' => 15,
! 'body' => array(
! 'action' => $action,
! 'request' => serialize( $args )
! )
! ) );
!
if ( is_wp_error($request) ) {
$res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums .' ), $request->get_error_message() );
} else {
***************
*** 53,59 ****
$res->external = true;
}
! return apply_filters('plugins_api_result', $res, $action, $args);
}
/**
--- 83,98 ----
$res->external = true;
}
! /**
! * Filter the Plugin Install API response results.
! *
! * @since 2.7.0
! *
! * @param object|WP_Error $res Response object or WP_Error.
! * @param string $action The type of information being requested from the Plugin Install API.
! * @param object $args Plugin API arguments.
! */
! return apply_filters( 'plugins_api_result', $res, $action, $args );
}
/**
***************
*** 265,271 ****
function install_plugin_information() {
global $tab;
! $api = plugins_api('plugin_information', array('slug' => wp_unslash( $_REQUEST['plugin'] ) ));
if ( is_wp_error($api) )
wp_die($api);
--- 304,310 ----
function install_plugin_information() {
global $tab;
! $api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $_REQUEST['plugin'] ), 'is_ssl' => is_ssl() ) );
if ( is_wp_error($api) )
wp_die($api);
***************
*** 296,304 ****
$api->$key = wp_kses( $api->$key, $plugins_allowedtags );
}
! $section = isset($_REQUEST['section']) ? wp_unslash( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
! if ( empty($section) || ! isset($api->sections[ $section ]) )
! $section = array_shift( $section_titles = array_keys((array)$api->sections) );
iframe_header( __('Plugin Install') );
echo "
+
+
'createusersub' ) ); ?>