本文整理匯總了PHP中OW::getConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP OW::getConfig方法的具體用法?PHP OW::getConfig怎麽用?PHP OW::getConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OW
的用法示例。
在下文中一共展示了OW::getConfig方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* Default action
*/
public function index()
{
$lang = OW::getLanguage();
OW::getDocument()->setHeading($lang->text('ocssitestats', 'admin_page_heading'));
OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
$pluginManager = OW::getPluginManager();
$pluginsActivated = array('total_users' => true, 'online_users' => true, 'new_users_today' => true, 'new_users_this_month' => true, 'photos' => $pluginManager->isPluginActive('photo'), 'videos' => $pluginManager->isPluginActive('video'), 'blogs' => $pluginManager->isPluginActive('blogs'), 'groups' => $pluginManager->isPluginActive('groups'), 'events' => $pluginManager->isPluginActive('event'), 'discussions' => $pluginManager->isPluginActive('forum'), 'links' => $pluginManager->isPluginActive('links'));
$config = OW::getConfig();
if (OW::getRequest()->isPost() && !empty($_POST['action'])) {
switch ($_POST['action']) {
case 'update_metrics':
$conf = array();
foreach ($pluginsActivated as $key => $m) {
$conf[$key] = $pluginsActivated[$key] && !empty($_POST['metrics'][$key]) && $_POST['metrics'][$key];
}
$config->saveConfig('ocssitestats', 'metrics', json_encode($conf));
OW::getFeedback()->info($lang->text('ocssitestats', 'settings_updated'));
$this->redirect();
break;
case 'update_settings':
$config->saveConfig('ocssitestats', 'zero_values', !empty($_POST['zero_values']));
OW::getFeedback()->info($lang->text('ocssitestats', 'settings_updated'));
$this->redirect();
break;
}
}
$metricsConf = json_decode($config->getValue('ocssitestats', 'metrics'), true);
$this->assign('metrics', $metricsConf);
$zeroValues = $config->getValue('ocssitestats', 'zero_values');
$this->assign('zeroValues', $zeroValues);
$this->assign('pluginsActivated', $pluginsActivated);
$logo = OW::getPluginManager()->getPlugin('ocssitestats')->getStaticUrl() . 'img/oxwallcandystore-logo.jpg';
$this->assign('logo', $logo);
}
示例2: render
public function render()
{
$defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
$this->assign('defaultAvatarUrl', $defaultAvatarUrl);
$js = "OW.Mailbox.conversationController = new MAILBOX_ConversationView();";
OW::getDocument()->addOnloadScript($js, 3006);
//TODO check this config
$enableAttachments = OW::getConfig()->getValue('mailbox', 'enable_attachments');
$this->assign('enableAttachments', $enableAttachments);
$replyToMessageActionPromotedText = '';
$isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_message');
$isAuthorizedReplyToMessage = $isAuthorizedReplyToMessage || OW::getUser()->isAuthorized('mailbox', 'send_chat_message');
if (!$isAuthorizedReplyToMessage) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_message');
if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
$replyToMessageActionPromotedText = $status['msg'];
}
}
$this->assign('isAuthorizedReplyToMessage', $isAuthorizedReplyToMessage);
$isAuthorizedReplyToChatMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message');
if (!$isAuthorizedReplyToChatMessage) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_chat_message');
if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
$replyToMessageActionPromotedText = $status['msg'];
}
}
$this->assign('isAuthorizedReplyToChatMessage', $isAuthorizedReplyToChatMessage);
$this->assign('replyToMessageActionPromotedText', $replyToMessageActionPromotedText);
if ($isAuthorizedReplyToMessage) {
$text = new WysiwygTextarea('mailbox_message');
$text->setId('conversationTextarea');
$this->assign('mailbox_message', $text->renderInput());
}
return parent::render();
}
示例3: __construct
public function __construct($layout, $params)
{
parent::__construct();
if (empty($params['available'])) {
if (!empty($params['msg'])) {
$msg = $params['msg'];
} else {
$msg = OW::getLanguage()->text('base', 'authorization_failed_feedback');
}
$this->assign('authError', $msg);
return;
}
switch ($layout) {
case 'page':
$class = ' ow_photoview_info_onpage';
break;
default:
if ((bool) OW::getConfig()->getValue('photo', 'photo_view_classic')) {
$class = ' ow_photoview_pint_mode';
} else {
$class = '';
}
break;
}
$this->assign('class', $class);
$this->assign('layout', $layout);
}
示例4: __construct
public function __construct($name)
{
parent::__construct($name);
$this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup'));
$this->setAjax();
$lang = OW::getLanguage();
$affName = new TextField('name');
$affName->setRequired(true);
$affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
$this->addElement($affName);
$email = new TextField('email');
$email->setRequired(true);
$email->setLabel($lang->text('ocsaffiliates', 'email'));
$email->addValidator(new EmailValidator());
$this->addElement($email);
$password = new PasswordField('password');
$password->setRequired(true);
$password->setLabel($lang->text('ocsaffiliates', 'password'));
$this->addElement($password);
$payment = new Textarea('payment');
$payment->setRequired(true);
$payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
$this->addElement($payment);
if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) {
$terms = new CheckboxField('terms');
$validator = new RequiredValidator();
$validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg'));
$terms->addValidator($validator);
$this->addElement($terms);
}
$submit = new Submit('signup');
$submit->setValue($lang->text('ocsaffiliates', 'signup_btn'));
$this->addElement($submit);
$this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n if ( !data.result ) {\n OW.error(data.error);\n }\n else {\n document.location.reload();\n }\n }");
}
示例5: detectContext
private static function detectContext()
{
if (self::$context !== null) {
return;
}
if (defined('OW_USE_CONTEXT')) {
switch (true) {
case OW_USE_CONTEXT == 1:
self::$context = self::CONTEXT_DESKTOP;
return;
case OW_USE_CONTEXT == 1 << 1:
self::$context = self::CONTEXT_MOBILE;
return;
case OW_USE_CONTEXT == 1 << 2:
self::$context = self::CONTEXT_API;
return;
}
}
$context = self::CONTEXT_DESKTOP;
try {
$isSmart = UTIL_Browser::isSmartphone();
} catch (Exception $e) {
return;
}
if (defined('OW_CRON')) {
$context = self::CONTEXT_DESKTOP;
} else {
if (self::getSession()->isKeySet(OW_Application::CONTEXT_NAME)) {
$context = self::getSession()->get(OW_Application::CONTEXT_NAME);
} else {
if ($isSmart) {
$context = self::CONTEXT_MOBILE;
}
}
}
if (defined('OW_USE_CONTEXT')) {
if ((OW_USE_CONTEXT & 1 << 1) == 0 && $context == self::CONTEXT_MOBILE) {
$context = self::CONTEXT_DESKTOP;
}
if ((OW_USE_CONTEXT & 1 << 2) == 0 && $context == self::CONTEXT_API) {
$context = self::CONTEXT_DESKTOP;
}
}
if ((bool) OW::getConfig()->getValue('base', 'disable_mobile_context') && $context == self::CONTEXT_MOBILE) {
$context = self::CONTEXT_DESKTOP;
}
//temp API context detection
//TODO remake
$uri = UTIL_Url::getRealRequestUri(OW::getRouter()->getBaseUrl(), $_SERVER['REQUEST_URI']);
if (mb_strstr($uri, '/')) {
if (trim(mb_substr($uri, 0, mb_strpos($uri, '/'))) == 'api') {
$context = self::CONTEXT_API;
}
} else {
if (trim($uri) == 'api') {
$context = self::CONTEXT_API;
}
}
self::$context = $context;
}
示例6: processCleanUp
public function processCleanUp()
{
$configs = OW::getConfig()->getValues('cacheextreme');
//clean template cache
if ($configs['template_cache']) {
OW_ViewRenderer::getInstance()->clearCompiledTpl();
}
//clean db backend cache
if ($configs['backend_cache']) {
OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_ALL);
}
//clean themes static contents cache
if ($configs['theme_static']) {
OW::getThemeManager()->getThemeService()->processAllThemes();
}
//clean plugins static contents cache
if ($configs['plugin_static']) {
$pluginService = BOL_PluginService::getInstance();
$activePlugins = $pluginService->findActivePlugins();
/* @var $pluginDto BOL_Plugin */
foreach ($activePlugins as $pluginDto) {
$pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS;
if (file_exists($pluginStaticDir)) {
$staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS;
if (file_exists($staticDir)) {
UTIL_File::removeDir($staticDir);
}
mkdir($staticDir);
chmod($staticDir, 0777);
UTIL_File::copyDir($pluginStaticDir, $staticDir);
}
}
}
}
示例7: index
public function index()
{
$language = OW::getLanguage();
$config = OW::getConfig();
OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_mobile_settings'));
OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
$settingsForm = new Form('mobile_settings');
$disableMobile = new CheckboxField('disable_mobile');
$disableMobile->setLabel($language->text('admin', 'mobile_settings_mobile_context_disable_label'));
$disableMobile->setDescription($language->text('admin', 'mobile_settings_mobile_context_disable_desc'));
$settingsForm->addElement($disableMobile);
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$settingsForm->addElement($submit);
$this->addForm($settingsForm);
if (OW::getRequest()->isPost()) {
if ($settingsForm->isValid($_POST)) {
$data = $settingsForm->getValues();
$config->saveConfig('base', 'disable_mobile_context', (bool) $data['disable_mobile']);
OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message'));
} else {
OW::getFeedback()->error('Error');
}
$this->redirect();
}
$disableMobile->setValue($config->getValue('base', 'disable_mobile_context'));
}
示例8: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$uniqId = uniqid('questionAdd');
$this->assign('uniqId', $uniqId);
$config = OW::getConfig()->getValues(EQUESTIONS_Plugin::PLUGIN_KEY);
$this->assign('configs', $config);
$form = $this->initForm();
$this->addForm($form);
EQUESTIONS_Plugin::getInstance()->addStatic();
$attachmentsId = null;
if ($config['attachments']) {
$types = array();
if ($config['attachments_image']) {
$types[] = 'image';
}
if ($config['attachments_video']) {
$types[] = 'video';
}
if ($config['attachments_link']) {
$types[] = 'link';
}
$attachments = new EQUESTIONS_CMP_Attachments($types);
$attachments->initJs();
$this->addComponent('attachments', $attachments);
$attachmentsId = $attachments->getUniqId();
}
$js = UTIL_JsGenerator::newInstance()->newObject('questionsAdd', 'QUESTIONS_QuestionAdd', array($uniqId, $form->getName(), array('maxQuestionLength' => 500, 'minQuestionLength' => 3, 'maxAnswerLength' => 150), $attachmentsId));
OW::getDocument()->addOnloadScript($js);
}
示例9: getTabs
protected function getTabs()
{
$language = OW::getLanguage();
$service = UHEADER_BOL_Service::getInstance();
$photoBridge = UHEADER_CLASS_PhotoBridge::getInstance();
$templatesCount = $service->findTemplatesCountForUser($this->userId);
if ($templatesCount > 0 || !$photoBridge->isActive()) {
$activeTab = "gallery";
} else {
$activeTab = "photos";
}
$tabs = array();
if ($templatesCount > 0) {
$tabKey = "gallery";
$dimensions = $this->getDimensions();
//$dimensions["height"] -= 45;
if (OW::getConfig()->getValue('uheader', 'tpl_view_mode') == "list") {
$coverGallery = new UHEADER_CMP_CoverGallery($this->userId, $tabKey, $dimensions);
} else {
$coverGallery = new UHEADER_CMP_CoverPreviewGallery($this->userId, $tabKey, $dimensions);
}
$coverGallery->assign("dimensions", $this->getDimensions());
$tabs[] = array("label" => $language->text("uheader", "gallery_tab_gallery"), "key" => $tabKey, "active" => $tabKey == $activeTab, "content" => $coverGallery->render());
}
$tabKey = "photos";
$photoList = new UHEADER_CMP_MyPhotos($this->userId, $tabKey);
$tabs[] = array("label" => $language->text("uheader", "gallery_tab_photos"), "key" => $tabKey, "active" => $tabKey == $activeTab, "content" => $photoList->render());
return $tabs;
}
示例10: __construct
public function __construct($layout)
{
parent::__construct();
$status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'view');
if ($status['status'] == BOL_AuthorizationService::STATUS_DISABLED) {
$this->assign('authError', $status['msg']);
return;
}
$class = "";
switch ($layout) {
case 'page':
$class = ' ow_photoview_info_onpage';
break;
default:
if ((bool) OW::getConfig()->getValue('photo', 'photo_view_classic')) {
$class = ' ow_photoview_pint_mode';
} else {
$class = '';
}
break;
}
$this->assign('class ', $class);
$this->assign('layout ', $layout);
$document = OW::getDocument();
$js = "\$('#btn-save-as-avatar').off().on('click', function() {\n console.log('photo floatbox call js');\n var photoId = \$('#btn-photo-edit') . attr('rel');\n\n document.avatarFloatBox = OW.ajaxFloatBox(\n 'BASE_CMP_AvatarChange', {\n params: {\n step: 2, entityType: 'photo_album', entityId: '', id: photoId\n }}, {\n width: 749, title: OW.getLanguageText('base', 'avatar_change')}\n );\n })";
$document->addOnloadScript($js);
}
示例11: index
public function index()
{
$this->setPageHeading(OW::getLanguage()->text('admin', 'admin_dashboard'));
$this->setPageHeadingIconClass('ow_ic_dashboard');
$this->assign('version', OW::getConfig()->getValue('base', 'soft_version'));
$this->assign('build', OW::getConfig()->getValue('base', 'soft_build'));
}
示例12: run
public function run()
{
$config = OW::getConfig();
// check if uninstall is in progress
if (!$config->getValue('groups', 'uninstall_inprogress')) {
return;
}
if (!$config->configExists('groups', 'uninstall_cron_busy')) {
$config->addConfig('groups', 'uninstall_cron_busy', 0);
}
// check if cron queue is not busy
if ($config->getValue('groups', 'uninstall_cron_busy')) {
return;
}
$config->saveConfig('groups', 'uninstall_cron_busy', 1);
$service = GROUPS_BOL_Service::getInstance();
try {
$groups = $service->findLimitedList(self::GROUPS_DELETE_LIMIT);
if (empty($groups)) {
BOL_PluginService::getInstance()->uninstall('groups');
OW::getApplication()->setMaintenanceMode(false);
return;
}
foreach ($groups as $group) {
$service->deleteGroup($group->id);
}
$config->saveConfig('groups', 'uninstall_cron_busy', 0);
} catch (Exception $e) {
$config->saveConfig('groups', 'uninstall_cron_busy', 0);
throw $e;
}
}
示例13: settings
public function settings()
{
$adminForm = new Form('adminForm');
$language = OW::getLanguage();
$config = OW::getConfig();
$element = new TextField('autoclick');
$element->setRequired(true);
$validator = new IntValidator(1);
$validator->setErrorMessage($language->text('autoviewmore', 'admin_invalid_number_error'));
$element->addValidator($validator);
$element->setLabel($language->text('autoviewmore', 'admin_auto_click'));
$element->setValue($config->getValue('autoviewmore', 'autoclick'));
$adminForm->addElement($element);
$element = new Submit('saveSettings');
$element->setValue($language->text('autoviewmore', 'admin_save_settings'));
$adminForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($adminForm->isValid($_POST)) {
$values = $adminForm->getValues();
$config = OW::getConfig();
$config->saveConfig('autoviewmore', 'autoclick', $values['autoclick']);
OW::getFeedback()->info($language->text('autoviewmore', 'user_save_success'));
}
}
$this->addForm($adminForm);
}
示例14: getList
public function getList(array $params)
{
OW::getDocument()->setHeading(OW::getLanguage()->text('bookmarks', 'list_headint_title'));
$this->setTemplate(OW::getPluginManager()->getPlugin('bookmarks')->getCtrlViewDir() . 'list.html');
$userId = OW::getUser()->getId();
$page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
$userOnPage = (int) OW::getConfig()->getValue('base', 'users_on_page');
$first = ($page - 1) * $userOnPage;
$list = $this->service->findBookmarksUserIdList($userId, $first, $userOnPage, $params['category']);
$count = $this->service->findBookmarksCount($userId, $params['category']);
$sexValue = array();
$userDataList = array();
$questionService = BOL_QuestionService::getInstance();
$data = $questionService->getQuestionData($list, array('sex', 'googlemap_location', 'birthdate'));
foreach (BOL_QuestionValueDao::getInstance()->findQuestionValues('sex') as $sexDto) {
$sexValue[$sexDto->value] = $questionService->getQuestionValueLang('sex', $sexDto->value);
}
foreach ($data as $userId => $user) {
if (isset($user['birthdate'])) {
$date = UTIL_DateTime::parseDate($user['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
} else {
$age = '';
}
$userDataList[$userId] = array('info_gender' => !empty($user['sex']) && !empty($sexValue[$user['sex']]) ? $sexValue[$user['sex']] : '' . ' ' . $age, 'location' => !empty($user['googlemap_location']) ? $user['googlemap_location']['address'] : '');
}
$this->addComponent('list', OW::getClassInstance('BASE_CMP_Users', $userDataList, array(), $count));
}
示例15: ganalytics_admin_notification
function ganalytics_admin_notification(BASE_CLASS_EventCollector $event)
{
$wpid = OW::getConfig()->getValue('ganalytics', 'web_property_id');
if (empty($wpid)) {
$event->add(OW::getLanguage()->text('ganalytics', 'admin_notification_text', array('link' => OW::getRouter()->urlForRoute('ganalytics_admin'))));
}
}