Exemple #1
0
 /**
 	获取指定的微博
 */
 function detail()
 {
     include ROOT_PATH . 'lib/func/functions_rewrite.php';
     $this->setXmlNode('statues', 'status');
     $statuses = $this->dat->detail($this->input['id']);
     if ($statuses) {
         foreach ($statuses as $status) {
             $status['status'] = $status['status'] ? 0 : 2;
             $status['pubstatus'] = $status['status'] ? 1 : 0;
             $status['status_link'] = hg_rewrite($status['status_link']);
             $this->addItem($status);
         }
     }
     $this->output();
 }
Exemple #2
0
 /**
  * 输出模板
  *
  */
 public function outTemplate($hg_template_name, $callback = '')
 {
     if (!$this->mSoftVar) {
         echo 'Please specify SOFTVAR in configuare file.';
         return;
     }
     $fetch_template = false;
     if (!CACHE_TEMPLATE) {
         $fetch_template = true;
     } else {
         if (!file_exists(TEMPLATE_DIR . $this->mSoftVar . '/' . $hg_template_name . '.php')) {
             $fetch_template = true;
         }
     }
     if ($fetch_template) {
         //fetch template and cahed
         $this->localCss($hg_template_name);
         $this->fetchTemplates($hg_template_name);
     }
     foreach ($this->mTemplateDatas as $k => $v) {
         ${$k} = $v;
     }
     $this->mHeaderCode = implode("\n", $this->mHeaderCode);
     $this->mFooterCode = implode("\n", $this->mFooterCode);
     $RESOURCE_URL = RESOURCE_URL;
     if (!$_REQUEST['ajax']) {
         global $gGlobalConfig;
         if ($gGlobalConfig['rewrite']) {
             ob_end_clean();
             ob_start();
             @(include TEMPLATE_DIR . $this->mSoftVar . '/' . $hg_template_name . '.php');
             $html = ob_get_contents();
             ob_end_clean();
             include ROOT_PATH . 'lib/func/functions_rewrite.php';
             $html = hg_rewrite($html);
             echo $html;
         } else {
             @(include TEMPLATE_DIR . $this->mSoftVar . '/' . $hg_template_name . '.php');
         }
         $this->mTemplate = $hg_template_name;
         exit;
     } else {
         ob_end_clean();
         ob_start();
         @(include TEMPLATE_DIR . $this->mSoftVar . '/' . $hg_template_name . '.php');
         $html = ob_get_contents();
         global $gGlobalConfig;
         if ($gGlobalConfig['rewrite']) {
             include ROOT_PATH . 'lib/func/functions_rewrite.php';
             $html = hg_rewrite($html);
         }
         ob_end_clean();
         $html = str_replace(array("\r", "\n", "\t"), '', $html);
         $this->mTemplate = $hg_template_name;
         if ($callback) {
             $html = addslashes($html);
             $callback = explode(',', $callback);
             $cfunc = $callback[0];
             unset($callback[0]);
             if ($callback) {
                 $jsstr = '';
                 foreach ($callback as $v) {
                     $jsstr .= ",'{$v}'";
                 }
                 $callback = $cfunc . "('{$html}'{$jsstr})";
                 $html = '';
                 $data = array('html' => $html, 'msg' => '', 'callback' => $callback);
                 echo json_encode($data);
                 exit;
             } else {
                 $callback = $cfunc . "('{$html}'{$jsstr})";
                 $data = array('html' => $html, 'msg' => '', 'callback' => $callback);
                 return json_encode($data);
             }
         } else {
             return $html;
         }
     }
 }