MediaWiki REL1_28
ConverterRule Class Reference

Parser for rules of language conversion , parse rules in -{ }- tag. More...

Public Member Functions

 __construct ( $text, $converter)
 Constructor.
 
 generateConvTable ()
 Generate conversion table for all text.
 
 getConvTable ()
 Get conversion table.
 
 getDisplay ()
 Get display text on markup -{...}-.
 
 getFlags ()
 Get conversion flags.
 
 getRuleConvertedStr ( $variant)
 Parse rules conversion.
 
 getRuleConvertedTitle ( $variant)
 Similar to getRuleConvertedStr(), but this prefers to use original page title if $variant === $this->mConverter->mMainLanguageCode and may return false in this case (so this title conversion rule will be ignored and the original title is shown).
 
 getRules ()
 Get conversion rules string.
 
 getRulesAction ()
 Return how deal with conversion rules.
 
 getRulesDesc ()
 
 getTextInBidtable ( $variants)
 Check if variants array in convert array.
 
 getTitle ()
 Get converted title.
 
 hasRules ()
 Checks if there are conversion rules.
 
 parse ( $variant=null)
 Parse rules and flags.
 
 parseFlags ()
 Parse flags with syntax -{FLAG| ... }-.
 
 parseRules ()
 Generate conversion table.
 

Public Attributes

 $mBidtable = []
 
 $mConverter
 
 $mConvTable = []
 
 $mFlags = []
 
 $mRuleDisplay = ''
 
 $mRules = ''
 
 $mRulesAction = 'none'
 
 $mRuleTitle = false
 
 $mText
 
 $mUnidtable = []
 
 $mVariantFlags = []
 

Detailed Description

Parser for rules of language conversion , parse rules in -{ }- tag.

Author
fdcn fdcn6.nosp@m.4@gm.nosp@m.ail.c.nosp@m.om, PhiLiP phili.nosp@m.p.np.nosp@m.c@gma.nosp@m.il.c.nosp@m.om

Definition at line 27 of file ConverterRule.php.

Constructor & Destructor Documentation

◆ __construct()

ConverterRule::__construct (   $text,
  $converter 
)

Constructor.

Parameters
string$textThe text between -{ and }-
LanguageConverter$converter

Definition at line 46 of file ConverterRule.php.

Member Function Documentation

◆ generateConvTable()

ConverterRule::generateConvTable ( )

Generate conversion table for all text.

Access:\n private

Definition at line 279 of file ConverterRule.php.

References $mBidtable, $mUnidtable, as, and getTextInBidtable().

Referenced by parse().

◆ getConvTable()

ConverterRule::getConvTable ( )

Get conversion table.

(bidirectional and unidirectional conversion table)

Returns
array

Definition at line 483 of file ConverterRule.php.

References $mConvTable.

◆ getDisplay()

ConverterRule::getDisplay ( )

Get display text on markup -{...}-.

Returns
string

Definition at line 458 of file ConverterRule.php.

References $mRuleDisplay.

◆ getFlags()

ConverterRule::getFlags ( )

Get conversion flags.

Returns
array

Definition at line 499 of file ConverterRule.php.

References $mFlags.

◆ getRuleConvertedStr()

ConverterRule::getRuleConvertedStr (   $variant)

Parse rules conversion.

Access:\n private
Parameters
string$variant
Returns
string

Definition at line 215 of file ConverterRule.php.

References $mBidtable, $mRules, $mUnidtable, and getTextInBidtable().

Referenced by getRuleConvertedTitle(), and parse().

◆ getRuleConvertedTitle()

ConverterRule::getRuleConvertedTitle (   $variant)

Similar to getRuleConvertedStr(), but this prefers to use original page title if $variant === $this->mConverter->mMainLanguageCode and may return false in this case (so this title conversion rule will be ignored and the original title is shown).

Since
1.22
Parameters
string$variantThe variant code to display page title in
Returns
string|bool The converted title or false if just page name

Definition at line 255 of file ConverterRule.php.

References getRuleConvertedStr(), and getTextInBidtable().

Referenced by parse().

◆ getRules()

ConverterRule::getRules ( )

Get conversion rules string.

Returns
string

Definition at line 491 of file ConverterRule.php.

References $mRules.

◆ getRulesAction()

ConverterRule::getRulesAction ( )

Return how deal with conversion rules.

Returns
string

Definition at line 474 of file ConverterRule.php.

References $mRulesAction.

◆ getRulesDesc()

ConverterRule::getRulesDesc ( )
Access:\n private
Returns
string

Definition at line 191 of file ConverterRule.php.

References $from, and as.

Referenced by parse().

◆ getTextInBidtable()

ConverterRule::getTextInBidtable (   $variants)

Check if variants array in convert array.

Parameters
array | string$variantsVariant language code
Returns
string Translated text

Definition at line 57 of file ConverterRule.php.

References array(), and as.

Referenced by generateConvTable(), getRuleConvertedStr(), and getRuleConvertedTitle().

◆ getTitle()

ConverterRule::getTitle ( )

Get converted title.

Returns
string

Definition at line 466 of file ConverterRule.php.

References $mRuleTitle.

◆ hasRules()

ConverterRule::hasRules ( )

Checks if there are conversion rules.

Returns
bool

Definition at line 450 of file ConverterRule.php.

◆ parse()

ConverterRule::parse (   $variant = null)

Parse rules and flags.

Parameters
string$variantVariant language code

Definition at line 337 of file ConverterRule.php.

References $flags, $mFlags, $mRules, as, generateConvTable(), getRuleConvertedStr(), getRuleConvertedTitle(), getRulesDesc(), parseFlags(), parseRules(), true, and wfMessage().

◆ parseFlags()

ConverterRule::parseFlags ( )

Parse flags with syntax -{FLAG| ... }-.

Access:\n private

Definition at line 74 of file ConverterRule.php.

References $flags, $mText, as, StringUtils\explode(), and true.

Referenced by parse().

◆ parseRules()

ConverterRule::parseRules ( )

Generate conversion table.

Access:\n private

Definition at line 137 of file ConverterRule.php.

References $from, $mRules, and as.

Referenced by parse().

Member Data Documentation

◆ $mBidtable

ConverterRule::$mBidtable = []

Definition at line 37 of file ConverterRule.php.

Referenced by generateConvTable(), and getRuleConvertedStr().

◆ $mConverter

ConverterRule::$mConverter

Definition at line 29 of file ConverterRule.php.

◆ $mConvTable

ConverterRule::$mConvTable = []

Definition at line 36 of file ConverterRule.php.

Referenced by getConvTable().

◆ $mFlags

ConverterRule::$mFlags = []

Definition at line 34 of file ConverterRule.php.

Referenced by getFlags(), and parse().

◆ $mRuleDisplay

ConverterRule::$mRuleDisplay = ''

Definition at line 30 of file ConverterRule.php.

Referenced by getDisplay().

◆ $mRules

ConverterRule::$mRules = ''

Definition at line 32 of file ConverterRule.php.

Referenced by getRuleConvertedStr(), getRules(), parse(), and parseRules().

◆ $mRulesAction

ConverterRule::$mRulesAction = 'none'

Definition at line 33 of file ConverterRule.php.

Referenced by getRulesAction().

◆ $mRuleTitle

ConverterRule::$mRuleTitle = false

Definition at line 31 of file ConverterRule.php.

Referenced by getTitle().

◆ $mText

ConverterRule::$mText

Definition at line 28 of file ConverterRule.php.

Referenced by parseFlags().

◆ $mUnidtable

ConverterRule::$mUnidtable = []

Definition at line 38 of file ConverterRule.php.

Referenced by generateConvTable(), and getRuleConvertedStr().

◆ $mVariantFlags

ConverterRule::$mVariantFlags = []

Definition at line 35 of file ConverterRule.php.


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