PHP Class The_SEO_Framework\Site_Options

Handles Site Options for the plugin.
Since: 2.7.1
Inheritance: extends Sanitize
Mostra file Open project: sybrew/the-seo-framework

Public Properties

Property Type Description
$seo_settings_page_slug Hold the SEO Settings Page ID for this plugin.

Protected Properties

Property Type Description
$o_plugin_updated Holds the update option.
$settings_field Site Settings field.

Public Methods

Method Description
fb_locales ( ) : array Returns Facebook locales array values.
get_all_options ( string $setting = null ) : array Return current option array.
get_default_option ( string $key, boolean $use_cache = true ) : mixed Return Default SEO options from the SEO options array.
get_default_settings ( string $key, string $setting = '', boolean $use_cache = true ) : integer | boolean | string Get the default of any of the The SEO Framework settings.
get_default_site_options ( ) : array Holds default site options.
get_option ( string $key, boolean $use_cache = true ) : mixed Return SEO options from the SEO options database.
get_site_option ( string $key, boolean $use_cache = true ) : mixed Return SEO options from the SEO options database.
get_user_id ( ) : integer Sets up user ID and returns it if user is found.
get_user_meta ( integer $user_id, string $key = THE_SEO_FRAMEWORK_USER_OPTIONS, boolean $use_cache = true ) : array Fetches The SEO Framework usermeta.
get_user_option ( integer $user_id, string $option, mixed $default = null ) : mixed Fetches user SEO user meta data by name.
get_warned_settings ( string $key, string $setting = '', boolean $use_cache = true ) : integer Get the warned setting of any of the The SEO Framework settings.
get_warned_site_options ( ) : array Holds warned site options array.
language_keys ( ) : array Returns Facebook locales array keys.
register_settings ( ) : void Register the database settings for storage.
site_updated_plugin_notice ( ) Echos plugin updated notification.
site_updated_plugin_option ( ) : void Updates option from default options at plugin update.
the_seo_framework_get_option ( string $key, string $setting = null, boolean $use_cache = true ) : mixed Return option from the options table and cache result.
update_settings ( string | array $new = '', string $settings_field = '' ) Allows updating of settings.
update_user_option ( integer $user_id, string $option, mixed $value ) : boolean Updates user SEO option.

Protected Methods

Method Description
__construct ( ) Constructor, load parent constructor and set up cachable variables.
default_site_options ( array $args = [] ) : array Return the parsed default options array.
pre_output_site_updated_plugin_notice ( ) Determine whether to output update notice directly or on refresh.
update_hidden_options_to_default ( ) Updates special hidden values to default on settings save.
warned_site_options ( array $args = [] ) : array Return the Warned site options. Options which should be 'avoided' return true.

Method Details

__construct() protected method

Constructor, load parent constructor and set up cachable variables.
protected __construct ( )

default_site_options() protected method

Return the parsed default options array.
Since: 2.2.7 Applies filters the_seo_framework_default_site_options : The default site options array.
protected default_site_options ( array $args = [] ) : array
$args array Additional default options to filter.
return array The SEO Framework Options

fb_locales() public method

Returns Facebook locales array values.
See also: https://www.facebook.com/translations/FacebookLocales.xml
Since: 2.5.2
public fb_locales ( ) : array
return array Valid Facebook locales

get_all_options() public method

Return current option array.
Since: 2.6.0
public get_all_options ( string $setting = null ) : array
$setting string The setting key.
return array Options.

get_default_option() public method

Return Default SEO options from the SEO options array.
Since: 2.2.5
public get_default_option ( string $key, boolean $use_cache = true ) : mixed
$key string Option name.
$use_cache boolean Optional. Whether to use the cache value or not. Defaults to true.
return mixed The value of this $key in the database.

get_default_settings() public method

Get the default of any of the The SEO Framework settings.
Since: 2.2.4
public get_default_settings ( string $key, string $setting = '', boolean $use_cache = true ) : integer | boolean | string
$key string required The option name
$setting string optional The settings field
$use_cache boolean optional Use the options cache or not. For debugging purposes.
return integer | boolean | string default option int '-1' if option doesn't exist.

get_default_site_options() public method

Holds default site options.
Since: 2.6.0
public get_default_site_options ( ) : array
return array Default site options.

get_option() public method

Return SEO options from the SEO options database.
Since: 2.2.2
public get_option ( string $key, boolean $use_cache = true ) : mixed
$key string Option name.
$use_cache boolean Optional. Whether to use the cache value or not. Defaults to true.
return mixed The value of this $key in the database.

get_site_option() public method

Return SEO options from the SEO options database.
Since: 2.2.2
public get_site_option ( string $key, boolean $use_cache = true ) : mixed
$key string Option name.
$use_cache boolean Optional. Whether to use the cache value or not. Defaults to true.
return mixed The value of this $key in the database.

get_user_id() public method

To be used in AJAX, back-end and front-end.
Since: 2.7.0
public get_user_id ( ) : integer
return integer $user_id : 0 if user is not found.

get_user_meta() public method

Fetches The SEO Framework usermeta.
Since: 2.7.0
public get_user_meta ( integer $user_id, string $key = THE_SEO_FRAMEWORK_USER_OPTIONS, boolean $use_cache = true ) : array
$user_id integer The user ID.
$key string The user metadata key. Leave empty to fetch all data.
$use_cache boolean Whether to store and use options from cache.
return array The user SEO meta data.

get_user_option() public method

Caches all meta data per $user_id.
Since: 2.7.0
public get_user_option ( integer $user_id, string $option, mixed $default = null ) : mixed
$user_id integer The user ID. When empty, it will try to fetch the current user.
$option string The option name.
$default mixed The default value to return when the data doesn't exist.
return mixed The metadata value.

get_warned_settings() public method

Get the warned setting of any of the The SEO Framework settings.
Since: 2.3.4
public get_warned_settings ( string $key, string $setting = '', boolean $use_cache = true ) : integer
$key string required The option name
$setting string optional The settings field
$use_cache boolean optional Use the options cache or not. For debugging purposes.
return integer 0|1 Whether the option is flagged as dangerous for SEO. int '-1' if option doesn't exist.

get_warned_site_options() public method

Holds warned site options array.
Since: 2.6.0
public get_warned_site_options ( ) : array
return array $options.

language_keys() public method

This is apart from the fb_locales array since there are "duplicated" keys. Use this to compare the numeric key position.
See also: https://www.facebook.com/translations/FacebookLocales.xml
Since: 2.5.2
public language_keys ( ) : array
return array Valid Facebook locale keys

pre_output_site_updated_plugin_notice() protected method

Run before headers are sent.
Since: 2.6.0

register_settings() public method

Register the database settings for storage.
Since: 2.2.2
public register_settings ( ) : void
return void

site_updated_plugin_notice() public method

Echos plugin updated notification.
Since: 2.6.0

site_updated_plugin_option() public method

Updates option from default options at plugin update.
Since: 2.6.0
public site_updated_plugin_option ( ) : void
return void early if already has been updated.

the_seo_framework_get_option() public method

Values pulled from the database are cached on each request, so a second request for the same value won't cause a second DB interaction.
Since: 2.0.0
public the_seo_framework_get_option ( string $key, string $setting = null, boolean $use_cache = true ) : mixed
$key string Option name.
$setting string Optional. Settings field name. Eventually defaults to null if not passed as an argument.
$use_cache boolean Optional. Whether to use the cache value or not. Default is true.
return mixed The value of this $key in the database.

update_hidden_options_to_default() protected method

Updates special hidden values to default on settings save.
Since: 2.6.0

update_settings() public method

Allows updating of settings.
Since: 2.7.0
public update_settings ( string | array $new = '', string $settings_field = '' )
$new string | array The new setting(s).
$settings_field string The Settings Field to update. Defaults to The SEO Framework settings field.

update_user_option() public method

Updates user SEO option.
Since: 2.7.0
public update_user_option ( integer $user_id, string $option, mixed $value ) : boolean
$user_id integer The user ID.
$option string The user's SEO metadata option.
$value mixed The escaped option value.
return boolean True on success. False on failure.

warned_site_options() protected method

Return the Warned site options. Options which should be 'avoided' return true.
Since: 2.3.4 Applies filters 'the_seo_framework_warned_site_options' : array The warned site options array.
protected warned_site_options ( array $args = [] ) : array
$args array Additional warned options to filter.
return array The SEO Framework Warned Options

Property Details

$o_plugin_updated protected_oe property

Holds the update option.
Since: 2.6.0
protected $o_plugin_updated

$seo_settings_page_slug public_oe property

Hold the SEO Settings Page ID for this plugin.
Since: 2.2.2
Since: 2.70 Renamed var from page_id and made public.
public $seo_settings_page_slug

$settings_field protected_oe property

Site Settings field.
Since: 2.2.2
protected $settings_field