PHP Class AS3CF_Filter, wp-amazon-s3-and-cloudfront

Show file Open project: deliciousbrains/wp-amazon-s3-and-cloudfront

Protected Properties

Property Type Description
$as3cf Amazon_S3_And_CloudFront
$query_cache array

Public Methods

Method Description
__construct ( Amazon_S3_And_CloudFront $as3cf ) Constructor
filter_customizer_image ( string $value, boolean | string $old_value = false ) : string Filter customizer image.
filter_edd_download_files ( array $value ) : array Filter EDD download files.
filter_header_image_data ( stdClass $value, boolean | stdClass $old_value = false ) : stdClass Filter header image data.
filter_post ( string $content ) : string Filter post.
purge_cache_on_attachment_delete ( integer $post_id ) Purge attachment from cache on delete.
purge_from_cache ( string $url, boolean | integer $blog_id = false ) Purge URL from cache

Protected Methods

Method Description
attachment_id_matches_src ( integer $attachment_id, string $url ) : boolean Does attachment ID match src?
find_urls_and_replace ( string $value, array $cache, array &$to_cache ) : string Find URLs and replace.
get_attachment_id_from_url ( string $url ) : boolean | integer Get attachment ID from URL.
get_attachment_ids_from_urls ( array $urls ) : array Get attachment IDs from URLs.
get_base_url ( integer $attachment_id ) : string | false Get base URL.
get_option_cache ( ) : array Get option cache.
get_post_cache ( ) : array Get post cache
get_size_string_from_url ( integer $attachment_id, string $url ) : null | string Get size string from URL.
get_url ( integer $attachment_id, null | string $size = null ) : boolean | string Get URL.
get_urls_from_content ( string $content, array $cache, array &$to_cache ) : array Get URLs from content.
get_urls_from_img_src ( string $content, array &$to_cache ) : array Get URLs from img src.
is_failure ( mixed $value ) : boolean Is failure?
maybe_update_option_cache ( array $to_cache ) Maybe update option cache.
maybe_update_post_cache ( array $to_cache ) Maybe update post cache
normalize_find_value ( string $url ) : string Normalize find value.
normalize_replace_value ( string $url ) : string Normalize replace value.
post_process_content ( string $content ) : string Post process content.
pre_replace_content ( string $content ) : string Pre replace content.
process_content ( string $content, array $cache, array &$to_cache ) : mixed Process content.
push_to_url_pairs ( array &$url_pairs, integer $attachment_id, string $find, array &$to_cache ) Push to URL pairs.
remove_aws_query_strings ( string $content, string $base_url = '' ) : string Remove AWS query strings.
replace_urls ( string $content, array $url_pairs ) : string Replace URLs.
should_filter_content ( ) : boolean Should filter content.
url_cache_failure ( string $url, array &$to_cache ) URL cache failure.
url_needs_replacing ( string $url ) : boolean Does URL need replacing?

Method Details

__construct() public method

Constructor
public __construct ( Amazon_S3_And_CloudFront $as3cf )
$as3cf Amazon_S3_And_CloudFront

attachment_id_matches_src() protected method

Does attachment ID match src?
protected attachment_id_matches_src ( integer $attachment_id, string $url ) : boolean
$attachment_id integer
$url string
return boolean

filter_customizer_image() public method

Filter customizer image.
public filter_customizer_image ( string $value, boolean | string $old_value = false ) : string
$value string
$old_value boolean | string
return string

filter_edd_download_files() public method

Filter EDD download files.
public filter_edd_download_files ( array $value ) : array
$value array
return array

filter_header_image_data() public method

Filter header image data.
public filter_header_image_data ( stdClass $value, boolean | stdClass $old_value = false ) : stdClass
$value stdClass
$old_value boolean | stdClass
return stdClass

filter_post() public method

Filter post.
public filter_post ( string $content ) : string
$content string
return string

find_urls_and_replace() protected method

Find URLs and replace.
protected find_urls_and_replace ( string $value, array $cache, array &$to_cache ) : string
$value string
$cache array
$to_cache array
return string

get_attachment_id_from_url() abstract protected method

Get attachment ID from URL.
abstract protected get_attachment_id_from_url ( string $url ) : boolean | integer
$url string
return boolean | integer

get_attachment_ids_from_urls() abstract protected method

Get attachment IDs from URLs.
abstract protected get_attachment_ids_from_urls ( array $urls ) : array
$urls array
return array url => attachment ID (or false)

get_base_url() abstract protected method

Get base URL.
abstract protected get_base_url ( integer $attachment_id ) : string | false
$attachment_id integer
return string | false

get_option_cache() protected method

Get option cache.
protected get_option_cache ( ) : array
return array

get_post_cache() protected method

Get post cache
protected get_post_cache ( ) : array
return array

get_size_string_from_url() protected method

Get size string from URL.
protected get_size_string_from_url ( integer $attachment_id, string $url ) : null | string
$attachment_id integer
$url string
return null | string

get_url() abstract protected method

Get URL.
abstract protected get_url ( integer $attachment_id, null | string $size = null ) : boolean | string
$attachment_id integer
$size null | string
return boolean | string

get_urls_from_content() protected method

Get URLs from content.
protected get_urls_from_content ( string $content, array $cache, array &$to_cache ) : array
$content string
$cache array
$to_cache array
return array

get_urls_from_img_src() protected method

Get URLs from img src.
protected get_urls_from_img_src ( string $content, array &$to_cache ) : array
$content string
$to_cache array
return array

is_failure() protected method

Is failure?
protected is_failure ( mixed $value ) : boolean
$value mixed
return boolean

maybe_update_option_cache() protected method

Maybe update option cache.
protected maybe_update_option_cache ( array $to_cache )
$to_cache array

maybe_update_post_cache() protected method

Maybe update post cache
protected maybe_update_post_cache ( array $to_cache )
$to_cache array

normalize_find_value() abstract protected method

Normalize find value.
abstract protected normalize_find_value ( string $url ) : string
$url string
return string

normalize_replace_value() abstract protected method

Normalize replace value.
abstract protected normalize_replace_value ( string $url ) : string
$url string
return string

post_process_content() abstract protected method

Post process content.
abstract protected post_process_content ( string $content ) : string
$content string
return string

pre_replace_content() abstract protected method

Pre replace content.
abstract protected pre_replace_content ( string $content ) : string
$content string
return string

process_content() protected method

Process content.
protected process_content ( string $content, array $cache, array &$to_cache ) : mixed
$content string
$cache array
$to_cache array
return mixed

purge_cache_on_attachment_delete() public method

Purge attachment from cache on delete.
public purge_cache_on_attachment_delete ( integer $post_id )
$post_id integer

purge_from_cache() public method

Purge URL from cache
public purge_from_cache ( string $url, boolean | integer $blog_id = false )
$url string
$blog_id boolean | integer

push_to_url_pairs() protected method

Push to URL pairs.
protected push_to_url_pairs ( array &$url_pairs, integer $attachment_id, string $find, array &$to_cache )
$url_pairs array
$attachment_id integer
$find string
$to_cache array

remove_aws_query_strings() protected method

Remove AWS query strings.
protected remove_aws_query_strings ( string $content, string $base_url = '' ) : string
$content string
$base_url string Optional base URL that must exist within URL for Amazon query strings to be removed.
return string

replace_urls() protected method

Replace URLs.
protected replace_urls ( string $content, array $url_pairs ) : string
$content string
$url_pairs array
return string

should_filter_content() protected method

Should filter content.
protected should_filter_content ( ) : boolean
return boolean

url_cache_failure() protected method

URL cache failure.
protected url_cache_failure ( string $url, array &$to_cache )
$url string
$to_cache array

url_needs_replacing() abstract protected method

Does URL need replacing?
abstract protected url_needs_replacing ( string $url ) : boolean
$url string
return boolean

Property Details

$as3cf protected property

protected Amazon_S3_And_CloudFront $as3cf
return Amazon_S3_And_CloudFront

$query_cache protected property

protected array $query_cache
return array