Exemplo n.º 1
0
 protected function initBuilderSettings()
 {
     // Initialize Builder configuration - author name and namespace
     // if it was not set yet.
     $settings = PluginSettings::instance();
     if (strlen($settings->author_name) || strlen($settings->author_namespace)) {
         return;
     }
     $settings->author_name = $this->author;
     $settings->author_namespace = $this->author_namespace;
     $settings->save();
 }
Exemplo n.º 2
0
 protected function getData()
 {
     $plugins = $this->getPluginList();
     $searchTerm = Str::lower($this->getSearchTerm());
     // Apply the search
     //
     if (strlen($searchTerm)) {
         $words = explode(' ', $searchTerm);
         $result = [];
         foreach ($plugins as $code => $plugin) {
             if ($this->textMatchesSearch($words, $plugin['full-text'])) {
                 $result[$code] = $plugin;
             }
         }
         $plugins = $result;
     }
     // Apply the my plugins / all plugins filter
     //
     $mode = $this->getFilterMode();
     if ($mode == 'my') {
         $namespace = PluginSettings::instance()->author_namespace;
         $result = [];
         foreach ($plugins as $code => $plugin) {
             if (strcasecmp($plugin['namespace'], $namespace) === 0) {
                 $result[$code] = $plugin;
             }
         }
         $plugins = $result;
     }
     return $plugins;
 }