Example #1
0
 function check_updater_status()
 {
     // if not installed, show link to install.
     if (!pl_check_updater_exists()) {
         add_filter('plugins_api', array($this, 'pagelines_updater_install'), 10, 3);
     }
     // if installed but not activated, lets activate it.
     add_action('admin_notices', array($this, 'updater_install'), 9);
 }
function pagelines_check_updater($note)
{
    // check for updater...
    $slug = 'pagelines-updater';
    $message = '';
    if (!pl_check_updater_exists()) {
        // need to install...
        $install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $slug), 'install-plugin_' . $slug);
        $message = sprintf('<a class="btn btn-mini btn-warning" href="%s" class="icon icon-download"></i> %s</a> %s', esc_url($install_url), __('Install the PageLines Updater plugin', 'pagelines'), __('to activate this site and get updates for your PageLines themes and plugins.', 'pagelines'));
    } else {
        // must be installed..maybe its not active?
        include_once ABSPATH . 'wp-admin/includes/plugin.php';
        if (!is_plugin_active('pagelines-updater/pagelines-updater.php')) {
            $activate_url = 'plugins.php?action=activate&plugin=' . urlencode('pagelines-updater/pagelines-updater.php') . '&plugin_status=all&paged=1&s&_wpnonce=' . urlencode(wp_create_nonce('activate-plugin_pagelines-updater/pagelines-updater.php'));
            $message = '<a href="' . esc_url(self_admin_url($activate_url)) . '">Activate the PageLines Updater plugin</a> to activate your site and get updates for your PageLines themes and plugins.';
        } else {
            if (!pl_is_activated()) {
                $url = 'index.php?page=pagelines_updater';
                $message = '<a href="' . esc_url(self_admin_url($url)) . '">Add your key now</a> to activate this site and get updates for your PageLines themes and plugins.';
            }
        }
    }
    if ($message) {
        ob_start();
        ?>
		<div class="editor-alert alert">		
		  	<p>
			<?php 
        echo $message;
        ?>
			</p>
		</div>
		<?php 
        $note .= ob_get_clean();
    }
    return $note;
}
Example #3
0
function pl_updater_txt()
{
    if (!is_super_admin()) {
        return false;
    }
    $install_txt = __('Install the PageLines Updater plugin</a> to activate a key and get updates for your PageLines themes and plugins.', 'pagelines');
    $activate_txt = __('Activate the PageLines Updater plugin</a> to activate your key and get updates for your PageLines themes and plugins.', 'pagelines');
    if (pl_is_wporg()) {
        $install_txt = __('Install the PageLines Updater plugin</a> to upgrade to the Pro edition and get updates direct from PageLines.', 'pagelines');
        $activate_txt = __('Activate the PageLines Updater plugin</a> to upgrade to the Pro edition and get updates direct from PageLines.', 'pagelines');
    }
    //normal
    $active_plugins = apply_filters('active_plugins', get_option('active_plugins'));
    if (in_array('pagelines-updater/pagelines-updater.php', $active_plugins)) {
        return false;
    }
    // ms
    if (!function_exists('is_plugin_active_for_network')) {
        require_once ABSPATH . '/wp-admin/includes/plugin.php';
    }
    if (is_plugin_active_for_network('pagelines-updater/pagelines-updater.php')) {
        return false;
    }
    if (!pl_check_updater_exists()) {
        $install_url = wp_nonce_url(network_admin_url('update.php?action=install-plugin&plugin=pagelines-updater'), 'install-plugin_pagelines-updater');
        $message = sprintf('<a class="btn btn-mini btn-warning" href="%s"> %s', esc_url($install_url), $install_txt);
    } else {
        // installed...
        $activate_url = 'plugins.php?action=activate&plugin=' . urlencode('pagelines-updater/pagelines-updater.php') . '&plugin_status=all&paged=1&s&_wpnonce=' . urlencode(wp_create_nonce('activate-plugin_pagelines-updater/pagelines-updater.php'));
        $message = sprintf('<a class="btn btn-mini btn-warning" href="%s">%s', esc_url(network_admin_url($activate_url)), $activate_txt);
    }
    return $message;
}