antragsbot 0.5.1
http://antragsbot.sf.net
Public Member Functions | Public Attributes

WikiPage Class Reference

List of all members.

Public Member Functions

 __construct ($title, $wikimate)
 __destruct ()
 __invoke ()
 __toString ()
 destroy ()
 exists ()
 getAllSections ($includeHeading=false, $keyNames=self::SECTIONLIST_BY_INDEX)
 getError ()
 getNumSections ()
 getSection ($section, $includeHeading=false)
 getSectionOffsets ()
 getText ($refresh=false)
 getTitle ()
 newSection ($name, $text)
 setSection ($text, $section=0, $summary=null, $minor=false)
 setText ($text, $section=null, $minor=false, $summary=null)

Public Attributes

const SECTIONLIST_BY_INDEX = 1
const SECTIONLIST_BY_NAME = 2
const SECTIONLIST_BY_NUMBER = 3

Detailed Description

Models a wiki article page that can have its text altered and retrieved.

Author:
Robert McLeod
Since:
December 2010
Version:
0.5

Constructor & Destructor Documentation

WikiPage::__construct ( title,
wikimate 
)

Constructs a WikiPage object from the title given and adds a wikibot object

Parameters:
string$titlename of the wiki article
WikiBot$wikibotWikiBot object
WikiPage::__destruct ( )
Returns:
<type> Destructor

Member Function Documentation

WikiPage::__invoke ( )

Returns an array sections with the section name as the key and the text as the element e.g.

array( 'intro' => 'this text is the introduction', 'History' => 'this is text under the history section' )

Returns:
array of sections
WikiPage::__toString ( )

Returns the wikicode of the page

Returns:
string of wikicode
WikiPage::destroy ( )

Alias of self::__destruct()

WikiPage::exists ( )

Returns the page existance status

Returns:
boolean true if page exists
WikiPage::getAllSections ( includeHeading = false,
keyNames = self::SECTIONLIST_BY_INDEX 
)

Return all the sections of the page in an array - the key names can be set to name or index by using the following for the second param

  • self::SECTIONLIST_BY_NAME
  • self::SECTIONLIST_BY_INDEX
Parameters:
boolean$includeHeadingfalse to get section text only
integer$keyNamesmodifier for the array key names
Returns:
array of sections
WikiPage::getError ( )

Returns an error if there is one, null shows no error

Returns:
mixed null for no errors or an error array object
WikiPage::getNumSections ( )

Returns the number of sections in this page

Returns:
integer the number of sections in this page
WikiPage::getSection ( section,
includeHeading = false 
)

Returns the section requested, section can be the following:

  • section name (string:"History")
  • section index (int:3)
Parameters:
mixed$sectionthe section to get
boolan$includeHeadingfalse to get section text only
Returns:
string wikitext of the section on the page
WikiPage::getSectionOffsets ( )

Returns the sections offsets and lengths

Returns:
StdClass section class
WikiPage::getText ( refresh = false)

Gets the text of the page. If refesh is true then this method will query the wiki api again for the page details

Parameters:
boolean$refreshtrue to query the wiki api again
Returns:
string the text of the page
WikiPage::getTitle ( )

Returns the title of this page

Returns:
string the title of this page
WikiPage::newSection ( name,
text 
)

Alias of WikiPage::setSection() specifically for creating new sections

Parameters:
string$namethe heading name for the new section
string$textThe text of the new section
Returns:
boolean true if the section was saved
WikiPage::setSection ( text,
section = 0,
summary = null,
minor = false 
)

Sets the text of the given section. Essentially an alias of WikiPage:setText() with the summary and minor parameters switched.

Parameters:
string$textThe text of the section
mixed$sectionsection index, new by default
string$summarysummary text
boolean$minortrue for minor edit
Returns:
boolean true if the section was saved
WikiPage::setText ( text,
section = null,
minor = false,
summary = null 
)

Sets the text in the page. Updates the starttimestamp to the timestamp after the page edit (if the edit is successful)

Parameters:
string$textthe article text
string$sectionthe section to edit (null for whole page)
Returns:
boolean true if page was edited successfully

Member Data Documentation


The documentation for this class was generated from the following file:
All Classes Files Functions Variables Enumerations