PHP Класс The_SEO_Framework\Sanitize

Sanitizes input within the plugin.
С версии: 2.7.1
Наследование: extends Admin_Pages
Показать файл Открыть проект

Открытые методы

Метод Описание
add_filter ( string $filter, string $option, array | string $suboption = null ) : boolean Add sanitization filters to options.
autodescription_add_option_filter ( string $filter, string $option, string | array $suboption = null ) : true Registers option sanitation filter
s_excerpt ( string $excerpt = '' ) : string Escapes input excerpt.
sanitize ( mixed $new_value, string $option ) : mixed Sanitize a value, via the sanitization filter type associated with an option.
sanitizer_filters ( ) Register each of the settings with a sanitization filter type.
verify_seo_settings_nonce ( ) : boolean Checks the SEO Settings page nonce. Returns false if nonce can't be found.

Защищенные методы

Метод Описание
__construct ( ) Constructor, load parent constructor
do_filter ( string $filter, string $new_value, string $old_value ) : mixed Checks sanitization filter exists, and if so, passes the value through it.
get_available_filters ( ) : array Return array of known sanitization filter types.
get_option_filters ( ) : array Returns sanitation filters from cache.
s_absint ( mixed $new_value ) : integer Returns a positive integer value.
s_description ( string $new_value ) : string Returns a one-line sanitized description
s_description_separator ( mixed $new_value ) : string Returns the description separator value string.
s_email_address ( string $new_value ) : string Makes Email Addresses safe, via sanitize_email()
s_knowledge_type ( mixed $new_value ) : string Returns the knowledge type value string.
s_left_right ( mixed $new_value ) : string Returns left or right, for the separator location.
s_left_right_home ( mixed $new_value ) : string Returns left or right, for the home separator location.
s_no_html ( string $new_value ) : string Removes HTML tags from string.
s_no_html_space ( string $new_value ) : string Removes HTML tags and line breaks from string.
s_one_zero ( mixed $new_value ) : integer Returns a 1 or 0, for all truthy / falsy values.
s_one_zero_flush_rewrite ( mixed $new_value ) : integer Returns a 1 or 0, for all truthy / falsy values.
s_one_zero_flush_sitemap ( mixed $new_value ) : integer Returns a 1 or 0, for all truthy / falsy values.
s_redirect_url ( string $new_value ) : string Sanitize the Redirect URL
s_relative_url ( string $url ) : string Converts full URL paths to absolute paths.
s_safe_html ( string $new_value ) : string Removes unsafe HTML tags, via wp_kses_post().
s_title ( string $new_value ) : string Returns a sanitized and trimmed title.
s_title_separator ( mixed $new_value ) : string Returns the title separator value string.
s_twitter_card ( string $new_value ) : string Parses Twitter Card radio input. Fills in default if incorrect value is supplied.
s_twitter_name ( string $new_value ) : string Parses Twitter name and site. Adds @ if it wasn't supplied.
s_url ( string $new_value ) : string Makes URLs safe
s_url_query ( string $new_value ) : string Makes URLs safe and removes query args.
set_option_filter ( string $filter, string $option, array | string $suboption = null, boolean $get = false ) : boolean Sets sanitation filters cache.

Описание методов

__construct() защищенный Метод

Constructor, load parent constructor
protected __construct ( )

add_filter() публичный Метод

Associates a sanitization filter to each option (or sub options if they exist) before adding a reference to run the option through that sanitizer at the right time.
С версии: 2.2.2
С версии: 2.7.0: Uses external caching function.
public add_filter ( string $filter, string $option, array | string $suboption = null ) : boolean
$filter string Sanitization filter type
$option string Option key
$suboption array | string Optional. Suboption key
Результат boolean Returns true when complete

autodescription_add_option_filter() публичный Метод

Registers option sanitation filter
С версии: 2.2.2
С версии: 2.7.0 : No longer used internally.
public autodescription_add_option_filter ( string $filter, string $option, string | array $suboption = null ) : true
$filter string The filter to call (see The_SEO_Framework_Site_Options::$available_filters for options)
$option string The WordPress option name
$suboption string | array Optional. The suboption or suboptions you want to filter
Результат true

do_filter() защищенный Метод

Checks sanitization filter exists, and if so, passes the value through it.
С версии: 2.2.2
protected do_filter ( string $filter, string $new_value, string $old_value ) : mixed
$filter string Sanitization filter type
$new_value string New value
$old_value string Previous value
Результат mixed Returns filtered value, or submitted value if value is unfiltered.

get_available_filters() защищенный Метод

Array can be filtered via 'the_seo_framework_available_sanitizer_filters' to let themes and other plugins add their own sanitization filters.
С версии: 2.2.2
protected get_available_filters ( ) : array
Результат array Array with keys of sanitization types, and values of the filter function name as a callback

get_option_filters() защищенный Метод

Returns sanitation filters from cache.
С версии: 2.7.0
protected get_option_filters ( ) : array
Результат array Filters with their associated (sub)options.

s_absint() защищенный Метод

Returns a positive integer value.
С версии: 2.2.2
protected s_absint ( mixed $new_value ) : integer
$new_value mixed Should ideally be a positive integer.
Результат integer Positive integer.

s_description() защищенный Метод

Returns a one-line sanitized description
С версии: 2.5.0
С версии: 2.6.6 Removes duplicated spaces.
protected s_description ( string $new_value ) : string
$new_value string The Description.
Результат string One line sanitized description.

s_description_separator() защищенный Метод

Returns the description separator value string.
С версии: 2.2.2
protected s_description_separator ( mixed $new_value ) : string
$new_value mixed Should be identical to any of the $this->description_separator values
Результат string Description separator option

s_email_address() защищенный Метод

Makes Email Addresses safe, via sanitize_email()
С версии: 2.2.2
protected s_email_address ( string $new_value ) : string
$new_value string String, an email address, possibly unsafe.
Результат string String a safe email address

s_excerpt() публичный Метод

Escapes input excerpt.
С версии: 2.7.1
public s_excerpt ( string $excerpt = '' ) : string
$excerpt string the Excerpt.
Результат string The escaped Excerpt.

s_knowledge_type() защищенный Метод

Returns the knowledge type value string.
С версии: 2.2.8
protected s_knowledge_type ( mixed $new_value ) : string
$new_value mixed Should be identical to any of the $person_organization values.
Результат string title Knowledge type option

s_left_right() защищенный Метод

Returns left or right, for the separator location.
С версии: 2.2.2
protected s_left_right ( mixed $new_value ) : string
$new_value mixed Should ideally be a string 'left' or 'right' passed in.
Результат string left or right

s_left_right_home() защищенный Метод

Returns left or right, for the home separator location.
С версии: 2.5.2
protected s_left_right_home ( mixed $new_value ) : string
$new_value mixed Should ideally be a string 'left' or 'right' passed in.
Результат string left or right

s_no_html() защищенный Метод

Removes HTML tags from string.
С версии: 2.2.2
protected s_no_html ( string $new_value ) : string
$new_value string String, possibly with HTML in it.
Результат string String without HTML in it.

s_no_html_space() защищенный Метод

Removes HTML tags and line breaks from string.
С версии: 2.5.2
protected s_no_html_space ( string $new_value ) : string
$new_value string String, possibly with HTML and spaces in it.
Результат string String without HTML and breaks in it.

s_one_zero() защищенный Метод

Uses double casting. First, we cast to bool, then to integer.
С версии: 2.2.2
protected s_one_zero ( mixed $new_value ) : integer
$new_value mixed Should ideally be a 1 or 0 integer passed in.
Результат integer 1 or 0.

s_one_zero_flush_rewrite() защищенный Метод

Uses double casting. First, we cast to bool, then to integer. Also flushes rewrite rules.
С версии: 2.2.9
protected s_one_zero_flush_rewrite ( mixed $new_value ) : integer
$new_value mixed Should ideally be a 1 or 0 integer passed in.
Результат integer 1 or 0.

s_one_zero_flush_sitemap() защищенный Метод

Uses double casting. First, we cast to bool, then to integer. Also flushes the sitemap.
С версии: 2.2.9
protected s_one_zero_flush_sitemap ( mixed $new_value ) : integer
$new_value mixed Should ideally be a 1 or 0 integer passed in.
Результат integer 1 or 0.

s_redirect_url() защищенный Метод

Sanitize the Redirect URL
С версии: 2.2.4
protected s_redirect_url ( string $new_value ) : string
$new_value string String with potentially unwanted redirect URL.
Результат string The Sanitized Redirect URL

s_relative_url() защищенный Метод

Removes the http or https protocols and the domain. Keeps the path '/' at the beginning, so it isn't a true relative link, but from the web root base.
С версии: 2.6.5
protected s_relative_url ( string $url ) : string
$url string Full Path URL or relative URL.
Результат string Abolute path.

s_safe_html() защищенный Метод

Removes unsafe HTML tags, via wp_kses_post().
С версии: 2.2.2
protected s_safe_html ( string $new_value ) : string
$new_value string String with potentially unsafe HTML in it.
Результат string String with only safe HTML in it

s_title() защищенный Метод

Returns a sanitized and trimmed title.
С версии: 2.5.2
protected s_title ( string $new_value ) : string
$new_value string The Title.
Результат string Sanitized and trimmed title.

s_title_separator() защищенный Метод

Returns the title separator value string.
С версии: 2.2.2
protected s_title_separator ( mixed $new_value ) : string
$new_value mixed Should be identical to any of the $this->get_separator_list() values
Результат string Title separator option

s_twitter_card() защищенный Метод

Falls back to previous value if empty. If previous value is empty if will go to default.
С версии: 2.5.2
protected s_twitter_card ( string $new_value ) : string
$new_value string String with potentially wrong option value.
Результат string Sanitized twitter card type.

s_twitter_name() защищенный Метод

Parses URL to path and adds @ if URL is given.
С версии: 2.2.2
protected s_twitter_name ( string $new_value ) : string
$new_value string String with potentially wrong Twitter username.
Результат string String with 'correct' Twitter username

s_url() защищенный Метод

Makes URLs safe
С версии: 2.2.2
protected s_url ( string $new_value ) : string
$new_value string String, a URL, possibly unsafe.
Результат string String a safe URL without Query Arguments.

s_url_query() защищенный Метод

Makes URLs safe and removes query args.
С версии: 2.2.8
protected s_url_query ( string $new_value ) : string
$new_value string String, a URL, possibly unsafe.
Результат string String a safe URL with Query Arguments.

sanitize() публичный Метод

Sanitize a value, via the sanitization filter type associated with an option.
С версии: 2.2.2
public sanitize ( mixed $new_value, string $option ) : mixed
$new_value mixed New value
$option string Name of the option
Результат mixed Filtered, or unfiltered value

sanitizer_filters() публичный Метод

Register each of the settings with a sanitization filter type.
См. также: The_SEO_Framework_Sanitize::add_filter() Add sanitization filters to options.
С версии: 2.2.2
public sanitizer_filters ( )

set_option_filter() защищенный Метод

Associates a sanitization filter to each option (or sub options if they exist) before adding a reference to run the option through that sanitizer at the right time.
С версии: 2.7.0
protected set_option_filter ( string $filter, string $option, array | string $suboption = null, boolean $get = false ) : boolean
$filter string Sanitization filter type
$option string Option key
$suboption array | string Optional. Suboption key
$get boolean Whether to retrieve cache.
Результат boolean Returns true when complete

verify_seo_settings_nonce() публичный Метод

Performs wp_die() when nonce verification fails. Never run a sensitive function when it's returning false. This means no nonce can be verified.
С версии: 2.7.0
public verify_seo_settings_nonce ( ) : boolean
Результат boolean True if verified and matches. False if can't verify.