Code Embed - Version 1.6

Version Description

  • Improved code further from 1.5, including seperating code into seperate includes
  • Added global embeds option
  • New tools option in the administration menu which allows you to search for code embeds

=

Download this release

Release Info

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

Code changes from version 1.5.1 to 1.6

includes/admin-menu.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ?>
simple-code-embed-options.php → includes/code-embed-options.php RENAMED
@@ -7,7 +7,8 @@
7
  * @package Artiss-Code-Embed
8
  * @since 1.4
9
  *
10
- * @uses artiss_code_embed_help Return help text
 
11
  */
12
  ?>
13
  <div class="wrap">
@@ -16,63 +17,63 @@
16
  <?php
17
  // If options have been updated on screen, update the database
18
  if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'code-embed-profile' , 'code_embed_profile_nonce' ) ) ) {
19
-
20
  // Update the options array from the form fields. Strip invalid tags.
21
  $options[ 'opening_ident' ] = strtoupper( trim( $_POST[ 'code_embed_opening' ], '[]<>' ) );
22
  $options[ 'keyword_ident' ] = strtoupper( trim( $_POST[ 'code_embed_keyword' ], '[]<>' ) );
23
  $options[ 'closing_ident' ] = strtoupper( trim( $_POST[ 'code_embed_closing' ], '[]<>' ) );
24
-
25
  // If any fields are blank assign default values
26
  if ( $options[ 'opening_ident' ] == "" ) {$options[ 'opening_ident' ] = "%";}
27
- if ( $options[ 'keyword_ident' ] == "" ) {$options[ 'keyword_ident' ] = "CODE";}
28
- if ( $options[ 'closing_ident' ] == "" ) {$options[ 'closing_ident' ] = "%";}
29
-
30
  update_option( 'artiss_code_embed', $options );
31
  }
32
 
33
  // Fetch options into an array
34
- $options = get_code_embed_paras();
35
  ?>
36
 
37
- <form method="post" action="<?php echo get_bloginfo('wpurl').'/wp-admin/options-general.php?page=artiss-code-embed-settings&amp;updated=true' ?>">
38
 
39
  <?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.' ); ?>
40
 
41
  <table class="form-table">
42
 
43
  <tr>
44
- <th scope="row"><?php _e('Keyword'); ?></th>
45
- <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>
46
  </tr>
47
 
48
  <tr>
49
- <th scope="row"><?php _e('Opening Identifier'); ?></th>
50
- <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>
51
  </tr>
52
 
53
  <tr>
54
- <th scope="row"><?php _e('Closing Identifier'); ?></th>
55
- <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>
56
  </tr>
57
 
58
  </table>
59
 
60
  <?php wp_nonce_field( 'code-embed-profile', 'code_embed_profile_nonce', true, true ); ?>
61
 
62
- <br/><input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Settings'); ?>"/>
63
 
64
  </form>
65
 
66
  <?php
67
 
68
  _e( '<h3>How to Embed</h3>' );
69
- _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>' );
70
- _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>' );
71
- _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>' );
72
 
73
  _e( '<h3>Support Information</h3>' );
74
  if ( !function_exists( 'add_contextual_help' ) ) {
75
- _e( artiss_code_embed_help() );
76
  } else {
77
  _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>' );
78
  }
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">
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
  }
includes/code-embed-search.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Code Embed Searcg
4
+ *
5
+ * Allow the user to change the default options
6
+ *
7
+ * @package Artiss-Code-Embed
8
+ * @since 1.6
9
+ *
10
+ * @uses ace_get_embed_paras Get the options
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' ) ) ) {
31
+ $suffix = $_POST[ 'ace_suffix' ];
32
+ } else {
33
+ $suffix = '';
34
+ }
35
+ }
36
+
37
+ // Fetch options into an array
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
+
45
+ <input type="text" size="6" name="ace_suffix" value="<?php echo $suffix; ?>"/>
46
+
47
+ <?php echo $options[ 'closing_ident' ]; ?>
48
+
49
+ <?php wp_nonce_field( 'code-embed-search', 'code_embed_search_nonce', true, true ); ?>
50
+
51
+ <input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Search' ); ?>"/>
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
+
60
+ global $wpdb;
61
+ $meta = $wpdb -> get_results( "SELECT meta_value, post_title, ID FROM $wpdb->postmeta, $wpdb->posts WHERE meta_key = '" . $options[ 'keyword_ident' ] . $suffix . "' AND post_id = ID ORDER BY meta_value" );
62
+ $records = $wpdb -> num_rows;
63
+
64
+ if ( $records > 0 ) {
65
+
66
+ echo '<table class="form-table">';
67
+ $color1 = 'CCCCCC';
68
+ $color2 = 'EAF2FA';
69
+ $color = $color1;
70
+ $prev_html = '';
71
+
72
+ foreach ( $meta as $meta_data ) {
73
+ $html = $meta_data -> meta_value;
74
+ $post_title = $meta_data -> post_title;
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";
81
+ echo '<td><a href="' . home_url() . '/wp-admin/post.php?post=' . $post_id . '&action=edit" style="color: #f00;">'.$post_title."</td>\n";
82
+ echo '<td><textarea readonly="readonly" rows="3" cols="80">' . htmlspecialchars( $html ) . "</textarea></td>\n";
83
+ echo "</tr>\n";
84
+
85
+ $prev_html = $html;
86
+ }
87
+
88
+ echo "</table>\n";
89
+
90
+ } else {
91
+
92
+ echo "<p style=\"color: #f00\">No posts were found containing that embed code.</p>\n";
93
+
94
+ }
95
+ }
96
+ ?>
97
+
98
+ </div>
includes/get-options.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Get Code Embed Parameters
4
+ *
5
+ * Fetch options - if none exist set them. If the old options exist, move them over
6
+ *
7
+ * @package Artiss-Code-Embed
8
+ * @since 1.5
9
+ *
10
+ * @return string Array of default options
11
+ */
12
+
13
+ function ace_get_embed_paras() {
14
+
15
+ $options = get_option( 'artiss_code_embed' );
16
+ $changed = false;
17
+
18
+ // If array doesn't exist, set defaults
19
+
20
+ if ( !is_array( $options ) ) {
21
+ $options = array( 'opening_ident' => '%', 'keyword_ident' => 'CODE', 'closing_ident' => '%' );
22
+ $changed = true;
23
+ }
24
+
25
+ // If the old options exist, import and delete them
26
+
27
+ if ( get_option( 'simple_code_embed' ) ) {
28
+ $old_option = get_option( 'simple_code_embed' );
29
+ $options[ 'keyword_ident' ] = $old_option[ 'prefix'];
30
+ delete_option( 'simple_code_embed' );
31
+ $changed = true;
32
+ }
33
+
34
+ // Update the options, if changed, and return the result
35
+
36
+ if ( $changed ) { update_option( 'artiss_code_embed', $options );}
37
+
38
+ return $options;
39
+ }
40
+ ?>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Artiss Code Embed ===
2
  Contributors: dartiss
3
  Donate link: http://artiss.co.uk/donate
4
- Tags: embed, code, artiss, script, HTML, JavaScript, XHTML, YouTube, video
5
- Requires at least: 2.0.0
6
- Tested up to: 3.1.2
7
- Stable tag: 1.5.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
 
@@ -34,11 +34,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
  **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.**
38
 
39
  == Licence ==
40
 
41
- This WordPRess plugin is licensed under the [GPLv2 (or later)](http://wordpress.org/about/gpl/ "GNU General Public License").
42
 
43
  == Support ==
44
 
@@ -46,7 +58,7 @@ All of my plugins are supported via [my website](http://www.artiss.co.uk "Artiss
46
 
47
  Please feel free to visit the site for plugin updates and development news - either visit the site regularly, follow [my news feed](http://www.artiss.co.uk/feed "RSS News Feed") or [follow me on Twitter](http://www.twitter.com/artiss_tech "Artiss.co.uk on Twitter") (@artiss_tech).
48
 
49
- For problems, suggestions or enhancements for this plugin, there is [a dedicated page](http://www.artiss.co.uk/code-embed "Simple Code Embed") and [a forum](http://www.artiss.co.uk/forum "WordPress Plugins Forum"). The dedicated page will also list any known issues and planned enhancements.
50
 
51
  **This plugin, and all support, is supplied for free, but [donations](http://artiss.co.uk/donate "Donate") are always welcome.**
52
 
@@ -77,10 +89,16 @@ If your code contains the characters `]]>` then you'll find that it doesn't - Wo
77
 
78
  WordPress stores the custom field contents in a MySQL table using the `longtext` format. This can hold over 4 billion characters.
79
 
 
 
 
 
80
  = Which version of PHP does this plugin work with? =
81
 
82
  It has been tested and been found valid from PHP 4 upwards.
83
 
 
 
84
  == Screenshots ==
85
 
86
  1. The custom field meta box with a Code Embed field set up to show some YouTube embed code
@@ -120,6 +138,11 @@ It has been tested and been found valid from PHP 4 upwards.
120
  = 1.5.1 =
121
  * Added form security
122
 
 
 
 
 
 
123
  == Upgrade Notice ==
124
 
125
  = 1.3 =
@@ -135,4 +158,7 @@ It has been tested and been found valid from PHP 4 upwards.
135
  * Much more efficient performance and ability to totally personalise the embed code used in posts
136
 
137
  = 1.5.1 =
138
- * Added form security
 
 
 
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
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
 
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
+
43
+ So, let's say in one post you define a custom field named `CODE1`. You can, if you wish, place `%CODE1%` not just in that post but also in another and it will work.
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
 
53
+ This WordPress plugin is licensed under the [GPLv2 (or later)](http://wordpress.org/about/gpl/ "GNU General Public License").
54
 
55
  == Support ==
56
 
58
 
59
  Please feel free to visit the site for plugin updates and development news - either visit the site regularly, follow [my news feed](http://www.artiss.co.uk/feed "RSS News Feed") or [follow me on Twitter](http://www.twitter.com/artiss_tech "Artiss.co.uk on Twitter") (@artiss_tech).
60
 
61
+ For problems, suggestions or enhancements for this plugin, there is [a dedicated page](http://www.artiss.co.uk/code-embed "Artiss Code Embed") and [a forum](http://www.artiss.co.uk/forum "WordPress Plugins Forum"). The dedicated page will also list any known issues and planned enhancements.
62
 
63
  **This plugin, and all support, is supplied for free, but [donations](http://artiss.co.uk/donate "Donate") are always welcome.**
64
 
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.
99
 
100
+ Please note, however, that the minimum for WordPress is now PHP 5.2.4. Even though this plugin supports a lower version, I am not coding specifically to achieve this - therefore this minimum may change in the future.
101
+
102
  == Screenshots ==
103
 
104
  1. The custom field meta box with a Code Embed field set up to show some YouTube embed code
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
  == Upgrade Notice ==
147
 
148
  = 1.3 =
158
  * Much more efficient performance and ability to totally personalise the embed code used in posts
159
 
160
  = 1.5.1 =
161
+ * Added form security
162
+
163
+ = 1.6 =
164
+ * Added ability to specify global code embeds
simple-code-embed.php CHANGED
@@ -1,149 +1,43 @@
1
- <?php
2
- /*
3
- Plugin Name: Artiss Code Embed
4
- Plugin URI: http://www.artiss.co.uk/artiss-code-embed
5
- Description: Allows you to embed code into your posts & pages
6
- Version: 1.5.1
7
- Author: David Artiss
8
- Author URI: http://www.artiss.co.uk
9
- */
10
-
11
- /**
12
- * Artiss Code Embed
13
- *
14
- * Embed code into a post
15
- *
16
- * @package Artiss-Code-Embed
17
- */
18
-
19
- define( 'artiss_code_embed_version', '1.5' );
20
-
21
- /**
22
- * Artiss Code Embed
23
- *
24
- * Filter to add embed to any posts
25
- *
26
- * @since 1.5
27
- *
28
- * @uses get_code_embed_paras Get default options
29
- *
30
- * @param string $content Post content without embedded code
31
- * @return string Post content with embedded code
32
- */
33
- add_filter( 'the_content', 'artiss_code_embed' );
34
- function artiss_code_embed( $content ) {
35
-
36
- $plugin_name = 'Artiss Code Embed';
37
- global $post;
38
-
39
- // Set initial values
40
- $options = get_code_embed_paras();
41
- $found_pos = strpos( $content, $options[ 'opening_ident' ] . $options[ 'keyword_ident' ], 0 );
42
- $prefix_len = strlen( $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] );
43
-
44
- // Loop around the post content looking for all requests for code embeds
45
- while ( $found_pos !== false ) {
46
-
47
- // Get the position of the closing identifier - ignore if one is not found
48
- $end_pos = strpos( $content, $options[ 'closing_ident' ], $found_pos + $prefix_len );
49
- if ( $end_pos !== false ) {
50
-
51
- // Extract the suffix
52
- $suffix_len = $end_pos - ( $found_pos + $prefix_len );
53
- if ( $suffix_len == 0 ) {
54
- $suffix = '';
55
- } else {
56
- $suffix = substr( $content, $found_pos + $prefix_len, $suffix_len );
57
- }
58
-
59
- // Get the custom field data and replace in the post
60
- if ( $suffix_len < 13 ) {
61
- $html = get_post_meta( $post -> ID, $options[ 'keyword_ident' ].$suffix, false );
62
- $search = $options[ 'opening_ident' ] . $options[ 'keyword_ident' ] . $suffix . $options[ 'closing_ident' ];
63
- $replace = '<!-- ' . $plugin_name . ' v' . artiss_code_embed_version . ' | http://www.artiss.co.uk/' . str_replace( ' ', '-', strtolower( $plugin_name ) ) . " -->\n" . $html[ 0 ] .= '<!-- End of ' . $plugin_name . " code -->\n";
64
- $content = str_replace($search , $replace, $content );
65
- }
66
- }
67
- $found_pos = strpos( $content, $options[ 'opening_ident' ] . $options[ 'keyword_ident' ], $found_pos + 1 );
68
- }
69
-
70
- return $content;
71
- }
72
-
73
- /**
74
- * Get Code Embed Parameters
75
- *
76
- * Fetch options - if none exist set them. If the old options exist, move them over
77
- *
78
- * @since 1.5
79
- *
80
- * @return string Array of default options
81
- */
82
- function get_code_embed_paras() {
83
-
84
- $options = get_option( 'artiss_code_embed' );
85
- $changed = false;
86
-
87
- // If array doesn't exist, set defaults
88
- if ( !is_array( $options ) ) {
89
- $options = array( 'opening_ident' => '%', 'keyword_ident' => 'CODE', 'closing_ident' => '%' );
90
- $changed = true;
91
- }
92
-
93
- // If the old options exist, import and delete them
94
- if ( get_option( 'simple_code_embed' ) ) {
95
- $old_option = get_option( 'simple_code_embed' );
96
- $options[ 'keyword_ident' ] = $old_option[ 'prefix'];
97
- delete_option( 'simple_code_embed' );
98
- $changed = true;
99
- }
100
-
101
- // Update the options, if changed, and return the result
102
- if ( $changed ) {update_option( 'artiss_code_embed', $options );}
103
-
104
- return $options;
105
- }
106
-
107
- /**
108
- * Code Embed Menu
109
- *
110
- * Add a new option to the Admin menu
111
- *
112
- * @since 1.4
113
- *
114
- * @uses artiss_code_embed_help Return help text
115
- */
116
- add_action( 'admin_menu','artiss_code_embed_menu' );
117
- function artiss_code_embed_menu() {
118
- $code_embed_hook = add_options_page( 'Artiss Code Embed Settings', 'Code Embed', 10, 'artiss-code-embed-settings', 'artiss_code_embed_options' );
119
- if ( function_exists( 'add_contextual_help' ) ) {add_contextual_help( $code_embed_hook, __( artiss_code_embed_help() ) );}
120
- }
121
-
122
- /**
123
- * Code Embed Options
124
- *
125
- * Define an option screen
126
- *
127
- * @since 1.4
128
- */
129
- function artiss_code_embed_options() {
130
- include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . "/simple-code-embed-options.php" );
131
- }
132
-
133
- /**
134
- * Code Embed Help
135
- *
136
- * Return help text
137
- *
138
- * @since 1.5
139
- *
140
- * @return string Help Text
141
- */
142
- function artiss_code_embed_help() {
143
- $help_text = '<p><a href="http://www.artiss.co.uk/code-embed">Artiss Code Embed Plugin Documentation</a></p>';
144
- $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>';
145
- $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>';
146
- $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>';
147
- return $help_text;
148
- }
149
  ?>
1
+ <?php
2
+ /*
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
7
+ Author: David Artiss
8
+ Author URI: http://www.artiss.co.uk
9
+ */
10
+
11
+ /**
12
+ * Artiss Code Embed
13
+ *
14
+ * Embed code into a post
15
+ *
16
+ * @package Artiss-Code-Embed
17
+ * @since 1.6
18
+ */
19
+
20
+ define( 'artiss_code_embed_version', '1.6' );
21
+
22
+ $functions_dir = WP_PLUGIN_DIR . '/simple-code-embed/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
  ?>
uninstall.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Uninstaller
4
+ *
5
+ * Uninstall the plugin by removing any options from the database
6
+ *
7
+ * @package Artiss-Code-Embed
8
+ * @since 1.6
9
+ */
10
+
11
+ // If the uninstall was not called by WordPress, exit
12
+ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+ exit();
14
+ }
15
+
16
+ // Delete any options
17
+ delete_option( 'artiss_code_embed' );
18
+ delete_option( 'simple_code_embed' );
19
+ ?>