Jetpack_JITM::manage_pi_msg PHP Méthode

manage_pi_msg() public méthode

Display message prompting user to enable auto-updates in WordPress.com.
Since: 3.8.2
public manage_pi_msg ( )
    function manage_pi_msg()
    {
        $normalized_site_url = Jetpack::build_raw_urls(get_home_url());
        $manage_active = Jetpack::is_module_active('manage');
        // Check if plugin has auto update already enabled in WordPress.com and don't show JITM in such case.
        $active_before = get_option('jetpack_temp_active_plugins_before', array());
        delete_option('jetpack_temp_active_plugins_before');
        $active_now = get_option('active_plugins', array());
        $activated = array_diff($active_now, $active_before);
        $auto_update_plugin_list = Jetpack_Options::get_option('autoupdate_plugins', array());
        $plugin_auto_update_disabled = false;
        foreach ($activated as $plugin) {
            if (!in_array($plugin, $auto_update_plugin_list)) {
                // Plugin doesn't have auto updates enabled in WordPress.com yet.
                $plugin_auto_update_disabled = true;
                // We don't need to continue checking, it's ok to show JITM for this plugin.
                break;
            }
        }
        // Check if the activated plugin is in the WordPress.org repository
        $plugin_can_auto_update = false;
        $plugin_updates = get_site_transient('update_plugins');
        if (false === $plugin_updates) {
            // If update_plugins doesn't exist, display message anyway
            $plugin_can_auto_update = true;
        } else {
            $plugin_updates = array_merge($plugin_updates->response, $plugin_updates->no_update);
            foreach ($activated as $plugin) {
                if (isset($plugin_updates[$plugin])) {
                    // There's at least one plugin set cleared for auto updates
                    $plugin_can_auto_update = true;
                    // We don't need to continue checking, it's ok to show JITM for this round.
                    break;
                }
            }
        }
        if (!$manage_active && $plugin_auto_update_disabled && $plugin_can_auto_update && self::$auto_updates_allowed) {
            ?>
			<div class="jp-jitm">
				<a href="#" data-module="manage-pi" class="dismiss"><span class="genericon genericon-close"></span></a>

			<?php 
            echo self::get_emblem();
            ?>

				<?php 
            if (!$manage_active) {
                ?>
					<p class="msg">
						<?php 
                esc_html_e('Save time with automated plugin updates.', 'jetpack');
                ?>
					</p>
					<p>
						<img class="j-spinner hide" src="<?php 
                echo esc_url(includes_url('images/spinner-2x.gif'));
                ?>
" alt="<?php 
                echo esc_attr__('Loading...', 'jetpack');
                ?>
" /><a href="#" data-module="manage" data-module-success="<?php 
                esc_attr_e('Success!', 'jetpack');
                ?>
" class="activate button"><?php 
                esc_html_e('Activate remote management', 'jetpack');
                ?>
</a>
					</p>
				<?php 
            } elseif ($manage_active) {
                ?>
					<p>
						<?php 
                esc_html_e('Save time with auto updates on WordPress.com', 'jetpack');
                ?>
					</p>
				<?php 
            }
            // manage inactive
            ?>
				<p class="show-after-enable <?php 
            echo $manage_active ? '' : 'hide';
            ?>
">
					<a href="<?php 
            echo esc_url('https://wordpress.com/plugins/' . $normalized_site_url);
            ?>
" target="_blank" title="<?php 
            esc_attr_e('Go to WordPress.com to enable auto-updates for plugins', 'jetpack');
            ?>
" data-module="manage-pi" class="button button-jetpack launch show-after-enable"><?php 
            if (!$manage_active) {
                esc_html_e('Enable auto-updates on WordPress.com', 'jetpack');
            } elseif ($manage_active) {
                esc_html_e('Enable auto-updates', 'jetpack');
            }
            // manage inactive
            ?>
</a>
				</p>
			</div>
			<?php 
            //jitm is being viewed, track it
            $jetpack = Jetpack::init();
            $jetpack->stat('jitm', 'manage-pi-viewed-' . JETPACK__VERSION);
            $jetpack->do_stats('server_side');
        }
        // manage inactive
    }