Example #1
0
 /**
  * Insert $lang to use in a View & include tracking code.
  */
 private function processSmartyView($v)
 {
     global $app_i, $lang;
     $viewDir = currentViewDir();
     $v->assign('lang', $lang[$viewDir]);
     if (!isLocalhost() && file_exists(BASEVIEW . '/' . $viewDir . '/tracking_code.html')) {
         $v->assign('inc_tracking_code', 'file:' . BASEVIEW . '/' . $viewDir . '/tracking_code.html');
         // abs path so Extensions find it too.
     } else {
         $v->assign('inc_tracking_code', 'file:' . BASEVIEW . '/blank.html');
     }
 }
Example #2
0
function t($textKey)
{
    global $app_i, $lang;
    $langKey = currentViewDir();
    if (isset($lang[$langKey])) {
        $ret = $lang[$langKey][$textKey];
        // fill parameters into lang key
        $numargs = func_num_args();
        if ($numargs > 1) {
            $args = func_get_args();
            for ($i = 1; $i < $numargs; $i++) {
                $ret = str_replace('{' . ($i - 1) . '}', $args[$i], $ret);
            }
        }
        return $ret;
    }
    return '';
}
Example #3
0
 public function view()
 {
     if ($this->isPosting()) {
         return $this->processPost();
     }
     session_start();
     if (getLoggedInUsername() != '') {
         if (isset($this->params[0])) {
             $viewToEdit = $this->params[0];
             $viewPath = BASEVIEW . '/' . currentViewDir() . '/' . $viewToEdit;
             if (file_exists($viewPath)) {
                 $viewContent = file_get_contents($viewPath);
                 if (isDemoMode()) {
                     $viewContent .= "<p/><b>Demo Mode: This page is set to readonly in demo mode.</b>";
                 }
             }
             $html = file_get_contents_with_vars(BASEEXT . '/editor/page_editor.html', array('{$viewFile}' => $viewToEdit, '{$viewContent}' => $viewContent));
             echo $html;
         }
     } else {
         echo '';
     }
 }