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)
 __isset ($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 is_static ($name)

Static Protected Member Functions

static instance ()

Detailed Description

Habari Options Class

Definition at line 12 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 201 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 255 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 284 of file options.php.

static Options::clear_cache (  )  [static]

Clears memory of cached options

Definition at line 293 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 182 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 121 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 39 of file options.php.

Referenced by FileCache::__construct(), Post::__get(), Comments::__get(), DateTime::__static(), Plugins::_autoload(), AtomHandler::act_introspection(), UserHandler::act_password_reset(), CronHandler::act_poll_cron(), Charcoal::action_block_content_charcoal_menu(), Charcoal::action_form_comment(), Plugins::activate_plugin(), Themes::activate_theme(), FeedbackHandler::add_comment(), CronTab::add_cron(), AtomHandler::add_pagination_links(), Charcoal::add_template_vars(), Theme::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(), CronJob::execute(), Posts::filter_posts_get_all_presets(), SpamChecker::get_code(), AtomHandler::get_collection(), AdminDashboardHandler::get_dashboard(), DateTime::get_default_date_format(), DateTime::get_default_time_format(), get_group(), AdminHandler::get_sysinfo(), Themes::get_theme_dir(), AdminThemesHandler::get_themes(), LogEntry::insert(), Plugins::list_active(), UserHandler::login_form(), Version::requires_upgrade(), CronHandler::run_cron(), FlickrSilo::silo_contents(), FlickrSilo::silo_dir(), HabariSilo::silo_get(), FlickrSilo::silo_get(), HabariSilo::silo_put(), Theme::theme_next_page_link(), Theme::theme_page_selector(), Theme::theme_page_title(), 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 224 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 64 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 21 of file options.php.

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

static Options::is_static ( name  )  [static]

Check if an option was set via the config, making it unsettable

Parameters:
string $name The name of the option to check
Returns:
bool True if the option is set in the config

Definition at line 304 of file options.php.

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 145 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 162 of file options.php.

Referenced by Plugins::_autoload(), CronHandler::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(), Update::cron(), Plugins::deactivate_plugin(), CronHandler::run_cron(), 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 95 of file options.php.

Referenced by Charcoal::action_theme_activated().


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