示例#1
0
 public function AvailableList($show_options = true)
 {
     global $langmessage, $config;
     //search settings
     $this->searchPerPage = 10;
     $this->searchOrderOptions = array();
     $this->searchOrderOptions['modified'] = $langmessage['Recently Updated'];
     $this->searchOrderOptions['rating_score'] = $langmessage['Highest Rated'];
     $this->searchOrderOptions['downloads'] = $langmessage['Most Downloaded'];
     $this->SearchOrder();
     $this->SortAvailable();
     // pagination
     $this->searchMax = count($this->avail_addons);
     $this->searchPage = \gp\special\Search::ReqPage('page', $this->searchMax);
     $start = $this->searchPage * $this->searchPerPage;
     $possible = array_slice($this->avail_addons, $start, $this->searchPerPage, true);
     if ($show_options) {
         $this->SearchOptions();
         echo '<hr/>';
     }
     // show themes
     echo '<div id="gp_avail_themes">';
     foreach ($possible as $theme_id => $info) {
         $this->AvailableTheme($theme_id, $info, $show_options);
     }
     echo '</div>';
     if ($show_options) {
         $this->SearchNavLinks();
     }
 }
示例#2
0
 /**
  * Get remote addon data and display to user
  *
  */
 public function RemoteBrowse()
 {
     global $langmessage, $config;
     $this->SearchOptionSave();
     //make a list of installed addon id's
     $this->installed_ids = self::InstalledIds();
     //search settings
     $this->searchUrl = $this->path_remote;
     $this->searchOrderOptions['rating_score'] = $langmessage['Highest Rated'];
     $this->searchOrderOptions['downloads'] = $langmessage['Most Downloaded'];
     $this->searchOrderOptions['modified'] = $langmessage['Recently Updated'];
     $this->searchOrderOptions['created'] = $langmessage['Newest'];
     $_GET += array('q' => '');
     $this->searchPage = \gp\special\Search::ReqPage('page');
     //version specific search
     if (!isset($config['search_version']) || $config['search_version']) {
         $this->searchQuery .= '&ug=' . rawurlencode(gpversion);
     }
     if (!empty($_GET['q'])) {
         $this->searchQuery .= '&q=' . rawurlencode($_GET['q']);
     }
     $this->SearchOrder();
     $slug = 'Plugins';
     if ($this->config_index == 'themes') {
         $slug = 'Themes';
     }
     $src = addon_browse_path . '/' . $slug . '?cmd=remote&format=json&' . $this->searchQuery . '&page=' . $this->searchPage;
     // format=json added 4.6b3
     $data = $this->RemoteBrowseResponse($src);
     if ($data === false) {
         return;
     }
     $this->searchMax = $data['max'];
     if (isset($data['per_page']) && $data['per_page']) {
         $this->searchPerPage = $data['per_page'];
     } else {
         $this->searchPerPage = count($data['rows']);
     }
     $this->ShowHeader();
     $this->RemoteBrowseRows($data);
     $this->VersionOption();
 }