ID; $rePlaceManager = new RePlace(); $re_pairs = $rePlaceManager->getRePairs(); return $re_pairs; } /** * Content filter: */ function re_place_content_filter($content) { global $user_ID; $pairs = get_re_pairs(); $search = array(); $place = array(); foreach ($pairs as $re_place) { $search[] = "/" . $re_place->re_search . "/"; if ( $re_place->restriction == 'auth' && !$user_ID ) { $place[] = $re_place->restr_otherwise; } else if ( $re_place->restriction == 'page' && !is_page() ) { $place[] = $re_place->restr_otherwise; } else if ( $re_place->restriction == 'post' && is_page() ) { $place[] = $re_place->restr_otherwise; } else { $place[] = $re_place->re_place; } } $content = preg_replace($search, $place, $content); return $content; } // re.place menu: add_action('admin_menu', 're_place_menu'); function re_place_menu() { if (function_exists('add_submenu_page')) { add_submenu_page('options-general.php', __('re.place'), __('re.place'), 'edit_themes', 'replace/re.place-options.php'); } } // add content filter: if(function_exists('add_filter')) { add_filter('the_content', 're_place_content_filter',9); } ?>