Exemplo n.º 1
0
 public function getThemeOptions($keyValue = null)
 {
     $all = Theme::all();
     $ret = [];
     foreach ($all as $theme) {
         $ret[$theme->getDirName()] = $theme->getConfigValue('name', $theme->getDirName());
     }
     return ['' => '-- none --'] + $ret;
 }
Exemplo n.º 2
0
 /**
  * Execute the console command.
  */
 public function fire()
 {
     $themeManager = ThemeManager::instance();
     $updateManager = UpdateManager::instance();
     foreach (Theme::all() as $theme) {
         $flag = $theme->isActiveTheme() ? '[*] ' : '[-] ';
         $themeId = $theme->getId();
         $themeName = $themeManager->findByDirName($themeId) ?: $themeId;
         $this->info($flag . $themeName);
     }
     if ($this->option('include-marketplace')) {
         // @todo List everything in the marketplace - not just popular.
         $popularThemes = $updateManager->requestPopularProducts('theme');
         foreach ($popularThemes as $popularTheme) {
             if (!$themeManager->isInstalled($popularTheme['code'])) {
                 $this->info('[ ] ' . $popularTheme['code']);
             }
         }
     }
     $this->info(PHP_EOL . "[*] Active    [-] Installed    [ ] Not installed");
 }
 public function up()
 {
     $themes = Theme::all();
     foreach ($themes as $theme) {
         $partials = Partial::inTheme($theme)->all();
         foreach ($partials as $partial) {
             try {
                 $path = $partial->getFullPath();
                 $contents = File::get($path);
                 if (strpos($contents, 'staticPageSnippetCode') === false) {
                     continue;
                 }
                 $contents = str_replace('staticPageSnippetName', 'snippetName', $contents);
                 $contents = str_replace('staticPageSnippetCode', 'snippetCode', $contents);
                 $contents = str_replace('staticPageSnippetProperties', 'snippetProperties', $contents);
                 File::put($path, $contents);
             } catch (\Exception $ex) {
                 continue;
             }
         }
     }
 }