You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Code Embed
2
2
3
-
<imgsrc="https://ps.w.org/simple-embed-code/assets/icon-128x128.png"align="left">Code Embed allows you to embed code – JavaScript and HTML primarily – in a post. This is incredibly useful for embedding video, etc, when required and is used, amongst other, by Mozilla.
3
+
<imgsrc="https://ps.w.org/simple-embed-code/assets/icon-128x128.png"align="left">Code Embed allows you to embed code – JavaScript, CSS and HTML primarily – in a post. This is incredibly useful for embedding video, etc, when required and is used, amongst other, by Mozilla.
4
4
5
5
It cannot be used for server side code, such as PHP.
* Function to look for and, if available, return the global embed code
209
-
*
210
-
* @since 1.6
211
-
*
212
-
* @uses ce_report_error Generate an error message
213
-
*
214
-
* @param $ident string The embed code opening identifier
215
-
* @param $suffix string The embed code suffix
216
-
* @return string The embed code (or error)
217
-
*/
218
-
197
+
* Get the Global Embed Code
198
+
*
199
+
* Function to look for and, if available, return the global embed code
200
+
*
201
+
* @uses ce_report_error Generate an error message
202
+
*
203
+
* @param string $ident The embed code opening identifier.
204
+
* @param string $suffix The embed code suffix.
205
+
* @return string The embed code (or error)
206
+
*/
219
207
functionce_get_embed_code( $ident, $suffix ) {
220
208
221
-
// Meta was not found in current post so look across meta table - find the number of distinct code results
209
+
// Meta was not found in current post so look across meta table - find the number of distinct code results.
222
210
223
211
$meta_name = $ident . $suffix;
224
212
global$wpdb;
@@ -227,29 +215,29 @@ function ce_get_embed_code( $ident, $suffix ) {
227
215
228
216
if ( 0 < $records ) {
229
217
230
-
// Results were found
218
+
// Results were found.
231
219
232
220
$meta = $wpdb->get_results( $wpdb->prepare( "SELECT meta_value, post_title, ID FROM $wpdb->postmeta, $wpdb->posts WHERE meta_key = %s AND post_id = ID", $meta_name ) ); // @codingStandardsIgnoreLine -- requires the latest data when called, so caching is inappropriate
233
221
$total_records = $wpdb->num_rows;
234
222
235
223
if ( 1 === $records ) {
236
224
237
-
// Only one unique code result returned so assume this is the global embed
225
+
// Only one unique code result returned so assume this is the global embed.
238
226
239
227
foreach ( $metaas$meta_data ) {
240
228
$html = $meta_data->meta_value;
241
229
}
242
230
} else {
243
231
244
-
// More than one unique code result returned, so output the list of posts
232
+
// More than one unique code result returned, so output the list of posts.
245
233
246
234
/* translators: %1$s: embed name, %2$d: number of pieces of code being stored with that name, %3$d: number of posts using that embed name */
247
235
$error = sprintf( __( 'Cannot use %1$s as a global code as it is being used to store %2$d unique pieces of code in %3$d posts', 'simple-embed-code' ), $meta_name, $records, $total_records );
0 commit comments