Esempio n. 1
0
 /**
  * Reads a mo file and stores the po file.
  * If no PO file was given, only displays what would be the result.
  * @param string $mo Filename of the input MO file.
  * @param string $po Filename of the output PO file.
  * @return void
  */
 public static function msgunfmt($mo, $po = null)
 {
     $stringset = Mo::fromFile($mo);
     if ($po === null) {
         print Po::toString($stringset);
     } else {
         Po::toFile($stringset, $po);
     }
 }
Esempio n. 2
0
 function puc()
 {
     return Po::uc();
 }
Esempio n. 3
0
    public function calledPosition($backNum = 6, $separator = '#5')
    {
        if (!headers_sent()) {
            @header('Content-Type: text/html; charset=UTF-8');
        }
        if (self::$disabled) {
            return '';
        }
        ob_start();
        if ($phpGt54 = version_compare(PHP_VERSION, '5.4.0', '>=')) {
            debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $backNum);
        } else {
            debug_print_backtrace(false);
        }
        $positionInfo = ob_get_clean();
        $positionInfo = strstr($positionInfo, $separator);
        if (!$phpGt54) {
            $positionInfo = strstr($positionInfo, ' called at ');
            $positionInfo = strstr($positionInfo, "]\n#", true) . ']';
        }
        $positionInfo = trim(str_replace(array("\n", $separator), '', $positionInfo));
        $positionInfo = str_replace('\\', '/', $positionInfo);
        # ajax cli flash
        if (!PrintHelper::isWebRequest() || self::$stripTags) {
            $positionInfo = str_replace($this->rootPath, '<ROOT>', $positionInfo);
            if (PrintHelper::isCli() && PrintHelper::hasColorSupport()) {
                $this->positionData = "\n >>>>>> The method {$positionInfo}\n";
            } else {
                $this->positionData = "\n>>>>>> The method {$positionInfo}\n";
            }
            return $this;
        }
        $positionInfo = str_replace($this->rootPath, '&lt;ROOT&gt;', $positionInfo);
        $positionData = '';
        # 加载样式和jQuery。 TODO: 同一个页面只加载一次样式和jQuery
        if (!self::$hasStyle) {
            $positionData .= self::_styleTag() . PHP_EOL . self::_scriptTag();
            self::$hasStyle = true;
        }
        #
        $tips = !static::$hidden ? '' : '本次打印数据已隐藏,请点击右侧开关按钮显示数据。';
        $positionData .= <<<EOF
<div class="general-print-pos general-print-font">
  <p class="js-general-pos-info general-pos-info" style="display:inline-block;">本次打印调用位置:{$positionInfo} <span class="general-print-tips">{$tips}</span></p>
  <span class="general-print-help">?</span>
  <span class="general-print-code">&equiv;</span>
  <span class="general-print-switch js-general-print-switch">&otimes;</span>
</div>
EOF;
        $this->positionData = $positionData;
        return $this;
    }