PHP Class The_SEO_Framework\Core

Initializes the plugin & Holds plugin core functions.
Since: 2.7.1
ファイルを表示 Open project: sybrew/the-seo-framework

Public Methods

Method Description
__call ( string $name, array $arguments ) : void Handles unapproachable invoked methods.
__get ( $name ) : mixed Handles unapproachable invoked properties.
allow_external_redirect ( ) : boolean Whether to allow external redirect through the 301 redirect option.
code_wrap ( string $content ) : string Mark up content with code tags.
code_wrap_noesc ( string $content ) : string Mark up content with code tags.
current_blog_is_spam_or_deleted ( ) : boolean Whether the current blog is spam or deleted.
description ( string $content, boolean $block = true ) : string Mark up content in description wrap.
description_noesc ( string $content, boolean $block = true ) : string Mark up content in description wrap.
do_dismissible_notice ( $message = '', $type = 'updated', boolean $a11y = true, boolean $escape = true ) Echos generated dismissible notice.
generate_dismissible_notice ( string $message = '', string $type = 'updated', boolean $a11y = true, boolean $escape = true ) : string Generates dismissible notice.
get_custom_field ( string $field, integer $post_id = null ) : string | boolean Return custom field post meta data.
get_the_front_page_ID ( ) : integer Returns the front page ID, if home is a page.
get_timezone_string ( boolean $guess = false ) : string | empty Returns the PHP timezone compatible string.
get_view ( string $view, array $args = [], string $instance = 'main' ) Fetches files based on input to reduce memory overhead.
get_word_count ( string $string, integer $amount = 3, integer $amount_bother = 5, integer $bother_length = 3 ) : array Counts words encounters from input string.
gmt2date ( string $format = 'Y-m-d', string $time = '' ) : string Converts time from GMT input to given format.
is_blog_public ( ) : boolean Checks if blog is public through WordPress core settings.
is_checked ( string $value ) : boolean Checks if the string input is exactly '1'.
is_option_checked ( string $option ) : boolean Checks if the option is used and checked.
maybe_lowercase_noun ( $noun ) : string Whether to lowercase the noun or keep it UCfirst.
object_cache_get ( string $key, string $group = 'the_seo_framework', boolean $force = false, boolean &$found = null ) : mixed Object cache get wrapper.
object_cache_set ( string $key, mixed $data, integer $expire, string $group = 'the_seo_framework' ) : boolean Object cache set wrapper.
plugin_action_links ( array $links = [] ) Adds link from plugins page to SEO Settings page.
post_type_support ( ) Adds post type support for The SEO Framework.
proportionate_dimensions ( integer $i, integer $r1, integer $r2 ) : integer Proportionate dimensions based on Width and Height.
reset_timezone ( ) : boolean Resets the timezone to default or UTC.
seo_settings_page_url ( ) : string Returns the SEO Settings page URL.
set_timezone ( string $tzstring = '', boolean $reset = false ) : boolean Sets and resets the timezone.
settings_capability ( ) : string Returns the minimum role required to adjust settings.

Protected Methods

Method Description
__clone ( ) Cloning of this object is forbidden.
__construct ( ) Constructor. Loads actions and filters.
__wakeup ( ) Unserializing instances of this object is forbidden.
clean_reponse_header ( ) : boolean Destroys output buffer, if any. To be used with AJAX and XML to clear any PHP errors or dumps.
get_tzstring_from_offset ( integer $offset ) : string Fetches the Timezone String from given offset.
get_view_instance ( string $base, string $instance = 'main' ) : string Fetches view instance for switch.
google_language ( ) : string Google docs language determinator.

Method Details

__call() final public method

Handles unapproachable invoked methods.
final public __call ( string $name, array $arguments ) : void
$name string
$arguments array
return void

__clone() final protected method

Cloning of this object is forbidden.
final protected __clone ( )

__construct() protected method

Latest Class. Doesn't have parent.
protected __construct ( )

__get() final public method

Makes sure deprecated properties are still accessible.
Since: 2.7.0
final public __get ( $name ) : mixed
return mixed $var The object variable.

__wakeup() final protected method

Unserializing instances of this object is forbidden.
final protected __wakeup ( )

allow_external_redirect() public method

Whether to allow external redirect through the 301 redirect option.
Since: 2.6.0
public allow_external_redirect ( ) : boolean
return boolean Whether external redirect is allowed.

clean_reponse_header() protected method

Destroys output buffer, if any. To be used with AJAX and XML to clear any PHP errors or dumps.
Since: 2.7.1
protected clean_reponse_header ( ) : boolean
return boolean True on clear. False otherwise.

code_wrap() public method

Escapes all HTML, so < gets changed to < and displays correctly.
Since: 2.0.0
public code_wrap ( string $content ) : string
$content string Content to be wrapped in code tags.
return string Content wrapped in code tags.

code_wrap_noesc() public method

Escapes no HTML.
Since: 2.2.2
public code_wrap_noesc ( string $content ) : string
$content string Content to be wrapped in code tags.
return string Content wrapped in code tags.

current_blog_is_spam_or_deleted() public method

Multisite Only.
Since: 2.6.0
public current_blog_is_spam_or_deleted ( ) : boolean
return boolean Current blog is spam.

description() public method

Escapes all HTML, so < gets changed to < and displays correctly.
Since: 2.7.0
public description ( string $content, boolean $block = true ) : string
$content string Content to be wrapped in the description wrap.
$block boolean Whether to wrap the content in

tags.

return string Content wrapped int he description wrap.

description_noesc() public method

Mark up content in description wrap.
Since: 2.7.0
public description_noesc ( string $content, boolean $block = true ) : string
$content string Content to be wrapped in the description wrap. Expected to be escaped.
$block boolean Whether to wrap the content in

tags.

return string Content wrapped int he description wrap.

do_dismissible_notice() public method

Echos generated dismissible notice.
Since: 2.7.0
public do_dismissible_notice ( $message = '', $type = 'updated', boolean $a11y = true, boolean $escape = true )
$message The notice message. Expected to be escaped if $escape is false.
$type The notice type : 'updated', 'error', 'warning'. Expected to be escaped.
$a11y boolean Whether to add an accessibility icon.
$escape boolean Whether to escape the whole output.

generate_dismissible_notice() public method

Also loads scripts and styles if out of The SEO Framework's context.
Since: 2.6.0
public generate_dismissible_notice ( string $message = '', string $type = 'updated', boolean $a11y = true, boolean $escape = true ) : string
$message string The notice message. Expected to be escaped if $escape is false.
$type string The notice type : 'updated', 'error', 'warning'. Expected to be escaped.
$a11y boolean Whether to add an accessibility icon.
$escape boolean Whether to escape the whole output.
return string The dismissible error notice.

get_custom_field() public method

Return only the first value of custom field. Return false if field is blank or not set.
Since: 2.0.0
public get_custom_field ( string $field, integer $post_id = null ) : string | boolean
$field string Custom field key.
$post_id integer The post ID
return string | boolean Return value or false on failure.

get_the_front_page_ID() public method

Returns the front page ID, if home is a page.
Since: 2.6.0
public get_the_front_page_ID ( ) : integer
return integer the ID.

get_timezone_string() public method

UTC offsets are unreliable.
Since: 2.6.0
public get_timezone_string ( boolean $guess = false ) : string | empty
$guess boolean : If true, the timezone will be guessed from the WordPress core gmt_offset option.
return string | empty PHP Timezone String.

get_tzstring_from_offset() protected method

Fetches the Timezone String from given offset.
Since: 2.6.0
protected get_tzstring_from_offset ( integer $offset ) : string
$offset integer The GMT offzet.
return string PHP Timezone String.

get_view() public method

Passes on input vars.
Since: 2.7.0
public get_view ( string $view, array $args = [], string $instance = 'main' )
$view string The file name.
$args array The arguments to be supplied within the file name. Each array key is converted to a variable with its value attached.
$instance string The instance suffix to call back upon.

get_view_instance() protected method

Fetches view instance for switch.
Since: 2.7.0
protected get_view_instance ( string $base, string $instance = 'main' ) : string
$base string The instance basename (namespace).
$instance string The instance suffix to call back upon.
return string The file instance case.

get_word_count() public method

Case insensitive. Returns first encounter of each word if found multiple times.
Since: 2.7.0
public get_word_count ( string $string, integer $amount = 3, integer $amount_bother = 5, integer $bother_length = 3 ) : array
$string string Required. The string to count words in.
$amount integer Minimum amount of words to encounter in the string. Set to 0 to count all words longer than $bother_length.
$amount_bother integer Minimum amount of words to encounter in the string that fall under the $bother_length. Set to 0 to count all words shorter than $bother_length.
$bother_length integer The maximum string length of a word to pass for $amount_bother instead of $amount. Set to 0 to pass all words through $amount_bother
return array Containing arrays of words with their count.

gmt2date() public method

Converts time from GMT input to given format.
Since: 2.7.0
public gmt2date ( string $format = 'Y-m-d', string $time = '' ) : string
$format string The datetime format.
$time string The GMT time. Expects timezone to be omitted.
return string The converted time. Empty string if no $time is given.

google_language() protected method

Google docs language determinator.
Since: 2.2.2
protected google_language ( ) : string
return string language code

is_blog_public() public method

Checks if blog is public through WordPress core settings.
Since: 2.6.0
public is_blog_public ( ) : boolean
return boolean True is blog is public.

is_checked() public method

Checks if the string input is exactly '1'.
Since: 2.6.0
public is_checked ( string $value ) : boolean
$value string The value to check.
return boolean true if value is '1'

is_option_checked() public method

Checks if the option is used and checked.
Since: 2.6.0
public is_option_checked ( string $option ) : boolean
$option string The option name.
return boolean Option is checked.

maybe_lowercase_noun() public method

Depending if language is German.
Since: 2.6.0
public maybe_lowercase_noun ( $noun ) : string
return string The maybe lowercase noun.

object_cache_get() public method

Object cache get wrapper.
Since: 2.4.3
public object_cache_get ( string $key, string $group = 'the_seo_framework', boolean $force = false, boolean &$found = null ) : mixed
$key string The Object cache key.
$group string The Object cache group.
$force boolean Whether to force an update of the local cache.
$found boolean Whether the key was found in the cache. Disambiguates a return of false, a storable value.
return mixed wp_cache_get if object caching is allowed. False otherwise.

object_cache_set() public method

Object cache set wrapper.
Since: 2.4.3
public object_cache_set ( string $key, mixed $data, integer $expire, string $group = 'the_seo_framework' ) : boolean
$key string The Object cache key.
$data mixed The Object cache data.
$expire integer The Object cache expire time.
$group string The Object cache group.
return boolean true on set, false when disabled.

post_type_support() public method

Adds post type support for The SEO Framework.
Since: 2.1.6
public post_type_support ( )

proportionate_dimensions() public method

AKA Aspect Ratio.
Since: 2.6.0
public proportionate_dimensions ( integer $i, integer $r1, integer $r2 ) : integer
$i integer The dimension to resize.
$r1 integer The deminsion that determines the ratio.
$r2 integer The dimension to proportionate to.
return integer The proportional dimension, rounded.

reset_timezone() public method

Resets the timezone to default or UTC.
Since: 2.6.0
public reset_timezone ( ) : boolean
return boolean True on success. False on failure.

seo_settings_page_url() public method

Returns the SEO Settings page URL.
Since: 2.6.0
public seo_settings_page_url ( ) : string
return string The escaped SEO Settings page URL.

set_timezone() public method

Sets and resets the timezone.
public set_timezone ( string $tzstring = '', boolean $reset = false ) : boolean
$tzstring string Optional. The PHP Timezone string. Best to leave empty to always get a correct one.
$reset boolean Whether to reset to default. Ignoring first parameter.
return boolean True on success. False on failure.

settings_capability() public method

Applies filter 'the_seo_framework_settings_capability' : string This filter changes the minimum role for viewing and editing the plugin's settings.
Since: 2.6.0
public settings_capability ( ) : string
return string The minimum required capability for SEO Settings.