$lang $as
This *is* what some $lang code looks like (escaped:$escaped):
\t \r
$c
EOF;
return $snippet;
}
function gather_content()
{
$content = '';
$content .= test_lang('php');
$content .= test_lang('lisp', null, 1);
$content .= test_lang('java', null, 1);
$content .= test_lang('xml');
$content .= test_lang('xml', null, null, "true");
$content .= test_lang('html', 'html4strict');
$content .= test_lang('html', 'xml', 18);
$content .= test_lang('html', 'xml', 18, "true");
$content .= test_lang('ocaml');
$content .= test_lang('python');
$content .= test_lang('ruby', null, 18);
$content .= test_lang('ruby');
$content .= test_lang('rails');
$content .= test_lang('c');
return $content;
}
function test_head()
{
echo apply_filters("wp_head", "");
}
function test_all()
{
echo apply_filters("the_content", gather_content());
}
function test_all_with_other_filters()
{
add_filter('the_content', 'pre_killer'); // bad if run before GeSHi
add_filter('the_content', 'amp_exposer'); // bad if run after GeSHi
if (file_exists("filters/filters.php"))
{
include("filters/filters.php");
}
echo apply_filters("the_content", gather_content());
}
include("../wp-syntax.php");
?>
WP-Syntax Test Page
Vanilla, without other filters
Modified, with other filters
]*)>/", "[$1pre$2]", $content);
}
/*
* === WORDPRESS STUBS ===
*/
function get_bloginfo($arg) {
return "http://yourblog.com/blog";
}
function get_option($arg) {
return "http://yourblog.com/blog";
}
function remove_filter($tag, $function_to_remove, $priority = 10)
{
return true;
}
function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1)
{
global $test_filter;
$test_filter[$tag][$priority][] = $function_to_add;
$test_filter[$tag][$priority] = array_unique($test_filter[$tag][$priority]);
return true;
}
function apply_filters($tag, $string)
{
global $test_filter;
if (!isset($test_filter[$tag])) return $string;
uksort($test_filter[$tag], "strnatcasecmp");
foreach ($test_filter[$tag] as $priority => $functions)
{
if (is_null($functions)) continue;
foreach($functions as $function)
{
$string = call_user_func_array($function, array($string));
}
}
return $string;
}
function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
{
add_filter($tag, $function_to_add, $priority, $accepted_args);
}
function do_action($tag, $arg = '') {
global $test_filter;
if (!isset($test_filter[$tag])) return;
uksort($test_filter[$tag], "strnatcasecmp");
foreach ($test_filter[$tag] as $priority => $functions)
{
if (is_null($functions)) continue;
foreach($functions as $function)
{
call_user_func_array($function, array($arg));
}
}
}
function do_action_ref_array($tag, $args) {
global $test_filter;
if (!isset($test_filter[$tag])) return;
uksort($test_filter[$tag], "strnatcasecmp");
foreach ($test_filter[$tag] as $priority => $functions)
{
if (is_null($functions)) continue;
foreach($functions as $function)
{
call_user_func_array($function, $args);
}
}
}
?>