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


PHP Wiki::get_maxlag方法代码示例

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


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

示例1: move

 /**
  * Moves a page to a new location.
  *
  * @param string $newTitle The new title to which to move the page.
  * @param string $reason A descriptive reason for the move.
  * @param bool $movetalk Whether or not to move any associated talk (discussion) page.
  * @param bool $movesubpages Whether or not to move any subpages.
  * @param bool $noredirect Whether or not to suppress the leaving of a redirect to the new title at the old title.
  * @param string|bool $watch Unconditionally add or remove the page from your watchlist, use preferences or do not change watch. Default: go by user preference.
  * @param bool $nowarnings Ignore any warnings. Default false.
  * @return bool True on success
  */
 public function move($newTitle, $reason = '', $movetalk = true, $movesubpages = true, $noredirect = false, $watch = null, $nowarnings = false)
 {
     global $pgNotag, $pgTag;
     $tokens = $this->wiki->get_tokens();
     if ($tokens['move'] == '+\\') {
         pecho("User has logged out.\n\n", PECHO_FATAL);
         return false;
     } elseif ($tokens['move'] == '') {
         pecho("User is not allowed to move {$this->title}\n\n", PECHO_FATAL);
         return false;
     }
     if (mb_strlen($reason, '8bit') > 255) {
         pecho("Reason is over 255 bytes, the maximum allowed.\n\n", PECHO_FATAL);
         return false;
     }
     try {
         $this->preEditChecks("Move");
     } catch (EditError $e) {
         pecho("Error: {$e}\n\n", PECHO_FATAL);
         return false;
     }
     pecho("Moving {$this->title} to {$newTitle}...\n\n", PECHO_NOTICE);
     $editarray = array('from' => $this->title, 'to' => $newTitle, 'action' => 'move', 'token' => $tokens['move']);
     if (!is_null($watch)) {
         if ($watch) {
             $editarray['watchlist'] = 'watch';
         } elseif (!$watch) {
             $editarray['watchlist'] = 'nochange';
         } elseif (in_array($watch, array('watch', 'unwatch', 'preferences', 'nochange'))) {
             $editarray['watchlist'] = $watch;
         } else {
             pecho("Watch parameter set incorrectly.  Omitting...\n\n", PECHO_WARN);
         }
     }
     if ($nowarnings) {
         $editarray['ignorewarnings'] = 'yes';
     }
     if (!$pgNotag) {
         $reason .= $pgTag;
     }
     if (!empty($reason)) {
         $editarray['reason'] = $reason;
     }
     if ($movetalk) {
         $editarray['movetalk'] = 'yes';
     }
     if ($movesubpages) {
         $editarray['movesubpages'] = 'yes';
     }
     if ($noredirect) {
         $editarray['noredirect'] = 'yes';
     }
     if ($this->wiki->get_maxlag()) {
         $editarray['maxlag'] = $this->wiki->get_maxlag();
     }
     Hooks::runHook('StartMove', array(&$editarray));
     $result = $this->wiki->apiQuery($editarray, true);
     if (isset($result['move'])) {
         if (isset($result['move']['to'])) {
             $this->__construct($this->wiki, null, $this->pageid);
             return true;
         } else {
             pecho("Move error...\n\n" . print_r($result['move'], true) . "\n\n", PECHO_FATAL);
             return false;
         }
     } else {
         pecho("Move error...\n\n" . print_r($result, true), PECHO_FATAL);
         return false;
     }
 }
开发者ID:emijrp,项目名称:Peachy,代码行数:82,代码来源:Page.php


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