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

Static Public Member Functions

static makeLink ( $linkRenderer, $title, $msg=null, $attrs=array(), $params=array())
 
static linkForSpecialPage ( $linkRenderer, $specialPageName)
 
static titleURLString ( $title)
 
static titleString ( $title)
 
static getPageText ( $title)
 
static getSMWStore ()
 
static linkText ( $namespace, $name, $text=null)
 
static printRedirectForm ( $title, $page_contents, $edit_summary, $is_save, $is_preview, $is_diff, $is_minor_edit, $watch_this, $start_time, $edit_time)
 
static addFormRLModules ( $parser=null)
 
static getAllForms ()
 
static formDropdownHTML ( $form_names=null)
 
static convertBackToPipes ( $s)
 
static smartSplitFormTag ( $string)
 
static getFormTagComponents ( $str)
 
static getWordForYesOrNo ( $isYes)
 
static array_merge_recursive_distinct (array &$array1, array &$array2)
 

Member Function Documentation

◆ addFormRLModules()

static PFUtils::addFormRLModules (   $parser = null)
static

Includes the necessary ResourceLoader modules for the form to display and work correctly.

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

Parameters
Parser | null$parser

◆ array_merge_recursive_distinct()

static PFUtils::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>

◆ convertBackToPipes()

static PFUtils::convertBackToPipes (   $s)
static

A helper function, used by getFormTagComponents().

Parameters
string$s
Returns
string

◆ formDropdownHTML()

static PFUtils::formDropdownHTML (   $form_names = null)
static

Creates a dropdown of possible form names.

Parameters
array | null$form_names
Returns
string

◆ getAllForms()

static PFUtils::getAllForms ( )
static

Returns an array of all form names on this wiki.

Returns
string[]

◆ getFormTagComponents()

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

Parameters
string$str
Returns
string[]

◆ getPageText()

static PFUtils::getPageText (   $title)
static

Gets the text contents of a page with the passed-in Title object.

Parameters
Title$title
Returns
string|null

◆ getSMWStore()

static PFUtils::getSMWStore ( )
static

Helper function to get the SMW data store for different versions of SMW.

Returns
Store|null

◆ getWordForYesOrNo()

static PFUtils::getWordForYesOrNo (   $isYes)
static

Gets the word in the wiki's language for either the value 'yes' or 'no'.

Parameters
bool$isYes
Returns
string

◆ linkForSpecialPage()

static PFUtils::linkForSpecialPage (   $linkRenderer,
  $specialPageName 
)
static

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

Parameters
LinkRenderer$linkRenderer
string$specialPageName
Returns
string

◆ linkText()

static PFUtils::linkText (   $namespace,
  $name,
  $text = null 
)
static

Creates wiki-text for a link to a wiki page

Parameters
int$namespace
string$name
string | null$text
Returns
string

◆ makeLink()

static PFUtils::makeLink (   $linkRenderer,
  $title,
  $msg = null,
  $attrs = array(),
  $params = array() 
)
static

Helper function for backward compatibility.

Parameters
LinkRenderer$linkRenderer
string$title
string | null$msg
array$attrs
array$params
Returns
string

◆ printRedirectForm()

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

Parameters
string$title
string$page_contents
string$edit_summary
bool$is_save
bool$is_preview
bool$is_diff
bool$is_minor_edit
bool$watch_this
string$start_time
string$edit_time
Returns
string

◆ smartSplitFormTag()

static PFUtils::smartSplitFormTag (   $string)
static

Splits the contents of a tag in a form definition based on pipes, but does not split on pipes that are contained within additional curly brackets, in case the tag contains any calls to parser functions or templates.

Parameters
string$string
Returns
string[]

◆ titleString()

static PFUtils::titleString (   $title)
static

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

Parameters
Title$title
Returns
string

◆ titleURLString()

static PFUtils::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

Parameters
Title$title
Returns
string

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

About | General disclaimer | Privacy policy