Changeset 988085
- Timestamp:
- 09/12/2014 08:32:29 AM (12 years ago)
- Location:
- 2mb-autocode/trunk
- Files:
-
- 2 edited
-
2mb-autocode.php (modified) (5 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
2mb-autocode/trunk/2mb-autocode.php
r987913 r988085 51 51 $top = 0; 52 52 } 53 if( $count3 > 0 && !is_single()) {53 if(($count3 > 0 && !is_single()) || get_option('2mb_autocode_tophome') == 0) { 54 54 $top = 0; 55 55 } … … 60 60 $bottom = 0; 61 61 } 62 if( $count4 > 0 && !is_single()) {62 if(($count4 > 0 && !is_single()) || get_option('2mb_autocode_tophome') == 0) { 63 63 $bottom = 0; 64 64 } … … 74 74 if($top == 1) { 75 75 if(get_option('2mb_autocode_toptype') == 1) { 76 $content = do_shortcode(exec(get_option('2mb_autocode_topstring'))).$content; 76 ob_start(); 77 eval(get_option('2mb_autocode_topstring')); 78 $string = ob_get_contents(); 79 ob_end_clean(); 80 $content = do_shortcode($string).$content; 77 81 } 78 82 else if(get_option('2mb_autocode_toptype') == 2) { … … 85 89 if($bottom == 1) { 86 90 if(get_option('2mb_autocode_bottomtype') == 1) { 87 $content = $content.do_shortcode(exec(get_option('2mb_autocode_bottomstring'))); 91 ob_start(); 92 eval(get_option('2mb_autocode_bottomstring')); 93 $string = ob_get_contents(); 94 ob_end_clean(); 95 $content = $content.do_shortcode($string); 88 96 } 89 97 else if(get_option('2mb_autocode_bottomtype') == 2) { … … 95 103 } 96 104 return $content; 105 } 106 107 add_action('the_content', 'do_php', 0); 108 function do_php($content) { 109 $content = preg_replace_callback('/\[php\]((.|\n)+)\[\/php\]/', 'exec_php', $content); 110 return $content; 111 } 112 113 function exec_php($matches) { 114 ob_start(); 115 eval($matches[1]); 116 $output = ob_get_contents(); 117 ob_end_clean(); 118 return $output; 97 119 } 98 120 -
2mb-autocode/trunk/readme.txt
r984821 r988085 1 1 === 2MB Autocode === 2 2 Contributors: lilmike, stormdragon2976 3 Donate link: http://2mb.solutions/ 3 Donate link: http://2mb.solutions/donate 4 4 Tags: autocode, code placement, automatic, php, html, preformatted text, top, bottom, modify posts 5 5 Requires at least: 2.7.0 6 6 Tested up to: 4.0 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 This plugin, developed by [2MB Solutions](http://2mb.solutions/), allows you to place predetermined text/html/php at the top and/or bottom of each post. In addition, you can override the placing of text at the bottom and/or top of a specific post .15 This plugin, developed by [2MB Solutions](http://2mb.solutions/), allows you to place predetermined text/html/php at the top and/or bottom of each post. In addition, you can override the placing of text at the bottom and/or top of a specific post, override the placing of text on the homepage or on a post individually, or run arbitrary php inside a post. 16 16 17 17 For more on 2MB, please visit (http://2mb.solutions/). … … 40 40 We're glad you asked! We're always looking for new ways to improve, whether in the realm of new plugins, or upgrading existing ones. Please go to our [website](http://2mb.solutions/), and click contact us. There you will be able to email us a message. Rest assured we read every email we receive and strive to respond to as many as possible! 41 41 42 = How do I run php inside a post? = 43 44 Simply enclose the php you want to run inside [php and ]/php] tags. 45 46 For example, to echo hello world in the middle of a post, do the following: 47 48 [php] echo("hello world!");[/php] 49 42 50 == Screenshots == 43 51 … … 46 54 == Changelog == 47 55 56 = 1.1 = 57 *Added ##do_top## and ##do_bottom## to place the bottom or top text anywhere in a post. 58 *Added ##no_top_home##, ##no_bottom_home##, ##no_top_post##, and ##no_bottom_post## to override the placing of text specifically on the home or post pages. 59 *Added [php] PHP CODE HERE [/php] to run php inside a post. 60 *Very important! Fixed an issue where php at the top or bottom of posts would not run, and could possibly crash programs or make them not work correctly. 61 *Fixed a possible bug where php code in the top or bottom of the post may have been echoing to the wrong part of the screen. 62 48 63 = 1.0 = 49 64 *First release. woohoo! … … 51 66 == Upgrade Notice == 52 67 68 = 1.1 = 69 If you were using php at the top or bottom of a post, please upgrade to this version as this fixes a possibility that the php code would not run or the php may have echoed to the wrong part of the screen. In addition if you want to run php code in your posts without having to add it to every post, then you may like this release. Also, if you wish to turn off the placing of text on a per post basis for the home and/or single post pages, this update is for you. 70 53 71 = 1.0 = 54 72 Because this plugin is awesome! Seriously, go try it! ;-)
Note: See TracChangeset
for help on using the changeset viewer.