Semantic MediaWiki and related extensions
Static Public Member Functions | List of all members
PFValuesUtils Class Reference

Static Public Member Functions

static getSMWPropertyValues ( $store, $subject, $propID, $requestOptions=null)
 
static getCategoriesForPage ( $title)
 
static getAllCategories ()
 
static getAllValuesForProperty ( $property_name)
 
static getAllValuesForCargoField ( $tableName, $fieldName)
 
static getValuesForCargoField ( $tableName, $fieldName, $whereStr=null)
 
static getAllPagesForCategory ( $top_category, $num_levels, $substring=null)
 
static fixedMultiSort ( $sortkeys, $pages)
 
static getAllPagesForConcept ( $conceptName, $substring=null)
 
static getAllPagesForNamespace ( $namespaceStr, $substring=null)
 
static getAutocompleteValues ( $source_name, $source_type)
 
static getAutocompletionTypeAndSource (&$field_args)
 
static getRemoteDataTypeAndPossiblySetAutocompleteValues ( $autocompleteFieldType, $autocompletionSource, $field_args, $autocompleteSettings)
 
static setAutocompleteValues ( $field_args, $is_list)
 
static getValuesArray ( $value, $delimiter)
 
static getValuesFromExternalURL ( $external_url_alias, $substring)
 
static getSQLConditionForAutocompleteInColumn ( $column, $substring, $replaceSpaces=true)
 
static getAllPagesForQuery ( $rawQuery)
 
static disambiguateLabels ( $labels)
 

Member Function Documentation

◆ disambiguateLabels()

static PFValuesUtils::disambiguateLabels (   $labels)
static

Doing "mapping" on values can potentially lead to more than one value having the same "label". To avoid this, we find duplicate labels, if there are any, add on the real value, in parentheses, to all of them.

Parameters
array$labels
Returns
array

◆ fixedMultiSort()

static PFValuesUtils::fixedMultiSort (   $sortkeys,
  $pages 
)
static

array_multisort() unfortunately messes up array keys that are numeric - they get converted to 0, 1, etc. There are a few ways to get around this, but I (Yaron) couldn't get those working, so instead we're going with this hack, where all key values get appended with a '@' before sorting, which is then removed after sorting. It's inefficient, but it's probably good enough.

Parameters
string[]$sortkeys
string[]$pages
Returns
string[] a sorted version of $pages, sorted via $sortkeys

◆ getAllCategories()

static PFValuesUtils::getAllCategories ( )
static

Helper function - returns names of all the categories.

Returns
array

◆ getAllPagesForCategory()

static PFValuesUtils::getAllPagesForCategory (   $top_category,
  $num_levels,
  $substring = null 
)
static

Get all the pages that belong to a category and all its subcategories, down a certain number of levels - heavily based on SMW's SMWInlineQuery::includeSubcategories().

Parameters
string$top_category
int$num_levels
string | null$substring
Returns
string

◆ getAllPagesForQuery()

static PFValuesUtils::getAllPagesForQuery (   $rawQuery)
static

Returns an array of the names of pages that are the result of an SMW query.

Parameters
string$rawQuerythe query string like [[Category:Trees]][[age::>1000]]
Returns
array

◆ getAllValuesForCargoField()

static PFValuesUtils::getAllValuesForCargoField (   $tableName,
  $fieldName 
)
static

Used with the Cargo extension.

Parameters
string$tableName
string$fieldName
Returns
array

◆ getAllValuesForProperty()

static PFValuesUtils::getAllValuesForProperty (   $property_name)
static

This function, unlike the others, doesn't take in a substring because it uses the SMW data store, which can't perform case-insensitive queries; for queries with a substring, the function PFAutocompleteAPI::getAllValuesForProperty() exists.

Parameters
string$property_name
Returns
array

◆ getAutocompleteValues()

static PFValuesUtils::getAutocompleteValues (   $source_name,
  $source_type 
)
static

Creates an array of values that match the specified source name and type, for use by both Javascript autocompletion and comboboxes.

Parameters
string | null$source_name
string$source_type
Returns
string[]

◆ getCategoriesForPage()

static PFValuesUtils::getCategoriesForPage (   $title)
static

Helper function - gets names of categories for a page; based on Title::getParentCategories(), but simpler.

Parameters
Title$title
Returns
array

◆ getSMWPropertyValues()

static PFValuesUtils::getSMWPropertyValues (   $store,
  $subject,
  $propID,
  $requestOptions = null 
)
static

Helper function to handle getPropertyValues().

Parameters
Store$store
Title$subject
string$propID
array | null$requestOptions
Returns
array

◆ getSQLConditionForAutocompleteInColumn()

static PFValuesUtils::getSQLConditionForAutocompleteInColumn (   $column,
  $substring,
  $replaceSpaces = true 
)
static

Returns a SQL condition for autocompletion substring value in a column.

Parameters
string$columnValue column name
string$substringSubstring to look for
bool$replaceSpaces
Returns
string SQL condition for use in WHERE clause

◆ getValuesArray()

static PFValuesUtils::getValuesArray (   $value,
  $delimiter 
)
static

Helper function to get an array of values out of what may be either an array or a delimited string.

Parameters
string[]|string$value
string$delimiter
Returns
string[]

◆ getValuesForCargoField()

static PFValuesUtils::getValuesForCargoField (   $tableName,
  $fieldName,
  $whereStr = null 
)
static

Used with the Cargo extension.

Parameters
string$tableName
string$fieldName
string | null$whereStr
Returns
array

◆ setAutocompleteValues()

static PFValuesUtils::setAutocompleteValues (   $field_args,
  $is_list 
)
static

Get all autocomplete-related values, plus delimiter value (it's needed also for the 'uploadable' link, if there is one).

Parameters
array$field_args
bool$is_list
Returns
string[]

The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy