PHP 클래스 The_SEO_Framework\Sanitize

Sanitizes input within the plugin.
부터: 2.7.1
상속: extends Admin_Pages
파일 보기 프로젝트 열기: sybrew/the-seo-framework

공개 메소드들

메소드 설명
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.