From 9d6b3af07038b1af3dc3ca5185a10a42ea7e83c4 Mon Sep 17 00:00:00 2001 From: Sal Ferrarello Date: Thu, 31 Oct 2013 00:55:25 -0400 Subject: [PATCH 1/3] Fix for oEmbed cache not clearing on update. Replaced do_shortcode() with apply_filters( 'the_content' in method delete_gist_transients in class GistPress. do_shortcode() does not does not process oEmbeds, which prevented the shortcode method from being executed and clearing the cache. --- class-gistpress.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/class-gistpress.php b/class-gistpress.php index 7a297cc..c49c2df 100644 --- a/class-gistpress.php +++ b/class-gistpress.php @@ -571,8 +571,8 @@ public function delete_gist_transients( $post_id, WP_Post $post_after, WP_Post $ $this->delete_shortcode_transients = true; // Run the shortcodes to clear associated transients. - do_shortcode( $post_after->post_content ); - do_shortcode( $post_before->post_content ); + apply_filters( 'the_content', $post_after->post_content ); + apply_filters( 'the_content', $post_before->post_content ); // Delete raw transients whose keys match a post meta fallback. $keys = get_post_custom_keys( $post_id ); From b3df2b8d402d0cd3af36fca6fc8dce26373f5da6 Mon Sep 17 00:00:00 2001 From: Sal Ferrarello Date: Thu, 31 Oct 2013 20:40:16 -0400 Subject: [PATCH 2/3] Fix for oEmbed cache not clearing on update Replaced do_shortcode() with $GLOBALS['wp_embed']->autoembed() in method delete_gist_transients in class GistPress. do_shortcode() does not does not process oEmbeds, which prevented the shortcode method from being executed and clearing the cache. This is an improvement over my previous pull request, which used apply_filters( 'the_content' and therefore applied signficantly more filters than necessary. Thank you to GaryJones for this improvement. --- class-gistpress.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/class-gistpress.php b/class-gistpress.php index c49c2df..cef28a0 100644 --- a/class-gistpress.php +++ b/class-gistpress.php @@ -571,8 +571,8 @@ public function delete_gist_transients( $post_id, WP_Post $post_after, WP_Post $ $this->delete_shortcode_transients = true; // Run the shortcodes to clear associated transients. - apply_filters( 'the_content', $post_after->post_content ); - apply_filters( 'the_content', $post_before->post_content ); + do_shortcode( $GLOBALS['wp_embed']->autoembed( $post_after->post_content ) ); + do_shortcode( $GLOBALS['wp_embed']->autoembed( $post_before->post_content ) ); // Delete raw transients whose keys match a post meta fallback. $keys = get_post_custom_keys( $post_id ); From 8f8cd161c0741cb9248fdb14de3704355f765d13 Mon Sep 17 00:00:00 2001 From: Sal Ferrarello Date: Thu, 31 Oct 2013 22:49:16 -0400 Subject: [PATCH 3/3] Correct erroneous output from method rebuild_shortcode in class GistPress Replace $rawattr with $attrs in method rebuild_shortcode in class GistPress as per @bradyvercher's comment in [Issue 34](https://github.com/bradyvercher/gistpress/issues/34) Old Erroneous Behavior: [gist 7243951 1] New Corrected Behavior: [gist id="7243951"] --- class-gistpress.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class-gistpress.php b/class-gistpress.php index cef28a0..167e927 100644 --- a/class-gistpress.php +++ b/class-gistpress.php @@ -602,7 +602,7 @@ protected function rebuild_shortcode( array $rawattr ) { $attrs[] = $key . '="' . $value . '"'; } } - return '[gist ' . implode( ' ', $rawattr ) . ']'; + return '[gist ' . implode( ' ', $attrs ) . ']'; } /**