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


PHP PageList::explodePageList方法代码示例

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


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

示例1: WikiDB_backend_dumb_WantedPagesIter

 function WikiDB_backend_dumb_WantedPagesIter(&$backend, &$all_pages, $exclude = '', $sortby = false, $limit = false)
 {
     $this->_allpages = $all_pages;
     $this->_allpages_array = $all_pages->asArray();
     $this->_backend =& $backend;
     if (!is_array($exclude)) {
         $this->exclude = $exclude ? PageList::explodePageList($exclude) : array();
     } else {
         $this->exclude = $exclude;
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:WantedPagesIter.php

示例2: WikiDB_backend_dumb_WantedPagesIter

 function WikiDB_backend_dumb_WantedPagesIter(&$backend, &$all_pages, $exclude = '', $sortby = '', $limit = '')
 {
     $this->_allpages = $all_pages;
     $this->_allpages_array = $all_pages->asArray();
     $this->_backend =& $backend;
     if (!is_array($exclude)) {
         $this->exclude = $exclude ? PageList::explodePageList($exclude) : array();
     } else {
         $this->exclude = $exclude;
     }
     $this->sortby = $sortby;
     // ignored
     if ($limit) {
         // extract from,count from limit
         list($this->from, $this->limit) = $backend->limit($limit);
     } else {
         $this->limit = 0;
         $this->from = 0;
     }
     $this->pos = 0;
     $this->pagelinks = array();
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:22,代码来源:WantedPagesIter.php

示例3: applyFilters

 /**
  * Apply filters for options like 'sortby', 'limit', 'exclude'
  * for simple queries like titleSearch, where the backend is not ready yet.
  * Since iteration is usually destructive for SQL results,
  * we have to generate a copy.
  */
 function applyFilters($options = false)
 {
     if (!$options) {
         $options = $this->_options;
     }
     if (isset($options['sortby'])) {
         $array = array();
         /* this is destructive */
         while ($page = $this->next()) {
             $result[] = $page->getName();
         }
         $this->_doSort($array, $options['sortby']);
     }
     /* the rest is not destructive.
      * reconstruct a new iterator 
      */
     $pagenames = array();
     $i = 0;
     if (isset($options['limit'])) {
         $limit = $options['limit'];
     } else {
         $limit = 0;
     }
     if (isset($options['exclude'])) {
         $exclude = $options['exclude'];
     }
     if (is_string($exclude) and !is_array($exclude)) {
         $exclude = PageList::explodePageList($exclude, false, false, $limit);
     }
     foreach ($array as $pagename) {
         if ($limit and $i++ > $limit) {
             return new WikiDB_Array_PageIterator($pagenames);
         }
         if (!empty($exclude) and !in_array($pagename, $exclude)) {
             $pagenames[] = $pagename;
         } elseif (empty($exclude)) {
             $pagenames[] = $pagename;
         }
     }
     return new WikiDB_Array_PageIterator($pagenames);
 }
开发者ID:nterray,项目名称:tuleap,代码行数:47,代码来源:WikiDB.php

示例4: explodePageList

function explodePageList($input, $include_empty = false, $sortby = 'pagename', $limit = '', $exclude = '')
{
    include_once "lib/PageList.php";
    return PageList::explodePageList($input, $include_empty, $sortby, $limit, $exclude);
}
开发者ID:hugcoday,项目名称:wiki,代码行数:5,代码来源:stdlib.php

示例5: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $this->args = $this->getArgs($argstr, $request);
     extract($this->args);
     $this->request =& $request;
     if (!$from_lang) {
         $from_lang = $request->getPref('lang');
     }
     if (!$from_lang) {
         $from_lang = $GLOBALS['LANG'];
     }
     $this->lang = $from_lang;
     if (empty($languages)) {
         $available_languages = listAvailableLanguages();
         if ($from_lang == 'en') {
             // "en" is always the first.
             array_shift($available_languages);
         }
         // put from_lang to the very end.
         if (in_array($from_lang, $available_languages)) {
             $languages = $available_languages;
         } else {
             $languages = array_merge($available_languages, array($from_lang));
         }
     } elseif (strstr($languages, ',')) {
         $languages = explode(',', $languages);
     } else {
         $languages = array($languages);
     }
     if (in_array('zh', $languages) or in_array('ja', $languages)) {
         // If the current charset != utf-8 the text will not be displayed correctly.
         // But here we cannot change the header anymore. So we can decide to ignore them,
         // or display them with all the errors.
         //FIXME: do iconv the ob
         if ($GLOBALS['charset'] != 'utf-8' and !defined('NEED_ICONV_TO')) {
             define('NEED_ICONV_TO', 'utf-8');
             //either the extension or external
             //$GLOBALS['charset'] = 'utf-8';
         }
     }
     $to_lang = $languages[0];
     if (!empty($string) and count($languages) == 1) {
         return $this->translate($string, $to_lang, $from_lang);
     }
     if (!empty($page)) {
         $pagename = $page;
         if ($dbi->isWikiPage($pagename)) {
             $url = '';
             // google can only translate from english and french
             if (in_array($from_lang, array('en', 'fr'))) {
                 $url = "http://translate.google.com/translate";
                 $url .= "?langpair=" . urlencode($from_lang . "|" . $to_lang);
                 $url .= "&u=" . urlencode(WikiURL($pagename, false, true));
             }
             // redirect or transclude?
             if ($url) {
                 return $request->redirect($url);
             }
             return HTML(fmt("TODO: Google can only translate from english and french. Find a translation service for %s to language %s", WikiURL($pagename, false, true), $to_lang));
         } else {
             return $this->error(fmt("%s is empty", $pagename));
         }
     }
     $pagelist = new PageList('', $exclude, $this->args);
     $pagelist->_columns[0]->_heading = "{$from_lang}";
     foreach ($languages as $lang) {
         if ($lang == $from_lang) {
             continue;
         }
         $field = "custom:{$lang}";
         $pagelist->addColumnObject(new _PageList_Column_customlang($field, $from_lang, $this));
     }
     if (!empty($string)) {
         $pagelist->addPage($string);
         return $pagelist;
     }
     switch ($what) {
         case 'allpages':
             $pagelist->addPages($dbi->getAllPages($include_empty, $sortby, $limit, $exclude));
             break;
         case 'pages':
             // not all pages, only the pgsrc pages
             if (!is_array($exclude)) {
                 $exclude = $pagelist->explodePageList($exclude, false, $sortby, $limit, $exclude);
             }
             $path = FindLocalizedFile(WIKI_PGSRC);
             $pgsrc = new fileSet($path);
             foreach ($pgsrc->getFiles($exclude, $sortby, $limit) as $pagename) {
                 $pagename = urldecode($pagename);
                 if (substr($pagename, -1, 1) == '~') {
                     continue;
                 }
                 if (in_array($pagename, $exclude)) {
                     continue;
                 }
                 // exclude page.
                 if ($match != '*' and !glob_match($match, $pagename)) {
                     continue;
                 }
                 $page_handle = $dbi->getPage($pagename);
//.........这里部分代码省略.........
开发者ID:hugcoday,项目名称:wiki,代码行数:101,代码来源:_WikiTranslation.php

示例6: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     static $included_pages = false;
     if (!$included_pages) {
         $included_pages = array($basepage);
     }
     $args = $this->getArgs($argstr, $request);
     extract($args);
     $query = new TextSearchQuery($pagename . SUBPAGE_SEPARATOR . '*', true, 'glob');
     $subpages = $dbi->titleSearch($query, $sortby, $limit, $exclude);
     //if ($sortby)
     //    $subpages = $subpages->applyFilters(array('sortby' => $sortby, 'limit' => $limit, 'exclude' => $exclude));
     //$subpages = explodePageList($pagename . SUBPAGE_SEPARATOR . '*', false,
     //                            $sortby, $limit, $exclude);
     if (is_string($exclude) and !is_array($exclude)) {
         $exclude = PageList::explodePageList($exclude, false, false, $limit);
     }
     $content = HTML();
     include_once 'lib/BlockParser.php';
     $i = 0;
     while ($page = $subpages->next()) {
         $cpagename = $page->getName();
         if ($maxpages and $i++ > $maxpages) {
             return $content;
         }
         if (in_array($cpagename, $exclude)) {
             continue;
         }
         // A page cannot include itself. Avoid doublettes.
         if (in_array($cpagename, $included_pages)) {
             $content->pushContent(HTML::p(sprintf(_("recursive inclusion of page %s ignored"), $cpagename)));
             continue;
         }
         // Check if user is allowed to get the Page.
         if (!mayAccessPage('view', $cpagename)) {
             return $this->error(sprintf(_("Illegal inclusion of page %s: no read access"), $cpagename));
         }
         // trap any remaining nonexistant subpages
         if ($page->exists()) {
             $r = $page->getCurrentRevision();
             $c = $r->getContent();
             // array of lines
             // follow redirects
             if (preg_match('/<' . '\\?plugin\\s+RedirectTo\\s+page=(\\S+)\\s*\\?' . '>/', implode("\n", $c), $m) or preg_match('/<' . '\\?plugin\\s+RedirectTo\\s+page=(.*?)\\s*\\?' . '>/', implode("\n", $c), $m) or preg_match('/<<\\s*RedirectTo\\s+page=(\\S+)\\s*>>/', implode("\n", $c), $m) or preg_match('/<<\\s*RedirectTo\\s+page="(.*?)"\\s*>>/', implode("\n", $c), $m)) {
                 // Strip quotes (simple or double) from page name if any
                 if (string_starts_with($m[1], "'") or string_starts_with($m[1], "\"")) {
                     $m[1] = substr($m[1], 1, -1);
                 }
                 // trap recursive redirects
                 if (in_array($m[1], $included_pages)) {
                     if (!$quiet) {
                         $content->pushContent(HTML::p(sprintf(_("recursive inclusion of page %s ignored"), $cpagename . ' => ' . $m[1])));
                     }
                     continue;
                 }
                 $cpagename = $m[1];
                 // Check if user is allowed to get the Page.
                 if (!mayAccessPage('view', $cpagename)) {
                     return $this->error(sprintf(_("Illegal inclusion of page %s: no read access"), $cpagename));
                 }
                 $page = $dbi->getPage($cpagename);
                 $r = $page->getCurrentRevision();
                 $c = $r->getContent();
                 // array of lines
             }
             // moved to IncludePage
             $ct = $this->extractParts($c, $cpagename, $args);
             array_push($included_pages, $cpagename);
             if ($smalltitle) {
                 $pname = array_pop(explode(SUBPAGE_SEPARATOR, $cpagename));
                 // get last subpage name
                 // Use _("%s: %s") instead of .": ". for French punctuation
                 $ct = TransformText(sprintf(_("%s: %s"), "[{$pname}|{$cpagename}]", $ct), $r->get('markup'), $cpagename);
             } else {
                 $ct = TransformText($ct, $r->get('markup'), $cpagename);
             }
             array_pop($included_pages);
             if (!$smalltitle) {
                 $content->pushContent(HTML::p(array('class' => $quiet ? '' : 'transclusion-title'), fmt("Included from %s:", WikiLink($cpagename))));
             }
             $content->pushContent(HTML(HTML::div(array('class' => $quiet ? '' : 'transclusion'), false, $ct)));
         }
     }
     if (!isset($cpagename)) {
         return $this->error(sprintf(_("%s has no subpages defined."), $pagename));
     }
     return $content;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:88,代码来源:UnfoldSubpages.php

示例7: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     static $included_pages = false;
     if (!$included_pages) {
         $included_pages = array($basepage);
     }
     $args = $this->getArgs($argstr, $request);
     extract($args);
     $query = new TextSearchQuery($pagename . SUBPAGE_SEPARATOR . '*', true, 'glob');
     $subpages = $dbi->titleSearch($query, $sortby, $limit, $exclude);
     //if ($sortby)
     //    $subpages = $subpages->applyFilters(array('sortby' => $sortby, 'limit' => $limit, 'exclude' => $exclude));
     //$subpages = explodePageList($pagename . SUBPAGE_SEPARATOR . '*', false,
     //                            $sortby, $limit, $exclude);
     if (is_string($exclude) and !is_array($exclude)) {
         $exclude = PageList::explodePageList($exclude, false, false, $limit);
     }
     $content = HTML();
     include_once 'lib/BlockParser.php';
     $i = 0;
     while ($page = $subpages->next()) {
         $cpagename = $page->getName();
         if ($maxpages and $i++ > $maxpages) {
             return $content;
         }
         if (in_array($cpagename, $exclude)) {
             continue;
         }
         // A page cannot include itself. Avoid doublettes.
         if (in_array($cpagename, $included_pages)) {
             $content->pushContent(HTML::p(sprintf(_("recursive inclusion of page %s ignored"), $cpagename)));
             continue;
         }
         // trap any remaining nonexistant subpages
         if ($page->exists()) {
             $r = $page->getCurrentRevision();
             $c = $r->getContent();
             // array of lines
             // trap recursive redirects
             if (preg_match('/<' . '\\?plugin\\s+RedirectTo\\s+page=(\\w+)\\s+\\?' . '>/', implode("\n", $c), $m)) {
                 if (in_array($m[1], $included_pages)) {
                     if (!$quiet) {
                         $content->pushContent(HTML::p(sprintf(_("recursive inclusion of page %s ignored"), $cpagename . ' => ' . $m[1])));
                     }
                     continue;
                 }
             }
             if ($section) {
                 $c = extractSection($section, $c, $cpagename, $quiet, $sectionhead);
             }
             if ($lines) {
                 $c = array_slice($c, 0, $lines) . sprintf(_(" ... first %d lines"), $bytes);
             }
             if ($words) {
                 $c = firstNWordsOfContent($words, $c);
             }
             if ($bytes) {
                 if (strlen($c) > $bytes) {
                     $c = substr($c, 0, $bytes) . sprintf(_(" ... first %d bytes"), $bytes);
                 }
             }
             $ct = implode("\n", $c);
             // one string
             array_push($included_pages, $cpagename);
             if ($smalltitle) {
                 $pname = array_pop(explode(SUBPAGE_SEPARATOR, $cpagename));
                 // get last subpage name
                 // Use _("%s: %s") instead of .": ". for French punctuation
                 $ct = TransformText(sprintf(_("%s: %s"), "[{$pname}|{$cpagename}]", $ct), $r->get('markup'), $cpagename);
             } else {
                 $ct = TransformText($ct, $r->get('markup'), $cpagename);
             }
             array_pop($included_pages);
             if (!$smalltitle) {
                 $content->pushContent(HTML::p(array('class' => $quiet ? '' : 'transclusion-title'), fmt("Included from %s:", WikiLink($cpagename))));
             }
             $content->pushContent(HTML(HTML::div(array('class' => $quiet ? '' : 'transclusion'), false, $ct)));
         }
     }
     if (!$cpagename) {
         return $this->error(sprintf(_("%s has no subpages defined."), $pagename));
     }
     return $content;
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:84,代码来源:UnfoldSubpages.php


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