/**
  *
  * @param type $input
  * @param type $args
  * @param Parser $parser
  * @return type
  */
 public function onMagicWordBsCountCharacters($input, $args, $parser)
 {
     $parser->disableCache();
     if (empty($input)) {
         $oErrorView = new ViewTagError(wfMessage('bs-countthings-error-no-input')->plain());
         return $oErrorView->execute();
     }
     $sMode = isset($args['mode']) ? str_replace(' ', '', $args['mode']) : 'all';
     $aModes = explode(',', $sMode);
     $aAvailableModes = array('chars', 'words', 'pages', 'all');
     $sOut = '';
     $bValidModeProvided = false;
     foreach ($aModes as $sMode) {
         if (!in_array($sMode, $aAvailableModes)) {
             $oErrorView = new ViewTagError(wfMessage('bs-countthings-error-invalid-mode', $sMode)->plain());
             $sOut .= $oErrorView->execute();
             continue;
         }
         $bValidModeProvided = true;
     }
     if ($bValidModeProvided == false) {
         $aModes = array('all');
     }
     $aTitleTexts = explode(',', $input);
     foreach ($aTitleTexts as $sTitleText) {
         $oTitle = Title::newFromText(trim($sTitleText));
         if ($oTitle == null || $oTitle->exists() == false) {
             $oErrorView = new ViewTagError(wfMessage('bs-countthings-error-not-exist', $sTitleText)->plain());
             $sOut .= $oErrorView->execute();
             continue;
         }
         $sContent = BsPageContentProvider::getInstance()->getContentFromTitle($oTitle);
         //Old: last revision
         $oCountView = new ViewCountCharacters();
         $oCountView->setTitle($oTitle);
         if (in_array('all', $aModes)) {
             $iChars = strlen(preg_replace("/\\s+/", " ", $sContent));
             $iWords = sizeof(explode(' ', $sContent));
             $iPages = ceil($iChars / 2000);
             $oCountView->setChars($iChars);
             $oCountView->setWords($iWords);
             $oCountView->setPages($iPages);
             $sOut .= $oCountView->execute();
             continue;
         }
         // TODO RBV (17.02.12 15:34): Find better logic for this...
         if (in_array('chars', $aModes)) {
             $iChars = strlen(preg_replace("/\\s+/", " ", $sContent));
             $oCountView->setChars($iChars);
         }
         if (in_array('words', $aModes)) {
             $iChars = strlen(preg_replace("/\\s+/", " ", $sContent));
             $iWords = sizeof(explode(' ', $sContent));
             $oCountView->setWords($iWords);
         }
         if (in_array('pages', $aModes)) {
             $iChars = strlen(preg_replace("/\\s+/", " ", $sContent));
             $iWords = sizeof(explode(' ', $sContent));
             $iPages = ceil($iChars / 2000);
             $oCountView->setPages($iPages);
         }
         $sOut .= $oCountView->execute();
     }
     return $sOut;
 }
 /**
  *
  * @param type $input
  * @param string $args
  * @param Parser $parser
  * @return string
  */
 public function onTagBsPageAccess($input, $args, $parser)
 {
     //ignore access tag on mainpage or it will break all ajax calls without title param
     if ($parser->getTitle()->equals(Title::newMainPage()) === true) {
         return '';
     }
     $parser->disableCache();
     if (!isset($args['groups'])) {
         $oErrorView = new ViewTagError(wfMessage('bs-pageaccess-error-no-groups-given')->escaped());
         return $oErrorView->execute();
     }
     $sOldAccessGroups = $parser->getOutput()->getProperty('bs-page-access');
     if ($sOldAccessGroups) {
         $args['groups'] = $sOldAccessGroups . "," . $args['groups'];
     }
     $parser->getOutput()->setProperty('bs-page-access', $args['groups']);
     return '';
 }