当前位置: 首页>>代码示例>>PHP>>正文


PHP EventUtil::getManager方法代码示例

本文整理汇总了PHP中EventUtil::getManager方法的典型用法代码示例。如果您正苦于以下问题:PHP EventUtil::getManager方法的具体用法?PHP EventUtil::getManager怎么用?PHP EventUtil::getManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventUtil的用法示例。


在下文中一共展示了EventUtil::getManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bootstrap

 protected function bootstrap($disableSessions = true, $loadZikulaCore = true, $fakeRequest = true)
 {
     define('_ZINSTALLVER', \Zikula_Core::VERSION_NUM);
     $kernel = $this->getContainer()->get('kernel');
     $loader = (require $kernel->getRootDir() . '/autoload.php');
     \ZLoader::register($loader);
     if ($loadZikulaCore && !$this->getContainer()->has('zikula')) {
         $core = new Zikula_Core();
         $core->setKernel($kernel);
         $core->boot();
         foreach ($GLOBALS['ZConfig'] as $config) {
             $core->getContainer()->loadArguments($config);
         }
         $GLOBALS['ZConfig']['System']['temp'] = $core->getContainer()->getParameter('temp_dir');
         $GLOBALS['ZConfig']['System']['datadir'] = $core->getContainer()->getParameter('datadir');
         $GLOBALS['ZConfig']['System']['system.chmod_dir'] = $core->getContainer()->getParameter('system.chmod_dir');
         \ServiceUtil::getManager($core);
         \EventUtil::getManager($core);
     }
     if ($disableSessions) {
         // Disable sessions.
         $this->getContainer()->set('session.storage', new MockArraySessionStorage());
         $this->getContainer()->set('session.handler', new NullSessionHandler());
     }
     if ($fakeRequest) {
         // Fake request
         $request = Request::create('http://localhost/install');
         $this->getContainer()->set('request', $request);
     }
 }
开发者ID:rojblake,项目名称:core,代码行数:30,代码来源:AbstractCoreInstallerCommand.php

示例2: getPlugins

 public static function getPlugins($type = 'Content')
 {
     $type = in_array($type, array('Content', 'Layout')) ? trim(ucwords(strtolower($type))) . "Type" : 'ContentType';
     // trigger event
     $event = new Zikula_Event('module.content.gettypes', new Content_Types());
     $plugins = EventUtil::getManager()->notify($event)->getSubject()->getValidatedPlugins($type);
     return $plugins;
 }
开发者ID:robbrandt,项目名称:Content,代码行数:8,代码来源:Util.php

示例3: bootstrap

 /**
  * Initialises own (and legacy) components, like service manager.
  */
 protected function bootstrap()
 {
     // taken from lib/bootstrap.php
     // legacy handling
     $core = new \Zikula_Core();
     $core->setKernel($this->kernel);
     $core->boot();
     // these two events are called for BC only. remove in 2.0.0
     $core->getDispatcher()->dispatch('bootstrap.getconfig', new GenericEvent($core));
     $core->getDispatcher()->dispatch('bootstrap.custom', new GenericEvent($core));
     foreach ($GLOBALS['ZConfig'] as $config) {
         $core->getContainer()->loadArguments($config);
     }
     $GLOBALS['ZConfig']['System']['temp'] = $core->getContainer()->getParameter('temp_dir');
     $GLOBALS['ZConfig']['System']['datadir'] = $core->getContainer()->getParameter('datadir');
     $GLOBALS['ZConfig']['System']['system.chmod_dir'] = $core->getContainer()->getParameter('system.chmod_dir');
     \ServiceUtil::getManager($core);
     \EventUtil::getManager($core);
     $core->attachHandlers('config/EventHandlers');
     return $core;
 }
开发者ID:rojblake,项目名称:core,代码行数:24,代码来源:Application.php

示例4: prepareStylesheets

 /**
  * Procedure for managinig stylesheets.
  *
  * @param array   $stylesheets List of demanded stylesheets.
  * @param array   $themeinfo   array of info on current theme
  * @param boolean $isAdminController
  *
  * @return array List of stylesheets
  */
 public static function prepareStylesheets($stylesheets, $themeinfo = array(), $isAdminController = false)
 {
     if (ThemeUtil::getVar('noCoreCss', false)) {
         $initStyle = null;
     } else {
         $initStyle = array('style/core.css');
     }
     // Add generic stylesheet as the first stylesheet.
     $event = new \Zikula\Core\Event\GenericEvent('stylesheet', array(), $initStyle);
     $coreStyle = EventUtil::getManager()->dispatch('pageutil.addvar_filter', $event)->getData();
     if (!is_array($stylesheets)) {
         $stylesheets = array();
     }
     // Add legacy stylesheet
     if (System::isLegacyMode('1.4.0')) {
         array_unshift($stylesheets, 'style/legacy.css');
     }
     // Add core stylesheet
     array_unshift($stylesheets, $coreStyle[0]);
     // is theme a 1.4.0 type bundle?
     $theme = null;
     if (!empty($themeinfo)) {
         $theme = ThemeUtil::getTheme($themeinfo['name']);
     }
     // Add bootstrap stylesheet only for 1.4.x type themes or if an admin controller is in use
     if (isset($theme) || $isAdminController) {
         $overrideBootstrapPath = ThemeUtil::getVar('bootstrapPath', '');
         // allows for theme override of bootstrap css path
         if (empty($overrideBootstrapPath)) {
             $bootstrapFontAwesomePath = ServiceUtil::getManager()->getParameter('zikula.stylesheet.bootstrap-font-awesome.path');
             array_unshift($stylesheets, $bootstrapFontAwesomePath);
         }
         // Add font-awesome
         if (!empty($overrideBootstrapPath)) {
             $fontAwesomePath = ServiceUtil::getManager()->getParameter('zikula.stylesheet.fontawesome.min.path');
             array_unshift($stylesheets, $fontAwesomePath);
         }
         $stylesheets = array_unique(array_values($stylesheets));
     }
     $iehack = '<!--[if IE]><link rel="stylesheet" type="text/css" href="style/core_iehacks.css" media="print,projection,screen" /><![endif]-->';
     PageUtil::addVar('header', $iehack);
     return $stylesheets;
 }
开发者ID:Silwereth,项目名称:core,代码行数:52,代码来源:JCSSUtil.php

示例5: initialHandlerScan

 /**
  * Listens for 'bootstrap.getconfig' event.
  *
  * @param Zikula_Event $event Event.
  *
  * @return void
  */
 public function initialHandlerScan(Zikula_Event $event)
 {
     $core = $this->serviceManager->getService('zikula');
     ServiceUtil::getManager($core);
     EventUtil::getManager($core);
     $core->attachHandlers('config/EventHandlers');
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:14,代码来源:SystemListeners.php

示例6: getTemplateOverride

 /**
  * Execute a template override event.
  *
  * @param string $template Path to template.
  *
  * @throws InvalidArgumentException If event handler returns a non-existent template.
  *
  * @return mixed String if found, false if no override present.
  */
 public static function getTemplateOverride($template)
 {
     $event = new \Zikula\Core\Event\GenericEvent(null, array(), $template);
     EventUtil::getManager()->dispatch('zikula_view.template_override', $event);
     if ($event->isPropagationStopped()) {
         $ostemplate = DataUtil::formatForOS($event->getData());
         if (is_readable($ostemplate)) {
             return $ostemplate;
         } else {
             throw new InvalidArgumentException(__f('zikula_view.template_override returned a non-existent template path %s', $ostemplate));
         }
     }
     return false;
 }
开发者ID:Silwereth,项目名称:core,代码行数:23,代码来源:View.php

示例7: getPluginsAvailable

 /**
  * Available plugins list.
  *
  * @return array List of the available plugins.
  */
 public static function getPluginsAvailable()
 {
     $classNames = array();
     $classNames['category'] = 'FilterUtil_Filter_Category';
     $classNames['default'] = 'FilterUtil_Filter_Default';
     $classNames['date'] = 'FilterUtil_Filter_Date';
     $classNames['mnlist'] = 'FilterUtil_Filter_Mnlist';
     $classNames['pmlist'] = 'FilterUtil_Filter_Pmlist';
     $classNames['replaceName'] = 'FilterUtil_Filter_ReplaceName';
     // collect classes from other providers also allows for override
     // TODO A [This is only allowed for the module which owns this object.]
     $event = new GenericEvent();
     $event->setData($classNames);
     EventUtil::getManager()->dispatch('zikula.filterutil.get_plugin_classes', $event);
     $classNames = $event->getData();
     return $classNames;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:22,代码来源:PluginManager.php

示例8: exec

 /**
  * Run a module function.
  *
  * @param string  $modname    The name of the module.
  * @param string  $type       The type of function to run.
  * @param string  $func       The specific function to run.
  * @param array   $args       The arguments to pass to the function.
  * @param boolean $api        Whether or not to execute an API (or regular) function.
  * @param string  $instanceof Perform instanceof checking of target class.
  *
  * @throws Zikula_Exception_NotFound If method was not found.
  * @throws InvalidArgumentException  If the controller is not an instance of the class specified in $instanceof.
  *
  * @return mixed.
  */
 public static function exec($modname, $type = 'user', $func = 'main', $args = array(), $api = false, $instanceof = null)
 {
     // define input, all numbers and booleans to strings
     $modname = isset($modname) ? (string) $modname : '';
     $ftype = $api ? 'api' : '';
     $loadfunc = $api ? 'ModUtil::loadApi' : 'ModUtil::load';
     // validate
     if (!System::varValidate($modname, 'mod')) {
         return null;
     }
     // Remove from 1.4
     if (System::isLegacyMode() && $modname == 'Modules') {
         LogUtil::log(__('Warning! "Modules" module has been renamed to "Extensions".  Please update your ModUtil::func() and ModUtil::apiFunc() calls.'));
         $modname = 'Extensions';
     }
     $modinfo = self::getInfo(self::getIDFromName($modname));
     $path = $modinfo['type'] == self::TYPE_SYSTEM ? 'system' : 'modules';
     $controller = null;
     $modfunc = null;
     $loaded = call_user_func_array($loadfunc, array($modname, $type));
     if (self::isOO($modname)) {
         $result = self::getCallable($modname, $type, $func, $api);
         if ($result) {
             $modfunc = $result['callable'];
             $controller = $modfunc[0];
             if (!is_null($instanceof)) {
                 if (!$controller instanceof $instanceof) {
                     throw new InvalidArgumentException(__f('%1$s must be an instance of $2$s', array(get_class($controller), $instanceof)));
                 }
             }
         }
     }
     $modfunc = $modfunc ? $modfunc : "{$modname}_{$type}{$ftype}_{$func}";
     $eventManager = EventUtil::getManager();
     if ($loaded) {
         $preExecuteEvent = new Zikula_Event('module_dispatch.preexecute', $controller, array('modname' => $modname, 'modfunc' => $modfunc, 'args' => $args, 'modinfo' => $modinfo, 'type' => $type, 'api' => $api));
         $postExecuteEvent = new Zikula_Event('module_dispatch.postexecute', $controller, array('modname' => $modname, 'modfunc' => $modfunc, 'args' => $args, 'modinfo' => $modinfo, 'type' => $type, 'api' => $api));
         if (is_callable($modfunc)) {
             $eventManager->notify($preExecuteEvent);
             // Check $modfunc is an object instance (OO) or a function (old)
             if (is_array($modfunc)) {
                 if ($modfunc[0] instanceof Zikula_AbstractController) {
                     $reflection = call_user_func(array($modfunc[0], 'getReflection'));
                     $subclassOfReflection = new ReflectionClass($reflection->getParentClass());
                     if ($subclassOfReflection->hasMethod($modfunc[1])) {
                         // Don't allow front controller to access any public methods inside the controller's parents
                         throw new Zikula_Exception_NotFound();
                     }
                     $modfunc[0]->preDispatch();
                 }
                 $postExecuteEvent->setData(call_user_func($modfunc, $args));
                 if ($modfunc[0] instanceof Zikula_AbstractController) {
                     $modfunc[0]->postDispatch();
                 }
             } else {
                 $postExecuteEvent->setData($modfunc($args));
             }
             return $eventManager->notify($postExecuteEvent)->getData();
         }
         // get the theme
         if (ServiceUtil::getManager()->getService('zikula')->getStage() & Zikula_Core::STAGE_THEME) {
             $theme = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));
             if (file_exists($file = 'themes/' . $theme['directory'] . '/functions/' . $modname . "/{$type}{$ftype}/{$func}.php") || file_exists($file = 'themes/' . $theme['directory'] . '/functions/' . $modname . "/pn{$type}{$ftype}/{$func}.php")) {
                 include_once $file;
                 if (function_exists($modfunc)) {
                     EventUtil::notify($preExecuteEvent);
                     $postExecuteEvent->setData($modfunc($args));
                     return EventUtil::notify($postExecuteEvent)->getData();
                 }
             }
         }
         if (file_exists($file = "config/functions/{$modname}/{$type}{$ftype}/{$func}.php") || file_exists($file = "config/functions/{$modname}/pn{$type}{$ftype}/{$func}.php")) {
             include_once $file;
             if (is_callable($modfunc)) {
                 $eventManager->notify($preExecuteEvent);
                 $postExecuteEvent->setData($modfunc($args));
                 return $eventManager->notify($postExecuteEvent)->getData();
             }
         }
         if (file_exists($file = "{$path}/{$modname}/{$type}{$ftype}/{$func}.php") || file_exists($file = "{$path}/{$modname}/pn{$type}{$ftype}/{$func}.php")) {
             include_once $file;
             if (is_callable($modfunc)) {
                 $eventManager->notify($preExecuteEvent);
                 $postExecuteEvent->setData($modfunc($args));
                 return $eventManager->notify($postExecuteEvent)->getData();
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:ModUtil.php

示例9: prepareStylesheets

 /**
  * Procedure for managinig stylesheets.
  *
  * @param array $stylesheets List of demanded stylesheets.
  *
  * @return array List of stylesheets
  */
 public static function prepareStylesheets($stylesheets)
 {
     // Add generic stylesheet as the first stylesheet.
     $event = new GenericEvent('stylesheet', array(), array('style/core.css'));
     $coreStyle = EventUtil::getManager()->dispatch('pageutil.addvar_filter', $event);
     $coreStyle = $event->getData();
     if (is_array($stylesheets)) {
         array_unshift($stylesheets, $coreStyle[0]);
     } else {
         $stylesheets = array($coreStyle[0]);
     }
     $stylesheets = array_unique(array_values($stylesheets));
     $iehack = '<!--[if IE]><link rel="stylesheet" type="text/css" href="style/core_iehacks.css" media="print,projection,screen" /><![endif]-->';
     PageUtil::addVar('header', $iehack);
     return $stylesheets;
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:23,代码来源:JCSSUtil.php

示例10: exec

 /**
  * Run a module function.
  *
  * @param string  $modname    The name of the module.
  * @param string  $type       The type of function to run.
  * @param string  $func       The specific function to run.
  * @param array   $args       The arguments to pass to the function.
  * @param boolean $api        Whether or not to execute an API (or regular) function.
  * @param string  $instanceof Perform instanceof checking of target class.
  *
  * @throws Zikula_Exception_NotFound If method was not found.
  * @throws InvalidArgumentException  If the controller is not an instance of the class specified in $instanceof.
  *
  * @return mixed.
  */
 public static function exec($modname, $type = 'user', $func = 'main', $args = array(), $api = false, $instanceof = null)
 {
     // define input, all numbers and booleans to strings
     $modname = isset($modname) ? (string) $modname : '';
     $modname = static::convertModuleName($modname);
     // validate
     if (!System::varValidate($modname, 'mod')) {
         return null;
     }
     // Remove from 1.4
     if (System::isLegacyMode('1.4.0') && $modname == 'Modules') {
         LogUtil::log(__('Warning! "Modules" module has been renamed to "ZikulaExtensionsModule".  Please update your ModUtil::func() and ModUtil::apiFunc() calls.'));
         $modname = 'ZikulaExtensionsModule';
     }
     $modinfo = self::getInfo(self::getIDFromName($modname));
     $controller = null;
     $modfunc = null;
     $loaded = call_user_func_array($api ? 'ModUtil::loadApi' : 'ModUtil::load', array($modname, $type));
     if (self::isOO($modname)) {
         $result = self::getCallable($modname, $type, $func, $api);
         if ($result) {
             $modfunc = $result['callable'];
             $controller = $modfunc[0];
             if (!is_null($instanceof)) {
                 if (!$controller instanceof $instanceof) {
                     throw new InvalidArgumentException(__f('%1$s must be an instance of $2$s', array(get_class($controller), $instanceof)));
                 }
             }
         }
     }
     $eventManager = EventUtil::getManager();
     $sm = ServiceUtil::getManager();
     if ($loaded) {
         $preExecuteEvent = new \Zikula\Core\Event\GenericEvent($controller, array('modname' => $modname, 'modfunc' => $modfunc, 'args' => $args, 'modinfo' => $modinfo, 'type' => $type, 'api' => $api));
         $postExecuteEvent = new \Zikula\Core\Event\GenericEvent($controller, array('modname' => $modname, 'modfunc' => $modfunc, 'args' => $args, 'modinfo' => $modinfo, 'type' => $type, 'api' => $api));
         if (is_callable($modfunc)) {
             $eventManager->dispatch('module_dispatch.preexecute', $preExecuteEvent);
             // Check $modfunc is an object instance (OO) or a function (old)
             if (is_array($modfunc)) {
                 try {
                     self::getModule($modname);
                     $newType = true;
                 } catch (\Exception $e) {
                     $newType = false;
                 }
                 if ($args) {
                     $newType = false;
                 }
                 if (!$api && $newType) {
                     // resolve request args.
                     $resolver = new ControllerResolver($sm, new ControllerNameParser(ServiceUtil::get('kernel')));
                     try {
                         $r = new \ReflectionClass($modfunc[0]);
                         if (!$r->hasMethod($modfunc[1])) {
                             // Method doesn't exist. Do some BC handling.
                             // First try to remove the 'Action' suffix.
                             $modfunc[1] = preg_replace('/(\\w+)Action$/', '$1', $modfunc[1]);
                             if (!$r->hasMethod($modfunc[1])) {
                                 // Method still not found. Try to use the old 'main' method name.
                                 if ($modfunc[1] == 'index') {
                                     $modfunc[1] = $r->hasMethod('mainAction') ? 'mainAction' : 'main';
                                 }
                             }
                         }
                         if ($r->hasMethod($modfunc[1])) {
                             // Did we get a valid method? If so, resolve arguments!
                             $methodArgs = $resolver->getArguments($sm->get('request'), $modfunc);
                         } else {
                             // We still didn't get a valid method. Do not use argument resolving.
                             $newType = false;
                         }
                     } catch (\RuntimeException $e) {
                         // Something went wrong. Check if the method still uses the old non-Symfony $args array.
                         if ($modfunc[0] instanceof \Zikula_AbstractBase) {
                             $r = new \ReflectionMethod($modfunc[0], $modfunc[1]);
                             $parameters = $r->getParameters();
                             if (count($parameters) == 1) {
                                 $firstParameter = $parameters[0];
                                 if ($firstParameter->getName() == 'args') {
                                     // The method really uses the old $args parameter. In this case we can continue
                                     // using the old Controller call and don't have to throw an exception.
                                     $newType = false;
                                 }
                             }
                         }
//.........这里部分代码省略.........
开发者ID:rmaiwald,项目名称:core,代码行数:101,代码来源:ModUtil.php

示例11: installmodules

function installmodules($lang = 'en')
{
    // This is a temporary hack for release 1.3.x to be able to install modules
    // load Doctrine plugin
    include_once __DIR__ . '/../plugins/Doctrine/Plugin.php';
    PluginUtil::loadPlugin('SystemPlugin_Doctrine_Plugin');
    // load DoctrineExtensions plugin
    include_once __DIR__ . '/../plugins/DoctrineExtensions/Plugin.php';
    PluginUtil::loadPlugin('SystemPlugin_DoctrineExtensions_Plugin');
    $connection = Doctrine_Manager::connection();
    // Lang validation
    $lang = DataUtil::formatForOS($lang);
    // create a result set
    $results = array();
    $sm = ServiceUtil::getManager();
    $em = EventUtil::getManager();
    $coremodules = array('Extensions', 'Settings', 'Theme', 'Admin', 'Permissions', 'Groups', 'Blocks', 'Users');
    // manually install the modules module
    foreach ($coremodules as $coremodule) {
        $modpath = 'system';
        if (is_dir("{$modpath}/{$coremodule}/lib")) {
            ZLoader::addAutoloader($coremodule, "{$modpath}/{$coremodule}/lib");
        }
        $bootstrap = "{$modpath}/{$coremodule}/bootstrap.php";
        if (file_exists($bootstrap)) {
            include_once $bootstrap;
        }
        ModUtil::dbInfoLoad($coremodule, $coremodule);
        $className = "{$coremodule}_Installer";
        $instance = new $className($sm);
        if ($instance->install()) {
            $results[$coremodule] = true;
        }
    }
    // regenerate modules list
    $filemodules = ModUtil::apiFunc('Extensions', 'admin', 'getfilemodules');
    ModUtil::apiFunc('Extensions', 'admin', 'regenerate', array('filemodules' => $filemodules));
    // set each of the core modules to active
    reset($coremodules);
    foreach ($coremodules as $coremodule) {
        $mid = ModUtil::getIdFromName($coremodule, true);
        ModUtil::apiFunc('Extensions', 'admin', 'setstate', array('id' => $mid, 'state' => ModUtil::STATE_INACTIVE));
        ModUtil::apiFunc('Extensions', 'admin', 'setstate', array('id' => $mid, 'state' => ModUtil::STATE_ACTIVE));
    }
    // Add them to the appropriate category
    reset($coremodules);
    $coremodscat = array('Extensions' => __('System'), 'Permissions' => __('Users'), 'Groups' => __('Users'), 'Blocks' => __('Layout'), 'Users' => __('Users'), 'Theme' => __('Layout'), 'Admin' => __('System'), 'Settings' => __('System'));
    $categories = ModUtil::apiFunc('Admin', 'admin', 'getall');
    $modscat = array();
    foreach ($categories as $category) {
        $modscat[$category['name']] = $category['cid'];
    }
    foreach ($coremodules as $coremodule) {
        $category = $coremodscat[$coremodule];
        ModUtil::apiFunc('Admin', 'admin', 'addmodtocategory', array('module' => $coremodule, 'category' => $modscat[$category]));
    }
    // create the default blocks.
    $blockInstance = new Blocks_Installer($sm);
    $blockInstance->defaultdata();
    // install all the basic modules
    $modules = array(array('module' => 'SecurityCenter', 'category' => __('Security')), array('module' => 'Tour', 'category' => __('Content')), array('module' => 'Categories', 'category' => __('Content')), array('module' => 'Legal', 'category' => __('Content')), array('module' => 'Mailer', 'category' => __('System')), array('module' => 'Errors', 'category' => __('System')), array('module' => 'Theme', 'category' => __('Layout')), array('module' => 'Search', 'category' => __('Content')));
    foreach ($modules as $module) {
        // sanity check - check if module is already installed
        if (ModUtil::available($module['module'])) {
            continue;
        }
        $modpath = 'modules';
        if (is_dir("{$modpath}/{$module}/lib")) {
            ZLoader::addAutoloader($module, "{$modpath}/{$module}/lib");
        }
        $bootstrap = "{$modpath}/{$module}/bootstrap.php";
        if (file_exists($bootstrap)) {
            include_once $bootstrap;
        }
        ZLanguage::bindModuleDomain($module);
        $results[$module['module']] = false;
        // #6048 - prevent trying to install modules which are contained in an install type, but are not available physically
        if (!file_exists('system/' . $module['module'] . '/') && !file_exists('modules/' . $module['module'] . '/')) {
            continue;
        }
        $mid = ModUtil::getIdFromName($module['module']);
        // init it
        if (ModUtil::apiFunc('Extensions', 'admin', 'initialise', array('id' => $mid)) == true) {
            // activate it
            if (ModUtil::apiFunc('Extensions', 'admin', 'setstate', array('id' => $mid, 'state' => ModUtil::STATE_ACTIVE))) {
                $results[$module['module']] = true;
            }
            // Set category
            ModUtil::apiFunc('Admin', 'admin', 'addmodtocategory', array('module' => $module['module'], 'category' => $modscat[$module['category']]));
        }
    }
    System::setVar('language_i18n', $lang);
    return $results;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:94,代码来源:lib.php

示例12: loader

    /**
     * Initialise Scribite for requested areas.
     *
     * @param array $args Module name: 'modulename'.
     *
     * @return string
     */
    private function loader($args)
    {
        // Argument checks
        $module = (isset($args['modulename'])) ? $args['modulename'] : ModUtil::getName();
        
        $overrides = ModUtil::getVar('Scribite', 'overrides');
        $editor = (isset($overrides[$module]['editor'])) ? $overrides[$module]['editor'] : ModUtil::getVar('Scribite', 'DefaultEditor');

        // check for modules providing helpers and load them into the page
        $event = new Zikula_Event('module.scribite.editorhelpers', new Scribite_EditorHelper(), array('editor' => $editor));
        $helpers = EventUtil::getManager()->notify($event)->getSubject()->getHelpers();
        foreach ($helpers as $helper) {
            if (ModUtil::available($helper['module'])) {
                PageUtil::AddVar($helper['type'], $helper['path']);            
            }
        }
        
        // check for allowed html
        $AllowableHTML = System::getVar('AllowableHTML');
        $disallowedhtml = array();
        while (list($key, $access) = each($AllowableHTML)) {
            if ($access == 0) {
                $disallowedhtml[] = DataUtil::formatForDisplay($key);
            }
        }

        // fetch additonal editor specific parameters.
        $classname = 'ModulePlugin_Scribite_' . $editor . '_Util';
        $additionalEditorParameters = array();
        if (method_exists($classname, 'addParameters')) {
            $additionalEditorParameters = $classname::addParameters();
        }
        // fetch external editor plugins
        $additionalExternalEditorPlugins = array();
        if (method_exists($classname, 'addExternalPlugins')) {
            $additionalExternalEditorPlugins = $classname::addExternalPlugins();
        }

        // assign disabled textareas to template as a javascript array
        $javascript = "var disabledTextareas=[";
        if (isset($overrides[$module])) {
            foreach (array_keys($overrides[$module]) as $area) {
                if ($area == 'editor') continue;
                if ((isset($overrides[$module][$area]['disabled'])) && ($overrides[$module][$area]['disabled'] == "true")) {
                    $javascript .= "'" . $area . "',";
                }
            }
        }
        $javascript = rtrim($javascript, ",");
        $javascript .= "];";
        PageUtil::addVar("footer", "<script type='text/javascript'>$javascript</script>");
        
        // assign override parameters to javascript object
        $javascript = "";
        $paramOverrides = false;
        if (isset($overrides[$module])) {
            foreach ($overrides[$module] as $area => $config) {
                if ($area == 'editor') continue;
                if (!empty($config['params'])) {
                    $paramOverrides = true;
                    $javascript .= "var paramOverrides_$area = {";
                    foreach ($config['params'] as $param => $value) {
                        $javascript .= "\n    $param: '$value',";
                    }
                    
                    $javascript .= "\n}";
                }
            }
        }
        PageUtil::addVar("footer", "<script type='text/javascript'>\n$javascript\n</script>");
        
        // insert notify function
        PageUtil::addVar('javascript', 'modules/Scribite/javascript/function-insertnotifyinput.js');

        $view = Zikula_View_Plugin::getPluginInstance("Scribite", $editor, Zikula_View::CACHE_DISABLED);

        // assign to template in Scribite 'namespace'
        $templateVars = array('editorVars' => ModUtil::getVar("moduleplugin.scribite." . strtolower($editor)),
            'modname' => $module,
            'disallowedhtml' => $disallowedhtml,
            'paramOverrides' => $paramOverrides);
        if (!empty($additionalEditorParameters)) {
            $templateVars['editorParameters'] = $additionalEditorParameters;
        }
        if (!empty($additionalExternalEditorPlugins)) {
            $templateVars['addExtEdPlugins'] = $additionalExternalEditorPlugins;
        }
        $view->assign('Scribite', $templateVars);

        return $view->fetch("editorheader.tpl");
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:98,代码来源:HookHandlers.php

示例13: addVar

 /**
  * Add var.
  *
  * Adds a new vaule to a page variable. In the case of a single
  * page variable, this functions acts exactly like PageUtil::setVar.
  *
  * @param string $varname The name of the page variable.
  * @param mixed  $value   The new value.
  *
  * @see    PageUtil::setVar
  * @return boolean true On success, false of the page variable is not registered.
  */
 public static function addVar($varname, $value)
 {
     global $_pageVars;
     // check for $_pageVars sanity
     if (!isset($_pageVars)) {
         $_pageVars = array();
     } elseif (!is_array($_pageVars)) {
         return false;
     }
     if (!isset($_pageVars[$varname])) {
         return false;
     }
     if (is_array($value)) {
         $value = array_unique($value);
     }
     $event = new GenericEvent($varname, array(), $value);
     $value = EventUtil::getManager()->dispatch('pageutil.addvar_filter', $event)->getData();
     if ($_pageVars[$varname]['multivalue']) {
         if (is_array($value)) {
             $_pageVars[$varname]['contents'] = array_merge($_pageVars[$varname]['contents'], $value);
         } else {
             $_pageVars[$varname]['contents'][] = $value;
         }
         // make values unique
         $_pageVars[$varname]['contents'] = array_unique($_pageVars[$varname]['contents']);
     } else {
         $_pageVars[$varname]['contents'] = $value;
     }
     return true;
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:42,代码来源:PageUtil.php

示例14: addVar

 /**
  * Add var.
  *
  * Adds a new vaule to a page variable. In the case of a single
  * page variable, this functions acts exactly like PageUtil::setVar.
  *
  * @param string $varname  The name of the page variable.
  * @param mixed  $value    The new value.
  * @param string $features The feature(s) to load via polyfill.
  *
  * @see    PageUtil::setVar
  * @return boolean true On success, false of the page variable is not registered.
  */
 public static function addVar($varname, $value, $features = 'forms')
 {
     global $_pageVars;
     if (System::isLegacyMode()) {
         switch ($varname) {
             case 'rawtext':
                 LogUtil::log(__f('Warning! The page variable %1$s is deprecated. Please use %2$s instead.', array('rawtext', 'header')), E_USER_DEPRECATED);
                 $varname = 'header';
                 break;
         }
     }
     // check for $_pageVars sanity
     if (!isset($_pageVars)) {
         $_pageVars = array();
     } elseif (!is_array($_pageVars)) {
         return false;
     }
     if (!isset($_pageVars[$varname])) {
         return false;
     }
     if (is_array($value)) {
         $value = array_unique($value);
     }
     $value = self::resolveSymfonyAsset($value);
     // @todo Remove in 1.5.0.
     $value = self::fixJQueryThemesPath($value);
     $event = new \Zikula\Core\Event\GenericEvent($varname, array(), $value);
     $value = EventUtil::getManager()->dispatch('pageutil.addvar_filter', $event)->getData();
     if ($_pageVars[$varname]['multivalue']) {
         if (is_array($value)) {
             if (in_array('polyfill', $value)) {
                 $features = explode(' ', $features);
                 foreach ($features as $feature) {
                     PageUtil::addVar('polyfill_features', $feature);
                 }
                 $_pageVars[$varname]['contents'] = array_merge($_pageVars[$varname]['contents'], $value);
             } else {
                 $_pageVars[$varname]['contents'] = array_merge($_pageVars[$varname]['contents'], $value);
             }
         } else {
             $_pageVars[$varname]['contents'][] = $value;
         }
         // make values unique
         $_pageVars[$varname]['contents'] = array_unique($_pageVars[$varname]['contents']);
     } else {
         $_pageVars[$varname]['contents'] = $value;
     }
     return true;
 }
开发者ID:rmaiwald,项目名称:core,代码行数:62,代码来源:PageUtil.php

示例15: requireSession

 /**
  * Session required.
  *
  * Starts a session or terminates loading.
  *
  * @return void
  */
 public static function requireSession()
 {
     $event = new GenericEvent();
     EventUtil::getManager()->dispatch('session.require', $event);
 }
开发者ID:planetenkiller,项目名称:core,代码行数:12,代码来源:SessionUtil.php


注:本文中的EventUtil::getManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。