コード例 #1
0
 public function deleteAction()
 {
     $app = App::getInstance();
     $id = (int) $app->getUrlParam('id');
     Options::delete($id);
     $app->redirect(__HOME__ . '/options/');
 }
コード例 #2
0
 public function action_plugin_deactivation($file)
 {
     // remove all the posts
     $this->update_num_posts(0);
     // delete the option
     Options::delete('lipsum__num_posts');
 }
コード例 #3
0
ファイル: piwik.plugin.php プロジェクト: habari-extras/piwik
 /**
  * Remove options on deactivation.
  */
 public function action_plugin_deactivation()
 {
     Options::delete('piwik__siteurl');
     Options::delete('piwik__sitenum');
     Options::delete('piwik__trackloggedin');
     Options::delete('piwik__auth_token');
 }
コード例 #4
0
 public function action_plugin_deactivation($file = '')
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         CronTab::delete_cronjob('optimize database tables initial');
         CronTab::delete_cronjob('optimize database tables');
         Options::delete('database_optimizer__frequency');
     }
 }
コード例 #5
0
 /**
  * Remove options when the plugin is deactivated
  */
 public function action_plugin_deactivation($file)
 {
     if (realpath($file) == __FILE__) {
         Options::delete(self::OPTION_NAME . '__text', _t("We're down for maintenance. Please return later."));
         Options::delete(self::OPTION_NAME . '__in_maintenance', FALSE);
         Options::delete(self::OPTION_NAME . '__display_feeds', FALSE);
     }
 }
コード例 #6
0
 /**
  * Remove notify_all options on deactivation
  */
 public function action_plugin_deactivation($file)
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         Options::delete('notify_all__notify_posts');
         Options::delete('notify_all__notify_comments');
         Options::delete('notify_all__user_can_override');
     }
 }
コード例 #7
0
 /**
  * Deletes all options
  *
  * @return bool Returns `true` of the options were deleted, `false` otherwise
  * @api
  */
 public function delete()
 {
     if (!parent::delete()) {
         return false;
     }
     $result = delete_option($this->name);
     if ($result !== false) {
         $this->_invalidateOptions();
     }
     return $result;
 }
コード例 #8
0
 public function action_plugin_deactivation($file)
 {
     if (realpath($file) == __FILE__) {
         Options::delete('getclicky__siteid');
         Options::delete('getclicky__sitekey');
         Options::delete('getclicky__sitedb');
         Options::delete('getclicky__loggedin');
         Options::delete('getclicky__cachetime');
         $this->clearCache();
         Modules::remove_by_name('GetClicky');
     }
 }
コード例 #9
0
ファイル: test_cron.php プロジェクト: habari/tests
 public function test_delete_on_fail()
 {
     $job = CronTab::add_single_cron('test_delete_fail', 'this_cron_hook_doesnt_exist', DateTime::create(), 'Test Cron');
     for ($z = 0; $z < 10; $z++) {
         $job = CronTab::get_cronjob('test_delete_fail');
         Options::set('next_cron', 0);
         Options::delete('cron_running');
         $job->execute();
     }
     $this->assert_false($job->active, 'The cron is still active after failing more than the allowed number of times.');
     CronTab::delete_cronjob('test_delete_fail');
 }
コード例 #10
0
 public function action_plugin_deactivation($file = '')
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         ACL::destroy_token('snapshot');
         // wipe out the default options we added
         Options::delete('exportsnapshot__frequency');
         Options::delete('exportsnapshot__type');
         // remove the module
         Modules::remove_by_name(_t('Snapshots', 'exportsnapshot'));
         // @todo what about the snapshots option and deleting those cached items?
         // probably an uninstall method too?
     }
 }
コード例 #11
0
 /**
  * Plugin activation function. Remove all information created by this plugin.
  * @param string $file the plugin being activated.
  */
 function action_plugin_deactivation($file)
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         // Avoid breaking in the middle of the operation
         $time_limit = ini_get('time_limit');
         ini_set('time_limit', 0);
         // Destroy all data
         $this->populate_users_remove();
         $this->populate_groups_remove();
         $this->populate_tokens_remove();
         ini_set('time_limit', $time_limit);
         // Delete all options created by this plugin.
         Options::delete('populate__tokens');
         Options::delete('populate__groups');
         Options::delete('populate__users');
     }
 }
コード例 #12
0
 /**
  * Run update version 0.
  *
  * @param array  $options    Options.
  * @param string $db_version Option version.
  */
 protected function version_0($options = [], $db_version = '0')
 {
     if (!empty($options) && version_compare('0', $db_version, '==')) {
         $transient_key = 'vasocialbuzz_push7_register_url';
         $transient = get_transient($transient_key);
         $old_options = $options;
         $new_options = ['db_version' => VA_SOCIALBUZZ_VERSION_DB, 'fb_page' => $old_options['fb_page'], 'fb_appid' => $old_options['fb_appid'], 'twttr_name' => $old_options['tw_account'], 'text_like_0' => $old_options['text']['like'][0], 'text_like_1' => $old_options['text']['like'][1], 'text_share' => $old_options['text']['share'], 'text_tweet' => $old_options['text']['tweet'], 'text_follow' => $old_options['text']['follow'], 'like_area_bg' => $old_options['like_button_area']['bg'], 'like_area_color' => $old_options['like_button_area']['color'], 'post_types' => $old_options['post_type']];
         if (Functions::exists_push7()) {
             $new_options['text_push7'] = $old_options['text']['push7'];
         }
         if (Functions::exists_bcadd()) {
             $new_options['like_area_opacity'] = $old_options['like_button_area']['bg_opacity'];
         }
         if (false !== $transient) {
             delete_transient($transient_key);
         }
         Options::delete();
         Options::update($new_options);
     }
 }
コード例 #13
0
ファイル: test_formui.php プロジェクト: psaintlaurent/Habari
 function teardown()
 {
     Options::delete('test__username');
     Options::delete('test__about');
 }
コード例 #14
0
 public function upgrade_pre_004()
 {
     DB::register_table('blogroll');
     DB::register_table('bloginfo');
     DB::register_table('tag2blog');
     if (!in_array(DB::table('blogroll'), DB::list_tables())) {
         Options::set('blogroll__api_version', self::API_VERSION);
         return;
     }
     Post::add_new_type(self::CONTENT_TYPE);
     $opml = new \SimpleXMLElement('<opml version="1.1"></opml>');
     $head = $opml->addChild('head');
     $head->addChild('title', Options::get('title'));
     $head->addChild('dateCreated', gmdate('D, d M Y G:i:s e'));
     $body = $opml->addChild('body');
     $blogs = DB::get_results("SELECT * FROM {blogroll}", array());
     foreach ($blogs as $blog) {
         $outline = $body->addChild('outline');
         $outline->addAttribute('text', $blog->name);
         $outline->addAttribute('htmlUrl', $blog->url);
         $outline->addAttribute('xmlUrl', $blog->feed);
         $outline->addAttribute('relation', $blog->rel);
         $outline->addAttribute('updated', $blog->updated);
         $outline->addAttribute('content', $blog->description);
         $outline->addAttribute('type', 'link');
     }
     try {
         $count = $this->import_opml($opml->body);
         DB::query('DROP TABLE IF EXISTS {blogroll}');
         DB::query('DROP TABLE IF EXISTS {bloginfo}');
         DB::query('DROP TABLE IF EXISTS {tag2blog}');
         EventLog::log(sprintf(_n('Imported %d blog from previous Blogroll version, and removed obsolete tables', 'Imported %d blogs from previous Blogroll version, and removed obsolete tables', $count, self::DOMAIN), $count));
     } catch (\Exception $e) {
         EventLog::log(_t('Could not Import previous data. please import manually and drop tables.', self::DOMAIN));
     }
     Options::delete('blogroll__db_version');
     Options::set('blogroll__api_version', self::API_VERSION);
     Options::set('blogroll__sort_by', 'id');
 }
コード例 #15
0
 /**
  * Processes the 'option edit' form
  *
  * @param FormUI $form
  * @return bool TRUE on success, FALSE on failure
  */
 public function formui_submit_edit(FormUI $form)
 {
     if (strlen($form->option_name->value) < 1) {
         Session::error(_t('The "option_name" requires a value'));
         return FALSE;
     }
     if (strlen($form->option_value->value) < 1) {
         Session::error(_t('The "option_value" requires a value'));
         return FALSE;
     }
     if (strlen($form->current_option_name->value) < 1) {
         Session::error(_t('The current/old "option_name" is missing'));
         return FALSE;
     }
     $_opt_curr = $this->get_option_from_name($form->current_option_name->value);
     Options::set($form->option_name->value, $form->option_value->value);
     // @todo okay? what if option type = serialized? research later
     $success = Options::get($form->option_name->value);
     if (is_null($success) || $success !== $form->option_value->value) {
         Session::error(_t('The "%s" option failed to edit', array($form->option_name->value)));
     } else {
         // The name was changed, so delete the old, depending on if we're allowed
         if ($form->current_option_name->value !== $form->option_name->value) {
             if ($this->is_option_genre_delete_allowed($_opt_curr['genre'])) {
                 Options::delete($form->current_option_name->value);
                 $message = 'The "%s" option name was changed and renamed to "%s"';
             } else {
                 $message = 'The "%s" option name could not be renamed, but a new option named "%s" was added';
             }
             Session::notice(_t($message, array($form->current_option_name->value, $form->option_name->value)));
             EventLog::log(_t($message, array($form->current_option_name->value, $form->option_name->value)), 'notice', 'plugin');
         } else {
             Session::notice(_t('The "%s" option was edited to %s', array($form->option_name->value, $form->option_value->value)));
             EventLog::log(_t('The %s option was edited', array($form->option_name->value)), 'notice', 'plugin');
         }
     }
     Utils::redirect(URL::get('admin', array('page' => 'options_view')), TRUE);
     return TRUE;
 }
コード例 #16
0
 public function action_plugin_deactivation($file)
 {
     Options::delete('acronyms__acronyms');
 }
コード例 #17
0
 /**
  * Run uninstall.
  */
 public function run()
 {
     Options::delete();
     delete_transient(VA_SOCIALBUZZ_PREFIX . 'push7_register_url');
 }
コード例 #18
0
ファイル: options.php プロジェクト: habari/system
 /**
  * Shortcut to unset an option in the options table
  *
  * @param string|array $name The name of the option or an array of names to delete.
  */
 public static function delete($name)
 {
     if (is_array($name)) {
         foreach ($name as $key) {
             Options::delete($key);
             // recursively wrap around ourselves!
         }
     } else {
         unset(self::instance()->{$name});
     }
 }
コード例 #19
0
 /**
  * Deactivation; removes the Options key
  */
 public function action_plugin_deactivation($file)
 {
     Options::delete(self::OPTIONS_LOCALPATH);
 }
コード例 #20
0
 /**
  * Process posting data
  */
 public function postProcess()
 {
     $languages = Language::getLanguages(false);
     $current_theme = Theme::getThemeInfo($this->context->shop->id_theme);
     //$theme_arr['theme_id'] = $theme->id;
     //		$theme_arr['theme_name'] = $theme->name;
     //		$theme_arr['theme_directory'] = $theme->directory;
     if (Tools::isSubmit('submitnewOption')) {
         $id_option = Tools::getValue('id_option');
         if ($id_option && Validate::isUnsignedId($id_option)) {
             $option = new Options($id_option);
             $addaction = false;
         } else {
             $option = new Options();
             $addaction = true;
         }
         $option->column = Tools::getValue('colselected');
         $option->theme = strtolower($current_theme['theme_name']);
         $option->alias = Tools::getValue('alias');
         $option->active = (int) Tools::getValue('active');
         $name_set = false;
         $option_name = Tools::getValue('option_name');
         if (strlen($option_name) > 0) {
             $name_set = true;
             $option->name = $option_name;
         }
         if (!$name_set) {
             $lang_title = Language::getLanguage($this->context->language->id);
             $this->errors[] = Tools::displayError('This item title field is required');
         }
         if (strlen($option->alias) > 0) {
             if (OvicLayoutControl::isAvailablebyAlias($option->alias) > 0) {
                 $this->errors[] = Tools::displayError('Alias is avaiable in database');
             }
         } else {
             $this->errors[] = Tools::displayError('This item alias field is required');
         }
         if (isset($_FILES['option_img']) && strlen($_FILES['option_img']['name']) > 0) {
             $img_name = time() . $_FILES['option_img']['name'];
             $img_name = preg_replace('/[^A-Za-z0-9\\-.]/', '', $img_name);
             // Removes special chars.
             //_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $this->name .DIRECTORY_SEPARATOR
             $main_name = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'oviclayoutcontrol' . DIRECTORY_SEPARATOR . 'thumbnails' . DIRECTORY_SEPARATOR . $img_name;
             if (!move_uploaded_file($_FILES['option_img']['tmp_name'], $main_name)) {
                 $this->errors[] = Tools::displayError('An error occurred during the image upload.');
             } else {
                 $option->image = $img_name;
                 if (Tools::getValue('old_img') != '') {
                     $filename = Tools::getValue('old_img');
                     if (file_exists(_PS_MODULE_DIR_ . 'oviclayoutcontrol/thumbnails/' . $filename)) {
                         @unlink(_PS_MODULE_DIR_ . 'oviclayoutcontrol/thumbnails/' . $filename);
                     }
                 }
             }
         } else {
             $option->image = Tools::getValue('old_img');
         }
         if (!count($this->errors)) {
             if ($addaction) {
                 if (!$option->add()) {
                     $this->errors[] = Tools::displayError('An error occurred while saving data.');
                 } else {
                     if (Tools::getIsset('id_copy_option')) {
                         $id_copy_option = (int) Tools::getValue('id_copy_option');
                         $source_option = new Options($id_copy_option);
                         OvicLayoutControl::copyHookModule($source_option, $option);
                         OvicLayoutControl::copyOptionStyle($source_option, $option);
                     } else {
                         OvicLayoutControl::registerDefaultHookModule($option->id);
                     }
                 }
             } else {
                 if (!$option->update()) {
                     $this->errors[] = Tools::displayError('An error occurred while update data.');
                 }
             }
             if (!count($this->errors)) {
                 Tools::redirectAdmin(self::$currentIndex . '&conf=3&token=' . Tools::getValue('token'));
             }
         }
     } elseif (Tools::isSubmit('changeactive')) {
         $id_option = Tools::getValue('id_option');
         if ($id_option && Validate::isUnsignedId($id_option)) {
             $option = new Options($id_option);
             $option->active = !$option->active;
             if (!$option->update()) {
                 $this->errors[] = Tools::displayError('Could not change');
             } else {
                 Tools::redirectAdmin(self::$currentIndex . '&conf=5&token=' . Tools::getValue('token'));
             }
         }
     } elseif (Tools::isSubmit('removeoption')) {
         $id_option = Tools::getValue('id_option');
         if ($id_option && Validate::isUnsignedId($id_option)) {
             $option = new Options($id_option);
             if (!$option->delete()) {
                 $this->errors[] = Tools::displayError('An error occurred during deletion');
             } else {
                 Tools::redirectAdmin(self::$currentIndex . '&conf=1&token=' . Tools::getValue('token'));
             }
         }
     } elseif (Tools::isSubmit('submitMultiSave')) {
         $id_option = (int) Tools::getValue('id_option');
         if ($id_option && Validate::isUnsignedId($id_option)) {
             $fonts = array();
             foreach (OvicLayoutControl::$OptionFonts as $font) {
                 $fonts[$font] = Tools::getValue($font);
             }
             $colors = array();
             foreach (OvicLayoutControl::$OptionColors as $color) {
                 $colors[$color] = Tools::getValue($color);
             }
             $option = new Options($id_option);
             $where = "`theme` = '" . $option->theme . "' AND `alias` = '" . $option->alias . "'";
             $sql = 'SELECT `alias`
     			FROM `' . _DB_PREFIX_ . 'ovic_options_style` 
     			 WHERE ' . $where;
             if (Db::getInstance()->getRow($sql)) {
                 $result = Db::getInstance()->update('ovic_options_style', array('color' => Tools::jsonEncode($colors), 'font' => Tools::jsonEncode($fonts)), $where);
             } else {
                 // Register module in hook
                 $result = Db::getInstance()->insert('ovic_options_style', array('theme' => $option->theme, 'alias' => $option->alias, 'color' => Tools::jsonEncode($colors), 'font' => Tools::jsonEncode($fonts)));
             }
             if ($result) {
                 Tools::redirectAdmin(self::$currentIndex . '&conf=4&token=' . Tools::getValue('token') . '&view=detail&id_option=' . $id_option);
             } else {
                 $this->errors[] = Tools::displayError('An error occurred while saving data.');
             }
         }
     }
     parent::postProcess();
 }
コード例 #21
0
 /**
  * Process posting data
  */
 public function postProcess()
 {
     $errors = array();
     $languages = Language::getLanguages(false);
     if (Tools::isSubmit('submitnewOption')) {
         $id_option = Tools::getValue('id_option');
         if ($id_option && Validate::isUnsignedId($id_option)) {
             $option = new Options($id_option);
             $addaction = false;
         } else {
             $option = new Options();
             $addaction = true;
         }
         $option->column = Tools::getValue('colselected');
         $option->active = (int) Tools::getValue('active');
         $name_set = false;
         foreach ($languages as $language) {
             $option_name = Tools::getValue('option_name_' . $language['id_lang']);
             if (strlen($option_name) > 0) {
                 $name_set = true;
             }
             $option->name[$language['id_lang']] = $option_name;
         }
         if (!$name_set) {
             $lang_title = Language::getLanguage($this->context->language->id);
             $errors[] = Tools::displayError('This item title field is required at least in ' . $lang_title['name']);
         }
         if (isset($_FILES['option_img']) && strlen($_FILES['option_img']['name']) > 0) {
             $img_name = time() . $_FILES['option_img']['name'];
             $img_name = preg_replace('/[^A-Za-z0-9\\-.]/', '', $img_name);
             // Removes special chars.
             //_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $this->name .DIRECTORY_SEPARATOR
             $main_name = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'oviclayoutcontrol' . DIRECTORY_SEPARATOR . 'thumbnails' . DIRECTORY_SEPARATOR . $img_name;
             if (!move_uploaded_file($_FILES['option_img']['tmp_name'], $main_name)) {
                 $errors[] = Tools::displayError('An error occurred during the image upload.');
             } else {
                 $option->image = $img_name;
                 if (Tools::getValue('old_img') != '') {
                     $filename = Tools::getValue('old_img');
                     if (file_exists(_PS_MODULE_DIR_ . 'oviclayoutcontrol/thumbnails/' . $filename)) {
                         @unlink(_PS_MODULE_DIR_ . 'oviclayoutcontrol/thumbnails/' . $filename);
                     }
                 }
             }
         } else {
             $option->image = Tools::getValue('old_img');
         }
         if (!count($errors)) {
             if ($addaction) {
                 if (!$option->add()) {
                     $errors[] = Tools::displayError('An error occurred while saving data.');
                 } else {
                     if (Tools::getIsset('id_copy_option')) {
                         $id_copy_option = Tools::getValue('id_copy_option');
                         OvicLayoutControl::copyHookModule($id_copy_option, $option->id);
                     } else {
                         OvicLayoutControl::registerDefaultHookModule($option->id);
                     }
                 }
             } else {
                 if (!$option->update()) {
                     $errors[] = Tools::displayError('An error occurred while update data.');
                 }
             }
             if (!count($errors)) {
                 Tools::redirectAdmin(self::$currentIndex . '&conf=3&token=' . Tools::getValue('token'));
             }
         }
     } elseif (Tools::isSubmit('changeactive')) {
         $id_option = Tools::getValue('id_option');
         if ($id_option && Validate::isUnsignedId($id_option)) {
             $option = new Options($id_option);
             $option->active = !$option->active;
             if (!$option->update()) {
                 $errors[] = Tools::displayError('Could not change');
             } else {
                 Tools::redirectAdmin(self::$currentIndex . '&conf=5&token=' . Tools::getValue('token'));
             }
         }
     } elseif (Tools::isSubmit('removeoption')) {
         $id_option = Tools::getValue('id_option');
         if ($id_option && Validate::isUnsignedId($id_option)) {
             $option = new Options($id_option);
             if (!$option->delete()) {
                 $errors[] = Tools::displayError('An error occurred during deletion');
             } else {
                 Tools::redirectAdmin(self::$currentIndex . '&conf=1&token=' . Tools::getValue('token'));
             }
         }
     } else {
         $this->context->controller->errors = array_merge($this->context->controller->errors, $errors);
     }
     parent::postProcess();
 }
コード例 #22
0
 /**
  * Perform plugin operation
  *
  * @param int $plugin_id The plugin id
  * @param string $action The action to perform
  */
 public function action_plugin_ui($plugin_id, $action)
 {
     $confirm_url = rawurlencode(URL::get('admin', array('page' => 'plugins', 'configure' => $this->plugin_id(), 'configaction' => 'Confirm')) . '#plugin_options');
     $picasa = new Picasa();
     $auth_url = $picasa->get_auth_url() . $confirm_url;
     $deauth_url = URL::get('admin', array('page' => 'plugins', 'configure' => $this->plugin_id(), 'configaction' => 'De-Authorize')) . '#plugin_options';
     if ($plugin_id == $this->plugin_id) {
         switch ($action) {
             case _t('Authorize'):
                 if ($this->is_auth()) {
                     echo "<p>" . _t("This installation has already been authorized to access your Picasa account.") . "</p>";
                     echo "<p><a href='" . $deauth_url . "' title='" . _t("De-Authorize") . "'>" . _t("De-Authorize access to your Picasa account") . "</p>";
                 } else {
                     echo "<p>" . _t("You have not authorized access to your Picasa account") . "</p>";
                     echo "<p><a href='" . $auth_url . "' target='_blank'>" . _t("Authorize") . "</a> " . _t("your Habari installation to access your Picasa account") . "</p>";
                 }
                 break;
             case 'Confirm':
                 if (!isset($_GET['token'])) {
                     echo "<p>" . _t("Your account has not been authorized access to this installation.") . "<p>";
                     echo "<p><a href='" . $auth_url . "' target='_blank'>" . _t("Authorize") . "</a> " . _t("your Habari installation to access your Picasa account.") . "</p>";
                 } else {
                     $token = $_GET['token'];
                     $picasa->exchange_token($token);
                     echo "<p>" . _t("Your authorization was successful.") . "</p>";
                     echo "<p><a href='" . $deauth_url . "' title='" . _t("De-Authorize") . "'>" . _t("De-Authorize access to your Picasa account") . "</p>";
                 }
                 break;
             case _t('De-Authorize'):
                 Options::delete('picasa_token_' . User::identify()->id, $token);
                 echo "<p>" . _t("De-Authorization successful. This installation will no longer be able to access your Picasa account.") . "</p>";
                 echo "<p><a href='" . $auth_url . "' title='" . _t("Authorize") . "' target='_blank'>" . _t("Authorize") . "</a> " . _t("your Habari installation to access your Picasa account") . "</p>";
                 break;
             case _t('Configure'):
                 $ui = new FormUI(strtolower(get_class($this)));
                 $ui->append('select', 'picasa_size', 'option:picasasilo__picasa_size', _t('Default size for images in Posts:'));
                 //I did not _t() the following as it should be replaced. Picasa supports all sizes up to original size.
                 $ui->picasa_size->options = array('s75' => 'Square (75x75)', 's100' => 'Thumbnail (100px)', 's240' => 'Small (240px)', 's500' => 'Medium (500px)', 's1024' => 'Large (1024px)', '' => 'Original Size');
                 $ui->append('submit', 'save', _t('Save'));
                 $ui->set_option('success_message', _t('Options saved'));
                 $ui->out();
                 break;
         }
     }
 }
コード例 #23
0
ファイル: installhandler.php プロジェクト: habari/system
 private function upgrade_db_post_4763()
 {
     // delete the base_url option, which is no longer used
     Options::delete('base_url');
 }
コード例 #24
0
ファイル: test_options.php プロジェクト: habari/tests
 public function test_setMultiplePrefix()
 {
     $options_in = array('one' => 1, 'two' => 2, 'three' => 3);
     Options::set($options_in, $this->prefix);
     foreach ($options_in as $option_in => $value) {
         $option_out = Options::get($this->prefix . $option_in);
         $this->assert_true($option_out != null, 'All options should be set with prefix.');
         $this->assert_equal($value, $option_out, 'Retrieved option value should be what was set.');
     }
     // Clean up
     foreach ($options_in as $option) {
         Options::delete($this->prefix, $option);
     }
 }
コード例 #25
0
 /**
  * Deactivate the plugin and remove the options
  *
  * @param string $file 
  */
 public function action_plugin_deactivation($file)
 {
     Options::delete(self::ENGINE_OPTION);
 }
コード例 #26
0
ファイル: versionTest.php プロジェクト: psaintlaurent/Habari
 public function testSave_dbversion()
 {
     Options::delete('db_version');
     Version::save_dbversion();
     $this->assertEquals(Version::DB_VERSION, Options::get('db_version'));
 }
コード例 #27
0
ファイル: test_pluggable.php プロジェクト: habari/tests
 public function teardown()
 {
     Cache::expire('pluggable_assets');
     Options::delete(array('released_pluggable_assets', 'inactive_pluggable_assets'));
 }
コード例 #28
0
 private function upgrade_db_post_3539()
 {
     // get the global option
     $hide = Options::get('dashboard__hide_spam_count');
     // if it was set to hide, get all our available users and set their info values instead
     if ($hide == true) {
         $users = Users::get();
         foreach ($users as $user) {
             $user->info->dashboard_hide_spam_count = 1;
             $user->update();
         }
     }
     Options::delete('dashboard__hide_spam_count');
     return true;
 }
コード例 #29
0
ファイル: update.php プロジェクト: habari/system
 /**
  * Compare the current set of plugins with those we last checked for updates.
  * This is run by AdminHandler on every page load to make sure we always have fresh data on the dashboard.
  */
 public static function check_plugins()
 {
     // register the beacons
     self::register_beacons();
     // get the list we checked last time
     $checked_list = Options::get('updates_beacons');
     // if the lists are different
     if ($checked_list != self::instance()->beacons) {
         // remove any stored updates, just to avoid showing stale data
         Options::delete('updates_available');
         // schedule an update check the next time cron runs
         CronTab::add_single_cron('update_check_single', Method::create('\\Habari\\Update', 'cron'), DateTime::create()->int, _t('Perform a single check for plugin updates, the plugin set has changed.'));
     }
 }
コード例 #30
0
ファイル: test_version.php プロジェクト: habari/tests
 function test_save_dbversion()
 {
     Options::delete('db_version');
     Version::save_dbversion();
     $this->assert_equal(Version::DB_VERSION, Options::get('db_version'));
 }