本文整理汇总了PHP中Options::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::delete方法的具体用法?PHP Options::delete怎么用?PHP Options::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAction
public function deleteAction()
{
$app = App::getInstance();
$id = (int) $app->getUrlParam('id');
Options::delete($id);
$app->redirect(__HOME__ . '/options/');
}
示例2: action_plugin_deactivation
public function action_plugin_deactivation($file)
{
// remove all the posts
$this->update_num_posts(0);
// delete the option
Options::delete('lipsum__num_posts');
}
示例3: action_plugin_deactivation
/**
* 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: action_plugin_deactivation
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: action_plugin_deactivation
/**
* 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: action_plugin_deactivation
/**
* 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: delete
/**
* 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: action_plugin_deactivation
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: test_delete_on_fail
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: action_plugin_deactivation
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: action_plugin_deactivation
/**
* 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: version_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: teardown
function teardown()
{
Options::delete('test__username');
Options::delete('test__about');
}
示例14: upgrade_pre_004
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: formui_submit_edit
/**
* 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;
}