当前位置: 首页>>代码示例>>PHP>>正文


PHP SFUtils::getAllPagesForCategory方法代码示例

本文整理汇总了PHP中SFUtils::getAllPagesForCategory方法的典型用法代码示例。如果您正苦于以下问题:PHP SFUtils::getAllPagesForCategory方法的具体用法?PHP SFUtils::getAllPagesForCategory怎么用?PHP SFUtils::getAllPagesForCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SFUtils的用法示例。


在下文中一共展示了SFUtils::getAllPagesForCategory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:roland2025,项目名称:mediawiki-extensions-SemanticForms,代码行数:59,代码来源:SF_AutocompleteAPI.php

示例2: newFromFormFieldTag


//.........这里部分代码省略.........
                 $f->mFieldArgs['autocompletion source'] = $sub_components[1];
             } elseif ($sub_components[0] == 'autocomplete on concept') {
                 $f->mFieldArgs['autocomplete field type'] = 'concept';
                 $f->mFieldArgs['autocompletion source'] = $sub_components[1];
             } 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('&lt;page name&gt;', $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])));
             }
         }
开发者ID:paladox,项目名称:mediawiki-extensions-SemanticForms,代码行数:67,代码来源:SF_FormField.php

示例3: formHTML


//.........这里部分代码省略.........
								if ( $propValue->getPropertyTypeID() == '_wpg' ) {
									$field_args['autocomplete field type'] = 'relation';
								} else {
									$field_args['autocomplete field type'] = 'attribute';
								}
								$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( '&lt;page name&gt;', $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;
					}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:67,代码来源:SF_FormPrinter.php

示例4: formSerialize


//.........这里部分代码省略.........
                         $is_mandatory = true;
                     } elseif ($component == 'hidden') {
                         $is_hidden = true;
                     } elseif ($component == 'restricted') {
                         $is_restricted = true;
                     } elseif ($component == 'uploadable') {
                         $field_args['is_uploadable'] = true;
                     } elseif ($component == 'list') {
                         $is_list = true;
                     } elseif ($component == 'autocomplete') {
                         $field_args['autocomplete'] = true;
                     } elseif ($component == 'no autocomplete') {
                         $field_args['no autocomplete'] = true;
                     } elseif ($component == 'remote autocompletion') {
                         $field_args['remote autocompletion'] = true;
                     } else {
                         $sub_components = explode('=', $component);
                         if (count($sub_components) == 2) {
                             if ($sub_components[0] == 'input type') {
                                 $input_type = $sub_components[1];
                             } elseif ($sub_components[0] == 'default') {
                                 $default_value = $sub_components[1];
                             } elseif ($sub_components[0] == 'preload') {
                                 // free text field has special handling
                                 if ($field_name == 'free text' || ($field_name = '<freetext>')) {
                                     $free_text_preload_page = $sub_components[1];
                                 } else {
                                     // this variable is not used
                                     $preload_page = $sub_components[1];
                                 }
                             } elseif ($sub_components[0] == 'values') {
                                 $possible_values = explode(',', $sub_components[1]);
                             } elseif ($sub_components[0] == 'values from category') {
                                 $possible_values = SFUtils::getAllPagesForCategory($sub_components[1], 10);
                             } elseif ($sub_components[0] == 'values from concept') {
                                 $possible_values = SFUtils::getAllPagesForConcept($sub_components[1]);
                             } else {
                                 $field_args[$sub_components[0]] = $sub_components[1];
                             }
                             // for backwards compatibility
                             if ($sub_components[0] == 'autocomplete on' && $sub_components[1] == null) {
                                 $field_args['no autocomplete'] = true;
                             }
                         }
                     }
                 }
                 $field_args['part_of_multiple'] = $allow_multiple;
                 // get the value from the request, if it's there, and if it's not
                 // an array
                 $escaped_field_name = str_replace("'", "\\'", $field_name);
                 if (isset($template_instance_query_values) && $template_instance_query_values != null && array_key_exists($escaped_field_name, $template_instance_query_values)) {
                     $field_query_val = $template_instance_query_values[$escaped_field_name];
                     if ($field_query_val && !is_array($field_query_val)) {
                         $cur_value = $field_query_val;
                     }
                 } else {
                     $cur_value = '';
                 }
                 if ($cur_value && !is_array($cur_value)) {
                     # no escaping needed
                     // $cur_value = str_replace('"', '&quot;', $cur_value);
                 }
                 if ($cur_value == null) {
                     // set to default value specified in the form, if it's there
                     $cur_value = $default_value;
                 }
开发者ID:seedbank,项目名称:old-repo,代码行数:67,代码来源:SF_DataAPI.php


注:本文中的SFUtils::getAllPagesForCategory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。