• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Application\Icinga类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Icinga\Application\Icinga的典型用法代码示例。如果您正苦于以下问题:PHP Icinga类的具体用法?PHP Icinga怎么用?PHP Icinga使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: addLoadedModules

 public function addLoadedModules()
 {
     foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $name => $module) {
         $this->addModule($name, $module);
     }
     return $this;
 }
开发者ID:hsanjuan,项目名称:icingaweb2,代码行数:7,代码来源:LessCompiler.php


示例2: send

 public static function send($minified = false)
 {
     header('Content-Type: application/javascript');
     $basedir = Icinga::app()->getBootstrapDirecory();
     $js = $out = '';
     $min = $minified ? '.min' : '';
     // TODO: Cache header
     header('Content-Type: application/javascript');
     $cacheFile = '/tmp/cache_icinga' . $min . '.js';
     if (file_exists($cacheFile)) {
         readfile($cacheFile);
         exit;
     }
     // We do not minify vendor files
     foreach (self::$vendorFiles as $file) {
         $out .= file_get_contents($basedir . '/' . $file . $min . '.js');
     }
     foreach (self::$jsFiles as $file) {
         $js .= file_get_contents($basedir . '/' . $file);
     }
     foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $name => $module) {
         if ($module->hasJs()) {
             $js .= file_get_contents($module->getJsFilename());
         }
     }
     if ($minified) {
         require_once 'IcingaVendor/JShrink/Minifier.php';
         $out .= Minifier::minify($js, array('flaggedComments' => false));
     } else {
         $out .= $js;
     }
     // Not yet, this is for tests only. Waiting for Icinga\Web\Cache
     // file_put_contents($cacheFile, $out);
     echo $out;
 }
开发者ID:vbereza,项目名称:icinga2-migration,代码行数:35,代码来源:JavaScript.php


示例3: getView

 /**
  * Get the view this menu item is being rendered to
  *
  * @return View
  */
 protected function getView()
 {
     if ($this->view === null) {
         $this->view = Icinga::app()->getViewRenderer()->view;
     }
     return $this->view;
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:12,代码来源:MenuItemRenderer.php


示例4: imgAction

 /**
  * Return an image from the application's or the module's public folder
  */
 public function imgAction()
 {
     // TODO(el): I think this action only retrieves images from modules
     $module = $this->_getParam('module_name');
     $file = $this->_getParam('file');
     $basedir = Icinga::app()->getModuleManager()->getModule($module)->getBaseDir();
     $filePath = realpath($basedir . '/public/img/' . $file);
     if ($filePath === false) {
         $this->httpNotFound('%s does not exist', $filePath);
     }
     if (preg_match('/\\.([a-z]+)$/i', $file, $m)) {
         $extension = $m[1];
         if ($extension === 'svg') {
             $extension = 'svg+xml';
         }
     } else {
         $extension = 'fixme';
     }
     $s = stat($filePath);
     header('Content-Type: image/' . $extension);
     header(sprintf('ETag: "%x-%x-%x"', $s['ino'], $s['size'], (double) str_pad($s['mtime'], 16, '0')));
     header('Cache-Control: public, max-age=3600');
     header('Pragma: cache');
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $s['mtime']) . ' GMT');
     readfile($filePath);
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:29,代码来源:StaticController.php


示例5: serveAction

 public function serveAction()
 {
     $minVersion = '5.4.0';
     if (version_compare(PHP_VERSION, $minVersion) < 0) {
         throw new IcingaException('You are running PHP %s, internal webserver requires %s.', PHP_VERSION, $minVersion);
     }
     $fork = $this->params->get('daemonize');
     $documentRoot = $this->params->shift();
     $socket = $this->params->shift();
     // TODO: Sanity check!!
     if ($socket === null) {
         $socket = '0.0.0.0:80';
         // throw new IcingaException('Socket is required');
     }
     if ($documentRoot === null) {
         $documentRoot = Icinga::app()->getBaseDir('public');
         if (!file_exists($documentRoot) || !is_dir($documentRoot)) {
             throw new IcingaException('Document root directory is required');
         }
     }
     $documentRoot = realpath($documentRoot);
     if ($fork) {
         $this->forkAndExit();
     }
     echo "Serving Icingaweb from {$documentRoot}\n";
     $cmd = sprintf('%s -S %s -t %s %s', readlink('/proc/self/exe'), $socket, $documentRoot, Icinga::app()->getLibraryDir('/Icinga/Application/webrouter.php'));
     // TODO: Store webserver log, switch uid, log index.php includes, pid file
     if ($fork) {
         exec($cmd);
     } else {
         passthru($cmd);
     }
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:33,代码来源:WebCommand.php


示例6: fromConfig

 /**
  * Create menu from the application's menu config file plus the config files from all enabled modules
  *
  * @return  self
  */
 public static function fromConfig()
 {
     $menu = new static('menu');
     $manager = Icinga::app()->getModuleManager();
     try {
         $menuConfigs = array(Config::app('menu'));
     } catch (NotReadableError $e) {
         Logger::error($e);
         $menuConfigs = array();
     }
     try {
         $modules = $manager->listEnabledModules();
     } catch (NotReadableError $e) {
         Logger::error($e);
         $modules = array();
     }
     foreach ($modules as $moduleName) {
         try {
             $moduleMenuConfig = Config::module($moduleName, 'menu');
         } catch (NotReadableError $e) {
             Logger::error($e);
             $moduleMenuConfig = array();
         }
         if (!empty($moduleMenuConfig)) {
             $menuConfigs[] = $moduleMenuConfig;
         }
     }
     return $menu->loadMenuItems($menu->flattenConfigs($menuConfigs));
 }
开发者ID:vbereza,项目名称:icinga2-migration,代码行数:34,代码来源:Menu.php


示例7: getConfigDir

 public function getConfigDir()
 {
     if ($this->configDir === null) {
         $dir = Icinga::app()->getModuleManager()->getModule('businessprocess')->getConfigDir();
         // TODO: This is silly. We need Config::requireDirectory().
         if (!is_dir($dir)) {
             if (!is_dir(dirname($dir))) {
                 if (!@mkdir(dirname($dir))) {
                     throw new SystemPermissionException('Could not create config directory "%s"', dirname($dir));
                 }
             }
             if (!mkdir($dir)) {
                 throw new SystemPermissionException('Could not create config directory "%s"', $dir);
             }
         }
         $dir = $dir . '/processes';
         if (!is_dir($dir)) {
             if (!mkdir($dir)) {
                 throw new SystemPermissionException('Could not create config directory "%s"', $dir);
             }
         }
         $this->configDir = $dir;
     }
     return $this->configDir;
 }
开发者ID:0svald,项目名称:icingaweb2-module-businessprocess,代码行数:25,代码来源:LegacyStorage.php


示例8: init

 /**
  * {@inheritdoc}
  */
 public function init()
 {
     $this->providedPermissions = array('*' => $this->translate('Allow everything') . ' (*)', 'application/stacktraces' => $this->translate('Allow to adjust in the preferences whether to show stacktraces') . ' (application/stacktraces)', 'config/*' => $this->translate('Allow config access') . ' (config/*)');
     $helper = new Zend_Form_Element('bogus');
     $mm = Icinga::app()->getModuleManager();
     foreach ($mm->listInstalledModules() as $moduleName) {
         $modulePermission = $mm::MODULE_PERMISSION_NS . $moduleName;
         $this->providedPermissions[$modulePermission] = sprintf($this->translate('Allow access to module %s') . ' (%s)', $moduleName, $modulePermission);
         $module = $mm->getModule($moduleName, false);
         foreach ($module->getProvidedPermissions() as $permission) {
             /** @var object $permission */
             $this->providedPermissions[$permission->name] = $permission->description . ' (' . $permission->name . ')';
         }
         foreach ($module->getProvidedRestrictions() as $restriction) {
             /** @var object $restriction */
             // Zend only permits alphanumerics, the underscore, the circumflex and any ASCII character in range
             // \x7f to \xff (127 to 255)
             $name = $helper->filterName($restriction->name);
             while (isset($this->providedRestrictions[$name])) {
                 // Because Zend_Form_Element::filterName() replaces any not permitted character with the empty
                 // string we may have duplicate names, e.g. 're/striction' and 'restriction'
                 $name .= '_';
             }
             $this->providedRestrictions[$name] = array('description' => $restriction->description, 'name' => $restriction->name);
         }
     }
 }
开发者ID:JakobGM,项目名称:icingaweb2,代码行数:30,代码来源:RoleForm.php


示例9: load

 public static function load($name, Module $module = null)
 {
     if ($module === null) {
         $basedir = Icinga::app()->getApplicationDir('forms');
         $ns = '\\Icinga\\Web\\Forms\\';
     } else {
         $basedir = $module->getFormDir();
         $ns = '\\Icinga\\Module\\' . ucfirst($module->getName()) . '\\Forms\\';
     }
     if (preg_match('~^[a-z0-9/]+$~i', $name)) {
         $parts = preg_split('~/~', $name);
         $class = ucfirst(array_pop($parts)) . 'Form';
         $file = sprintf('%s/%s/%s.php', rtrim($basedir, '/'), implode('/', $parts), $class);
         if (file_exists($file)) {
             require_once $file;
             $class = $ns . $class;
             $options = array();
             if ($module !== null) {
                 $options['icingaModule'] = $module;
             }
             return new $class($options);
         }
     }
     throw new ProgrammingError(sprintf('Cannot load %s (%s), no such form', $name, $file));
 }
开发者ID:dgoeger,项目名称:icingadirector,代码行数:25,代码来源:FormLoader.php


示例10: view

 /**
  * Access the current view
  *
  * Will instantiate a new one if none exists
  * // TODO: App->getView
  *
  * @return Zend_View_Abstract
  */
 protected function view()
 {
     if (self::$view === null) {
         self::$view = Icinga::app()->getViewRenderer()->view;
     }
     return self::$view;
 }
开发者ID:vbereza,项目名称:icinga2-migration,代码行数:15,代码来源:AbstractWidget.php


示例11: Module

 /**
  * Return this controller's module
  *
  * @return  Module
  */
 public function Module()
 {
     if ($this->module === null) {
         $this->module = Icinga::app()->getModuleManager()->getModule($this->getModuleName());
     }
     return $this->module;
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:12,代码来源:ModuleActionController.php


示例12: render

 /**
  * {@inheritdoc}
  */
 public function render()
 {
     $repo = new AnnouncementIniRepository();
     $etag = $repo->getEtag();
     $cookie = new AnnouncementCookie();
     if ($cookie->getEtag() !== $etag) {
         $cookie->setEtag($etag);
         $cookie->setNextActive($repo->findNextActive());
         Icinga::app()->getResponse()->setCookie($cookie);
     }
     $acked = array();
     foreach ($cookie->getAcknowledged() as $hash) {
         $acked[] = Filter::expression('hash', '!=', $hash);
     }
     $acked = Filter::matchAll($acked);
     $announcements = $repo->findActive();
     $announcements->applyFilter($acked);
     if ($announcements->hasResult()) {
         $html = '<ul role="alert" id="announcements">';
         foreach ($announcements as $announcement) {
             $ackForm = new AcknowledgeAnnouncementForm();
             $ackForm->populate(array('hash' => $announcement->hash));
             $html .= '<li><div>' . $this->view()->escape($announcement->message) . '</div>' . $ackForm . '</li>';
         }
         $html .= '</ul>';
         return $html;
     }
     // Force container update on XHR
     return '<div style="display: none;"></div>';
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:33,代码来源:Announcements.php


示例13: getResponse

 /**
  * Get the response
  *
  * @return Response
  */
 public function getResponse()
 {
     if ($this->response === null) {
         $this->response = Icinga::app()->getResponse();
     }
     return $this->response;
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:12,代码来源:Request.php


示例14: getRequest

 /**
  * Get the request
  *
  * @return Request
  */
 public function getRequest()
 {
     if ($this->request === null) {
         $this->request = Icinga::app()->getRequest();
     }
     return $this->request;
 }
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:12,代码来源:Response.php


示例15: send

 /**
  * Send the client side script code to the client
  *
  * Does not cache the client side script code if the HTTP header Cache-Control or Pragma is set to no-cache.
  *
  * @param   bool    $minified   Whether to compress the client side script code
  */
 public static function send($minified = false)
 {
     header('Content-Type: application/javascript');
     $basedir = Icinga::app()->getBootstrapDirectory();
     $js = $out = '';
     $min = $minified ? '.min' : '';
     // Prepare vendor file list
     $vendorFiles = array();
     foreach (self::$vendorFiles as $file) {
         $vendorFiles[] = $basedir . '/' . $file . $min . '.js';
     }
     // Prepare Icinga JS file list
     $jsFiles = array();
     foreach (self::$jsFiles as $file) {
         $jsFiles[] = $basedir . '/' . $file;
     }
     foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $name => $module) {
         if ($module->hasJs()) {
             foreach ($module->getJsFiles() as $path) {
                 if (file_exists($path)) {
                     $jsFiles[] = $path;
                 }
             }
         }
     }
     $files = array_merge($vendorFiles, $jsFiles);
     $request = Icinga::app()->getRequest();
     $noCache = $request->getHeader('Cache-Control') === 'no-cache' || $request->getHeader('Pragma') === 'no-cache';
     if (!$noCache && FileCache::etagMatchesFiles($files)) {
         header("HTTP/1.1 304 Not Modified");
         return;
     } else {
         $etag = FileCache::etagForFiles($files);
     }
     header('Cache-Control: public');
     header('ETag: "' . $etag . '"');
     header('Content-Type: application/javascript');
     $cacheFile = 'icinga-' . $etag . $min . '.js';
     $cache = FileCache::instance();
     if (!$noCache && $cache->has($cacheFile)) {
         $cache->send($cacheFile);
         return;
     }
     // We do not minify vendor files
     foreach ($vendorFiles as $file) {
         $out .= ';' . ltrim(trim(file_get_contents($file)), ';') . "\n";
     }
     foreach ($jsFiles as $file) {
         $js .= file_get_contents($file) . "\n\n\n";
     }
     if ($minified) {
         require_once 'JShrink/Minifier.php';
         $out .= Minifier::minify($js, array('flaggedComments' => false));
     } else {
         $out .= $js;
     }
     $cache->store($cacheFile, $out);
     echo $out;
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:66,代码来源:JavaScript.php


示例16: dump

 /**
  * Dump benchmark data
  *
  * Will dump a text table if running on CLI and a simple HTML table
  * otherwise. Use Benchmark::TIME and Benchmark::MEMORY to choose whether
  * you prefer to show either time or memory or both in your output
  *
  * @param  int   Whether to get time and/or memory summary
  * @return string
  */
 public static function dump($what = null)
 {
     if (Icinga::app()->isCli()) {
         echo self::renderToText($what);
     } else {
         echo self::renderToHtml($what);
     }
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:18,代码来源:Benchmark.php


示例17: createElements

 /**
  * {@inheritdoc}
  *
  * @return  $this
  */
 public function createElements(array $formData)
 {
     $themes = Icinga::app()->getThemes();
     $themes[StyleSheet::DEFAULT_THEME] .= ' (' . $this->translate('default') . ')';
     $this->addElement('select', 'themes_default', array('description' => $this->translate('The default theme', 'Form element description'), 'disabled' => count($themes) < 2 ? 'disabled' : null, 'label' => $this->translate('Default Theme', 'Form element label'), 'multiOptions' => $themes, 'value' => StyleSheet::DEFAULT_THEME));
     $this->addElement('checkbox', 'themes_disabled', array('description' => $this->translate('Check this box for disallowing users to change the theme. If a default theme is set, it will be' . ' used nonetheless', 'Form element description'), 'label' => $this->translate('Users Can\'t Change Theme', 'Form element label')));
     return $this;
 }
开发者ID:0svald,项目名称:icingaweb2,代码行数:13,代码来源:ThemingConfigForm.php


示例18: init

 public function init()
 {
     $m = Icinga::app()->getModuleManager();
     if (!$m->hasLoaded('monitoring') && $m->hasInstalled('monitoring')) {
         $m->loadModule('monitoring');
     }
     $this->view->errors = array();
     $this->view->compact = $this->params->get('view') === 'compact';
 }
开发者ID:0svald,项目名称:icingaweb2-module-businessprocess,代码行数:9,代码来源:Controller.php


示例19: getFields

 /**
  * Returns a ordered list of fields to show in the table
  *
  * @return array
  */
 public function getFields()
 {
     if ($this->fields !== null) {
         return $this->fields;
     }
     $fields = Icinga::app()->getRequest()->getUrl()->getParam('fields');
     $fields = preg_split('/\\s*,\\s*/', $fields, -1, PREG_SPLIT_NO_EMPTY);
     return $this->fields = $fields;
 }
开发者ID:Icinga,项目名称:icingaweb2-module-elasticsearch,代码行数:14,代码来源:FieldSelector.php


示例20: collectModuleTabs

 /**
  * Collect module tabs for all modules containing the given controller
  *
  * @param string $controller        The controller name to use for tab collection
  *
  * @return array                    An array of Tabs objects or arrays containing Tab descriptions
  */
 private static function collectModuleTabs($controller)
 {
     $moduleManager = Icinga::app()->getModuleManager();
     $modules = $moduleManager->listEnabledModules();
     $tabs = array();
     foreach ($modules as $module) {
         $tabs += self::createModuleConfigurationTabs($controller, $moduleManager->getModule($module));
     }
     return $tabs;
 }
开发者ID:kobmaki,项目名称:icingaweb2,代码行数:17,代码来源:ControllerTabCollector.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Application\Logger类代码示例发布时间:2022-05-23
下一篇:
PHP Application\Config类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap