本文整理汇总了PHP中Article::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::getTitle方法的具体用法?PHP Article::getTitle怎么用?PHP Article::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::getTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setMetadata
/**
* Register the article's metadata with the SWORD deposit.
*/
function setMetadata()
{
$this->package->setCustodian($this->journal->getSetting('contactName'));
$this->package->setTitle(html_entity_decode($this->article->getTitle($this->journal->getPrimaryLocale()), ENT_QUOTES, 'UTF-8'));
$this->package->setAbstract(html_entity_decode(strip_tags($this->article->getAbstract($this->journal->getPrimaryLocale())), ENT_QUOTES, 'UTF-8'));
$this->package->setType($this->section->getIdentifyType($this->journal->getPrimaryLocale()));
// The article can be published or not. Support either.
if (is_a($this->article, 'PublishedArticle')) {
$doi = $this->article->getPubId('doi');
if ($doi !== null) {
$this->package->setIdentifier($doi);
}
}
foreach ($this->article->getAuthors() as $author) {
$creator = $author->getFullName(true);
$affiliation = $author->getAffiliation($this->journal->getPrimaryLocale());
if (!empty($affiliation)) {
$creator .= "; {$affiliation}";
}
$this->package->addCreator($creator);
}
// The article can be published or not. Support either.
if (is_a($this->article, 'PublishedArticle')) {
$plugin = PluginRegistry::loadPlugin('citationFormats', 'bibtex');
$this->package->setCitation(html_entity_decode(strip_tags($plugin->fetchCitation($this->article, $this->issue, $this->journal)), ENT_QUOTES, 'UTF-8'));
}
}
示例2: create
/**
* Create a new poll
* @param wgRequest question
* @param wgRequest answer (expects PHP array style in the form <input name=answer[]>)
* Page Content should be of a different style so we have to translate
* *question 1\n
* *question 2\n
*/
public static function create()
{
wfProfileIn(__METHOD__);
$app = F::app();
$title = $app->wg->Request->getVal('question');
$answers = $app->wg->Request->getArray('answer');
// array
$title_object = Title::newFromText($title, NS_WIKIA_POLL);
if (is_object($title_object) && $title_object->exists()) {
$res = array('success' => false, 'error' => $app->renderView('Error', 'Index', array(wfMsg('wikiapoll-error-duplicate'))));
} else {
if ($title_object == null) {
$res = array('success' => false, 'error' => $app->renderView('Error', 'Index', array(wfMsg('wikiapoll-error-invalid-title'))));
} else {
$content = "";
foreach ($answers as $answer) {
$content .= "*{$answer}\n";
}
/* @var $article WikiPage */
$article = new Article($title_object, NS_WIKIA_POLL);
$article->doEdit($content, 'Poll Created', EDIT_NEW, false, $app->wg->User);
$title_object = $article->getTitle();
// fixme: check status object
$res = array('success' => true, 'pollId' => $article->getID(), 'url' => $title_object->getLocalUrl(), 'question' => $title_object->getPrefixedText());
}
}
wfProfileOut(__METHOD__);
return $res;
}
示例3: ArticleMessage
/**
* Log article related event.
*
* @param Article $p_article
* @param string $p_text
* @param int $p_userId
* @param int $p_eventId
* @param bool $p_short
*
* @return void
*/
public static function ArticleMessage(Article $p_article, $p_text, $p_userId = NULL, $p_eventId = 0, $p_short = FALSE)
{
ob_start();
$translator = \Zend_Registry::get('container')->getService('translator');
echo $translator->trans('Article'), ': ', $p_article->getTitle();
if (!$p_short) {
// add publication, issue, section
echo ' (';
echo $translator->trans('Publication'), ': ', $p_article->getPublicationId();
echo ', ';
echo $translator->trans('Issue'), ': ', $p_article->getIssueNumber();
echo ', ';
echo $translator->trans('Section'), ': ', $p_article->getSectionNumber();
echo ")\n";
}
// generate url
$url = ShortURL::GetURL($p_article->getPublicationId(), $p_article->getLanguageId(), $p_article->getIssueNumber(), $p_article->getSectionNumber(), $p_article->getArticleNumber());
if (strpos($url, 'http') !== FALSE) {
// no url for deleted
echo $translator->trans('Article URL', array(), 'api'), ': ', $url, "\n";
}
echo $translator->trans('Article Number', array(), 'api'), ': ', $p_article->getArticleNumber(), "\n";
echo $translator->trans('Language'), ': ', $p_article->getLanguageName(), "\n";
echo "\n";
echo $translator->trans('Action') . ': ', $p_text;
$message = ob_get_clean();
self::Message(substr($message, 0, 254), $p_userId, $p_eventId);
}
示例4: create
/**
* Create category.
*
* @param $category String: Name of category to create.
* @param $code String: Code of language that the category is for.
* @param $level String: Level that the category is for.
*/
public static function create($category, $code, $level = null)
{
$category = strip_tags($category);
$title = Title::makeTitleSafe(NS_CATEGORY, $category);
if ($title === null || $title->exists()) {
return;
}
global $wgLanguageCode;
$language = BabelLanguageCodes::getName($code, $wgLanguageCode);
if ($level === null) {
$text = wfMsgForContent('babel-autocreate-text-main', $language, $code);
} else {
$text = wfMsgForContent('babel-autocreate-text-levels', $level, $language, $code);
}
$user = self::user();
# Do not add a message if the username is invalid or if the account that adds it, is blocked
if (!$user || $user->isBlocked()) {
return;
}
$article = new Article($title, 0);
if (!$article->getTitle()->quickUserCan('create', $user)) {
return;
# The Babel AutoCreate account is not allowed to create the page
}
/* $article->doEdit will call $wgParser->parse.
* Calling Parser::parse recursively is baaaadd... (bug 29245)
* @todo FIXME: surely there is a better way?
*/
global $wgParser, $wgParserConf;
$oldParser = $wgParser;
$parserClass = $wgParserConf['class'];
$wgParser = new $parserClass($wgParserConf);
$article->doEdit($text, wfMsgForContent('babel-autocreate-reason', wfMsgForContent('babel-url')), EDIT_FORCE_BOT, false, $user);
$wgParser = $oldParser;
}
示例5: onArticleSaveComplete
/**
* Hook entry when article is change
*
* @param Article $article
*/
public static function onArticleSaveComplete(&$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect)
{
$title = $article->getTitle();
$ce = new CategoryExhibitionSection(null);
$ce->setTouched($title);
return true;
}
示例6: onArticleViewAfterParser
public static function onArticleViewAfterParser(Article $article, ParserOutput $parserOutput)
{
global $wgCityId, $wgDBname;
// we collect production data from Oasis only
/*
$app = F::app();
if ( !$app->checkSkin( 'oasis', $app->wg->Skin )
|| $app->wg->DevelEnvironment || $app->wg->StagingEnvironment ) {
return true;
}
*/
if (class_exists('WScribeClient')) {
try {
$title = $article->getTitle();
$fields = array('wikiId' => intval($wgCityId), 'databaseName' => $wgDBname, 'articleId' => $title->getArticleID(), 'namespaceId' => $title->getNamespace(), 'articleTitle' => $title->getText(), 'parserTime' => $parserOutput->getPerformanceStats('time'), 'wikitextSize' => $parserOutput->getPerformanceStats('wikitextSize'), 'htmlSize' => $parserOutput->getPerformanceStats('htmlSize'), 'expFuncCount' => $parserOutput->getPerformanceStats('expFuncCount'), 'nodeCount' => $parserOutput->getPerformanceStats('nodeCount'), 'postExpandSize' => $parserOutput->getPerformanceStats('postExpandSize'), 'tempArgSize' => $parserOutput->getPerformanceStats('tempArgSize'));
$data = json_encode($fields);
WScribeClient::singleton(self::SCRIBE_KEY)->send($data);
} catch (TException $e) {
Wikia::log(__METHOD__, 'scribeClient exception', $e->getMessage());
}
}
// Logging parser activity for monitoring
// wiki and article info are sent to logstash anyways so no need to repeat them here
WikiaLogger::instance()->info("Parser execution", ['parser-time' => round($parserOutput->getPerformanceStats('time') * 1000), 'node-count' => (int) $parserOutput->getPerformanceStats('nodeCount'), 'wikitext-size' => (int) $parserOutput->getPerformanceStats('wikitextSize'), 'skin-name' => RequestContext::getMain()->getSkin()->getSkinName()]);
return true;
}
示例7: getSimpleFormatForArticle
/**
*
*/
public function getSimpleFormatForArticle(\Article $article)
{
$measurement = \Wikia\Measurements\Time::start([__CLASS__, __METHOD__]);
$cacheKey = wfMemcKey("SimpleJson", $article->getPage()->getId(), self::SIMPLE_JSON_SCHEMA_VERSION);
$jsonSimple = $this->app->wg->memc->get($cacheKey);
if ($jsonSimple === false) {
/**
* Prevention from circular references, when parsing articles with tabs.
*
* E.g. when page contains tab, which is actually link to itself,
* or if any tab contains tab, which referenced to given page.
*
* @see DivContainingHeadersVisitor::parseTabview
*/
\Wikia\JsonFormat\HtmlParser::markAsVisited($article->getTitle()->getText());
$jsonFormatRootNode = $this->getJsonFormatForArticle($article);
// We have finished parsing of article, so we can clean array of visited articles
\Wikia\JsonFormat\HtmlParser::clearVisited();
$simplifier = new Wikia\JsonFormat\JsonFormatSimplifier();
$jsonSimple = $simplifier->simplify($jsonFormatRootNode, $article->getTitle()->getText());
$this->app->wg->memc->set($cacheKey, $jsonSimple, self::SIMPLE_JSON_CACHE_EXPIRATION);
}
$measurement->stop();
return $jsonSimple;
}
示例8: loadOne
protected function loadOne($file)
{
$xml = new SimpleXMLElement($file, 0, true);
if ((string) $xml->head->title == null) {
return null;
}
$article = new Article();
foreach ($xml->head->meta as $meta) {
$name = (string) $meta['name'];
$content = (string) $meta['content'];
switch ($name) {
case 'date':
$article->setPublicationDate(new DateTime($content));
break;
case 'author':
$article->setAuthor($content);
break;
}
}
$article->setTitle((string) $xml->head->title);
$article->setHash($this->getHash($article->getTitle()));
$content = "";
foreach ($xml->body->children() as $child) {
$content .= $child->asXml();
}
$article->setContent($content);
return $article;
}
示例9: onPowerDelete
/**
* @static
* @param string $action
* @param Article $article
* @return bool
* @throws UserBlockedError
* @throws PermissionsError
*/
static function onPowerDelete($action, $article)
{
global $wgOut, $wgUser, $wgRequest;
if ($action !== 'powerdelete') {
return true;
}
if (!$wgUser->isAllowed('delete') || !$wgUser->isAllowed('powerdelete')) {
throw new PermissionsError('powerdelete');
}
if ($wgUser->isBlocked()) {
throw new UserBlockedError($wgUser->mBlock);
}
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return false;
}
$reason = $wgRequest->getText('reason');
$title = $article->getTitle();
$file = $title->getNamespace() == NS_IMAGE ? wfLocalFile($title) : false;
if ($file) {
$oldimage = null;
FileDeleteForm::doDelete($title, $file, $oldimage, $reason, false);
} else {
$article->doDelete($reason);
}
// this is stupid, but otherwise, WikiPage::doUpdateRestrictions complains about passing by reference
$false = false;
$article->doUpdateRestrictions(array('create' => 'sysop'), array('create' => 'infinity'), $false, $reason, $wgUser);
return false;
}
示例10: ArticleMessage
/**
* Log article related event.
*
* @param Article $p_article
* @param string $p_text
* @param int $p_userId
* @param int $p_eventId
* @param bool $p_short
*
* @return void
*/
public static function ArticleMessage(Article $p_article, $p_text, $p_userId = NULL, $p_eventId = 0, $p_short = FALSE)
{
ob_start();
echo getGS('Article'), ': ', $p_article->getTitle();
if (!$p_short) {
// add publication, issue, section
echo ' (';
echo getGS('Publication'), ': ', $p_article->getPublicationId();
echo ', ';
echo getGS('Issue'), ': ', $p_article->getIssueNumber();
echo ', ';
echo getGS('Section'), ': ', $p_article->getSectionNumber();
echo ")\n";
}
// generate url
$url = ShortURL::GetURL($p_article->getPublicationId(), $p_article->getLanguageId(), $p_article->getIssueNumber(), $p_article->getSectionNumber(), $p_article->getArticleNumber());
if (strpos($url, 'http') !== FALSE) {
// no url for deleted
echo getGS('Article URL'), ': ', $url, "\n";
}
echo getGS('Article Number'), ': ', $p_article->getArticleNumber(), "\n";
echo getGS('Language'), ': ', $p_article->getLanguageName(), "\n";
echo "\n";
echo getGS('Action') . ': ', $p_text;
$message = ob_get_clean();
self::Message($message, $p_userId, $p_eventId);
}
示例11: 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);
}
示例12: __construct
/**
* Instantiate this topic with a supplied Article instance.
*
* @param Article $article
*/
public function __construct(Article &$article)
{
$this->pArticle = $article;
$this->pTitle = $article->getTitle();
if (preg_match('/' . PONYDOCS_DOCUMENTATION_NAMESPACE_NAME . ':.*:.*:.*:.*/i', $this->pTitle->__toString())) {
$this->mIsDocumentationTopic = TRUE;
}
}
示例13: clearBlacklist
/**
* ArticleSaveComplete hook
*
* @param Article $article
*/
public static function clearBlacklist(&$article, &$user, $text, $summary, $isminor, $iswatch, $section)
{
$title = $article->getTitle();
if ($title->getNamespace() == NS_MEDIAWIKI && $title->getDBkey() == 'Emailblacklist') {
EmailBlacklist::singleton()->invalidate();
}
return true;
}
示例14: __invoke
public function __invoke($args)
{
if (count($args) < 1) {
throw new OrongoScriptParseException("Argument missing for Articles.GetTitle()");
}
$article = new Article($args[0]);
return new OrongoVariable($article->getTitle());
}
示例15: processArticle
/**
* @desc Process Artist article page
*
* @param Article $article
*
* @return array
*/
public function processArticle(Article $article)
{
$name = $article->getTitle()->getText();
$artistData = ['article_id' => $article->getId(), 'name' => $name, 'name_lowercase' => LyricsUtils::lowercase($name)];
$artistData = array_merge($artistData, $this->getHeader($article));
$artistData = array_merge($artistData, $this->getFooter($article));
$artistData['genres'] = $this->getGenres($article);
return $this->sanitizeData($artistData, $this->getDataMap());
}