Ejemplo n.º 1
0
 static function get($key, $default = null)
 {
     $theme = Webconfig::get('app.theme');
     if (mb_strpos($key, '::')) {
         $theme_key = str_replace('::', '::!/' . $theme, $key);
     } else {
         $theme_key = '!/' . $theme . '/' . $key;
     }
     return \Config::get($theme_key, \Config::get($key, $default));
 }
Ejemplo n.º 2
0
Archivo: Sync.php Proyecto: larakit/lk
 protected function downloadFiles(array $files)
 {
     $progress = new \Symfony\Component\Console\Helper\ProgressBar($this->output, sizeof($files));
     $progress->setFormat('debug');
     $progress->start();
     $production_url = Webconfig::get('larakit.sync_url');
     //'http://bmmaket.bmdemo.ru';
     //        dd($production_url);
     $path = public_path();
     foreach ($files as $file) {
         try {
             $url = trim(Arr::get($file, 'url'), '/');
             if ($url) {
                 $thumb = Arr::get($file, 'thumb');
                 $size = Arr::get($file, 'size');
                 if (!file_exists(dirname($path . '/' . $url))) {
                     mkdir(dirname($path . '/' . $url), 0777, true);
                 }
                 //                    $this->info('');
                 //                    $this->info('-----------');
                 //                    $this->info(trim($production_url, '/') . '/' . $url);
                 //                    $this->info($path . '/' . $url);
                 //                    $this->info('-----------');
                 copy(trim($production_url, '/') . '/' . $url, $path . '/' . $url);
                 $selector = [];
                 $selector[] = 'img[data-entity=' . $thumb->entity() . '][data-vendor=' . $thumb->vendor() . '][data-thumb-size=' . $size . '][data-thumb-name=' . $thumb->getName() . '],';
                 $selector[] = '.js-list[data-entity=' . $thumb->entity() . '][data-vendor=' . $thumb->vendor() . ']';
                 $selector[] = '.js-item[data-id=' . $thumb->getId() . ']';
                 $selector[] = '.js-btn[data-thumb-size=' . $size . '][data-thumb-name=' . $thumb->getName() . ']';
                 $selector[] = 'img';
                 $data = ['url' => $thumb->getUrl($size) . '?' . microtime(true), 'selector' => implode(' ', $selector)];
                 Event::notify('larakit::thumb_size', $data);
             }
             //                $this->info($url);
         } catch (\Exception $e) {
             //                $this->error(trim($e->getMessage()) . ':' . $e->getLine());
         }
         $progress->advance();
     }
     $progress->finish();
     $this->info('');
 }