function _potx_find_menu_hook in Translation template extractor 5.2
Same name and namespace in other branches
- 5 potx.inc \_potx_find_menu_hook()
- 6 potx.inc \_potx_find_menu_hook()
- 6.2 potx.inc \_potx_find_menu_hook()
List of menu item titles. Only for Drupal 6.
Parameters
$file: Full path name of file parsed.
$filebase: Filenaname of file parsed.
$save_callback: Callback function used to save strings.
1 call to _potx_find_menu_hook()
- _potx_process_file in ./
potx.inc - Process a file and put extracted information to the given parameters.
File
- ./
potx.inc, line 816 - Extraction API used by the web and command line interface.
Code
function _potx_find_menu_hook($file, $filebase, $save_callback) {
global $_potx_tokens, $_potx_lookup;
if (is_array($_potx_lookup[$filebase . '_menu'])) {
// We have a menu hook in this file.
foreach ($_potx_lookup[$filebase . '_menu'] as $ti) {
$end = _potx_find_end_of_function($ti);
$tn = $ti;
while ($tn < $end) {
// Look through the code until the end of the function.
if ($_potx_tokens[$tn][0] == T_CONSTANT_ENCAPSED_STRING && in_array($_potx_tokens[$tn][1], array(
"'title'",
'"title"',
"'description'",
'"description"',
)) && $_potx_tokens[$tn + 1][0] == T_DOUBLE_ARROW) {
if ($_potx_tokens[$tn + 2][0] == T_CONSTANT_ENCAPSED_STRING) {
$save_callback(_potx_format_quoted_string($_potx_tokens[$tn + 2][1]), $file, $_potx_tokens[$tn + 2][2]);
$tn += 2;
// Jump forward by 2.
}
else {
_potx_status(t("Invalid menu %element definition found in %hook in %filename on line %lineno\n\n", array(
'%element' => $_potx_tokens[$tn][1],
'%filename' => $file,
'%hook' => $filebase . '_menu()',
'%lineno' => $_potx_tokens[$tn][2],
)), 'error');
}
}
$tn++;
}
}
}
}