本文整理汇总了PHP中ParserOutput::getProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP ParserOutput::getProperties方法的具体用法?PHP ParserOutput::getProperties怎么用?PHP ParserOutput::getProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParserOutput
的用法示例。
在下文中一共展示了ParserOutput::getProperties方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LinksUpdate
/**
* Constructor
*
* @param Title $title Title of the page we're updating
* @param ParserOutput $parserOutput Output from a full parse of this page
* @param bool $recursive Queue jobs for recursive updates?
*/
function LinksUpdate($title, $parserOutput, $recursive = true)
{
global $wgAntiLockFlags;
if ($wgAntiLockFlags & ALF_NO_LINK_LOCK) {
$this->mOptions = array();
} else {
$this->mOptions = array('FOR UPDATE');
}
$this->mDb = wfGetDB(DB_MASTER);
if (!is_object($title)) {
throw new MWException("The calling convention to LinksUpdate::LinksUpdate() has changed. " . "Please see Article::editUpdates() for an invocation example.\n");
}
$this->mTitle = $title;
$this->mId = $title->getArticleID();
$this->mParserOutput = $parserOutput;
$this->mLinks = $parserOutput->getLinks();
$this->mImages = $parserOutput->getImages();
$this->mTemplates = $parserOutput->getTemplates();
$this->mExternals = $parserOutput->getExternalLinks();
$this->mCategories = $parserOutput->getCategories();
$this->mProperties = $parserOutput->getProperties();
# Convert the format of the interlanguage links
# I didn't want to change it in the ParserOutput, because that array is passed all
# the way back to the skin, so either a skin API break would be required, or an
# inefficient back-conversion.
$ill = $parserOutput->getLanguageLinks();
$this->mInterlangs = array();
foreach ($ill as $link) {
list($key, $title) = explode(':', $link, 2);
$this->mInterlangs[$key] = $title;
}
$this->mRecursive = $recursive;
$this->mTouchTmplLinks = false;
wfRunHooks('LinksUpdateConstructed', array(&$this));
}
示例2: testProperties
/**
* @covers ParserOutput::setProperty
* @covers ParserOutput::getProperty
* @covers ParserOutput::unsetProperty
* @covers ParserOutput::getProperties
*/
public function testProperties()
{
$po = new ParserOutput();
$po->setProperty('foo', 'val');
$properties = $po->getProperties();
$this->assertEquals($po->getProperty('foo'), 'val');
$this->assertEquals($properties['foo'], 'val');
$po->setProperty('foo', 'second val');
$properties = $po->getProperties();
$this->assertEquals($po->getProperty('foo'), 'second val');
$this->assertEquals($properties['foo'], 'second val');
$po->unsetProperty('foo');
$properties = $po->getProperties();
$this->assertEquals($po->getProperty('foo'), false);
$this->assertArrayNotHasKey('foo', $properties);
}
示例3: MWException
/**
* Constructor
*
* @param Title $title Title of the page we're updating
* @param ParserOutput $parserOutput Output from a full parse of this page
* @param bool $recursive Queue jobs for recursive updates?
* @throws MWException
*/
function __construct($title, $parserOutput, $recursive = true)
{
parent::__construct(false);
// no implicit transaction
if (!$title instanceof Title) {
throw new MWException("The calling convention to LinksUpdate::LinksUpdate() has changed. " . "Please see Article::editUpdates() for an invocation example.\n");
}
if (!$parserOutput instanceof ParserOutput) {
throw new MWException("The calling convention to LinksUpdate::__construct() has changed. " . "Please see WikiPage::doEditUpdates() for an invocation example.\n");
}
$this->mTitle = $title;
$this->mId = $title->getArticleID();
if (!$this->mId) {
throw new MWException("The Title object did not provide an article " . "ID. Perhaps the page doesn't exist?");
}
$this->mParserOutput = $parserOutput;
$this->mLinks = $parserOutput->getLinks();
$this->mImages = $parserOutput->getImages();
$this->mTemplates = $parserOutput->getTemplates();
$this->mExternals = $parserOutput->getExternalLinks();
$this->mCategories = $parserOutput->getCategories();
$this->mProperties = $parserOutput->getProperties();
$this->mInterwikis = $parserOutput->getInterwikiLinks();
# Convert the format of the interlanguage links
# I didn't want to change it in the ParserOutput, because that array is passed all
# the way back to the skin, so either a skin API break would be required, or an
# inefficient back-conversion.
$ill = $parserOutput->getLanguageLinks();
$this->mInterlangs = array();
foreach ($ill as $link) {
list($key, $title) = explode(':', $link, 2);
$this->mInterlangs[$key] = $title;
}
foreach ($this->mCategories as &$sortkey) {
# If the sortkey is longer then 255 bytes,
# it truncated by DB, and then doesn't get
# matched when comparing existing vs current
# categories, causing bug 25254.
# Also. substr behaves weird when given "".
if ($sortkey !== '') {
$sortkey = substr($sortkey, 0, 255);
}
}
$this->mRecursive = $recursive;
Hooks::run('LinksUpdateConstructed', array(&$this));
}
示例4: InvalidArgumentException
/**
* Constructor
*
* @param Title $title Title of the page we're updating
* @param ParserOutput $parserOutput Output from a full parse of this page
* @param bool $recursive Queue jobs for recursive updates?
* @throws MWException
*/
function __construct(Title $title, ParserOutput $parserOutput, $recursive = true)
{
parent::__construct(false);
// no implicit transaction
$this->mTitle = $title;
$this->mId = $title->getArticleID(Title::GAID_FOR_UPDATE);
if (!$this->mId) {
throw new InvalidArgumentException("The Title object yields no ID. Perhaps the page doesn't exist?");
}
$this->mParserOutput = $parserOutput;
$this->mLinks = $parserOutput->getLinks();
$this->mImages = $parserOutput->getImages();
$this->mTemplates = $parserOutput->getTemplates();
$this->mExternals = $parserOutput->getExternalLinks();
$this->mCategories = $parserOutput->getCategories();
$this->mProperties = $parserOutput->getProperties();
$this->mInterwikis = $parserOutput->getInterwikiLinks();
# Convert the format of the interlanguage links
# I didn't want to change it in the ParserOutput, because that array is passed all
# the way back to the skin, so either a skin API break would be required, or an
# inefficient back-conversion.
$ill = $parserOutput->getLanguageLinks();
$this->mInterlangs = array();
foreach ($ill as $link) {
list($key, $title) = explode(':', $link, 2);
$this->mInterlangs[$key] = $title;
}
foreach ($this->mCategories as &$sortkey) {
# If the sortkey is longer then 255 bytes,
# it truncated by DB, and then doesn't get
# matched when comparing existing vs current
# categories, causing bug 25254.
# Also. substr behaves weird when given "".
if ($sortkey !== '') {
$sortkey = substr($sortkey, 0, 255);
}
}
$this->mRecursive = $recursive;
Hooks::run('LinksUpdateConstructed', array(&$this));
}