public static function onWFAfterErrorDetection($cv_id, $city_id, $cv_name, $cv_value, &$return, &$error) { wfProfileIn(__METHOD__); if (self::isWikiaBarConfig($city_id, $cv_name)) { /* @var $validator WikiaBarMessageDataValidator */ $validator = new WikiaBarMessageDataValidator(); $model = new WikiaBarModel(); $errorCount = 0; $errors = array(); if (is_array($cv_value)) { foreach ($cv_value as $vertical => $languages) { foreach ($languages as $language => $content) { $validator->clearErrors(); $model->parseBarConfigurationMessage(trim($content), $validator); $messageErrorCount = $validator->getErrorCount(); if ($messageErrorCount) { $errorMessages = $validator->getErrors(); foreach ($errorMessages as &$errorMessage) { $errorMessage = Wikia::errormsg('vertical: ' . $vertical . ', language: ' . $language . ' : ' . $errorMessage); } $errors = array_merge($errors, $errorMessages); $errorCount += $messageErrorCount; } } } } if ($errorCount) { $error = $errorCount; $return = trim(implode("<br/>", $errors)); } } wfProfileOut(__METHOD__); return true; }
/** * @desc Contents for Weebo * @param Array $params request params */ public function anon() { wfProfileIn(__METHOD__); $params = $this->request->getParams(); $lang = !empty($params['lang']) ? $params['lang'] : WikiaBarModel::WIKIA_BAR_DEFAULT_LANG_CODE; $vertical = !empty($params['vertical']) ? $params['vertical'] : HubService::getCategoryInfoForCity($this->wg->cityId)->cat_id; /** @var $model WikiaBarModel */ $model = new WikiaBarModel(); $vertical = $model->mapVerticalToMain($vertical); $model->setLang($lang); $model->setVertical($vertical); $barContents = $model->getBarContents(); $this->barContents = $barContents['data']; $this->status = $barContents['status']; wfProfileOut(__METHOD__); }