Code Embed - Version 2.3.3

Version Description

  • Enhancement: I've removed the debug code. I allowed to be switched off but I've never used it and it may not have switched off properly anyway. So it's gone
  • Enhancement: Added some additional plugin meta
Download this release

Release Info

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

Code changes from version 2.3.2 to 2.3.3

includes/add-embeds.php CHANGED
@@ -179,9 +179,6 @@ function ce_quick_replace( $content = '', $options = '', $search = '' ) {
179
  function ce_generate_code( $html, $responsive = '', $max_width = '', $debug = '' ) {
180
 
181
  $code = "\n";
182
- if ( 1 !== $debug ) {
183
- $code .= '<!-- Code Embed v' . CODE_EMBED_VERSION . " -->\n";
184
- }
185
 
186
  if ( false !== $max_width ) {
187
  $code .= '<div style="width: ' . $max_width . 'px; max-width: 100%">';
@@ -202,9 +199,6 @@ function ce_generate_code( $html, $responsive = '', $max_width = '', $debug = ''
202
  }
203
 
204
  $code .= "\n";
205
- if ( 1 !== $debug ) {
206
- $code .= '<!-- ' . __( 'End of Code Embed output', 'simple-embed-code' ) . " -->\n";
207
- }
208
 
209
  return $code;
210
  }
179
  function ce_generate_code( $html, $responsive = '', $max_width = '', $debug = '' ) {
180
 
181
  $code = "\n";
 
 
 
182
 
183
  if ( false !== $max_width ) {
184
  $code .= '<div style="width: ' . $max_width . 'px; max-width: 100%">';
199
  }
200
 
201
  $code .= "\n";
 
 
 
202
 
203
  return $code;
204
  }
includes/admin-config.php CHANGED
@@ -1,24 +1,21 @@
1
  <?php
2
  /**
3
- * Administration Menu Options
4
- *
5
- * Add various adminstration menu options
6
- *
7
- * @package simple-embed-code
8
- */
9
 
10
  /**
11
- * Add Settings link to plugin list
12
- *
13
- * Add a Settings link to the options listed against this plugin
14
- *
15
- * @since 1.6
16
- *
17
- * @param string $links Current links
18
- * @param string $file File in use
19
- * @return string Links, now with settings added
20
- */
21
-
22
  function ce_add_settings_link( $links, $file ) {
23
 
24
  static $this_plugin;
@@ -38,17 +35,14 @@ function ce_add_settings_link( $links, $file ) {
38
  add_filter( 'plugin_action_links', 'ce_add_settings_link', 10, 2 );
39
 
40
  /**
41
- * Add meta to plugin details
42
- *
43
- * Add options to plugin meta line
44
- *
45
- * @since 1.6
46
- *
47
- * @param string $links Current links
48
- * @param string $file File in use
49
- * @return string Links, now with settings added
50
- */
51
-
52
  function ce_set_plugin_meta( $links, $file ) {
53
 
54
  if ( false !== strpos( $file, 'code-embed.php' ) ) {
@@ -56,6 +50,10 @@ function ce_set_plugin_meta( $links, $file ) {
56
  $links = array_merge( $links, array( '<a href="https://github.com/dartiss/code-embed">' . __( 'Github', 'simple-embed-code' ) . '</a>' ) );
57
 
58
  $links = array_merge( $links, array( '<a href="https://wordpress.org/plugins/simple-embed-code/">' . __( 'Support', 'simple-embed-code' ) . '</a>' ) );
 
 
 
 
59
  }
60
 
61
  return $links;
@@ -64,18 +62,15 @@ function ce_set_plugin_meta( $links, $file ) {
64
  add_filter( 'plugin_row_meta', 'ce_set_plugin_meta', 10, 2 );
65
 
66
  /**
67
- * Code Embed Menu
68
- *
69
- * Add a new option to the Admin menu and context menu
70
- *
71
- * @since 1.4
72
- *
73
- * @uses ce_help Return help text
74
- */
75
-
76
  function ce_menu() {
77
 
78
- // Add search sub-menu
79
 
80
  global $ce_search_hook;
81
 
@@ -83,7 +78,7 @@ function ce_menu() {
83
 
84
  add_action( 'load-' . $ce_search_hook, 'ce_add_search_help' );
85
 
86
- // Add options sub-menu
87
 
88
  global $ce_options_hook;
89
 
@@ -96,15 +91,12 @@ function ce_menu() {
96
  add_action( 'admin_menu', 'ce_menu' );
97
 
98
  /**
99
- * Add Options Help
100
- *
101
- * Add help tab to options screen
102
- *
103
- * @since 2.0
104
- *
105
- * @uses ce_options_help Return help text
106
- */
107
-
108
  function ce_add_options_help() {
109
 
110
  global $ce_options_hook;
@@ -126,15 +118,12 @@ function ce_add_options_help() {
126
  }
127
 
128
  /**
129
- * Add Search Help
130
- *
131
- * Add help tab to search screen
132
- *
133
- * @since 2.0
134
- *
135
- * @uses ce_search_help Return help text
136
- */
137
-
138
  function ce_add_search_help() {
139
 
140
  global $ce_search_hook;
@@ -156,43 +145,34 @@ function ce_add_search_help() {
156
  }
157
 
158
  /**
159
- * Code Embed Options
160
- *
161
- * Define an option screen
162
- *
163
- * @since 1.4
164
- */
165
-
166
  function ce_options() {
167
 
168
- include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'options-screen.php' );
169
 
170
  }
171
 
172
  /**
173
- * Code Embed Search
174
- *
175
- * Define a the search screen
176
- *
177
- * @since 1.6
178
- */
179
-
180
  function ce_search() {
181
 
182
- include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'search-screen.php' );
183
 
184
  }
185
 
186
  /**
187
- * Code Embed Options Help
188
- *
189
- * Return help text for options screen
190
- *
191
- * @since 1.5
192
- *
193
- * @return string Help Text
194
- */
195
-
196
  function ce_options_help() {
197
 
198
  $help_text = '<p>' . __( 'Use this screen to modify the various settings, including the identifiers and keyword used to specify your embedded code.', 'simple-embed-code' ) . '</p>';
@@ -205,15 +185,12 @@ function ce_options_help() {
205
  }
206
 
207
  /**
208
- * Code Embed Search Help
209
- *
210
- * Return help text for search screen
211
- *
212
- * @since 1.6
213
- *
214
- * @return string Help Text
215
- */
216
-
217
  function ce_search_help() {
218
 
219
  $help_text = '<p>' . __( 'This screen allows you to search for the post and pages that a particular code embed has been used in.', 'simple-embed-code' ) . '</p>';
@@ -224,15 +201,12 @@ function ce_search_help() {
224
  }
225
 
226
  /**
227
- * Code Embed Help Sidebar
228
- *
229
- * Return sidebar help text
230
- *
231
- * @since 2.3
232
- *
233
- * @return string Help Text
234
- */
235
-
236
  function ce_help_sidebar() {
237
 
238
  $help_text = '<p><strong>' . __( 'For more information:', 'simple-embed-code' ) . '</strong></p>';
1
  <?php
2
  /**
3
+ * Administration Menu Options
4
+ *
5
+ * Add various adminstration menu options
6
+ *
7
+ * @package simple-embed-code
8
+ */
9
 
10
  /**
11
+ * Add Settings link to plugin list
12
+ *
13
+ * Add a Settings link to the options listed against this plugin
14
+ *
15
+ * @param string $links Current links.
16
+ * @param string $file File in use.
17
+ * @return string Links, now with settings added.
18
+ */
 
 
 
19
  function ce_add_settings_link( $links, $file ) {
20
 
21
  static $this_plugin;
35
  add_filter( 'plugin_action_links', 'ce_add_settings_link', 10, 2 );
36
 
37
  /**
38
+ * Add meta to plugin details
39
+ *
40
+ * Add options to plugin meta line
41
+ *
42
+ * @param string $links Current links.
43
+ * @param string $file File in use.
44
+ * @return string Links, now with settings added.
45
+ */
 
 
 
46
  function ce_set_plugin_meta( $links, $file ) {
47
 
48
  if ( false !== strpos( $file, 'code-embed.php' ) ) {
50
  $links = array_merge( $links, array( '<a href="https://github.com/dartiss/code-embed">' . __( 'Github', 'simple-embed-code' ) . '</a>' ) );
51
 
52
  $links = array_merge( $links, array( '<a href="https://wordpress.org/plugins/simple-embed-code/">' . __( 'Support', 'simple-embed-code' ) . '</a>' ) );
53
+
54
+ $links = array_merge( $links, array( '<a href="https://artiss.blog/donate">' . __( 'Donate', 'simple-embed-code' ) . '</a>' ) );
55
+
56
+ $links = array_merge( $links, array( '<a href="https://wordpress.org/support/plugin/simple-embed-code/reviews/#new-post">' . __( 'Write a Review', 'simple-embed-code' ) . '&nbsp;⭐️⭐️⭐️⭐️⭐️</a>' ) );
57
  }
58
 
59
  return $links;
62
  add_filter( 'plugin_row_meta', 'ce_set_plugin_meta', 10, 2 );
63
 
64
  /**
65
+ * Code Embed Menu
66
+ *
67
+ * Add a new option to the Admin menu and context menu
68
+ *
69
+ * @uses ce_help Return help text
70
+ */
 
 
 
71
  function ce_menu() {
72
 
73
+ // Add search sub-menu.
74
 
75
  global $ce_search_hook;
76
 
78
 
79
  add_action( 'load-' . $ce_search_hook, 'ce_add_search_help' );
80
 
81
+ // Add options sub-menu.
82
 
83
  global $ce_options_hook;
84
 
91
  add_action( 'admin_menu', 'ce_menu' );
92
 
93
  /**
94
+ * Add Options Help
95
+ *
96
+ * Add help tab to options screen
97
+ *
98
+ * @uses ce_options_help Return help text.
99
+ */
 
 
 
100
  function ce_add_options_help() {
101
 
102
  global $ce_options_hook;
118
  }
119
 
120
  /**
121
+ * Add Search Help
122
+ *
123
+ * Add help tab to search screen
124
+ *
125
+ * @uses ce_search_help Return help text.
126
+ */
 
 
 
127
  function ce_add_search_help() {
128
 
129
  global $ce_search_hook;
145
  }
146
 
147
  /**
148
+ * Code Embed Options
149
+ *
150
+ * Define an option screen
151
+ */
 
 
 
152
  function ce_options() {
153
 
154
+ include_once WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'options-screen.php';
155
 
156
  }
157
 
158
  /**
159
+ * Code Embed Search
160
+ *
161
+ * Define a the search screen
162
+ */
 
 
 
163
  function ce_search() {
164
 
165
+ include_once WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'search-screen.php';
166
 
167
  }
168
 
169
  /**
170
+ * Code Embed Options Help
171
+ *
172
+ * Return help text for options screen
173
+ *
174
+ * @return string Help Text.
175
+ */
 
 
 
176
  function ce_options_help() {
177
 
178
  $help_text = '<p>' . __( 'Use this screen to modify the various settings, including the identifiers and keyword used to specify your embedded code.', 'simple-embed-code' ) . '</p>';
185
  }
186
 
187
  /**
188
+ * Code Embed Search Help
189
+ *
190
+ * Return help text for search screen
191
+ *
192
+ * @return string Help Text
193
+ */
 
 
 
194
  function ce_search_help() {
195
 
196
  $help_text = '<p>' . __( 'This screen allows you to search for the post and pages that a particular code embed has been used in.', 'simple-embed-code' ) . '</p>';
201
  }
202
 
203
  /**
204
+ * Code Embed Help Sidebar
205
+ *
206
+ * Return sidebar help text
207
+ *
208
+ * @return string Help Text.
209
+ */
 
 
 
210
  function ce_help_sidebar() {
211
 
212
  $help_text = '<p><strong>' . __( 'For more information:', 'simple-embed-code' ) . '</strong></p>';
includes/initialise.php CHANGED
@@ -39,7 +39,6 @@ function ce_initialisation() {
39
  'opening_ident' => '{{',
40
  'keyword_ident' => 'CODE',
41
  'closing_ident' => '}}',
42
- 'debug' => '',
43
  'excerpts' => '',
44
  );
45
 
39
  'opening_ident' => '{{',
40
  'keyword_ident' => 'CODE',
41
  'closing_ident' => '}}',
 
42
  'excerpts' => '',
43
  );
44
 
includes/options-screen.php CHANGED
@@ -38,12 +38,6 @@ if ( ( ! empty( $_POST ) ) && ( check_admin_referer( 'code-embed-profile', 'code
38
  $options['closing_ident'] = '}}';
39
  }
40
 
41
- if ( ! empty( $_POST['code_embed_debug'] ) ) {
42
- $options['debug'] = sanitize_text_field( wp_unslash( $_POST['code_embed_debug'] ) ); // Input var okay.
43
- } else {
44
- $options['debug'] = '';
45
- }
46
-
47
  if ( isset( $_POST['code_embed_excerpt'] ) ) {
48
  $options['excerpt'] = sanitize_text_field( wp_unslash( $_POST['code_embed_excerpt'] ) ); // Input var okay.
49
  } else {
@@ -63,13 +57,6 @@ $options = get_option( 'artiss_code_embed' );
63
  <form method="post" action="<?php echo esc_html( get_bloginfo( 'wpurl' ) ) . '/wp-admin/options-general.php?page=ce-options'; ?>">
64
 
65
  <table class="form-table">
66
- <tr>
67
- <th scope="row"><label for="code_embed_debug"><?php echo esc_html( ucwords( __( 'Hide debug', 'simple-embed-code' ) ) ); ?></label></th>
68
- <td><input type="checkbox" name="code_embed_debug" value="1"
69
- <?php checked( '1', $options['debug'] ); ?>
70
- /><?php esc_html_e( 'Hide debug HTML comments in source', 'simple-embed-code' ); ?></td>
71
- </tr>
72
-
73
  <tr>
74
  <th scope="row"><label for="code_embed_excerpt"><?php echo esc_html( ucwords( __( 'Allow in excerpts', 'simple-embed-code' ) ) ); ?></label></th>
75
  <td><input type="checkbox" name="code_embed_excerpt" value="1"
38
  $options['closing_ident'] = '}}';
39
  }
40
 
 
 
 
 
 
 
41
  if ( isset( $_POST['code_embed_excerpt'] ) ) {
42
  $options['excerpt'] = sanitize_text_field( wp_unslash( $_POST['code_embed_excerpt'] ) ); // Input var okay.
43
  } else {
57
  <form method="post" action="<?php echo esc_html( get_bloginfo( 'wpurl' ) ) . '/wp-admin/options-general.php?page=ce-options'; ?>">
58
 
59
  <table class="form-table">
 
 
 
 
 
 
 
60
  <tr>
61
  <th scope="row"><label for="code_embed_excerpt"><?php echo esc_html( ucwords( __( 'Allow in excerpts', 'simple-embed-code' ) ) ); ?></label></th>
62
  <td><input type="checkbox" name="code_embed_excerpt" value="1"
readme.txt CHANGED
@@ -1,16 +1,19 @@
1
  === Code Embed ===
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
 
11
  Code Embed provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.
12
 
13
- == Description ==
 
 
14
 
15
  Code Embed allows you to embed code (JavaScript and HTML - it can't be used for server-side code, such as PHP) in a post, without the content being changed by the editor. This is incredibly useful for embedding third-party scripts, etc. The plugin is used by many large sites, including Mozilla.
16
 
@@ -25,16 +28,6 @@ Key features include...
25
  * Embed an external script directly using just the URL
26
  * And much, much more!
27
 
28
- Technical specification...
29
-
30
- * Licensed under [GPLv2 (or later)](http://wordpress.org/about/gpl/ "GNU General Public License")
31
- * Designed for both single and multi-site installations
32
- * PHP7 compatible
33
- * Passes [WordPress.com VIP](https://vip.wordpress.com) coding standards and fully compatible with their platform
34
- * Fully internationalized, ready for translations **If you would like to add a translation to this plugin then please head to our [Translating WordPress](https://translate.wordpress.org/projects/wp-plugins/simple-embed-code "Translating WordPress") page**
35
- * GDPR compliant
36
- * See FAQ for Gutenberg compatibility
37
-
38
  Please visit the [Github page](https://github.com/dartiss/code-embed "Github") for the latest code development, planned enhancements and known issues.
39
 
40
  == Getting Started ==
@@ -148,7 +141,16 @@ Code Embed can be found and installed via the Plugin menu within WordPress admin
148
 
149
  Voila! It's ready to go.
150
 
151
- == Frequently Asked Questions ==
 
 
 
 
 
 
 
 
 
152
 
153
  = My code doesn't work =
154
 
@@ -166,10 +168,6 @@ If you still can't find it then you may have a theme or plugin that removes this
166
 
167
  WordPress stores the custom field contents in a MySQL table using the `longtext` format. This can hold over 4 billion characters.
168
 
169
- == Does this work with Gutenberg? ==
170
-
171
- Right now, no, as the custom fields meta box will not be present. However, a rather smart plugin named [Custom Fields for Gutenberg](https://wordpress.org/plugins/custom-fields-gutenberg/) will add this functionality back in - with that active, you can happily continue to use this plugin.
172
-
173
  == Is this GDPR compliant? ==
174
 
175
  It is, in that it doesn't save any data that could be odds with GDPR compliance (i.e. it's compliant by design). However, if you use this to embed third-party scripts, then those scripts may not be and you will need to speak to the providers for further details.
@@ -187,8 +185,12 @@ 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.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
@@ -296,5 +298,5 @@ versions of this plugin
296
 
297
  == Upgrade Notice ==
298
 
299
- = 2.3.2 =
300
- * Minor bug fix
1
  === Code Embed ===
2
+ Contributors: dartiss
3
+ Donate link: https://artiss.blog/donate
4
  Tags: code, embed, html, javascript, script
5
  Requires at least: 4.6
6
+ Tested up to: 5.4
7
  Requires PHP: 5.3
8
+ Stable tag: 2.3.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
  Code Embed provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.
13
 
14
+ == Description ==
15
+
16
+ **Note for users of WordPress 5.0 and above: please see the FAQ for details on using this plugin with Gutenberg**
17
 
18
  Code Embed allows you to embed code (JavaScript and HTML - it can't be used for server-side code, such as PHP) in a post, without the content being changed by the editor. This is incredibly useful for embedding third-party scripts, etc. The plugin is used by many large sites, including Mozilla.
19
 
28
  * Embed an external script directly using just the URL
29
  * And much, much more!
30
 
 
 
 
 
 
 
 
 
 
 
31
  Please visit the [Github page](https://github.com/dartiss/code-embed "Github") for the latest code development, planned enhancements and known issues.
32
 
33
  == Getting Started ==
141
 
142
  Voila! It's ready to go.
143
 
144
+ == Frequently Asked Questions ==
145
+
146
+ == Can I use this plugin with the new block editor (aka Gutenberg) / WordPress 5.0 and above? ==
147
+
148
+ Yes, you can. By default, custom fields are hidden inside the block editor but can be revealed.
149
+
150
+ 1. Edit a post
151
+ 2. Click the settings button (three dots) in the top, right-hand corner
152
+ 3. Go to Options
153
+ 4. You will find a tick box to display the 'Custom Fields' meta box
154
 
155
  = My code doesn't work =
156
 
168
 
169
  WordPress stores the custom field contents in a MySQL table using the `longtext` format. This can hold over 4 billion characters.
170
 
 
 
 
 
171
  == Is this GDPR compliant? ==
172
 
173
  It is, in that it doesn't save any data that could be odds with GDPR compliance (i.e. it's compliant by design). However, if you use this to embed third-party scripts, then those scripts may not be and you will need to speak to the providers for further details.
185
 
186
  [Learn more about my version numbering methodology](https://artiss.blog/2016/09/wordpress-plugin-versioning/ "WordPress Plugin Versioning")
187
 
188
+ = 2.3.3 =
189
+ * Enhancement: I've removed the debug code. I allowed to be switched off but I've never used it and it may not have switched off properly anyway. So it's gone
190
+ * Enhancement: Added some additional plugin meta
191
+
192
  = 2.3.2 =
193
+ * 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
194
 
195
  = 2.3.1 =
196
  * Bug: Fixed a variable naming issue that I may, or may not (I did), have created in the latest release
298
 
299
  == Upgrade Notice ==
300
 
301
+ = 2.3.3 =
302
+ * Minor change to code output
simple-code-embed.php CHANGED
@@ -1,39 +1,32 @@
1
  <?php
2
- /*
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
10
- */
11
 
12
- /**
13
- * Code Embed
14
- *
15
- * Embed code into a post
16
- *
17
- * @package Code-Embed
18
- * @since 1.6
19
- */
20
 
21
- define( 'CODE_EMBED_VERSION', '2.3.2' );
22
 
23
- // Include all the various functions
24
 
25
  $functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
26
 
27
- include_once( $functions_dir . 'initialise.php' ); // Initialisation scripts
28
 
29
  if ( is_admin() ) {
30
 
31
- include_once( $functions_dir . 'admin-config.php' ); // Various administration config. options
32
 
33
  } else {
34
 
35
- include_once( $functions_dir . 'add-scripts.php' ); // Add scripts to the main theme
36
 
37
- include_once( $functions_dir . 'add-embeds.php' ); // Filter to apply code embeds
38
 
39
  }
1
  <?php
2
+ /**
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.3
7
  Author: David Artiss
8
  Author URI: https://artiss.blog
9
  Text Domain: simple-embed-code
 
10
 
11
+ @package Code-Embed
12
+ */
 
 
 
 
 
 
13
 
14
+ define( 'CODE_EMBED_VERSION', '2.3.3' );
15
 
16
+ // Include all the various functions.
17
 
18
  $functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
19
 
20
+ require_once $functions_dir . 'initialise.php'; // Initialisation scripts.
21
 
22
  if ( is_admin() ) {
23
 
24
+ require_once $functions_dir . 'admin-config.php'; // Various administration config. options.
25
 
26
  } else {
27
 
28
+ require_once $functions_dir . 'add-scripts.php'; // Add scripts to the main theme.
29
 
30
+ require_once $functions_dir . 'add-embeds.php'; // Filter to apply code embeds.
31
 
32
  }