diff --git a/includes/add-embeds.php b/includes/add-embeds.php index 5696ded..47eeae7 100644 --- a/includes/add-embeds.php +++ b/includes/add-embeds.php @@ -139,23 +139,24 @@ function ce_filter( $content ) { function ce_quick_replace( $content = '', $options = '', $search = '' ) { - $start_pos = strpos( $content, $options['opening_ident'] . $search, 0 ); - $prefix_len = strlen( $options['opening_ident'] ); + $start_pos = strpos( $content, $options['opening_ident'] . $search, 0 ); while ( false !== $start_pos ) { - $start_pos = $start_pos + strlen( $options['opening_ident'] ); - $end_pos = strpos( $content, $options['closing_ident'], $start_pos ); + $end_pos = strpos( $content, $options['closing_ident'], $start_pos + 1 ); if ( false !== $end_pos ) { - $url = substr( $content, $start_pos, $end_pos - $start_pos ); + $url = substr( $content, $start_pos + 1, $end_pos - $start_pos - 1 ); $file = ce_get_file( $url ); if ( false !== $file ) { - $content = str_replace( $options['opening_ident'] . $url . $options['closing_ident'], $file['file'], $content ); + $content = str_replace( $options['opening_ident'] . $url . $options['closing_ident'], $file, $content ); } else { ce_report_error( __( 'File could not be fetched', 'simple-embed-code' ), 'Code Embed', false ); } } + + $start_pos = strpos( $content, $options['opening_ident'] . $search, 0 ); + } return $content; diff --git a/readme.txt b/readme.txt index 9dadbcd..821c22b 100644 --- a/readme.txt +++ b/readme.txt @@ -2,9 +2,9 @@ Contributors: dartiss Tags: code, embed, html, javascript, script Requires at least: 4.6 -Tested up to: 4.9.4 +Tested up to: 4.9.6 Requires PHP: 5.3 -Stable tag: 2.3.1 +Stable tag: 2.3.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -187,6 +187,9 @@ It is, in that it doesn't save any data that could be odds with GDPR compliance [Learn more about my version numbering methodology](https://artiss.blog/2016/09/wordpress-plugin-versioning/ "WordPress Plugin Versioning") += 2.3.2 = +* Bug: Fixed another pesky bug that was affecting embedded URLs. My code to do this was years old and I couldn't understand why I'd written it the way I had. So I've re-written it from scratch. + = 2.3.1 = * Bug: Fixed a variable naming issue that I may, or may not (I did), have created in the latest release @@ -293,5 +296,5 @@ versions of this plugin == Upgrade Notice == -= 2.3.1 = += 2.3.2 = * Minor bug fix \ No newline at end of file diff --git a/simple-code-embed.php b/simple-code-embed.php index 0b5b28c..1a12260 100644 --- a/simple-code-embed.php +++ b/simple-code-embed.php @@ -3,7 +3,7 @@ Plugin Name: Code Embed Plugin URI: https://github.com/dartiss/code-embed Description: Code Embed provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages. -Version: 2.3.1 +Version: 2.3.2 Author: David Artiss Author URI: https://artiss.blog Text Domain: simple-embed-code @@ -18,7 +18,7 @@ * @since 1.6 */ -define( 'CODE_EMBED_VERSION', '2.3.1' ); +define( 'CODE_EMBED_VERSION', '2.3.2' ); // Include all the various functions