當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Article::getContent方法代碼示例

本文整理匯總了PHP中Article::getContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Article::getContent方法的具體用法?PHP Article::getContent怎麽用?PHP Article::getContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Article的用法示例。


在下文中一共展示了Article::getContent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute

 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute($par)
 {
     global $wgOut, $wgUser, $wgRequest;
     // Set page title and other stuff
     $this->setHeaders();
     # Show a message if the database is in read-only mode
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     # If user is blocked, s/he doesn't need to access this page
     if ($wgUser->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     $title = $wgRequest->getVal('wpTitle');
     $category = $wgRequest->getVal('wpCategory');
     if (empty($title) || empty($category)) {
         return;
     }
     $oTitle = Title::newFromText($title);
     if (!is_object($oTitle)) {
         return;
     }
     $oArticle = new Article($oTitle);
     if ($oTitle->exists()) {
         $text = $oArticle->getContent();
     } else {
         $text = self::getCreateplate($category);
     }
     $text .= "\n[[Category:" . $category . ']]';
     $oArticle->doEdit($text, wfMsgForContent('createincategory-comment', $category));
     $wgOut->redirect($oTitle->getFullUrl());
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:38,代碼來源:SpecialCreateInCategory_body.php

示例2: run

 /**
  * Run a dtImport job
  * @return boolean success
  */
 function run()
 {
     wfProfileIn(__METHOD__);
     if (is_null($this->title)) {
         $this->error = "dtImport: Invalid title";
         wfProfileOut(__METHOD__);
         return false;
     }
     $article = new Article($this->title);
     if (!$article) {
         $this->error = 'dtImport: Article not found "' . $this->title->getPrefixedDBkey() . '"';
         wfProfileOut(__METHOD__);
         return false;
     }
     $for_pages_that_exist = $this->params['for_pages_that_exist'];
     if ($for_pages_that_exist == 'skip' && $this->title->exists()) {
         return true;
     }
     // change global $wgUser variable to the one specified by
     // the job only for the extent of this import
     global $wgUser;
     $actual_user = $wgUser;
     $wgUser = User::newFromId($this->params['user_id']);
     $text = $this->params['text'];
     if ($for_pages_that_exist == 'append' && $this->title->exists()) {
         $text = $article->getContent() . "\n" . $text;
     }
     $edit_summary = $this->params['edit_summary'];
     $article->doEdit($text, $edit_summary);
     $wgUser = $actual_user;
     wfProfileOut(__METHOD__);
     return true;
 }
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:37,代碼來源:DT_ImportJob.php

示例3: run

 /**
  * Run a refreshLinks job
  * @return boolean success
  */
 function run()
 {
     global $wgTitle, $wgUser, $wgLang, $wrGedcomExportDirectory;
     $wgTitle = $this->title;
     // FakeTitle (the default) generates errors when accessed, and sometimes I log wgTitle, so set it to something else
     $wgUser = User::newFromName('WeRelate agent');
     // set the user
     $treeId = $this->params['tree_id'];
     $treeName = $this->params['name'];
     $treeUser = $this->params['user'];
     $filename = "{$wrGedcomExportDirectory}/{$treeId}.ged";
     $ge = new GedcomExporter();
     $error = $ge->exportGedcom($treeId, $filename);
     if ($error) {
         $this->error = $error;
         return false;
     }
     // leave a message for the tree requester
     $userTalkTitle = Title::newFromText($treeUser, NS_USER_TALK);
     $article = new Article($userTalkTitle, 0);
     if ($article->getID() != 0) {
         $text = $article->getContent();
     } else {
         $text = '';
     }
     $title = Title::makeTitle(NS_SPECIAL, 'Trees');
     $msg = wfMsg('GedcomExportReady', $wgLang->date(wfTimestampNow(), true, false), $treeName, $title->getFullURL(wfArrayToCGI(array('action' => 'downloadExport', 'user' => $treeUser, 'name' => $treeName))));
     $text .= "\n\n" . $msg;
     $success = $article->doEdit($text, 'GEDCOM export ready');
     if (!$success) {
         $this->error = 'Unable to edit user talk page: ' . $treeUser;
         return false;
     }
     return true;
 }
開發者ID:k-hasan-19,項目名稱:wiki,代碼行數:39,代碼來源:GedcomExportJob.php

示例4: initialize

 protected function initialize()
 {
     global $wgParser;
     $article = new Article($this->mOriginTitle);
     $content = $article->getContent();
     $this->parse($content);
 }
開發者ID:radii,項目名稱:noisecal,代碼行數:7,代碼來源:NoiseEvent.php

示例5: onAddCommentsFormDiv

/**
 * adding the flag table to the comments form
 *
 * @global SFFormPrinter $sfgFormPrinter from SMW
 * @global Article $wgArticle
 * @param String $sHtml
 * @return boolean
 */
function onAddCommentsFormDiv(&$sHtml)
{
    global $sfgFormPrinter, $wgArticle, $webplatformSectionCommentsSMW;
    $sHtml .= '<a id="comments-flag-link">' . wfMessage('comments-flag-link')->text() . '</a>';
    $sHtml .= '<div id="comment-flags">';
    $sFormName = $webplatformSectionCommentsSMW['form'];
    //$sPageName = 'Comments';
    $oTitle = Title::newFromText($sFormName, SF_NS_FORM);
    $oArticle = new Article($oTitle, 0);
    $sFormDefinition = $oArticle->getContent();
    $sFormDefinition = StringUtils::delimiterReplace('<noinclude>', '</noinclude>', '', $sFormDefinition);
    $aHtml = $sfgFormPrinter->formHTML($sFormDefinition, false, true, $oTitle->getArticleID(), $wgArticle->fetchContent());
    //, $wgArticle->getTitle()->getArticleID(), $wgArticle->fetchContent(), $wgArticle->getTitle()->getText(), null );
    $aMatches = array();
    preg_match_all('#<table.*?</table>#is', $aHtml[0], $aMatches);
    $index = null;
    foreach ($aMatches[0] as $key => $value) {
        $bPos = strrpos($value, $webplatformSectionCommentsSMW['template'] . '[');
        if ($bPos !== false) {
            $index = $key;
            break;
        }
    }
    $sHtml .= $aMatches[0][$index];
    $sHtml .= '</div>';
    return true;
}
開發者ID:renoirb,項目名稱:mediawiki-1,代碼行數:35,代碼來源:SectionComments.php

示例6: assertArticle

 public function assertArticle(Article $article, $hash, $title, $author, $publicationDate, $content)
 {
     $this->assertEquals($article->getHash(), $hash);
     $this->assertEquals($article->getTitle(), $title);
     $this->assertEquals($article->getAuthor(), $author);
     $this->assertEquals($article->getPublicationDate(), $publicationDate);
     $this->assertEquals($article->getContent(), $content);
 }
開發者ID:nbrignol,項目名稱:PhpLayeredApplicationFramework,代碼行數:8,代碼來源:ArticleDaoFileSystemTest.php

示例7: getParam

	/**
	 * Fetches the content of a defined MediaWiki message.
	 *
	 * @param $name String: name of the MediaWiki message
	 * @return string or nothing
	 */
	static function getParam( $name ) {
		$nameTitle = Title::newFromText( $name, NS_MEDIAWIKI );
		if ( $nameTitle->exists() ) {
			$article = new Article( $nameTitle );
			return $article->getContent();
		} else {
			return '';
		}
	}
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:15,代碼來源:SpecialPrivateDomains.php

示例8: isArticleAnswered

 public function isArticleAnswered()
 {
     global $wgContLang;
     if (!self::isQuestion()) {
         return false;
     }
     $article = new Article($this->title);
     $content = $article->getContent();
     return self::isContentAnswered($content);
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:10,代碼來源:AnswersClass.php

示例9: getTextById

 function getTextById($id)
 {
     $title = $this->getTitleObject('id', $id);
     if ($title == '') {
         return '';
     }
     $rev = new Article($title, 0);
     $text = $rev->getContent();
     return $text;
 }
開發者ID:mediawiki-extensions,項目名稱:wiki2latex,代碼行數:10,代碼來源:w2lContentCatcher.php

示例10: addArticle

 public function addArticle($month, $day, $year, $page)
 {
     $lines = array();
     $temp = "";
     $head = array();
     $article = new Article(Title::newFromText($page));
     if (!$article->exists()) {
         return "";
     }
     $redirectCount = 0;
     if ($article->isRedirect() && $this->setting('disableredirects')) {
         return '';
     }
     while ($article->isRedirect() && $redirectCount < 10) {
         $redirectedArticleTitle = Title::newFromRedirect($article->getContent());
         $article = new Article($redirectedArticleTitle);
         $redirectCount += 1;
     }
     $body = $article->fetchContent(0, false, false);
     if (strlen(trim($body)) == 0) {
         return "";
     }
     $lines = split("\n", $body);
     $cntLines = count($lines);
     // dont use section events... only line 1 of the page
     if ($this->setting('disablesectionevents')) {
         $key = $lines[0];
         //initalize the key
         $head[$key] = "";
         $cntLines = 0;
     }
     for ($i = 0; $i < $cntLines; $i++) {
         $line = $lines[$i];
         if (substr($line, 0, 2) == '==') {
             $arr = split("==", $line);
             $key = $arr[1];
             $head[$key] = "";
             $temp = "";
         } else {
             if ($i == 0) {
                 // $i=0  means this is a one event page no (==event==) data
                 $key = $line;
                 //initalize the key
                 $head[$key] = "";
             } else {
                 $temp .= "{$line}\n";
                 $head[$key] = Common::cleanWiki($temp);
             }
         }
     }
     while (list($event, $body) = each($head)) {
         $this->buildEvent($month, $day, $year, trim($event), $page, $body);
     }
 }
開發者ID:radii,項目名稱:noisecal,代碼行數:54,代碼來源:CalendarArticles.php

示例11: efCondTemplateLoadPage

function efCondTemplateLoadPage($p)
{
    $title = Title::newFromText($p);
    if ($title->getArticleID() == 0) {
        $text = "<b>[[" . $p . ']]</b>';
    } else {
        $article = new Article($title);
        $text = $article->getContent();
    }
    return $text;
}
開發者ID:clrh,項目名稱:mediawiki,代碼行數:11,代碼來源:ConditionalTemplate.php

示例12: getPageText

 /**
  * Returns the contents of the specified wiki page, at either the
  * specified revision (if there is one) or the latest revision
  * (otherwise).
  */
 public static function getPageText($title, $revisionID = null)
 {
     if (method_exists('Revision', 'getContent')) {
         // MW >= 1.21
         $revision = Revision::newFromTitle($title, $revisionID);
         return $revision->getContent()->getNativeData();
     } else {
         $article = new Article($title, $revisionID);
         return $article->getContent();
     }
 }
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:16,代碼來源:ApprovedRevs_body.php

示例13: setup

 function setup()
 {
     global $wgParser, $wgHooks, $wgLogTypes, $wgLogNames, $wgLogHeaders, $wgLogActions, $wgSecurityExtraActions, $wgSecurityExtraGroups, $wgRestrictionTypes, $wgRestrictionLevels, $wgGroupPermissions, $wgSecurityRenderInfo, $wgSecurityAllowUnreadableLinks, $wgSecurityGroupsArticle;
     # Add our hooks
     $wgHooks['UserGetRights'][] = $this;
     $wgHooks['ImgAuthBeforeStream'][] = $this;
     $wgParser->setFunctionHook('ifusercan', array($this, 'ifUserCan'));
     $wgParser->setFunctionHook('ifgroup', array($this, 'ifGroup'));
     if ($wgSecurityRenderInfo) {
         $wgHooks['OutputPageBeforeHTML'][] = $this;
     }
     if ($wgSecurityAllowUnreadableLinks) {
         $wgHooks['BeforePageDisplay'][] = $this;
     }
     # Add a new log type
     $wgLogTypes[] = 'security';
     $wgLogNames['security'] = 'securitylogpage';
     $wgLogHeaders['security'] = 'securitylogpagetext';
     $wgLogActions['security/deny'] = 'securitylogentry';
     # Each extra action is also a restriction type
     foreach ($wgSecurityExtraActions as $k => $v) {
         $wgRestrictionTypes[] = $k;
     }
     # Add extra available groups if $wgSecurityGroupsArticle is set
     if ($wgSecurityGroupsArticle) {
         $groups = new Article(Title::newFromText($wgSecurityGroupsArticle, NS_MEDIAWIKI));
         if (preg_match_all("/^\\*?\\s*(.+?)\\s*(\\|\\s*(.+))?\$/m", $groups->getContent(), $match)) {
             foreach ($match[1] as $i => $k) {
                 $v = $match[3][$i];
                 if ($v) {
                     $wgSecurityExtraGroups[strtolower($k)] = $v;
                 } else {
                     $wgSecurityExtraGroups[strtolower($k)] = '';
                 }
             }
         }
     }
     # Ensure the new groups show up in rights management
     # - note that 1.13 does a strange check in the ProtectionForm::buildSelector
     #   $wgUser->isAllowed($key) where $key is an item from $wgRestrictionLevels
     #   this requires that we treat the extra groups as an action and make sure its allowed by the user
     foreach ($wgSecurityExtraGroups as $k => $v) {
         if (is_numeric($k)) {
             $k = strtolower($v);
         }
         $wgRestrictionLevels[] = $k;
         $wgGroupPermissions[$k][$k] = true;
         # members of $k must be allowed to perform $k
         $wgGroupPermissions['sysop'][$k] = true;
         # sysops must be allowed to perform $k as well
     }
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:52,代碼來源:SimpleSecurity_body.php

示例14: update

 public function update(Article $article)
 {
     $id = $article->getId();
     $content = mysqli_real_escape_string($article->getContent());
     $id_author = $article->getUser()->getId();
     $query = "UPDATE article SET content='" . $content . "', id_user='" . $id_user . "' WHERE id='" . $id . "'";
     $res = mysqli_query($this->db, $query);
     if ($res) {
         return $this->findById($id);
     } else {
         return "Internal Server Error";
     }
 }
開發者ID:Hollux,項目名稱:Fennec,代碼行數:13,代碼來源:ArticleManager.class.php

示例15: execute

 function execute($par)
 {
     global $wgOut, $wgRequest, $wgParser, $wgTitle, $wgUser;
     $year = isset($_GET['year']) ? $_REQUEST['year'] : null;
     $month = isset($_GET['month']) ? $_REQUEST['month'] : null;
     $day = isset($_GET['day']) ? $_REQUEST['day'] : null;
     if ($year == "") {
         $year = date("Y");
     }
     if ($month == "") {
         $month = date("m");
     }
     # Don't show the navigation if we're including the page
     if (!$this->mIncluding) {
         $this->setHeaders();
         $wgOut->addWikiText(wfMsg('events-header'));
     }
     if ($day == "") {
         $wgOut->AddWikiText('<calendar>upcoming=off</calendar>');
         $day = "__";
     }
     //build the SQL query
     $dbr =& wfGetDB(DB_SLAVE);
     $sPageTable = $dbr->tableName('page');
     $categorylinks = $dbr->tableName('categorylinks');
     $sSqlSelect = "SELECT page_namespace, page_title, page_id, clike1.cl_to catlike1 ";
     $sSqlSelectFrom = "FROM {$sPageTable} INNER JOIN {$categorylinks} AS c1 ON page_id = c1.cl_from AND c1.cl_to='Events' INNER JOIN {$categorylinks} " . "AS clike1 ON page_id = clike1.cl_from AND clike1.cl_to LIKE '{$year}/{$month}/{$day}'";
     $sSqlWhere = ' WHERE page_is_redirect = 0 ';
     $sSqlOrderby = ' ORDER BY catlike1 ASC';
     //DEBUG: output SQL query
     //$wgOut->addHTML('[' . $sSqlSelect . $sSqlSelectFrom . $sSqlWhere . $sSqlOrderby . ']');
     $res = $dbr->query($sSqlSelect . $sSqlSelectFrom . $sSqlWhere . $sSqlOrderby);
     $sk =& $wgUser->getSkin();
     while ($row = $dbr->fetchObject($res)) {
         $title = Title::makeTitle($row->page_namespace, $row->page_title);
         $wgOut->addHTML('<div class="eventsblock">');
         $title_text = $title->getSubpageText();
         $wgOut->addHTML('<b>' . $sk->makeKnownLinkObj($title, $title_text) . '</b><br>');
         $wl_article = new Article($title);
         $wl = $wl_article->getContent();
         $parserOptions = ParserOptions::newFromUser($wgUser);
         $parserOptions->setEditSection(false);
         $parserOptions->setTidy(true);
         $parserOutput = $wgParser->parse($wl, $title, $parserOptions);
         $previewHTML = $parserOutput->getText();
         $wgOut->addHTML($previewHTML);
         $wgOut->addHTML('</div>');
     }
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:49,代碼來源:SpecialEvents.php


注:本文中的Article::getContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。