/** * @return Constructor. */ public function __construct($params) { parent::__construct(); $adsService = ADS_BOL_Service::getInstance(); $rhandlerAttrs = OW::getRequestHandler()->getHandlerAttributes(); $pluginKey = OW::getAutoloader()->getPluginKey($rhandlerAttrs['controller']); if (empty($params['position']) || OW::getUser()->isAuthorized('ads', 'hide_ads')) { $this->setVisible(false); return; } $position = trim($params['position']); if (!in_array($position, array(ADS_BOL_Service::BANNER_POSITION_TOP, ADS_BOL_Service::BANNER_POSITION_SIDEBAR, ADS_BOL_Service::BANNER_POSITION_BOTTOM))) { $this->setVisible(false); return; } $location = BOL_GeolocationService::getInstance()->ipToCountryCode3(OW::getRequest()->getRemoteAddress()); $banners = ADS_BOL_Service::getInstance()->findPlaceBannerList($pluginKey, $params['position'], $location); if (empty($banners)) { $this->setVisible(false); return; } $banner = $banners[array_rand($banners)]; $event = new OW_Event('ads_get_banner_code', array('pluginKey' => $pluginKey, 'position' => $params['position'], 'location' => $location)); $result = OW::getEventManager()->trigger($event); $data = $result->getData(); $this->assign('code', empty($data) ? $banner->getCode() : $data); $this->assign('position', $params['position']); }
public function __construct($template = null) { parent::__construct(); if ($template === null) { $template = OW::getAutoloader()->classToFilename(get_class($this), false); } $this->setTemplate(INSTALL_DIR_VIEW_CMP . $template . '.php'); }
public function initPlugins() { $autoloader = OW::getAutoloader(); /* @var $value OW_Plugin */ foreach ($this->activePlugins as $value) { $upperedKey = mb_strtoupper($value->getKey()); $autoloader->addPackagePointer($upperedKey . '_CMP', $value->getCmpDir()); $autoloader->addPackagePointer($upperedKey . '_CTRL', $value->getCtrlDir()); $autoloader->addPackagePointer($upperedKey . '_BOL', $value->getBolDir()); $autoloader->addPackagePointer($upperedKey . '_CLASS', $value->getClassesDir()); $autoloader->addPackagePointer($upperedKey . '_MCMP', $value->getMobileCmpDir()); $autoloader->addPackagePointer($upperedKey . '_MCTRL', $value->getMobileCtrlDir()); $autoloader->addPackagePointer($upperedKey . '_MBOL', $value->getMobileBolDir()); $autoloader->addPackagePointer($upperedKey . '_MCLASS', $value->getMobileClassesDir()); $initFilePath = (OW::getApplication()->isMobile() ? $value->getMobileDir() : $value->getRootDir()) . 'init.php'; if (file_exists($initFilePath)) { include $initFilePath; } } }
protected function init() { $autoloader = OW::getAutoloader(); $autoloader->addPackagePointer('SPVIDEOLITE_PRO_ALLMYVIDEOS_CMP', $this->getClassPath() . DS . 'components'); $autoloader->addPackagePointer('SPVIDEOLITE_PRO_ALLMYVIDEOS_CLASS', $this->getClassPath() . DS . 'classes'); }
foreach ($sql as $query) { OW::getDbo()->query($query); } OW::getConfig()->addConfig('uheader', 'cover_height', '250', 'Cover height in pixels'); OW::getConfig()->addConfig('uheader', 'photo_share', '1', 'Add cover images to user photos'); OW::getConfig()->addConfig('uheader', 'tpl_view_mode', 'list', 'Cover gallery view mode'); OW::getPluginManager()->addPluginSettingsRouteName('uheader', 'uheader-settings-page'); $authorization = OW::getAuthorization(); $groupName = 'uheader'; $authorization->addGroup($groupName); $authorization->addAction($groupName, 'view_cover', true); $authorization->addAction($groupName, 'add_cover'); $authorization->addAction($groupName, 'add_comment'); $authorization->addAction($groupName, 'delete_comment_by_content_owner'); BOL_LanguageService::getInstance()->importPrefixFromZip($plugin->getRootDir() . 'langs.zip', $plugin->getKey()); try { OW::getAutoloader()->addPackagePointer("UHEADER_BOL", $plugin->getBolDir()); OW::getAutoloader()->addPackagePointer("UHEADER_CLASS", $plugin->getClassesDir()); } catch (Exception $e) { } try { //Add default templates $templatesBridge = UHEADER_CLASS_TemplatesBridge::getInstance(); $templatesBridge->addBuiltInCovers(); } catch (Exception $e) { } try { UHEADER_BOL_Service::getInstance()->saveInfoConfig(UHEADER_BOL_Service::INFO_LINE1, "base-gender-age"); UHEADER_BOL_Service::getInstance()->saveInfoConfig(UHEADER_BOL_Service::INFO_LINE2, "base-about"); } catch (Exception $e) { }
/** * Returns template path for provided controller and action. * * @param string $controller * @param string $action * @return string<path> */ private function getControllerActionDefaultTemplate() { $plugin = OW::getPluginManager()->getPlugin(OW::getAutoloader()->getPluginKey($this->dispatchAttributes[self::ATTRS_KEY_CTRL])); $templateFilename = OW::getAutoloader()->classToFilename($this->dispatchAttributes[self::ATTRS_KEY_CTRL], false) . '_' . OW::getAutoloader()->classToFilename(ucfirst($this->dispatchAttributes[self::ATTRS_KEY_ACTION]), false) . '.html'; return $plugin->getCtrlViewDir() . $templateFilename; }
<?php /** * Copyright (c) 2011 Sardar Madumarov * All rights reserved. * ATTENTION: This commercial software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ * and is licensed under Oxwall Store Commercial License. * Full text of this license can be found at http://www.oxwall.org/store/oscl */ /** * @author Sardar Madumarov <*****@*****.**> * @package oaseo.bol */ OW::getAutoloader()->addClass('OA_CCLASS_TagsField', OW::getPluginManager()->getPlugin('oaseo')->getClassesDir() . 'tags_field.php'); $router = OW::getRouter(); $router->addRoute(new OW_Route('oaseo.admin_index', 'oaseo/admin', 'OASEO_CTRL_Admin', 'index')); $router->addRoute(new OW_Route('oaseo.admin_advanced', 'oaseo/admin/advanced', 'OASEO_CTRL_Admin', 'advanced')); $router->addRoute(new OW_Route('oaseo.admin_slugs', 'oaseo/admin/slugs', 'OASEO_CTRL_Admin', 'slugs')); $router->addRoute(new OW_Route('oaseo.admin_robots', 'oaseo/admin/robots', 'OASEO_CTRL_Admin', 'robots')); $router->addRoute(new OW_Route('oaseo.admin_sitemap', 'oaseo/admin/sitemap', 'OASEO_CTRL_Admin', 'sitemap')); $router->addRoute(new OW_Route('oaseo.admin_sitemap_info', 'oaseo/admin/sitemap-info', 'OASEO_CTRL_Admin', 'sitemapInfo')); if ($router->getRoute('base.robots_txt')) { $router->removeRoute('base.robots_txt'); } $router->addRoute(new OW_Route('oaseo.robots', 'robots.txt', 'OASEO_CTRL_Base', 'robots')); $router->addRoute(new OW_Route('oaseo.xmlsitemap', OW::getConfig()->getValue('oaseo', 'sitemap_url') ? trim(OW::getConfig()->getValue('oaseo', 'sitemap_url')) : 'sitemap.xml', 'OASEO_CTRL_Base', 'xmlSitemap')); $router->addRoute(new OW_Route('oaseo.xmlimagesitemap', OW::getConfig()->getValue('oaseo', 'imagemap_url') ? trim(OW::getConfig()->getValue('oaseo', 'imagemap_url')) : 'sitemap_images.xml', 'OASEO_CTRL_Base', 'xmlImageSitemap')); $router->addRoute(new OW_Route('oaseo.xmlsitemapgz', OW::getConfig()->getValue('oaseo', 'sitemap_url') ? 'gz' . trim(OW::getConfig()->getValue('oaseo', 'sitemap_url')) : 'gzsitemap.xml', 'OASEO_CTRL_Base', 'xmlSitemapGz')); $router->addRoute(new OW_Route('oaseo.xmlimagesitemapgz', OW::getConfig()->getValue('oaseo', 'imagemap_url') ? 'gz' . trim(OW::getConfig()->getValue('oaseo', 'imagemap_url')) : 'gzsitemap_images.xml', 'OASEO_CTRL_Base', 'xmlImageSitemapGz')); //output handler function oaseo_handler()
public function init() { OW::getAutoloader()->addPackagePointer("NEWSFEED_FORMAT", $this->plugin->getRootDir() . "formats" . DS); OW::getAutoloader()->addPackagePointer("NEWSFEED_MFORMAT", $this->plugin->getMobileDir() . "formats" . DS); OW::getEventManager()->bind(OW_EventManager::ON_PLUGINS_INIT, array($this, "collectFormats")); }
if ($spvlConfig->get('tweaks.link_import')) { OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, array($eventHandler, 'replaceVideoAddView')); } if ($spvlConfig->get('tweaks.desc_show_more')) { OW::getEventManager()->bind('video.collect_video_toolbar_items', array($eventHandler, 'showLessVideoDescription')); } if ($spvlConfig->get('tweaks.correct_player_size')) { OW::getEventManager()->bind('video.collect_video_toolbar_items', array($eventHandler, 'correctPlayerSize')); } if ($spvlConfig->get('tweaks.player_enlargable')) { OW::getEventManager()->bind('video.collect_video_toolbar_items', array($eventHandler, 'addLargerPlayerButton')); } if ($spvlConfig->get('tweaks.fix_long_titles')) { OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, array($eventHandler, 'fixLongTitles')); } if ($spvlConfig->get('tweaks.forum_bridge')) { OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, array($eventHandler, 'integrateForum')); } if ($spvlConfig->get('tweaks.blog_bridge')) { OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, array($eventHandler, 'integrateBlog')); } } // adding package pointers for importers OW::getAutoloader()->addPackagePointer('SPVIDEOLITE_IMP', SPVIDEOLITE_DIR_IMPORTERS); // adding package pointers for processors OW::getAutoloader()->addPackagePointer('SPVIDEOLITE_PRO', SPVIDEOLITE_DIR_PROCESSORS); // registering processors SPVIDEOLITE_BOL_Service::registerProcessor('Allmyvideos'); } catch (Exception $err) { // failed to detect base video plugin }
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and * the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and * the following disclaimer in the documentation and/or other materials provided with the distribution. * * - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ OW::getAutoloader()->addPackagePointer('WATCHDOG_FORM', OW::getPluginManager()->getPlugin('watchdog')->getRootDir() . 'forms/'); OW::getRouter()->addRoute(new OW_Route('watchdog.admin_status', 'admin/watchdog/status', "WATCHDOG_CTRL_Admin", 'status')); OW::getRouter()->addRoute(new OW_Route('watchdog.admin_white_list', 'admin/watchdog/white-list', "WATCHDOG_CTRL_Admin", 'whiteList')); function watchdog_after_route(OW_Event $event) { $handlerAttributes = OW::getRequestHandler()->getHandlerAttributes(); if ($handlerAttributes[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_Join' && $handlerAttributes[OW_RequestHandler::ATTRS_KEY_ACTION] == 'index' || OW::getUser()->isAuthenticated() && !OW::getUser()->isAdmin()) { WATCHDOG_BOL_WatchdogService::getInstance()->checkRemoteIP(); return; } } OW::getEventManager()->bind(OW_EventManager::ON_AFTER_ROUTE, 'watchdog_after_route');
public function addPackagePointers(BOL_Plugin $pluginDto) { $plugin = $this->pluginService->getPluginObject($pluginDto); $upperedKey = mb_strtoupper($plugin->getKey()); $autoloader = OW::getAutoloader(); $autoloader->addPackagePointer($upperedKey . '_CMP', $plugin->getCmpDir()); $autoloader->addPackagePointer($upperedKey . '_CTRL', $plugin->getCtrlDir()); $autoloader->addPackagePointer($upperedKey . '_BOL', $plugin->getBolDir()); $autoloader->addPackagePointer($upperedKey . '_CLASS', $plugin->getClassesDir()); $autoloader->addPackagePointer($upperedKey . '_MCMP', $plugin->getMobileCmpDir()); $autoloader->addPackagePointer($upperedKey . '_MCTRL', $plugin->getMobileCtrlDir()); $autoloader->addPackagePointer($upperedKey . '_MBOL', $plugin->getMobileBolDir()); $autoloader->addPackagePointer($upperedKey . '_MCLASS', $plugin->getMobileClassesDir()); $autoloader->addPackagePointer($upperedKey . '_ACTRL', $plugin->getApiCtrlDir()); $autoloader->addPackagePointer($upperedKey . '_ABOL', $plugin->getApiBolDir()); $autoloader->addPackagePointer($upperedKey . '_ACLASS', $plugin->getApiClassesDir()); }
* Attribution Copyright Notice: Copyright 2011 Oxwall Foundation. All rights reserved. * Attribution Phrase (not exceeding 10 words): Powered by Oxwall community software * Attribution URL: http://www.oxwall.org/ * Graphic Image as provided in the Covered Code. * Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work * which combines Covered Code or portions thereof with code not governed by the terms of the CPAL. */ $plugin = OW::getPluginManager()->getPlugin('admin'); OW::getRouter()->addRoute(new OW_Route('admin_default', 'admin', 'ADMIN_CTRL_Base', 'index')); OW::getRouter()->addRoute(new OW_Route('admin_finance', 'admin/finance', 'ADMIN_CTRL_Finance', 'index')); OW::getRouter()->addRoute(new OW_Route('admin_settings_language', 'admin/languages', 'ADMIN_CTRL_Languages', 'index')); OW::getRouter()->addRoute(new OW_Route('admin_settings_language_mod', 'admin/languages/mod', 'ADMIN_CTRL_Languages', 'mod')); OW::getRouter()->addRoute(new OW_Route('admin_developer_tools_language', 'admin/dev-tools/languages', 'ADMIN_CTRL_Languages', 'index')); OW::getRouter()->addRoute(new OW_Route('admin_developer_tools_language_mod', 'admin/dev-tools/languages/mod', 'ADMIN_CTRL_Languages', 'mod')); OW::getAutoloader()->addClass('ColorField', $plugin->getClassesDir() . 'form_fields.php'); OW::getAutoloader()->addClass('ADMIN_UserListParams', $plugin->getCmpDir() . 'user_list.php'); $router->addRoute(new OW_Route('admin_permissions', 'admin/permissions', 'ADMIN_CTRL_Permissions', 'index')); $router->addRoute(new OW_Route('admin_permissions_roles', 'admin/permissions/roles', 'ADMIN_CTRL_Permissions', 'roles')); $router->addRoute(new OW_Route('admin_permissions_moderators', 'admin/permissions/moderators', 'ADMIN_CTRL_Permissions', 'moderators')); $router->addRoute(new OW_Route('admin_user_roles', 'admin/users/roles', 'ADMIN_CTRL_Users', 'roles')); $router->addRoute(new OW_Route('admin_users_browse_membership_owners', 'admin/users/role/:roleId', 'ADMIN_CTRL_Users', 'role')); $router->addRoute(new OW_Route('questions_index', 'admin/questions/index', 'ADMIN_CTRL_Questions', 'index')); $router->addRoute(new OW_Route('questions_add', 'admin/questions/add', 'ADMIN_CTRL_Questions', 'add')); $router->addRoute(new OW_Route('questions_edit_account_type', 'admin/questions/edit-account-type/', 'ADMIN_CTRL_Questions', 'editAccountType')); $router->addRoute(new OW_Route('questions_settings', 'admin/questions/settings/', 'ADMIN_CTRL_Questions', 'settings')); $router->addRoute(new OW_Route('admin_themes_edit', 'admin/theme', 'ADMIN_CTRL_Theme', 'settings')); $router->addRoute(new OW_Route('admin_themes_choose', 'admin/themes', 'ADMIN_CTRL_Themes', 'chooseTheme')); $router->addRoute(new OW_Route('admin_themes_add_new', 'admin/themes/add', 'ADMIN_CTRL_Themes', 'addTheme')); $router->addRoute(new OW_Route('admin_pages_edit_external', 'admin/pages/edit-external/id/:id', 'ADMIN_CTRL_PagesEditExternal', 'index')); $router->addRoute(new OW_Route('admin_pages_edit_local', 'admin/pages/edit-local/id/:id', 'ADMIN_CTRL_PagesEditLocal', 'index')); $router->addRoute(new OW_Route('admin_pages_edit_plugin', 'admin/pages/edit-plugin/id/:id', 'ADMIN_CTRL_PagesEditPlugin', 'index'));
* - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and * the following disclaimer in the documentation and/or other materials provided with the distribution. * * - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ $plugin = OW::getPluginManager()->getPlugin('forum'); OW::getAutoloader()->addClass('ForumSelectBox', $plugin->getRootDir() . 'classes' . DS . 'forum_select_box.php'); OW::getAutoloader()->addClass('ForumStringValidator', $plugin->getRootDir() . 'classes' . DS . 'forum_string_validator.php'); OW::getRouter()->addRoute(new OW_Route('forum-default', 'forum', 'FORUM_CTRL_Index', 'index')); OW::getRouter()->addRoute(new OW_Route('customize-default', 'forum/customize', 'FORUM_CTRL_Customize', 'index')); OW::getRouter()->addRoute(new OW_Route('section-default', 'forum/section/:sectionId', 'FORUM_CTRL_Section', 'index')); OW::getRouter()->addRoute(new OW_Route('group-default', 'forum/:groupId', 'FORUM_CTRL_Group', 'index')); OW::getRouter()->addRoute(new OW_Route('topic-default', 'forum/topic/:topicId', 'FORUM_CTRL_Topic', 'index')); OW::getRouter()->addRoute(new OW_Route('add-topic-default', 'forum/addTopic', 'FORUM_CTRL_AddTopic', 'index')); OW::getRouter()->addRoute(new OW_Route('add-topic', 'forum/addTopic/:groupId', 'FORUM_CTRL_AddTopic', 'index')); OW::getRouter()->addRoute(new OW_Route('sticky-topic', 'forum/stickyTopic/:topicId/:page', 'FORUM_CTRL_Topic', 'stickyTopic')); OW::getRouter()->addRoute(new OW_Route('lock-topic', 'forum/lockTopic/:topicId/:page', 'FORUM_CTRL_Topic', 'lockTopic')); OW::getRouter()->addRoute(new OW_Route('delete-topic', 'forum/deleteTopic/:topicId', 'FORUM_CTRL_Topic', 'deleteTopic')); OW::getRouter()->addRoute(new OW_Route('get-post', 'forum/getPost/:postId', 'FORUM_CTRL_Topic', 'getPost')); OW::getRouter()->addRoute(new OW_Route('edit-post', 'forum/edit-post/:id', 'FORUM_CTRL_EditPost', 'index')); OW::getRouter()->addRoute(new OW_Route('edit-topic', 'forum/edit-topic/:id', 'FORUM_CTRL_EditTopic', 'index')); OW::getRouter()->addRoute(new OW_Route('move-topic', 'forum/moveTopic', 'FORUM_CTRL_Topic', 'moveTopic')); OW::getRouter()->addRoute(new OW_Route('subscribe-topic', 'forum/subscribe-topic/:id', 'FORUM_CTRL_Topic', 'subscribeTopic'));
function base_dev_tool(BASE_CLASS_EventCollector $event) { $viewRenderer = OW_ViewRenderer::getInstance(); $prevVars = $viewRenderer->getAllAssignedVars(); $viewRenderer->assignVar('oxwall', (array) simplexml_load_file(OW_DIR_ROOT . 'ow_version.xml')); $requestHandlerData = OW::getRequestHandler()->getDispatchAttributes(); try { $ctrlPath = OW::getAutoloader()->getClassPath($requestHandlerData['controller']); } catch (Exception $e) { $ctrlPath = 'not_found'; } $requestHandlerData['ctrlPath'] = $ctrlPath; $requestHandlerData['paramsExp'] = var_export(empty($requestHandlerData['params']) ? array() : $requestHandlerData['params'], true); $viewRenderer->assignVar('requestHandler', $requestHandlerData); $viewRenderer->assignVar('profiler', UTIL_Profiler::getInstance()->getResult()); $viewRenderer->assignVar('memoryUsage', function_exists('memory_get_peak_usage') ? sprintf('%0.3f', memory_get_peak_usage(true) / 1048576) : 'No info'); if (!OW_DEV_MODE || true) { //TODO remove hardcode $viewRenderer->assignVar('clrBtnUrl', OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('BASE_CTRL_Base', 'turnDevModeOn'), array('back-uri' => urlencode(OW::getRouter()->getUri())))); } $rndItems = OW_Renderable::getRenderedClasses(); $rndArray = array('mp' => array(), 'cmp' => array(), 'ctrl' => array()); foreach ($rndItems as $key => $item) { try { $src = OW::getAutoloader()->getClassPath($key); } catch (Exception $e) { $src = 'not_found'; } $addItem = array('class' => $key, 'src' => $src, 'tpl' => $item); if (strstr($key, 'OW_MasterPage')) { $rndArray['mp'] = $addItem; } else { if (strstr($key, '_CTRL_')) { $rndArray['ctrl'] = $addItem; } else { $rndArray['cmp'][] = $addItem; } } } $viewRenderer->assignVar('renderedItems', array('items' => $rndArray, 'count' => count(OW_Renderable::getRenderedClasses()) - 2)); $queryLog = OW::getDbo()->getQueryLog(); foreach ($queryLog as $key => $query) { if (isset($_GET['pr_query_log_filter']) && strlen($_GET['pr_query_log_filter']) > 3) { if (!strstr($query['query'], $_GET['pr_query_log_filter'])) { unset($queryLog[$key]); continue; } } if ($query['params'] && is_array($query['params'])) { $queryLog[$key]['params'] = var_export($query['params'], true); } } $viewRenderer->assignVar('database', array('qet' => OW::getDbo()->getTotalQueryExecTime(), 'ql' => $queryLog, 'qc' => count($queryLog))); //events $eventsData = OW::getEventManager()->getLog(); $eventsDataToAssign = array('bind' => array(), 'calls' => array()); foreach ($eventsData['bind'] as $eventName => $listeners) { $listenersList = array(); foreach ($listeners as $priority) { foreach ($priority as $listener) { if (is_array($listener)) { if (is_object($listener[0])) { $listener = get_class($listener[0]) . ' -> ' . $listener[1]; } else { $listener = $listener[0] . ' :: ' . $listener[1]; } } $listenersList[] = $listener; } } $eventsDataToAssign['bind'][] = array('name' => $eventName, 'listeners' => $listenersList); } foreach ($eventsData['call'] as $eventItem) { $listenersList = array(); foreach ($eventItem['listeners'] as $priority) { foreach ($priority as $listener) { if (is_array($listener)) { if (is_object($listener[0])) { $listener = get_class($listener[0]) . ' -> ' . $listener[1]; } else { $listener = $listener[0] . ' :: ' . $listener[1]; } } $listenersList[] = $listener; } } $eventsDataToAssign['call'][] = array('type' => $eventItem['type'], 'name' => $eventItem['event']->getName(), 'listeners' => $listenersList, 'params' => var_export($eventItem['event']->getParams(), true), 'start' => sprintf('%.3f', $eventItem['start']), 'exec' => sprintf('%.3f', $eventItem['exec'])); } $eventsDataToAssign['bindsCount'] = count($eventsDataToAssign['bind']); $eventsDataToAssign['callsCount'] = count($eventsDataToAssign['call']); $viewRenderer->assignVar('events', $eventsDataToAssign); $output = $viewRenderer->renderTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'dev_tools_tpl.html'); $viewRenderer->clearAssignedVars(); $viewRenderer->assignVars($prevVars); $event->add($output); }
/** * Returns dispatch params (controller, action, vars) for provided URI. * * @throws Redirect404Exception * @param string $uri * @return array */ public function getDispatchAttrs($uri) { //TODO check if method is in try/catch $uriString = UTIL_String::removeFirstAndLastSlashes($uri); $uriArray = explode('/', $uriString); if (sizeof($uriArray) < 2) { throw new Redirect404Exception('Invalid uri was provided for routing!'); } $controllerNamePrefixAdd = ''; if (strstr($uriArray[0], '-')) { $uriPartArray = explode('-', $uriArray[0]); $uriArray[0] = $uriPartArray[1]; $controllerNamePrefixAdd = strtoupper($uriPartArray[0]); } $dispatchAttrs = array(); $classPrefix = null; $arraySize = sizeof($uriArray); for ($i = 0; $i < $arraySize; $i++) { if ($i === 0) { try { $classPrefix = strtoupper(OW::getPluginManager()->getPluginKey($uriArray[$i])) . '_' . $controllerNamePrefixAdd . $this->controllerNamePrefix; } catch (InvalidArgumentException $e) { throw new Redirect404Exception('Invalid uri was provided for routing!'); } continue; } if ($i === 1) { if ($classPrefix === null) { throw new Redirect404Exception('Invalid uri was provided for routing!'); } $ctrClass = $classPrefix . '_' . UTIL_String::delimiterToCaps('-' . $uriArray[$i], '-'); if (!file_exists(OW::getAutoloader()->getClassPath($ctrClass))) { throw new Redirect404Exception('Invalid uri was provided for routing!'); } $dispatchAttrs['controller'] = $ctrClass; continue; } if ($i === 2) { $dispatchAttrs['action'] = UTIL_String::delimiterToCaps($uriArray[$i], '-'); continue; } if ($i % 2 !== 0) { $dispatchAttrs['vars'][$uriArray[$i]] = null; } else { $dispatchAttrs['vars'][$uriArray[$i - 1]] = $uriArray[$i]; } } return $dispatchAttrs; }
/** * Returns template path for provided controller and action. * * @param string $controller * @param string $action * @return string<path> */ protected function getControllerActionDefaultTemplate(OW_ActionController $ctrl) { $plugin = OW::getPluginManager()->getPlugin(OW::getAutoloader()->getPluginKey($this->handlerAttributes[self::ATTRS_KEY_CTRL])); $templateFilename = OW::getAutoloader()->classToFilename($this->handlerAttributes[self::ATTRS_KEY_CTRL], false) . '_' . OW::getAutoloader()->classToFilename(ucfirst($this->handlerAttributes[self::ATTRS_KEY_ACTION]), false) . '.html'; return ($ctrl instanceof OW_MobileActionController ? $plugin->getMobileCtrlViewDir() : $plugin->getCtrlViewDir()) . $templateFilename; }
define("HAMMU_DB_PAYMENT_TYPE_KEY", "field_2de34e86b2ea038c86f2b4b5be00811e"); define("HAMMU_DB_IM_USING_HAMMU_AS_KEY", "field_8eb4e427b80ac66d870fc0a5a0cc22ba"); define("HAMMU_DB_PREFRENCES_KEY", "field_f2d8bb949d7d74a70bcb2003abc5b436"); define("HAMMU_DB_PREFRENCES_KEY", "field_f2d8bb949d7d74a70bcb2003abc5b436"); define("HAMMU_DB_SERVICES_KEY", "field_f92bbdb57510b86ba6c506c487be3aa1"); define("HAMMU_DB_MOBILE_NUMBER_KEY", "field_391797ad0e06d17d5b5cec0e48def7c2"); mb_internal_encoding('UTF-8'); if (OW_DEBUG_MODE) { ob_start(); } spl_autoload_register(array('OW_Autoload', 'autoload')); // adding standard package pointers $autoloader = OW::getAutoloader(); $autoloader->addPackagePointer('OW', OW_DIR_CORE); $autoloader->addPackagePointer('INC', OW_DIR_INC); $autoloader->addPackagePointer('UTIL', OW_DIR_UTIL); $autoloader->addPackagePointer('BOL', OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'bol'); // Force autoload of classes without package pointer $classesToAutoload = array('Form' => OW_DIR_CORE . 'form.php', 'TextField' => OW_DIR_CORE . 'form_element.php', 'HiddenField' => OW_DIR_CORE . 'form_element.php', 'FormElement' => OW_DIR_CORE . 'form_element.php', 'RequiredValidator' => OW_DIR_CORE . 'validator.php', 'StringValidator' => OW_DIR_CORE . 'validator.php', 'RegExpValidator' => OW_DIR_CORE . 'validator.php', 'EmailValidator' => OW_DIR_CORE . 'validator.php', 'UrlValidator' => OW_DIR_CORE . 'validator.php', 'AlphaNumericValidator' => OW_DIR_CORE . 'validator.php', 'IntValidator' => OW_DIR_CORE . 'validator.php', 'FloatValidator' => OW_DIR_CORE . 'validator.php', 'DateValidator' => OW_DIR_CORE . 'validator.php', 'CaptchaValidator' => OW_DIR_CORE . 'validator.php', 'RadioField' => OW_DIR_CORE . 'form_element.php', 'CheckboxField' => OW_DIR_CORE . 'form_element.php', 'Selectbox' => OW_DIR_CORE . 'form_element.php', 'CheckboxGroup' => OW_DIR_CORE . 'form_element.php', 'RadioField' => OW_DIR_CORE . 'form_element.php', 'PasswordField' => OW_DIR_CORE . 'form_element.php', 'Submit' => OW_DIR_CORE . 'form_element.php', 'Button' => OW_DIR_CORE . 'form_element.php', 'Textarea' => OW_DIR_CORE . 'form_element.php', 'FileField' => OW_DIR_CORE . 'form_element.php', 'TagsField' => OW_DIR_CORE . 'form_element.php', 'SuggestField' => OW_DIR_CORE . 'form_element.php', 'MultiFileField' => OW_DIR_CORE . 'form_element.php', 'Multiselect' => OW_DIR_CORE . 'form_element.php', 'CaptchaField' => OW_DIR_CORE . 'form_element.php', 'InvitationFormElement' => OW_DIR_CORE . 'form_element.php', 'Range' => OW_DIR_CORE . 'form_element.php'); OW::getAutoloader()->addClassArray($classesToAutoload); if (defined("OW_URL_HOME")) { OW::getRouter()->setBaseUrl(OW_URL_HOME); } if (OW_PROFILER_ENABLE) { UTIL_Profiler::getInstance(); } require_once OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'classes' . DS . 'file_log_writer.php'; require_once OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'classes' . DS . 'db_log_writer.php'; require_once OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'classes' . DS . 'err_output.php'; $errorManager = OW_ErrorManager::getInstance(OW_DEBUG_MODE); $errorManager->setErrorOutput(new BASE_CLASS_ErrOutput());
protected function getViewInfo(array $viewData) { $viewDataArray = array("mp" => array(), "cmp" => array(), "ctrl" => array()); foreach ($viewData as $class => $item) { try { $src = OW::getAutoloader()->getClassPath($class); } catch (Exception $e) { $src = "not_found"; } $addItem = array("class" => $class, "src" => $src, "tpl" => $item); if (is_subclass_of($class, OW_MasterPage::class)) { $viewDataArray["mp"] = $addItem; } else { if (is_subclass_of($class, OW_ActionController::class)) { $viewDataArray["ctrl"] = $addItem; } else { if (is_subclass_of($class, OW_Component::class)) { $viewDataArray["cmp"][] = $addItem; } else { $viewDataArray["view"][] = $addItem; } } } } return array("items" => $viewDataArray, "count" => count($viewData) - 2); }
$installPos = strpos($selfUrl, '/install'); if (!$installPos) { $installPos = strpos($selfUrl, '/ow_install'); } if ($installPos) { $selfUrl = substr($selfUrl, 0, $installPos) . '/'; } define('OW_URL_HOME', $selfUrl); } define('INSTALL_DIR_ROOT', dirname(__FILE__) . DS); define('INSTALL_URL_ROOT', OW_URL_HOME . 'ow_install/'); define('INSTALL_URL_VIEW', INSTALL_URL_ROOT . 'view/'); define('INSTALL_DIR_CLASSES', INSTALL_DIR_ROOT . 'classes' . DS); define('INSTALL_DIR_BOL', INSTALL_DIR_ROOT . 'bol' . DS); define('INSTALL_DIR_CTRL', INSTALL_DIR_ROOT . 'controllers' . DS); define('INSTALL_DIR_CMP', INSTALL_DIR_ROOT . 'components' . DS); define('INSTALL_DIR_VIEW', INSTALL_DIR_ROOT . 'view' . DS); define('INSTALL_DIR_VIEW_CTRL', INSTALL_DIR_VIEW . 'controllers' . DS); define('INSTALL_DIR_VIEW_CMP', INSTALL_DIR_VIEW . 'components' . DS); define('INSTALL_DIR_FILES', INSTALL_DIR_ROOT . 'files' . DS); OW::getAutoloader()->addPackagePointer('INSTALL', INSTALL_DIR_CLASSES); OW::getAutoloader()->addPackagePointer('INSTALL_BOL', INSTALL_DIR_BOL); OW::getAutoloader()->addPackagePointer('INSTALL_CTRL', INSTALL_DIR_CTRL); OW::getAutoloader()->addPackagePointer('INSTALL_CMP', INSTALL_DIR_CMP); OW::getAutoloader()->addClass('INSTALL', INSTALL_DIR_CLASSES . 'install.php'); OW::getSession()->start(); $application = INSTALL_Application::getInstance(); $application->init($dbReady); $application->display($dbReady); exit; }
* the following disclaimer in the documentation and/or other materials provided with the distribution. * * - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ $plugin = OW::getPluginManager()->getPlugin('blogs'); OW::getAutoloader()->addClass('Post', $plugin->getBolDir() . 'dto' . DS . 'post.php'); OW::getAutoloader()->addClass('PostDao', $plugin->getBolDir() . 'dao' . DS . 'post_dao.php'); OW::getAutoloader()->addClass('PostService', $plugin->getBolDir() . 'service' . DS . 'post_service.php'); OW::getRouter()->addRoute(new OW_Route('blogs-uninstall', 'admin/blogs/uninstall', 'BLOGS_CTRL_Admin', 'uninstall')); OW::getRouter()->addRoute(new OW_Route('post-save-new', 'blogs/post/new', "BLOGS_CTRL_Save", 'index')); OW::getRouter()->addRoute(new OW_Route('post-save-edit', 'blogs/post/edit/:id', "BLOGS_CTRL_Save", 'index')); OW::getRouter()->addRoute(new OW_Route('post', 'blogs/post/:id', "BLOGS_CTRL_View", 'index')); OW::getRouter()->addRoute(new OW_Route('post-approve', 'blogs/post/approve/:id', "BLOGS_CTRL_View", 'approve')); OW::getRouter()->addRoute(new OW_Route('post-part', 'blogs/post/:id/:part', "BLOGS_CTRL_View", 'index')); OW::getRouter()->addRoute(new OW_Route('user-blog', 'blogs/user/:user', "BLOGS_CTRL_UserBlog", 'index')); OW::getRouter()->addRoute(new OW_Route('user-post', 'blogs/:id', "BLOGS_CTRL_View", 'index')); OW::getRouter()->addRoute(new OW_Route('blogs', 'blogs', "BLOGS_CTRL_Blog", 'index', array('list' => array(OW_Route::PARAM_OPTION_HIDDEN_VAR => 'latest')))); OW::getRouter()->addRoute(new OW_Route('blogs.list', 'blogs/list/:list', "BLOGS_CTRL_Blog", 'index')); OW::getRouter()->addRoute(new OW_Route('blog-manage-posts', 'blogs/my-published-posts/', "BLOGS_CTRL_ManagementPost", 'index')); OW::getRouter()->addRoute(new OW_Route('blog-manage-drafts', 'blogs/my-drafts/', "BLOGS_CTRL_ManagementPost", 'index')); OW::getRouter()->addRoute(new OW_Route('blog-manage-comments', 'blogs/my-incoming-comments/', "BLOGS_CTRL_ManagementComment", 'index')); OW::getRouter()->addRoute(new OW_Route('blogs-admin', 'admin/blogs', "BLOGS_CTRL_Admin", 'index')); $eventHandler = BLOGS_CLASS_EventHandler::getInstance();
* licensed under The BSD license. * --- * Copyright (c) 2011, Oxwall Foundation * All rights reserved. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and * the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and * the following disclaimer in the documentation and/or other materials provided with the distribution. * * - Neither the name of the Oxwall Foundation nor the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ $plugin = OW::getPluginManager()->getPlugin('links'); OW::getAutoloader()->addClass('Link', $plugin->getBolDir() . 'dto' . DS . 'link.php'); OW::getAutoloader()->addClass('LinkDao', $plugin->getBolDir() . 'dao' . DS . 'link_dao.php'); OW::getAutoloader()->addClass('LinkService', $plugin->getBolDir() . 'service' . DS . 'link_service.php'); $eventHandler = LINKS_CLASS_EventHandler::getInstance(); $eventHandler->genericInit(); $mobileEventHandler = LINKS_MCLASS_EventHandler::getInstance(); $mobileEventHandler->init();
<?php Updater::getLanguageService()->importPrefixFromZip(dirname(__FILE__) . DS . 'langs.zip', 'uheader'); $sql = array(); $sql[] = "ALTER TABLE `" . OW_DB_PREFIX . "uheader_cover` ADD `templateId` int(11) DEFAULT NULL"; $sql[] = "CREATE TABLE IF NOT EXISTS `" . OW_DB_PREFIX . "uheader_template` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `file` varchar(255) NOT NULL,\n `settings` text NOT NULL,\n `default` int(11) NOT NULL DEFAULT '0',\n `timeStamp` int(11) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; $sql[] = "CREATE TABLE IF NOT EXISTS `" . OW_DB_PREFIX . "uheader_template_role` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `templateId` int(11) NOT NULL,\n `roleId` int(11) NOT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `templateId` (`templateId`,`roleid`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; foreach ($sql as $query) { Updater::getDbo()->query($query); } Updater::getConfigService()->addConfig('uheader', 'tpl_view_mode', 'list', 'Cover gallery view mode'); try { $plugin = OW::getPluginManager()->getPlugin("uheader"); $basePlugin = OW::getPluginManager()->getPlugin("base"); spl_autoload_register(array('OW_Autoload', 'autoload')); OW::getAutoloader()->addPackagePointer("UHEADER_BOL", $plugin->getBolDir()); OW::getAutoloader()->addPackagePointer("UHEADER_CLASS", $plugin->getClassesDir()); OW::getAutoloader()->addPackagePointer("BASE_CLASS", $basePlugin->getClassesDir()); } catch (Exception $e) { } try { //Add default templates $templatesBridge = UHEADER_CLASS_TemplatesBridge::getInstance(); $templatesBridge->addBuiltInCovers(); } catch (Exception $e) { } try { UHEADER_BOL_Service::getInstance()->saveInfoConfig(UHEADER_BOL_Service::INFO_LINE1, "base-gender-age"); UHEADER_BOL_Service::getInstance()->saveInfoConfig(UHEADER_BOL_Service::INFO_LINE2, "base-about"); } catch (Exception $e) { }
public function beforeContentRender() { $plugin = OW::getPluginManager()->getPlugin("snippets"); $template = OW::getAutoloader()->classToFilename(get_class($this), false); $this->setTemplate($plugin->getCmpViewDir() . $template . '.html'); }
/** * Adds platform predefined package pointers * * @param BOL_Plugin $pluginDto */ public function addPackagePointers(BOL_Plugin $pluginDto) { $plugin = new OW_Plugin($pluginDto); $upperedKey = mb_strtoupper($plugin->getKey()); $autoloader = OW::getAutoloader(); $predefinedPointers = array("CMP" => $plugin->getCmpDir(), "CTRL" => $plugin->getCtrlDir(), "BOL" => $plugin->getBolDir(), "CLASS" => $plugin->getClassesDir(), "MCMP" => $plugin->getMobileCmpDir(), "MCTRL" => $plugin->getMobileCtrlDir(), "MBOL" => $plugin->getMobileBolDir(), "MCLASS" => $plugin->getMobileClassesDir(), "ACTRL" => $plugin->getApiCtrlDir(), "ABOL" => $plugin->getApiBolDir(), "ACLASS" => $plugin->getApiClassesDir()); foreach ($predefinedPointers as $pointer => $dirPath) { $autoloader->addPackagePointer($upperedKey . "_" . $pointer, $dirPath); } }
public function render() { if ($this->getTemplate() === null) { $template = OW::getAutoloader()->classToFilename(get_class($this), false); $this->setTemplate($this->getViewDir() . "formats" . DS . $template . '.html'); } return parent::render(); }
private function loadModules() { $this->importers = array(); $files = scandir($this->importerModulePath); foreach ($files as $file) { if ($this->strEndWith($file, '.php')) { $className = OW::getAutoloader()->filenameToClass($file, 'SPVIDEOLITE_IMP'); $shortname = strtolower(substr($className, 16)); $importer = array('className' => $className, 'regexp' => $className::getRegExp(), 'regexpIdIndex' => $className::getRegExpIdentifierIndex(), 'instance' => null); $this->importers[$shortname] = $importer; } } }
public function render() { if ($this->getTemplate() === null) { try { $plugin = OW::getPluginManager()->getPlugin(OW::getAutoloader()->getPluginKey(get_class($this))); } catch (InvalidArgumentException $e) { $plugin = null; } if ($plugin !== null) { $template = OW::getAutoloader()->classToFilename(get_class($this), false); $this->setTemplate($plugin->getCmpViewDir() . $template . '.html'); } } return parent::render(); }
public function __construct($placeName, array $componentList, $template = null) { parent::__construct(); if ($template !== null) { $plugin = OW::getPluginManager()->getPlugin(OW::getAutoloader()->getPluginKey(get_class($this))); $this->setTemplate($plugin->getCmpViewDir() . $template . '.html'); } $this->placeName = $placeName; $this->componentList = $componentList; foreach ($this->componentList as $widget) { $this->standartSettings[$widget['className']] = call_user_func(array($widget['className'], 'getStandardSettingValueList')); } OW_ViewRenderer::getInstance()->registerFunction('dd_component', array($this, 'tplComponent')); $this->assign('disableJs', !empty($_GET['disable-js'])); $this->assign('placeName', $placeName); $this->sharedData = array('additionalSettings' => &$this->additionalSettingList, 'place' => $this->placeName); }
public function display($dbReady) { $dispatchAttrs = OW::getRouter()->route(); $controllerClass = $dispatchAttrs['controller']; /* @var $controller INSTALL_ActionController */ $controller = new $controllerClass(); $controller->init($dispatchAttrs, $dbReady); $params = array(); if (!empty($dispatchAttrs['vars'])) { $params[] = $dispatchAttrs['vars']; } call_user_func_array(array($controller, $dispatchAttrs['action']), $params); $template = $controller->getTemplate(); if (empty($template)) { $controllerName = OW::getAutoloader()->classToFilename($controllerClass, false); $template = INSTALL_DIR_VIEW_CTRL . $controllerName . '_' . UTIL_String::capsToDelimiter($dispatchAttrs['action'], '_') . '.php'; $controller->setTemplate($template); } $content = $controller->render(); $viewRenderer = INSTALL::getViewRenderer(); $viewRenderer->assignVars(array('pageBody' => $content, 'pageTitle' => $controller->getPageTitle(), 'pageHeading' => $controller->getPageHeading(), 'pageSteps' => INSTALL::getStepIndicator()->render(), 'pageStylesheetUrl' => INSTALL_URL_VIEW . 'style.css')); echo $viewRenderer->render(INSTALL_DIR_VIEW . 'master_page.php'); }
/** * @param array $dispatchAttributes */ public function dispatch() { // check if controller class contains package pointer with plugin key if (empty($this->handlerAttributes[self::ATTRS_KEY_CTRL]) || !mb_strstr($this->handlerAttributes[self::ATTRS_KEY_CTRL], '_')) { throw new InvalidArgumentException("Can't dispatch request! Empty or invalid controller class provided!"); } // set uri params in request object if (!empty($this->handlerAttributes[self::ATTRS_KEY_VARLIST])) { OW::getRequest()->setUriParams($this->handlerAttributes[self::ATTRS_KEY_VARLIST]); } $plugin = OW::getPluginManager()->getPlugin(OW::getAutoloader()->getPluginKey($this->handlerAttributes[self::ATTRS_KEY_CTRL])); $catchAllRequests = $this->processCatchAllRequestsAttrs(); if ($catchAllRequests !== null) { $this->handlerAttributes = $catchAllRequests; } try { $reflectionClass = new ReflectionClass($this->handlerAttributes[self::ATTRS_KEY_CTRL]); } catch (ReflectionException $e) { throw new Redirect404Exception(); } /* @var $controller OW_ActionController */ $controller = $reflectionClass->newInstance(); // check if controller exists and is instance of base action controller class if ($controller === null || !$controller instanceof OW_ApiActionController) { throw new LogicException("Can't dispatch request! Please provide valid controller class!"); } // redirect to page 404 if plugin is inactive and isn't instance of admin controller class if (!$plugin->isActive() && !$controller instanceof ADMIN_CTRL_Abstract) { throw new Redirect404Exception(); } // call optional init method $controller->init(); if (empty($this->handlerAttributes[self::ATTRS_KEY_ACTION])) { $this->handlerAttributes[self::ATTRS_KEY_ACTION] = $controller->getDefaultAction(); } try { $action = $reflectionClass->getMethod($this->handlerAttributes[self::ATTRS_KEY_ACTION]); } catch (Exception $e) { throw new Redirect404Exception(); } $args = array(); $args[] = $_POST; $args[] = empty($this->handlerAttributes[self::ATTRS_KEY_VARLIST]) ? array() : $this->handlerAttributes[self::ATTRS_KEY_VARLIST]; $action->invokeArgs($controller, $args); OW::getDocument()->setBody($controller->render()); }