PHP 클래스 Jetpack_Photon, jetpack

파일 보기 프로젝트 열기: automattic/jetpack 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$extensions Allowed extensions must match http://code.trac.wordpress.org/browser/photon/index.php#L31
$image_sizes Don't access this directly. Instead, use self::image_sizes() so it's actually populated with something.

공개 메소드들

메소드 설명
action_wp_enqueue_scripts ( ) : null Enqueue Photon helper script
filter_image_downsize ( string | boolean $image, integer $attachment_id, string | array $size ) : string | boolean Filter post thumbnail image retrieval, passing images through Photon
filter_open_graph_tags ( array $tags, array $parameters ) : array Pass og:image URLs through Photon
filter_sizes ( array $sizes, array $size ) : array Filters an array of image sizes values, using $content_width instead of image's full size.
filter_srcset_array ( array $sources, $size_array, $image_src, $image_meta ) : array Filters an array of image srcset values, replacing each URL with its Photon equivalent.
filter_the_content ( string $content ) : string Identify images in post content, and if images are local (uploaded to the current site), pass through Photon.
filter_the_galleries ( $galleries )
instance ( ) : object Singleton implementation
parse_dimensions_from_filename ( string $src ) : array Try to determine height and width from strings WP appends to resized image filenames.
parse_images_from_html ( string $content ) : array Match all images and any relevant tags in a block of HTML.

보호된 메소드들

메소드 설명
image_sizes ( ) : array Provide an array of available image sizes and corresponding dimensions.
strip_image_dimensions_maybe ( string $src ) : string Checks if the file exists before it passes the file to photon
validate_image_url ( string $url ) : boolean Ensure image URL is valid for Photon.

비공개 메소드들

메소드 설명
__construct ( ) Silence is golden.
setup ( ) : null Register actions and filters, but only if basic Photon functions are available.

메소드 상세

action_wp_enqueue_scripts() 공개 메소드

Enqueue Photon helper script
public action_wp_enqueue_scripts ( ) : null
리턴 null

filter_image_downsize() 공개 메소드

Filter post thumbnail image retrieval, passing images through Photon
public filter_image_downsize ( string | boolean $image, integer $attachment_id, string | array $size ) : string | boolean
$image string | boolean
$attachment_id integer
$size string | array
리턴 string | boolean

filter_open_graph_tags() 공개 메소드

Pass og:image URLs through Photon
public filter_open_graph_tags ( array $tags, array $parameters ) : array
$tags array
$parameters array
리턴 array

filter_sizes() 공개 메소드

Filters an array of image sizes values, using $content_width instead of image's full size.
부터: 4.0.4
부터: 4.1.0 Returns early for images not within the_content.
public filter_sizes ( array $sizes, array $size ) : array
$sizes array An array of media query breakpoints.
$size array Width and height of the image
리턴 array An array of media query breakpoints.

filter_srcset_array() 공개 메소드

Filters an array of image srcset values, replacing each URL with its Photon equivalent.
부터: 3.8.0
부터: 4.0.4 Added automatically additional sizes beyond declared image sizes.
public filter_srcset_array ( array $sources, $size_array, $image_src, $image_meta ) : array
$sources array An array of image urls and widths.
리턴 array An array of Photon image urls and widths.

filter_the_content() 공개 정적인 메소드

Identify images in post content, and if images are local (uploaded to the current site), pass through Photon.
public static filter_the_content ( string $content ) : string
$content string
리턴 string

filter_the_galleries() 공개 정적인 메소드

public static filter_the_galleries ( $galleries )

image_sizes() 보호된 정적인 메소드

Similar to get_intermediate_image_sizes() except that it includes image sizes' dimensions, not just their names.
protected static image_sizes ( ) : array
리턴 array

instance() 공개 정적인 메소드

Singleton implementation
public static instance ( ) : object
리턴 object

parse_dimensions_from_filename() 공개 정적인 메소드

Try to determine height and width from strings WP appends to resized image filenames.
public static parse_dimensions_from_filename ( string $src ) : array
$src string The image URL.
리턴 array An array consisting of width and height.
Checks if the file exists before it passes the file to photon
protected static strip_image_dimensions_maybe ( string $src ) : string
$src string The image URL
리턴 string

validate_image_url() 보호된 정적인 메소드

Though Photon functions address some of the URL issues, we should avoid unnecessary processing if we know early on that the image isn't supported.
protected static validate_image_url ( string $url ) : boolean
$url string
리턴 boolean

프로퍼티 상세

$extensions 보호되어 있는 정적으로 프로퍼티

Allowed extensions must match http://code.trac.wordpress.org/browser/photon/index.php#L31
protected static $extensions

$image_sizes 보호되어 있는 정적으로 프로퍼티

Don't access this directly. Instead, use self::image_sizes() so it's actually populated with something.
protected static $image_sizes