Public Member Functions | Static Public Member Functions | Static Protected Member Functions

Options Class Reference

Inheritance diagram for Options:
Collaboration diagram for Options:

List of all members.

Public Member Functions

 __get ($name)
 get_all_options ()
 __set ($name, $value)
 __unset ($name)

Static Public Member Functions

static get ($name, $default_value=null)
static get_group ($prefix)
static set_group ($prefix, $values)
static delete_group ($prefix)
static out ($name)
static set ($name, $value= '')
static delete ($name)
static clear_cache ()

Static Protected Member Functions

static instance ()

Detailed Description

Habari Options Class

Definition at line 11 of file options.php.


Member Function Documentation

Options::__get ( name  ) 

Retrieve an option value

Parameters:
string $name Name of the option to get
Returns:
mixed Stored value for specified option

Definition at line 200 of file options.php.

Options::__set ( name,
value 
)

Applies the option value to the options table

Parameters:
string $name Name of the option to set
mixed $value Value to set

Definition at line 242 of file options.php.

Options::__unset ( name  ) 

Removes an option from the options table

Parameters:
string $name The name of the option

Definition at line 267 of file options.php.

static Options::clear_cache (  )  [static]

Clears memory of cached options

Definition at line 276 of file options.php.

static Options::delete ( name  )  [static]

Shortcut to unset an option in the options table

Parameters:
string|array $name The name of the option or an array of names to delete.

Definition at line 181 of file options.php.

Referenced by __unset(), Update::check_plugins(), delete_group(), and InstallHandler::upgrade_db().

static Options::delete_group ( prefix  )  [static]

Delete a group of options with a specific prefix

Options::delete_group( 'foo' ); // would delete all foo__* option names

Parameters:
string $prefix The prefix to delete

Definition at line 120 of file options.php.

static Options::get ( name,
default_value = null 
) [static]

Shortcut to return the value of an option

$foo = Options::get('foo'); // returns null if the option 'foo' does not exist list($foo, $bar, $baz) = Options::get( array('foo1', 'bar2', 'baz3') ); // useful with array_keys() $bar = Options::get('foo', 'bar'); // returns 'bar' if the option 'foo' does not exist. useful for avoiding if/then blocks to detect unset options

Parameters:
string|array $name The name or an array of names of the option to fetch.
mixed $default_value The value to return for an option if it does not exist.
Returns:
mixed The option requested or an array of requested options, $default_value for each if the option does not exist

Definition at line 38 of file options.php.

Referenced by FileCache::__construct(), HabariDateTime::__static(), AtomHandler::act_introspection(), UserHandler::act_login(), UserHandler::act_password_reset(), CronTab::act_poll_cron(), Charcoal::action_block_content_charcoal_menu(), K2::action_block_content_k2_menu(), Mzingi::action_form_comment(), K2::action_form_comment(), Charcoal::action_form_comment(), Plugins::activate_plugin(), Themes::activate_theme(), FeedbackHandler::add_comment(), CronTab::add_cron(), AtomHandler::add_pagination_links(), K2::add_template_vars(), Charcoal::add_template_vars(), Utils::archive_pages(), Plugins::changed_since_last_activation(), Update::check_plugins(), Post::comment_form(), AtomHandler::create_atom_wrapper(), Plugins::deactivate_plugin(), Error::error_handler(), Error::exception_handler(), Posts::get(), SpamChecker::get_code(), AtomHandler::get_collection(), AdminDashboardHandler::get_dashboard(), get_group(), AdminHandler::get_sysinfo(), Themes::get_theme_dir(), AdminThemesHandler::get_themes(), LogEntry::insert(), Plugins::list_active(), Version::requires_upgrade(), CronTab::run_cron(), FormUI::salted_name(), FlickrSilo::silo_contents(), FlickrSilo::silo_dir(), FlickrSilo::silo_get(), Theme::theme_next_page_link(), Theme::theme_page_selector(), Charcoal::theme_show_tags(), Update::updates_available(), Pluggable::upgrade(), InstallHandler::upgrade_db(), and Utils::WSSE().

Options::get_all_options (  ) 

Fetch all options from the options table into local storage

Definition at line 213 of file options.php.

Referenced by __get(), and __set().

static Options::get_group ( prefix  )  [static]

Fetch a group of options with a specific prefix Useful for plugins that use FormUI to automatically store options with the plugin's prefix.

Parameters:
string $prefix The prefix to fetch
Returns:
array An associative array of all options with that prefix

Definition at line 63 of file options.php.

Referenced by Charcoal::action_theme_activated(), and Charcoal::add_template_vars().

static Options::instance (  )  [static, protected]

Enables singleton working properly

See also:
singleton.php

Reimplemented from Singleton.

Definition at line 20 of file options.php.

Referenced by clear_cache(), get(), out(), and set().

static Options::out ( name  )  [static]

Shortcut to output the value of an option

Options::out('foo');

Parameters:
string $name Name of the option to output

Definition at line 144 of file options.php.

Referenced by Undelete::action_template_header(), and HiEngineParser::hi_command().

static Options::set ( name,
value = '' 
) [static]

function set Shortcut to set the value of an option

Options::set('foo', 'newvalue'); Options::set( array( 'foo' => 'bar', 'baz' => 'qux' ) );

Parameters:
string|array $name Name of the option to set or an array of name => value options to set.
mixed $value New value of the option to store. If first parameter is an array, $value is ignored.

Definition at line 161 of file options.php.

Referenced by CronTab::act_poll_cron(), Undelete::action_plugin_activation(), FlickrSilo::action_plugin_ui_confirm(), FlickrSilo::action_plugin_ui_deauthorize(), Plugins::activate_plugin(), Themes::activate_theme(), CronTab::add_cron(), Plugins::check_every_plugin_syntax(), Modules::commit(), Update::cron(), Plugins::deactivate_plugin(), CronTab::run_cron(), FormControl::save(), Version::save_dbversion(), set_group(), Plugins::set_present(), Pluggable::upgrade(), and InstallHandler::upgrade_db().

static Options::set_group ( prefix,
values 
) [static]

Set a group of options with a specific prefix

Options::set_group( 'foo', array( 'bar' => 'baz', 'qux' => 'quux' ) ); // results in 2 options: foo__bar == baz and foo__qux == quux

Parameters:
string $prefix The prefix to set
array $values An associative array of all options to be set with that prefix

Definition at line 94 of file options.php.

Referenced by Charcoal::action_theme_activated().


The documentation for this class was generated from the following file: