SFUtils Class Reference

List of all members.

Static Public Member Functions

static linkForSpecialPage ($skin, $specialPageName)
 Creates a link to a special page, using that page's top-level description as the link text.
static titleURLString ($title)
 Creates the name of the page that appears in the URL; this method is necessary because Title::getPartialURL(), for some reason, doesn't include the namespace.
static titleString ($title)
 A very similar function to titleURLString(), to get the non-URL-encoded title string.
static getSMWPropertyValues ($store, $subject, $propID, $requestOptions=null)
 Helper function to handle getPropertyValues() in both SMW 1.6 and earlier versions.
static getCategoriesForPage ($title=null)
 Helper function - gets names of categories for a page; based on Title::getParentCategories(), but simpler
  • this function doubles as a function to get all categories on the site, if no article is specified.

static registerProperty ($id, $typeid, $label)
static initProperties ()
static linkText ($namespace, $name, $text=null)
 Creates wiki-text for a link to a wiki page.
static printRedirectForm ($title, $page_contents, $edit_summary, $is_save, $is_preview, $is_diff, $is_minor_edit, $watch_this, $start_time, $edit_time)
 Prints the mini-form contained at the bottom of various pages, that allows pages to spoof a normal edit page, that can preview, save, etc.
static addJavascriptFiles ($parser)
 Javascript files to be added outside of the ResourceLoader.
static addJavascriptAndCSS ($parser=null)
 Includes the necessary Javascript and CSS files for the form to display and work correctly.
static getAllForms ()
 Returns an array of all form names on this wiki.
static formDropdownHTML ()
 Creates a dropdown of possible form names.
static getAllValuesForProperty ($property_name)
 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 SFAutocompleteAPI::getAllValuesForProperty() exists.
static getAllPagesForCategory ($top_category, $num_levels, $substring=null)
 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().
static getAllPagesForConcept ($concept_name, $substring=null)
static getAllPagesForNamespace ($namespace_name, $substring=null)
static getAutocompleteValues ($source_name, $source_type)
 Creates an array of values that match the specified source name and type, for use by both Javascript autocompletion and comboboxes.
static getValuesArray ($value, $delimiter)
 Helper function to get an array of values out of what may be either an array or a delimited string.
static getValuesFromExternalURL ($external_url_alias, $substring)
static convertBackToPipes ($s)
 A helper function, used by getFormTagComponents().
static getFormTagComponents ($str)
 This function is basically equivalent to calling explode( '|', $str ), except that it doesn't split on pipes that are within parser function calls - i.e., pipes within double curly brackets.
static getWordForYesOrNo ($isYes)
 Gets the word in the wiki's language, as defined in Semantic MediaWiki, for either the value 'yes' or 'no'.
static processEditErrors ($error)
 Translates an EditPage error code into a corresponding message ID.
static addToAdminLinks (&$admin_links_tree)
static getSpecialPage ($pageName)
 Compatibility helper function.
static getSQLConditionForAutocompleteInColumn ($column, $substring)
 Returns a SQL condition for autocompletion substring value in a column.
static showFormPreview (EditPage $editpage, WebRequest $request)
 Appends a preview of the actual form, when a page in the "Form" namespace is previewed.
static createFormLink (&$parser, $specialPageName, $params)
static loadScriptsForPopupForm (&$parser)
static array_merge_recursive_distinct (array &$array1, array &$array2)
 array_merge_recursive merges arrays, but it converts values with duplicate keys to arrays rather than overwriting the value in the first array with the duplicate value in the second array, as array_merge does.
static registerNamespaces (array &$list)
 Register the namespaces for Semantic Forms.


Detailed Description

Definition at line 10 of file SF_Utils.php.


Member Function Documentation

static SFUtils::linkForSpecialPage ( skin,
specialPageName 
) [static]

Creates a link to a special page, using that page's top-level description as the link text.

Definition at line 15 of file SF_Utils.php.

Referenced by SFCreateForm::doSpecialCreateForm(), SFCreateClass::execute(), SFCreateCategory::execute(), TemplatesPage::getPageHeader(), FormsPage::getPageHeader(), and SFCreateTemplate::printCreateTemplateForm().

static SFUtils::titleURLString ( title  )  [static]

Creates the name of the page that appears in the URL; this method is necessary because Title::getPartialURL(), for some reason, doesn't include the namespace.

Definition at line 25 of file SF_Utils.php.

Referenced by SFForm::createMarkup(), SFFormStart::doRedirect(), SFCreateClass::execute(), and SFFormLinker::getFormEditLinkForPage().

static SFUtils::titleString ( title  )  [static]

A very similar function to titleURLString(), to get the non-URL-encoded title string.

Definition at line 42 of file SF_Utils.php.

Referenced by SFFormEditAction::displayForm(), SFFormLinker::getIncomingProperties(), and SFFormEditPage::showContentForm().

static SFUtils::getSMWPropertyValues ( store,
subject,
propID,
requestOptions = null 
) [static]

Helper function to handle getPropertyValues() in both SMW 1.6 and earlier versions.

Definition at line 59 of file SF_Utils.php.

References $store, SMWPropertyValue::makeProperty(), SMWDIWikiPage::newFromTitle(), and SMWDIProperty::newFromUserLabel().

Referenced by SFFormLinker::getFormsThatPagePointsTo(), and SFTemplateField::setTypeAndPossibleValues().

static SFUtils::getCategoriesForPage ( title = null  )  [static]

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

  • this function doubles as a function to get all categories on the site, if no article is specified.

Definition at line 104 of file SF_Utils.php.

References $db.

Referenced by SFCreateCategory::execute(), and SFFormLinker::getDefaultFormsForPage().

static SFUtils::registerProperty ( id,
typeid,
label 
) [static]

static SFUtils::initProperties (  )  [static]

Definition at line 139 of file SF_Utils.php.

static SFUtils::linkText ( namespace,
name,
text = null 
) [static]

Creates wiki-text for a link to a wiki page.

Definition at line 188 of file SF_Utils.php.

Referenced by SFFormField::creationHTML(), SFFormStart::execute(), TemplatesPage::formatResult(), SFFormEdit::printForm(), and SFRunQuery::printPage().

static SFUtils::printRedirectForm ( title,
page_contents,
edit_summary,
is_save,
is_preview,
is_diff,
is_minor_edit,
watch_this,
start_time,
edit_time 
) [static]

Prints the mini-form contained at the bottom of various pages, that allows pages to spoof a normal edit page, that can preview, save, etc.

Definition at line 205 of file SF_Utils.php.

References $sfgScriptPath, and END.

Referenced by SFCreateForm::doSpecialCreateForm(), SFCreateCategory::execute(), SFCreateProperty::printCreatePropertyForm(), SFCreateTemplate::printCreateTemplateForm(), and SFFormEdit::printForm().

static SFUtils::addJavascriptFiles ( parser  )  [static]

Javascript files to be added outside of the ResourceLoader.

Definition at line 259 of file SF_Utils.php.

static SFUtils::addJavascriptAndCSS ( parser = null  )  [static]

Includes the necessary Javascript and CSS files for the form to display and work correctly.

Accepts an optional Parser instance, or uses $wgOut if omitted.

Definition at line 289 of file SF_Utils.php.

Referenced by SFCreateTemplate::addJavascript(), SFCreateClass::addJavascript(), SFFormEdit::printForm(), SFRunQuery::printPage(), SFParserFunctions::renderFormInput(), and showFormPreview().

static SFUtils::getAllForms (  )  [static]

Returns an array of all form names on this wiki.

Definition at line 314 of file SF_Utils.php.

Referenced by SFCreateCategory::execute(), and formDropdownHTML().

static SFUtils::formDropdownHTML (  )  [static]

Creates a dropdown of possible form names.

Definition at line 333 of file SF_Utils.php.

References getAllForms().

Referenced by SFFormStart::execute(), and SFParserFunctions::renderFormInput().

static SFUtils::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 SFAutocompleteAPI::getAllValuesForProperty() exists.

Definition at line 351 of file SF_Utils.php.

References $sfgMaxAutocompleteValues, $store, and smwfGetStore().

Referenced by SFFormPrinter::formHTML().

static SFUtils::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().

Definition at line 367 of file SF_Utils.php.

References $db, and $sfgMaxAutocompleteValues.

Referenced by SFAutocompleteAPI::execute(), and SFFormPrinter::formHTML().

static SFUtils::getAllPagesForConcept ( concept_name,
substring = null 
) [static]

static SFUtils::getAllPagesForNamespace ( namespace_name,
substring = null 
) [static]

static SFUtils::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.

Definition at line 547 of file SF_Utils.php.

Referenced by SFComboBoxInput::getHTML(), SFParserFunctions::renderFormInput(), and SFTextWithAutocompleteInput::setAutocompleteValues().

static SFUtils::getValuesArray ( value,
delimiter 
) [static]

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

Definition at line 570 of file SF_Utils.php.

Referenced by SFListBoxInput::getHTML(), SFCheckboxesInput::getHTML(), and SFCategoriesInput::getHTML().

static SFUtils::getValuesFromExternalURL ( external_url_alias,
substring 
) [static]

Definition at line 579 of file SF_Utils.php.

Referenced by SFAutocompleteAPI::execute().

static SFUtils::convertBackToPipes ( s  )  [static]

A helper function, used by getFormTagComponents().

Definition at line 599 of file SF_Utils.php.

static SFUtils::getFormTagComponents ( str  )  [static]

This function is basically equivalent to calling explode( '|', $str ), except that it doesn't split on pipes that are within parser function calls - i.e., pipes within double curly brackets.

Definition at line 609 of file SF_Utils.php.

Referenced by SFFormPrinter::formHTML(), and SFFormEdit::printForm().

static SFUtils::getWordForYesOrNo ( isYes  )  [static]

Gets the word in the wiki's language, as defined in Semantic MediaWiki, for either the value 'yes' or 'no'.

Definition at line 624 of file SF_Utils.php.

Referenced by SFFormPrinter::formHTML(), SFRadioButtonInput::getHTML(), and SFDropdownInput::getHTML().

static SFUtils::processEditErrors ( error  )  [static]

Translates an EditPage error code into a corresponding message ID.

Parameters:
$error The error code
Returns:
String

Definition at line 644 of file SF_Utils.php.

Referenced by SFFormEdit::printForm().

static SFUtils::addToAdminLinks ( &$  admin_links_tree  )  [static]

Definition at line 698 of file SF_Utils.php.

static SFUtils::getSpecialPage ( pageName  )  [static]

Compatibility helper function.

Since 1.18 SpecialPageFactory::getPage should be used. SpecialPage::getPage is deprecated in 1.18.

Since:
2.3.3
Parameters:
string $pageName
Returns:
SpecialPage|null

Definition at line 732 of file SF_Utils.php.

Referenced by createFormLink(), SFForm::createMarkup(), SFFormLinker::getFormEditLinkForPage(), SFFormStart::getFormEditURL(), SFFormEdit::printAltFormsList(), SFParserFunctions::renderFormInput(), and SFTextInput::uploadableHTML().

static SFUtils::getSQLConditionForAutocompleteInColumn ( column,
substring 
) [static]

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

Parameters:
string $value_column Value column name
string $substring Substring to look for
Returns:
SQL condition for use in WHERE clause
Author:
Ilmars Poikans

Definition at line 745 of file SF_Utils.php.

References $sfgAutocompleteOnAllChars.

Referenced by getAllPagesForNamespace(), and SFAutocompleteAPI::getAllValuesForProperty().

static SFUtils::showFormPreview ( EditPage $  editpage,
WebRequest $  request 
) [static]

Appends a preview of the actual form, when a page in the "Form" namespace is previewed.

Author:
Solitarius
Since:
2.4
Parameters:
EditPage $editpage
WebRequest $request
Returns:
true

Definition at line 773 of file SF_Utils.php.

References addJavascriptAndCSS().

static SFUtils::createFormLink ( &$  parser,
specialPageName,
params 
) [static]

static SFUtils::loadScriptsForPopupForm ( &$  parser  )  [static]

Definition at line 927 of file SF_Utils.php.

Referenced by SFParserFunctions::renderFormInput().

static SFUtils::array_merge_recursive_distinct ( array &$  array1,
array &$  array2 
) [static]

array_merge_recursive merges arrays, but it converts values with duplicate keys to arrays rather than overwriting the value in the first array with the duplicate value in the second array, as array_merge does.

array_merge_recursive_distinct does not change the datatypes of the values in the arrays. Matching keys' values in the second array overwrite those in the first array.

Parameters are passed by reference, though only for performance reasons. They're not altered by this function.

See http://www.php.net/manual/en/function.array-merge-recursive.php#92195

Parameters:
array $array1
array $array2
Returns:
array
Author:
Daniel <daniel (at) danielsmedegaardbuus (dot) dk>

Gabriel Sobrinho <gabriel (dot) sobrinho (at) gmail (dot) com>

Definition at line 951 of file SF_Utils.php.

Referenced by SFParserFunctions::renderAutoEdit(), SFParserFunctions::renderFormInput(), and SFAutoeditAPI::storeSemanticData().

static SFUtils::registerNamespaces ( array &$  list  )  [static]

Register the namespaces for Semantic Forms.

See also:
https://www.mediawiki.org/wiki/Manual:Hooks/CanonicalNamespaces
Since:
2.4.1
Parameters:
array $list
Returns:
true

Definition at line 976 of file SF_Utils.php.


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

Generated on Sun Mar 18 07:15:42 2012 for Semantic MediaWiki by  doxygen 1.5.6