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


PHP Title::newFromId方法代碼示例

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


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

示例1: importArticles

 public function importArticles($filePath)
 {
     $row = 0;
     $tagMap = ConciergeTag::getTagMap();
     $newTags = array();
     if (($handle = fopen(&$filePath, "r")) !== FALSE) {
         while (($data = fgetcsv($handle, 10000000, "\t", '"')) !== FALSE) {
             if ($row != 0) {
                 list($pageId, $url, $userUrl, $tags, $completed) = $data;
                 $t = Title::newFromId($pageId);
                 if ($t && $t->exists()) {
                     $tags = explode(",", $tags);
                     foreach ($tags as $k => $tag) {
                         $tags[$k] = trim($tag);
                     }
                     $datum = array('t' => $t, 'userUrl' => $userUrl, 'tags' => $tags, 'completed' => $completed);
                     $newData[] = $datum;
                     $newTags = array_unique(array_merge($newTags, $this->getNewTags($tagMap, $tags)));
                 } else {
                     $this->debug("ERROR - No article found for: {$url}");
                 }
             }
             $row++;
         }
     }
     $this->addTags($newTags);
     $this->addArticles($newData);
     $this->addArticleTags($newData);
 }
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:29,代碼來源:conciergeImporter.php

示例2: logRestore

 function logRestore($itemId, $low, $hi, $reason, $count)
 {
     $title = Title::newFromId($itemId);
     $params = array($itemId, $low, $hi);
     $log = new LogPage('accuracy', true);
     $log->addEntry($this->logType, $title, wfMsg('clearratings_logrestore', $reason, $title->getFullText(), $count), $params);
 }
開發者ID:ErdemA,項目名稱:wikihow,代碼行數:7,代碼來源:RatingArticle.php

示例3: execute

 public function execute()
 {
     $this->println('Adding missing file links for attachments.');
     try {
         $dbr = \wfGetDB(DB_SLAVE);
         $res = $dbr->select('page_attachment_data', '*');
         if (!$res->numRows()) {
             $this->println('No attachments found.  No links added.');
             break;
         } else {
             foreach ($res as $row) {
                 $linkFromPageId = $row->attached_to_page_id;
                 $linkToFileId = $row->attachment_page_id;
                 $linkToFileTitle = \Title::newFromId($linkToFileId);
                 $linkToFileDatabaseKey = $linkToFileTitle->getDBkey();
                 if (!$this->isLinkExist($linkFromPageId, $linkToFileDatabaseKey)) {
                     $linkFromPageTitle = \Title::newFromId($linkFromPageId);
                     $linkToFileName = $linkToFileTitle->getText();
                     $this->println('Adding missing link from page [' . $linkFromPageTitle . '] to attachment file [' . $linkToFileName . ']');
                     $linkToFileWikiPage = \WikiPage::factory($linkToFileTitle);
                     $linkToFileWikiPage->doPurge();
                     $this->addLink($linkFromPageId, $linkToFileDatabaseKey);
                 }
             }
             $this->println('Finished adding file links.');
         }
     } catch (Exception $e) {
         $this->println('Failed to add file links.  Error: [' . $e->getMessage() . ']');
     }
 }
開發者ID:mediawiki-extensions,項目名稱:mediawiki-page-attachment,代碼行數:30,代碼來源:AddMissingFileLinks.php

示例4: getCategoriesWithPSDefined

	public static function getCategoriesWithPSDefined(){
		$cat_titles = array();
		$dbr = wfGetDB( DB_SLAVE );
		//get the result set, query : select page_props
		$res = $dbr->select( 'page_props',
			array(
				'pp_page',
				'pp_propname',
				'pp_value'
			),
			array(
				'pp_propname' => 'PageSchema'
			)
		);
		while ( $row = $dbr->fetchRow( $res ) ) {
			if( $row[2] != null ){
				$page_id_cat = $row[0];
				if( Title::newFromId($page_id_cat)->getNamespace() == NS_CATEGORY){
					$cat_text = Title::newFromId($page_id_cat)->getText();
					$cat_titles[] = $cat_text;
				}
			}
		}
		$dbr->freeResult( $res );
		return $cat_titles;
	}
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:26,代碼來源:PageSchemas.classes.php

示例5: execute

 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute($par)
 {
     global $wgUser, $wgOut, $wgRequest;
     // Check permissions
     if (!Link::canAdmin()) {
         $this->displayRestrictionError();
         return;
     }
     // Is the database locked or not?
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return false;
     }
     // No access for blocked users
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage(false);
         return false;
     }
     // Add CSS & JS
     $wgOut->addModules('ext.linkFilter');
     if ($wgRequest->wasPosted() && $_SESSION['alreadysubmitted'] == false) {
         $_SESSION['alreadysubmitted'] = true;
         // Update link
         $dbw = wfGetDB(DB_MASTER);
         $dbw->update('link', array('link_url' => $_POST['lf_URL'], 'link_description' => $_POST['lf_desc'], 'link_type' => intval($_POST['lf_type'])), array('link_page_id' => $wgRequest->getInt('id')), __METHOD__);
         $title = Title::newFromId($wgRequest->getInt('id'));
         $wgOut->redirect($title->getFullURL());
     } else {
         $wgOut->addHTML($this->displayEditForm());
     }
 }
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:36,代碼來源:SpecialLinkEdit.php

示例6: getItems

 /**
  * Our query is on the whole revision table not just recent changes
  */
 private function getItems()
 {
     global $wgBlikiDefaultCat;
     $dbr = wfGetDB(DB_SLAVE);
     // Make the query condition and options
     $opts = array('ORDER BY' => 'rev_timestamp DESC');
     $cat = $this->params['q'] ?: $wgBlikiDefaultCat;
     $cat = Title::newFromText($cat, NS_CATEGORY)->getDBkey();
     $cond = array('page_id = rev_page', 'rev_deleted = 0', 'rev_parent_id = 0', 'cl_from = page_id', 'cl_to' => $cat);
     // Update the query condition and opts with the API params
     if ($this->params['from']) {
         $cond[] = 'rev_timestamp > ' . intval($this->params['from']);
     } elseif ($this->params['days']) {
         $cond[] = 'rev_timestamp > ' . $dbr->timestamp(time() - intval($this->params['days'] * 86400));
     }
     if ($this->params['limit']) {
         $opts['LIMIT'] = intval($this->params['limit']);
     }
     // Do the query
     $res = $dbr->select(array('page', 'revision', 'categorylinks'), 'page_id,rev_timestamp,rev_user_text', $cond, __METHOD__, $opts);
     // Build a list of feed items from the resulting article list
     $items = array();
     foreach ($res as $row) {
         $title = Title::newFromId($row->page_id);
         $items[] = new FeedItem($title->getPrefixedText(), $this->desc($title), $title->getFullUrl(), $row->rev_timestamp, $row->rev_user_text, '');
     }
     return $items;
 }
開發者ID:saper,項目名稱:organic-extensions,代碼行數:31,代碼來源:BlikiFeed.api.php

示例7: newFromId

 /**
  * @param $id
  * @param int $flags
  *
  * @return null|Wall
  */
 public static function newFromId($id, $flags = 0)
 {
     $title = Title::newFromId($id, $flags);
     if (empty($title)) {
         return null;
     }
     return self::newFromTitle($title);
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:14,代碼來源:Wall.class.php

示例8: executeGetData

 function executeGetData($articles)
 {
     foreach ($articles as $value) {
         $title = Title::newFromId($value);
         if (!empty($title) && ($img = wfFindFile($title))) {
             $this->addImagesList($title->getText(), $value, 1);
             $this->addToFiltredList($title->getText(), 1, $img->getWidth(), $img->getHeight(), $img->getMimeType());
         }
     }
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:10,代碼來源:ImageServingDriverFileNS.class.php

示例9: loadFromDb

 function loadFromDb($articleIds)
 {
     foreach ($articleIds as $articleId) {
         $title = Title::newFromId($articleId);
         if (!empty($title) && ($img = wfFindFile($title))) {
             $this->addImage($title->getText(), $articleId, 1);
             $this->addImageDetails($title->getText(), 1, $img->getWidth(), $img->getHeight(), $img->getMimeType());
         }
     }
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:10,代碼來源:ImageServingDriverFileNS.class.php

示例10: formatResult

 function formatResult($skin, $result)
 {
     global $wgContLang;
     $title = Title::newFromId($result->value);
     $dp = Title::makeTitle($result->namespace, $result->title);
     $from = $skin->makeKnownLinkObj($title, '');
     $edit = $skin->makeBrokenLinkObj($title, "(" . wfMsg("qbedit") . ")", 'redirect=no');
     $to = $skin->makeKnownLinkObj($dp, '');
     return "{$from} {$edit} => {$to}";
 }
開發者ID:BackupTheBerlios,項目名稱:openzaurus-svn,代碼行數:10,代碼來源:SpecialDisambiguations.php

示例11: formatResult

 function formatResult($skin, $result)
 {
     global $wgContLang;
     $title = Title::newFromId($result->value);
     $dp = Title::makeTitle($result->namespace, $result->title);
     $from = $skin->makeKnownLinkObj($title, '');
     $edit = $skin->makeKnownLinkObj($title, "(" . wfMsgHtml("qbedit") . ")", 'redirect=no&action=edit');
     $arr = $wgContLang->getArrow();
     $to = $skin->makeKnownLinkObj($dp, '');
     return "{$from} {$edit} {$arr} {$to}";
 }
開發者ID:BackupTheBerlios,項目名稱:shoutwiki-svn,代碼行數:11,代碼來源:SpecialDisambiguations.php

示例12: printVideo

function printVideo($vidId, &$vidTitle, &$t)
{
    $dbr = wfGetDB(DB_SLAVE);
    $res = $dbr->select('templatelinks', array('tl_from'), array('tl_namespace' => NS_VIDEO, 'tl_title' => $t->getDBKey()), __METHOD__, array('LIMIT 1'));
    if ($row = $dbr->fetchObject($res)) {
        $nt = Title::newFromId($row->tl_from);
        if ($nt && $nt->exists()) {
            $day30 = Pagestats::get30day($row->tl_from, $dbr);
            echo "{$vidId}\t{$vidTitle}\thttp://www.wikihow.com" . $nt->getLocalUrl() . "\t{$day30}\n";
        }
    }
}
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:12,代碼來源:findCuratedVideos.php

示例13: addStatChangeAction

 private function addStatChangeAction($action, $feed, $user)
 {
     if (!$feed instanceof WallNotificationAdminEntity) {
         return false;
     }
     $title = Title::newFromId($feed->data->message_id);
     if (empty($title)) {
         return false;
     }
     $this->internalAdd($feed->data->user_wallowner_id, '', $feed->data->user_removing_id, '', $feed->data->is_reply, $feed->data->message_id, $title->getNamespace(), $feed->data->parent_id, $feed->data->title, $action, $feed->data->reason, null);
     return true;
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:12,代碼來源:WallHistory.class.php

示例14: spellCheckArticles

 public function spellCheckArticles(&$pageIds)
 {
     //$pageIds = array(15985);
     foreach ($pageIds as $pageId) {
         $t = Title::newFromId($pageId);
         if ($t && $t->exists()) {
             $misspellings = $this->spellCheckArticle($t);
             //var_dump($t->getText());
             //var_dump($misspellings);
             $this->updateTables($t, $misspellings);
         }
     }
 }
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:13,代碼來源:articleSpellChecker.php

示例15: addStatChangeAction

 private function addStatChangeAction($action, $feed)
 {
     if (!$feed instanceof WallNotificationAdminEntity) {
         return false;
     }
     $data = $feed->data;
     $title = Title::newFromId($data->message_id);
     if (empty($title)) {
         return false;
     }
     $this->internalAdd($data->parent_page_id, $data->user_removing_id, '', $data->is_reply, $data->message_id, $title->getNamespace(), $data->parent_id, $data->title, $action, $data->reason, null);
     $this->getDB(DB_MASTER)->update('wall_history', array('deleted_or_removed' => $action == WH_DELETE || $action == WH_REMOVE ? 1 : 0), array('comment_id' => $data->message_id), __METHOD__);
     return true;
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:14,代碼來源:WallHistory.class.php


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