- token_get_all: documentation ( source)
- strtolower: documentation ( source)
<?php
$source = <<<EOD
<?php
include_once "noentry.php";
list(\$get_arr, \$post_arr, \$request_arr) = get_secure_request_params();
\$mode = empty(\$get_arr['mode']) ? 'add' : \$get_arr['mode'];
try {
if (!in_array(strtolower(\$mode), ['add', 'update'])) {
throw new Exception("Error Processing Request", 0);
}
\$msg = trim(\$get_arr['var_msg']);
if (strtolower(\$mode) == 'update') {
\$top_header="Update ".'$module_header';
\$id = \$get_arr['$table_primary_key'];
\$db_data = \$mfa_db_obj->db->table('$table_name')->select('*')->where('$table_primary_key', \$id)->first();
if(empty(\$db_data))
{
\$redirect_url=\$admin_url."index.php?file=sitemap&AX=No";
header("Location:".\$redirect_url);
}
}
} catch (Exception \$e) {
\$exception_message=\$e->getMessage();
\$redirect_url=\$admin_url . "{$listing_url}&var_msg=".\$exception_message;
header("Location:".\$redirect_url);
exit;
}
include_once "common_css.php";
include_once "common_js.php";
?>
EOD;
$tokens = token_get_all($source);
foreach ($tokens as $token) {
list($id, $text) = get_token($token);
$lower_text = strtolower($text);
if (T_STRING == $id && isset($alias_list[$lower_text])) {
$alias_count[$lower_text] ++;
}
$return .= $text;
}
function get_token($token) {
if (is_string($token)) {
return array($token, $token);
} else {
return $token;
}
}
echo $return;