Ejemplo n.º 1
0
 /**
  *
  * Saving lang files from $res
  *
  * @param string $res
  * @param string $lang
  * @param string $fname
  * @return bool
  * @throws \Exception
  */
 public function parseLangCSV($res, $lang = '', $fname = 'main', $commentSeparator = '#')
 {
     $path = \App::langPath() . DIRECTORY_SEPARATOR;
     $path_js = \App::publicPath() . DIRECTORY_SEPARATOR . 'js/lang/' . DIRECTORY_SEPARATOR;
     $file = \App::storagePath() . DIRECTORY_SEPARATOR . 'temp.csv';
     file_put_contents($file, $res);
     $csvFile = fopen($file, 'r');
     while (!feof($csvFile)) {
         $csv = fgetcsv($csvFile);
         $csvArr[] = $csv;
     }
     $csv = $csvArr;
     if (!empty($csv)) {
         /*foreach ($csv as $k => $v) {
               $csv[$k] = str_getcsv($v);
           }*/
         $langs = $csv[0];
         unset($csv[0], $langs[0]);
         //dd($langs);
         foreach ($langs as $k => $lang) {
             $data = array();
             $count = 0;
             foreach ($csv as $line) {
                 if (empty($line[0])) {
                     continue;
                 }
                 if (count($line) < 2) {
                     continue;
                 }
                 if ($line[0][0] == $commentSeparator) {
                     continue;
                 }
                 if (isset($line[$k])) {
                     $data[$line[0]] = $line[$k];
                     $count++;
                 }
             }
             $r = $this->writeLangFile($data, $path . $lang . DIRECTORY_SEPARATOR, $fname . '.php');
             $s = $this->writeLangJsFile($data, $path_js . $lang . DIRECTORY_SEPARATOR, $fname . '.js');
             if ($r && $s) {
                 echo 'writing ' . $lang . ': ' . $count . " entries\n";
             } else {
                 echo 'error writing ' . $lang . " (php: {$r} / js: {$s}) \n";
             }
         }
         return true;
     } else {
         throw new \Exception('Empty Data', 500);
     }
 }
Ejemplo n.º 2
0
 /**
  * Registers the TvDb-client.
  *
  * @param Application $app
  *
  * @return void
  */
 public function registerClient(Application $app)
 {
     $app->singleton('bstien.tvdb.client', function ($app) {
         // Set API-key
         $apiKey = $app['config']['tvdb.api.key'];
         // Set base URL for TvDb-Client
         $baseUrl = $app['config']['tvdb.api.url'];
         // Set cache-path.
         $cachePath = !isset($app['config']['tvdb.cache.path']) ? "/cache/tvdb/" : $app['config']['tvdb.cache.path'];
         $cachePath = \App::storagePath() . $cachePath;
         // Set cache-TTL.
         $cacheTtl = !isset($app['config']['tvdb.cache.ttl']) ? null : $app['config']['tvdb.cache.ttl'];
         return new TvDbClient($baseUrl, $apiKey, $cachePath, $cacheTtl);
     });
 }
 public function __construct()
 {
     $this->cachePath = \App::storagePath() . '/' . self::CACHE_DIR_NAME;
 }
Ejemplo n.º 4
0
<?php

return ['paths' => [realpath(App::basePath('resources/views'))], 'compiled' => realpath(App::storagePath('framework/views'))];
Ejemplo n.º 5
0
<?php

return ['default' => env('CACHE_DRIVER', 'file'), 'stores' => ['apc' => ['driver' => 'apc'], 'array' => ['driver' => 'array'], 'database' => ['driver' => 'database', 'table' => 'cache', 'connection' => null], 'file' => ['driver' => 'file', 'path' => App::storagePath('framework/cache')], 'memcached' => ['driver' => 'memcached', 'servers' => [['host' => env('MEMCACHED_HOST', '127.0.0.1'), 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100]]], 'redis' => ['driver' => 'redis', 'connection' => 'default']], 'prefix' => env('CACHE_PREFIX', 'hero_cache')];