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


PHP Wiki::get_api_limit方法代码示例

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


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

示例1: get_duplicates

 /**
  * Returns an array of all files with identical sha1 hashes
  *
  * @param int $limit Number of duplicates to get. Default null (all)
  * @param bool $force Force regeneration of the cache. Default false (use cache).
  * @return array Duplicate files
  */
 public function get_duplicates($limit = null, $force = false)
 {
     if ($force || !count($this->duplicates)) {
         if (!$this->get_exists()) {
             return $this->duplicates;
         }
         $dArray = array('action' => 'query', 'prop' => 'duplicatefiles', 'dflimit' => is_null($limit) ? $this->wiki->get_api_limit() + 1 : $limit, 'titles' => $this->title);
         $continue = null;
         pecho("Getting duplicate images of {$this->title}..\n\n", PECHO_NORMAL);
         while (1) {
             if (!is_null($continue)) {
                 $dArray['dfcontinue'] = $continue;
             }
             $dRes = $this->wiki->apiQuery($dArray);
             foreach ($dRes['query']['pages'] as $x) {
                 if (isset($x['duplicatefiles'])) {
                     foreach ($x['duplicatefiles'] as $y) {
                         $this->duplicates[] = $y['name'];
                     }
                 }
             }
             if (isset($dRes['query-continue'])) {
                 foreach ($dRes['query-continue'] as $z) {
                     $continue = $z['dfcontinue'];
                 }
             } else {
                 break;
             }
         }
     }
     return $this->duplicates;
 }
开发者ID:emijrp,项目名称:Peachy,代码行数:39,代码来源:Image.php

示例2: history

 /**
  * Returns page history. Can be specified to return content as well
  *
  * @param int $count Revisions to return (default: 1)
  * @param string $dir Direction to return revisions (default: "older")
  * @param bool $content Should content of that revision be returned as well (default: false)
  * @param int $revid Revision ID to start from (default: null)
  * @param bool $rollback_token Should a rollback token be returned (default: false)
  * @param bool $recurse Used internally to provide more results than can be returned with a single API query
  * @return array Revision data
  */
 public function history($count = 1, $dir = "older", $content = false, $revid = null, $rollback_token = false, $recurse = false)
 {
     if (!$this->exists) {
         return array();
     }
     $historyArray = array('action' => 'query', 'prop' => 'revisions', 'titles' => $this->title, 'rvprop' => 'timestamp|ids|user|comment', 'rawcontinue' => 1, 'rvdir' => $dir);
     if ($content) {
         $historyArray['rvprop'] .= "|content";
     }
     if (!is_null($revid)) {
         $historyArray['rvstartid'] = $revid;
     }
     if (!is_null($count)) {
         $historyArray['rvlimit'] = $count;
     }
     if ($rollback_token) {
         $historyArray['rvtoken'] = 'rollback';
     }
     if (!$recurse) {
         pecho("Getting page history for {$this->title}..\n\n", PECHO_NORMAL);
     }
     if (is_null($count)) {
         $history = $ei = $this->history($this->wiki->get_api_limit() + 1, $dir, $content, $revid, $rollback_token, true);
         while (!is_null($ei[1])) {
             $ei = $this->history($this->wiki->get_api_limit() + 1, $dir, $content, $ei[1], $rollback_token, true);
             foreach ($ei[0] as $eg) {
                 $history[0][] = $eg;
             }
         }
         return $history[0];
     }
     $historyResult = $this->wiki->apiQuery($historyArray);
     if ($recurse) {
         if (isset($historyResult['query-continue'])) {
             return array($historyResult['query']['pages'][$this->pageid]['revisions'], $historyResult['query-continue']['revisions']['rvcontinue']);
         }
         return array($historyResult['query']['pages'][$this->pageid]['revisions'], null);
     }
     return $historyResult['query']['pages'][$this->pageid]['revisions'];
 }
开发者ID:emijrp,项目名称:Peachy,代码行数:51,代码来源:Page.php


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