当前位置: 首页>>代码示例>>PHP>>正文


PHP Repository::encodeVersion方法代码示例

本文整理汇总了PHP中Repository::encodeVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::encodeVersion方法的具体用法?PHP Repository::encodeVersion怎么用?PHP Repository::encodeVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Repository的用法示例。


在下文中一共展示了Repository::encodeVersion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listExtensions

 /**
  * List the extensions
  */
 protected function listExtensions()
 {
     $rep =& $this->Template->rep;
     $rep->f_page = 0;
     // returning from submit?
     if ($this->filterPost('repository_action') == $rep->f_action) {
         // get url parameters
         $rep->f_tag = trim(Input::post('repository_tag'));
         $rep->f_type = trim(Input::post('repository_type'));
         $rep->f_category = trim(Input::post('repository_category'));
         $rep->f_state = trim(Input::post('repository_state'));
         $rep->f_author = trim(Input::post('repository_author'));
         $rep->f_order = trim(Input::post('repository_order'));
         $rep->f_page = trim(Input::post('repository_page'));
         $rep->f_find = trim(Input::post('repository_find'));
         $this->Session->set('repository_catalog_settings', array('repository_tag' => $rep->f_tag, 'repository_type' => $rep->f_type, 'repository_category' => $rep->f_category, 'repository_state' => $rep->f_state, 'repository_author' => $rep->f_author, 'repository_order' => $rep->f_order, 'repository_page' => $rep->f_page, 'repository_find' => $rep->f_find));
     } else {
         $stg = $this->Session->get('repository_catalog_settings');
         if (is_array($stg)) {
             $rep->f_tag = trim($stg['repository_tag']);
             $rep->f_type = trim($stg['repository_type']);
             $rep->f_category = trim($stg['repository_category']);
             $rep->f_state = trim($stg['repository_state']);
             $rep->f_author = trim($stg['repository_author']);
             $rep->f_order = trim($stg['repository_order']);
             $rep->f_page = trim($stg['repository_page']);
             $rep->f_find = trim($stg['repository_find']);
         }
         // if
     }
     // if
     if ($rep->f_order == '') {
         $rep->f_order = 'popular';
     }
     $perpage = (int) trim(Config::get('repository_listsize'));
     if ($perpage < 0) {
         $perpage = 0;
     }
     // process parameters and build query options
     $options = array('languages' => $this->languages, 'sets' => 'sums,reviews');
     if ($rep->f_page >= 0 && $perpage > 0) {
         $options['first'] = $rep->f_page * $perpage;
         $options['limit'] = $perpage;
     }
     // if
     if ($rep->f_tag != '') {
         $options['tags'] = $rep->f_tag;
     }
     if ($rep->f_type != '') {
         $options['types'] = $rep->f_type;
     }
     if ($rep->f_category != '') {
         $options['categories'] = $rep->f_category;
     }
     if ($rep->f_state != '') {
         $options['states'] = $rep->f_state;
     }
     if ($rep->f_author != '') {
         $options['authors'] = $rep->f_author;
     }
     if ($rep->f_find != '') {
         $options['find'] = $rep->f_find;
     }
     if (!Config::get('repository_unsafe_catalog')) {
         $options['compatibility'] = Repository::encodeVersion(VERSION . '.' . BUILD);
     }
     switch ($rep->f_order) {
         case 'name':
             break;
         case 'title':
             $options['order'] = 'title';
             break;
         case 'author':
             $options['order'] = 'author';
             break;
         case 'rating':
             $options['order'] = 'rating-';
             break;
         case 'reldate':
             $options['order'] = 'releasedate-';
             break;
         default:
             $options['order'] = 'popularity-';
     }
     // switch
     // query extensions
     $rep->extensions = $this->getExtensionList($options);
     if ($rep->f_page >= 0 && $perpage > 0 && count($rep->extensions) == 0) {
         $rep->f_page = 0;
         $options['first'] = 0;
         $rep->extensions = $this->getExtensionList($options);
     }
     // if
     // add view links
     $totrecs = 0;
     foreach ($rep->extensions as &$ext) {
         $ext->viewLink = $this->createUrl(array('view' => $ext->name . '.' . $ext->version . '.' . $ext->language));
//.........这里部分代码省略.........
开发者ID:iCodr8,项目名称:core,代码行数:101,代码来源:RepositoryCatalog.php

示例2: getInstalledExtensions

 /**
  * Get installed extensions list.
  * @return array Array with the extension records.
  */
 private function getInstalledExtensions($aIds = '')
 {
     $db =& $this->Database;
     // query installed extensions
     $exts = array();
     $q = $db->execute($aIds == '' ? "select * from `tl_repository_installs` order by `extension`" : "select * from `tl_repository_installs` where `id` in ({$aIds}) order by `extension`");
     while ($q->next()) {
         $exts[] = (object) $q->row();
     }
     // find each highest compatible version
     foreach ($exts as &$ext) {
         $ext->tl_incompatible = false;
         $ext->tl_shouldwork = false;
         $ext->dep_missing = array();
         $ext->dep_incompatible = array();
         $ext->dep_shouldwork = array();
         $ext->upd_version = $ext->version;
         $ext->upd_build = $ext->build;
         // query current release
         $elist = $this->getExtensionList(array('match' => 'exact', 'names' => $ext->extension, 'versions' => $ext->version, 'languages' => $this->languages, 'sets' => 'dependencies,history,details'));
         $ext->found = count($elist) > 0;
         if ($ext->found) {
             $extrec =& $elist[0];
             if (isset($extrec->manual)) {
                 $ext->manualLink = $extrec->manual;
             }
             if (isset($extrec->forum)) {
                 $ext->forumLink = $extrec->forum;
             }
             // contao compatibility check
             $tlversion = Repository::encodeVersion(VERSION . '.' . BUILD);
             $minver = $extrec->coreminversion > 0 ? $extrec->coreminversion : $tlversion;
             $maxver = $extrec->coremaxversion > 0 ? $extrec->coremaxversion : $tlversion;
             if ($tlversion < $minver || $tlversion > $maxver) {
                 $tlversion = intval($tlversion / 10000);
                 $minver = intval($minver / 10000);
                 $maxver = intval($maxver / 10000);
                 if ($tlversion < $minver || $tlversion > $maxver) {
                     $ext->tl_incompatible = true;
                 } else {
                     $ext->tl_shouldwork = true;
                 }
             }
             // if
             // dependencies compatibility check
             if (property_exists($ext, 'dependencies')) {
                 foreach ($ext->dependencies as &$dep) {
                     $found = false;
                     foreach ($exts as $e) {
                         if ($e->extension == $dep->extension) {
                             $found = true;
                             $extver = $e->version;
                             $minver = $dep->minversion > 0 ? $dep->minversion : $extver;
                             $maxver = $dep->maxversion > 0 ? $dep->maxversion : $extver;
                             if ($extver < $minver || $extver > $maxver) {
                                 $extver = intval($extver / 10000);
                                 $minver = intval($minver / 10000);
                                 $maxver = intval($maxver / 10000);
                                 if ($extver < $minver || $extver > $maxver) {
                                     $ext->dep_incompatible[] = array('extension' => $e->extension, 'version' => $e->version);
                                 } else {
                                     $ext->dep_shouldwork[] = array('extension' => $e->extension, 'version' => $e->version);
                                 }
                             }
                             // if
                             break;
                         }
                     }
                     // if
                     if (!$found) {
                         $ext->dep_missing[] = $dep->extension;
                     }
                 }
                 // foreach
             }
             // if
         } else {
             // find any other version
             $elist = $this->getExtensionList(array('match' => 'exact', 'names' => $ext->extension, 'languages' => $this->languages, 'sets' => 'dependencies,history'));
         }
         // if
         if (count($elist) < 1) {
             continue;
         }
         // no other tests possible
         // get all available versions in descending order
         $vers = array();
         foreach ($elist[0]->allversions as $ver) {
             array_unshift($vers, (object) array('version' => $ver->version, 'build' => $ver->build));
         }
         // find highest compatible version
         foreach ($vers as $ver) {
             // status check
             $compatible = false;
             switch ($ver->version % 10) {
                 case 0:
//.........这里部分代码省略.........
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:101,代码来源:RepositoryManager.php

示例3: listExtensions


//.........这里部分代码省略.........
             $rep->f_state = trim($stg['repository_state']);
             $rep->f_author = trim($stg['repository_author']);
             $rep->f_order = trim($stg['repository_order']);
             $rep->f_page = trim($stg['repository_page']);
             $rep->f_find = trim($stg['repository_find']);
             $rep->f_wildcardsearch = trim($stg['repository_wildcardsearch']);
         }
         // if
     }
     // if
     if ($rep->f_order == '') {
         $rep->f_order = 'popular';
     }
     if ($rep->f_page < 1) {
         $rep->f_page = 1;
     }
     $perpage = (int) trim($GLOBALS['TL_CONFIG']['repository_listsize']);
     if ($perpage < 1) {
         $perpage = 10;
     }
     // process parameters and build query options
     $options = array('languages' => $this->languages, 'sets' => 'sums,reviews', 'first' => ($rep->f_page - 1) * $perpage, 'limit' => $perpage);
     if ($rep->f_tag != '') {
         $options['tags'] = $rep->f_tag;
     }
     if ($rep->f_type != '') {
         $options['types'] = $rep->f_type;
     }
     if ($rep->f_category != '') {
         $options['categories'] = $rep->f_category;
     }
     if ($rep->f_state != '') {
         $options['states'] = $rep->f_state;
     }
     if ($rep->f_author != '') {
         $options['authors'] = $rep->f_author;
     }
     if ($rep->f_find != '') {
         $options['find'] = $rep->f_find;
     }
     if ($rep->f_wildcardsearch != '') {
         unset($options[match]);
         // in future(ER 2.0) we want something like: $options[match]				= 'fuzzy';
         $options[tags] = $rep->f_wildcardsearch;
         unset($rep->f_tag);
     }
     switch ($rep->f_order) {
         case 'name':
             break;
         case 'title':
             $options['order'] = 'title';
             break;
         case 'author':
             $options['order'] = 'author';
             break;
         case 'rating':
             $options['order'] = 'rating-';
             break;
         case 'reldate':
             $options['order'] = 'releasedate-';
             break;
         default:
             $options['order'] = 'popularity-';
     }
     // switch
     // query extensions
     $rep->extensions = $this->getExtensionList($options);
     if ($rep->f_page > 1 && count($rep->extensions) == 0) {
         $rep->f_page = 1;
         $options['first'] = 0;
         $rep->extensions = $this->getExtensionList($options);
     }
     // if
     // add view links
     $totrecs = 0;
     // Contao compatibility check
     $tlversion = Repository::encodeVersion(VERSION . '.' . BUILD);
     foreach ($rep->extensions as &$ext) {
         $ext->viewLink = $this->createUrl(array('view' => $ext->name . '.' . $ext->version . '.' . $ext->language));
         $totrecs = $ext->totrecs;
         $displayversion = sprintf('%s - %s', Repository::formatCoreVersion($ext->coreminversion), Repository::formatCoreVersion($ext->coremaxversion));
         if ($ext->coreminversion > 0 && $tlversion < $ext->coreminversion || $ext->coremaxversion > 0 && $tlversion > $ext->coremaxversion) {
             // less than current Core version
             $ext->status = (object) array('color' => 'darkorange', 'text' => 'notapproved', 'par1' => 'Contao', 'par2' => Repository::formatCoreVersion($tlversion));
             $ext->validfor = (object) array('color' => 'red', 'version' => $displayversion);
         } else {
             if ($ext->coremaxversion > 0 && $tlversion < $ext->coremaxversion) {
                 // greater than current Core version
                 $ext->validfor = (object) array('color' => 'blue', 'version' => $displayversion);
             } else {
                 // equal to current Core version
                 $ext->validfor = (object) array('color' => 'green', 'version' => $displayversion);
             }
         }
     }
     // foreach
     $rep->pages = $totrecs > 0 ? floor(($totrecs + $perpage - 1) / $perpage) : 1;
     $rep->tags = $this->getTagList(array('languages' => $this->languages, 'mode' => 'initcap'));
     $rep->authors = $this->getAuthorList(array('languages' => $this->languages));
 }
开发者ID:unmaintained-stuff,项目名称:tl_tenside,代码行数:101,代码来源:TensideCatalog.php


注:本文中的Repository::encodeVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。