当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Automatic_Updater::is_disabled方法代码示例

本文整理汇总了PHP中WP_Automatic_Updater::is_disabled方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Automatic_Updater::is_disabled方法的具体用法?PHP WP_Automatic_Updater::is_disabled怎么用?PHP WP_Automatic_Updater::is_disabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Automatic_Updater的用法示例。


在下文中一共展示了WP_Automatic_Updater::is_disabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

		if ( current_user_can( 'update_core' ) ) {
			$future_minor_update = (object) array(
				'current'       => $wp_version . '.1.next.minor',
				'version'       => $wp_version . '.1.next.minor',
				'php_version'   => $required_php_version,
				'mysql_version' => $required_mysql_version,
			);
			require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
			$updater = new WP_Automatic_Updater;
			$can_auto_update = wp_http_supports( array( 'ssl' ) ) && $updater->should_update( 'core', $future_minor_update, ABSPATH );

			if ( $can_auto_update ) {
				echo '<p class="about-auto-update cool">' . __( 'This site <strong>is</strong> able to apply these updates automatically. Cool!' ). '</p>';

			// If the updater is disabled entirely, don't show them anything.
			} elseif ( ! $updater->is_disabled() ) {
				echo '<p class="about-auto-update">';
				// If this is is filtered to false, they won't get emails, so don't claim we will.
				// Assumption: If the user can update core, they can see what the admin email is.

				/** This filter is documented in wp-admin/includes/class-wp-upgrader.php */
				if ( apply_filters( 'send_core_update_notification_email', true, $future_minor_update ) ) {
					printf( __( 'This site <strong>is not</strong> able to apply these updates automatically. But we&#8217;ll email %s when there is a new security release.' ), esc_html( get_site_option( 'admin_email' ) ) );
				} else {
					_e( 'This site <strong>is not</strong> able to apply these updates automatically.' );
				}
				echo '</p>';
			}
		}
		?>
	</div>
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:about.php

示例2: array

 static function get_possible_failures()
 {
     $result = array();
     // Lets check some reasons why it might not be working as expected
     include_once ABSPATH . '/wp-admin/includes/admin.php';
     include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
     $upgrader = new WP_Automatic_Updater();
     if ($upgrader->is_disabled()) {
         $result[] = 'autoupdates-disabled';
     }
     if (!is_main_site()) {
         $result[] = 'is-not-main-site';
     }
     if (!is_main_network()) {
         $result[] = 'is-not-main-network';
     }
     if ($upgrader->is_vcs_checkout(ABSPATH)) {
         $result[] = 'site-on-vcs';
     }
     if ($upgrader->is_vcs_checkout(WP_PLUGIN_DIR)) {
         $result[] = 'plugin-directory-on-vcs';
     }
     if ($upgrader->is_vcs_checkout(WP_CONTENT_DIR)) {
         $result[] = 'content-directory-on-vcs';
     }
     $lock = get_option('auto_updater.lock');
     if ($lock > time() - HOUR_IN_SECONDS) {
         $result[] = 'lock-is-set';
     }
     $skin = new Automatic_Upgrader_Skin();
     include_once ABSPATH . 'wp-admin/includes/file.php';
     include_once ABSPATH . 'wp-admin/includes/template.php';
     if (!$skin->request_filesystem_credentials(false, ABSPATH, false)) {
         $result[] = 'no-system-write-access';
     }
     if (!$skin->request_filesystem_credentials(false, WP_PLUGIN_DIR, false)) {
         $result[] = 'no-plugin-directory-write-access';
     }
     if (!$skin->request_filesystem_credentials(false, WP_CONTENT_DIR, false)) {
         $result[] = 'no-wp-content-directory-write-access';
     }
     return $result;
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:43,代码来源:class.jetpack-autoupdate.php

示例3: strtotime

    function upgrade_screen()
    {
        $html = ob_get_clean();
        if (!$this->check_user_permission() && !$this->can_update_core()) {
            $html = preg_replace('~<form[^>]*?>~', '<!--form opening tag removed by BusinessPres-->', $html);
            $html = str_replace('</form>', '<!--form closing tag removed by BusinessPres-->', $html);
        }
        if (!$this->check_user_permission() && (empty($this->aOptions['cap_update']) || !$this->aOptions['cap_update'])) {
            $html = preg_replace('~<input[^>]*?type=["\']checkbox["\'][^>]*?>~', '', $html);
            $html = preg_replace('~<thead[\\s\\S]*?</thead>~', '', $html);
            $html = preg_replace('~<tfoot[\\s\\S]*?</tfoot>~', '', $html);
            $html = preg_replace('~<input[^>]*?upgrade-plugins[^>]*?>~', '', $html);
            $html = preg_replace('~<input[^>]*?upgrade-themes[^>]*?>~', '', $html);
        }
        global $wp_version;
        $new_html = '';
        if (!$this->check_user_permission() && !$this->can_update_core()) {
            $new_html .= "<div class='error'><p>" . $this->talk_no_permissions('upgrade WordPress core') . "</p></div>";
        }
        $new_html .= "<h4>WordPress " . $wp_version . " installed<br />";
        global $wp_version;
        $sStatus = false;
        $iTTL = 0;
        $aVersions = $this->cache_core_version_info();
        if ($aVersions && isset($aVersions['data']) && count($aVersions['data']) > 0) {
            if ($this->get_version_branch() && isset($aVersions['data'][$this->get_version_branch()])) {
                $iDate = strtotime($aVersions['data'][$this->get_version_branch()]);
                $iTTL = $iDate + 3600 * 24 * 30 * 30;
                //  the current version is good has time to live set to 30 months
                if ($iTTL - time() < 0) {
                    $sStatus = "Not Secure - Major Upgrade Required";
                } else {
                    if ($iTTL - time() < 3600 * 24 * 30 * 3) {
                        //  if the current version is older than 23 monts, warn the user
                        $sStatus = "Update Recommended Soon";
                    } else {
                        $sStatus = "Secure";
                    }
                }
            }
            if ($this->get_branch_latest() != $wp_version && strtotime($aVersions['data'][$this->get_branch_latest()]) + 3600 * 24 * 5 < time()) {
                $sStatus = "Not Secure - Minor Upgrade Required";
            }
        }
        $new_html .= "Last updated: " . date('j F Y', strtotime($aVersions['data'][$this->get_branch_latest()])) . "<br />";
        $new_html .= "Status: " . $sStatus . "<br />";
        $iRemaining = floor(($iTTL - time()) / (3600 * 24) / 30);
        if ($iRemaining > 0) {
            $new_html .= "Projected security updates: " . $iRemaining . " months.";
        } else {
            $new_html .= "Projected security updates: Negative " . abs($iRemaining) . " months. Expired or expiration imminent.";
        }
        $new_html .= "</h4>\n";
        if (!class_exists('Core_Upgrader')) {
            include_once ABSPATH . '/wp-admin/includes/admin.php';
            include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
        }
        if (class_exists('Core_Upgrader')) {
            $new_html .= "<p>Core auto-updates status: ";
            $bDisabled = false;
            if (class_exists('Core_Upgrader')) {
                $objUpdater = new WP_Automatic_Updater();
                if ($objUpdater->is_disabled()) {
                    $new_html .= "disabled";
                    $bDisabled = true;
                }
            }
            if (!$bDisabled) {
                if (Core_Upgrader::should_update_to_version('100.1.2.3')) {
                    $new_html .= "<strong>Major version updates enabled</strong>";
                } else {
                    if (Core_Upgrader::should_update_to_version(get_bloginfo('version') . '.0.1')) {
                        $new_html .= "only Minor version updates enabled";
                    }
                }
            }
            $new_html .= "</p>";
        }
        $aBlockedUpdates = get_site_option('businesspress_core_update_delay');
        $bFound = false;
        if ($aBlockedUpdates) {
            foreach ($aBlockedUpdates as $key => $value) {
                if (stripos($key, '.next.minor') === false) {
                    $bFound = true;
                }
            }
        }
        if ($bFound && $aBlockedUpdates) {
            ksort($aBlockedUpdates);
            $aBlockedUpdates = array_reverse($aBlockedUpdates);
            $new_html .= "<p>Recently blocked updates:</p>";
            $new_html .= "<ul>\n";
            foreach ($aBlockedUpdates as $key => $value) {
                if (stripos($key, '.next.minor') !== false) {
                    $new_html .= "<li>WP core internal autoupdate check " . human_time_diff(time(), $value) . " ago</li>\n";
                    continue;
                }
                $new_html .= "<li><a href='https://codex.wordpress.org/Version_" . $key . "' target='_blank'>" . $key . "</a> " . human_time_diff(time(), $value) . " ago</li>\n";
            }
            $new_html .= "</ul>\n";
//.........这里部分代码省略.........
开发者ID:foliovision,项目名称:businesspress,代码行数:101,代码来源:businesspress.php


注:本文中的WP_Automatic_Updater::is_disabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。