本文整理汇总了PHP中ContentHandler::getContentModels方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentHandler::getContentModels方法的具体用法?PHP ContentHandler::getContentModels怎么用?PHP ContentHandler::getContentModels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentHandler
的用法示例。
在下文中一共展示了ContentHandler::getContentModels方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: provideHandlers
public static function provideHandlers()
{
$models = ContentHandler::getContentModels();
$handlers = [];
foreach ($models as $model) {
$handlers[] = [ContentHandler::getForModelID($model)];
}
return $handlers;
}
示例2: getOptionsForTitle
private function getOptionsForTitle(Title $title = null)
{
$models = ContentHandler::getContentModels();
$options = array();
foreach ($models as $model) {
$handler = ContentHandler::getForModelID($model);
if (!$handler->supportsDirectEditing()) {
continue;
}
if ($title) {
if ($title->getContentModel() === $model) {
continue;
}
if (!$handler->canBeUsedOn($title)) {
continue;
}
}
$options[ContentHandler::getLocalizedName($model)] = $model;
}
return $options;
}
示例3: getAllowedParams
public function getAllowedParams()
{
return array('title' => array(ApiBase::PARAM_DFLT => 'API'), 'text' => null, 'summary' => null, 'page' => null, 'pageid' => array(ApiBase::PARAM_TYPE => 'integer'), 'redirects' => false, 'oldid' => array(ApiBase::PARAM_TYPE => 'integer'), 'prop' => array(ApiBase::PARAM_DFLT => 'text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties', ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_TYPE => array('text', 'langlinks', 'languageshtml', 'categories', 'categorieshtml', 'links', 'templates', 'images', 'externallinks', 'sections', 'revid', 'displaytitle', 'headitems', 'headhtml', 'iwlinks', 'wikitext', 'properties')), 'pst' => false, 'onlypst' => false, 'uselang' => null, 'section' => null, 'disablepp' => false, 'generatexml' => false, 'contentformat' => array(ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats()), 'contentmodel' => array(ApiBase::PARAM_TYPE => ContentHandler::getContentModels()));
}
示例4: getAllowedParams
public function getAllowedParams()
{
return array('title' => array(ApiBase::PARAM_TYPE => 'string'), 'pageid' => array(ApiBase::PARAM_TYPE => 'integer'), 'section' => null, 'sectiontitle' => array(ApiBase::PARAM_TYPE => 'string'), 'text' => array(ApiBase::PARAM_TYPE => 'text'), 'summary' => null, 'tags' => array(ApiBase::PARAM_TYPE => ChangeTags::listExplicitlyDefinedTags(), ApiBase::PARAM_ISMULTI => true), 'minor' => false, 'notminor' => false, 'bot' => false, 'basetimestamp' => array(ApiBase::PARAM_TYPE => 'timestamp'), 'starttimestamp' => array(ApiBase::PARAM_TYPE => 'timestamp'), 'recreate' => false, 'createonly' => false, 'nocreate' => false, 'watch' => array(ApiBase::PARAM_DFLT => false, ApiBase::PARAM_DEPRECATED => true), 'unwatch' => array(ApiBase::PARAM_DFLT => false, ApiBase::PARAM_DEPRECATED => true), 'watchlist' => array(ApiBase::PARAM_DFLT => 'preferences', ApiBase::PARAM_TYPE => array('watch', 'unwatch', 'preferences', 'nochange')), 'md5' => null, 'prependtext' => array(ApiBase::PARAM_TYPE => 'text'), 'appendtext' => array(ApiBase::PARAM_TYPE => 'text'), 'undo' => array(ApiBase::PARAM_TYPE => 'integer'), 'undoafter' => array(ApiBase::PARAM_TYPE => 'integer'), 'redirect' => array(ApiBase::PARAM_TYPE => 'boolean', ApiBase::PARAM_DFLT => false), 'contentformat' => array(ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats()), 'contentmodel' => array(ApiBase::PARAM_TYPE => ContentHandler::getContentModels()), 'token' => array(ApiBase::PARAM_HELP_MSG_APPEND => array('apihelp-edit-param-token')));
}
示例5: getAllowedParams
public function getAllowedParams()
{
return array('title' => null, 'text' => array(ApiBase::PARAM_TYPE => 'text'), 'summary' => null, 'page' => null, 'pageid' => array(ApiBase::PARAM_TYPE => 'integer'), 'redirects' => false, 'oldid' => array(ApiBase::PARAM_TYPE => 'integer'), 'prop' => array(ApiBase::PARAM_DFLT => 'text|langlinks|categories|links|templates|' . 'images|externallinks|sections|revid|displaytitle|iwlinks|properties', ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_TYPE => array('text', 'langlinks', 'categories', 'categorieshtml', 'links', 'templates', 'images', 'externallinks', 'sections', 'revid', 'displaytitle', 'headitems', 'headhtml', 'modules', 'jsconfigvars', 'encodedjsconfigvars', 'indicators', 'iwlinks', 'wikitext', 'properties', 'limitreportdata', 'limitreporthtml', 'parsetree'), ApiBase::PARAM_HELP_MSG_PER_VALUE => array('parsetree' => array('apihelp-parse-paramvalue-prop-parsetree', CONTENT_MODEL_WIKITEXT))), 'pst' => false, 'onlypst' => false, 'effectivelanglinks' => false, 'section' => null, 'sectiontitle' => array(ApiBase::PARAM_TYPE => 'string'), 'disablepp' => array(ApiBase::PARAM_DFLT => false, ApiBase::PARAM_DEPRECATED => true), 'disablelimitreport' => false, 'disableeditsection' => false, 'disabletidy' => false, 'generatexml' => array(ApiBase::PARAM_DFLT => false, ApiBase::PARAM_HELP_MSG => array('apihelp-parse-param-generatexml', CONTENT_MODEL_WIKITEXT), ApiBase::PARAM_DEPRECATED => true), 'preview' => false, 'sectionpreview' => false, 'disabletoc' => false, 'contentformat' => array(ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats()), 'contentmodel' => array(ApiBase::PARAM_TYPE => ContentHandler::getContentModels()));
}
示例6: getAllowedParams
public function getAllowedParams()
{
return array('title' => array(ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true), 'section' => array(ApiBase::PARAM_TYPE => 'string'), 'sectiontitle' => array(ApiBase::PARAM_TYPE => 'string'), 'text' => array(ApiBase::PARAM_TYPE => 'text', ApiBase::PARAM_REQUIRED => true), 'contentmodel' => array(ApiBase::PARAM_TYPE => ContentHandler::getContentModels(), ApiBase::PARAM_REQUIRED => true), 'contentformat' => array(ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(), ApiBase::PARAM_REQUIRED => true), 'baserevid' => array(ApiBase::PARAM_TYPE => 'integer', ApiBase::PARAM_REQUIRED => true));
}
示例7: getAllowedParams
public function getAllowedParams()
{
return array('title' => array(ApiBase::PARAM_TYPE => 'string'), 'pageid' => array(ApiBase::PARAM_TYPE => 'integer'), 'section' => null, 'sectiontitle' => array(ApiBase::PARAM_TYPE => 'string'), 'text' => null, 'token' => array(ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true), 'summary' => null, 'minor' => false, 'notminor' => false, 'bot' => false, 'basetimestamp' => null, 'starttimestamp' => null, 'recreate' => false, 'createonly' => false, 'nocreate' => false, 'watch' => array(ApiBase::PARAM_DFLT => false, ApiBase::PARAM_DEPRECATED => true), 'unwatch' => array(ApiBase::PARAM_DFLT => false, ApiBase::PARAM_DEPRECATED => true), 'watchlist' => array(ApiBase::PARAM_DFLT => 'preferences', ApiBase::PARAM_TYPE => array('watch', 'unwatch', 'preferences', 'nochange')), 'md5' => null, 'prependtext' => null, 'appendtext' => null, 'undo' => array(ApiBase::PARAM_TYPE => 'integer'), 'undoafter' => array(ApiBase::PARAM_TYPE => 'integer'), 'redirect' => array(ApiBase::PARAM_TYPE => 'boolean', ApiBase::PARAM_DFLT => false), 'contentformat' => array(ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats()), 'contentmodel' => array(ApiBase::PARAM_TYPE => ContentHandler::getContentModels()));
}
示例8: getSearchIndexFields
/**
* Get fields for search index
* @since 1.28
* @return SearchIndexField[] Index field definitions for all content handlers
*/
public function getSearchIndexFields()
{
$models = ContentHandler::getContentModels();
$fields = [];
foreach ($models as $model) {
$handler = ContentHandler::getForModelID($model);
$handlerFields = $handler->getFieldsForSearchIndex($this);
foreach ($handlerFields as $fieldName => $fieldData) {
if (empty($fields[$fieldName])) {
$fields[$fieldName] = $fieldData;
} else {
// TODO: do we allow some clashes with the same type or reject all of them?
$mergeDef = $fields[$fieldName]->merge($fieldData);
if (!$mergeDef) {
throw new InvalidArgumentException("Duplicate field {$fieldName} for model {$model}");
}
$fields[$fieldName] = $mergeDef;
}
}
}
// Hook to allow extensions to produce search mapping fields
Hooks::run('SearchIndexFields', [&$fields, $this]);
return $fields;
}
示例9: getAllowedParams
public function getAllowedParams()
{
return ['title' => [ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true], 'section' => [ApiBase::PARAM_TYPE => 'string'], 'sectiontitle' => [ApiBase::PARAM_TYPE => 'string'], 'text' => [ApiBase::PARAM_TYPE => 'text', ApiBase::PARAM_DFLT => null], 'stashedtexthash' => [ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_DFLT => null], 'summary' => [ApiBase::PARAM_TYPE => 'string'], 'contentmodel' => [ApiBase::PARAM_TYPE => ContentHandler::getContentModels(), ApiBase::PARAM_REQUIRED => true], 'contentformat' => [ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(), ApiBase::PARAM_REQUIRED => true], 'baserevid' => [ApiBase::PARAM_TYPE => 'integer', ApiBase::PARAM_REQUIRED => true]];
}