Esempio n. 1
0
 /**
  * @return bool
  */
 public function execute()
 {
     $this->settings->set('seo.description', $this->request->get('description'));
     $this->settings->set('seo.keyword', $this->request->get('keyword'));
     $this->settings->set('seo.title', $this->request->get('title'));
     return true;
 }
Esempio n. 2
0
 /**
  * @param \Notadd\Foundation\Extension\ExtensionManager           $manager
  * @param \Notadd\Foundation\Setting\Contracts\SettingsRepository $settings
  *
  * @return bool
  */
 public function fire(ExtensionManager $manager, SettingsRepository $settings)
 {
     $name = $this->input->getArgument('name');
     $extensions = $manager->getExtensionPaths();
     if (!$extensions->offsetExists($name)) {
         $this->error("Extension {$name} do not exist!");
         return false;
     }
     if (!$this->container->make(SettingsRepository::class)->get('extension.' . $name . '.installed')) {
         $this->error("Extension {$name} does not installed!");
         return false;
     }
     $extension = $extensions->get($name);
     $path = $extension;
     if (Str::contains($path, $manager->getVendorPath())) {
         $this->error("Please update extension {$name} from composer command!");
         return false;
     }
     $extensionFile = new JsonFile($path . DIRECTORY_SEPARATOR . 'composer.json');
     $extension = collect($extensionFile->read());
     if ($extension->has('autoload')) {
         $autoload = collect($extension->get('autoload'));
         $autoload->has('classmap') && collect($autoload->get('classmap'))->each(function ($value) use($path) {
             $path = str_replace($this->container->basePath() . '/', '', realpath($path . DIRECTORY_SEPARATOR . $value)) . '/';
             if (!in_array($path, $this->backup['autoload']['classmap'])) {
                 $this->backup['autoload']['classmap'][] = $path;
             }
         });
         $autoload->has('files') && collect($autoload->get('files'))->each(function ($value) use($path) {
             $path = str_replace($this->container->basePath() . '/', '', realpath($path . DIRECTORY_SEPARATOR . $value));
             if (!in_array($path, $this->backup['autoload']['files'])) {
                 $this->backup['autoload']['files'][] = $path;
             }
         });
         $autoload->has('psr-0') && collect($autoload->get('psr-0'))->each(function ($value, $key) use($path) {
             $path = str_replace($this->container->basePath() . '/', '', realpath($path . DIRECTORY_SEPARATOR . $value)) . '/';
             $this->backup['autoload']['psr-0'][$key] = $path;
         });
         $autoload->has('psr-4') && collect($autoload->get('psr-4'))->each(function ($value, $key) use($path) {
             $path = str_replace($this->container->basePath() . '/', '', realpath($path . DIRECTORY_SEPARATOR . $value)) . '/';
             $this->backup['autoload']['psr-4'][$key] = $path;
         });
         $this->json->addProperty('autoload', $this->backup['autoload']);
         $settings->set('extension.' . $name . '.autoload', json_encode($autoload->toArray()));
     }
     if ($extension->has('require')) {
         $require = collect($extension->get('require'));
         $require->each(function ($version, $name) {
             $this->backup['require'][$name] = $version;
         });
         $this->json->addProperty('require', $this->backup['require']);
         $settings->set('extension.' . $name . '.require', json_encode($require->toArray()));
     }
     $this->updateComposer(true);
     $this->info("Extension {$name} is updated!");
     return true;
 }
Esempio n. 3
0
 /**
  * Optimization constructor.
  *
  * @param \Illuminate\Container\Container                         $container
  * @param \Notadd\Foundation\Setting\Contracts\SettingsRepository $settings
  * @param \Illuminate\View\Factory                                $view
  */
 public function __construct(Container $container, SettingsRepository $settings, Factory $view)
 {
     $this->container = $container;
     $this->view = $view;
     $this->code = new Collection();
     $this->meta = new Meta();
     $this->settings = $settings;
     $this->code->put('{sitename}', $this->settings->get('seo.title', 'Notadd CMS'));
     $this->code->put('{keywords}', $this->settings->get('seo.keyword', 'Notadd CMS'));
     $this->code->put('{description}', $this->settings->get('seo.description', 'Notadd CMS'));
 }
Esempio n. 4
0
 /**
  * @return bool
  */
 public function execute()
 {
     $this->settings->set('site.enabled', $this->request->input('enabled'));
     $this->settings->set('site.name', $this->request->input('name'));
     $this->settings->set('site.domain', $this->request->input('domain'));
     $this->settings->set('site.beian', $this->request->input('beian'));
     $this->settings->set('site.company', $this->request->input('company'));
     $this->settings->set('site.copyright', $this->request->input('copyright'));
     $this->settings->set('site.statistics', $this->request->input('statistics'));
     return true;
 }
Esempio n. 5
0
 /**
  * @return bool
  */
 public function execute()
 {
     $this->settings->set('mail.protocol', $this->request->input('protocol'));
     $this->settings->set('mail.encryption', $this->request->input('encryption'));
     $this->settings->set('mail.port', $this->request->input('port'));
     $this->settings->set('mail.host', $this->request->input('host'));
     $this->settings->set('mail.mail', $this->request->input('mail'));
     $this->settings->set('mail.username', $this->request->input('username'));
     $this->settings->set('mail.password', $this->request->input('password'));
     return true;
 }
Esempio n. 6
0
 /**
  * Command Handler.
  *
  * @param \Notadd\Foundation\Extension\ExtensionManager           $manager
  * @param \Notadd\Foundation\Setting\Contracts\SettingsRepository $settings
  *
  * @return true
  * @throws \Exception
  */
 public function fire(ExtensionManager $manager, SettingsRepository $settings)
 {
     $name = $this->input->getArgument('name');
     $extensions = $manager->getExtensionPaths();
     if (!$extensions->offsetExists($name)) {
         $this->error("Extension {$name} do not exist!");
         return false;
     }
     if (!$settings->get('extension.' . $name . '.installed')) {
         $this->error("Extension {$name} does not installed!");
         return false;
     }
     $path = $extensions->get($name);
     if (Str::contains($path, $manager->getVendorPath())) {
         $this->error("Please remove extension {$name} from composer.json!");
         return false;
     }
     $this->composer->dumpAutoloads();
     $settings->set('extension.' . $name . '.installed', false);
     $this->info("Extension {$name} is uninstalled!");
     return true;
 }
Esempio n. 7
0
 /**
  * Execute Handler.
  *
  * @return bool
  */
 public function execute()
 {
     $this->settings->set('attachment.cnd.default', $this->request->get('default'));
     return true;
 }
Esempio n. 8
0
 /**
  * @return array
  */
 public function data()
 {
     return $this->settings->all()->toArray();
 }
Esempio n. 9
0
 /**
  * @return bool
  */
 public function execute()
 {
     $this->settings->set('debug.enabled', $this->request->input('enabled'));
     return true;
 }
 /**
  * @param $key
  * @param $value
  */
 public function set($key, $value)
 {
     $this->cache[$key] = $value;
     $this->inner->set($key, $value);
 }
Esempio n. 11
0
 /**
  * Execute Handler.
  *
  * @return bool
  */
 public function execute()
 {
     $this->settings->set('storage.default', $this->request->get('default'));
     return true;
 }
Esempio n. 12
0
 /**
  * @param \Notadd\Foundation\Setting\Contracts\SettingsRepository $settings
  */
 public function postInstall(SettingsRepository $settings)
 {
     if ($this->extension->has('autoload')) {
         $this->json->addProperty('autoload', $this->backup['autoload']);
         $settings->set("extension.{$this->name}.autoload", json_encode($this->extension->get('autoload')));
     }
     if ($this->extension->has('require')) {
         $this->json->addProperty('require', $this->backup['require']);
         $settings->set("extension.{$this->name}.require", json_encode($this->extension->get('require')));
     }
     $settings->set("extension.{$this->name}.info", json_encode($this->info));
 }
Esempio n. 13
0
 /**
  * @return bool
  */
 public function execute()
 {
     $this->settings->set('attachment.engine', $this->request->get('engine'));
     $this->settings->set('attachment.limit.file', $this->request->get('limit_file'));
     $this->settings->set('attachment.limit.image', $this->request->get('limit_image'));
     $this->settings->set('attachment.limit.video', $this->request->get('limit_video'));
     $this->settings->set('attachment.format.image', $this->request->get('allow_image'));
     $this->settings->set('attachment.format.catcher', $this->request->get('allow_catcher'));
     $this->settings->set('attachment.format.video', $this->request->get('allow_video'));
     $this->settings->set('attachment.format.file', $this->request->get('allow_file'));
     $this->settings->set('attachment.manager.image', $this->request->get('allow_manager_image'));
     $this->settings->set('attachment.manager.file', $this->request->get('allow_manager_file'));
     $this->settings->set('attachment.watermark', $this->request->get('allow_watermark'));
     return true;
 }
Esempio n. 14
0
 /**
  * Post Install handler.
  *
  * @param \Notadd\Foundation\Setting\Contracts\SettingsRepository $settings
  */
 public function postInstall(SettingsRepository $settings)
 {
     $settings->set("extension.{$this->name}.info", json_encode($this->info));
 }