public function __construct() { require_once dirname(__FILE__) . '/class.settings-api.php'; $this->settings = cnSettingsAPI::getInstance(); add_action('admin_menu', array(&$this, 'loadSettingsPage')); add_action('plugins_loaded', array(&$this, 'init')); }
/** * @access private * @since unknown * @static * * @return connectionsLoad */ public static function instance() { if (!isset(self::$instance) && !self::$instance instanceof connectionsLoad) { self::$instance = new connectionsLoad(); self::defineConstants(); self::includes(); self::$instance->options = new cnOptions(); self::$instance->settings = cnSettingsAPI::getInstance(); self::$instance->pageHook = new stdClass(); self::$instance->currentUser = new cnUser(); self::$instance->retrieve = new cnRetrieve(); self::$instance->term = new cnTerms(); self::$instance->template = new cnTemplatePart(); self::$instance->url = new cnURL(); /** * NOTE: Any calls to load_plugin_textdomain should be in a function attached to the `plugins_loaded` action hook. * @link http://ottopress.com/2013/language-packs-101-prepwork/ * * NOTE: Any portion of the plugin w/ translatable strings should be bound to the plugins_loaded action hook or later. * * NOTE: Priority set at -1 to allow extensions to use the `connections` text domain. Since extensions are * generally loaded on the `plugins_loaded` action hook, any strings with the `connections` text * domain will be merged into it. The purpose is to allow the extensions to use strings known to * in the core plugin to reuse those strings and benefit if they are already translated. */ add_action('plugins_loaded', array(__CLASS__, 'loadTextdomain'), -1); /* * Process front end actions. */ add_action('template_redirect', array(__CLASS__, 'frontendActions')); // Activation/Deactivation hooks register_activation_hook(dirname(__FILE__) . '/connections.php', array(__CLASS__, 'activate')); register_deactivation_hook(dirname(__FILE__) . '/connections.php', array(__CLASS__, 'deactivate')); // @TODO: Create uninstall method to remove options and tables. // register_uninstall_hook( dirname(__FILE__) . '/connections.php', array('connectionsLoad', 'uninstall') ); // Init the options if there is a version change just in case there were any changes. if (version_compare(self::$instance->options->getVersion(), CN_CURRENT_VERSION) < 0) { self::$instance->initOptions(); } //self::$instance->options->setDBVersion('0.1.9'); self::$instance->options->saveOptions(); do_action('cn_loaded'); } return self::$instance; }