Version Description
- Option screen which allows you to specify the maximum number of possible embeds per post and the embed word
=
Download this release
Release Info
| Developer | dartiss |
| Plugin | |
| Version | 1.4 |
| Comparing to | |
| See all releases | |
Code changes from version 1.3 to 1.4
- readme.txt +23 -7
- simple-code-embed-options.php +52 -0
- simple-code-embed.php +21 -5
readme.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
=== Simple Code Embed ===
|
| 2 |
Contributors: dartiss
|
| 3 |
-
Donate link: http://
|
| 4 |
-
Tags: Code, HTML, JavaScript, XHTML,
|
| 5 |
Requires at least: 2.0.0
|
| 6 |
-
Tested up to:
|
| 7 |
-
Stable tag: 1.
|
| 8 |
|
| 9 |
Embed code, whether HTML or JavaScript, directly in your posts and pages. Ideal for showing YouTube videos!
|
| 10 |
|
|
@@ -28,11 +28,17 @@ Here's an example. I create a custom field named `CODE1` with a value of...
|
|
| 28 |
|
| 29 |
Then, where I wish the video to appear in my post I simply add `%CODE1%`. Simple!
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
== Installation ==
|
| 32 |
|
| 33 |
1. Upload the entire simple-code-embed folder to your wp-content/plugins/ directory.
|
| 34 |
-
2. Activate the plugin through the
|
| 35 |
-
3. There is no options screen.
|
| 36 |
|
| 37 |
== Frequently Asked Questions ==
|
| 38 |
|
|
@@ -40,6 +46,10 @@ Then, where I wish the video to appear in my post I simply add `%CODE1%`. Simple
|
|
| 40 |
|
| 41 |
Feel free to report any problems, or suggestions for enhancements, to me either via my contact form or by the plugins homepage at http://www.artiss.co.uk/simple-code-embed
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
== Changelog ==
|
| 44 |
|
| 45 |
= 1.0 =
|
|
@@ -56,7 +66,13 @@ Feel free to report any problems, or suggestions for enhancements, to me either
|
|
| 56 |
= 1.3 =
|
| 57 |
* Increased limit of number of code embeds from 5 to 20
|
| 58 |
|
|
|
|
|
|
|
|
|
|
| 59 |
== Upgrade Notice ==
|
| 60 |
|
| 61 |
= 1.3 =
|
| 62 |
-
* Upgrade if you'd like to be able to embed more than 5 scripts on a single page
|
|
|
|
|
|
|
|
|
| 1 |
=== Simple Code Embed ===
|
| 2 |
Contributors: dartiss
|
| 3 |
+
Donate link: http://artiss.co.uk/donate
|
| 4 |
+
Tags: Embed, Code, Script, HTML, JavaScript, XHTML, YouTube, Video
|
| 5 |
Requires at least: 2.0.0
|
| 6 |
+
Tested up to: 3.0.1
|
| 7 |
+
Stable tag: 1.4
|
| 8 |
|
| 9 |
Embed code, whether HTML or JavaScript, directly in your posts and pages. Ideal for showing YouTube videos!
|
| 10 |
|
| 28 |
|
| 29 |
Then, where I wish the video to appear in my post I simply add `%CODE1%`. Simple!
|
| 30 |
|
| 31 |
+
**Settings Screen**
|
| 32 |
+
|
| 33 |
+
The plugin has a settings screen where you can make 2 changes...
|
| 34 |
+
|
| 35 |
+
1. The embed word. This defaults to CODE but can be changed to any other word.
|
| 36 |
+
2. The maximum number of embeds allowed per post/page. The more you specify, the less efficient the program is as it will look for this number each time you display the post/page.
|
| 37 |
+
|
| 38 |
== Installation ==
|
| 39 |
|
| 40 |
1. Upload the entire simple-code-embed folder to your wp-content/plugins/ directory.
|
| 41 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
|
|
|
| 42 |
|
| 43 |
== Frequently Asked Questions ==
|
| 44 |
|
| 46 |
|
| 47 |
Feel free to report any problems, or suggestions for enhancements, to me either via my contact form or by the plugins homepage at http://www.artiss.co.uk/simple-code-embed
|
| 48 |
|
| 49 |
+
= My code doesn't work =
|
| 50 |
+
|
| 51 |
+
If you code contains the characters `]]>` then you'll find that it doesn't - WordPress modifies this itself.
|
| 52 |
+
|
| 53 |
== Changelog ==
|
| 54 |
|
| 55 |
= 1.0 =
|
| 66 |
= 1.3 =
|
| 67 |
* Increased limit of number of code embeds from 5 to 20
|
| 68 |
|
| 69 |
+
= 1.4 =
|
| 70 |
+
* Option screen which allows you to specify the maximum number of possible embeds per post and the embed word
|
| 71 |
+
|
| 72 |
== Upgrade Notice ==
|
| 73 |
|
| 74 |
= 1.3 =
|
| 75 |
+
* Upgrade if you'd like to be able to embed more than 5 scripts on a single page
|
| 76 |
+
|
| 77 |
+
= 1.4 =
|
| 78 |
+
* Update to specify your own embed word and max. embeds per post
|
simple-code-embed-options.php
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="wrap">
|
| 2 |
+
<?php screen_icon(); ?>
|
| 3 |
+
<h2>Simple Code Embed Options</h2>
|
| 4 |
+
<?php
|
| 5 |
+
// If options have been updated on screen, update the database
|
| 6 |
+
if(!empty($_POST['Submit'])) {
|
| 7 |
+
$options['prefix']=$_POST['simple_code_embed_prefix'];
|
| 8 |
+
$options['number']=$_POST['simple_code_embed_number'];
|
| 9 |
+
update_option("simple_code_embed",$options);
|
| 10 |
+
}
|
| 11 |
+
// Fetch options into an array
|
| 12 |
+
$options=get_option("simple_code_embed");
|
| 13 |
+
// Set defaults if no array is defined
|
| 14 |
+
if (!is_array($options)) {
|
| 15 |
+
echo "<div class=\"updated\"><p><strong>Please review the options below and click \"Save Settings\" to update them.</strong></p></div>\n";
|
| 16 |
+
$options = array('prefix'=>'CODE','number'=>'20');}
|
| 17 |
+
?>
|
| 18 |
+
|
| 19 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="float: right;" target="_blank">
|
| 20 |
+
<input type="hidden" name="cmd" value="_s-xclick"/>
|
| 21 |
+
<input type="hidden" name="hosted_button_id" value="2827258"/>
|
| 22 |
+
<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" name="submit" alt="Donate!"/>
|
| 23 |
+
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"/>
|
| 24 |
+
</form>
|
| 25 |
+
|
| 26 |
+
<p><?php _e('If you like this plugin, please consider donating.'); ?></p>
|
| 27 |
+
|
| 28 |
+
<form method="post" action="<?php echo get_bloginfo('wpurl').'/wp-admin/options-general.php?page=simple-code-embed-settings&updated=true' ?>">
|
| 29 |
+
<table class="form-table">
|
| 30 |
+
|
| 31 |
+
<tr>
|
| 32 |
+
<th scope="row"><?php _e('Prefix'); ?></th>
|
| 33 |
+
<td><input type="text" size="12" maxlength="12" name="simple_code_embed_prefix" value="<?php echo $options['prefix']; ?>"/></td>
|
| 34 |
+
</tr>
|
| 35 |
+
|
| 36 |
+
<tr>
|
| 37 |
+
<th scope="row"><?php _e('Max. Number Per Post'); ?></th>
|
| 38 |
+
<td><input type="text" size="2" maxlength="2" name="simple_code_embed_number" value="<?php echo $options['number']; ?>"/></td>
|
| 39 |
+
</tr>
|
| 40 |
+
|
| 41 |
+
</table>
|
| 42 |
+
<p class="submit">
|
| 43 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Settings'); ?>"/>
|
| 44 |
+
</p>
|
| 45 |
+
</form>
|
| 46 |
+
|
| 47 |
+
<h3>Further Help</h3>
|
| 48 |
+
<p>Comprehensive instructions can be found on <a href="http://www.artiss.co.uk/simple-code-embed">the official site page</a>, along with <a href="http://www.artiss.co.uk/category/software/wordpress">blog updates</a> and a comprehensive <a href="http://www.artiss.co.uk/feed">news feed</a>.</p>
|
| 49 |
+
<p>Alternatively, please see <a href="http://wordpress.org/extend/plugins/simple-code-embed/">the WordPress plugin page</a>.</p>
|
| 50 |
+
|
| 51 |
+
<p><a href="http://validator.w3.org"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" height="31px" width="88px" style="float: right"/></a></p>
|
| 52 |
+
</div>
|
simple-code-embed.php
CHANGED
|
@@ -3,19 +3,35 @@
|
|
| 3 |
Plugin Name: Simple Code Embed
|
| 4 |
Plugin URI: http://www.artiss.co.uk/simple-code-embed
|
| 5 |
Description: Allows you to embed code into your posts & pages
|
| 6 |
-
Version: 1.
|
| 7 |
Author: David Artiss
|
| 8 |
Author URI: http://www.artiss.co.uk
|
| 9 |
*/
|
| 10 |
add_filter('the_content','simple_code_embed');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
function simple_code_embed($content) {
|
|
|
|
|
|
|
|
|
|
| 12 |
global $post;
|
| 13 |
$loop=1;
|
| 14 |
-
while ($loop<
|
| 15 |
-
$html=get_post_meta($post->ID
|
| 16 |
-
$content=str_replace("%
|
| 17 |
$loop++;
|
| 18 |
}
|
| 19 |
-
return $content
|
| 20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
?>
|
| 3 |
Plugin Name: Simple Code Embed
|
| 4 |
Plugin URI: http://www.artiss.co.uk/simple-code-embed
|
| 5 |
Description: Allows you to embed code into your posts & pages
|
| 6 |
+
Version: 1.4
|
| 7 |
Author: David Artiss
|
| 8 |
Author URI: http://www.artiss.co.uk
|
| 9 |
*/
|
| 10 |
add_filter('the_content','simple_code_embed');
|
| 11 |
+
add_action('admin_menu','simple_code_embed_menu');
|
| 12 |
+
define('simple_code_embed_version','1.4');
|
| 13 |
+
|
| 14 |
+
// Main function to embed code
|
| 15 |
function simple_code_embed($content) {
|
| 16 |
+
$plugin_name="Simple Code Embed";
|
| 17 |
+
$options=get_option("simple_code_embed");
|
| 18 |
+
if (!is_array($options)) {$options=array('prefix'=>'CODE','number'=>'20');}
|
| 19 |
global $post;
|
| 20 |
$loop=1;
|
| 21 |
+
while ($loop<($options['number'])+1) {
|
| 22 |
+
$html=get_post_meta($post->ID,$options['prefix'].$loop,false);
|
| 23 |
+
$content=str_replace("%".$options['prefix'].$loop."%",$html[0],$content);
|
| 24 |
$loop++;
|
| 25 |
}
|
| 26 |
+
return "<!-- ".$plugin_name." v".simple_code_embed_version." | http://www.artiss.co.uk/".str_replace(" ","-",strtolower($plugin_name))." -->\n".$content.="<!-- End of ".$plugin_name." code -->\n";;
|
| 27 |
}
|
| 28 |
+
|
| 29 |
+
// Define a dashboard menu option
|
| 30 |
+
function simple_code_embed_menu() {
|
| 31 |
+
add_options_page('Simple Code Embed Settings','Simple Code Embed',10,'simple-code-embed-settings','simple_code_embed_options');
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
// Define an option screen
|
| 35 |
+
function simple_code_embed_options() {
|
| 36 |
+
include_once(WP_PLUGIN_DIR.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__))."/simple-code-embed-options.php");}
|
| 37 |
?>
|
