Edit File by line
/home/zeestwma/richards.../wp-inclu...
File: update.php
* @type string $package Optional. The update ZIP for the plugin.
[500] Fix | Delete
* @type string $tested Optional. The version of WordPress the plugin is tested against.
[501] Fix | Delete
* @type string $requires_php Optional. The version of PHP which the plugin requires.
[502] Fix | Delete
* @type bool $autoupdate Optional. Whether the plugin should automatically update.
[503] Fix | Delete
* @type string[] $icons Optional. Array of plugin icons.
[504] Fix | Delete
* @type string[] $banners Optional. Array of plugin banners.
[505] Fix | Delete
* @type string[] $banners_rtl Optional. Array of plugin RTL banners.
[506] Fix | Delete
* @type array $translations {
[507] Fix | Delete
* Optional. List of translation updates for the plugin.
[508] Fix | Delete
*
[509] Fix | Delete
* @type string $language The language the translation update is for.
[510] Fix | Delete
* @type string $version The version of the plugin this translation is for.
[511] Fix | Delete
* This is not the version of the language file.
[512] Fix | Delete
* @type string $updated The update timestamp of the translation file.
[513] Fix | Delete
* Should be a date in the `YYYY-MM-DD HH:MM:SS` format.
[514] Fix | Delete
* @type string $package The ZIP location containing the translation update.
[515] Fix | Delete
* @type string $autoupdate Whether the translation should be automatically installed.
[516] Fix | Delete
* }
[517] Fix | Delete
* }
[518] Fix | Delete
* @param array $plugin_data Plugin headers.
[519] Fix | Delete
* @param string $plugin_file Plugin filename.
[520] Fix | Delete
* @param string[] $locales Installed locales to look up translations for.
[521] Fix | Delete
*/
[522] Fix | Delete
$update = apply_filters( "update_plugins_{$hostname}", false, $plugin_data, $plugin_file, $locales );
[523] Fix | Delete
[524] Fix | Delete
if ( ! $update ) {
[525] Fix | Delete
continue;
[526] Fix | Delete
}
[527] Fix | Delete
[528] Fix | Delete
$update = (object) $update;
[529] Fix | Delete
[530] Fix | Delete
// Is it valid? We require at least a version.
[531] Fix | Delete
if ( ! isset( $update->version ) ) {
[532] Fix | Delete
continue;
[533] Fix | Delete
}
[534] Fix | Delete
[535] Fix | Delete
// These should remain constant.
[536] Fix | Delete
$update->id = $plugin_data['UpdateURI'];
[537] Fix | Delete
$update->plugin = $plugin_file;
[538] Fix | Delete
[539] Fix | Delete
// WordPress needs the version field specified as 'new_version'.
[540] Fix | Delete
if ( ! isset( $update->new_version ) ) {
[541] Fix | Delete
$update->new_version = $update->version;
[542] Fix | Delete
}
[543] Fix | Delete
[544] Fix | Delete
// Handle any translation updates.
[545] Fix | Delete
if ( ! empty( $update->translations ) ) {
[546] Fix | Delete
foreach ( $update->translations as $translation ) {
[547] Fix | Delete
if ( isset( $translation['language'], $translation['package'] ) ) {
[548] Fix | Delete
$translation['type'] = 'plugin';
[549] Fix | Delete
$translation['slug'] = isset( $update->slug ) ? $update->slug : $update->id;
[550] Fix | Delete
[551] Fix | Delete
$updates->translations[] = $translation;
[552] Fix | Delete
}
[553] Fix | Delete
}
[554] Fix | Delete
}
[555] Fix | Delete
[556] Fix | Delete
unset( $updates->no_update[ $plugin_file ], $updates->response[ $plugin_file ] );
[557] Fix | Delete
[558] Fix | Delete
if ( version_compare( $update->new_version, $plugin_data['Version'], '>' ) ) {
[559] Fix | Delete
$updates->response[ $plugin_file ] = $update;
[560] Fix | Delete
} else {
[561] Fix | Delete
$updates->no_update[ $plugin_file ] = $update;
[562] Fix | Delete
}
[563] Fix | Delete
}
[564] Fix | Delete
[565] Fix | Delete
$sanitize_plugin_update_payload = static function ( &$item ) {
[566] Fix | Delete
$item = (object) $item;
[567] Fix | Delete
[568] Fix | Delete
unset( $item->translations, $item->compatibility );
[569] Fix | Delete
[570] Fix | Delete
return $item;
[571] Fix | Delete
};
[572] Fix | Delete
[573] Fix | Delete
array_walk( $updates->response, $sanitize_plugin_update_payload );
[574] Fix | Delete
array_walk( $updates->no_update, $sanitize_plugin_update_payload );
[575] Fix | Delete
[576] Fix | Delete
set_site_transient( 'update_plugins', $updates );
[577] Fix | Delete
}
[578] Fix | Delete
[579] Fix | Delete
/**
[580] Fix | Delete
* Checks for available updates to themes based on the latest versions hosted on WordPress.org.
[581] Fix | Delete
*
[582] Fix | Delete
* Despite its name this function does not actually perform any updates, it only checks for available updates.
[583] Fix | Delete
*
[584] Fix | Delete
* A list of all themes installed is sent to api.wordpress.org, along with the site locale.
[585] Fix | Delete
*
[586] Fix | Delete
* Checks against the WordPress server at api.wordpress.org. Will only check
[587] Fix | Delete
* if WordPress isn't installing.
[588] Fix | Delete
*
[589] Fix | Delete
* @since 2.7.0
[590] Fix | Delete
*
[591] Fix | Delete
* @global string $wp_version The WordPress version string.
[592] Fix | Delete
*
[593] Fix | Delete
* @param array $extra_stats Extra statistics to report to the WordPress.org API.
[594] Fix | Delete
*/
[595] Fix | Delete
function wp_update_themes( $extra_stats = array() ) {
[596] Fix | Delete
if ( wp_installing() ) {
[597] Fix | Delete
return;
[598] Fix | Delete
}
[599] Fix | Delete
[600] Fix | Delete
$installed_themes = wp_get_themes();
[601] Fix | Delete
$translations = wp_get_installed_translations( 'themes' );
[602] Fix | Delete
[603] Fix | Delete
$last_update = get_site_transient( 'update_themes' );
[604] Fix | Delete
[605] Fix | Delete
if ( ! is_object( $last_update ) ) {
[606] Fix | Delete
$last_update = new stdClass();
[607] Fix | Delete
}
[608] Fix | Delete
[609] Fix | Delete
$themes = array();
[610] Fix | Delete
$checked = array();
[611] Fix | Delete
$request = array();
[612] Fix | Delete
[613] Fix | Delete
// Put slug of active theme into request.
[614] Fix | Delete
$request['active'] = get_option( 'stylesheet' );
[615] Fix | Delete
[616] Fix | Delete
foreach ( $installed_themes as $theme ) {
[617] Fix | Delete
$checked[ $theme->get_stylesheet() ] = $theme->get( 'Version' );
[618] Fix | Delete
[619] Fix | Delete
$themes[ $theme->get_stylesheet() ] = array(
[620] Fix | Delete
'Name' => $theme->get( 'Name' ),
[621] Fix | Delete
'Title' => $theme->get( 'Name' ),
[622] Fix | Delete
'Version' => $theme->get( 'Version' ),
[623] Fix | Delete
'Author' => $theme->get( 'Author' ),
[624] Fix | Delete
'Author URI' => $theme->get( 'AuthorURI' ),
[625] Fix | Delete
'UpdateURI' => $theme->get( 'UpdateURI' ),
[626] Fix | Delete
'Template' => $theme->get_template(),
[627] Fix | Delete
'Stylesheet' => $theme->get_stylesheet(),
[628] Fix | Delete
);
[629] Fix | Delete
}
[630] Fix | Delete
[631] Fix | Delete
$doing_cron = wp_doing_cron();
[632] Fix | Delete
[633] Fix | Delete
// Check for update on a different schedule, depending on the page.
[634] Fix | Delete
switch ( current_filter() ) {
[635] Fix | Delete
case 'upgrader_process_complete':
[636] Fix | Delete
$timeout = 0;
[637] Fix | Delete
break;
[638] Fix | Delete
case 'load-update-core.php':
[639] Fix | Delete
$timeout = MINUTE_IN_SECONDS;
[640] Fix | Delete
break;
[641] Fix | Delete
case 'load-themes.php':
[642] Fix | Delete
case 'load-update.php':
[643] Fix | Delete
$timeout = HOUR_IN_SECONDS;
[644] Fix | Delete
break;
[645] Fix | Delete
default:
[646] Fix | Delete
if ( $doing_cron ) {
[647] Fix | Delete
$timeout = 2 * HOUR_IN_SECONDS;
[648] Fix | Delete
} else {
[649] Fix | Delete
$timeout = 12 * HOUR_IN_SECONDS;
[650] Fix | Delete
}
[651] Fix | Delete
}
[652] Fix | Delete
[653] Fix | Delete
$time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked );
[654] Fix | Delete
[655] Fix | Delete
if ( $time_not_changed && ! $extra_stats ) {
[656] Fix | Delete
$theme_changed = false;
[657] Fix | Delete
[658] Fix | Delete
foreach ( $checked as $slug => $v ) {
[659] Fix | Delete
if ( ! isset( $last_update->checked[ $slug ] ) || (string) $last_update->checked[ $slug ] !== (string) $v ) {
[660] Fix | Delete
$theme_changed = true;
[661] Fix | Delete
}
[662] Fix | Delete
}
[663] Fix | Delete
[664] Fix | Delete
if ( isset( $last_update->response ) && is_array( $last_update->response ) ) {
[665] Fix | Delete
foreach ( $last_update->response as $slug => $update_details ) {
[666] Fix | Delete
if ( ! isset( $checked[ $slug ] ) ) {
[667] Fix | Delete
$theme_changed = true;
[668] Fix | Delete
break;
[669] Fix | Delete
}
[670] Fix | Delete
}
[671] Fix | Delete
}
[672] Fix | Delete
[673] Fix | Delete
// Bail if we've checked recently and if nothing has changed.
[674] Fix | Delete
if ( ! $theme_changed ) {
[675] Fix | Delete
return;
[676] Fix | Delete
}
[677] Fix | Delete
}
[678] Fix | Delete
[679] Fix | Delete
// Update last_checked for current to prevent multiple blocking requests if request hangs.
[680] Fix | Delete
$last_update->last_checked = time();
[681] Fix | Delete
set_site_transient( 'update_themes', $last_update );
[682] Fix | Delete
[683] Fix | Delete
$request['themes'] = $themes;
[684] Fix | Delete
[685] Fix | Delete
$locales = array_values( get_available_languages() );
[686] Fix | Delete
[687] Fix | Delete
/**
[688] Fix | Delete
* Filters the locales requested for theme translations.
[689] Fix | Delete
*
[690] Fix | Delete
* @since 3.7.0
[691] Fix | Delete
* @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
[692] Fix | Delete
*
[693] Fix | Delete
* @param string[] $locales Theme locales. Default is all available locales of the site.
[694] Fix | Delete
*/
[695] Fix | Delete
$locales = apply_filters( 'themes_update_check_locales', $locales );
[696] Fix | Delete
$locales = array_unique( $locales );
[697] Fix | Delete
[698] Fix | Delete
if ( $doing_cron ) {
[699] Fix | Delete
$timeout = 30; // 30 seconds.
[700] Fix | Delete
} else {
[701] Fix | Delete
// Three seconds, plus one extra second for every 10 themes.
[702] Fix | Delete
$timeout = 3 + (int) ( count( $themes ) / 10 );
[703] Fix | Delete
}
[704] Fix | Delete
[705] Fix | Delete
$options = array(
[706] Fix | Delete
'timeout' => $timeout,
[707] Fix | Delete
'body' => array(
[708] Fix | Delete
'themes' => wp_json_encode( $request ),
[709] Fix | Delete
'translations' => wp_json_encode( $translations ),
[710] Fix | Delete
'locale' => wp_json_encode( $locales ),
[711] Fix | Delete
),
[712] Fix | Delete
'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ),
[713] Fix | Delete
);
[714] Fix | Delete
[715] Fix | Delete
if ( $extra_stats ) {
[716] Fix | Delete
$options['body']['update_stats'] = wp_json_encode( $extra_stats );
[717] Fix | Delete
}
[718] Fix | Delete
[719] Fix | Delete
$url = 'http://api.wordpress.org/themes/update-check/1.1/';
[720] Fix | Delete
$http_url = $url;
[721] Fix | Delete
$ssl = wp_http_supports( array( 'ssl' ) );
[722] Fix | Delete
[723] Fix | Delete
if ( $ssl ) {
[724] Fix | Delete
$url = set_url_scheme( $url, 'https' );
[725] Fix | Delete
}
[726] Fix | Delete
[727] Fix | Delete
$raw_response = wp_remote_post( $url, $options );
[728] Fix | Delete
[729] Fix | Delete
if ( $ssl && is_wp_error( $raw_response ) ) {
[730] Fix | Delete
wp_trigger_error(
[731] Fix | Delete
__FUNCTION__,
[732] Fix | Delete
sprintf(
[733] Fix | Delete
/* translators: %s: Support forums URL. */
[734] Fix | Delete
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
[735] Fix | Delete
__( 'https://wordpress.org/support/forums/' )
[736] Fix | Delete
) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
[737] Fix | Delete
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
[738] Fix | Delete
);
[739] Fix | Delete
$raw_response = wp_remote_post( $http_url, $options );
[740] Fix | Delete
}
[741] Fix | Delete
[742] Fix | Delete
if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) {
[743] Fix | Delete
return;
[744] Fix | Delete
}
[745] Fix | Delete
[746] Fix | Delete
$new_update = new stdClass();
[747] Fix | Delete
$new_update->last_checked = time();
[748] Fix | Delete
$new_update->checked = $checked;
[749] Fix | Delete
[750] Fix | Delete
$response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
[751] Fix | Delete
[752] Fix | Delete
if ( is_array( $response ) ) {
[753] Fix | Delete
$new_update->response = $response['themes'];
[754] Fix | Delete
$new_update->no_update = $response['no_update'];
[755] Fix | Delete
$new_update->translations = $response['translations'];
[756] Fix | Delete
}
[757] Fix | Delete
[758] Fix | Delete
// Support updates for any themes using the `Update URI` header field.
[759] Fix | Delete
foreach ( $themes as $theme_stylesheet => $theme_data ) {
[760] Fix | Delete
if ( ! $theme_data['UpdateURI'] || isset( $new_update->response[ $theme_stylesheet ] ) ) {
[761] Fix | Delete
continue;
[762] Fix | Delete
}
[763] Fix | Delete
[764] Fix | Delete
$hostname = wp_parse_url( sanitize_url( $theme_data['UpdateURI'] ), PHP_URL_HOST );
[765] Fix | Delete
[766] Fix | Delete
/**
[767] Fix | Delete
* Filters the update response for a given theme hostname.
[768] Fix | Delete
*
[769] Fix | Delete
* The dynamic portion of the hook name, `$hostname`, refers to the hostname
[770] Fix | Delete
* of the URI specified in the `Update URI` header field.
[771] Fix | Delete
*
[772] Fix | Delete
* @since 6.1.0
[773] Fix | Delete
*
[774] Fix | Delete
* @param array|false $update {
[775] Fix | Delete
* The theme update data with the latest details. Default false.
[776] Fix | Delete
*
[777] Fix | Delete
* @type string $id Optional. ID of the theme for update purposes, should be a URI
[778] Fix | Delete
* specified in the `Update URI` header field.
[779] Fix | Delete
* @type string $theme Directory name of the theme.
[780] Fix | Delete
* @type string $version The version of the theme.
[781] Fix | Delete
* @type string $url The URL for details of the theme.
[782] Fix | Delete
* @type string $package Optional. The update ZIP for the theme.
[783] Fix | Delete
* @type string $tested Optional. The version of WordPress the theme is tested against.
[784] Fix | Delete
* @type string $requires_php Optional. The version of PHP which the theme requires.
[785] Fix | Delete
* @type bool $autoupdate Optional. Whether the theme should automatically update.
[786] Fix | Delete
* @type array $translations {
[787] Fix | Delete
* Optional. List of translation updates for the theme.
[788] Fix | Delete
*
[789] Fix | Delete
* @type string $language The language the translation update is for.
[790] Fix | Delete
* @type string $version The version of the theme this translation is for.
[791] Fix | Delete
* This is not the version of the language file.
[792] Fix | Delete
* @type string $updated The update timestamp of the translation file.
[793] Fix | Delete
* Should be a date in the `YYYY-MM-DD HH:MM:SS` format.
[794] Fix | Delete
* @type string $package The ZIP location containing the translation update.
[795] Fix | Delete
* @type string $autoupdate Whether the translation should be automatically installed.
[796] Fix | Delete
* }
[797] Fix | Delete
* }
[798] Fix | Delete
* @param array $theme_data Theme headers.
[799] Fix | Delete
* @param string $theme_stylesheet Theme stylesheet.
[800] Fix | Delete
* @param string[] $locales Installed locales to look up translations for.
[801] Fix | Delete
*/
[802] Fix | Delete
$update = apply_filters( "update_themes_{$hostname}", false, $theme_data, $theme_stylesheet, $locales );
[803] Fix | Delete
[804] Fix | Delete
if ( ! $update ) {
[805] Fix | Delete
continue;
[806] Fix | Delete
}
[807] Fix | Delete
[808] Fix | Delete
$update = (object) $update;
[809] Fix | Delete
[810] Fix | Delete
// Is it valid? We require at least a version.
[811] Fix | Delete
if ( ! isset( $update->version ) ) {
[812] Fix | Delete
continue;
[813] Fix | Delete
}
[814] Fix | Delete
[815] Fix | Delete
// This should remain constant.
[816] Fix | Delete
$update->id = $theme_data['UpdateURI'];
[817] Fix | Delete
[818] Fix | Delete
// WordPress needs the version field specified as 'new_version'.
[819] Fix | Delete
if ( ! isset( $update->new_version ) ) {
[820] Fix | Delete
$update->new_version = $update->version;
[821] Fix | Delete
}
[822] Fix | Delete
[823] Fix | Delete
// Handle any translation updates.
[824] Fix | Delete
if ( ! empty( $update->translations ) ) {
[825] Fix | Delete
foreach ( $update->translations as $translation ) {
[826] Fix | Delete
if ( isset( $translation['language'], $translation['package'] ) ) {
[827] Fix | Delete
$translation['type'] = 'theme';
[828] Fix | Delete
$translation['slug'] = isset( $update->theme ) ? $update->theme : $update->id;
[829] Fix | Delete
[830] Fix | Delete
$new_update->translations[] = $translation;
[831] Fix | Delete
}
[832] Fix | Delete
}
[833] Fix | Delete
}
[834] Fix | Delete
[835] Fix | Delete
unset( $new_update->no_update[ $theme_stylesheet ], $new_update->response[ $theme_stylesheet ] );
[836] Fix | Delete
[837] Fix | Delete
if ( version_compare( $update->new_version, $theme_data['Version'], '>' ) ) {
[838] Fix | Delete
$new_update->response[ $theme_stylesheet ] = (array) $update;
[839] Fix | Delete
} else {
[840] Fix | Delete
$new_update->no_update[ $theme_stylesheet ] = (array) $update;
[841] Fix | Delete
}
[842] Fix | Delete
}
[843] Fix | Delete
[844] Fix | Delete
set_site_transient( 'update_themes', $new_update );
[845] Fix | Delete
}
[846] Fix | Delete
[847] Fix | Delete
/**
[848] Fix | Delete
* Performs WordPress automatic background updates.
[849] Fix | Delete
*
[850] Fix | Delete
* Updates WordPress core plus any plugins and themes that have automatic updates enabled.
[851] Fix | Delete
*
[852] Fix | Delete
* @since 3.7.0
[853] Fix | Delete
*/
[854] Fix | Delete
function wp_maybe_auto_update() {
[855] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/admin.php';
[856] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
[857] Fix | Delete
[858] Fix | Delete
$upgrader = new WP_Automatic_Updater();
[859] Fix | Delete
$upgrader->run();
[860] Fix | Delete
}
[861] Fix | Delete
[862] Fix | Delete
/**
[863] Fix | Delete
* Retrieves a list of all language updates available.
[864] Fix | Delete
*
[865] Fix | Delete
* @since 3.7.0
[866] Fix | Delete
*
[867] Fix | Delete
* @return object[] Array of translation objects that have available updates.
[868] Fix | Delete
*/
[869] Fix | Delete
function wp_get_translation_updates() {
[870] Fix | Delete
$updates = array();
[871] Fix | Delete
$transients = array(
[872] Fix | Delete
'update_core' => 'core',
[873] Fix | Delete
'update_plugins' => 'plugin',
[874] Fix | Delete
'update_themes' => 'theme',
[875] Fix | Delete
);
[876] Fix | Delete
[877] Fix | Delete
foreach ( $transients as $transient => $type ) {
[878] Fix | Delete
$transient = get_site_transient( $transient );
[879] Fix | Delete
[880] Fix | Delete
if ( empty( $transient->translations ) ) {
[881] Fix | Delete
continue;
[882] Fix | Delete
}
[883] Fix | Delete
[884] Fix | Delete
foreach ( $transient->translations as $translation ) {
[885] Fix | Delete
$updates[] = (object) $translation;
[886] Fix | Delete
}
[887] Fix | Delete
}
[888] Fix | Delete
[889] Fix | Delete
return $updates;
[890] Fix | Delete
}
[891] Fix | Delete
[892] Fix | Delete
/**
[893] Fix | Delete
* Collects counts and UI strings for available updates.
[894] Fix | Delete
*
[895] Fix | Delete
* @since 3.3.0
[896] Fix | Delete
*
[897] Fix | Delete
* @return array {
[898] Fix | Delete
* Fetched update data.
[899] Fix | Delete
*
[900] Fix | Delete
* @type int[] $counts An array of counts for available plugin, theme, and WordPress updates.
[901] Fix | Delete
* @type string $update_title Titles of available updates.
[902] Fix | Delete
* }
[903] Fix | Delete
*/
[904] Fix | Delete
function wp_get_update_data() {
[905] Fix | Delete
$counts = array(
[906] Fix | Delete
'plugins' => 0,
[907] Fix | Delete
'themes' => 0,
[908] Fix | Delete
'wordpress' => 0,
[909] Fix | Delete
'translations' => 0,
[910] Fix | Delete
);
[911] Fix | Delete
[912] Fix | Delete
$plugins = current_user_can( 'update_plugins' );
[913] Fix | Delete
[914] Fix | Delete
if ( $plugins ) {
[915] Fix | Delete
$update_plugins = get_site_transient( 'update_plugins' );
[916] Fix | Delete
[917] Fix | Delete
if ( ! empty( $update_plugins->response ) ) {
[918] Fix | Delete
$counts['plugins'] = count( $update_plugins->response );
[919] Fix | Delete
}
[920] Fix | Delete
}
[921] Fix | Delete
[922] Fix | Delete
$themes = current_user_can( 'update_themes' );
[923] Fix | Delete
[924] Fix | Delete
if ( $themes ) {
[925] Fix | Delete
$update_themes = get_site_transient( 'update_themes' );
[926] Fix | Delete
[927] Fix | Delete
if ( ! empty( $update_themes->response ) ) {
[928] Fix | Delete
$counts['themes'] = count( $update_themes->response );
[929] Fix | Delete
}
[930] Fix | Delete
}
[931] Fix | Delete
[932] Fix | Delete
$core = current_user_can( 'update_core' );
[933] Fix | Delete
[934] Fix | Delete
if ( $core && function_exists( 'get_core_updates' ) ) {
[935] Fix | Delete
$update_wordpress = get_core_updates( array( 'dismissed' => false ) );
[936] Fix | Delete
[937] Fix | Delete
if ( ! empty( $update_wordpress )
[938] Fix | Delete
&& ! in_array( $update_wordpress[0]->response, array( 'development', 'latest' ), true )
[939] Fix | Delete
&& current_user_can( 'update_core' )
[940] Fix | Delete
) {
[941] Fix | Delete
$counts['wordpress'] = 1;
[942] Fix | Delete
}
[943] Fix | Delete
}
[944] Fix | Delete
[945] Fix | Delete
if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() ) {
[946] Fix | Delete
$counts['translations'] = 1;
[947] Fix | Delete
}
[948] Fix | Delete
[949] Fix | Delete
$counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations'];
[950] Fix | Delete
$titles = array();
[951] Fix | Delete
[952] Fix | Delete
if ( $counts['wordpress'] ) {
[953] Fix | Delete
/* translators: %d: Number of available WordPress updates. */
[954] Fix | Delete
$titles['wordpress'] = sprintf( __( '%d WordPress Update' ), $counts['wordpress'] );
[955] Fix | Delete
}
[956] Fix | Delete
[957] Fix | Delete
if ( $counts['plugins'] ) {
[958] Fix | Delete
/* translators: %d: Number of available plugin updates. */
[959] Fix | Delete
$titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] );
[960] Fix | Delete
}
[961] Fix | Delete
[962] Fix | Delete
if ( $counts['themes'] ) {
[963] Fix | Delete
/* translators: %d: Number of available theme updates. */
[964] Fix | Delete
$titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] );
[965] Fix | Delete
}
[966] Fix | Delete
[967] Fix | Delete
if ( $counts['translations'] ) {
[968] Fix | Delete
$titles['translations'] = __( 'Translation Updates' );
[969] Fix | Delete
}
[970] Fix | Delete
[971] Fix | Delete
$update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : '';
[972] Fix | Delete
[973] Fix | Delete
$update_data = array(
[974] Fix | Delete
'counts' => $counts,
[975] Fix | Delete
'title' => $update_title,
[976] Fix | Delete
);
[977] Fix | Delete
/**
[978] Fix | Delete
* Filters the returned array of update data for plugins, themes, and WordPress core.
[979] Fix | Delete
*
[980] Fix | Delete
* @since 3.5.0
[981] Fix | Delete
*
[982] Fix | Delete
* @param array $update_data {
[983] Fix | Delete
* Fetched update data.
[984] Fix | Delete
*
[985] Fix | Delete
* @type int[] $counts An array of counts for available plugin, theme, and WordPress updates.
[986] Fix | Delete
* @type string $update_title Titles of available updates.
[987] Fix | Delete
* }
[988] Fix | Delete
* @param array $titles An array of update counts and UI strings for available updates.
[989] Fix | Delete
*/
[990] Fix | Delete
return apply_filters( 'wp_get_update_data', $update_data, $titles );
[991] Fix | Delete
}
[992] Fix | Delete
[993] Fix | Delete
/**
[994] Fix | Delete
* Determines whether core should be updated.
[995] Fix | Delete
*
[996] Fix | Delete
* @since 2.8.0
[997] Fix | Delete
*/
[998] Fix | Delete
function _maybe_update_core() {
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function