PHPDoc PHP注释的标准文档

PHPDoc PHP注释的标准文档

<?php
    /**
     * start page for webaccess
     * 
     * PHP version 5
     * 
     * @category PHP
     * @package PSI_Web
     * @author qxb
     * @copyright 2009 phpSysInfo
     * @license
     * @version SVN:
     * @link http:
     */
    /**
     * generate the dynamic webpage
     * 
     * @category PHP
     * @package PSI_Web
     * @author  xxx
     * @copyright
     * @license
     * @version
     * @link
     */
    class webpage extends Output implements PSI_Interface_Output{
        /**
         * confugured language
         * 
         * @var String
         */
        private $_language;

        /**
         * configuraed template
         * 
         * @var String
          */
          private $_template;

          /**
           * all available templates
           * 
           * @var Array
           */
          private $_templates = array();

          /**
           * all available languages
           * 
           * @var Array
           */
          private $_languages = array();
        
          /**
           * check for all extensions that are needed,initialize needed vars and read config.php
           */
          public function __construct(){
              parent::__construct();
              $this->_getTemplateList();
              $this->_getLanguageList();
          }

          /**
           * check config.php setting for template,if not supportet set phpsysinfo.css as default
           * checking config.php setting for language,if not supported set en as default
           */
          private function _checkTamplateLanguage(){
              $this->_template  = trim(PSI_DEFAULT_TEMPLATE);
              if(!file_exists(APP_ROOT . '/templates/' . $this->_template . '.css')){
                $this->_template = 'phpsysinfo';
              }

              $this->_language = trim(PSI_DEFAULT_LANG);
              if(!file_exists(APP_ROOT . '/language/' . $this->_language . ".xml")){
                $this->_language = 'en';
              }
          }

          /**
           * get all available templates and store then in internal array
           * @return void
           */
          private function _getTemplateList(){
              $dirlist = CommonFunctions :: gdc(APP_ROOT . '/templates/');
              sort($dirlist);
              foreach($dirlist as $file){
                $tpl_ext = substr($file,strlen($file) - 4);
                $tpl_name = substr($file,0,strlen($file) - 4);
                if($tpl_ext === ".css"){
                    array_push($this->_templates,$tpl_name);
                }
              }
          }

          /**
           * get all available translations and store then in internal array
           * 
           * @return void
           */
          private function _getLanguageList(){
              $dirlist = CommonFunctions::gdc(APP_ROOT . '/language/');
                sort($dirlist);
                foreach ($dirlist as $file) {
                    $lang_ext = substr($file,strlen($file) - 4);
                    $lang_name = substr($file,0,strlen($file) - 4);
                    if($lang_ext == ".xml"){
                        array_push($this->_language,$lang_name);
                    }
                }
          }

          /**
           * render the page
           * 
           * @return void
           */
          public function run(){
              $this->_checkTamplateLanguage();

              $tpl = new Template("/templates/html/index_dynamic.html");

              $tpl->set("template",$this->_template);
              $tpl->set("templates",$this->_templates);
              $tpl->set("language",$this->_language);
              $tpl->set("languages",$this->_languages);

              echo $tpl->fetch();
          }
    }
?>