function oxy_fix_tgm_double_nag()
{
    global $current_screen;
    if (strpos($current_screen->base, THEME_SHORT) !== false || isset($current_screen->post_type) && $current_screen->post_type === 'oxy_swatch') {
        $tgmpa = TGM_Plugin_Activation::get_instance();
        remove_action('admin_notices', array($tgmpa, 'notices'));
    }
}
/**
 * ----------------------------------------------------------------------
 * Check if required plugins were manually installed
 */
function lbmn_required_plugins_install_check()
{
    if (TGM_Plugin_Activation::get_instance()->is_tgmpa_complete()) {
        // Update theme option '_required_plugins_installed'
        update_option(LBMN_THEME_NAME . '_required_plugins_installed', true);
        // Mark first step 'Install Plugins' as done
        echo '<script type="text/javascript">jQuery(\'.step-plugins\').addClass(\'step-completed\');</script>';
    } else {
        update_option(LBMN_THEME_NAME . '_required_plugins_installed', false);
    }
}
 /**
  * Returns the singleton instance of the class.
  *
  * @since 2.4.0
  *
  * @return object The TGM_Plugin_Activation object.
  */
 public static function get_instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * Returns the singleton instance of the class.
  *
  * @since 2.4.0
  *
  * @return object The TGM_Plugin_Activation object.
  */
 public static function get_instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof TGM_Plugin_Activation) {
         self::$instance = new TGM_Plugin_Activation();
     }
     return self::$instance;
 }
Example #5
0
 /**
  * Renders admin notes in case there are errors or notices on bootstrap init
  *
  * @author peshkov@UD
  */
 public function admin_notices()
 {
     global $wp_version;
     //** Don't show the message if the user has no 'activate plugins' permission. */
     if (!function_exists('wp_get_current_user')) {
         require_once ABSPATH . 'wp-includes/pluggable.php';
     }
     if (!current_user_can('activate_plugins')) {
         return;
     }
     //** Don't show the message if on a multisite and the user isn't a super user. */
     if (is_multisite() && !is_super_admin()) {
         return;
     }
     //** Ignore messages on TGM Plugin Activation page */
     if (TGM_Plugin_Activation::get_instance()->is_tgmpa_page()) {
         return;
     }
     $errors = apply_filters('ud:errors:admin_notices', $this->errors, $this->args);
     $messages = apply_filters('ud:messages:admin_notices', $this->messages, $this->args);
     $warnings = apply_filters('ud:warnings:admin_notices', $this->warnings, $this->args);
     if (!empty($errors) || !empty($messages) || !empty($warnings)) {
         echo "<style>.ud-admin-notice a { text-decoration: underline !important; } .ud-admin-notice { display: block !important; } .ud-admin-notice.update-nag { border-color: #ffba00 !important; }</style>";
     }
     //** Errors Block */
     if (!empty($errors) && is_array($errors)) {
         $message = '<ul style="list-style:disc inside;"><li>' . implode('</li><li>', $errors) . '</li></ul>';
         $message = sprintf(__('<p><b>%s</b> is not active due to following errors:</p> %s', $this->domain), $this->name, $message);
         if (!empty($this->action_links['errors']) && is_array($this->action_links['errors'])) {
             $message .= '<p>' . implode(' | ', $this->action_links['errors']) . '</p>';
         }
         echo '<div class="ud-admin-notice error fade" style="padding:11px;">' . $message . '</div>';
     }
     //** Warnings Block */
     if (!empty($warnings) && is_array($warnings)) {
         $message = '<ul style="list-style:disc inside;"><li>' . implode('</li><li>', $warnings) . '</li></ul>';
         $message = sprintf(__('<p><b>%s</b> has the following warnings:</p> %s', $this->domain), $this->name, $message);
         if (!empty($this->action_links['errors']) && is_array($this->action_links['errors'])) {
             $message .= '<p>' . implode(' | ', $this->action_links['errors']) . '</p>';
         }
         echo '<div class="ud-admin-notice updated update-nag fade" style="padding:11px;">' . $message . '</div>';
     }
     //** Determine if message has been dismissed */
     $dismissed = get_option('dismissed_notice_' . sanitize_key($this->name));
     if (empty($dismissed)) {
         //** Notices Block */
         if (!empty($messages) && is_array($messages)) {
             $message = '<ul style="list-style:disc inside;"><li>' . implode('</li><li>', $messages) . '</li></ul>';
             if (!empty($errors)) {
                 $message = sprintf(__('<p><b>%s</b> has the following additional notices:</p> %s', $this->domain), $this->name, $message);
             } else {
                 $message = sprintf(__('<p><b>%s</b> is active, but has the following notices:</p> %s', $this->domain), $this->name, $message);
             }
             if ($this->dismiss) {
                 $this->action_links['messages'][] = '<a class="dismiss-notice" href="' . add_query_arg('udan-dismiss-' . sanitize_key($this->name), 'true') . '" target="_parent">' . __('Dismiss this notice', $this->domain) . '</a>';
             }
             $message .= '<p>' . implode(' | ', $this->action_links['messages']) . '</p>';
             echo '<div class="ud-admin-notice updated fade" style="padding:11px;">' . $message . '</div>';
         }
     }
 }
 /**
  * Retrieve plugin data, given the plugin name.
  *
  * @since      2.2.0
  * @deprecated 2.5.0 use {@see TGM_Plugin_Activation::_get_plugin_data_from_name()} instead.
  * @see        TGM_Plugin_Activation::_get_plugin_data_from_name()
  *
  * @param string $name Name of the plugin, as it was registered.
  * @param string $data Optional. Array key of plugin data to return. Default is slug.
  * @return string|boolean Plugin slug if found, false otherwise.
  */
 protected function _get_plugin_data_from_name($name, $data = 'slug')
 {
     _deprecated_function(__FUNCTION__, 'TGMPA 2.5.0', 'TGM_Plugin_Activation::_get_plugin_data_from_name()');
     return $this->tgmpa->_get_plugin_data_from_name($name, $data);
 }
/**
 * Relocate the tgmpa admin menu under Themify
 *
 * @since 1.0.0
 */
function themify_theme_required_plugins_admin_menu()
{
    // Make sure privileges are correct to see the page
    if (!current_user_can('install_plugins')) {
        return;
    }
    TGM_Plugin_Activation::get_instance()->populate_file_path();
    foreach (TGM_Plugin_Activation::get_instance()->plugins as $plugin) {
        if (!is_plugin_active($plugin['file_path'])) {
            add_submenu_page('themify', __('Install Plugins', 'themify'), __('Install Plugins', 'themify'), 'manage_options', 'themify-install-plugins', array(TGM_Plugin_Activation::get_instance(), 'install_plugins_page'));
            break;
        }
    }
}
/**
 * ----------------------------------------------------------------------
 * Check if required plugins were manually installed
 */
function lbmn_required_plugins_install_check()
{
    if (TGM_Plugin_Activation::get_instance()->is_tgmpa_complete()) {
        // Update theme option '_required_plugins_installed'
        update_option(LBMN_THEME_NAME . '_required_plugins_installed', true);
        // Mark first step 'Install Plugins' as done
        echo '<script type="text/javascript">jQuery(\'.step-plugins\').addClass(\'step-completed\');</script>';
    } else {
        update_option(LBMN_THEME_NAME . '_required_plugins_installed', false);
    }
    // if ( ! get_option( LBMN_THEME_NAME . '_required_plugins_installed' ) ) {
    // Proceed only if '_required_plugins_installed' not already market as true
    /*
    		global $tgmpa_settings_errors;
    
    	$current_tgmpa_message = '';
    	if (is_array($tgmpa_settings_errors)) {
    			foreach ($tgmpa_settings_errors as $message) {
    				$current_tgmpa_message .= $message['message'];
    			}
    		}
    	$current_wpadmin_screen = get_current_screen();
    		lbmn_debug_console( $current_wpadmin_screen->id );
    	// Don't check on TGMPA installation page as there is no notices
    		// if ($current_wpadmin_screen->id != 'appearance_page_install-required-plugins' ) {
    		if ($current_wpadmin_screen->id == 'themes' ) {
    		// echo "MESSAGE: $current_tgmpa_message";
    		// If message has no link to install-required-plugins page then all
    			// required plugins has been installed
    			if ( ! stristr($current_tgmpa_message, 'install-required-plugins') ) {
    			// Update theme option '_required_plugins_installed'
    				update_option( LBMN_THEME_NAME . '_required_plugins_installed', true);
    			// Mark first step 'Install Plugins' as done
    				echo '<script type="text/javascript">jQuery(\'.step-plugins\').addClass(\'step-completed\');</script>';
    		} else {
    				update_option( LBMN_THEME_NAME . '_required_plugins_installed', false);
    			}
    		lbmn_debug_console( get_option (LBMN_THEME_NAME . '_required_plugins_installed') );
    		}
    // }
    */
}
Example #9
0
 /**
  * Ensure only one instance of the class is ever invoked.
  */
 function load_tgm_plugin_activation()
 {
     $GLOBALS['tgmpa'] = TGM_Plugin_Activation::get_instance();
 }
Example #10
0
" class="nav-tab <?php 
    if ($this->navigation == 'extensions') {
        echo "nav-tab-active";
    }
    ?>
"><?php 
    _e('Extensions', 'framework');
    ?>
</a>
	<?php 
}
?>
</h2>
<?php 
global $plugin_installer, $themePlugins;
$tgm = new TGM_Plugin_Activation();
$link = admin_url('admin.php?page=plugin-installer');
$redirect = '<script type="text/javascript">window.location = "' . $link . '";</script>';
$action = isset($_GET['action']) ? $_GET['action'] : '';
switch ($action) {
    case 'install':
        $tgm->do_plugin_install();
        echo $redirect;
        break;
    case 'activate':
        $tgm->do_plugin_activate();
        echo $redirect;
        break;
    case 'install-extension':
        $extensions = $_POST['ext_chk'];
        if ($extensions[0] == 'on') {
Example #11
0
} else {
    echo '<p>Click the add key button below to add a collection key</p>';
}
?>
					</tbody>
				</table>
				</p>
				<?php 
if (count($payload)) {
    ?>
					<input type="button" id="wpcore_addrow" class="button button-large" value="Add another collection key" />
					<a href="<?php 
    echo TGM_Plugin_Activation::get_instance()->parent_slug;
    ?>
?page=<?php 
    echo TGM_Plugin_Activation::get_instance()->menu;
    ?>
" class="button button-large float-right">Install Plugins</a>



				<?php 
} else {
    ?>
					<input type="button" id="wpcore_addrow" class="button button-large" value="Add a collection key" />
				<?php 
}
?>
				</p>
				<hr>
				<?php 
Example #12
0
 /**
  * Determine if plugin/theme requires or recommends another plugin(s)
  *
  * @author peshkov@UD
  */
 private function plugins_dependencies()
 {
     /** 
      * Dependencies must be checked before plugins_loaded hook to prevent issues!
      * 
      * The current condition fixes incorrect behaviour on custom 'Install Plugins' page
      * after activation plugin which has own dependencies.
      * 
      * The condition belongs to WordPress 4.3 and higher.
      */
     if (did_action('plugins_loaded')) {
         return;
     }
     $plugins = $this->get_schema('extra.schemas.dependencies.plugins');
     if (!empty($plugins) && is_array($plugins)) {
         $tgma = TGM_Plugin_Activation::get_instance();
         foreach ($plugins as $plugin) {
             $plugin['_referrer'] = get_class($this);
             $plugin['_referrer_name'] = $this->name;
             $tgma->register($plugin);
         }
         $this->is_tgma = true;
     }
 }
Example #13
0
function site_admin_plugin_notice()
{
    $tgm = new TGM_Plugin_Activation();
    $tgm->notices();
}