Ejemplo n.º 1
0
 /**
  * returns singleton instance
  * instance is stored in the session for non-logged users
  * this is because of developement, users that are logged in BE could be
  * editing the conf file, so they need to see the changes immediately
  */
 public static function getTranslateInstance()
 {
     if (!isset($_SESSION) || !is_array($_SESSION)) {
         session_start();
     }
     if (!self::$confArray) {
         self::$confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['cooluri']);
         if (empty(self::$confArray['LANGID'])) {
             self::$confArray['LANGID'] = 'L';
         }
     }
     if (!self::isBEUserLoggedIn() && !empty($_SESSION['coolUriTransformerInstance']) && !empty($_SESSION['coolUriTransformerInstance']->conf)) {
         return $_SESSION['coolUriTransformerInstance'];
     }
     if (file_exists(self::$confArray['XMLPATH'] . 'CoolUriConf.xml')) {
         $lt = \Bednarik\Cooluri\Core\Translate::getInstance(self::$confArray['XMLPATH'] . 'CoolUriConf.xml');
     } elseif (file_exists(PATH_typo3conf . 'CoolUriConf.xml')) {
         $lt = \Bednarik\Cooluri\Core\Translate::getInstance(PATH_typo3conf . 'CoolUriConf.xml');
     } elseif (file_exists(dirname(__FILE__) . '/cooluri/CoolUriConf.xml')) {
         $lt = \Bednarik\Cooluri\Core\Translate::getInstance(dirname(__FILE__) . '/cooluri/CoolUriConf.xml');
     } else {
         return false;
     }
     if (!self::isBEUserLoggedIn()) {
         $cc = @clone $lt;
         $_SESSION['coolUriTransformerInstance'] = $cc;
     }
     return $lt;
 }
Ejemplo n.º 2
0
 public function __construct($file, $conf, $res = '')
 {
     $this->db = \Bednarik\Cooluri\Core\DB::getInstance();
     $this->file = $file;
     $this->resPath = $res;
     $this->lt = \Bednarik\Cooluri\Core\Translate::getInstance($conf);
     $this->enable = !empty(\Bednarik\Cooluri\Core\Translate::$conf->cache) && !empty(\Bednarik\Cooluri\Core\Translate::$conf->cache->usecache) && \Bednarik\Cooluri\Core\Translate::$conf->cache->usecache == 1;
     if (!empty(\Bednarik\Cooluri\Core\Translate::$conf->cache->tablesprefix)) {
         $this->table = \Bednarik\Cooluri\Core\Translate::$conf->cache->tablesprefix;
     }
 }
Ejemplo n.º 3
0
 public function testAll()
 {
     $lt = \Bednarik\Cooluri\Core\Translate::getInstance(dirname(__FILE__) . '/Resources/CoolUriConf.xml');
     $lt->params2cool(array('id' => 1));
     echo $lt;
 }