本文整理汇总了PHP中wp_installing函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_installing函数的具体用法?PHP wp_installing怎么用?PHP wp_installing使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_installing函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_disabled
/**
* Whether the entire automatic updater is disabled.
*
* @since 3.7.0
* @access public
*/
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 (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;
/**
* Filters 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);
}
示例2: wp_schedule_update_global_counts
function wp_schedule_update_global_counts()
{
if (!is_main_network() || !is_main_site()) {
return;
}
if (!wp_next_scheduled('update_global_counts') && !wp_installing()) {
wp_schedule_event(time(), 'twicedaily', 'update_global_counts');
}
}
示例3: schedule_events
public function schedule_events()
{
if (!is_main_site()) {
return;
}
if (!wp_next_scheduled('gmember_network_counts') && !wp_installing()) {
wp_schedule_event(time(), 'daily', 'gmember_network_counts');
}
}
示例4: _wpcom_vip_maybe_clear_alloptions_cache
/**
* Fix a race condition in alloptions caching
*
* See https://core.trac.wordpress.org/ticket/31245
*/
function _wpcom_vip_maybe_clear_alloptions_cache($option)
{
if (!wp_installing()) {
$alloptions = wp_load_alloptions();
//alloptions should be cached at this point
if (isset($alloptions[$option])) {
//only if option is among alloptions
wp_cache_delete('alloptions', 'options');
}
}
}
示例5: create_object
function create_object($args)
{
global $wpdb;
$meta = isset($args['meta']) ? $args['meta'] : array('public' => 1);
$user_id = isset($args['user_id']) ? $args['user_id'] : get_current_user_id();
// temp tables will trigger db errors when we attempt to reference them as new temp tables
$suppress = $wpdb->suppress_errors();
$blog = wpmu_create_blog($args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id']);
$wpdb->suppress_errors($suppress);
// Tell WP we're done installing.
wp_installing(false);
return $blog;
}
示例6: test_update_theme
public function test_update_theme()
{
$this->_setRole('administrator');
$_POST['_ajax_nonce'] = wp_create_nonce('updates');
$_POST['slug'] = 'twentyten';
// Make the request.
try {
// Prevent wp_update_themes() from running.
wp_installing(true);
$this->_handleAjax('update-theme');
wp_installing(false);
} catch (WPAjaxDieContinueException $e) {
unset($e);
}
// Get the response.
$response = json_decode($this->_last_response, true);
$expected = array('success' => false, 'data' => array('update' => 'theme', 'slug' => 'twentyten', 'errorMessage' => 'The theme is at the latest version.', 'newVersion' => '', 'debug' => array('The theme is at the latest version.')));
$this->assertEqualSets($expected, $response);
}
示例7: wp_get_active_and_valid_plugins
function wp_get_active_and_valid_plugins()
{
$plugins = array();
$active_plugins = (array) get_option('active_plugins', array());
// Check for hacks file if the option is enabled
if (get_option('hack_file') && file_exists(ABSPATH . 'my-hacks.php')) {
_deprecated_file('my-hacks.php', '1.5');
array_unshift($plugins, ABSPATH . 'my-hacks.php');
}
if (empty($active_plugins) || wp_installing()) {
return $plugins;
}
$network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
foreach ($active_plugins as $plugin) {
if (!validate_file($plugin) && '.php' == substr($plugin, -4) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) && (!$network_plugins || !in_array(WP_PLUGIN_DIR . '/' . $plugin, $network_plugins))) {
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
}
}
return $plugins;
}
示例8: wp_get_available_translations
/**
* Get available translations from the WordPress.org API.
*
* @since 4.0.0
*
* @see translations_api()
*
* @return array Array of translations, each an array of data. If the API response results
* in an error, an empty array will be returned.
*/
function wp_get_available_translations()
{
if (!wp_installing() && false !== ($translations = get_site_transient('available_translations'))) {
return $translations;
}
include ABSPATH . WPINC . '/version.php';
// include an unmodified $wp_version
$api = translations_api('core', array('version' => $wp_version));
if (is_wp_error($api) || empty($api['translations'])) {
return array();
}
$translations = array();
// Key the array with the language code for now.
foreach ($api['translations'] as $translation) {
$translations[$translation['language']] = $translation;
}
if (!defined('WP_INSTALLING')) {
set_site_transient('available_translations', $translations, 3 * HOUR_IN_SECONDS);
}
return $translations;
}
示例9: wp_remote_get
* attempt to do no more than threshold value, with some +/- allowed.
*/
if ($c <= 50 || $c > 50 && mt_rand(0, (int) ($c / 50)) == 1) {
require_once ABSPATH . WPINC . '/http.php';
$response = wp_remote_get(admin_url('upgrade.php?step=1'), array('timeout' => 120, 'httpversion' => '1.1'));
/** This action is documented in wp-admin/network/upgrade.php */
do_action('after_mu_upgrade', $response);
unset($response);
}
unset($c);
}
}
require_once ABSPATH . 'wp-admin/includes/admin.php';
auth_redirect();
// Schedule trash collection
if (!wp_next_scheduled('wp_scheduled_delete') && !wp_installing()) {
wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
}
set_screen_options();
$date_format = __('F j, Y');
$time_format = __('g:i a');
wp_enqueue_script('common');
/**
* $pagenow is set in vars.php
* $wp_importers is sometimes set in wp-admin/includes/import.php
* The remaining variables are imported as globals elsewhere, declared as globals here
*
* @global string $pagenow
* @global array $wp_importers
* @global string $hook_suffix
* @global string $plugin_page
示例10: wp_style_loader_src
/**
* Administration Screen CSS for changing the styles.
*
* If installing the 'wp-admin/' directory will be replaced with './'.
*
* The $_wp_admin_css_colors global manages the Administration Screens CSS
* stylesheet that is loaded. The option that is set is 'admin_color' and is the
* color and key for the array. The value for the color key is an object with
* a 'url' parameter that has the URL path to the CSS file.
*
* The query from $src parameter will be appended to the URL that is given from
* the $_wp_admin_css_colors array value URL.
*
* @since 2.6.0
* @global array $_wp_admin_css_colors
*
* @param string $src Source URL.
* @param string $handle Either 'colors' or 'colors-rtl'.
* @return string|false URL path to CSS stylesheet for Administration Screens.
*/
function wp_style_loader_src($src, $handle)
{
global $_wp_admin_css_colors;
if (wp_installing()) {
return preg_replace('#^wp-admin/#', './', $src);
}
if ('colors' == $handle) {
$color = get_user_option('admin_color');
if (empty($color) || !isset($_wp_admin_css_colors[$color])) {
$color = 'fresh';
}
$color = $_wp_admin_css_colors[$color];
$parsed = parse_url($src);
$url = $color->url;
if (!$url) {
return false;
}
if (isset($parsed['query']) && $parsed['query']) {
wp_parse_str($parsed['query'], $qv);
$url = add_query_arg($qv, $url);
}
return $url;
}
return $src;
}
示例11: validate_current_theme
/**
* Checks that current theme files 'index.php' and 'style.css' exists.
*
* Does not initially check the default theme, which is the fallback and should always exist.
* But if it doesn't exist, it'll fall back to the latest core default theme that does exist.
* Will switch theme to the fallback theme if current theme does not validate.
*
* You can use the 'validate_current_theme' filter to return false to
* disable this functionality.
*
* @since 1.5.0
* @see WP_DEFAULT_THEME
*
* @return bool
*/
function validate_current_theme()
{
/**
* Filter whether to validate the current theme.
*
* @since 2.7.0
*
* @param bool $validate Whether to validate the current theme. Default true.
*/
if (wp_installing() || !apply_filters('validate_current_theme', true)) {
return true;
}
if (!file_exists(get_template_directory() . '/index.php')) {
// Invalid.
} elseif (!file_exists(get_template_directory() . '/style.css')) {
// Invalid.
} elseif (is_child_theme() && !file_exists(get_stylesheet_directory() . '/style.css')) {
// Invalid.
} else {
// Valid.
return true;
}
$default = wp_get_theme(WP_DEFAULT_THEME);
if ($default->exists()) {
switch_theme(WP_DEFAULT_THEME);
return false;
}
/**
* If we're in an invalid state but WP_DEFAULT_THEME doesn't exist,
* switch to the latest core default theme that's installed.
* If it turns out that this latest core default theme is our current
* theme, then there's nothing we can do about that, so we have to bail,
* rather than going into an infinite loop. (This is why there are
* checks against WP_DEFAULT_THEME above, also.) We also can't do anything
* if it turns out there is no default theme installed. (That's `false`.)
*/
$default = WP_Theme::get_core_default_theme();
if (false === $default || get_stylesheet() == $default->get_stylesheet()) {
return true;
}
switch_theme($default->get_stylesheet());
return false;
}
示例12: load_default_textdomain
/**
* Load default translated strings based on locale.
*
* Loads the .mo file in WP_LANG_DIR constant path from WordPress root.
* The translated (.mo) file is named based on the locale.
*
* @see load_textdomain()
*
* @since 1.5.0
*
* @param string $locale Optional. Locale to load. Default is the value of {@see get_locale()}.
* @return bool Whether the textdomain was loaded.
*/
function load_default_textdomain($locale = null)
{
if (null === $locale) {
$locale = get_locale();
}
// Unload previously loaded strings so we can switch translations.
unload_textdomain('default');
$return = load_textdomain('default', WP_LANG_DIR . "/{$locale}.mo");
if ((is_multisite() || defined('WP_INSTALLING_NETWORK') && WP_INSTALLING_NETWORK) && !file_exists(WP_LANG_DIR . "/admin-{$locale}.mo")) {
load_textdomain('default', WP_LANG_DIR . "/ms-{$locale}.mo");
return $return;
}
if (is_admin() || wp_installing() || defined('WP_REPAIRING') && WP_REPAIRING) {
load_textdomain('default', WP_LANG_DIR . "/admin-{$locale}.mo");
}
if (is_network_admin() || defined('WP_INSTALLING_NETWORK') && WP_INSTALLING_NETWORK) {
load_textdomain('default', WP_LANG_DIR . "/admin-network-{$locale}.mo");
}
return $return;
}
示例13: get_transient
/**
* Get the value of a transient.
*
* If the transient does not exist, does not have a value, or has expired,
* then the return value will be false.
*
* @since 2.8.0
*
* @param string $transient Transient name. Expected to not be SQL-escaped.
* @return mixed Value of transient.
*/
function get_transient($transient)
{
/**
* Filters the value of an existing transient.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* Passing a truthy value to the filter will effectively short-circuit retrieval
* of the transient, returning the passed value instead.
*
* @since 2.8.0
* @since 4.4.0 The `$transient` parameter was added
*
* @param mixed $pre_transient The default value to return if the transient does not exist.
* Any value other than false will short-circuit the retrieval
* of the transient, and return the returned value.
* @param string $transient Transient name.
*/
$pre = apply_filters("pre_transient_{$transient}", false, $transient);
if (false !== $pre) {
return $pre;
}
if (wp_using_ext_object_cache()) {
$value = wp_cache_get($transient, 'transient');
} else {
$transient_option = '_transient_' . $transient;
if (!wp_installing()) {
// If option is not in alloptions, it is not autoloaded and thus has a timeout
$alloptions = wp_load_alloptions();
if (!isset($alloptions[$transient_option])) {
$transient_timeout = '_transient_timeout_' . $transient;
$timeout = get_option($transient_timeout);
if (false !== $timeout && $timeout < time()) {
delete_option($transient_option);
delete_option($transient_timeout);
$value = false;
}
}
}
if (!isset($value)) {
$value = get_option($transient_option);
}
}
/**
* Filters an existing transient's value.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 2.8.0
* @since 4.4.0 The `$transient` parameter was added
*
* @param mixed $value Value of transient.
* @param string $transient Transient name.
*/
return apply_filters("transient_{$transient}", $value, $transient);
}
示例14: load_default_textdomain
/**
* Load default translated strings based on locale.
*
* Loads the .mo file in WP_LANG_DIR constant path from WordPress root.
* The translated (.mo) file is named based on the locale.
*
* @see load_textdomain()
*
* @since 1.5.0
*
* @param string $locale Optional. Locale to load. Default is the value of {@see get_locale()}.
* @return bool Whether the textdomain was loaded.
*/
function load_default_textdomain($locale = null)
{
if (null === $locale) {
$locale = get_locale();
}
// Unload previously loaded strings so we can switch translations.
unload_textdomain('default');
$return = load_textdomain('default', WP_LANG_DIR . "/{$locale}.mo");
if (is_admin() || wp_installing() || defined('WP_REPAIRING') && WP_REPAIRING) {
load_textdomain('default', WP_LANG_DIR . "/admin-{$locale}.mo");
}
return $return;
}
示例15: update_home_siteurl
/**
* Flushes rewrite rules if siteurl, home or page_on_front changed.
*
* @since 2.1.0
*
* @param string $old_value
* @param string $value
*/
function update_home_siteurl($old_value, $value)
{
if (wp_installing()) {
return;
}
flush_rewrite_rules();
}