* @param array $variantfallback the fallback language of each variant
* @param array $markup array defining the markup used for manual conversion
* @param array $flags array defining the custom strings that maps to the flags
+ * @param array $manualLevel limit for supported variants
* @public
*/
function __construct($langobj, $maincode,
$this->mTitleDisplay = $title;
}
- //add manual conversion table to global table
+ //apply manual conversion table to global table
$convTable = $convRule->getConvTable();
- $isAdd = $convRule->getRulesAction()=="add";
- $isRemove = $convRule->getRulesAction()=="remove";
+ $action = $convRule->getRulesAction();
foreach($convTable as $v=>$t) {
if( !in_array($v,$this->mVariants) )continue;
- if( $isAdd )
+ if( $action=="add" )
$this->mTables[$v]->mergeArray($t);
- elseif ( $isRemove )
+ elseif ( $action=="remove" )
$this->mTables[$v]->removeArray($t);
}
}
$rules = $text;
}
- if( !in_array('R',$flags) ){
- //FIXME: may cause trouble here...
- //strip since it interferes with the parsing, plus,
- //all spaces should be stripped in this tag anyway.
- $rules = str_replace(' ', '', $rules);
- $rules = str_replace('=>','=>',$rules);
- }
-
//check flags
if( in_array('R',$flags) ){
$flags = array('R');// remove other flags
* @private
*/
function generateConvTable(){
- //$rules = $this->mRules;
$flags = $this->mFlags;
$bidtable = $this->mBidtable;
$unidtable = $this->mUnidtable;
if(!$variant) $variant = $this->mConverter->getPreferredVariant();
$this->parseFlags();
- $this->parseRules();
+ $flags = $this->mFlags;
+ if( !in_array('R',$flags) || !in_array('N',$flags) ){
+ //FIXME: may cause trouble here...
+ //strip since it interferes with the parsing, plus,
+ //all spaces should be stripped in this tag anyway.
+ $this->mRules = str_replace(' ', '', $this->mRules);
+ // decode => HTML entities modified by Sanitizer::removeHTMLtags
+ $this->mRules = str_replace('=>','=>',$this->mRules);
+
+ $this->parseRules();
+ }
$rules = $this->mRules;
- $flags = $this->mFlags;
if(count($this->mBidtable)==0 && count($this->mUnidtable)==0){
if(in_array('+',$flags) || in_array('-',$flags))
} else {
$this->mRuleDisplay= $this->mManualCodeError;
}
- // proces T flag : output nothing
+ // proces T flag
if ( in_array('T',$flags) ) {
$this->mRuleTitle = $this->getRuleConvertedStr($variant,
$this->mConverter->mDoTitleConvert);
/**
* get display text on markup -{...}-
- * @param string $variant the current variant
* @public
*/
function getDisplay(){
}
/**
* get converted title
- * @param string $variant the current variant
* @public
*/
function getTitle(){