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


PHP PageList::isEmpty方法代码示例

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


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

示例1: testPageList

 function testPageList()
 {
     // Completely empty PageList
     $columns = "";
     $exclude = "";
     $options = "";
     $pl = new PageList($columns, $exclude, $options);
     $this->assertTrue($pl->isEmpty(), "empty");
     $this->assertEquals(0, $pl->getTotal(), "count 0");
     $cap = $pl->getCaption();
     $this->assertTrue(empty($cap), "empty caption");
     // PageList sorting
     $columns[] = 'pagename';
     $pl = new PageList($columns, $exclude, $options);
     //global $request;
     $pl->addPage("foo");
     $pl->addPage("blarg");
     $this->assertEquals(2, $pl->getTotal(), "count 2");
     //print_r($pl->getContent());
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:20,代码来源:PageListTest.php

示例2: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if (empty($page) and $page != '0') {
         return '';
     }
     // exclude is now already expanded in WikiPlugin::getArgs()
     if (empty($exclude)) {
         $exclude = array();
     }
     if (!$include_self) {
         $exclude[] = $page;
     }
     if ($info) {
         $info = explode(",", $info);
         if (in_array('count', $info)) {
             $args['types']['count'] = new _PageList_Column_BackLinks_count('count', _("#"), 'center');
         }
     }
     if (!empty($limit)) {
         $args['limit'] = $limit;
     }
     $args['dosort'] = !empty($args['sortby']);
     // override DB sort (??)
     $pagelist = new PageList($info, $exclude, $args);
     // support logical AND: page1,page2
     $pages = explodePageList($page);
     $count = count($pages);
     if (count($pages) > 1) {
         // AND: the intersection of all these pages
         $bl = array();
         foreach ($pages as $p) {
             $dp = $dbi->getPage($p);
             $bi = $dp->getBackLinks(false, $sortby, 0, $exclude);
             while ($b = $bi->next()) {
                 $name = $b->getName();
                 if (isset($bl[$name])) {
                     $bl[$name]++;
                 } else {
                     $bl[$name] = 1;
                 }
             }
         }
         foreach ($bl as $b => $v) {
             if ($v == $count) {
                 $pagelist->addPage($b);
             }
         }
     } else {
         $p = $dbi->getPage($page);
         $pagelist->addPages($p->getBackLinks(false, $sortby, 0, $exclude));
     }
     $total = $pagelist->getTotal();
     // Localization note: In English, the differences between the
     // various phrases spit out here may seem subtle or negligible
     // enough to tempt you to combine/normalize some of these
     // strings together, but the grammar employed most by other
     // languages does not always end up with so subtle a
     // distinction as it does with English in this case. :)
     if (!$noheader) {
         if ($page == $request->getArg('pagename') and !$dbi->isWikiPage($page)) {
             // BackLinks plugin is more than likely being called
             // upon for an empty page on said page, while either
             // 'browse'ing, 'create'ing or 'edit'ing.
             //
             // Don't bother displaying a WikiLink 'unknown', just
             // the Un~WikiLink~ified (plain) name of the uncreated
             // page currently being viewed.
             $pagelink = $page;
             if ($pagelist->isEmpty()) {
                 return HTML::p(fmt("No other page links to %s yet.", $pagelink));
             }
             if ($total == 1) {
                 $pagelist->setCaption(fmt("One page would link to %s:", $pagelink));
             } else {
                 $pagelist->setCaption(fmt("%s pages would link to %s:", $total, $pagelink));
             }
         } else {
             if ($count) {
                 $tmp_pages = $pages;
                 $p = array_shift($tmp_pages);
                 $pagelink = HTML(WikiLink($p, 'auto'));
                 foreach ($tmp_pages as $p) {
                     $pagelink->pushContent(" ", _("AND"), " ", WikiLink($p, 'auto'));
                 }
             } else {
                 // BackLinks plugin is being displayed on a normal page.
                 $pagelink = WikiLink($page, 'auto');
             }
             if ($pagelist->isEmpty()) {
                 return HTML::p(fmt("No page links to %s.", $pagelink));
             }
             //trigger_error("DEBUG: " . $pagelist->getTotal());
             if ($total == 1) {
                 $pagelist->setCaption(fmt("One page links to %s:", $pagelink));
             } else {
                 $pagelist->setCaption(fmt("%s pages link to %s:", $limit > 0 ? $total : _("Those"), $pagelink));
             }
         }
//.........这里部分代码省略.........
开发者ID:hugcoday,项目名称:wiki,代码行数:101,代码来源:BackLinks.php

示例3: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if (empty($page) and $page != '0') {
         return '';
     }
     // exclude is now already expanded in WikiPlugin::getArgs()
     if (empty($exclude)) {
         $exclude = array();
     }
     if (!$include_self) {
         $exclude[] = $page;
     }
     if ($info) {
         $info = explode(",", $info);
         if (in_array('count', $info)) {
             $args['types']['count'] = new _PageList_Column_BackLinks_count('count', _("#"), 'center');
         }
     }
     $args['dosort'] = !empty($args['sortby']);
     // override DB sort (??)
     $pagelist = new PageList($info, $exclude, $args);
     $p = $dbi->getPage($page);
     $pagelist->addPages($p->getBackLinks(false, $sortby, $limit, $exclude));
     // Localization note: In English, the differences between the
     // various phrases spit out here may seem subtle or negligible
     // enough to tempt you to combine/normalize some of these
     // strings together, but the grammar employed most by other
     // languages does not always end up with so subtle a
     // distinction as it does with English in this case. :)
     if (!$noheader) {
         if ($page == $request->getArg('pagename') and !$dbi->isWikiPage($page)) {
             // BackLinks plugin is more than likely being called
             // upon for an empty page on said page, while either
             // 'browse'ing, 'create'ing or 'edit'ing.
             //
             // Don't bother displaying a WikiLink 'unknown', just
             // the Un~WikiLink~ified (plain) name of the uncreated
             // page currently being viewed.
             $pagelink = $page;
             if ($pagelist->isEmpty()) {
                 return HTML::p(fmt("No other page links to %s yet.", $pagelink));
             }
             if ($pagelist->getTotal() == 1) {
                 $pagelist->setCaption(fmt("One page would link to %s:", $pagelink));
             } else {
                 $pagelist->setCaption(fmt("%s pages would link to %s:", $pagelist->getTotal(), $pagelink));
             }
         } else {
             // BackLinks plugin is being displayed on a normal page.
             $pagelink = WikiLink($page, 'auto');
             if ($pagelist->isEmpty()) {
                 return HTML::p(fmt("No page links to %s.", $pagelink));
             }
             //trigger_error("DEBUG: " . $pagelist->getTotal());
             if ($pagelist->getTotal() == 1) {
                 $pagelist->setCaption(fmt("One page links to %s:", $pagelink));
             } else {
                 $pagelist->setCaption(fmt("%s pages link to %s:", $pagelist->getTotal(), $pagelink));
             }
         }
     }
     return $pagelist;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:65,代码来源:BackLinks.php


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