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


PHP DifferenceEngine::showDiffPage方法代码示例

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


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

示例1: writeBunchPatrolTableContent

 public function writeBunchPatrolTableContent(&$dbr, $target, $readOnly)
 {
     global $wgOut, $wgUser;
     $wgOut->addHTML("<table width='100%' align='center' class='bunchtable'><tr>");
     if (!$readOnly) {
         $wgOut->addHTML("<td><b>Patrol?</b></td>");
     }
     $wgOut->addHTML("<td align='center'><b>Diff</b></td></tr>");
     $opts = array('rc_user_text' => $target, 'rc_patrolled=0');
     $opts[] = ' (rc_namespace = 2 OR rc_namespace = 3) ';
     $res = $dbr->select('recentchanges', array('rc_id', 'rc_title', 'rc_namespace', 'rc_this_oldid', 'rc_cur_id', 'rc_last_oldid'), $opts, "wfSpecialBunchpatrol", array('LIMIT' => 15));
     $count = 0;
     while (($row = $dbr->fetchObject($res)) != null) {
         $t = Title::makeTitle($row->rc_namespace, $row->rc_title);
         $diff = $row->rc_this_oldid;
         $rcid = $row->rc_id;
         $oldid = $row->rc_last_oldid;
         $de = new DifferenceEngine($t, $oldid, $diff, $rcid);
         $wgOut->addHTML("<tr>");
         if (!$readOnly) {
             $wgOut->addHTML("<td valign='middle' style='padding-right:24px; border-right: 1px solid #eee;'><input type='checkbox' name='rc_{$rcid}'></td>");
         }
         $wgOut->addHTML("<td style='border-top: 1px solid #eee;'>");
         $wgOut->addHTML($wgUser->getSkin()->makeLinkObj($t));
         $de->showDiffPage(true);
         $wgOut->addHTML("</td></tr>");
         $count++;
     }
     $dbr->freeResult($res);
     $wgOut->addHTML("</table><br/><br/>");
     return $count;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:32,代码来源:Bunchpatrol.body.php

示例2: showDiff

 public static function showDiff($data, HTMLForm $form)
 {
     $rev1 = self::revOrTitle($data['Revision1'], $data['Page1']);
     $rev2 = self::revOrTitle($data['Revision2'], $data['Page2']);
     if ($rev1 && $rev2) {
         $de = new DifferenceEngine($form->getContext(), $rev1, $rev2, null, $data['Action'] == 'purge', $data['Unhide'] == '1');
         $de->showDiffPage(true);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:9,代码来源:SpecialComparePages.php

示例3: showDiff

 public static function showDiff($data)
 {
     $rev1 = self::revOrTitle($data['Revision1'], $data['Page1']);
     $rev2 = self::revOrTitle($data['Revision2'], $data['Page2']);
     if ($rev1 && $rev2) {
         $de = new DifferenceEngine(null, $rev1, $rev2, null, $data["Action"] == 'purge', false);
         $de->showDiffPage(true);
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:9,代码来源:SpecialComparePages.php

示例4: writeDiff

 public function writeDiff(&$dbr, $target)
 {
     global $wgOut, $wgUser;
     $wgOut->addHTML("<table width='100%' align='center' class='bunchtable'><tr>");
     $opts = array('rc_user_text' => $target);
     $opts[] = ' (rc_namespace = 0) ';
     $res = $dbr->select('recentchanges', array('rc_id', 'rc_title', 'rc_namespace', 'rc_this_oldid', 'rc_cur_id', 'rc_last_oldid'), $opts, __METHOD__, array('LIMIT' => 15));
     $count = 0;
     foreach ($res as $row) {
         $t = Title::makeTitle($row->rc_namespace, $row->rc_title);
         $diff = $row->rc_this_oldid;
         $rcid = $row->rc_id;
         $oldid = $row->rc_last_oldid;
         $de = new DifferenceEngine($t, $oldid, $diff, $rcid);
         $wgOut->addHTML("<tr>");
         $wgOut->addHTML("<td>");
         $wgOut->addHTML($wgUser->getSkin()->makeLinkObj($t));
         $de->showDiffPage(true);
         $wgOut->addHTML("</td></tr>");
         $count++;
     }
     $dbr->freeResult($res);
     $wgOut->addHTML("</table><br/><br/>");
     return $count;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:25,代码来源:WelcomeWagon.body.php

示例5: showDiffPage

 /**
  * Show a diff page according to current request variables. For use within
  * Article::view() only, other callers should use the DifferenceEngine class.
  */
 public function showDiffPage()
 {
     global $wgRequest, $wgUser;
     $diff = $wgRequest->getVal('diff');
     $rcid = $wgRequest->getVal('rcid');
     $diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
     $purge = $wgRequest->getVal('action') == 'purge';
     $unhide = $wgRequest->getInt('unhide') == 1;
     $oldid = $this->getOldID();
     $de = new DifferenceEngine($this->mTitle, $oldid, $diff, $rcid, $purge, $unhide);
     // DifferenceEngine directly fetched the revision:
     $this->mRevIdFetched = $de->mNewid;
     $de->showDiffPage($diffOnly);
     // Needed to get the page's current revision
     $this->loadPageData();
     if ($diff == 0 || $diff == $this->mLatest) {
         # Run view updates for current revision only
         $this->viewUpdates();
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:24,代码来源:Article.php

示例6: view

 /**
  * This is the default action of the script: just view the page of
  * the given title.
  */
 function view()
 {
     global $wgUser, $wgOut, $wgRequest, $wgContLang;
     global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser;
     global $wgUseTrackbacks, $wgNamespaceRobotPolicies;
     $sk = $wgUser->getSkin();
     wfProfileIn(__METHOD__);
     $parserCache =& ParserCache::singleton();
     $ns = $this->mTitle->getNamespace();
     # shortcut
     # Get variables from query string
     $oldid = $this->getOldID();
     # getOldID may want us to redirect somewhere else
     if ($this->mRedirectUrl) {
         $wgOut->redirect($this->mRedirectUrl);
         wfProfileOut(__METHOD__);
         return;
     }
     $diff = $wgRequest->getVal('diff');
     $rcid = $wgRequest->getVal('rcid');
     $rdfrom = $wgRequest->getVal('rdfrom');
     $wgOut->setArticleFlag(true);
     if (isset($wgNamespaceRobotPolicies[$ns])) {
         $policy = $wgNamespaceRobotPolicies[$ns];
     } else {
         # The default policy. Dev note: make sure you change the documentation
         # in DefaultSettings.php before changing it.
         $policy = 'index,follow';
     }
     $wgOut->setRobotpolicy($policy);
     # If we got diff and oldid in the query, we want to see a
     # diff page instead of the article.
     if (!is_null($diff)) {
         $wgOut->setPageTitle($this->mTitle->getPrefixedText());
         $de = new DifferenceEngine($this->mTitle, $oldid, $diff, $rcid);
         // DifferenceEngine directly fetched the revision:
         $this->mRevIdFetched = $de->mNewid;
         $de->showDiffPage();
         // Needed to get the page's current revision
         $this->loadPageData();
         if ($diff == 0 || $diff == $this->mLatest) {
             # Run view updates for current revision only
             $this->viewUpdates();
         }
         wfProfileOut(__METHOD__);
         return;
     }
     if (empty($oldid) && $this->checkTouched()) {
         $wgOut->setETag($parserCache->getETag($this, $wgUser));
         if ($wgOut->checkLastModified($this->mTouched)) {
             wfProfileOut(__METHOD__);
             return;
         } else {
             if ($this->tryFileCache()) {
                 # tell wgOut that output is taken care of
                 $wgOut->disable();
                 $this->viewUpdates();
                 wfProfileOut(__METHOD__);
                 return;
             }
         }
     }
     # Should the parser cache be used?
     $pcache = $wgEnableParserCache && intval($wgUser->getOption('stubthreshold')) == 0 && $this->exists() && empty($oldid);
     wfDebug('Article::view using parser cache: ' . ($pcache ? 'yes' : 'no') . "\n");
     if ($wgUser->getOption('stubthreshold')) {
         wfIncrStats('pcache_miss_stub');
     }
     $wasRedirected = false;
     if (isset($this->mRedirectedFrom)) {
         // This is an internally redirected page view.
         // We'll need a backlink to the source page for navigation.
         if (wfRunHooks('ArticleViewRedirect', array(&$this))) {
             $sk = $wgUser->getSkin();
             $redir = $sk->makeKnownLinkObj($this->mRedirectedFrom, '', 'redirect=no');
             $s = wfMsg('redirectedfrom', $redir);
             $wgOut->setSubtitle($s);
             // Set the fragment if one was specified in the redirect
             if (strval($this->mTitle->getFragment()) != '') {
                 $fragment = Xml::escapeJsString($this->mTitle->getFragmentForURL());
                 $wgOut->addInlineScript("redirectToFragment(\"{$fragment}\");");
             }
             $wasRedirected = true;
         }
     } elseif (!empty($rdfrom)) {
         // This is an externally redirected view, from some other wiki.
         // If it was reported from a trusted site, supply a backlink.
         global $wgRedirectSources;
         if ($wgRedirectSources && preg_match($wgRedirectSources, $rdfrom)) {
             $sk = $wgUser->getSkin();
             $redir = $sk->makeExternalLink($rdfrom, $rdfrom);
             $s = wfMsg('redirectedfrom', $redir);
             $wgOut->setSubtitle($s);
             $wasRedirected = true;
         }
     }
//.........这里部分代码省略.........
开发者ID:negabaro,项目名称:alfresco,代码行数:101,代码来源:Article.php

示例7: execute

 /**
  * Show a form for filtering namespace and username
  *
  * @param $par String
  * @return String
  */
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $this->setup($par);
     // Settings
     $this->form();
     if ($this->opts->getValue('rev1') && $this->opts->getValue('rev2')) {
         $de = new DifferenceEngine(null, $this->opts->getValue('rev1'), $this->opts->getValue('rev2'), null, $this->opts->getValue('action') == 'purge', false);
         $de->showDiffPage(true);
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:18,代码来源:SpecialComparePages.php

示例8: execute

 function execute($par)
 {
     global $wgRequest, $wgOut;
     $t = Title::newFromText($wgRequest->getVal('target'));
     $wgOut->setArticleBodyOnly(true);
     if ($wgRequest->getVal('action') == 'permalink') {
         $result = array();
         $result['title'] = $t;
         $result['rchi'] = $wgRequest->getVal('rchi');
         $result['rclo'] = $wgRequest->getVal('rclow');
         $result['rcid'] = $wgRequest->getVal('rcid');
         $result['old'] = $wgRequest->getVal('old');
         $result['new'] = $wgRequest->getVal('new');
         $result['vandal'] = $wgRequest->getVal('vandal');
         $result['rc_cur_id'] = $t->getArticleID();
         $result = RCPatrolData::getListofEditors($result);
         $wgOut->addHTML("<div id='articletitle' style='display:none;'><a href='{$t->getLocalURL()}'>{$t->getFullText()}</a></div>");
         $oldTitle = $this->getContext()->getTitle();
         $this->getContext()->setTitle($result['title']);
         $d = new DifferenceEngine($this->getContext(), RCPatrol::cleanOldId($wgRequest->getVal('old')), $wgRequest->getVal('new'), $wgRequest->getVal('rcid'));
         $d->loadRevisionData();
         $this->getContext()->setTitle($oldTitle);
         $wgOut->addHTML("<div id='rc_header' class='tool_header'>");
         $wgOut->addHTML('<a href="#" id="rcpatrol_keys">Get Shortcuts</a>');
         $wgOut->addHTML(RCPatrol::getButtons($result, $d->mNewRev));
         $wgOut->addHTML("</div>");
         $wgOut->addHTML('<div id="rcpatrol_info" style="display:none;">' . wfMessage('rcpatrol_keys')->text() . '</div>');
         $d->showDiffPage();
         $wgOut->disable();
         $response['html'] = $wgOut->getHTML();
         print_r(json_encode($response));
         return;
     }
     $a = new Article($t);
     if (!$wgRequest->getVal('grabnext')) {
         if (class_exists('RCTest') && RCTest::isEnabled() && $wgRequest->getVal('rctest')) {
             // Don't do anything if it's a test
         } elseif (!$wgRequest->getVal('skip') && $wgRequest->getVal('action') == 'markpatrolled') {
             $this->markRevisionsPatrolled($a);
         } elseif ($wgRequest->getVal('skip')) {
             // skip the article for now
             RCPatrol::skipArticle($t->getArticleID());
         }
     }
     $wgOut->clearHTML();
     $wgOut->redirect('');
     $result = RCPatrol::getNextArticleToPatrol($wgRequest->getVal('rcid'));
     $response = array();
     if ($result) {
         $rcTest = null;
         $testHtml = "";
         if (class_exists('RCTest') && RCTest::isEnabled()) {
             $rcTest = new RCTest();
             $testHtml = $rcTest->getTestHtml();
             /* Uncomment to debug rctest
             			$response['testtime'] = $rcTest->isTestTime() ? 1 : 0;
             			$response['totpatrol'] = $rcTest->getTotalPatrols();
             			$response['adjpatrol'] = $rcTest->getAdjustedPatrolCount();
             			global $wgCookiePrefix;
             			$response['testcookie'] = $_COOKIE[$wgCookiePrefix . '_rct_a'];
             			*/
         }
         $t = $result['title'];
         $wgOut->addHTML("<div id='bodycontents2'>");
         $titleText = RCTestStub::getTitleText($result, $rcTest);
         $wgOut->addHTML("<div id='articletitle' style='display:none;'>{$titleText}</div>");
         // Initialize the RCTest object. This is use to inject
         // tests into the RC Patrol queue.
         $d = RCTestStub::getDifferenceEngine($this->getContext(), $result, $rcTest);
         $d->loadRevisionData();
         $wgOut->addHTML("<div id='rc_header' class='tool_header'>");
         $wgOut->addHTML('<a href="#" id="rcpatrol_keys">Get Shortcuts</a>');
         $wgOut->addHTML(RCPatrol::getButtons($result, $d->mNewRev, $rcTest));
         $wgOut->addHTML("</div>");
         $wgOut->addHTML('<div id="rcpatrol_info" style="display:none;">' . wfMessage('rcpatrol_keys')->text() . '</div>');
         $d->showDiffPage();
         $wgOut->addHtml($testHtml);
         $wgOut->addHTML("</div>");
         $response['unpatrolled'] = self::getUnpatrolledCount();
     } else {
         $wgOut->addWikiMsg('markedaspatrolledtext');
         $response['unpatrolled'] = self::getUnpatrolledCount();
     }
     $wgOut->disable();
     header('Vary: Cookie');
     $response['html'] = $wgOut->getHTML();
     print_r(json_encode($response));
     return;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:89,代码来源:RCPatrol.body.php

示例9: showDiffPage

 /**
  * Show a diff page according to current request variables. For use within
  * Article::view() only, other callers should use the DifferenceEngine class.
  */
 public function showDiffPage()
 {
     global $wgRequest, $wgUser;
     $diff = $wgRequest->getVal('diff');
     $rcid = $wgRequest->getVal('rcid');
     $diffOnly = $wgRequest->getBool('diffonly', $wgUser->getGlobalPreference('diffonly'));
     $purge = $wgRequest->getVal('action') == 'purge';
     $unhide = $wgRequest->getInt('unhide') == 1;
     $oldid = $this->getOldID();
     $de = new DifferenceEngine($this->getContext(), $oldid, $diff, $rcid, $purge, $unhide);
     // DifferenceEngine directly fetched the revision:
     $this->mRevIdFetched = $de->mNewid;
     $de->showDiffPage($diffOnly);
     if ($diff == 0 || $diff == $this->mPage->getLatest()) {
         # Run view updates for current revision only
         $this->mPage->doViewUpdates($wgUser);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:22,代码来源:Article.php

示例10: view

 /**
  * This is the default action of the script: just view the page of
  * the given title.
  */
 function view()
 {
     global $wgUser, $wgOut, $wgRequest, $wgOnlySysopsCanPatrol, $wgLang;
     global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol;
     global $wgParser, $wgParserCache, $wgUseTrackbacks;
     $sk = $wgUser->getSkin();
     $fname = 'Article::view';
     wfProfileIn($fname);
     # Get variables from query string
     $oldid = $this->getOldID();
     $diff = $wgRequest->getVal('diff');
     $rcid = $wgRequest->getVal('rcid');
     $rdfrom = $wgRequest->getVal('rdfrom');
     $wgOut->setArticleFlag(true);
     $wgOut->setRobotpolicy('index,follow');
     # If we got diff and oldid in the query, we want to see a
     # diff page instead of the article.
     if (!is_null($diff)) {
         require_once 'DifferenceEngine.php';
         $wgOut->setPageTitle($this->mTitle->getPrefixedText());
         $de = new DifferenceEngine($oldid, $diff, $rcid);
         // DifferenceEngine directly fetched the revision:
         $this->mRevIdFetched = $de->mNewid;
         $de->showDiffPage();
         if ($diff == 0) {
             # Run view updates for current revision only
             $this->viewUpdates();
         }
         wfProfileOut($fname);
         return;
     }
     if (empty($oldid) && $this->checkTouched()) {
         $wgOut->setETag($wgParserCache->getETag($this, $wgUser));
         if ($wgOut->checkLastModified($this->mTouched)) {
             wfProfileOut($fname);
             return;
         } else {
             if ($this->tryFileCache()) {
                 # tell wgOut that output is taken care of
                 $wgOut->disable();
                 $this->viewUpdates();
                 wfProfileOut($fname);
                 return;
             }
         }
     }
     # Should the parser cache be used?
     $pcache = $wgEnableParserCache && intval($wgUser->getOption('stubthreshold')) == 0 && $this->exists() && empty($oldid);
     wfDebug('Article::view using parser cache: ' . ($pcache ? 'yes' : 'no') . "\n");
     $outputDone = false;
     if ($pcache) {
         if ($wgOut->tryParserCache($this, $wgUser)) {
             $outputDone = true;
         }
     }
     if (!$outputDone) {
         $text = $this->getContent(false);
         # May change mTitle by following a redirect
         # Another whitelist check in case oldid or redirects are altering the title
         if (!$this->mTitle->userCanRead()) {
             $wgOut->loginToUse();
             $wgOut->output();
             exit;
         }
         # We're looking at an old revision
         if (!empty($oldid)) {
             $this->setOldSubtitle(isset($this->mOldId) ? $this->mOldId : $oldid);
             $wgOut->setRobotpolicy('noindex,follow');
         }
         if ('' != $this->mRedirectedFrom) {
             $sk = $wgUser->getSkin();
             $redir = $sk->makeKnownLink($this->mRedirectedFrom, '', 'redirect=no');
             $s = wfMsg('redirectedfrom', $redir);
             $wgOut->setSubtitle($s);
             # Can't cache redirects
             $pcache = false;
         } elseif (!empty($rdfrom)) {
             global $wgRedirectSources;
             if ($wgRedirectSources && preg_match($wgRedirectSources, $rdfrom)) {
                 $sk = $wgUser->getSkin();
                 $redir = $sk->makeExternalLink($rdfrom, $rdfrom);
                 $s = wfMsg('redirectedfrom', $redir);
                 $wgOut->setSubtitle($s);
             }
         }
         # wrap user css and user js in pre and don't parse
         # XXX: use $this->mTitle->usCssJsSubpage() when php is fixed/ a workaround is found
         if ($this->mTitle->getNamespace() == NS_USER && preg_match('/\\/[\\w]+\\.(css|js)$/', $this->mTitle->getDBkey())) {
             $wgOut->addWikiText(wfMsg('clearyourcache'));
             $wgOut->addHTML('<pre>' . htmlspecialchars($this->mContent) . "\n</pre>");
         } else {
             if ($rt = Title::newFromRedirect($text)) {
                 # Display redirect
                 $imageUrl = $wgStylePath . '/common/images/redirect.png';
                 $targetUrl = $rt->escapeLocalURL();
                 $titleText = htmlspecialchars($rt->getPrefixedText());
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:enotifwiki,代码行数:101,代码来源:Article.php

示例11: view

 /**
  * This is the default action of the script: just view the page of
  * the given title.
  */
 public function view()
 {
     global $wgUser, $wgOut, $wgRequest, $wgContLang;
     global $wgEnableParserCache, $wgStylePath, $wgParser;
     global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies;
     global $wgDefaultRobotPolicy;
     wfProfileIn(__METHOD__);
     # Get variables from query string
     $oldid = $this->getOldID();
     # Try file cache
     if ($oldid === 0 && $this->checkTouched()) {
         global $wgUseETag;
         if ($wgUseETag) {
             $parserCache = ParserCache::singleton();
             $wgOut->setETag($parserCache->getETag($this, $wgUser));
         }
         if ($wgOut->checkLastModified($this->getTouched())) {
             wfProfileOut(__METHOD__);
             return;
         } else {
             if ($this->tryFileCache()) {
                 # tell wgOut that output is taken care of
                 $wgOut->disable();
                 $this->viewUpdates();
                 wfProfileOut(__METHOD__);
                 return;
             }
         }
     }
     $ns = $this->mTitle->getNamespace();
     # shortcut
     $sk = $wgUser->getSkin();
     # getOldID may want us to redirect somewhere else
     if ($this->mRedirectUrl) {
         $wgOut->redirect($this->mRedirectUrl);
         wfProfileOut(__METHOD__);
         return;
     }
     $diff = $wgRequest->getVal('diff');
     $rcid = $wgRequest->getVal('rcid');
     $rdfrom = $wgRequest->getVal('rdfrom');
     $diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
     $purge = $wgRequest->getVal('action') == 'purge';
     $return404 = false;
     $wgOut->setArticleFlag(true);
     # Discourage indexing of printable versions, but encourage following
     if ($wgOut->isPrintable()) {
         $policy = 'noindex,follow';
     } elseif (isset($wgArticleRobotPolicies[$this->mTitle->getPrefixedText()])) {
         $policy = $wgArticleRobotPolicies[$this->mTitle->getPrefixedText()];
     } elseif (isset($wgNamespaceRobotPolicies[$ns])) {
         # Honour customised robot policies for this namespace
         $policy = $wgNamespaceRobotPolicies[$ns];
     } else {
         $policy = $wgDefaultRobotPolicy;
     }
     $wgOut->setRobotPolicy($policy);
     # If we got diff and oldid in the query, we want to see a
     # diff page instead of the article.
     if (!is_null($diff)) {
         $wgOut->setPageTitle($this->mTitle->getPrefixedText());
         $diff = $wgRequest->getVal('diff');
         $htmldiff = $wgRequest->getVal('htmldiff', false);
         $de = new DifferenceEngine($this->mTitle, $oldid, $diff, $rcid, $purge, $htmldiff);
         // DifferenceEngine directly fetched the revision:
         $this->mRevIdFetched = $de->mNewid;
         $de->showDiffPage($diffOnly);
         // Needed to get the page's current revision
         $this->loadPageData();
         if ($diff == 0 || $diff == $this->mLatest) {
             # Run view updates for current revision only
             $this->viewUpdates();
         }
         wfProfileOut(__METHOD__);
         return;
     }
     # Should the parser cache be used?
     $pcache = $this->useParserCache($oldid);
     wfDebug('Article::view using parser cache: ' . ($pcache ? 'yes' : 'no') . "\n");
     if ($wgUser->getOption('stubthreshold')) {
         wfIncrStats('pcache_miss_stub');
     }
     $wasRedirected = false;
     if (isset($this->mRedirectedFrom)) {
         // This is an internally redirected page view.
         // We'll need a backlink to the source page for navigation.
         if (wfRunHooks('ArticleViewRedirect', array(&$this))) {
             $redir = $sk->makeKnownLinkObj($this->mRedirectedFrom, '', 'redirect=no');
             $s = wfMsgExt('redirectedfrom', array('parseinline', 'replaceafter'), $redir);
             $wgOut->setSubtitle($s);
             // Set the fragment if one was specified in the redirect
             if (strval($this->mTitle->getFragment()) != '') {
                 $fragment = Xml::escapeJsString($this->mTitle->getFragmentForURL());
                 $wgOut->addInlineScript("redirectToFragment(\"{$fragment}\");");
             }
             $wasRedirected = true;
//.........这里部分代码省略.........
开发者ID:amjadtbssm,项目名称:website,代码行数:101,代码来源:Article.php

示例12: getNextToPatrolHTML

 function getNextToPatrolHTML()
 {
     global $wgOut;
     if (!$this->mResult) {
         // nothing to patrol
         return null;
     }
     // construct the HTML to reply
     // load the page
     $t = $this->mTitle;
     // Title::newFromID($this->mResult->qc_page);
     if (!$t) {
         $this->deleteBad($this->mResult->qc_page);
         return "<!--{$this->mResult->qc_page}-->error creating title, oops, please <a href='#' onclick='window.location.reload()'>refresh</a>";
     }
     // get current revsion
     $r = Revision::newFromTitle($t);
     if (!$r) {
         return "Error creating revision";
     }
     $d = new DifferenceEngine($t, $this->mResult->qc_old_rev_id, $this->mResult->qc_rev_id);
     $d->loadRevisionData();
     // interesting
     $html = "";
     $changedby = self::getChangedBy("Edits patrolled by: ");
     $wgOut->clearHTML();
     $d->showDiffPage(true);
     $html = "<div id='qc_box'>" . $changedby . $html . $wgOut->getHTML() . "</div>";
     $wgOut->clearHTML();
     $html .= "<div id='quickeditlink'></div>";
     $popts = $wgOut->parserOptions();
     $popts->setTidy(true);
     $html .= WikihowArticleHTML::processArticleHTML($wgOut->parse($r->getText(), $t, $popts), array('no-ads' => 1, 'ns' => $t->getNamespace()));
     $html .= "<input type='hidden' name='qc_id' value='{$this->mResult->qc_id}'/>";
     $html .= "<div id='numqcusers'>{$this->mUsers}</div>";
     return $html;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:37,代码来源:QC.body.php

示例13: view

 /**
  * This is the default action of the script: just view the page of
  * the given title.
  */
 function view()
 {
     global $wgUser, $wgOut, $wgRequest, $wgContLang;
     global $wgEnableParserCache, $wgStylePath, $wgParser;
     global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies;
     global $wgDefaultRobotPolicy;
     $sk = $wgUser->getSkin();
     wfProfileIn(__METHOD__);
     $parserCache =& ParserCache::singleton();
     $ns = $this->mTitle->getNamespace();
     # shortcut
     # Get variables from query string
     $oldid = $this->getOldID();
     # getOldID may want us to redirect somewhere else
     if ($this->mRedirectUrl) {
         $wgOut->redirect($this->mRedirectUrl);
         wfProfileOut(__METHOD__);
         return;
     }
     $diff = $wgRequest->getVal('diff');
     $rcid = $wgRequest->getVal('rcid');
     $rdfrom = $wgRequest->getVal('rdfrom');
     $diffOnly = $wgRequest->getBool('diffonly', $wgUser->getOption('diffonly'));
     $purge = $wgRequest->getVal('action') == 'purge';
     $wgOut->setArticleFlag(true);
     # Discourage indexing of printable versions, but encourage following
     if ($wgOut->isPrintable()) {
         $policy = 'noindex,follow';
     } elseif (isset($wgArticleRobotPolicies[$this->mTitle->getPrefixedText()])) {
         $policy = $wgArticleRobotPolicies[$this->mTitle->getPrefixedText()];
     } elseif (isset($wgNamespaceRobotPolicies[$ns])) {
         # Honour customised robot policies for this namespace
         $policy = $wgNamespaceRobotPolicies[$ns];
     } else {
         $policy = $wgDefaultRobotPolicy;
     }
     // XXX: take out user talk pages and user profile box pages
     if ($this->mTitle->getNamespace() == NS_USER_TALK || $this->mTitle->getNamespace() == NS_USER && preg_match("@profilebox@", $this->mTitle->getText())) {
         $policy = "noindex,follow";
     }
     $wgOut->setRobotPolicy($policy);
     # If we got diff and oldid in the query, we want to see a
     # diff page instead of the article.
     if (!is_null($diff)) {
         $wgOut->setPageTitle($this->mTitle->getPrefixedText());
         $de = new DifferenceEngine($this->mTitle, $oldid, $diff, $rcid, $purge);
         // DifferenceEngine directly fetched the revision:
         $this->mRevIdFetched = $de->mNewid;
         $de->showDiffPage($diffOnly);
         // Needed to get the page's current revision
         $this->loadPageData();
         if ($diff == 0 || $diff == $this->mLatest) {
             # Run view updates for current revision only
             $this->viewUpdates();
         }
         wfProfileOut(__METHOD__);
         return;
     }
     if (empty($oldid) && $this->checkTouched()) {
         $wgOut->setETag($parserCache->getETag($this, $wgUser));
         if ($wgOut->checkLastModified($this->mTouched)) {
             wfProfileOut(__METHOD__);
             return;
         } else {
             if ($this->tryFileCache()) {
                 # tell wgOut that output is taken care of
                 $wgOut->disable();
                 $this->viewUpdates();
                 wfProfileOut(__METHOD__);
                 return;
             }
         }
     }
     # Should the parser cache be used?
     $pcache = $wgEnableParserCache && intval($wgUser->getOption('stubthreshold')) == 0 && $this->exists() && empty($oldid) && !$this->mTitle->isCssOrJsPage() && !$this->mTitle->isCssJsSubpage();
     wfDebug('Article::view using parser cache: ' . ($pcache ? 'yes' : 'no') . "\n");
     if ($wgUser->getOption('stubthreshold')) {
         wfIncrStats('pcache_miss_stub');
     }
     $wasRedirected = false;
     if (isset($this->mRedirectedFrom)) {
         // This is an internally redirected page view.
         // We'll need a backlink to the source page for navigation.
         if (wfRunHooks('ArticleViewRedirect', array(&$this))) {
             $sk = $wgUser->getSkin();
             $redir = $sk->makeKnownLinkObj($this->mRedirectedFrom, '', 'redirect=no');
             $s = wfMsg('redirectedfrom', $redir);
             $wgOut->setSubtitle($s);
             // Set the fragment if one was specified in the redirect
             if (strval($this->mTitle->getFragment()) != '') {
                 $fragment = Xml::escapeJsString($this->mTitle->getFragmentForURL());
                 $wgOut->addInlineScript("redirectToFragment(\"{$fragment}\");");
             }
             $wasRedirected = true;
         }
     } elseif (!empty($rdfrom)) {
//.........这里部分代码省略.........
开发者ID:ErdemA,项目名称:wikihow,代码行数:101,代码来源:Article.php


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