MediaWiki fundraising/REL1_35
FundraiserSubscriptionPage Class Reference
Inheritance diagram for FundraiserSubscriptionPage:
Collaboration diagram for FundraiserSubscriptionPage:

Public Member Functions

 execute ( $sub)
 Execute either the verification of a subscription request, or a subscription action.
 
- Public Member Functions inherited from SpecialPage
 __construct ( $name='', $restriction='', $listed=true, $function=false, $file='', $includable=false)
 Default constructor for special pages Derivative classes should call this from their constructor Note that if the user does not have the required level, an error message will be displayed by the default execute() method, without the global function ever being called.
 
 addHelpLink ( $to, $overrideBaseUrl=false)
 Adds help link with an icon via page indicators.
 
 checkPermissions ()
 Checks if userCanExecute, and if not throws a PermissionsError.
 
 checkReadOnly ()
 If the wiki is currently in readonly mode, throws a ReadOnlyError.
 
 doesWrites ()
 Indicates whether this special page may perform database writes.
 
 getConfig ()
 Shortcut to get main config object.
 
 getContext ()
 Gets the context this SpecialPage is executed in.
 
 getDescription ()
 Returns the name that goes in the \<h1\> in the special page itself, and also the name that will be listed in Special:Specialpages.
 
 getFinalGroupName ()
 Get the group that the special page belongs in on Special:SpecialPage Use this method, instead of getGroupName to allow customization of the group name from the wiki side.
 
 getFullTitle ()
 Return the full title, including $par.
 
 getLanguage ()
 Shortcut to get user's language.
 
 getLinkRenderer ()
 
 getLocalName ()
 Get the localised name of the special page Stable to override.
 
 getName ()
 Get the name of this Special Page.
 
 getOutput ()
 Get the OutputPage being used for this instance.
 
 getPageTitle ( $subpage=false)
 Get a self-referential title object.
 
 getRequest ()
 Get the WebRequest being used for this instance.
 
 getRestriction ()
 Get the permission that a user must have to execute this page.
 
 getSkin ()
 Shortcut to get the skin being used for this instance.
 
 getUser ()
 Shortcut to get the User executing this instance.
 
 including ( $x=null)
 Whether the special page is being evaluated via transclusion.
 
 isCached ()
 Is this page cached? Expensive pages are cached or disabled in miser mode.
 
 isExpensive ()
 Is this page expensive (for some definition of expensive)? Expensive pages are disabled or cached in miser mode.
 
 isIncludable ()
 Whether it's allowed to transclude the special page via {{Special:Foo/params}} Stable to override.
 
 isListed ()
 Whether this special page is listed in Special:SpecialPages Stable to override.
 
 isRestricted ()
 Can be overridden by subclasses with more complicated permissions schemes.
 
 listed ( $x=null)
 Get or set whether this special page is listed in Special:SpecialPages.
 
 maxIncludeCacheTime ()
 How long to cache page when it is being included.
 
 msg ( $key,... $params)
 Wrapper around wfMessage that sets the current context.
 
 prefixSearchSubpages ( $search, $limit, $offset)
 Return an array of subpages beginning with $search that this special page will accept.
 
 requireLogin ( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
 If the user is not logged in, throws UserNotLoggedIn error.
 
 run ( $subPage)
 Entry point.
 
 setContext ( $context)
 Sets the context this SpecialPage is executed in.
 
 setHookContainer (HookContainer $hookContainer)
 
 setLinkRenderer (LinkRenderer $linkRenderer)
 
 setListed ( $listed)
 Set whether this page is listed in Special:Specialpages, at run-time.
 
 userCanExecute (User $user)
 Checks if the given user (identified by an object) can execute this special page (as defined by $mRestriction).
 

Public Attributes

const FILT_EXECUTE = '/[a-zA-Z0-9]*/'
 
const FILT_PROCESS = '/[a-zA-Z0-9]*/'
 
const FILT_VARIANT = '/[a-zA-Z0-9_-]*/'
 
const KEY_EXECUTE = 'execute'
 
const KEY_PROCESS = 'p'
 
const KEY_VARIANT = 'v'
 

Protected Member Functions

 getErrorTemplate ()
 
 getQueryTemplate ()
 
 getSuccessTemplate ()
 
 getTemplateDir ()
 
 getTemplateParams ()
 
- Protected Member Functions inherited from SpecialPage
 addFeedLinks ( $params)
 Adds RSS/atom links.
 
 afterExecute ( $subPage)
 Gets called after.
 
 beforeExecute ( $subPage)
 Gets called before.
 
 buildPrevNextNavigation ( $offset, $limit, array $query=[], $atend=false, $subpage=false)
 Generate (prev x| next x) (20|50|100...) type links for paging.
 
 checkLoginSecurityLevel ( $level=null)
 Verifies that the user meets the security level, possibly reauthenticating them in the process.
 
 displayRestrictionError ()
 Output an error message telling the user what access level they have to have Stable to override.
 
 getCacheTTL ()
 Stable to override.
 
 getGroupName ()
 Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-group-*' for valid names This method defaults to group 'other'.
 
 getHookContainer ()
 
 getHookRunner ()
 
 getLanguageConverter ()
 Shortcut to get language's converter.
 
 getLoginSecurityLevel ()
 Tells if the special page does something security-sensitive and needs extra defense against a stolen account (e.g.
 
 getRobotPolicy ()
 Return the robot policy.
 
 getSubpagesForPrefixSearch ()
 Return an array of subpages that this special page will accept for prefix searches.
 
 outputHeader ( $summaryMessageKey='')
 Outputs a summary message on top of special pages Per default the message key is the canonical name of the special page May be overridden, i.e.
 
 prefixSearchString ( $search, $limit, $offset)
 Perform a regular substring search for prefixSearchSubpages.
 
 setHeaders ()
 Sets headers - this should be called from the execute() method of all derived classes! Stable to override.
 
 setReauthPostData (array $data)
 Record preserved POST data after a reauthentication.
 
 useTransactionalTimeLimit ()
 Call wfTransactionalTimeLimit() if this request was POSTed.
 

Protected Attributes

string $mVariant = ''
 
- Protected Attributes inherited from SpecialPage
IContextSource $mContext
 Current request context.
 
 $mIncludable
 
 $mIncluding
 
 $mName
 
 $mRestriction
 

Private Member Functions

 clearData ()
 Clears subscription request data from the session.
 
 doVerify ()
 Verifies that all required parameters are present and valid in the URI string.
 
 executeSubscriptionRequest ()
 Performs all registered subscription actions provided the edit token is valid.
 
 filterValue ( $rawValue, $filter, $expected=null)
 When all you have is a raw value; how does one sanitize it!? Answer, this function!
 
 getFilteredValue ( $key, $filter, $expected='')
 Gets a value from the URI string by $key, filter it by $filter, and return the result.
 
 getRequestVal_CleanKeys ( $key, $expected)
 Containment for a temporary fix, for the long tail on mangled unsub links in emails that went out between 11/2 and 11/3, 2012.
 
 instantiateObjects ()
 Will attempt to instantiate instances of all classes required by the current process.
 
 loadSessionData ()
 Reloads all required session data.
 
 reduceStandaside ( $standasideParam, &$solvedParams)
 Called by stashData() when we have complex parameters that need to be dealt with.
 
 stashData ()
 Obtain all required parameters from the URI, filter and validate, stash to session, and save them attached to the correct object in $this->mObjects[?]['params'] for calling later.
 

Private Attributes

string $mEmail = ''
 
int $mID = 0
 
array[] $mObjects = []
 
string $mProcess = ''
 

Additional Inherited Members

- Static Public Member Functions inherited from SpecialPage
static getSafeTitleFor ( $name, $subpage=false)
 Get a localised Title object for a page name with a possibly unvalidated subpage.
 
static getTitleFor ( $name, $subpage=false, $fragment='')
 Get a localised Title object for a specified special page name If you don't need a full Title object, consider using TitleValue through getTitleValueFor() below.
 
static getTitleValueFor ( $name, $subpage=false, $fragment='')
 Get a localised TitleValue object for a specified special page name.
 
- Static Protected Member Functions inherited from SpecialPage
static prefixSearchArray ( $search, $limit, array $subpages, $offset)
 Helper function for implementations of prefixSearchSubpages() that filter the values in memory (as opposed to making a query).
 

Detailed Description

Definition at line 47 of file FundraiserSubscriptionPage.php.

Member Function Documentation

◆ clearData()

FundraiserSubscriptionPage::clearData ( )
private

Clears subscription request data from the session.

Definition at line 550 of file FundraiserSubscriptionPage.php.

Referenced by execute().

◆ doVerify()

FundraiserSubscriptionPage::doVerify ( )
private

Verifies that all required parameters are present and valid in the URI string.

In practice this function will call the validateRequest() function of any enabled method in the current process that implements ISubscriptionValidator. This is useful for when a method cannot reasonably provide a validation method, ie: silverpop.

Returns
bool True if action can proceed.

Definition at line 229 of file FundraiserSubscriptionPage.php.

Referenced by execute().

◆ execute()

FundraiserSubscriptionPage::execute ( $sub)

◆ executeSubscriptionRequest()

FundraiserSubscriptionPage::executeSubscriptionRequest ( )
private

Performs all registered subscription actions provided the edit token is valid.

Even if a method fails, all other methods will be attempted. The error will of course be reported :)

Returns
bool True if all methods successfully executed. False if any or all failed.

Definition at line 255 of file FundraiserSubscriptionPage.php.

References $mVariant, and getFilteredValue().

Referenced by execute().

◆ filterValue()

FundraiserSubscriptionPage::filterValue ( $rawValue,
$filter,
$expected = null )
private

When all you have is a raw value; how does one sanitize it!? Answer, this function!

Parameters
string$rawValueThe raw value to poke and prod at
string$filterThe regex to use to validate the $rawValue
null$expectedWhat to return if the validation fails. Default is null which will throw an exception on unhappyness.
Returns
null The sanitized value :)
Exceptions
MWExceptionIf $expected was null and the validation failed.

Definition at line 623 of file FundraiserSubscriptionPage.php.

References $matches.

Referenced by getFilteredValue(), and reduceStandaside().

◆ getErrorTemplate()

FundraiserSubscriptionPage::getErrorTemplate ( )
abstractprotected

Reimplemented in SpecialFundraiserSubscribe, and SpecialFundraiserUnsubscribe.

Referenced by execute().

◆ getFilteredValue()

FundraiserSubscriptionPage::getFilteredValue ( $key,
$filter,
$expected = '' )
private

Gets a value from the URI string by $key, filter it by $filter, and return the result.

Parameters
string$keyThe key to obtain from the URI string
string$filterThe PCRE filter to run on the value
string$expectedThe expected value if the filter fails or it the result doesn't exist
Returns
string The filtered result.

Definition at line 567 of file FundraiserSubscriptionPage.php.

References filterValue(), and getRequestVal_CleanKeys().

Referenced by execute(), executeSubscriptionRequest(), reduceStandaside(), and stashData().

◆ getQueryTemplate()

FundraiserSubscriptionPage::getQueryTemplate ( )
abstractprotected

Reimplemented in SpecialFundraiserSubscribe, and SpecialFundraiserUnsubscribe.

Referenced by execute().

◆ getRequestVal_CleanKeys()

FundraiserSubscriptionPage::getRequestVal_CleanKeys ( $key,
$expected )
private

Containment for a temporary fix, for the long tail on mangled unsub links in emails that went out between 11/2 and 11/3, 2012.

Once we stop seeing 'amp;' in the logs, we can whack this and go back to just using getVal in getFilteredValue().

Parameters
string$key
string$expected
Returns
string

Definition at line 587 of file FundraiserSubscriptionPage.php.

References SpecialPage\getRequest().

Referenced by getFilteredValue().

◆ getSuccessTemplate()

FundraiserSubscriptionPage::getSuccessTemplate ( )
abstractprotected

Reimplemented in SpecialFundraiserSubscribe, and SpecialFundraiserUnsubscribe.

Referenced by execute().

◆ getTemplateDir()

FundraiserSubscriptionPage::getTemplateDir ( )
protected

◆ getTemplateParams()

FundraiserSubscriptionPage::getTemplateParams ( )
protected

◆ instantiateObjects()

FundraiserSubscriptionPage::instantiateObjects ( )
private

Will attempt to instantiate instances of all classes required by the current process.

Exceptions
MWException

Definition at line 199 of file FundraiserSubscriptionPage.php.

Referenced by execute(), and loadSessionData().

◆ loadSessionData()

FundraiserSubscriptionPage::loadSessionData ( )
private

Reloads all required session data.

Returns
bool True if session could be successfully restored.

Definition at line 521 of file FundraiserSubscriptionPage.php.

References instantiateObjects().

Referenced by execute().

◆ reduceStandaside()

FundraiserSubscriptionPage::reduceStandaside ( $standasideParam,
& $solvedParams )
private

Called by stashData() when we have complex parameters that need to be dealt with.

It's broken out here to make it a little bit more readable. It can handle both derived variables and lambda expression calls.

Lambda expressions are interesting. They can either be true PHP lambda's (ie: derived from Closure) or class static functions. Either way they must accept only a single argument which is an array of key->value pairs as dictated by the variable map.

Parameters
array$standasideParamInformation on the parameter we're solving for.
array&$solvedParamsKey->Value of all parameters already solved for.
Returns
bool If the parameter was successfully solved.

Definition at line 442 of file FundraiserSubscriptionPage.php.

References filterValue(), and getFilteredValue().

Referenced by stashData().

◆ stashData()

FundraiserSubscriptionPage::stashData ( )
private

Obtain all required parameters from the URI, filter and validate, stash to session, and save them attached to the correct object in $this->mObjects[?]['params'] for calling later.

Note: This takes a bit of a shortcut and assumes that the filters are shared between getRequiredValidationParameters() and getRequiredParameters().

Complex variable reduction takes place in reduceStandaside()

Returns
bool Returns true if operation was a success. False if something was missing.

Definition at line 302 of file FundraiserSubscriptionPage.php.

References $mEmail, $mID, $mProcess, $mVariant, getFilteredValue(), and reduceStandaside().

Referenced by execute().

Member Data Documentation

◆ $mEmail

string FundraiserSubscriptionPage::$mEmail = ''
private

Definition at line 68 of file FundraiserSubscriptionPage.php.

Referenced by getTemplateParams(), and stashData().

◆ $mID

int FundraiserSubscriptionPage::$mID = 0
private

Definition at line 71 of file FundraiserSubscriptionPage.php.

Referenced by getTemplateParams(), and stashData().

◆ $mObjects

array [] FundraiserSubscriptionPage::$mObjects = []
private

Definition at line 59 of file FundraiserSubscriptionPage.php.

◆ $mProcess

string FundraiserSubscriptionPage::$mProcess = ''
private

Definition at line 62 of file FundraiserSubscriptionPage.php.

Referenced by stashData().

◆ $mVariant

string FundraiserSubscriptionPage::$mVariant = ''
protected

◆ FILT_EXECUTE

const FundraiserSubscriptionPage::FILT_EXECUTE = '/[a-zA-Z0-9]*/'

Definition at line 53 of file FundraiserSubscriptionPage.php.

◆ FILT_PROCESS

const FundraiserSubscriptionPage::FILT_PROCESS = '/[a-zA-Z0-9]*/'

Definition at line 50 of file FundraiserSubscriptionPage.php.

◆ FILT_VARIANT

const FundraiserSubscriptionPage::FILT_VARIANT = '/[a-zA-Z0-9_-]*/'

Definition at line 56 of file FundraiserSubscriptionPage.php.

◆ KEY_EXECUTE

const FundraiserSubscriptionPage::KEY_EXECUTE = 'execute'

Definition at line 52 of file FundraiserSubscriptionPage.php.

◆ KEY_PROCESS

const FundraiserSubscriptionPage::KEY_PROCESS = 'p'

Definition at line 49 of file FundraiserSubscriptionPage.php.

◆ KEY_VARIANT

const FundraiserSubscriptionPage::KEY_VARIANT = 'v'

Definition at line 55 of file FundraiserSubscriptionPage.php.


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