PHP Class Jetpack_SEO_Titles, jetpack

Afficher le fichier Open project: automattic/jetpack Class Usage Examples

Méthodes publiques

Méthode Description
are_valid_title_formats ( array $title_formats ) : boolean Checks if a given format conforms to predefined SEO title templates.
get_allowed_tokens ( ) : array Returns tokens that are currently supported for each page type.
get_custom_title ( string $default_title = '' ) : string Used to modify the default title with custom SEO title.
get_custom_title_formats ( ) : array Retrieves custom title formats from site option.
get_date_for_title ( ) : string Returns the value that should be used as a replacement for the date token, depending on the archive path specified.
get_page_type ( ) : string | boolean Returns page type for current page. We need this helper in order to determine what user defined title format should be used for custom title.
get_token_value ( string $token_name ) : string Returns string value for given token.
is_conflicted_theme ( ) : boolean Checks if current theme is defining custom title that won't work nicely with our custom SEO title override.
update_title_formats ( array $new_formats ) : array Combines the previous values of title formats, stored as array in site options, with the new values that are provided.

Method Details

are_valid_title_formats() public static méthode

Every format type and token must be whitelisted.
See also: get_allowed_tokens()
public static are_valid_title_formats ( array $title_formats ) : boolean
$title_formats array Template of SEO title to check.
Résultat boolean True if the formats are valid, false otherwise.

get_allowed_tokens() public static méthode

Returns tokens that are currently supported for each page type.
public static get_allowed_tokens ( ) : array
Résultat array Array of allowed token strings.

get_custom_title() public static méthode

Used to modify the default title with custom SEO title.
public static get_custom_title ( string $default_title = '' ) : string
$default_title string Default title for current page.
Résultat string Custom title with replaced tokens or default title.

get_custom_title_formats() public static méthode

Retrieves custom title formats from site option.
public static get_custom_title_formats ( ) : array
Résultat array Array of custom title formats, or empty array.

get_date_for_title() public static méthode

Returns the value that should be used as a replacement for the date token, depending on the archive path specified.
public static get_date_for_title ( ) : string
Résultat string Token replacement for a given date, or empty string if no date is specified.

get_page_type() public static méthode

Returns page type for current page. We need this helper in order to determine what user defined title format should be used for custom title.
public static get_page_type ( ) : string | boolean
Résultat string | boolean Type of current page or false if unsupported.

get_token_value() public static méthode

Returns string value for given token.
public static get_token_value ( string $token_name ) : string
$token_name string The token name value that should be replaced.
Résultat string Token replacement for current site, or empty string for unknown token name.

is_conflicted_theme() public static méthode

Checks if current theme is defining custom title that won't work nicely with our custom SEO title override.
public static is_conflicted_theme ( ) : boolean
Résultat boolean True if current theme sets custom title, false otherwise.

update_title_formats() public static méthode

Combines the previous values of title formats, stored as array in site options, with the new values that are provided.
public static update_title_formats ( array $new_formats ) : array
$new_formats array Array containing new title formats.
Résultat array $result Array of updated title formats, or empty array if no update was performed.