本文整理汇总了PHP中SFUtils::getAllPagesForNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP SFUtils::getAllPagesForNamespace方法的具体用法?PHP SFUtils::getAllPagesForNamespace怎么用?PHP SFUtils::getAllPagesForNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFUtils
的用法示例。
在下文中一共展示了SFUtils::getAllPagesForNamespace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$params = $this->extractRequestParams();
$substr = $params['substr'];
$namespace = $params['namespace'];
$property = $params['property'];
$category = $params['category'];
$concept = $params['concept'];
$external_url = $params['external_url'];
$baseprop = $params['baseprop'];
$basevalue = $params['basevalue'];
//$limit = $params['limit'];
if (is_null($baseprop) && strlen($substr) == 0) {
$this->dieUsage('The substring must be specified', 'param_substr');
}
if (!is_null($baseprop)) {
if (!is_null($property)) {
$data = self::getAllValuesForProperty($property, null, $baseprop, $basevalue);
}
} elseif (!is_null($property)) {
$data = self::getAllValuesForProperty($property, $substr);
} elseif (!is_null($category)) {
$data = SFUtils::getAllPagesForCategory($category, 3, $substr);
} elseif (!is_null($concept)) {
$data = SFUtils::getAllPagesForConcept($concept, $substr);
} elseif (!is_null($namespace)) {
$data = SFUtils::getAllPagesForNamespace($namespace, $substr);
} elseif (!is_null($external_url)) {
$data = SFUtils::getValuesFromExternalURL($external_url, $substr);
} else {
$data = array();
}
// If we got back an error message, exit with that message.
if (!is_array($data)) {
$this->dieUsage($data);
}
// to prevent JS parsing problems, display should be the same
// even if there are no results
/*
if ( count( $data ) <= 0 ) {
return;
}
*/
// Format data as the API requires it - this is not needed
// for "values from url", where the data is already formatted
// correctly.
if (is_null($external_url)) {
$formattedData = array();
foreach ($data as $value) {
$formattedData[] = array('title' => $value);
}
} else {
$formattedData = $data;
}
// Set top-level elements.
$result = $this->getResult();
$result->setIndexedTagName($formattedData, 'p');
$result->addValue(null, $this->getModuleName(), $formattedData);
}
示例2: formHTML
//.........这里部分代码省略.........
}
$field_args['autocompletion source'] = $sub_components[1];
} elseif ( $sub_components[0] == 'autocomplete on category' ) {
$field_args['autocomplete field type'] = 'category';
$field_args['autocompletion source'] = $sub_components[1];
} elseif ( $sub_components[0] == 'autocomplete on concept' ) {
$field_args['autocomplete field type'] = 'concept';
$field_args['autocompletion source'] = $sub_components[1];
} elseif ( $sub_components[0] == 'autocomplete on namespace' ) {
$field_args['autocomplete field type'] = 'namespace';
$autocompletion_source = $sub_components[1];
// special handling for "main" (blank) namespace
if ( $autocompletion_source == "" )
$autocompletion_source = "main";
$field_args['autocompletion source'] = $autocompletion_source;
} elseif ( $sub_components[0] == 'autocomplete from url' ) {
$field_args['autocomplete field type'] = 'external_url';
$field_args['autocompletion source'] = $sub_components[1];
// 'external' autocompletion is always done remotely, i.e. via API
$field_args['remote autocompletion'] = true;
} elseif ( $sub_components[0] == 'values' ) {
// Handle this one only after 'delimiter' has
// also been set.
$values = $sub_components[1];
} elseif ( $sub_components[0] == 'values from property' ) {
$propertyName = $sub_components[1];
$possible_values = SFUtils::getAllValuesForProperty( $propertyName );
} elseif ( $sub_components[0] == 'values from category' ) {
$category_name = ucfirst( $sub_components[1] );
$possible_values = SFUtils::getAllPagesForCategory( $category_name, 10 );
} elseif ( $sub_components[0] == 'values from concept' ) {
$possible_values = SFUtils::getAllPagesForConcept( $sub_components[1] );
} elseif ( $sub_components[0] == 'values from namespace' ) {
$possible_values = SFUtils::getAllPagesForNamespace( $sub_components[1] );
} elseif ( $sub_components[0] == 'values dependent on' ) {
global $sfgDependentFields;
$sfgDependentFields[$sub_components[1]] = $fullFieldName;
} elseif ( $sub_components[0] == 'property' ) {
$semantic_property = $sub_components[1];
} elseif ( $sub_components[0] == 'default filename' ) {
$default_filename = str_replace( '<page name>', $page_name, $sub_components[1] );
// Parse value, so default filename can include parser functions.
$default_filename = $wgParser->recursiveTagParse( $default_filename );
$field_args['default filename'] = $default_filename;
} elseif ( $sub_components[0] == 'restricted' ) {
$is_restricted = !array_intersect(
$wgUser->getEffectiveGroups(), array_map( 'trim', explode( ',', $sub_components[1] ) )
);
}
}
} // end for
// Backwards compatibility
if ( $input_type == 'datetime with timezone' ) {
$input_type = 'datetime';
$field_args['include timezone'] = true;
} elseif ( $input_type == 'text' || $input_type == 'textarea' ) {
// Also for backwards compatibility,
// in that once b/c goes away,
// this will no longer be
// necessary.
$field_args['no autocomplete'] = true;
}
if ( $allow_multiple ) {
$field_args['part_of_multiple'] = $allow_multiple;
}
if ( count( $show_on_select ) > 0 ) {
示例3: newFromFormFieldTag
//.........这里部分代码省略.........
} elseif ($sub_components[0] == 'autocomplete on namespace') {
$f->mFieldArgs['autocomplete field type'] = 'namespace';
$autocompletion_source = $sub_components[1];
// Special handling for "main" (blank)
// namespace.
if ($autocompletion_source == "") {
$autocompletion_source = "main";
}
$f->mFieldArgs['autocompletion source'] = $autocompletion_source;
} elseif ($sub_components[0] == 'autocomplete from url') {
$f->mFieldArgs['autocomplete field type'] = 'external_url';
$f->mFieldArgs['autocompletion source'] = $sub_components[1];
// 'external' autocompletion is always done remotely, i.e. via API
$f->mFieldArgs['remote autocompletion'] = true;
} elseif ($sub_components[0] == 'values') {
// Handle this one only after
// 'delimiter' has also been set.
$values = $wgParser->recursiveTagParse($sub_components[1]);
} elseif ($sub_components[0] == 'values from property') {
$propertyName = $sub_components[1];
$f->mPossibleValues = SFUtils::getAllValuesForProperty($propertyName);
} elseif ($sub_components[0] == 'values from query') {
$pages = SFUtils::getAllPagesForQuery($sub_components[1]);
foreach ($pages as $page) {
$page_name_for_values = $page->getDbKey();
$f->mPossibleValues[] = $page_name_for_values;
}
} elseif ($sub_components[0] == 'values from category') {
$category_name = ucfirst($sub_components[1]);
$f->mPossibleValues = SFUtils::getAllPagesForCategory($category_name, 10);
} elseif ($sub_components[0] == 'values from concept') {
$f->mPossibleValues = SFUtils::getAllPagesForConcept($sub_components[1]);
} elseif ($sub_components[0] == 'values from namespace') {
$f->mPossibleValues = SFUtils::getAllPagesForNamespace($sub_components[1]);
} elseif ($sub_components[0] == 'values dependent on') {
global $sfgDependentFields;
$sfgDependentFields[] = array($sub_components[1], $fullFieldName);
} elseif ($sub_components[0] == 'unique for category') {
$f->mFieldArgs['unique'] = true;
$f->mFieldArgs['unique_for_category'] = $sub_components[1];
} elseif ($sub_components[0] == 'unique for namespace') {
$f->mFieldArgs['unique'] = true;
$f->mFieldArgs['unique_for_namespace'] = $sub_components[1];
} elseif ($sub_components[0] == 'unique for concept') {
$f->mFieldArgs['unique'] = true;
$f->mFieldArgs['unique_for_concept'] = $sub_components[1];
} elseif ($sub_components[0] == 'property') {
$semantic_property = $sub_components[1];
} elseif ($sub_components[0] == 'cargo table') {
$cargo_table = $sub_components[1];
} elseif ($sub_components[0] == 'cargo field') {
$cargo_field = $sub_components[1];
} elseif ($sub_components[0] == 'default filename') {
$default_filename = str_replace('<page name>', $page_name, $sub_components[1]);
// Parse value, so default filename can
// include parser functions.
$default_filename = $wgParser->recursiveTagParse($default_filename);
$f->mFieldArgs['default filename'] = $default_filename;
} elseif ($sub_components[0] == 'restricted') {
$f->mIsRestricted = !array_intersect($wgUser->getEffectiveGroups(), array_map('trim', explode(',', $sub_components[1])));
}
}
}
// end for
if (!array_key_exists('delimiter', $f->mFieldArgs)) {
$f->mFieldArgs['delimiter'] = ",";