Ejemplo n.º 1
0
 function _l10n_inject_lang_markers($buffer)
 {
     global $l10n_replace_strings, $l10n_url_exclusions;
     _l10n_make_exclusion_list();
     # Insert the language code into all permlinks...
     $l10n_replace_strings['start'] = ' href=["|\']';
     $l10n_replace_strings['start_rep'] = ' href="';
     $l10n_replace_strings['stop'] = '["|\']';
     $l10n_replace_strings['stop_rep'] = '"';
     $l10n_replace_strings['insert_blank'] = true;
     $pattern1 = _l10n_make_pattern();
     $buffer = _l10n_preg_replace_callback($pattern1, '_l10n_inject_lang_markers_cb', $buffer);
     # Insert language code into any URLs embedded as text in hyperlinks (eg search results)...
     $l10n_replace_strings['start'] = $l10n_replace_strings['start_rep'] = '>';
     $l10n_replace_strings['stop'] = $l10n_replace_strings['stop_rep'] = '</a>';
     $l10n_replace_strings['insert_blank'] = false;
     $pattern2 = _l10n_make_pattern();
     $buffer = _l10n_preg_replace_callback($pattern2, '_l10n_inject_lang_markers_cb', $buffer);
     if (0) {
         #debug
         $buffer = 'Exclusions... :' . join(', ', $l10n_url_exclusions) . $buffer;
     }
     return $buffer;
 }
Ejemplo n.º 2
0
function _l10n_list_buffer_processor($buffer)
{
    global $DB;
    // NEEDED to fix the mark-up elements injected into the renditions (list) page.
    //	Fix for php5 behaviour change: the global object has been decostructed by the time this
    // routine is called from the output buffer processor.
    if (!isset($DB)) {
        $DB = new DB();
    }
    //$count = 0;
    if (version_compare($GLOBALS['prefs']['version'], '4.3', '>=')) {
        $pattern = '/<td class="title"><a href="\\?event=article&#38;step=edit&#38;ID=(\\d+)">.*<\\/a>/';
    } else {
        $pattern = '/<\\/td>' . n . t . '<td><a href="\\?event=article&#38;step=edit&#38;ID=(\\d+)">.*<\\/a>/';
    }
    #	Inject the language chooser...
    $chooser = _l10n_chooser(MLPLanguageHandler::get_site_langs());
    $f = '<p><label for="list-search">';
    $buffer = str_replace($f, $chooser . br . n . $f, $buffer);
    #	Inject the language markers...
    $result = _l10n_preg_replace_callback($pattern, '_l10n_match_cb', $buffer);
    if (!empty($result)) {
        return $result;
    }
    return $buffer;
}
Ejemplo n.º 3
0
function _l10n_substitute_snippets(&$thing)
{
    $out = _l10n_preg_replace_callback(L10N_SNIPPET_PATTERN, '_l10n_replace_snippet', $thing);
    return $out;
}