includes/wikiformat.php
changeset 371 dc6026376919
parent 345 4ccdfeee9a11
child 407 35d94240a197
equal deleted inserted replaced
370:b251818286b1 371:dc6026376919
   117             $this->fixPath(ENANO_ROOT) . 'includes/wikiengine/Render/'
   117             $this->fixPath(ENANO_ROOT) . 'includes/wikiengine/Render/'
   118         );
   118         );
   119 
   119 
   120     }
   120     }
   121 
   121 
   122     function &singleton($parser = 'Default', $rules = null)
   122     public static function singleton($parser = 'Default', $rules = null)
   123     {
   123     {
   124         static $only = array();
   124         static $only = array();
   125         if (!isset($only[$parser])) {
   125         if (!isset($only[$parser])) {
   126             $ret =& Text_Wiki::factory($parser, $rules);
   126             $ret = Text_Wiki::factory($parser, $rules);
   127             if (!$ret) {
   127             if (!$ret) {
   128                 return $ret;
   128                 return $ret;
   129             }
   129             }
   130             $only[$parser] =& $ret;
   130             $only[$parser] =& $ret;
   131         }
   131         }
   132         return $only[$parser];
   132         return $only[$parser];
   133     }
   133     }
   134 
   134 
   135     function &factory($parser = 'Default', $rules = null)
   135     public static function factory($parser = 'Default', $rules = null)
   136     {
   136     {
   137         $d=getcwd();
   137         $d=getcwd();
   138         chdir(ENANO_ROOT);
   138         chdir(ENANO_ROOT);
   139         
   139         
   140         $class = 'Text_Wiki_' . $parser;
   140         $class = 'Text_Wiki_' . $parser;
   611         die($message);
   611         die($message);
   612     }
   612     }
   613 
   613 
   614     function isError(&$obj)
   614     function isError(&$obj)
   615     {
   615     {
   616         return is_a($obj, 'PEAR_Error');
   616         return ( @get_class($obj) == 'PEAR_Error' );
   617     }
   617     }
   618 }
   618 }
   619 
   619 
   620 ?>
   620 ?>