Example #1
0
 function save($iso, $lang)
 {
     $array = var_export($lang, true);
     $file = new File($this->dir . $iso . DS . $iso . '.locale.php', true);
     $file->clear();
     $file->write('<?php' . PHP_EOL . 'return ' . $array . ';');
 }
Example #2
0
 static function set($name = false, $context = false)
 {
     if ($name && $context) {
         $file_name = self::getTempFile($name);
         File::delete($file_name);
         $file = new File($file_name, true);
         $file->clear();
         $file->write($context);
     }
     return false;
 }
Example #3
0
 /**
  * Clear all keys from the cache.
  * 
  * This method returns true on success and false on failure.
  * 
  * @return bool
  */
 public function clear()
 {
     parent::clear();
     $this->data = array();
     return true;
 }
Example #4
0
 function setConfig($iso, $conf)
 {
     $localesDir = APP_DIR . DS . App::getAppName() . DS . APP_LOCALE . DS;
     $config = $localesDir . $iso . DS . 'config.php';
     $template = '<?php' . PHP_EOL . 'return ' . var_export($conf, true) . ';';
     $file = new File($config);
     $file->clear();
     $file->write($template);
 }
Example #5
0
 private function save($table = false, $data = array())
 {
     if (!$table) {
         return false;
     }
     $file = $this->basesDir . $table . DS . NODATABASE_TABLE_FILE;
     if (file_exists($file) && is_array($data)) {
         $handler = new File($file);
         $handler->clear();
         $handler->write('<?php' . PHP_EOL . 'return ' . var_export($data, true) . ';');
         return true;
     }
     return false;
 }
Example #6
0
 public static function save($app = false)
 {
     if (!$app && self::$settings) {
         foreach (self::$settings as $key => $value) {
             self::save($key);
         }
         return true;
     }
     if (isset(self::$settings[$app])) {
         $config = self::$settings[$app];
         unset($config['file']);
         $file = new File(self::$settings[$app]['file'], true);
         $file->clear();
         $file->write('<?php' . PHP_EOL . 'return ' . var_export($config, true) . ';' . PHP_EOL . '// PHP_EOL');
         return true;
     }
     return false;
 }