public function index($params) { if (empty($params['documentKey'])) { throw new Redirect404Exception(); } $language = OW::getLanguage(); $documentKey = $params['documentKey']; $document = $this->navService->findDocumentByKey($documentKey); if ($document === null) { throw new Redirect404Exception(); } $menuItem = $this->navService->findMenuItemByDocumentKey($document->getKey()); if ($menuItem !== null) { if (!$menuItem->getVisibleFor() || $menuItem->getVisibleFor() == BOL_NavigationService::VISIBLE_FOR_GUEST && OW::getUser()->isAuthenticated()) { throw new Redirect403Exception(); } if ($menuItem->getVisibleFor() == BOL_NavigationService::VISIBLE_FOR_MEMBER && !OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } } $this->assign('content', $language->text('base', "local_page_content_{$document->getKey()}")); $this->setPageHeading($language->text('base', "local_page_title_{$document->getKey()}")); $this->setPageTitle($language->text('base', "local_page_title_{$document->getKey()}")); $this->documentKey = $document->getKey(); $this->setDocumentKey($document->getKey()); OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, array($this, 'setCustomMetaInfo')); }
/** * Returns an instance of class (singleton pattern implementation). * * @return BOL_NavigationService */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
/** * Constructor. */ public function __construct() { parent::__construct(); $this->name = BOL_NavigationService::MENU_TYPE_MAIN; $menuItems = BOL_NavigationService::getInstance()->findMenuItems(BOL_NavigationService::MENU_TYPE_MAIN); $this->setMenuItems(BOL_NavigationService::getInstance()->getMenuItems($menuItems)); }
/** * @see OW_MasterPage::init() */ protected function init() { $language = OW::getLanguage(); OW::getThemeManager()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(BOL_ThemeService::DEFAULT_THEME)); $menuTypes = array(BOL_NavigationService::MENU_TYPE_ADMIN, BOL_NavigationService::MENU_TYPE_APPEARANCE, BOL_NavigationService::MENU_TYPE_PAGES, BOL_NavigationService::MENU_TYPE_PLUGINS, BOL_NavigationService::MENU_TYPE_SETTINGS, BOL_NavigationService::MENU_TYPE_USERS, BOL_NavigationService::MENU_TYPE_MOBILE); $menuItems = BOL_NavigationService::getInstance()->findMenuItemsForMenuList($menuTypes); if (defined('OW_PLUGIN_XP')) { foreach ($menuItems as $key1 => $menuType) { foreach ($menuType as $key2 => $menuItem) { if (in_array($menuItem['key'], array('sidebar_menu_plugins_add', 'sidebar_menu_themes_add'))) { unset($menuItems[$key1][$key2]); } } } } $menuDataArray = array('menu_admin' => BOL_NavigationService::MENU_TYPE_ADMIN, 'menu_users' => BOL_NavigationService::MENU_TYPE_USERS, 'menu_settings' => BOL_NavigationService::MENU_TYPE_SETTINGS, 'menu_appearance' => BOL_NavigationService::MENU_TYPE_APPEARANCE, 'menu_pages' => BOL_NavigationService::MENU_TYPE_PAGES, 'menu_plugins' => BOL_NavigationService::MENU_TYPE_PLUGINS, 'menu_mobile' => BOL_NavigationService::MENU_TYPE_MOBILE); foreach ($menuDataArray as $key => $value) { $this->menuCmps[$key] = new ADMIN_CMP_AdminMenu($menuItems[$value]); $this->addMenu($value, $this->menuCmps[$key]); } $event = new ADMIN_CLASS_NotificationCollector('admin.add_admin_notification'); OW::getEventManager()->trigger($event); $this->assign('notifications', $event->getData()); // platform info $event = new OW_Event('admin.get_soft_version_text'); OW_EventManager::getInstance()->trigger($event); $verString = $event->getData(); if (empty($verString)) { $verString = OW::getLanguage()->text('admin', 'soft_version', array('version' => OW::getConfig()->getValue('base', 'soft_version'), 'build' => OW::getConfig()->getValue('base', 'soft_build'))); } $this->assign('version', OW::getConfig()->getValue('base', 'soft_version')); $this->assign('build', OW::getConfig()->getValue('base', 'soft_build')); $this->assign('softVersion', $verString); }
public function staticDocument($params) { $navService = BOL_NavigationService::getInstance(); if (empty($params['documentKey'])) { throw new Redirect404Exception(); } $language = OW::getLanguage(); $documentKey = $params['documentKey']; $document = $navService->findDocumentByKey($documentKey); if ($document === null) { throw new Redirect404Exception(); } $menuItem = $navService->findMenuItemByDocumentKey($document->getKey()); if ($menuItem !== null) { if (!$menuItem->getVisibleFor() || $menuItem->getVisibleFor() == BOL_NavigationService::VISIBLE_FOR_GUEST && OW::getUser()->isAuthenticated()) { throw new Redirect403Exception(); } if ($menuItem->getVisibleFor() == BOL_NavigationService::VISIBLE_FOR_MEMBER && !OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } } $settings = BOL_MobileNavigationService::getInstance()->getItemSettings($menuItem); $title = $settings[BOL_MobileNavigationService::SETTING_TITLE]; $this->assign('content', $settings[BOL_MobileNavigationService::SETTING_CONTENT]); $this->setPageHeading($settings[BOL_MobileNavigationService::SETTING_TITLE]); $this->setPageTitle($settings[BOL_MobileNavigationService::SETTING_TITLE]); $this->setDocumentKey($document->getKey()); //OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, array($this, 'setCustomMetaInfo')); }
/** * Deletes menu item. * * @param string $prefix * @param string $key */ public function deleteMenuItem($prefix, $key) { $menuItem = $this->navService->findMenuItem($prefix, $key); if ($menuItem !== null) { $this->navService->deleteMenuItem($menuItem); } }
public function index($params) { $id = (int) $params['id']; $this->assign('id', $id); $menu = BOL_NavigationService::getInstance()->findMenuItemById($id); $service = BOL_NavigationService::getInstance(); $form = new EditExternalPageForm('edit-form', $menu); if (OW::getRequest()->isPost() && $form->isValid($_POST)) { $data = $form->getValues(); $visibleFor = 0; $arr = !empty($data['visible-for']) ? $data['visible-for'] : array(); foreach ($arr as $val) { $visibleFor += $val; } $service->saveMenuItem($menu->setExternalUrl($data['url'])->setVisibleFor($visibleFor)->setNewWindow(!empty($_POST['ext-open-in-new-window']) && $_POST['ext-open-in-new-window'] == 'on')); $languageService = BOL_LanguageService::getInstance(); $plugin = OW::getPluginManager()->getPlugin('base'); $langKey = $languageService->findKey($plugin->getKey(), $menu->getKey()); if (empty($langKey)) { $langPrefixDto = $languageService->findPrefix($menu->getPrefix()); $langKey = $languageService->addKey($langPrefixDto->getId(), $menu->getKey()); } $langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId()); if (empty($langValue)) { $languageService->addValue($languageService->getCurrent()->getId(), $menu->getPrefix(), $langKey->getKey(), $data['name']); } else { $languageService->saveValue($langValue->setValue($data['name'])); } $adminPlugin = OW::getPluginManager()->getPlugin('admin'); OW::getFeedback()->info(OW::getLanguage()->text($adminPlugin->getKey(), 'updated_msg')); $this->redirect(); } $this->addForm($form); }
/** * @see OW_MasterPage::init() */ protected function init() { $language = OW::getLanguage(); OW::getThemeManager()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(BOL_ThemeService::DEFAULT_THEME)); $menuTypes = array(BOL_NavigationService::MENU_TYPE_ADMIN, BOL_NavigationService::MENU_TYPE_APPEARANCE, BOL_NavigationService::MENU_TYPE_PRIVACY, BOL_NavigationService::MENU_TYPE_PAGES, BOL_NavigationService::MENU_TYPE_PLUGINS, BOL_NavigationService::MENU_TYPE_SETTINGS, BOL_NavigationService::MENU_TYPE_USERS, BOL_NavigationService::MENU_TYPE_MOBILE); $menuItems = BOL_NavigationService::getInstance()->findMenuItemsForMenuList($menuTypes); if (defined('OW_PLUGIN_XP')) { foreach ($menuItems as $key1 => $menuType) { foreach ($menuType as $key2 => $menuItem) { if (in_array($menuItem['key'], array('sidebar_menu_plugins_add', 'sidebar_menu_themes_add'))) { unset($menuItems[$key1][$key2]); } } } } $menuDataArray = array('menu_admin' => BOL_NavigationService::MENU_TYPE_ADMIN, 'menu_users' => BOL_NavigationService::MENU_TYPE_USERS, 'menu_settings' => BOL_NavigationService::MENU_TYPE_SETTINGS, 'menu_privacy' => BOL_NavigationService::MENU_TYPE_PRIVACY, 'menu_appearance' => BOL_NavigationService::MENU_TYPE_APPEARANCE, 'menu_pages' => BOL_NavigationService::MENU_TYPE_PAGES, 'menu_plugins' => BOL_NavigationService::MENU_TYPE_PLUGINS, 'menu_mobile' => BOL_NavigationService::MENU_TYPE_MOBILE); foreach ($menuDataArray as $key => $value) { $this->menuCmps[$key] = new ADMIN_CMP_AdminMenu($menuItems[$value]); $this->addMenu($value, $this->menuCmps[$key]); } // admin notifications $adminNotifications = array(); if (!defined('OW_PLUGIN_XP') && OW::getConfig()->getValue('base', 'update_soft')) { $adminNotifications[] = $language->text('admin', 'notification_soft_update', array('link' => OW::getRouter()->urlForRoute('admin_core_update_request'))); } $pluginsCount = BOL_PluginService::getInstance()->getPluginsToUpdateCount(); if (!defined('OW_PLUGIN_XP') && $pluginsCount > 0) { $adminNotifications[] = $language->text('admin', 'notification_plugins_to_update', array('link' => OW::getRouter()->urlForRoute('admin_plugins_installed'), 'count' => $pluginsCount)); } $themesCount = BOL_ThemeService::getInstance()->getThemesToUpdateCount(); if (!defined('OW_PLUGIN_XP') && $themesCount > 0) { $adminNotifications[] = $language->text('admin', 'notification_themes_to_update', array('link' => OW::getRouter()->urlForRoute('admin_themes_choose'), 'count' => $themesCount)); } $event = new BASE_CLASS_EventCollector('admin.add_admin_notification'); OW::getEventManager()->trigger($event); $adminNotifications = array_merge($adminNotifications, $event->getData()); $this->assign('notifications', $adminNotifications); $adminWarnings = array(); if (!defined('OW_PLUGIN_XP') && OW::getConfig()->configExists('base', 'cron_is_active') && (int) OW::getConfig()->getValue('base', 'cron_is_active') === 0) { $adminWarnings[] = $language->text('admin', 'warning_cron_is_not_active', array('path' => OW_DIR_ROOT . 'ow_cron' . DS . 'run.php')); } if (!defined('OW_PLUGIN_XP') && !ini_get('allow_url_fopen')) { $adminWarnings[] = $language->text('admin', 'warning_url_fopen_disabled'); } $event = new BASE_CLASS_EventCollector('admin.add_admin_warning'); OW::getEventManager()->trigger($event); $adminWarnings = array_merge($adminWarnings, $event->getData()); $this->assign('warnings', $adminWarnings); // platform info $event = new OW_Event('admin.get_soft_version_text'); OW_EventManager::getInstance()->trigger($event); $verString = $event->getData(); if (empty($verString)) { $verString = OW::getLanguage()->text('admin', 'soft_version', array('version' => OW::getConfig()->getValue('base', 'soft_version'), 'build' => OW::getConfig()->getValue('base', 'soft_build'))); } $this->assign('version', OW::getConfig()->getValue('base', 'soft_version')); $this->assign('build', OW::getConfig()->getValue('base', 'soft_build')); $this->assign('softVersion', $verString); }
public function getItemSettingsByPrefixAndKey($prefix, $key) { $item = $this->navigationService->findMenuItem($prefix, $key); if ($item === null) { return array(); } return $this->getItemSettings($item); }
/** * Constructor. */ public function __construct() { parent::__construct(); $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getMobileCmpViewDir() . 'top_menu.html'); $this->name = BOL_MobileNavigationService::MENU_TYPE_TOP; $menuItems = BOL_NavigationService::getInstance()->findMenuItems(BOL_MobileNavigationService::MENU_TYPE_TOP); $this->setMenuItems(BOL_NavigationService::getInstance()->getMenuItems($menuItems)); }
public function __construct($itemKey) { parent::__construct(); list($prefix, $key) = explode(':', $itemKey); $menuItem = BOL_NavigationService::getInstance()->findMenuItem($prefix, $key); $custom = $menuItem->getPrefix() == BOL_MobileNavigationService::MENU_PREFIX; $form = new ADMIN_CLASS_MobileNavigationItemSettingsForm($menuItem, $custom); $this->addForm($form); $this->assign("custom", $custom); $js = UTIL_JsGenerator::composeJsString('owForms[{$formName}].bind("success", function(r) { _scope.callBack(r); _scope.floatBox.close(); })', array("formName" => $form->getName())); OW::getDocument()->addOnloadScript($js); }
public function __construct($name, BOL_MenuItem $menu) { parent::__construct($name); $navigationService = BOL_NavigationService::getInstance(); $document = $navigationService->findDocumentByKey($menu->getDocumentKey()); $language = OW_Language::getInstance(); $adminPlugin = OW::getPluginManager()->getPlugin('admin'); $nameTextField = new TextField('name'); $this->addElement($nameTextField->setValue($language->text($menu->getPrefix(), $menu->getKey()))->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_menu_name'))->setRequired()); $visibleForCheckboxGroup = new CheckboxGroup('visible-for'); $visibleFor = $menu->getVisibleFor(); $options = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members')); $values = array(); foreach ($options as $value => $option) { if (!($value & $visibleFor)) { continue; } $values[] = $value; } $this->addElement($visibleForCheckboxGroup->setOptions($options)->setValue($values)->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_visible_for'))); $submit = new Submit('save'); $this->addElement($submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label'))); }
private function processMetaInfo() { /* hotfix - add static pages for ajax */ $staticDocs = BOL_NavigationService::getInstance()->findAllStaticDocuments(); $staticPageDispatchAttrs = OW::getRequestHandler()->getStaticPageAttributes(); /* @var $value BOL_Document */ foreach ($staticDocs as $value) { OW::getRouter()->addRoute(new OW_Route($value->getKey(), $value->getUri(), $staticPageDispatchAttrs['controller'], $staticPageDispatchAttrs['action'], array('documentKey' => array(OW_Route::PARAM_OPTION_HIDDEN_VAR => $value->getKey())))); } /* ------------------------------ */ $language = OW::getLanguage(); // edit route path if (!empty($_POST['routeName']) && !empty($_POST['url'])) { $urlUpdArr = json_decode($_POST['url'], true); // suuport only latin chars and '-' symbol if (preg_match("/[^a-zA-Z0-9\\-]+/", implode('', $urlUpdArr))) { throw new Exception(OW::getLanguage()->text('oaseo', 'use_only_latin_for_urls')); } foreach ($urlUpdArr as $item) { if (strlen($item) < 1) { throw new Exception(OW::getLanguage()->text('oaseo', 'url_empty_path_element')); } } $route = OW::getRouter()->getRoute($_POST['routeName']); if ($route !== null) { $urlDto = $this->metaService->findUrlByRouteName($route->getRouteName()); $rtArr = (array) $route; $path = empty($urlDto) ? $rtArr["OW_RouteroutePath"] : $urlDto->getUrl(); $pathArr = explode('/', $path); $pathUpdate = false; foreach ($pathArr as $pathKey => $pathItem) { if (strstr($pathItem, ':')) { continue; } $currPathItem = array_shift($urlUpdArr); if ($pathItem != $currPathItem) { $pathArr[$pathKey] = $currPathItem; $pathUpdate = true; } } if ($pathUpdate) { if ($urlDto === null) { $urlDto = new OASEO_BOL_Url(); $urlDto->setRouteName($route->getRouteName()); } $urlDto->setUrl(implode('/', $pathArr)); $this->metaService->saveUrl($urlDto); } } } // edit meta info $entryArr = array(); if (!empty($_POST['title'])) { $entryArr['title'] = trim($_POST['title']); } if (!empty($_POST['desc'])) { $entryArr['desc'] = trim($_POST['desc']); } if (!empty($_POST['keywords'])) { $entryArr['keywords'] = $_POST['keywords']; } if (!empty($entryArr)) { /* spec case for empty URI */ if (in_array(trim($_POST['uri']), array('', '/'))) { $item = BOL_NavigationService::getInstance()->findFirstLocal(OW::getUser()->isAuthenticated() ? BOL_NavigationService::VISIBLE_FOR_MEMBER : BOL_NavigationService::VISIBLE_FOR_GUEST); if ($item !== null) { if ($item->getRoutePath()) { $route = OW::getRouter()->getRoute($item->getRoutePath()); $dispatchAttrs = $route->getDispatchAttrs(); } else { $dispatchAttrs = OW::getRequestHandler()->getStaticPageAttributes(); } } else { $dispatchAttrs = array('controller' => 'BASE_CTRL_ComponentPanel', 'action' => 'index'); } } else { $dispatchAttrs = $this->metaService->getDispatchParamsForUri(trim($_POST['uri'])); } $entry = $this->metaService->getEntryForDispatchParams($dispatchAttrs); if ($entry === null) { $entry = new OASEO_BOL_Meta(); $entry->setKey($this->metaService->generateKey($dispatchAttrs)); $entry->setUri(trim($_POST['uri'])); $entry->setDispatchAttrs(json_encode($dispatchAttrs)); } $entry->setMeta(json_encode($entryArr)); $this->metaService->saveEntry($entry); } }
/** * Application init actions. */ public function init() { // router init - need to set current page uri and base url $router = OW::getRouter(); $router->setBaseUrl(OW_URL_HOME); $this->urlHostRedirect(); OW_Auth::getInstance()->setAuthenticator(new OW_SessionAuthenticator()); $this->userAutoLogin(); // setting default time zone date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone')); // synchronize the db's time zone OW::getDbo()->setTimezone(); // OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel'); OW::getRequestHandler()->setStaticPageAttributes('BASE_MCTRL_BaseDocument', 'staticDocument'); $uri = OW::getRequest()->getRequestUri(); // before setting in router need to remove get params if (strstr($uri, '?')) { $uri = substr($uri, 0, strpos($uri, '?')); } $router->setUri($uri); $defaultRoute = new OW_DefaultRoute(); //$defaultRoute->setControllerNamePrefix('MCTRL'); $router->setDefaultRoute($defaultRoute); $navService = BOL_NavigationService::getInstance(); // // // try to find static document with current uri // $document = $navService->findStaticDocument($uri); // // if ( $document !== null ) // { // $this->documentKey = $document->getKey(); // } OW::getPluginManager()->initPlugins(); $event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT); OW::getEventManager()->trigger($event); $beckend = OW::getEventManager()->call('base.cache_backend_init'); if ($beckend !== null) { OW::getCacheManager()->setCacheBackend($beckend); OW::getCacheManager()->setLifetime(3600); OW::getDbo()->setUseCashe(true); } $this->devActions(); OW::getThemeManager()->initDefaultTheme(true); // setting current theme $activeThemeName = OW::getEventManager()->call('base.get_active_theme_name'); $activeThemeName = $activeThemeName ? $activeThemeName : OW::getConfig()->getValue('base', 'selectedTheme'); if ($activeThemeName !== BOL_ThemeService::DEFAULT_THEME && OW::getThemeManager()->getThemeService()->themeExists($activeThemeName)) { OW_ThemeManager::getInstance()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(trim($activeThemeName), true)); } // adding static document routes $staticDocs = $navService->findAllMobileStaticDocuments(); $staticPageDispatchAttrs = OW::getRequestHandler()->getStaticPageAttributes(); /* @var $value BOL_Document */ foreach ($staticDocs as $value) { OW::getRouter()->addRoute(new OW_Route($value->getKey(), $value->getUri(), $staticPageDispatchAttrs['controller'], $staticPageDispatchAttrs['action'], array('documentKey' => array(OW_Route::PARAM_OPTION_HIDDEN_VAR => $value->getKey())))); // TODO refactor - hotfix for TOS page if (UTIL_String::removeFirstAndLastSlashes($value->getUri()) == 'terms-of-use') { OW::getRequestHandler()->addCatchAllRequestsExclude('base.members_only', $staticPageDispatchAttrs['controller'], $staticPageDispatchAttrs['action'], array('documentKey' => $value->getKey())); } } //adding index page route $item = BOL_NavigationService::getInstance()->findFirstLocal(OW::getUser()->isAuthenticated() ? BOL_NavigationService::VISIBLE_FOR_MEMBER : BOL_NavigationService::VISIBLE_FOR_GUEST, OW_Navigation::MOBILE_TOP); if ($item !== null) { if ($item->getRoutePath()) { $route = OW::getRouter()->getRoute($item->getRoutePath()); $ddispatchAttrs = $route->getDispatchAttrs(); } else { $ddispatchAttrs = OW::getRequestHandler()->getStaticPageAttributes(); } $router->addRoute(new OW_Route('base_default_index', '/', $ddispatchAttrs['controller'], $ddispatchAttrs['action'], array('documentKey' => array(OW_Route::PARAM_OPTION_HIDDEN_VAR => $item->getDocumentKey())))); $this->indexMenuItem = $item; OW::getEventManager()->bind(OW_EventManager::ON_AFTER_REQUEST_HANDLE, array($this, 'activateMenuItem')); } else { $router->addRoute(new OW_Route('base_default_index', '/', 'BASE_MCTRL_WidgetPanel', 'index')); } if (!OW::getRequest()->isAjax()) { OW::getResponse()->setDocument($this->newDocument()); OW::getDocument()->setMasterPage(new OW_MobileMasterPage()); OW::getResponse()->setHeader(OW_Response::HD_CNT_TYPE, OW::getDocument()->getMime() . '; charset=' . OW::getDocument()->getCharset()); } else { OW::getResponse()->setDocument(new OW_AjaxDocument()); } /* additional actions */ if (OW::getUser()->isAuthenticated()) { BOL_UserService::getInstance()->updateActivityStamp(OW::getUser()->getId(), $this->getContext()); } // adding global template vars $currentThemeImagesDir = OW::getThemeManager()->getCurrentTheme()->getStaticImagesUrl(); $viewRenderer = OW_ViewRenderer::getInstance(); $viewRenderer->assignVar('themeImagesUrl', $currentThemeImagesDir); $viewRenderer->assignVar('siteName', OW::getConfig()->getValue('base', 'site_name')); $viewRenderer->assignVar('siteTagline', OW::getConfig()->getValue('base', 'site_tagline')); $viewRenderer->assignVar('siteUrl', OW_URL_HOME); $viewRenderer->assignVar('isAuthenticated', OW::getUser()->isAuthenticated()); $viewRenderer->assignVar('bottomPoweredByLink', '<a href="http://www.oxwall.org/" target="_blank" title="Powered by Oxwall Community Software"><img src="' . $currentThemeImagesDir . 'powered-by-oxwall.png" alt="Oxwall Community Software" /></a>'); $viewRenderer->assignVar('adminDashboardIframeUrl', "http://static.oxwall.org/spotlight/?platform=oxwall&platform-version=" . OW::getConfig()->getValue('base', 'soft_version') . "&platform-build=" . OW::getConfig()->getValue('base', 'soft_build')); if (function_exists('ow_service_actions')) { call_user_func('ow_service_actions'); } $this->handleHttps(); }
public function isValid($value) { $value = str_replace(UTIL_String::removeFirstAndLastSlashes(OW::getRouter()->getBaseUrl()), '', UTIL_String::removeFirstAndLastSlashes($value)); if (!trim($value)) { return false; } return $this->uri == $value || BOL_NavigationService::getInstance()->isDocumentUriUnique($value); }
/** * @see OW_Renderable::onBeforeRender() * */ public function onBeforeRender() { $arrayToAssign = array(); usort($this->menuItems, array(BOL_NavigationService::getInstance(), 'sortObjectListByAsc')); /* @var $menuItem BASE_MenuItem */ foreach ($this->menuItems as $menuItem) { $menuItem->activate(OW::getRouter()->getBaseUrl() . OW::getRequest()->getRequestUri()); $arrayToAssign[] = $this->getItemViewData($menuItem); } $this->assign('class', 'ow_' . OW_Autoload::getInstance()->classToFilename(get_class($this), false)); $this->assign('data', $arrayToAssign); }
protected function findFirstMenuItem($availableFor) { return BOL_NavigationService::getInstance()->findFirstLocal($availableFor, OW_Navigation::MAIN); }
public function saveItemSettings() { list($prefix, $key) = explode(':', $_POST["key"]); $menuItem = BOL_NavigationService::getInstance()->findMenuItem($prefix, $key); $form = new ADMIN_CLASS_MobileNavigationItemSettingsForm($menuItem, $menuItem->getPrefix() == BOL_MobileNavigationService::MENU_PREFIX); $out = array(); if ($form->isValid($_POST)) { $out = $form->process(); } echo json_encode($out); exit; }
public function isValid($value) { if (!empty($_POST['external-url'])) { return true; } return BOL_NavigationService::getInstance()->isDocumentUriUnique($value); }
<?php /** * Copyright (c) 2014, Skalfa LLC * All rights reserved. * * ATTENTION: This commercial software is intended for exclusive use with SkaDate Dating Software (http://www.skadate.com) and is licensed under SkaDate Exclusive License by Skalfa LLC. * * Full text of this license can be found at http://www.skadate.com/sel.pdf */ $widgetService = BOL_ComponentAdminService::getInstance(); $widget = $widgetService->addWidget('USEARCH_CMP_QuickSearchWidget', false); $placeWidget = $widgetService->addWidgetToPlace($widget, BOL_ComponentService::PLACE_DASHBOARD); $widgetService->addWidgetToPosition($placeWidget, BOL_ComponentService::SECTION_LEFT); try { OW::getNavigation()->addMenuItem(OW_Navigation::MAIN, 'users-search', 'usearch', 'menu_item_search', OW_Navigation::VISIBLE_FOR_ALL); } catch (Exception $e) { } try { /* @var $menu BOL_MenuItem */ $menu = BOL_NavigationService::getInstance()->findMenuItem('base', 'users_main_menu_item'); if (!empty($menu)) { $menu->type = BOL_NavigationService::MENU_TYPE_HIDDEN; BOL_NavigationService::getInstance()->saveMenuItem($menu); } } catch (Exception $e) { }
/** * @see OW_Renderable::onBeforeRender() * */ public function onBeforeRender() { $arrayToAssign = array(); usort($this->menuItems, array(BOL_NavigationService::getInstance(), 'sortObjectListByAsc')); /* @var $menuItem BASE_MenuItem */ foreach ($this->menuItems as $menuItem) { $menuItem->activate(OW::getRouter()->getBaseUrl() . OW::getRequest()->getRequestUri()); $arrayToAssign[] = array('label' => $menuItem->getLabel(), 'url' => $menuItem->getUrl(), 'class' => $menuItem->getPrefix() . '_' . $menuItem->getKey(), 'iconClass' => $menuItem->getIconClass(), 'active' => $menuItem->isActive(), 'new_window' => $menuItem->getNewWindow(), 'prefix' => $menuItem->getPrefix(), 'key' => $menuItem->getKey()); } $this->assign('class', 'ow_' . OW_Autoload::getInstance()->classToFilename(get_class($this), false)); $this->assign('data', $arrayToAssign); }
/** * Saves and updates menu items. * * @param BOL_MenuItem $menuItem */ public function saveMenuItem(BOL_MenuItem $menuItem) { BOL_NavigationService::getInstance()->saveMenuItem($menuItem); }
/** * Master page init actions. Template assigning, registering standard cmps, etc. * Default version works for `general` master page. */ protected function init() { // add main menu $mainMenu = new BASE_CMP_Menu(); $mainMenuItems = BOL_NavigationService::getInstance()->findMenuItems(BOL_NavigationService::MENU_TYPE_MAIN); $mainMenu->setMenuItems(BOL_NavigationService::getInstance()->getMenuItems($mainMenuItems)); $this->addMenu(BOL_NavigationService::MENU_TYPE_MAIN, $mainMenu); $this->addComponent('main_menu', new BASE_CMP_MainMenu(array("responsive" => false))); // add bottom menu $bottomMenu = new BASE_CMP_BottomMenu(); $this->addMenu(BOL_NavigationService::MENU_TYPE_BOTTOM, $bottomMenu); $this->addComponent('bottom_menu', $bottomMenu); // assign image control values $currentTheme = OW::getThemeManager()->getCurrentTheme()->getDto(); $values = json_decode(OW::getConfig()->getValue('base', 'master_page_theme_info'), true); if (isset($values[$currentTheme->getId()])) { $this->assign('imageControlValues', $values[$currentTheme->getId()]); } }
/** * Returns first element. * * @return BASE_MenuItem */ public function getFirstElement() { usort($this->menuItems, array(BOL_NavigationService::getInstance(), 'sortObjectListByAsc')); return $this->menuItems[0]; }