Skip to content
Snippets Groups Projects
Select Git revision
  • 0975d24d9d8bcabeb6aafe4449d9ed42595d6add
  • master default protected
  • fix/woo-stubs-dir
  • default-packages
  • use-internal-packages
  • update-setup
  • feature/wpdesk-cs
  • 2.5.3
  • 2.5.2
  • 2.5.1
  • 2.5.0
  • 2.4.2
  • 2.4.1
  • 2.4.0
  • 2.3
  • 2.2.1
  • 2.2
  • 2.1
  • 2.0
  • 1.10.15
  • 1.10.12
  • 1.10.8
  • 1.10.7
  • 1.10.6
  • 1.10.5
  • 1.10.3
  • 1.10.2
27 results

class-helper.php

Blame
  • class-helper.php 1.62 KiB
    <?php
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    if ( ! class_exists( 'WPDesk_Helper_Plugin' ) ) {
    
    	class WPDesk_Helper_Plugin {
    
    		protected $plugin_data;
    
    		protected $text_domain;
    
    		protected $ame_activated_key;
    
    		protected $ame_activation_tab_key;
    
    		function __construct( $plugin_data ) {
    			global $wpdesk_helper_plugins;
    
    			$this->plugin_data = $plugin_data;
    			if ( ! isset( $wpdesk_helper_plugins ) ) $wpdesk_helper_plugins = array();
    			$plugin_data['helper_plugin'] = $this;
    			$wpdesk_helper_plugins[] = $plugin_data;
    
    			$this->ame_activated_key = 'api_' . dirname($plugin_data['plugin']) . '_activated';
    			$this->ame_activation_tab_key = 'api_' . dirname($plugin_data['plugin']) . '_dashboard';
    
    		}
    
    		public function inactive_notice() { ?>
    			<?php if ( ! current_user_can( 'manage_options' ) ) return; ?>
    			<?php if ( 1==1 && isset( $_GET['page'] ) && $this->ame_activation_tab_key == $_GET['page'] ) return; ?>
                <div class="update-nag">
    				<?php printf( __( 'The %s%s%s License Key has not been activated, so the plugin is inactive! %sClick here%s to activate the license key and the plugin.', 'wpdesk-plugin' ), '<strong>', $this->plugin_data['product_id'], '</strong>', '<a href="' . esc_url( admin_url( 'admin.php?page='.$this->ame_activation_tab_key ) ) . '">', '</a>' ); ?>
                </div>
    			<?php
    		}
    
    
    		function is_active( $add_notice = false ) {
    			if ( get_option( $this->ame_activated_key, '0' ) != 'Activated' ) {
    				if ( $add_notice ) {
    					add_action( 'admin_notices', array( $this, 'inactive_notice' ) );
    				}
    				return false;
    			}
    			else {
    				return true;
    			}
    		}
    
    	}
    
    }