Code Embed - Version 2.0

Version Description

  • Maintenance: Removed dashboard widget
  • Maintenance: Further code tidying
  • Maintenance: Added new code for contextual help to use new WP 3.3 elements
  • Enhancement: New admin menu option, under which existing option screens now exist along with a support screen. If you have the README Parser plugin installed then it will also add a sub-menu displaying README instructions
  • Enhancement: Added internationalization to code
  • Enhancement: Will now work with widgets if you install the plugin Widget Logic
  • Enhancement: Added experimental ability to convert to responsive output
  • Enhancement: Added option to specify a URL instead of an embed code
  • Enhancement: Added feature pointer for when plugin is activated
Download this release

Release Info

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

Code changes from version 1.6.1 to 2.0

css/ace-video-container UNCOMPRESSED.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ace-video-container {
2
+ position: relative;
3
+ padding-bottom: 56.25%;
4
+ height: 0;
5
+ overflow: hidden;
6
+ }
7
+
8
+ .ace-video-container iframe,
9
+ .ace-video-container object,
10
+ .ace-video-container embed {
11
+ position: absolute;
12
+ top: 0;
13
+ left: 0;
14
+ width: 100%;
15
+ height: 100%;
16
+ }
css/ace-video-container.css ADDED
@@ -0,0 +1 @@
 
1
+ .ace-video-container{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;}.ace-video-container iframe,.ace-video-container object,.ace-video-container embed{position:absolute;top:0;left:0;width:100%;height:100%;}
images/menu_icon.png ADDED
Binary file
images/screen_icon.png ADDED
Binary file
includes/ace-add-scripts.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add Scripts
4
+ *
5
+ * Add CSS to the main theme
6
+ *
7
+ * @package Artiss-Code-Embed
8
+ */
9
+
10
+ /**
11
+ * Add scripts to theme
12
+ *
13
+ * Add styles to the main theme
14
+ *
15
+ * @since 2.0
16
+ */
17
+
18
+ function ace_main_scripts() {
19
+
20
+ wp_register_style( 'ace_responsive', plugins_url( '/simple-embed-code/css/ace-video-container.css' ) );
21
+
22
+ wp_enqueue_style( 'ace_responsive' );
23
+
24
+ }
25
+
26
+ add_action( 'wp_enqueue_scripts', 'ace_main_scripts' );
27
+ ?>
includes/ace-admin-config.php ADDED
@@ -0,0 +1,362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Administration Menu Options
4
+ *
5
+ * Add various adminstration menu options
6
+ *
7
+ * @package Artiss-Code-Embed
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 ace_add_settings_link( $links, $file ) {
23
+
24
+ static $this_plugin;
25
+
26
+ if ( !$this_plugin ) { $this_plugin = plugin_basename( __FILE__ ); }
27
+
28
+ if ( strpos( $file, 'code-embed.php' ) !== false ) {
29
+ $settings_link = '<a href="admin.php?page=ace-options">' . __( 'Settings' ) . '</a>';
30
+ array_unshift( $links, $settings_link );
31
+ }
32
+
33
+ return $links;
34
+ }
35
+ add_filter( 'plugin_action_links', 'ace_add_settings_link', 10, 2 );
36
+
37
+ /**
38
+ * Add meta to plugin details
39
+ *
40
+ * Add options to plugin meta line
41
+ *
42
+ * @since 1.6
43
+ *
44
+ * @param string $links Current links
45
+ * @param string $file File in use
46
+ * @return string Links, now with settings added
47
+ */
48
+
49
+ function ace_set_plugin_meta( $links, $file ) {
50
+
51
+ if ( strpos( $file, 'code-embed.php' ) !== false ) {
52
+
53
+ $links = array_merge( $links, array( '<a href="http://www.artiss.co.uk/forum/specific-plugins-group2/artiss-code-embed-forum3">' . __( 'Support' ) . '</a>' ) );
54
+ $links = array_merge( $links, array( '<a href="http://www.artiss.co.uk/donate">' . __( 'Donate' ) . '</a>' ) );
55
+ }
56
+
57
+ return $links;
58
+ }
59
+ add_filter( 'plugin_row_meta', 'ace_set_plugin_meta', 10, 2 );
60
+
61
+ /**
62
+ * Code Embed Menu
63
+ *
64
+ * Add a new option to the Admin menu and context menu
65
+ *
66
+ * @since 1.4
67
+ *
68
+ * @uses ace_help Return help text
69
+ */
70
+
71
+ function ace_menu() {
72
+
73
+ // Depending on WordPress version and available functions decide which (if any) contextual help system to use
74
+
75
+ $contextual_help = ace_contextual_help_type();
76
+
77
+ // Add main admin option
78
+
79
+ add_menu_page( 'Artiss Code Embed Settings', 'Code Embed', 'edit_posts', 'ace-search', 'ace_search', plugins_url() . '/simple-embed-code/images/menu_icon.png' );
80
+
81
+ // Add search sub-menu
82
+
83
+ if ( $contextual_help == 'new' ) { global $ace_search_hook; }
84
+
85
+ $ace_search_hook = add_submenu_page( 'ace-search', 'Artiss Code Embed Search', 'Search', 'edit_posts', 'ace-search', 'ace_search' );
86
+
87
+ if ( $contextual_help == 'new' ) { add_action('load-'.$ace_search_hook, 'ace_add_search_help'); }
88
+
89
+ if ( $contextual_help == 'old' ) { add_contextual_help( $ace_search_hook, ace_search_help() ); }
90
+
91
+ // Add options sub-menu
92
+
93
+ if ( $contextual_help == 'new' ) { global $ace_options_hook; }
94
+
95
+ $ace_options_hook = add_submenu_page( 'ace-search', 'Artiss Code Embed Settings', 'Options', 'manage_options', 'ace-options', 'ace_options' );
96
+
97
+ if ( $contextual_help == 'new' ) { add_action('load-'.$ace_options_hook, 'ace_add_options_help'); }
98
+
99
+ if ( $contextual_help == 'old' ) { add_contextual_help( $ace_options_hook, ace_options_help() ); }
100
+
101
+ // Add readme sub-menu
102
+
103
+ if ( function_exists( 'wp_readme_parser' ) ) {
104
+ add_submenu_page( 'ace-search', 'Artiss Code Embed README', 'README', 'edit_posts', 'ace-readme', 'ace_readme' );
105
+ }
106
+
107
+ // Add support sub-menu
108
+
109
+ add_submenu_page( 'ace-search', 'Artiss Code Embed Support', 'Support', 'edit_posts', 'ace-support', 'ace_support' );
110
+
111
+ }
112
+ add_action( 'admin_menu','ace_menu' );
113
+
114
+ /**
115
+ * Get contextual help type
116
+ *
117
+ * Return whether this WP installtion requires the new or old contextual help type, or none at all
118
+ *
119
+ * @since 2.0
120
+ *
121
+ * @return string Contextual help type - 'new', 'old' or false
122
+ */
123
+
124
+ function ace_contextual_help_type() {
125
+
126
+ global $wp_version;
127
+
128
+ $type = false;
129
+
130
+ if ( ( float ) $wp_version >= 3.3 ) {
131
+ $type = 'new';
132
+ } else {
133
+ if ( function_exists( 'add_contextual_help' ) ) {
134
+ $type = 'old';
135
+ }
136
+ }
137
+
138
+ return $type;
139
+
140
+ }
141
+
142
+ /**
143
+ * Add Options Help
144
+ *
145
+ * Add help tab to options screen
146
+ *
147
+ * @since 2.0
148
+ *
149
+ * @uses ace_options_help Return help text
150
+ */
151
+
152
+ function ace_add_options_help() {
153
+
154
+ global $ace_options_hook;
155
+ $screen = get_current_screen();
156
+
157
+ if ( $screen->id != $ace_options_hook ) { return; }
158
+
159
+ $screen -> add_help_tab( array( 'id' => 'ace-options-help-tab', 'title' => __( 'Help' ), 'content' => ace_options_help() ) );
160
+ }
161
+
162
+ /**
163
+ * Add Search Help
164
+ *
165
+ * Add help tab to search screen
166
+ *
167
+ * @since 2.0
168
+ *
169
+ * @uses ace_search_help Return help text
170
+ */
171
+
172
+ function ace_add_search_help() {
173
+
174
+ global $ace_search_hook;
175
+ $screen = get_current_screen();
176
+
177
+ if ( $screen->id != $ace_search_hook ) { return; }
178
+
179
+ $screen -> add_help_tab( array( 'id' => 'ace-search-help-tab', 'title' => __( 'Help' ), 'content' => ace_search_help() ) );
180
+ }
181
+
182
+ /**
183
+ * Code Embed Options
184
+ *
185
+ * Define an option screen
186
+ *
187
+ * @since 1.4
188
+ */
189
+
190
+ function ace_options() {
191
+
192
+ include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'ace-options.php' );
193
+
194
+ }
195
+
196
+ /**
197
+ * Code Embed Search
198
+ *
199
+ * Define a the search screen
200
+ *
201
+ * @since 1.6
202
+ */
203
+
204
+ function ace_search() {
205
+
206
+ include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'ace-search.php' );
207
+
208
+ }
209
+
210
+ /**
211
+ * Code Embed README
212
+ *
213
+ * Define the README screen
214
+ *
215
+ * @since 2.0
216
+ */
217
+
218
+ function ace_readme() {
219
+
220
+ include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'ace-readme.php' );
221
+
222
+ }
223
+
224
+ /**
225
+ * Code Embed Support
226
+ *
227
+ * Define the support screen
228
+ *
229
+ * @since 2.0
230
+ */
231
+
232
+ function ace_support() {
233
+
234
+ include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'ace-support.php' );
235
+
236
+ }
237
+
238
+ /**
239
+ * Code Embed Options Help
240
+ *
241
+ * Return help text for options screen
242
+ *
243
+ * @since 1.5
244
+ *
245
+ * @return string Help Text
246
+ */
247
+
248
+ function ace_options_help() {
249
+
250
+ $help_text = '<p>' . __( 'Use this screen to modify the identifiers and keyword used to specify your embedded code.' ) . '</p>';
251
+ $help_text .= '<p>' . __( 'The keyword is the name used for your custom field. The custom field\'s value is the code that you wish to embed.' ) . '</p>';
252
+ $help_text .= '<p>' . __( 'The keyword, sandwiched with the identifier before and after, is what you then need to add to your post or page to activate the embed code.' ) . '</p>';
253
+ $help_text .= '<h4>' . __( 'This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.' ) . '</h4>';
254
+
255
+ return $help_text;
256
+ }
257
+
258
+ /**
259
+ * Code Embed Search Help
260
+ *
261
+ * Return help text for search screen
262
+ *
263
+ * @since 1.6
264
+ *
265
+ * @return string Help Text
266
+ */
267
+
268
+ function ace_search_help() {
269
+
270
+ $help_text = '<p>' . __( 'This screen allows you to search for the post and pages that a particular code embed has been used in.' ) . '</p>';
271
+ $help_text .= '<p>' . __( 'Simply enter the code suffix that you wish to search for and press the \'Search\' key to display a list of all the posts using it. In addition the code will be shown alongside it. Click on the post name to edit the post.' ) . '</p>';
272
+ $help_text .= '<p>' . __( 'The search results are grouped together in matching code groups, so posts with the same code will be shown together with the same colour background.' ) . '</p>';
273
+ $help_text .= '<h4>' . __( 'This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.' ) . '</h4>';
274
+
275
+ return $help_text;
276
+ }
277
+
278
+ /**
279
+ * Detect plugin activation
280
+ *
281
+ * Upon detection of activation set an option
282
+ *
283
+ * @since 2.0
284
+ */
285
+
286
+ function ace_plugin_activate() {
287
+
288
+ update_option( 'artiss_code_embed_activated', true );
289
+
290
+ }
291
+ register_activation_hook( WP_PLUGIN_DIR . "/simple-embed-code/simple-code-embed.php", 'ace_plugin_activate' );
292
+
293
+ // If plugin activated, run activation commands and delete option
294
+
295
+ global $wp_version;
296
+
297
+ if ( get_option( 'artiss_code_embed_activated' ) ) {
298
+
299
+ if ( ( float ) $wp_version >= 3.3 ) {
300
+
301
+ add_action( 'admin_enqueue_scripts', 'ace_admin_enqueue_scripts' );
302
+
303
+ }
304
+
305
+ delete_option( 'artiss_code_embed_activated' );
306
+ }
307
+
308
+ /**
309
+ * Enqueue Feature Pointer files
310
+ *
311
+ * Add the required feature pointer files
312
+ *
313
+ * @since 2.0
314
+ */
315
+
316
+ function ace_admin_enqueue_scripts() {
317
+
318
+ wp_enqueue_style( 'wp-pointer' );
319
+ wp_enqueue_script( 'wp-pointer' );
320
+
321
+ add_action( 'admin_print_footer_scripts', 'ace_admin_print_footer_scripts' );
322
+ }
323
+
324
+ /**
325
+ * Show Feature Pointer
326
+ *
327
+ * Display feature pointer
328
+ *
329
+ * @since 2.0
330
+ */
331
+
332
+ function ace_admin_print_footer_scripts() {
333
+
334
+ $pointer_content = '<h3>' . __( 'Welcome to Artiss Code Embed' ) . '</h3>';
335
+ $pointer_content .= '<p style="font-style:italic;">' . __( 'Thank you for installing this plugin.' ) . '</p>';
336
+ $pointer_content .= '<p>' . __( 'A new menu has been added to the sidebar. This will allow you to change the keywords and identifiers used for embedding as well as providing a method for searching for code embeds.' );
337
+ ?>
338
+ <script>
339
+ jQuery(function () {
340
+ var body = jQuery(document.body),
341
+ menu = jQuery('#toplevel_page_ace-options'),
342
+ collapse = jQuery('#collapse-menu'),
343
+ pluginmenu = menu.find("a[href='admin.php?page=ace-options']"),
344
+ options = {
345
+ content: '<?php echo $pointer_content; ?>',
346
+ position: {
347
+ edge: 'left',
348
+ align: 'center',
349
+ of: menu.is('.wp-menu-open') && !menu.is('.folded *') ? pluginmenu : menu
350
+ },
351
+ close: function() {
352
+ }};
353
+
354
+ if ( !pluginmenu.length )
355
+ return;
356
+
357
+ body.pointer(options).pointer('open');
358
+ });
359
+ </script>
360
+ <?php
361
+ }
362
+ ?>
includes/ace-filter.php ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add Embed to Posts
4
+ *
5
+ * Functions to add embed code to posts
6
+ *
7
+ * @package Artiss-Code-Embed
8
+ */
9
+
10
+ /**
11
+ * Add filter to add embed code
12
+ *
13
+ * Filter to add embed to any posts
14
+ *
15
+ * @since 1.5
16
+ *
17
+ * @uses ace_get_embed_paras Get default options
18
+ * @uses ace_get_embed_code Get embed code from other posts
19
+ *
20
+ * @param string $content Post content without embedded code
21
+ * @return string Post content with embedded code
22
+ */
23
+
24
+ function ace_filter( $content ) {
25
+
26
+ global $post;
27
+
28
+ // Set initial values
29
+
30
+ $options = ace_get_embed_paras();
31
+ $found_pos = strpos( $content, $options[ 'opening_ident' ] . $options[ 'keyword_ident' ], 0 );
32
+ $prefix_len = strlen( $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] );
33
+
34
+ // Loop around the post content looking for all requests for code embeds
35
+
36
+ while ( $found_pos !== false ) {
37
+
38
+ // Get the position of the closing identifier - ignore if one is not found
39
+
40
+ $end_pos = strpos( $content, $options[ 'closing_ident' ], $found_pos + $prefix_len );
41
+ if ( $end_pos !== false ) {
42
+
43
+ // Extract the suffix
44
+
45
+ $suffix_len = $end_pos - ( $found_pos + $prefix_len );
46
+ if ( $suffix_len == 0 ) {
47
+ $suffix = '';
48
+ } else {
49
+ $suffix = substr( $content, $found_pos + $prefix_len, $suffix_len );
50
+ }
51
+ $full_suffix = $suffix;
52
+
53
+ // Check for responsive part of suffix
54
+
55
+ $responsive = false;
56
+ $max_width = false;
57
+ $res_pos = false;
58
+ if ( strlen( $suffix ) > 1 ) { $res_pos = strpos( $suffix, '_RES', 1 ); }
59
+
60
+ if ( $res_pos !== false ) {
61
+
62
+ // If responsive section found, check it's at the end of has an underscore afterwards
63
+ // Otherwise it may be part of something else
64
+
65
+ if ( $res_pos == strlen( $suffix) - 4 ) {
66
+ $responsive = true;
67
+ } else {
68
+ if ( substr( $suffix, $res_pos+4, 1 ) == '_' ) {
69
+ $responsive = true;
70
+ $max_width = substr( $suffix, $res_pos + 5 );
71
+ if ( !is_numeric( $max_width ) ) { $max_width = ''; }
72
+ }
73
+ }
74
+
75
+ if ( $responsive ) { $suffix = substr( $suffix, 0, $res_pos ); }
76
+ }
77
+
78
+ // Get the custom field data and replace in the post
79
+
80
+ if ( $suffix_len < 13 ) {
81
+
82
+ $search = $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] . $suffix . $options[ 'closing_ident' ];
83
+
84
+ // Get the meta for the current post
85
+ $post_meta = get_post_meta( $post -> ID, $options[ 'keyword_ident' ].$suffix, false );
86
+ if ( isset( $post_meta[ 0 ] ) ) {
87
+ $html = $post_meta[ 0 ];
88
+ } else {
89
+ // No meta found, so look for it elsewhere
90
+ $html = ace_get_embed_code( $options[ 'keyword_ident' ], $suffix );
91
+ }
92
+
93
+ // Build the string to search for
94
+
95
+ $search = $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] . $full_suffix . $options[ 'closing_ident' ];
96
+
97
+ // Build the string of code to replace with
98
+
99
+ $replace = ace_generate_code( $html, 'Artiss Code Embed', $responsive, $max_width );
100
+
101
+ // Now modify all references
102
+
103
+ $content = str_replace( $search , $replace, $content );
104
+ }
105
+ }
106
+ $found_pos = strpos( $content, $options[ 'opening_ident' ] . $options[ 'keyword_ident' ], $found_pos + 1 );
107
+ }
108
+
109
+ // Loop around the post content looking for HTTP addresses
110
+
111
+ $content = ace_quick_replace( $content, $options, 'http://' );
112
+
113
+ // Loop around the post content looking for HTTPS addresses
114
+
115
+ $content = ace_quick_replace( $content, $options, 'https://' );
116
+
117
+ return $content;
118
+ }
119
+
120
+ add_filter( 'the_content', 'ace_filter' );
121
+ add_filter( 'widget_content', 'ace_filter' );
122
+
123
+ /**
124
+ * Quick Replace
125
+ *
126
+ * Function to do a quick search/replace of the content
127
+ *
128
+ * @since 2.0
129
+ *
130
+ * @param $content string The content
131
+ * @param $options string The options array
132
+ * @param $search string The string to search for
133
+ * @return string The updated content
134
+ */
135
+
136
+ function ace_quick_replace( $content = '', $options = '', $search = '' ) {
137
+
138
+ $start_pos = strpos( $content, $options[ 'opening_ident' ] . $search, 0 );
139
+ $prefix_len = strlen( $options[ 'opening_ident' ] );
140
+
141
+ while ( $start_pos !== false ) {
142
+
143
+ $start_pos = $start_pos + strlen( $options[ 'opening_ident' ] );
144
+ $end_pos = strpos( $content, $options[ 'closing_ident' ], $start_pos );
145
+ if ( $end_pos !== false ) {
146
+ $url = substr( $content, $start_pos, $end_pos - $start_pos );
147
+ $file = ace_get_file( $url );
148
+ $content = str_replace ( $options[ 'opening_ident' ] . $url . $options[ 'closing_ident' ], $file[ 'file' ], $content );
149
+ }
150
+ $start_pos = strpos( $content, $options[ 'opening_ident' ] . $search, $found_pos );
151
+
152
+ }
153
+
154
+ return $content;
155
+ }
156
+
157
+ /**
158
+ * Generate Embed Code
159
+ *
160
+ * Function to generate the embed code that will be output
161
+ *
162
+ * @since 2.0
163
+ *
164
+ * @param $html string The embed code (required)
165
+ * @param $plugin_name string The name of the plugin (required)
166
+ * @param $responsive string Responsive output required? (optional)
167
+ * @param $max_width string Maximum width of responsive output (optional)
168
+ * @return string The embed code
169
+ */
170
+
171
+ function ace_generate_code( $html, $plugin_name, $responsive = '', $max_width = '' ) {
172
+
173
+ $code = "\n<!-- " . $plugin_name . ' v' . artiss_code_embed_version . " | http://www.artiss.co.uk/code-embed -->\n";
174
+
175
+ if ( $max_width !== false ) { $code .= '<div style="width: ' . $max_width . 'px; max-width: 100%">'; }
176
+
177
+ if ( $responsive ) { $code .= '<div class="ace-video-container">'; }
178
+
179
+ $code .= $html;
180
+
181
+ if ( $responsive ) { $code .= '</div>'; }
182
+
183
+ if ( $max_width !== false ) { $code .= '</div>'; }
184
+
185
+ $code .= "\n<!-- End of " . $plugin_name . " code -->\n";
186
+
187
+ return $code;
188
+ }
189
+
190
+ /**
191
+ * Get the Global Embed Code
192
+ *
193
+ * Function to look for and, if available, return the global embed code
194
+ *
195
+ * @since 1.6
196
+ *
197
+ * @uses ace_report_error Generate an error message
198
+ *
199
+ * @param $ident string The embed code opening identifier
200
+ * @param $suffix string The embed code suffix
201
+ * @return string The embed code (or error)
202
+ */
203
+
204
+ function ace_get_embed_code( $ident, $suffix ) {
205
+
206
+ // Meta was not found in current post so look across meta table - find the number of distinct code results
207
+
208
+ $meta_name = $ident . $suffix;
209
+ global $wpdb;
210
+ $unique_records = $wpdb -> get_results( "SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = '" . $meta_name . "'" );
211
+ $records = $wpdb -> num_rows;
212
+
213
+ if ( $records > 0 ) {
214
+
215
+ // Results were found
216
+
217
+ $meta = $wpdb -> get_results( "SELECT meta_value, post_title, ID FROM $wpdb->postmeta, $wpdb->posts WHERE meta_key = '" . $meta_name . "' AND post_id = ID" );
218
+ $total_records = $wpdb -> num_rows;
219
+
220
+ if ( $records == 1 ) {
221
+
222
+ // Only one unique code result returned so assume this is the global embed
223
+
224
+ foreach ( $meta as $meta_data ) {
225
+ $html = $meta_data -> meta_value;
226
+ }
227
+
228
+ } else {
229
+
230
+ // More than one unique code result returned, so output the list of posts
231
+
232
+ $error = sprintf( __( 'Cannot use %s as a global code as it is being used to store %d unique pieces of code in %d posts - <a href="%s">click here</a> for more details' ), $meta_name, $records, $total_records, get_bloginfo( 'wpurl' ) . '/wp-admin/admin.php?page=ace-search&amp;suffix=' . $suffix );
233
+ $html = ace_report_error( $error, 'Artiss Code Embed', false );
234
+ }
235
+ } else {
236
+
237
+ // No meta code was found so write out an error
238
+
239
+ $html = ace_report_error( sprintf( __( 'No embed code was found for %s' ), $meta_name ), 'Artiss Code Embed', false );
240
+
241
+ }
242
+ return $html;
243
+ }
244
+
245
+ /**
246
+ * Fetch a file (1.6)
247
+ *
248
+ * Use WordPress API to fetch a file and check results
249
+ * RC is 0 to indicate success, -1 a failure
250
+ *
251
+ * @since 2.0
252
+ *
253
+ * @param string $filein File name to fetch
254
+ * @param string $header Only get headers?
255
+ * @return string Array containing file contents and response
256
+ */
257
+
258
+ function ace_get_file( $filein, $header = false ) {
259
+
260
+ $rc = 0;
261
+ $error = '';
262
+ if ( $header ) {
263
+ $fileout = wp_remote_head( $filein );
264
+ if ( is_wp_error( $fileout ) ) {
265
+ $error = 'Header: ' . $fileout -> get_error_message();
266
+ $rc = -1;
267
+ }
268
+ } else {
269
+ $fileout = wp_remote_get( $filein );
270
+ if ( is_wp_error( $fileout ) ) {
271
+ $error = 'Body: ' . $fileout -> get_error_message();
272
+ $rc = -1;
273
+ } else {
274
+ if ( isset( $fileout[ 'body' ] ) ) {
275
+ $file_return[ 'file' ] = $fileout[ 'body' ];
276
+ }
277
+ }
278
+ }
279
+
280
+ $file_return[ 'error' ] = $error;
281
+ $file_return[ 'rc' ] = $rc;
282
+ if ( !is_wp_error( $fileout ) ) {
283
+ if ( isset( $fileout[ 'response' ][ 'code' ] ) ) {
284
+ $file_return[ 'response' ] = $fileout[ 'response' ][ 'code' ];
285
+ }
286
+ }
287
+
288
+ return $file_return;
289
+ }
290
+
291
+ /**
292
+ * Report an error (1.4)
293
+ *
294
+ * Function to report an error
295
+ *
296
+ * @since 1.6
297
+ *
298
+ * @param $error string Error message
299
+ * @param $plugin_name string The name of the plugin
300
+ * @param $echo string True or false, depending on whether you wish to return or echo the results
301
+ * @return string True or the output text
302
+ */
303
+
304
+ function ace_report_error( $error, $plugin_name, $echo = true ) {
305
+
306
+ $output = '<p style="color: #f00; font-weight: bold;">' . $plugin_name . ': ' . $error . "</p>\n";
307
+
308
+ if ( $echo ) {
309
+ echo $output;
310
+ return true;
311
+ } else {
312
+ return $output;
313
+ }
314
+
315
+ }
316
+ ?>
includes/{get-options.php → ace-get-options.php} RENAMED
File without changes
includes/ace-options.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Code Embed Options
4
+ *
5
+ * Allow the user to change the default options
6
+ *
7
+ * @package Artiss-Code-Embed
8
+ * @since 1.4
9
+ *
10
+ * @uses ace_get_embed_paras Get the options
11
+ * @uses ace_help Return help text
12
+ */
13
+ ?>
14
+ <div class="wrap">
15
+ <div class="icon32"><img src="<?php echo plugins_url(); ?>/simple-embed-code/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
16
+ <h2><?php _e( 'Artiss Code Embed Options' ); ?></h2>
17
+ <?php
18
+ // If options have been updated on screen, update the database
19
+ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'code-embed-profile' , 'code_embed_profile_nonce' ) ) ) {
20
+
21
+ // Update the options array from the form fields. Strip invalid tags.
22
+ $options[ 'opening_ident' ] = strtoupper( trim( $_POST[ 'code_embed_opening' ], '[]<>' ) );
23
+ $options[ 'keyword_ident' ] = strtoupper( trim( $_POST[ 'code_embed_keyword' ], '[]<>' ) );
24
+ $options[ 'closing_ident' ] = strtoupper( trim( $_POST[ 'code_embed_closing' ], '[]<>' ) );
25
+
26
+ // If any fields are blank assign default values
27
+ if ( $options[ 'opening_ident' ] == '' ) { $options[ 'opening_ident' ] = '%'; }
28
+ if ( $options[ 'keyword_ident' ] == '' ) { $options[ 'keyword_ident' ] = 'CODE'; }
29
+ if ( $options[ 'closing_ident' ] == '' ) { $options[ 'closing_ident' ] = '%'; }
30
+
31
+ update_option( 'artiss_code_embed', $options );
32
+ }
33
+
34
+ // Fetch options into an array
35
+ $options = ace_get_embed_paras();
36
+ ?>
37
+
38
+ <form method="post" action="<?php echo get_bloginfo( 'wpurl' ) . '/wp-admin/admin.php?page=ace-options&amp;updated=true' ?>">
39
+
40
+ <?php echo '<h3>' . __( 'Identifier Format' ) . '</h3>' . __( 'Specify the format that will be used to define the way the code is embedded in your post. The formats are case insensitive and characters &lt; &gt [ ] are invalid.' ); ?>
41
+
42
+ <table class="form-table">
43
+
44
+ <tr>
45
+ <th scope="row"><?php _e( 'Keyword' ); ?></th>
46
+ <td><input type="text" size="12" maxlength="12" name="code_embed_keyword" value="<?php echo $options[ 'keyword_ident' ] ; ?>"/>&nbsp;<span class="description"><?php _e( 'The keyword that is used to name the custom field and then place in your post where the code should be embedded. A suffix on any type can then be placed on the end.' ); ?></span></td>
47
+ </tr>
48
+
49
+ <tr>
50
+ <th scope="row"><?php _e( 'Opening Identifier' ); ?></th>
51
+ <td><input type="text" size="4" maxlength="4" name="code_embed_opening" value="<?php echo $options[ 'opening_ident' ]; ?>"/>&nbsp;<span class="description"><?php _e( 'The character(s) that must be placed in the post before the keyword to uniquely identify it.' ); ?></span></td>
52
+ </tr>
53
+
54
+ <tr>
55
+ <th scope="row"><?php _e( 'Closing Identifier' ); ?></th>
56
+ <td><input type="text" size="4" maxlength="4" name="code_embed_closing" value="<?php echo $options[ 'closing_ident' ]; ?>"/>&nbsp;<span class="description"><?php _e( 'The character(s) that must be placed in the post after the keyword to uniquely identify it.' ); ?></span></td>
57
+ </tr>
58
+
59
+ </table>
60
+
61
+ <?php wp_nonce_field( 'code-embed-profile', 'code_embed_profile_nonce', true, true ); ?>
62
+
63
+ <br/><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings' ); ?>"/>
64
+
65
+ </form>
66
+
67
+ </div>
includes/ace-readme.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * README Page
4
+ *
5
+ * Display the README instructions
6
+ *
7
+ * @package Artiss-Code-Embed
8
+ * @since 2.0
9
+ */
10
+ ?>
11
+ <div class="wrap">
12
+ <div class="icon32" id="icon-edit-pages"></div>
13
+
14
+ <h2><?php _e( 'Artiss Code Embed README'); ?></h2>
15
+
16
+ <?php
17
+ if ( !function_exists( 'wp_readme_parser' ) ) {
18
+ echo '<p>You shouldn\'t be able to see this but I guess that odd things can happen!<p>';
19
+ echo '<p>To display the README you must install the <a href="http://wordpress.org/extend/plugins/wp-readme-parser/">README Parser plugin</a>.</p>';
20
+ } else {
21
+ echo wp_readme_parser( array( 'exclude' => 'meta,upgrade notice,screenshots,support,changelog,links,installation,licence,reviews & mentions', 'ignore' => 'For help with this plugin,,for more information and advanced options ' ), 'Simple Embed Code' );
22
+ }
23
+ ?>
24
+ </div>
includes/{code-embed-search.php → ace-search.php} RENAMED
@@ -11,20 +11,20 @@
11
  */
12
  ?>
13
  <div class="wrap">
14
- <?php screen_icon(); ?>
15
  <h2>Artiss Code Embed Search</h2>
16
 
17
  <?php
18
- if ( !function_exists( 'add_contextual_help' ) ) {
19
  _e( ace_search_help() );
20
  } else {
21
- _e( '<p>Enter the suffix to search for below and press the "Search" button to view the results. Further help can be found by clicking on the Help tab at the top right-hand of the screen.</p>' );
22
  }
23
  ?>
24
 
25
  <?php
26
  // Get the suffix - either from the submitted field or via the URL line
27
- if ( $_GET[ 'suffix' ] != '' ) {
28
  $suffix = $_GET[ 'suffix' ];
29
  } else {
30
  if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'code-embed-search' , 'code_embed_search_nonce' ) ) ) {
@@ -38,7 +38,7 @@ if ( $_GET[ 'suffix' ] != '' ) {
38
  $options = ace_get_embed_paras();
39
  ?>
40
 
41
- <form method="post" action="<?php echo get_bloginfo( 'wpurl' ) . '/wp-admin/tools.php?page=code-embed-search&amp;updated=true'; ?>">
42
 
43
  <?php echo $options[ 'opening_ident' ] . $options[ 'keyword_ident' ]; ?>
44
 
@@ -52,8 +52,6 @@ $options = ace_get_embed_paras();
52
 
53
  </form>
54
 
55
- <h4>This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.</h4>
56
-
57
  <?php
58
  if ( $suffix != '' ) {
59
 
@@ -64,8 +62,8 @@ if ( $suffix != '' ) {
64
  if ( $records > 0 ) {
65
 
66
  echo '<table class="form-table">';
67
- $color1 = 'CCCCCC';
68
- $color2 = 'EAF2FA';
69
  $color = $color1;
70
  $prev_html = '';
71
 
@@ -75,6 +73,7 @@ if ( $suffix != '' ) {
75
  $post_id = $meta_data -> ID;
76
 
77
  // Switch background colours as the code changes
 
78
  if ( $html != $prev_html ) { if ( $color == $color1 ) { $color = $color2; } else { $color = $color1; } }
79
 
80
  echo "<tr style=\"background-color: #" . $color . "\">\n";
@@ -89,7 +88,7 @@ if ( $suffix != '' ) {
89
 
90
  } else {
91
 
92
- echo "<p style=\"color: #f00\">No posts were found containing that embed code.</p>\n";
93
 
94
  }
95
  }
11
  */
12
  ?>
13
  <div class="wrap">
14
+ <div class="icon32"><img src="<?php echo plugins_url(); ?>/simple-embed-code/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
15
  <h2>Artiss Code Embed Search</h2>
16
 
17
  <?php
18
+ if ( !ace_contextual_help_type() ) {
19
  _e( ace_search_help() );
20
  } else {
21
+ echo '<p>' . __( 'Enter the suffix to search for below and press the \'Search\' button to view the results. Further help can be found by clicking on the Help tab at the top right-hand of the screen.' ) . '</p>';
22
  }
23
  ?>
24
 
25
  <?php
26
  // Get the suffix - either from the submitted field or via the URL line
27
+ if ( isset ( $_GET[ 'suffix' ] ) ) {
28
  $suffix = $_GET[ 'suffix' ];
29
  } else {
30
  if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'code-embed-search' , 'code_embed_search_nonce' ) ) ) {
38
  $options = ace_get_embed_paras();
39
  ?>
40
 
41
+ <form method="post" action="<?php echo get_bloginfo( 'wpurl' ) . '/wp-admin/admin.php?page=ace-search&amp;updated=true'; ?>">
42
 
43
  <?php echo $options[ 'opening_ident' ] . $options[ 'keyword_ident' ]; ?>
44
 
52
 
53
  </form>
54
 
 
 
55
  <?php
56
  if ( $suffix != '' ) {
57
 
62
  if ( $records > 0 ) {
63
 
64
  echo '<table class="form-table">';
65
+ $color1 = 'dfdfdf';
66
+ $color2 = 'ececec';
67
  $color = $color1;
68
  $prev_html = '';
69
 
73
  $post_id = $meta_data -> ID;
74
 
75
  // Switch background colours as the code changes
76
+
77
  if ( $html != $prev_html ) { if ( $color == $color1 ) { $color = $color2; } else { $color = $color1; } }
78
 
79
  echo "<tr style=\"background-color: #" . $color . "\">\n";
88
 
89
  } else {
90
 
91
+ echo "<p style=\"color: #f00\">" . __( 'No posts were found containing that embed code.') . "</p>\n";
92
 
93
  }
94
  }
includes/ace-support.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Support Page
4
+ *
5
+ * Support for the plugin
6
+ *
7
+ * @package Artiss-Code-Embed
8
+ * @since 2.0
9
+ */
10
+ ?>
11
+ <div class="wrap">
12
+ <div class="icon32"><img src="<?php echo plugins_url(); ?>/simple-embed-code/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
13
+
14
+ <h2><?php _e( 'Artiss Code Embed Support'); ?></h2>
15
+
16
+ <p><?php echo sprintf( __( 'You are using Artiss Code Embed version %s. It was written by David Artiss.' ), artiss_code_embed_version ); ?></p>
17
+
18
+ <?php
19
+ $options = ace_get_embed_paras();
20
+
21
+ // How to embed
22
+
23
+ echo "<h3>" . __( 'How to Embed' ) . "</h3>\n";
24
+ echo '<p>' . sprintf ( __( 'Based upon your current settings to embed some code simply add a custom field named %s, where %s is any suffix you wish. The code to embed is then added as the field value.' ), '<strong>' . $options[ 'keyword_ident' ] . 'x</strong>', '<strong>x</strong>' ) . "</p>\n";
25
+ echo '<p>' . sprintf ( __( 'Then, to add the code into your post simple add %s where you wish it to appear. %s is the suffix you used for the custom field name.' ), '<strong>' . $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] . "x" . $options[ 'closing_ident' ] . '</strong>', '<strong>x</strong>' ) . "</p>\n";
26
+ echo '<p>' . sprintf ( __( 'For example, I may add a custom field named %s, where the value is the code I wish to embed. I would then in my post add %s where I wish the code to then appear.' ), '<strong>' . $options[ 'keyword_ident' ].'1</strong>', '<strong>' . $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] . "1" . $options[ 'closing_ident' ] . '</strong>' ) . "</p>\n";
27
+ echo '<p>' . sprintf ( __( 'To embed the same code but to make it responsive you would use %s. To set a maximum width you would use %s, where %s is the maximum width in pixels.' ), '<strong>' . $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] . "x_RES" . $options[ 'closing_ident' ] . '</strong>', '<strong>' . $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] . "x_RES_y" . $options[ 'closing_ident' ] . '</strong>', '<strong>y</strong>' ) . "</p>\n";
28
+ echo '<p>' . sprintf ( __( 'To embed an external URL you would type %s, where %s is the URL.' ), '<strong>' . $options[ 'opening_ident' ] . 'url' . $options[ 'closing_ident' ] . '</strong>', '<strong>url</strong>' ) . "</p>\n";
29
+
30
+ // Support information
31
+
32
+ echo '<h3>' . __( 'Support Information' ) . "</h3>\n";
33
+ echo '<p><a href="http://www.artiss.co.uk/code-embed">' . __( 'Artiss Code Embed Plugin Documentation' ) . "</a></p>\n";
34
+ echo '<p><a href="http://www.artiss.co.uk/forum/specific-plugins-group2/artiss-code-embed-forum3">' . __( 'Artiss Code Embed Support Forum' ) . "</a></p>\n";
35
+ echo '<h4>' . __( 'This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.' ) . "</h4>\n";
36
+
37
+ // Acknowledgements
38
+
39
+ echo '<h3>' . __( 'Acknowledgements' ) . "</h3>\n";
40
+ echo '<p>' . sprintf( __( 'Images have been compressed with %s.' ), '<a href="http://www.smushit.com/ysmush.it/">Smush.it</a>' ) . "</p>\n";
41
+ echo '<p>' . sprintf( __( 'CSS has been compressed with %s.' ), '<a href="http://www.artiss.co.uk/css-compression">Artiss.co.uk CSS Compressor</a>' ) . "</p>\n";
42
+
43
+ // Stay in touch
44
+
45
+ echo '<h3>' . __( 'Stay in Touch' ) . "</h3>\n";
46
+ echo '<p>' . __( '<a href="http://www.artiss.co.uk/wp-plugins">See the full list</a> of Artiss plugins, including beta releases.' ) . "</p>\n";
47
+ echo '<p>' . __( '<a href="http://www.twitter.com/artiss_tech">Follow Artiss.co.uk</a> on Twitter.' ) . "</p>\n";
48
+ echo '<p>' . __( '<a href="http://www.artiss.co.uk/feed">Subscribe</a> to the Artiss.co.uk news feed.' ) . "</p>\n";
49
+
50
+ ?>
51
+ </div>
includes/admin-menu.php DELETED
@@ -1,154 +0,0 @@
1
- <?php
2
- /**
3
- * Administration Menu Options
4
- *
5
- * Add various adminstration menu options
6
- *
7
- * @package Artiss-Code-Embed
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 ace_add_settings_link( $links, $file ) {
23
-
24
- static $this_plugin;
25
-
26
- if ( !$this_plugin ) { $this_plugin = plugin_basename( __FILE__ ); }
27
-
28
- if ( strpos( $file, 'code-embed.php' ) !== false ) {
29
- $settings_link = '<a href="admin.php?page=code-embed-options">' . __( 'Settings' ) . '</a>';
30
- array_unshift( $links, $settings_link );
31
- }
32
-
33
- return $links;
34
- }
35
- add_filter( 'plugin_action_links', 'ace_add_settings_link', 10, 2 );
36
-
37
- /**
38
- * Add meta to plugin details
39
- *
40
- * Add options to plugin meta line
41
- *
42
- * @since 1.6
43
- *
44
- * @param string $links Current links
45
- * @param string $file File in use
46
- * @return string Links, now with settings added
47
- */
48
-
49
- function ace_set_plugin_meta( $links, $file ) {
50
-
51
- if ( strpos( $file, 'code-embed.php' ) !== false ) {
52
-
53
- $links = array_merge( $links, array( '<a href="http://www.artiss.co.uk/forum/specific-plugins-group2/artiss-code-embed-forum3">' . __( 'Support' ) . '</a>' ) );
54
- $links = array_merge( $links, array( '<a href="http://www.artiss.co.uk/donate">' . __( 'Donate' ) . '</a>' ) );
55
- }
56
-
57
- return $links;
58
- }
59
- add_filter( 'plugin_row_meta', 'ace_set_plugin_meta', 10, 2 );
60
-
61
- /**
62
- * Code Embed Menu
63
- *
64
- * Add a new option to the Admin menu
65
- *
66
- * @since 1.4
67
- *
68
- * @uses ace_help Return help text
69
- */
70
-
71
- function ace_menu() {
72
-
73
- $code_embed_hook = add_options_page( 'Artiss Code Embed Settings', 'Code Embed', 10, 'code-embed-options', 'ace_options' );
74
-
75
- if ( function_exists( 'add_contextual_help' ) ) {
76
- add_contextual_help( $code_embed_hook, __( ace_options_help() ) );
77
- }
78
-
79
- $code_embed_hook = add_submenu_page( 'tools.php', 'Code Embed Search', 'Code Embed Search', 10, 'code-embed-search', 'ace_search' );
80
-
81
- if ( function_exists( 'add_contextual_help' ) ) {
82
- add_contextual_help( $code_embed_hook, __( ace_search_help() ) );
83
- }
84
-
85
- }
86
- add_action( 'admin_menu','ace_menu' );
87
-
88
- /**
89
- * Code Embed Options
90
- *
91
- * Define an option screen
92
- *
93
- * @since 1.4
94
- */
95
-
96
- function ace_options() {
97
-
98
- include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . "code-embed-options.php" );
99
-
100
- }
101
-
102
- /**
103
- * Code Embed Search
104
- *
105
- * Define a the search screen
106
- *
107
- * @since 1.6
108
- */
109
-
110
- function ace_search() {
111
-
112
- include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . "code-embed-search.php" );
113
-
114
- }
115
-
116
- /**
117
- * Code Embed Options Help
118
- *
119
- * Return help text for options screen
120
- *
121
- * @since 1.5
122
- *
123
- * @return string Help Text
124
- */
125
-
126
- function ace_options_help() {
127
-
128
- $help_text = '<p><a href="http://www.artiss.co.uk/code-embed">Artiss Code Embed Plugin Documentation</a></p>';
129
- $help_text .= '<p><a href="http://www.artiss.co.uk/forum/specific-plugins-group2/artiss-code-embed-forum3">Artiss Code Embed Support Forum</a></p>';
130
- $help_text .= '<p>All of my plugins are supported via <a title="Artiss.co.uk" href="http://www.artiss.co.uk" target="_blank">my website</a>. Please feel free to visit the site for plugin updates and development news - either visit the site regularly, follow <a title="RSS News Feed" href="http://www.artiss.co.uk/feed" target="_blank">my news feed</a> or <a title="Artiss.co.uk on Twitter" href="http://www.twitter.com/artiss_tech" target="_blank">follow me on Twitter</a> (@artiss_tech).</p>';
131
- $help_text .= '<h4>This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.</h4>';
132
-
133
- return $help_text;
134
- }
135
-
136
- /**
137
- * Code Embed Search Help
138
- *
139
- * Return help text for search screen
140
- *
141
- * @since 1.6
142
- *
143
- * @return string Help Text
144
- */
145
-
146
- function ace_search_help() {
147
-
148
- $help_text = '<p>This screen allows you to search for the post and pages that a particular code embed has been used in.</p>';
149
- $help_text .= '<p>Simply enter the code suffix that you wish to search for and press the "Search" key to display a list of all the posts using it. In addition the code will be shown alongside it. Click on the post name to edit the post.</p>';
150
- $help_text .= '<p>The search results are grouped together in matching code groups, so posts with the same code will be shown together with the same colour background.</p>';
151
-
152
- return $help_text;
153
- }
154
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/artiss-dashboard-widget.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
2
- /**
3
- * Artiss Dashboard Widget (v1.2)
4
- *
5
- * Add a box to the dashboard to display Artiss posts, and plugin news and support links
6
- *
7
- * @package Artiss-Code-Embed
8
- * @since 1.6
9
- */
10
-
11
- /**
12
- * Define Dashboard Widget
13
- *
14
- * Set up a new dashboard widget
15
- *
16
- */
17
-
18
- function artiss_dashboard_widget() {
19
- global $wp_meta_boxes;
20
- wp_add_dashboard_widget( 'artiss_help_widget', 'Artiss News & Support', 'artiss_plugin_help' );
21
- }
22
- add_action( 'wp_dashboard_setup', 'artiss_dashboard_widget' );
23
-
24
- /**
25
- * Display Dashboard Widget
26
- *
27
- * Show dashboard widget. Fetch top news items from category feed and cache them.
28
- *
29
- */
30
-
31
- function artiss_plugin_help() {
32
-
33
- // Set number of minutes to cache output
34
- $minutes_to_cache = 60;
35
-
36
- // Set number of news items to display
37
- $news_items = 5;
38
-
39
- // Attempt to get the cache
40
- $output = get_transient( 'artiss_dashboard_text' );
41
-
42
- // No cache found
43
- if (!$output) {
44
-
45
- $output = '<img src="http://www.artiss.co.uk/wp-content/themes/artiss-1/images/head.png" alt="Artiss.co.uk logo" title="Artiss.co.uk logo" style="float: right; margin-right: 8px; margin-bottom: 4px; padding:2px; padding-bottom: 8px; border: 1px solid #ddd; background-color: #fff;" />';
46
-
47
- // Use MagpieRSS to fetch the feed
48
- include_once( ABSPATH . WPINC . '/rss.php' );
49
- $array = fetch_rss( 'http://www.artiss.co.uk/feed' );
50
-
51
- if ( $array != '' ) {
52
-
53
- // If a feed is returned, slice up the results into an array
54
- $items = array_slice( $array -> items, 0, $news_items );
55
-
56
- // Now loop around the result and output
57
- $output .= "<p style=\"font-size: 1.1em; font-weight: bold;\">Latest Posts</p><br/>\n";
58
- if ( count( $items ) != 0 ) {
59
- $output .= "<ul>\n";
60
- foreach ( $items as $item ) {
61
- $output .= '<li><a href="' . $item[ 'link' ] . '">' . $item[ 'title' ] . "</a></li>\n";
62
- }
63
- $output .= "</ul></br>\n";
64
- } else {
65
- $output .= "No news items were found - please check back later!</br></br>";
66
- }
67
- }
68
-
69
- // Generate news links
70
- $output .= "<p style=\"font-size: 1.1em; font-weight: bold;\">News Links</p><br/>\n<ul>\n<li><a href=\"http://www.artiss.co.uk/feed\">Subscribe to the RSS feed</a><br/></li>\n<li><a href=\"http://twitter.com/artiss_tech\">Follow us on Twitter</a><br/></li>\n</ul>\n";
71
-
72
- // Generate support links
73
- $output .= "<p style=\"font-size: 1.1em; font-weight: bold;\">Support Links</p><br/>\n<ul>\n<li><a href=\"http://www.artiss.co.uk\">Artiss.co.uk website</a><br/></li>\n<li><a href=\"http://www.artiss.co.uk/wp-plugins\">Main plugin page</a><br/></li>\n<li><a href=\"http://www.artiss.co.uk/forum\">Plugin forum </a></li>\n</ul></br>\n";
74
-
75
- // Add donation link
76
- $output .= "<h5 style=\"text-align: right\"><a href=\"http://www.artiss.co.uk/donate\">Donate</a></h5>";
77
-
78
- // Update cache
79
- set_transient( 'artiss_dashboard_text', $output, $minutes_to_cache * 60 );
80
- }
81
-
82
- echo $output;
83
- }
84
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/code-embed-filter.php DELETED
@@ -1,160 +0,0 @@
1
- <?php
2
- /**
3
- * Add Embed to Posts
4
- *
5
- * Functions to add embed code to posts
6
- *
7
- * @package Artiss-Code-Embed
8
- */
9
-
10
- /**
11
- * Add filter to add embed code
12
- *
13
- * Filter to add embed to any posts
14
- *
15
- * @since 1.5
16
- *
17
- * @uses ace_get_embed_paras Get default options
18
- * @uses ace_get_embed_code Get embed code from other posts
19
- *
20
- * @param string $content Post content without embedded code
21
- * @return string Post content with embedded code
22
- */
23
-
24
- function ace_filter( $content ) {
25
-
26
- $plugin_name = 'Artiss Code Embed';
27
- global $post;
28
-
29
- // Set initial values
30
-
31
- $options = ace_get_embed_paras();
32
- $found_pos = strpos( $content, $options[ 'opening_ident' ] . $options[ 'keyword_ident' ], 0 );
33
- $prefix_len = strlen( $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] );
34
-
35
- // Loop around the post content looking for all requests for code embeds
36
-
37
- while ( $found_pos !== false ) {
38
-
39
- // Get the position of the closing identifier - ignore if one is not found
40
-
41
- $end_pos = strpos( $content, $options[ 'closing_ident' ], $found_pos + $prefix_len );
42
- if ( $end_pos !== false ) {
43
-
44
- // Extract the suffix
45
-
46
- $suffix_len = $end_pos - ( $found_pos + $prefix_len );
47
- if ( $suffix_len == 0 ) {
48
- $suffix = '';
49
- } else {
50
- $suffix = substr( $content, $found_pos + $prefix_len, $suffix_len );
51
- }
52
-
53
- // Get the custom field data and replace in the post
54
-
55
- if ( $suffix_len < 13 ) {
56
-
57
- $search = $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] . $suffix . $options[ 'closing_ident' ];
58
-
59
- // Get the meta for the current post
60
- $post_meta = get_post_meta( $post -> ID, $options[ 'keyword_ident' ].$suffix, false );
61
- if ( isset( $post_meta[ 0 ] ) ) {
62
- $html = $post_meta[ 0 ];
63
- } else {
64
- // No meta found, so look for it elsewhere
65
- $html = ace_get_embed_code( $options[ 'keyword_ident' ], $suffix );
66
- }
67
-
68
- $search = $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] . $suffix . $options[ 'closing_ident' ];
69
- $replace = "\n<!-- " . $plugin_name . ' v' . artiss_code_embed_version . " | http://www.artiss.co.uk/code-embed -->\n" . $html .= "\n<!-- End of " . $plugin_name . " code -->\n";
70
- $content = str_replace( $search , $replace, $content );
71
- }
72
- }
73
- $found_pos = strpos( $content, $options[ 'opening_ident' ] . $options[ 'keyword_ident' ], $found_pos + 1 );
74
- }
75
-
76
- return $content;
77
- }
78
- add_filter( 'the_content', 'ace_filter' );
79
-
80
- /**
81
- * Get the Global Embed Code
82
- *
83
- * Function to look for and, if available, return the global embed code
84
- *
85
- * @since 1.6
86
- *
87
- * @uses ace_report_error Generate an error message
88
- *
89
- * @param $ident string The embed code opening identifier
90
- * @param $suffix string The embed code suffix
91
- * @return string The embed code (or error)
92
- */
93
-
94
- function ace_get_embed_code( $ident, $suffix ) {
95
-
96
- // Meta was not found in current post so look across meta table - find the number of distinct code results
97
-
98
- $meta_name = $ident . $suffix;
99
- global $wpdb;
100
- $unique_records = $wpdb -> get_results( "SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = '" . $meta_name . "'" );
101
- $records = $wpdb -> num_rows;
102
-
103
- if ( $records > 0 ) {
104
-
105
- // Results were found
106
-
107
- $meta = $wpdb -> get_results( "SELECT meta_value, post_title, ID FROM $wpdb->postmeta, $wpdb->posts WHERE meta_key = '" . $meta_name . "' AND post_id = ID" );
108
- $total_records = $wpdb -> num_rows;
109
-
110
- if ( $records == 1 ) {
111
-
112
- // Only one unique code result returned so assume this is the global embed
113
-
114
- foreach ( $meta as $meta_data ) {
115
- $html = $meta_data -> meta_value;
116
- }
117
-
118
- } else {
119
-
120
- // More than one unique code result returned, so output the list of posts
121
-
122
- $error = 'Cannot use ' . $meta_name . ' as a global code as it is being used to store ' . $records . ' unique pieces of code in '.$total_records . ' posts - <a href='.get_bloginfo( 'wpurl' ) . '/wp-admin/tools.php?page=code-embed-search&amp;suffix='.$suffix.'>click here</a> for more details';
123
-
124
- $html = ace_report_error( $error, 'Artiss Code Embed', false );
125
- }
126
- } else {
127
-
128
- // No meta code was found so write out an error
129
-
130
- $html = ace_report_error( 'No embed code was found for ' . $meta_name, 'Artiss Code Embed', false );
131
-
132
- }
133
- return $html;
134
- }
135
-
136
- /**
137
- * Report an error
138
- *
139
- * Function to report an error
140
- *
141
- * @since 1.6
142
- *
143
- * @param $error string Error message
144
- * @param $plugin_name string The name of the plugin
145
- * @param $echo string True or false, depending on whether you wish to return or echo the results
146
- * @return string True or the output text
147
- */
148
-
149
- function ace_report_error( $error, $plugin_name, $echo = true ) {
150
-
151
- $output = '<p style="color: #f00; font-weight: bold;">' . $plugin_name . ': ' . __( $error ) . "</p>\n";
152
-
153
- if ( $echo ) {
154
- echo $output;
155
- return true;
156
- } else {
157
- return $output;
158
- }
159
- }
160
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/code-embed-options.php DELETED
@@ -1,82 +0,0 @@
1
- <?php
2
- /**
3
- * Code Embed Options
4
- *
5
- * Allow the user to change the default options
6
- *
7
- * @package Artiss-Code-Embed
8
- * @since 1.4
9
- *
10
- * @uses ace_get_embed_paras Get the options
11
- * @uses ace_help Return help text
12
- */
13
- ?>
14
- <div class="wrap">
15
- <?php screen_icon(); ?>
16
- <h2>Artiss Code Embed Options</h2>
17
- <?php
18
- // If options have been updated on screen, update the database
19
- if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'code-embed-profile' , 'code_embed_profile_nonce' ) ) ) {
20
-
21
- // Update the options array from the form fields. Strip invalid tags.
22
- $options[ 'opening_ident' ] = strtoupper( trim( $_POST[ 'code_embed_opening' ], '[]<>' ) );
23
- $options[ 'keyword_ident' ] = strtoupper( trim( $_POST[ 'code_embed_keyword' ], '[]<>' ) );
24
- $options[ 'closing_ident' ] = strtoupper( trim( $_POST[ 'code_embed_closing' ], '[]<>' ) );
25
-
26
- // If any fields are blank assign default values
27
- if ( $options[ 'opening_ident' ] == "" ) {$options[ 'opening_ident' ] = "%";}
28
- if ( $options[ 'keyword_ident' ] == "" ) {$options[ 'keyword_ident' ] = "CODE";}
29
- if ( $options[ 'closing_ident' ] == "" ) {$options[ 'closing_ident' ] = "%";}
30
-
31
- update_option( 'artiss_code_embed', $options );
32
- }
33
-
34
- // Fetch options into an array
35
- $options = ace_get_embed_paras();
36
- ?>
37
-
38
- <form method="post" action="<?php echo get_bloginfo('wpurl').'/wp-admin/options-general.php?page=code-embed-options&amp;updated=true' ?>">
39
-
40
- <?php _e( '<h3>Identifier Format</h3>Specify the format that will be used to define the way the code is embedded in your post.<br/>The formats are case insensitive and characters &lt; &gt [ ] are invalid.' ); ?>
41
-
42
- <table class="form-table">
43
-
44
- <tr>
45
- <th scope="row"><?php _e( 'Keyword' ); ?></th>
46
- <td><input type="text" size="12" maxlength="12" name="code_embed_keyword" value="<?php echo $options[ 'keyword_ident'] ; ?>"/>&nbsp;<span class="description">The keyword that is used to name the custom field and then place in your post where the code should be embedded. A suffix on any type can then be placed on the end.</span></td>
47
- </tr>
48
-
49
- <tr>
50
- <th scope="row"><?php _e( 'Opening Identifier' ); ?></th>
51
- <td><input type="text" size="4" maxlength="4" name="code_embed_opening" value="<?php echo $options[ 'opening_ident' ]; ?>"/>&nbsp;<span class="description">The character(s) that must be placed in the post before the keyword to uniquely identify it.</span></td>
52
- </tr>
53
-
54
- <tr>
55
- <th scope="row"><?php _e( 'Closing Identifier' ); ?></th>
56
- <td><input type="text" size="4" maxlength="4" name="code_embed_closing" value="<?php echo $options[ 'closing_ident' ]; ?>"/>&nbsp;<span class="description">The character(s) that must be placed in the post after the keyword to uniquely identify it.</span></td>
57
- </tr>
58
-
59
- </table>
60
-
61
- <?php wp_nonce_field( 'code-embed-profile', 'code_embed_profile_nonce', true, true ); ?>
62
-
63
- <br/><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings' ); ?>"/>
64
-
65
- </form>
66
-
67
- <?php
68
-
69
- _e( '<h3>How to Embed</h3>' );
70
- _e( '<p>To add a custom field containing embed code simple name it <strong>' . $options[ 'keyword_ident' ] . 'x</strong>, where <strong>x</strong> is any suffix you wish. The code to embed is then added as the field value.</p>' );
71
- _e( '<p>Then, to add the code into your post simple add <strong>' . $options[ 'opening_ident' ] . $options[ 'keyword_ident' ]."x" . $options[ 'closing_ident' ].'</strong> where you wish it to appear. <strong>x</strong> is the suffix you used for the custom field name.</p>' );
72
- _e( '<p>For example, I may add a custom field named <strong>' . $options[ 'keyword_ident' ].'1</strong>, where the value is the code I wish to embed. I would then in my post add <strong>' . $options[ 'opening_ident'] . $options[ 'keyword_ident'] . "1" . $options[ 'closing_ident' ] . '</strong> where I wish the code to then appear.</p>' );
73
-
74
- _e( '<h3>Support Information</h3>' );
75
- if ( !function_exists( 'add_contextual_help' ) ) {
76
- _e( ace_options_help() );
77
- } else {
78
- _e( '<p>Useful support information and links can be found by clicking on the Help tab at the top right-hand of the screen.</p>' );
79
- }
80
- ?>
81
-
82
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/simple-embed-code.mo ADDED
Binary file
languages/simple-embed-code.po ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Artiss Code Embed\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-03-27 14:12-0000\n"
6
+ "PO-Revision-Date: 2012-03-27 14:12-0000\n"
7
+ "Last-Translator: David Artiss <david.artiss@artiss.co.uk>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e;_x;_ex;esc_attr_x;esc_html_x;_n;_nx;_n_noop;_nx_noop\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-SearchPath-0: .\n"
15
+
16
+ #: includes/ace-admin-config.php:29
17
+ msgid "Settings"
18
+ msgstr ""
19
+
20
+ #: includes/ace-admin-config.php:53
21
+ msgid "Support"
22
+ msgstr ""
23
+
24
+ #: includes/ace-admin-config.php:54
25
+ msgid "Donate"
26
+ msgstr ""
27
+
28
+ #: includes/ace-admin-config.php:159
29
+ #: includes/ace-admin-config.php:179
30
+ msgid "Help"
31
+ msgstr ""
32
+
33
+ #: includes/ace-admin-config.php:250
34
+ msgid "Use this screen to modify the identifiers and keyword used to specify your embedded code."
35
+ msgstr ""
36
+
37
+ #: includes/ace-admin-config.php:251
38
+ msgid "The keyword is the name used for your custom field. The custom field's value is the code that you wish to embed."
39
+ msgstr ""
40
+
41
+ #: includes/ace-admin-config.php:252
42
+ msgid "The keyword, sandwiched with the identifier before and after, is what you then need to add to your post or page to activate the embed code."
43
+ msgstr ""
44
+
45
+ #: includes/ace-admin-config.php:253
46
+ #: includes/ace-admin-config.php:273
47
+ #: includes/ace-support.php:35
48
+ msgid "This plugin, and all support, is supplied for free, but <a title=\"Donate\" href=\"http://artiss.co.uk/donate\" target=\"_blank\">donations</a> are always welcome."
49
+ msgstr ""
50
+
51
+ #: includes/ace-admin-config.php:270
52
+ msgid "This screen allows you to search for the post and pages that a particular code embed has been used in."
53
+ msgstr ""
54
+
55
+ #: includes/ace-admin-config.php:271
56
+ msgid "Simply enter the code suffix that you wish to search for and press the 'Search' key to display a list of all the posts using it. In addition the code will be shown alongside it. Click on the post name to edit the post."
57
+ msgstr ""
58
+
59
+ #: includes/ace-admin-config.php:272
60
+ msgid "The search results are grouped together in matching code groups, so posts with the same code will be shown together with the same colour background."
61
+ msgstr ""
62
+
63
+ #: includes/ace-admin-config.php:334
64
+ msgid "Welcome to Artiss Code Embed"
65
+ msgstr ""
66
+
67
+ #: includes/ace-admin-config.php:335
68
+ msgid "Thank you for installing this plugin."
69
+ msgstr ""
70
+
71
+ #: includes/ace-admin-config.php:336
72
+ msgid "A new menu has been added to the sidebar. This will allow you to change the keywords and identifiers used for embedding as well as providing a method for searching for code embeds."
73
+ msgstr ""
74
+
75
+ #: includes/ace-filter.php:232
76
+ #, php-format
77
+ msgid "Cannot use %s as a global code as it is being used to store %d unique pieces of code in %d posts - <a href=\"%s\">click here</a> for more details"
78
+ msgstr ""
79
+
80
+ #: includes/ace-filter.php:239
81
+ #, php-format
82
+ msgid "No embed code was found for %s"
83
+ msgstr ""
84
+
85
+ #: includes/ace-options.php:16
86
+ msgid "Artiss Code Embed Options"
87
+ msgstr ""
88
+
89
+ #: includes/ace-options.php:40
90
+ msgid "Identifier Format"
91
+ msgstr ""
92
+
93
+ #: includes/ace-options.php:40
94
+ msgid "Specify the format that will be used to define the way the code is embedded in your post. The formats are case insensitive and characters &lt; &gt [ ] are invalid."
95
+ msgstr ""
96
+
97
+ #: includes/ace-options.php:45
98
+ msgid "Keyword"
99
+ msgstr ""
100
+
101
+ #: includes/ace-options.php:46
102
+ msgid "The keyword that is used to name the custom field and then place in your post where the code should be embedded. A suffix on any type can then be placed on the end."
103
+ msgstr ""
104
+
105
+ #: includes/ace-options.php:50
106
+ msgid "Opening Identifier"
107
+ msgstr ""
108
+
109
+ #: includes/ace-options.php:51
110
+ msgid "The character(s) that must be placed in the post before the keyword to uniquely identify it."
111
+ msgstr ""
112
+
113
+ #: includes/ace-options.php:55
114
+ msgid "Closing Identifier"
115
+ msgstr ""
116
+
117
+ #: includes/ace-options.php:56
118
+ msgid "The character(s) that must be placed in the post after the keyword to uniquely identify it."
119
+ msgstr ""
120
+
121
+ #: includes/ace-options.php:63
122
+ msgid "Save Settings"
123
+ msgstr ""
124
+
125
+ #: includes/ace-readme.php:14
126
+ msgid "Artiss Code Embed README"
127
+ msgstr ""
128
+
129
+ #: includes/ace-search.php:21
130
+ msgid "Enter the suffix to search for below and press the 'Search' button to view the results. Further help can be found by clicking on the Help tab at the top right-hand of the screen."
131
+ msgstr ""
132
+
133
+ #: includes/ace-search.php:51
134
+ msgid "Search"
135
+ msgstr ""
136
+
137
+ #: includes/ace-search.php:91
138
+ msgid "No posts were found containing that embed code."
139
+ msgstr ""
140
+
141
+ #: includes/ace-support.php:14
142
+ msgid "Artiss Code Embed Support"
143
+ msgstr ""
144
+
145
+ #: includes/ace-support.php:16
146
+ #, php-format
147
+ msgid "You are using Artiss Code Embed version %s. It was written by David Artiss."
148
+ msgstr ""
149
+
150
+ #: includes/ace-support.php:23
151
+ msgid "How to Embed"
152
+ msgstr ""
153
+
154
+ #: includes/ace-support.php:24
155
+ #, php-format
156
+ msgid "Based upon your current settings to embed some code simply add a custom field named %s, where %s is any suffix you wish. The code to embed is then added as the field value."
157
+ msgstr ""
158
+
159
+ #: includes/ace-support.php:25
160
+ #, php-format
161
+ msgid "Then, to add the code into your post simple add %s where you wish it to appear. %s is the suffix you used for the custom field name."
162
+ msgstr ""
163
+
164
+ #: includes/ace-support.php:26
165
+ #, php-format
166
+ msgid "For example, I may add a custom field named %s, where the value is the code I wish to embed. I would then in my post add %s where I wish the code to then appear."
167
+ msgstr ""
168
+
169
+ #: includes/ace-support.php:27
170
+ #, php-format
171
+ msgid "To embed the same code but to make it responsive you would use %s. To set a maximum width you would use %s, where %s is the maximum width in pixels."
172
+ msgstr ""
173
+
174
+ #: includes/ace-support.php:28
175
+ #, php-format
176
+ msgid "To embed an external URL you would type %s, where %s is the URL."
177
+ msgstr ""
178
+
179
+ #: includes/ace-support.php:32
180
+ msgid "Support Information"
181
+ msgstr ""
182
+
183
+ #: includes/ace-support.php:33
184
+ msgid "Artiss Code Embed Plugin Documentation"
185
+ msgstr ""
186
+
187
+ #: includes/ace-support.php:34
188
+ msgid "Artiss Code Embed Support Forum"
189
+ msgstr ""
190
+
191
+ #: includes/ace-support.php:39
192
+ msgid "Acknowledgements"
193
+ msgstr ""
194
+
195
+ #: includes/ace-support.php:40
196
+ #, php-format
197
+ msgid "Images have been compressed with %s."
198
+ msgstr ""
199
+
200
+ #: includes/ace-support.php:41
201
+ #, php-format
202
+ msgid "CSS has been compressed with %s."
203
+ msgstr ""
204
+
205
+ #: includes/ace-support.php:45
206
+ msgid "Stay in Touch"
207
+ msgstr ""
208
+
209
+ #: includes/ace-support.php:46
210
+ msgid "<a href=\"http://www.artiss.co.uk/wp-plugins\">See the full list</a> of Artiss plugins, including beta releases."
211
+ msgstr ""
212
+
213
+ #: includes/ace-support.php:47
214
+ msgid "<a href=\"http://www.twitter.com/artiss_tech\">Follow Artiss.co.uk</a> on Twitter."
215
+ msgstr ""
216
+
217
+ #: includes/ace-support.php:48
218
+ msgid "<a href=\"http://www.artiss.co.uk/feed\">Subscribe</a> to the Artiss.co.uk news feed."
219
+ msgstr ""
220
+
languages/simple-embed-code.pot ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Artiss Code Embed\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-03-20 14:13-0000\n"
6
+ "PO-Revision-Date: 2012-03-20 14:13-0000\n"
7
+ "Last-Translator: David Artiss <david.artiss@artiss.co.uk>\n"
8
+ "Language-Team: dartiss\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e;_x;_ex;esc_attr_x;esc_html_x;_n;_nx;_n_noop;_nx_noop\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-SearchPath-0: .\n"
15
+
16
+ #: includes/ace-admin-config.php:29
17
+ msgid "Settings"
18
+ msgstr ""
19
+
20
+ #: includes/ace-admin-config.php:53
21
+ msgid "Support"
22
+ msgstr ""
23
+
24
+ #: includes/ace-admin-config.php:54
25
+ msgid "Donate"
26
+ msgstr ""
27
+
28
+ #: includes/ace-admin-config.php:143
29
+ msgid "Help & Support"
30
+ msgstr ""
31
+
32
+ #: includes/ace-admin-config.php:163
33
+ msgid "Help"
34
+ msgstr ""
35
+
36
+ #: includes/ace-admin-config.php:206
37
+ msgid "Artiss Code Embed Plugin Documentation"
38
+ msgstr ""
39
+
40
+ #: includes/ace-admin-config.php:207
41
+ msgid "Artiss Code Embed Support Forum"
42
+ msgstr ""
43
+
44
+ #: includes/ace-admin-config.php:208
45
+ msgid "All of my plugins are supported via <a title=\"Artiss.co.uk\" href=\"http://www.artiss.co.uk\" target=\"_blank\">my website</a>. Please feel free to visit the site for plugin updates and development news - either visit the site regularly, follow <a title=\"RSS News Feed\" href=\"http://www.artiss.co.uk/feed\" target=\"_blank\">my news feed</a> or <a title=\"Artiss.co.uk on Twitter\" href=\"http://www.twitter.com/artiss_tech\" target=\"_blank\">follow me on Twitter</a> (@artiss_tech)."
46
+ msgstr ""
47
+
48
+ #: includes/ace-admin-config.php:209
49
+ #: includes/ace-search.php:55
50
+ msgid "This plugin, and all support, is supplied for free, but <a title=\"Donate\" href=\"http://artiss.co.uk/donate\" target=\"_blank\">donations</a> are always welcome."
51
+ msgstr ""
52
+
53
+ #: includes/ace-admin-config.php:226
54
+ msgid "This screen allows you to search for the post and pages that a particular code embed has been used in."
55
+ msgstr ""
56
+
57
+ #: includes/ace-admin-config.php:227
58
+ msgid "Simply enter the code suffix that you wish to search for and press the 'Search' key to display a list of all the posts using it. In addition the code will be shown alongside it. Click on the post name to edit the post."
59
+ msgstr ""
60
+
61
+ #: includes/ace-admin-config.php:228
62
+ msgid "The search results are grouped together in matching code groups, so posts with the same code will be shown together with the same colour background."
63
+ msgstr ""
64
+
65
+ #: includes/ace-admin-config.php:289
66
+ msgid "Welcome to Artiss Code Embed"
67
+ msgstr ""
68
+
69
+ #: includes/ace-admin-config.php:290
70
+ msgid "Thank you for installing this plugin."
71
+ msgstr ""
72
+
73
+ #: includes/ace-admin-config.php:291
74
+ msgid "A new menu within 'Settings' will allow you to change the keywords and identifiers used for embedding. A search option also exists in the 'Tools' menu for searching for code embeds."
75
+ msgstr ""
76
+
77
+ #: includes/ace-filter.php:182
78
+ #, php-format
79
+ msgid "Cannot use %s as a global code as it is being used to store %d unique pieces of code in %d posts - <a href=\"%s\">click here</a> for more details"
80
+ msgstr ""
81
+
82
+ #: includes/ace-filter.php:189
83
+ #, php-format
84
+ msgid "No embed code was found for %s"
85
+ msgstr ""
86
+
87
+ #: includes/ace-options.php:16
88
+ msgid "Artiss Code Embed Options"
89
+ msgstr ""
90
+
91
+ #: includes/ace-options.php:40
92
+ msgid "Identifier Format"
93
+ msgstr ""
94
+
95
+ #: includes/ace-options.php:40
96
+ msgid "Specify the format that will be used to define the way the code is embedded in your post."
97
+ msgstr ""
98
+
99
+ #: includes/ace-options.php:40
100
+ msgid "The formats are case insensitive and characters &lt; &gt [ ] are invalid."
101
+ msgstr ""
102
+
103
+ #: includes/ace-options.php:45
104
+ msgid "Keyword"
105
+ msgstr ""
106
+
107
+ #: includes/ace-options.php:46
108
+ msgid "The keyword that is used to name the custom field and then place in your post where the code should be embedded. A suffix on any type can then be placed on the end."
109
+ msgstr ""
110
+
111
+ #: includes/ace-options.php:50
112
+ msgid "Opening Identifier"
113
+ msgstr ""
114
+
115
+ #: includes/ace-options.php:51
116
+ msgid "The character(s) that must be placed in the post before the keyword to uniquely identify it."
117
+ msgstr ""
118
+
119
+ #: includes/ace-options.php:55
120
+ msgid "Closing Identifier"
121
+ msgstr ""
122
+
123
+ #: includes/ace-options.php:56
124
+ msgid "The character(s) that must be placed in the post after the keyword to uniquely identify it."
125
+ msgstr ""
126
+
127
+ #: includes/ace-options.php:63
128
+ msgid "Save Settings"
129
+ msgstr ""
130
+
131
+ #: includes/ace-options.php:68
132
+ msgid "How to Embed"
133
+ msgstr ""
134
+
135
+ #: includes/ace-options.php:69
136
+ #, php-format
137
+ msgid "To add a custom field containing embed code simple name it %s, where %s is any suffix you wish. The code to embed is then added as the field value."
138
+ msgstr ""
139
+
140
+ #: includes/ace-options.php:70
141
+ #, php-format
142
+ msgid "Then, to add the code into your post simple add %s where you wish it to appear. %s is the suffix you used for the custom field name."
143
+ msgstr ""
144
+
145
+ #: includes/ace-options.php:71
146
+ #, php-format
147
+ msgid "For example, I may add a custom field named %s, where the value is the code I wish to embed. I would then in my post add %s where I wish the code to then appear."
148
+ msgstr ""
149
+
150
+ #: includes/ace-options.php:72
151
+ msgid "Support Information"
152
+ msgstr ""
153
+
154
+ #: includes/ace-options.php:77
155
+ msgid "Useful support information and links can be found by clicking on the Help tab at the top right-hand of the screen."
156
+ msgstr ""
157
+
158
+ #: includes/ace-search.php:21
159
+ msgid "Enter the suffix to search for below and press the 'Search' button to view the results. Further help can be found by clicking on the Help tab at the top right-hand of the screen."
160
+ msgstr ""
161
+
162
+ #: includes/ace-search.php:51
163
+ msgid "Search"
164
+ msgstr ""
165
+
166
+ #: includes/ace-search.php:92
167
+ msgid "No posts were found containing that embed code."
168
+ msgstr ""
169
+
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Artiss Code Embed ===
2
  Contributors: dartiss
3
  Donate link: http://artiss.co.uk/donate
4
- Tags: artiss, embed, code, HTML, JavaScript, script, simple, video, XHTML, YouTube
5
  Requires at least: 2.0
6
- Tested up to: 3.2.1
7
- Stable tag: 1.6.1
8
 
9
  Artiss Code Embed (formally Simple Code Embed) provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.
10
 
@@ -12,17 +12,42 @@ Artiss Code Embed (formally Simple Code Embed) provides a very easy and efficien
12
 
13
  Artiss Code Embed (formally Simple Code Embed) allows you to embed code - JavaScript and HTML primarily - in a post. This is incredibly useful for embedding video, etc, when required. It cannot be used for server side code, such as PHP.
14
 
15
- This plugin works for both posts and pages. However, for simplicity I will simply refer to posts - bear in mind that pages work in the same way.
16
 
17
- **Options Screen**
 
 
 
 
 
 
 
18
 
19
- To use first of all visit the options page. In the Administration menu, under the Settings section there will a new settings option titled "Code Embed". Click on this and an options screen will appear.
20
 
21
- Code embedding is performed via a special keyword that you must use to uniquely identify where you wish the code to appear. This consist of an opening identifier (some that that goes at the beginning), a keyword and then a closing identifier. You may also add a suffix to the end of the keyword if you wish to embed multiple pieces of code within the same post.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  From this options screen you can specify the above identifier that you wish to use. By default the opening and closing identifiers are percentage signs and the keyword is `CODE`. During these instructions these will be used in all examples.
24
 
25
- **Embedding**
 
 
26
 
27
  To embed in a post you need to find the meta box under the post named "Custom Fields". If this is missing you may need to add it by clicking on the "Screen Options" tab at the top of the new post screen.
28
 
@@ -34,9 +59,23 @@ If you wish to embed multiple pieces of code within a post you can add a suffix
34
 
35
  Don't forget - via the options screen you can change any part of this identifier to your own taste.
36
 
37
- **Global Embedding**
38
 
39
- From version 1.6 onwards you can use global embedding - that is creating one piece of embed code and using it in multiple posts or pages.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  To do this simply make reference to an already defined (but unique) piece of embed code from another post or page.
42
 
@@ -44,9 +83,31 @@ So, let's say in one post you define a custom field named `CODE1`. You can, if y
44
 
45
  However, bear in mind that the embed code name must be unique - you can't have defined it in multiple posts otherwise the plugin won't know which one you're referring to (although it will report this and list the posts that it has been used in).
46
 
47
- If you need help with this, then a new administration option is present under "Tools" named "Embed Code Search". Use this to search for specific embed names and it will list all the posts/pages that they're used on, along with the code for each.
48
 
49
- **For help with this plugin, or simply to comment or get in touch, please read the appropriate section in "Other Notes" for details. This plugin, and all support, is supplied for free, but [donations](http://artiss.co.uk/donate "Donate") are always welcome.**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  == Licence ==
52
 
@@ -89,10 +150,6 @@ If your code contains the characters `]]>` then you'll find that it doesn't - Wo
89
 
90
  WordPress stores the custom field contents in a MySQL table using the `longtext` format. This can hold over 4 billion characters.
91
 
92
- = A new box has appeared on my dashboard all about Artiss plugins =
93
-
94
- That's correct - all Artiss plugins will now add this feature to provide you with useful support information. If you wish to switch it off simply click on the "Screen Options" tab at the top and untick "Artiss Plugin News & Support".
95
-
96
  = Which version of PHP does this plugin work with? =
97
 
98
  It has been tested and been found valid from PHP 4 upwards.
@@ -104,67 +161,83 @@ Please note, however, that the minimum for WordPress is now PHP 5.2.4. Even thou
104
  1. The custom field meta box with a Code Embed field set up to show some YouTube embed code
105
  2. Example embed code in a post
106
  3. The resultant video from the previous example code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
- == Changelog ==
109
-
110
- = 1.0 =
111
- * Initial release
112
-
113
- = 1.1 =
114
- * The instructions have been corrected (thanks to John J. Camilleri for pointing it out!)
115
- * Plugin has been tested with version 2.8 of WordPress
116
- * No code changes have been made
117
 
118
- = 1.2 =
119
- * Simplification of code
 
 
120
 
121
- = 1.3 =
122
- * Increased limit of number of code embeds from 5 to 20
123
 
124
- = 1.4 =
125
- * Option screen which allows you to specify the maximum number of possible embeds per post and the embed word
 
 
 
 
 
126
 
127
  = 1.4.1 =
128
- * Version details as HTML comments were being output whether an embed existed or not - corrected
129
 
130
- = 1.5 =
131
- * Renamed plugin to bring in line with new plugin conventions
132
- * Plugin re-write to create more efficient code - can now also completely personalise the embed code used in the post
133
- * PHPDoc used throughout for documentation purposes, plus new coding standards
134
- * Support information improved, including contextual help on the settings screen (if supported)
135
- * All of the changes are backwards compatible with previous versions of this plugin
136
- * Instructions completely re-written
137
 
138
- = 1.5.1 =
139
- * Added form security
140
 
141
- = 1.6 =
142
- * Improved code further from 1.5, including seperating code into seperate includes
143
- * Added global embeds option
144
- * New tools option in the administration menu which allows you to search for code embeds
145
 
146
- = 1.6.1 =
147
- * Fixed bug where name of plugin folder was incorrect
 
 
 
 
148
 
149
  == Upgrade Notice ==
150
 
151
- = 1.3 =
152
- * Upgrade if you'd like to be able to embed more than 5 scripts on a single page
153
 
154
- = 1.4 =
155
- * Update to specify your own embed word and max. embeds per post
156
 
157
- = 1.4.1 =
158
- * Minor bug fix
 
 
 
159
 
160
  = 1.5 =
161
  * Much more efficient performance and ability to totally personalise the embed code used in posts
162
 
163
- = 1.5.1 =
164
- * Added form security
165
 
166
- = 1.6 =
167
- * Added ability to specify global code embeds
168
 
169
- = 1.6.1 =
170
- * Fixes critical bug in version 1.6
1
  === Artiss Code Embed ===
2
  Contributors: dartiss
3
  Donate link: http://artiss.co.uk/donate
4
+ Tags: artiss, embed, code, html, javascript, script, simple, video, xhtml, youtube
5
  Requires at least: 2.0
6
+ Tested up to: 3.3.1
7
+ Stable tag: 2.0
8
 
9
  Artiss Code Embed (formally Simple Code Embed) provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.
10
 
12
 
13
  Artiss Code Embed (formally Simple Code Embed) allows you to embed code - JavaScript and HTML primarily - in a post. This is incredibly useful for embedding video, etc, when required. It cannot be used for server side code, such as PHP.
14
 
15
+ Features include..
16
 
17
+ * Add HTML or JavaScript to posts or pages - particularly useful for embedding videos!
18
+ * Embed in widgets using the [Widget Logic](http://wordpress.org/extend/plugins/widget-logic/ "Widget Logic") plugin
19
+ * Global embedding allows you set up some code in one post or page and then access it from another
20
+ * Modify the keywords or identifiers used for embedding the code to your own choice
21
+ * Search for embedding code via a simple search option
22
+ * Add a simple suffix to the embed code to convert videos to responsive output
23
+ * Embed an external script directly using just the URL
24
+ * Fully internationalized ready for translations. **If you would like to add a translation to his plugin then please [contact me](http://artiss.co.uk/contact "Contact").**
25
 
26
+ Here's how easy it is...
27
 
28
+ 1. Once you have the plugin installed start a new post or page.
29
+ 2. In the `Custom Fields` meta box enter a name of CODE1 and your embed code as the value. Save this.
30
+ 3. In your post add `%CODE1%` where you wish the embed code to appear.
31
+
32
+ And that's it - when the post or page is viewed `%CODE1%` will be replaced with the code that you asked to be embedded.
33
+
34
+ This should get you started - for more information and advanced options please read the "Other Notes" tab.
35
+
36
+ Although this plugin works for both posts and pages for simplicity I will simply refer to posts - bear in mind that pages work in the same way.
37
+
38
+ **For help with this plugin, or simply to comment or get in touch, please read the appropriate section in "Other Notes" for details. This plugin, and all support, is supplied for free, but [donations](http://artiss.co.uk/donate "Donate") are always welcome.**
39
+
40
+ == Options Screen ==
41
+
42
+ In the administration menu there is a new sidebar menu named "Code Embed". Under this is a sub-menu named "Options".
43
+
44
+ Code embedding is performed via a special keyword that you must use to uniquely identify where you wish the code to appear. This consist of an opening identifier (some that that goes at the beginning), a keyword and then a closing identifier. You may also add a suffix to the end of the keyword if you wish to embed multiple pieces of code within the same post.
45
 
46
  From this options screen you can specify the above identifier that you wish to use. By default the opening and closing identifiers are percentage signs and the keyword is `CODE`. During these instructions these will be used in all examples.
47
 
48
+ The options screen is only available to those that with a capability of able to manage options or greater. All the other Code Embed menu options are available to users with a capability to edit posts or greater.
49
+
50
+ == Embedding ==
51
 
52
  To embed in a post you need to find the meta box under the post named "Custom Fields". If this is missing you may need to add it by clicking on the "Screen Options" tab at the top of the new post screen.
53
 
59
 
60
  Don't forget - via the options screen you can change any part of this identifier to your own taste.
61
 
62
+ == URL Embedding ==
63
 
64
+ If you specify a URL within your post, surrounded by your choice of identifiers, then the contents of the URL will be embedded within your post.
65
+
66
+ Obviously, be careful when embedding a URL that you have no control over, as this may be used to hijack your post by injecting, for example, dangerous JavaScript.
67
+
68
+ For example, using the default options you could embed the contents of a URL using the following method...
69
+
70
+ `%http://www.example.com/code.php%`
71
+
72
+ or
73
+
74
+ `%https://www.example.com/code.html%`
75
+
76
+ == Global Embedding ==
77
+
78
+ You can also create global embeds - that is creating one piece of embed code and using it in multiple posts or pages.
79
 
80
  To do this simply make reference to an already defined (but unique) piece of embed code from another post or page.
81
 
83
 
84
  However, bear in mind that the embed code name must be unique - you can't have defined it in multiple posts otherwise the plugin won't know which one you're referring to (although it will report this and list the posts that it has been used in).
85
 
86
+ In the administration menu there is a sidebar menu named "Code Embed". Under this is a sub-menu named "Search". Use this to search for specific embed names and it will list all the posts/pages that they're used on, along with the code for each.
87
 
88
+ == Embedding in Widgets ==
89
+
90
+ Natively you cannot use the embed facilities within sidebar widgets. However, if you install the plugin [Widget Logic](http://wordpress.org/extend/plugins/widget-logic/ "Widget Logic") then Artiss Code Embed has been set up to make use of this and add the ability.
91
+
92
+ * Install [Widget Logic](http://wordpress.org/extend/plugins/widget-logic/ "Widget Logic") and activate.
93
+ * In Administration, select the Widgets page from the Appearance menu. At the bottom there will be a set of Widget Logic options.
94
+ * Ensure Use 'widget_content' filter is ticked and press Save.
95
+
96
+ Although you cannot set up embed code within a widget you can make reference to it, for example by writing `%CODE1%` in the widget.
97
+
98
+ == Responsive Output Conversion ==
99
+
100
+ Responsive output is where an element on a web page dynamically resizes depending upon the current available size. Most video embeds, for instance, will be a fixed size. This is fine if your website is also of a fixed size, however if you have a responsive site then this is not suitable.
101
+
102
+ Artiss Code Embed provides a simple suffix that can be added to an embed code and will convert the output to being responsive. This works best with videos.
103
+
104
+ To use, when adding the embed code onto the page, simply add `_RES` to the end, before the final identifier. For example, `%CODE1_RES%`. The `_RES` should not be added to the custom fields definition.
105
+
106
+ This will now output the embedded code full width, but a width that is dynamic and will resize when required.
107
+
108
+ If you don't wish the output to be full width you can specify a maximum width by adding an additonal `_x` on the end, where `x` is the required width in pixels. For example, `%CODE1_RES_500%` this will output `CODE1` as responsive but with a maximum width of 500 pixels.
109
+
110
+ **It should be noted that this is an experimental addition and will not work in all circumstances.**
111
 
112
  == Licence ==
113
 
150
 
151
  WordPress stores the custom field contents in a MySQL table using the `longtext` format. This can hold over 4 billion characters.
152
 
 
 
 
 
153
  = Which version of PHP does this plugin work with? =
154
 
155
  It has been tested and been found valid from PHP 4 upwards.
161
  1. The custom field meta box with a Code Embed field set up to show some YouTube embed code
162
  2. Example embed code in a post
163
  3. The resultant video from the previous example code
164
+ 4. The administration menu with optional README option
165
+ 5. The options screen
166
+ 6. The search screen, showing search results
167
+
168
+ == Changelog ==
169
+
170
+ = 2.0 =
171
+ * Maintenance: Removed dashboard widget
172
+ * Maintenance: Further code tidying
173
+ * Maintenance: Added new code for contextual help to use new WP 3.3 elements
174
+ * Enhancement: New admin menu option, under which existing option screens now exist along with a support screen. If you have the [README Parser plugin](http://wordpress.org/extend/plugins/wp-readme-parser/ "README Parser") installed then it will also add a sub-menu displaying README instructions
175
+ * Enhancement: Added internationalization to code
176
+ * Enhancement: Will now work with widgets if you install the plugin [Widget Logic](http://wordpress.org/extend/plugins/widget-logic/ "Widget Logic")
177
+ * Enhancement: Added experimental ability to convert to responsive output
178
+ * Enhancement: Added option to specify a URL instead of an embed code
179
+ * Enhancement: Added feature pointer for when plugin is activated
180
 
181
+ = 1.6.1 =
182
+ * Bug: Fixed bug where name of plugin folder was incorrect
 
 
 
 
 
 
 
183
 
184
+ = 1.6 =
185
+ * Maintenance: Improved code further from 1.5, including seperating code into seperate includes
186
+ * Enhancement: Added global embeds option
187
+ * Enhancement: New tools option in the administration menu which allows you to search for code embeds
188
 
189
+ = 1.5.1 =
190
+ * Enhancement: Added form security
191
 
192
+ = 1.5 =
193
+ * Maintenance: Renamed plugin to bring in line with new plugin conventions
194
+ * Maintenance: Plugin re-write to create more efficient code - can now also completely personalise the embed code used in the post
195
+ * Maintenance: PHPDoc used throughout for documentation purposes, plus new coding standards
196
+ * Maintenance: Instructions completely re-written
197
+ * Enhancement: Support information improved, including contextual help on the settings screen (if supported)
198
+ versions of this plugin
199
 
200
  = 1.4.1 =
201
+ * Bug: Version details as HTML comments were being output whether an embed existed or not - corrected
202
 
203
+ = 1.4 =
204
+ * Enhancement: Option screen which allows you to specify the maximum number of possible embeds per post and the embed word
 
 
 
 
 
205
 
206
+ = 1.3 =
207
+ * Enhancement: Increased limit of number of code embeds from 5 to 20
208
 
209
+ = 1.2 =
210
+ * Maintenance: Simplification of code
 
 
211
 
212
+ = 1.1 =
213
+ * Maintenance: The instructions have been corrected (thanks to John J. Camilleri for pointing it out!)
214
+ * Maintenance: Plugin has been tested with version 2.8 of WordPress. No code changes have been made
215
+
216
+ = 1.0 =
217
+ * Initial release
218
 
219
  == Upgrade Notice ==
220
 
221
+ = 2.0 =
222
+ * Upgrade to improve the administration menus and add further features such as internationalization and responsive video conversion
223
 
224
+ = 1.6.1 =
225
+ * Fixes critical bug in version 1.6
226
 
227
+ = 1.6 =
228
+ * Added ability to specify global code embeds
229
+
230
+ = 1.5.1 =
231
+ * Added form security
232
 
233
  = 1.5 =
234
  * Much more efficient performance and ability to totally personalise the embed code used in posts
235
 
236
+ = 1.4.1 =
237
+ * Minor bug fix
238
 
239
+ = 1.4 =
240
+ * Update to specify your own embed word and max. embeds per post
241
 
242
+ = 1.3 =
243
+ * Upgrade if you'd like to be able to embed more than 5 scripts on a single page
screenshot-4.png ADDED
Binary file
screenshot-5.png ADDED
Binary file
screenshot-6.png ADDED
Binary file
simple-code-embed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Artiss Code Embed
4
  Plugin URI: http://www.artiss.co.uk/code-embed
5
  Description: Allows you to embed code into your posts & pages
6
- Version: 1.6.1
7
  Author: David Artiss
8
  Author URI: http://www.artiss.co.uk
9
  */
@@ -17,27 +17,28 @@ Author URI: http://www.artiss.co.uk
17
  * @since 1.6
18
  */
19
 
20
- define( 'artiss_code_embed_version', '1.6.1' );
 
 
 
 
 
21
 
22
  $functions_dir = WP_PLUGIN_DIR . '/simple-embed-code/includes/';
23
 
24
  // Include all the various functions
25
 
26
- include_once( $functions_dir . 'get-options.php' ); // Get the default options
27
 
28
  if ( is_admin() ) {
29
 
30
- include_once( $functions_dir . 'admin-menu.php' ); // Administration menus
31
-
32
- if ( !has_action( 'wp_dashboard_setup', 'artiss_dashboard_widget' ) ) {
33
-
34
- include_once( $functions_dir . 'artiss-dashboard-widget.php' ); // Artiss dashboard widget
35
-
36
- }
37
 
38
  } else {
39
 
40
- include_once( $functions_dir . 'code-embed-filter.php' ); // Filter to apply code embeds
 
 
41
 
42
  }
43
  ?>
3
  Plugin Name: Artiss Code Embed
4
  Plugin URI: http://www.artiss.co.uk/code-embed
5
  Description: Allows you to embed code into your posts & pages
6
+ Version: 2.0
7
  Author: David Artiss
8
  Author URI: http://www.artiss.co.uk
9
  */
17
  * @since 1.6
18
  */
19
 
20
+ define( 'artiss_code_embed_version', '2.0' );
21
+
22
+ function ace_load_plugin_textdomain() {
23
+ load_plugin_textdomain( 'simple-embed-code', false, 'simple-embed-code/languages' );
24
+ }
25
+ add_action( 'init', 'ace_load_plugin_textdomain' );
26
 
27
  $functions_dir = WP_PLUGIN_DIR . '/simple-embed-code/includes/';
28
 
29
  // Include all the various functions
30
 
31
+ include_once( $functions_dir . 'ace-get-options.php' ); // Get the default options
32
 
33
  if ( is_admin() ) {
34
 
35
+ include_once( $functions_dir . 'ace-admin-config.php' ); // Various administration config. options
 
 
 
 
 
 
36
 
37
  } else {
38
 
39
+ include_once( $functions_dir . 'ace-add-scripts.php' ); // Add scripts to the main theme
40
+
41
+ include_once( $functions_dir . 'ace-filter.php' ); // Filter to apply code embeds
42
 
43
  }
44
  ?>