Code Embed - Version 2.3.2

Version Description

  • 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.
Download this release

Release Info

Developer dartiss
Plugin Icon 128x128 Code Embed
Version 2.3.2
Comparing to
See all releases

Code changes from version 2.3.1 to 2.3.2

Files changed (3) hide show
  1. includes/add-embeds.php +7 -6
  2. readme.txt +6 -3
  3. simple-code-embed.php +2 -2
includes/add-embeds.php CHANGED
@@ -139,23 +139,24 @@ add_filter( 'widget_content', 'ce_filter' );
139
 
140
  function ce_quick_replace( $content = '', $options = '', $search = '' ) {
141
 
142
- $start_pos = strpos( $content, $options['opening_ident'] . $search, 0 );
143
- $prefix_len = strlen( $options['opening_ident'] );
144
 
145
  while ( false !== $start_pos ) {
146
 
147
- $start_pos = $start_pos + strlen( $options['opening_ident'] );
148
- $end_pos = strpos( $content, $options['closing_ident'], $start_pos );
149
 
150
  if ( false !== $end_pos ) {
151
- $url = substr( $content, $start_pos, $end_pos - $start_pos );
152
  $file = ce_get_file( $url );
153
  if ( false !== $file ) {
154
- $content = str_replace( $options['opening_ident'] . $url . $options['closing_ident'], $file['file'], $content );
155
  } else {
156
  ce_report_error( __( 'File could not be fetched', 'simple-embed-code' ), 'Code Embed', false );
157
  }
158
  }
 
 
 
159
  }
160
 
161
  return $content;
139
 
140
  function ce_quick_replace( $content = '', $options = '', $search = '' ) {
141
 
142
+ $start_pos = strpos( $content, $options['opening_ident'] . $search, 0 );
 
143
 
144
  while ( false !== $start_pos ) {
145
 
146
+ $end_pos = strpos( $content, $options['closing_ident'], $start_pos + 1 );
 
147
 
148
  if ( false !== $end_pos ) {
149
+ $url = substr( $content, $start_pos + 1, $end_pos - $start_pos - 1 );
150
  $file = ce_get_file( $url );
151
  if ( false !== $file ) {
152
+ $content = str_replace( $options['opening_ident'] . $url . $options['closing_ident'], $file, $content );
153
  } else {
154
  ce_report_error( __( 'File could not be fetched', 'simple-embed-code' ), 'Code Embed', false );
155
  }
156
  }
157
+
158
+ $start_pos = strpos( $content, $options['opening_ident'] . $search, 0 );
159
+
160
  }
161
 
162
  return $content;
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: dartiss
3
  Tags: code, embed, html, javascript, script
4
  Requires at least: 4.6
5
- Tested up to: 4.9.4
6
  Requires PHP: 5.3
7
- Stable tag: 2.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -187,6 +187,9 @@ It is, in that it doesn't save any data that could be odds with GDPR compliance
187
 
188
  [Learn more about my version numbering methodology](https://artiss.blog/2016/09/wordpress-plugin-versioning/ "WordPress Plugin Versioning")
189
 
 
 
 
190
  = 2.3.1 =
191
  * Bug: Fixed a variable naming issue that I may, or may not (I did), have created in the latest release
192
 
@@ -293,5 +296,5 @@ versions of this plugin
293
 
294
  == Upgrade Notice ==
295
 
296
- = 2.3.1 =
297
  * Minor bug fix
2
  Contributors: dartiss
3
  Tags: code, embed, html, javascript, script
4
  Requires at least: 4.6
5
+ Tested up to: 4.9.6
6
  Requires PHP: 5.3
7
+ Stable tag: 2.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
187
 
188
  [Learn more about my version numbering methodology](https://artiss.blog/2016/09/wordpress-plugin-versioning/ "WordPress Plugin Versioning")
189
 
190
+ = 2.3.2 =
191
+ * 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.
192
+
193
  = 2.3.1 =
194
  * Bug: Fixed a variable naming issue that I may, or may not (I did), have created in the latest release
195
 
296
 
297
  == Upgrade Notice ==
298
 
299
+ = 2.3.2 =
300
  * Minor bug fix
simple-code-embed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Code Embed
4
  Plugin URI: https://github.com/dartiss/code-embed
5
  Description: Code Embed provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.
6
- Version: 2.3.1
7
  Author: David Artiss
8
  Author URI: https://artiss.blog
9
  Text Domain: simple-embed-code
@@ -18,7 +18,7 @@ Text Domain: simple-embed-code
18
  * @since 1.6
19
  */
20
 
21
- define( 'CODE_EMBED_VERSION', '2.3.1' );
22
 
23
  // Include all the various functions
24
 
3
  Plugin Name: Code Embed
4
  Plugin URI: https://github.com/dartiss/code-embed
5
  Description: Code Embed provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.
6
+ Version: 2.3.2
7
  Author: David Artiss
8
  Author URI: https://artiss.blog
9
  Text Domain: simple-embed-code
18
  * @since 1.6
19
  */
20
 
21
+ define( 'CODE_EMBED_VERSION', '2.3.2' );
22
 
23
  // Include all the various functions
24