/** * Enable * * @return null */ public function actionEnable() { Craft::log(__METHOD__, LogLevel::Info, true); $pluginHandle = craft()->request->getParam('plugin'); $this->pluginService->enable($pluginHandle); $this->redirect(craft()->request->getUrlReferrer()); }
/** * Test the displayScope() function * * @return void */ public function testDisplayScope() { // Setup $type = 'Article'; $this->handler->enable(true)->setType($type); // Test the displayScope() function when the library is enabled $this->assertEquals($this->handler->displayScope(), "vocab='https://schema.org' typeof='{$type}'"); // Test the displayScope() function when the library is disabled $this->assertEquals($this->handler->enable(false)->displayScope(), ""); }
/** * Test the displayScope() function * * @return void * * @since 3.2 */ public function testDisplayScope() { // Setup $type = 'Article'; $this->handler->enable(true)->setType($type); // Test a displayScope() when microdata are enabled $this->assertEquals($this->handler->displayScope(), "itemscope itemtype='https://schema.org/{$type}'"); // Test a displayScope() when microdata are disabled $this->assertEquals($this->handler->displayScope(), "itemscope itemtype='https://schema.org/{$type}'"); }
/** * Enable objects with an enable() method. * * Used as a callback for ElggBatch. * * @todo why aren't these static methods on ElggBatch? * * @param object $object The object to enable * @return bool * @access private */ function elgg_batch_enable_callback($object) { // our db functions return the number of rows affected... return $object->enable() ? true : false; }
/** * Constructor, loads configurations and required classes. * The order in which these items are processed is very * important - do not move items around. * * @access public */ public function __construct($config) { // assign configuration data $this->_config = $config; if (!defined('LOADING_SECTION')) { define('LOADING_SECTION', ''); } // set a few constants define('LS', strtolower(LOADING_SECTION)); define('DS', DIRECTORY_SEPARATOR); $interface = LS; if (is_array($this->config('interface_global_folder_replace'))) { $replace = $this->config('interface_global_folder_replace'); if (array_key_exists(LS, $replace)) { $interface = $replace[LS]; } } define('INTERFACE_PATH', APPLICATION_PATH . DS . strtolower($interface)); if (!defined('INCLUDE_ONLY')) { define('INCLUDE_ONLY', false); } // start the session session_start(); // load all plugins $this->_plugins = $this->parsePluginRegistries(); // run the base class parent::Base(); // check whether or not the config file exists // if not, route to default if (!Bootstrap::checkUserConfigExists()) { $this->router->_selected_module = $this->config('default_module_no_config'); $this->router->_selected_method = $this->config('default_method'); } $this->setVersionConstants(); // set monetary locale setlocale(LC_MONETARY, $this->config('currency_locale')); // load all of the module registry files into a local var $this->_module_registry = $this->parseModuleRegistries(); // load in system libraries / classes $this->loadSystemLibraries(); // identify all model extensions $this->_model_extensions = $this->listModelExtensions(); // load any model extensions $this->loadSystemModelExtensions(); // enable system logging if ($this->config('enable_logging')) { $this->log->enable(); } // throw a db error if the config exists, we're not installing, but the db connection fails if (!$this->db && $this->checkUserConfigExists() && $this->router->module() != "Install_Admin") { trigger_error('General database failure.', E_USER_ERROR); exit; } else { $this->log->write('Database connection is up and running.'); } // Load the selected module and any dependencies unless the system is being included only if (!INCLUDE_ONLY) { $this->loadCurrentModule(); } else { $this->log->write('Skipping loading Application Interface module, INCLUDE_ONLY is true.'); } }