Пример #1
0
 function trans($key)
 {
     $code = getLangKey();
     $skey = mysql_escape_string(stripslashes(trim($key)));
     $query = "SELECT lang_text FROM amsn_langs WHERE lang_code='{$code}' AND lang_key='{$skey}'";
     $result = mysql_query($query) or die(mysql_error());
     /* If no translation found, look up english */
     if (mysql_num_rows($result) == 0) {
         $query = "SELECT lang_text FROM amsn_langs WHERE lang_code='en' AND lang_key='{$skey}'";
         $result = mysql_query($query) or die(mysql_error());
     }
     /* If no translation found in english, return key */
     if (mysql_num_rows($result) == 0) {
         $text = $key;
     } else {
         $row = mysql_fetch_array($result);
         $text = $row['lang_text'];
     }
     /* Get rid of $x$ by replacing with arguments */
     for ($x = 1; $x < func_num_args(); $x++) {
         $arg = func_get_arg($x);
         $text = str_replace("\${$x}\$", $arg, $text);
     }
     return utf2html($text);
 }
Пример #2
0
<?php

$langlist = $lang_dir . '/langlist.dat';
$fp = @fopen($langlist, "r");
if (!$fp) {
    echo "Error: Unable to open langlist file";
    return;
}
$line = fgets($fp);
echo '<table class="langlist">';
echo '<tr><th>Language</th><th>Missing keys</th></tr>';
while (!feof($fp) && $line != "\n") {
    $line = rtrim($line);
    list($file, $encoding, $missing, $langname) = split(' ', $line, 4);
    echo '<tr><td><a href="view_lang.php?lang=' . basename($file) . '">' . utf2html($langname) . '</a></td><td>' . $missing . '</td></tr>' . "\n";
    $line = fgets($fp);
}
fclose($fp);
?>
</table>
<?php 
/*
switch($func) {
    default:
	AddonSample($page);
    break;

}*/
Пример #3
0
function exec_cmd($cmd, $file, $isRELAT, $rmHeader = 1, $finalUTF8 = true)
{
    global $io_options;
    global $dayFilter;
    file_put_contents('php://stderr', "\n -- ({$cmd}) {$file}\n");
    if ($isRELAT) {
        print "\n=== {$cmd}  {$file} ===";
    }
    $dayFilter = isset($io_options['day']) ? $io_options['day'] : '';
    $doc = new domParser();
    $doc->getHtmlBody($file, isset($io_options['utf8']) && $io_options['utf8']);
    $out = $doc->output($cmd, $finalUTF8, $dayFilter);
    if (!$isRELAT) {
        if ($rmHeader) {
            $out = str_replace(XML_HEADER1, '', $out);
        }
        $out = trim($out);
    }
    if (!isset($io_options['breaklines'])) {
        // na verdade no-breaklines
        $out = str_replace(array('<p', '<div', '<article', '<sec', '<keys', '<days'), array("\n<p", "\n<div", "\n<article", "\n<sec", "\n<keys", "\n<days"), $out);
    }
    if (isset($io_options['normaliza'])) {
        // normaliza texto do autor!
        $out = preg_replace('/(\\d)\\s+±\\s+(\\d)/us', '$1&#8239;±&#8239;$2', $out);
        $out = preg_replace('/([\\dp])\\s*(&lt;|&gt;|=)\\s*([\\dp])/ius', '$1&#8239;$2&#8239;$3', $out);
    }
    if (isset($io_options['entnum'])) {
        $out = utf2html($out);
    }
    return "{$out}\n";
}
Пример #4
0
function exec_cmd($cmd, $file, $isRELAT, $isMultiSec = FALSE, $rmHeader = 1, $finalUTF8 = TRUE)
{
    global $io_options;
    global $dayFilter;
    file_put_contents('php://stderr', "\n -- ({$cmd}) {$file}\n");
    if ($isRELAT) {
        print "\n=== {$cmd}  {$file} ===";
    }
    $dayFilter = isset($io_options['day']) ? $io_options['day'] : '';
    $doc = new domParser();
    // FALTA usar a  $io_options['normaliza'] pro XML na lib.php
    $doc->getHtmlBody($file, isset($io_options['utf8']) && $io_options['utf8']);
    $out = $doc->output($cmd, $finalUTF8, $dayFilter, $isMultiSec);
    if (!$isRELAT) {
        if ($rmHeader) {
            $out = str_replace(XML_HEADER1, '', $out);
        }
        $out = trim($out);
    }
    if (!isset($io_options['breaklines'])) {
        // na verdade no-breaklines
        $out = str_replace(['<p', '<div', '<article', '<sec', '<keys', '<days'], ["\n\n\n<p", "\n\n<div", "\n\n<article", "\n\n<sec", "\n<keys", "\n<days"], $out);
        $out = preg_replace("/[ \\t]*\n[ \\t]*/s", "\n", $out);
        // trim nas quebras de linha
    }
    $out = rmClosedFormatters($out);
    // repete limpeza já realizada no raw
    if (isset($io_options['entnum'])) {
        $out = utf2html($out);
    }
    return "{$out}\n";
}