PHP Класс The_SEO_Framework\Generate_Image

Generates Image SEO data based on content.
С версии: 2.7.1
Наследование: extends Generate_Url
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$image_dimensions array Holds the image dimensions, if found.

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

Метод Описание
get_header_image ( boolean $set_og_dimensions = false ) : string Returns header image URL.
get_image ( string $post_id = '', array $args = [], boolean $escape = true ) : string Fetches og:image URL.
get_image_from_post_thumbnail ( array $args = [] ) : string | null Fetches image from post thumbnail.
get_image_from_woocommerce_gallery ( ) : array Fetches images id's from WooCommerce gallery
parse_image_args ( array $args = [], array $defaults = [], boolean $get_defaults = false ) : array Parse and sanitize image args.
parse_og_image ( integer $id, array $args = [] ) : string | empty Parses OG image to correct size.
reparse_image_args ( array $args = [] ) : array Reparses image args.
site_icon ( string $size = 'full', boolean $set_og_dimensions = false ) : string Fetches site icon brought in WordPress 4.3.0

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

Метод Описание
__construct ( ) Constructor, loads parent constructor.

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

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

Constructor, loads parent constructor.
protected __construct ( )

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

Also sets image dimensions. Falls back to current post ID for index.
С версии: 2.7.0
public get_header_image ( boolean $set_og_dimensions = false ) : string
$set_og_dimensions boolean Whether to set size for OG image. Always falls back to the current post ID.
Результат string The header image URL, not escaped.

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

Fetches og:image URL.
С версии: 2.5.2 Applies filters string the_seo_framework_og_image_after_featured
С версии: 2.5.2 Applies filters string the_seo_framework_og_image_after_header
public get_image ( string $post_id = '', array $args = [], boolean $escape = true ) : string
$post_id string The post ID.
$args array The image arguments.
$escape boolean Whether to escape the image URL.
Результат string the image URL.

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

Resizes the image between 1500px if bigger. Then it saves the image and Keeps dimensions relative.
С версии: 2.3.0
public get_image_from_post_thumbnail ( array $args = [] ) : string | null
$args array Image arguments.
Результат string | null the image url.

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

Parse and sanitize image args.
С версии: 2.5.0
С версии: 2.0.1 Applies filters the_seo_framework_og_image_args : { @param string $image The image url @param mixed $size The image size @param bool $icon Fetch Image icon @param array $attr Image attributes @param array $disallowed Disallowed image types : { array ( string 'featured' string 'header' string 'icon' ) } } The image set in the filter will always be used as fallback
public parse_image_args ( array $args = [], array $defaults = [], boolean $get_defaults = false ) : array
$args array required The passed arguments.
$defaults array The default arguments.
$get_defaults boolean Return the default arguments. Ignoring $args.
Результат array $args parsed args.

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

Parses OG image to correct size.
С версии: 2.5.0
public parse_og_image ( integer $id, array $args = [] ) : string | empty
$id integer The attachment ID.
$args array The image args
Результат string | empty Parsed image url or empty if already called

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

Reparses image args.
С версии: 2.6.6
public reparse_image_args ( array $args = [] ) : array
$args array required The passed arguments.
Результат array $args parsed args.

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

Fetches site icon brought in WordPress 4.3.0
С версии: 2.2.1
public site_icon ( string $size = 'full', boolean $set_og_dimensions = false ) : string
$size string The icon size, accepts 'full' and pixel values.
$set_og_dimensions boolean Whether to set size for OG image. Always falls back to the current post ID.
Результат string URL site icon, not escaped.

Описание свойств

$image_dimensions публичное свойство

Holds the image dimensions, if found.
С версии: 2.7.0
public array $image_dimensions
Результат array