public static function provideHandlers() { $models = ContentHandler::getContentModels(); $handlers = []; foreach ($models as $model) { $handlers[] = [ContentHandler::getForModelID($model)]; } return $handlers; }
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; }
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())); }
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'))); }
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())); }
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)); }
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())); }
/** * 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; }
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]]; }