private function __construct($includeCache = true) { $this->languageDao = BOL_LanguageDao::getInstance(); $this->prefixDao = BOL_LanguagePrefixDao::getInstance(); $this->keyDao = BOL_LanguageKeyDao::getInstance(); $this->valueDao = BOL_LanguageValueDao::getInstance(); $this->languageCacheDir = OW::getPluginManager()->getPlugin('base')->getPluginFilesDir(); if ($includeCache) { $this->loadFromCahce(); } }
/** * BOL_LanguageService constructor. * @param bool $includeCache */ private function __construct($includeCache = true) { $this->languageDao = BOL_LanguageDao::getInstance(); $this->prefixDao = BOL_LanguagePrefixDao::getInstance(); $this->keyDao = BOL_LanguageKeyDao::getInstance(); $this->valueDao = BOL_LanguageValueDao::getInstance(); if ($includeCache) { $this->loadFromCache(); } }
public function countSearchResultKeys($languageId, $search) { $search = $this->dbo->escapeString($search); $_query = "\n\t\t\t SELECT COUNT(*)\n\t\t\t FROM `" . BOL_LanguageValueDao::getInstance()->getTableName() . "` as `v`\n\t\t\t INNER JOIN `" . BOL_LanguageKeyDao::getInstance()->getTableName() . "` as `k`\n\t\t\t ON( `v`.`keyId` = `k`.`id` )\n\t\t\t INNER JOIN `" . BOL_LanguagePrefixDao::getInstance()->getTableName() . "` as `p`\n\t\t\t ON( `k`.`prefixId` = `p`.`id` )\n\t\t\t WHERE `v`.`value` LIKE ? AND `v`.`languageId` = ? \n\t\t\t"; return $this->dbo->queryForColumn($_query, array("%{$search}%", $languageId)); }
public function hint(array $params = array()) { $this->document->addStyleSheet($this->plugin->getStaticCssUrl() . $this->theme . '.css'); $this->document->addStyleSheet($this->plugin->getStaticCssUrl() . 'tipTip.css'); $this->document->addScript($this->plugin->getStaticJsUrl() . 'jquery.tipTip.minified.js'); $features = array_filter(@get_object_vars(json_decode(OW::getConfig()->getValue('profileprogressbar', 'features')))); $_features = array(); foreach ($features as $feature => $count) { $_features[$feature] = OW::getLanguage()->text('profileprogressbar', $feature . '_desc'); $_features[$feature . 'Count'] = $count; } $form = new PROFILEPROGRESSBAR_CLASS_HintForm(); function unsetUnusedHint($val) { return strpos($val, '{$') === FALSE; } function getHint($_features) { $vars = array(); foreach ($_features as $key => $value) { $vars['{$' . $key . '}'] = $value; } $hintText = explode('#', OW::getLanguage()->text('profileprogressbar', 'hint_text')); foreach ($hintText as $key => $hint) { $hintText[$key] = str_replace(array_keys($vars), array_values($vars), $hint); } $hintText = array_filter($hintText, 'unsetUnusedHint'); return trim(implode('', $hintText)); } if (OW::getRequest()->isAjax() && $form->isValid($_POST)) { OW::getConfig()->saveConfig('profileprogressbar', 'show_hint', (int) $form->getElement('show-hint')->getValue()); $languageService = BOL_LanguageService::getInstance(); $langKey = $languageService->findKey('profileprogressbar', 'hint_text'); $langValue = BOL_LanguageValueDao::getInstance()->findValue($languageService->getCurrent()->getId(), $langKey->getId()); $langValue->setValue($_POST['hint-text']); BOL_LanguageService::getInstance()->saveValue($langValue); exit(json_encode(array('content' => getHint($_features)))); } $hintText = getHint($_features); OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(';$("#profile-progressbar").tipTip({ maxWidth: "auto", content: {$hint} });', array('hint' => $hintText))); $this->addForm($form); }
public function findMissingKeyCount($languageId) { $query = "\n SELECT COUNT(*)\n FROM `" . BOL_LanguageKeyDao::getInstance()->getTableName() . "` as k\n LEFT JOIN `" . BOL_LanguageValueDao::getInstance()->getTableName() . "` as v\n ON( k.id = v.keyId and v.`languageId` = ? )\n INNER JOIN `" . BOL_LanguagePrefixDao::getInstance()->getTableName() . "` as p\n ON(k.`prefixId` = p.id)\n WHERE v.keyId IS NULL OR (`v`.`value` IS NOT NULL AND LENGTH(`v`.`value`) = 0 )\n\t\t\t"; return $this->dbo->queryForColumn($query, array($languageId)); }