Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions class-blazer-six-gist-oembed.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function shortcode( $attr ) {
// Short-circuit the shortcode output and just delete the transient.
// This is set to true when posts are updated.
if ( $this->delete_shortcode_transients ) {
delete_transient( 'gist_html_' . $shortcode_hash );
delete_transient( $this->transient_key( $shortcode_hash ) );
return;
}

Expand Down Expand Up @@ -353,7 +353,7 @@ public function get_gist_html( $url, $args, $fetch = false ) {

$shortcode_hash = $this->shortcode_hash( 'gist', $args );
$raw_key = '_gist_raw_' . md5( $url );
$transient_key = 'gist_html_' . $shortcode_hash;
$transient_key = $this->transient_key( $shortcode_hash );

$html = get_transient( $transient_key );

Expand Down Expand Up @@ -581,4 +581,17 @@ protected function shortcode_hash( $tag, $args ) {
ksort( $args );
return md5( $tag . '_' . serialize( $args ) );
}

/**
* Get the transient key.
*
* @since 1.1.0
*
* @param string $identifier The identifier part of the key.
*
* @return string
*/
protected function transient_key( $identifier ) {
return 'gist_html_' . $identifier;
}
}