'.get_option('2mb_autocode_topstring').'', $content, $count7); } $count8 = 0; if(get_option('2mb_autocode_bottomtype') == 0) { $content = str_replace('##do_bottom##', do_shortcode(get_option('2mb_autocode_bottomstring')), $content, $count8); } else if(get_option('2mb_autocode_bottomtype') == 1) { ob_start(); eval(get_option('2mb_autocode_bottomstring')); $bottomstring = ob_get_contents(); ob_end_clean(); $content = str_replace('##do_bottom##', do_shortcode($bottomstring), $content, $count8); } else { $content = str_replace('##do_bottom##', '
'.get_option('2mb_autocode_bottomstring').'', $content, $count8);
}
$count9 = 0;
$content = str_replace('##do_top_home##', '', $content, $count9);
$count10 = 0;
$content = str_replace('##do_bottom_home##', '', $content, $count10);
$top = 1;
$bottom = 1;
if($count > 0) {
$top = 0;
}
if(($count3 > 0 || get_option('2mb_autocode_tophome') == 0) && !is_single()) {
$top = 0;
}
if($count5 > 0 && is_single()){
$top = 0;
}
if($count2 > 0) {
$bottom = 0;
}
if(($count4 > 0 || get_option('2mb_autocode_tophome') == 0) && !is_single()) {
$bottom = 0;
}
if($count6 > 0 && is_single()){
$bottom = 0;
}
if($count7 > 0) {
$top = 0;
}
if($count8 > 0) {
$bottom = 0;
}
if($count9 > 0 && !is_single()) {
$top = 1;
}
if($count10 > 0 && !is_single()) {
$bottom = 1;
}
global $post;
$tophome_force = get_post_meta($post->ID, '2mb_autocode_tophome_force', true);
$bottomhome_force = get_post_meta($post->ID, '2mb_autocode_bottomhome_force', true);
$top_force = get_post_meta($post->ID, '2mb_autocode_top_force', true);
$bottom_force = get_post_meta($post->ID, '2mb_autocode_bottom_force', true);
if($tophome_force == '') {
$tophome_force = 0;
}
if($bottomhome_force == '') {
$bottomhome_force = 0;
}
if($top_force == '') {
$top_force = 0;
}
if($bottom_force == '') {
$bottom_force = 0;
}
if($tophome_force == 1 && !is_single()) {
$top = 1;
}
else if($tophome_force == 2 && !is_single()) {
$top = 0;
}
if($bottomhome_force == 1 && !is_single()) {
$bottom = 1;
}
else if($bottomhome_force == 2 && !is_single()) {
$bottom = 0;
}
if($top_force == 1 && is_single()) {
$top = 1;
}
else if($top_force == 2 && is_single()) {
$top = 0;
}
if($bottom_force == 1 && is_single()) {
$bottom = 1;
}
if($bottom_force == 2 && is_single()) {
$bottom = 0;
}
if($top == 1) {
if(get_option('2mb_autocode_toptype') == 1) {
ob_start();
eval(get_option('2mb_autocode_topstring'));
$string = ob_get_contents();
ob_end_clean();
$content = do_shortcode($string).$content;
}
else if(get_option('2mb_autocode_toptype') == 2) {
$content = ''.get_option('2mb_autocode_topstring').''.$content;
}
else {
$content = do_shortcode(get_option('2mb_autocode_topstring')).$content;
}
}
if($bottom == 1) {
if(get_option('2mb_autocode_bottomtype') == 1) {
ob_start();
eval(get_option('2mb_autocode_bottomstring'));
$string = ob_get_contents();
ob_end_clean();
$content = $content.do_shortcode($string);
}
else if(get_option('2mb_autocode_bottomtype') == 2) {
$content = $content.''.get_option('2mb_autocode_bottomstring').'';
}
else {
$content = $content.do_shortcode(get_option('2mb_autocode_bottomstring'));
}
}
return $content;
}
add_action('the_content', 'twomb_autocode_do_php', 0);
function twomb_autocode_do_php($content) {
$content = preg_replace_callback('/\[php\]((.|\n)+)\[\/php\]/', 'twomb_autocode_exec_php', $content);
return $content;
}
function twomb_autocode_exec_php($matches) {
ob_start();
eval($matches[1]);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
add_action('admin_menu', 'twomb_autocode_init_admin_menu');
function twomb_autocode_init_admin_menu() {
add_options_page('Autocode Options', 'Autocode', 'manage_options', 'twomb-autocode-settings', 'twomb_autocode_options');
}
function twomb_autocode_options() {
if(!current_user_can( 'manage_options')) {
wp_die( 'You do not have rights to access this page.');
}
?>
Do you like this plugin? Does it make your life just a little bit easier -- we hope! If it does, please consider donating to help our plugin effort along. Any amount helps. We'll love you forever ;-)
This plugin is rather simple, but to make it as easy as possible to use this plugin, we will include some documentation here:
Enter your settings below, then click save to save your changes.
ID, '2mb_autocode_tophome_force', true); if($value == '') { $value = 0; } ?>
Should the top text be prepended to that on the home page? Note: The first option means that it will not be set specifically on this post, it will simply follow what is set in the options page. The other options will change the option only for this post.
':'>'); ?> Do what is set in the autocode settings.
':'>'); ?> Force the top text to appear on this post for the home page.
':'>'); ?> Force the top text to not show on the home page for this post.
Should the bottom text be appended to that on the home page? Note: The first option means that it will not be set specifically on this post, it will simply follow what is set in the options page. The other options will change the option only for this post.
':'>'); ?> Do what is set in the autocode settings.
':'>'); ?> Force the bottom text to appear on this post for the home page.
':'>'); ?> Force the bottom text to not show on the home page for this post.
Should the top text be prepended to this post? Note: The first option means that it will not be set specifically on this post, it will simply follow what is set in the options page. The other options will change the option only for this post.
':'>'); ?> Do what is set in the autocode settings.
':'>'); ?> Force the top text to appear on this post.
':'>'); ?> Force the top text to not show on this post.
Should the bottom text be appended to this post? Note: The first option means that it will not be set specifically on this post, it will simply follow what is set in the options page. The other options will change the option only for this post.
':'>'); ?> Do what is set in the autocode settings.
':'>'); ?> Force the bottom text to appear on this post.
':'>'); ?> Force the bottom text to not show on this post.