/**
  * Return an instance of this class.
  *
  * @since     1.0.0
  *
  * @return    object    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * Instantiate and return the unique Awesome Support object
  *
  * @since     3.2.5
  * @return object Awesome_Support Unique instance of Awesome Support
  */
 public static function instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof Awesome_Support) {
         self::$instance = new Awesome_Support();
         self::$instance->setup_constants();
         self::$instance->includes();
         self::$instance->session = new WPAS_Session();
         if (is_admin()) {
             self::$instance->includes_admin();
             self::$instance->admin_notices = new AS_Admin_Notices();
         }
     }
     return self::$instance;
 }
/*----------------------------------------------------------------------------*
 * Public-Facing Only Functionality
 *----------------------------------------------------------------------------*/
if (!is_admin() && Awesome_Support::dependencies_loaded()) {
    require_once WPAS_PATH . 'includes/shortcodes/shortcode-tickets.php';
    // The plugin main shortcodes
    require_once WPAS_PATH . 'includes/shortcodes/shortcode-submit.php';
    // The plugin main shortcode-submit
}
/*----------------------------------------------------------------------------*
 * Dashboard and Administrative Functionality
 *----------------------------------------------------------------------------*/
/**
 * The code below is intended to to give the lightest footprint possible.
 */
if (is_admin() && Awesome_Support::dependencies_loaded()) {
    /* Load main admin class */
    require_once WPAS_PATH . 'includes/admin/class-admin.php';
    add_action('plugins_loaded', array('Awesome_Support_Admin', 'get_instance'));
    /* Load the MailGun e-mail check settings */
    add_filter('wpas_plugin_settings', array('WPAS_MailGun_EMail_Check', 'settings'), 10, 1);
    /**
     * Add link ot settings tab
     */
    add_filter('plugin_action_links_' . plugin_basename(__FILE__), array('Awesome_Support_Admin', 'settings_page_link'));
}
/*----------------------------------------------------------------------------*
 * Declare global variables
 *----------------------------------------------------------------------------*/
/**
 * Instantiate the global $wpas_cf object containing all the custom fields.
 /**
  * Instantiate and return the unique Awesome Support object
  *
  * @since     3.2.5
  * @return object Awesome_Support Unique instance of Awesome Support
  */
 public static function instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof Awesome_Support) {
         self::$instance = new Awesome_Support();
         self::$instance->init();
     }
     return self::$instance;
 }
Example #5
0
/**
 * Installs WordPress for running the tests and loads WordPress and the test libraries
 */
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
$config_file_path = dirname(__FILE__) . '/unittests-config.php';
/*
 * Globalize some WordPress variables, because PHPUnit loads this file inside a function
 * See: https://github.com/sebastianbergmann/phpunit/issues/325
 *
 * These are not needed for WordPress 3.3+, only for older versions
*/
global $table_prefix, $wp_embed, $wp_locale, $_wp_deprecated_widgets_callbacks, $wp_widget_factory;
// These are still needed
global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp;
define('WPMU_PLUGIN_DIR', dirname(__FILE__) . '/mu-plugins');
require_once $config_file_path;
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
$_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
system(WP_PHP_BINARY . ' ' . escapeshellarg(dirname(__FILE__) . '/bin/install.php') . ' ' . escapeshellarg($config_file_path));
require dirname(__FILE__) . '/lib/functions.php';
// Load WordPress
require_once ABSPATH . '/wp-settings.php';
require dirname(__FILE__) . '/lib/testcase.php';
require dirname(__FILE__) . '/lib/exceptions.php';
require dirname(__FILE__) . '/../awesome-support.php';
// Install the plugin
Awesome_Support::activate(WP_ALLOW_MULTISITE);
$current_user = new WP_User(1);
$current_user->set_role('administrator');