本文整理匯總了PHP中OW::getAutoloader方法的典型用法代碼示例。如果您正苦於以下問題:PHP OW::getAutoloader方法的具體用法?PHP OW::getAutoloader怎麽用?PHP OW::getAutoloader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OW
的用法示例。
在下文中一共展示了OW::getAutoloader方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @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']);
}
示例2: __construct
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');
}
示例3: initPlugins
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;
}
}
}
示例4: init
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');
}
示例5: foreach
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) {
}
示例6: getControllerActionDefaultTemplate
/**
* 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;
}
示例7: oaseo_handler
<?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 <madumarov@gmail.com>
* @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()
示例8: init
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"));
}
示例9: array
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
}
示例10: watchdog_after_route
* 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');
示例11: addPackagePointers
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());
}
示例12: OW_Route
* 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'));
示例13:
* - 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'));
示例14: base_dev_tool
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);
}
示例15: getDispatchAttrs
/**
* 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;
}