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


PHP core\Zibo类代码示例

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


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

示例1: setInvertToCreatedFilter

 protected static function setInvertToCreatedFilter(AbstractInvertLogItemFilter $filter, Zibo $zibo, $name, $configBase)
 {
     $configInvert = $configBase . Module::CONFIG_INVERT;
     $invert = $zibo->getConfigValue($configInvert);
     if ($invert !== null) {
         $filter->setInvert($invert);
     }
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:8,代码来源:AbstractInvertLogItemFilter.php

示例2: getContainer

 /**
  * Gets the dependency container
  * @param zibo\core\Zibo $zibo Instance of zibo
  * @return zibo\core\di\DependencyContainer
  */
 public function getContainer(Zibo $zibo)
 {
     $container = new DependencyContainer();
     $files = array_reverse($zibo->getFiles(self::PATH_FILE));
     foreach ($files as $file) {
         $this->readDependencies($container, $file);
     }
     return $container;
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:14,代码来源:XmlDependencyIO.php

示例3: getMimeType

 /**
  * Gets the MIME type of a file based on it's extension
  * @param zibo\core\Zibo $zibo Instance of Zibo
  * @param zibo\library\filesystem\File $file The file to get the MIME from
  * @return string The MIME type of the file
  */
 public static function getMimeType(Zibo $zibo, File $file)
 {
     $extension = $file->getExtension();
     if (empty($extension)) {
         return self::MIME_UNKNOWN;
     }
     $mime = $zibo->getConfigValue(self::CONFIG_MIME . $extension);
     if (!$mime) {
         $mime = self::MIME_UNKNOWN;
     }
     return $mime;
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:18,代码来源:Mime.php

示例4: testMainWithChainedRequests

 public function testMainWithChainedRequests()
 {
     $routerMock = $this->getMock('zibo\\core\\router\\Router', array('getRequest', 'getRoutes', 'getAliases'));
     $routerMockCall = $routerMock->expects($this->once());
     $routerMockCall->method('getRequest');
     $routerMockCall->will($this->returnValue(new Request('', '', 'zibo\\core\\TestController', 'chainAction')));
     $zibo = new Zibo($this->getBrowserMock(), $this->getConfigIOMock());
     $zibo->setRouter($routerMock);
     $zibo->setDispatcher(new GenericDispatcher($zibo, new ObjectFactory()));
     $zibo->main();
     $this->assertEquals(array('chain', 'index'), TestController::$actions);
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:12,代码来源:ZiboTest.php

示例5: getTranslations

 /**
  * Gets all the translations for the provided locale
  * @param string $localeCode code of the locale
  * @return array an associative array with translation key - value pairs
  * @throws zibo\ZiboException when the locale code is empty or invalid
  */
 public function getTranslations($localeCode)
 {
     if (!String::isString($localeCode, String::NOT_EMPTY)) {
         throw new ZiboException('Provided locale code is empty');
     }
     if (isset($this->translations[$localeCode])) {
         return $this->translations[$localeCode];
     }
     $this->translations[$localeCode] = array();
     $translationFile = Zibo::DIRECTORY_L10N . File::DIRECTORY_SEPARATOR . $localeCode . self::EXTENSION;
     $translationFiles = array_reverse($this->zibo->getFiles($translationFile));
     $this->translations[$localeCode] = $this->getTranslationsFromFiles($translationFiles);
     return $this->translations[$localeCode];
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:20,代码来源:IniTranslationIO.php

示例6: dispatch

 /**
  * Dispatches a request to the action of a controller
  * @param Request $request The request to dispatch
  * @param Response $response The response to dispatch the request to
  * @return mixed The return value of the action
  * @throws zibo\ZiboException when the action is not invokable
  */
 public function dispatch(Request $request, Response $response)
 {
     $controller = $this->getController($request);
     $actionName = $request->getActionName();
     $parameters = $request->getParameters();
     $callback = $this->processAction($controller, $actionName, $parameters);
     $this->prepareController($controller, $request, $response, $actionName, $parameters);
     $this->zibo->triggerEvent(self::EVENT_PRE_DISPATCH, $controller, $actionName, $parameters);
     $controller->preAction();
     $returnValue = $callback->invokeWithArrayArguments($parameters);
     $controller->postAction();
     $this->zibo->triggerEvent(self::EVENT_POST_DISPATCH, $controller, $actionName, $parameters);
     return $returnValue;
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:21,代码来源:GenericDispatcher.php

示例7: render

 /**
  * Render this taskbar view
  * @param boolean $return true to return the rendered view, false to send it to the client
  * @return mixed null when provided $return is set to true; the rendered output when the provided $return is set to false
  */
 public function render($return = true)
 {
     $request = Zibo::getInstance()->getRequest();
     if (!$request) {
         return;
     }
     $baseUrl = $request->getBaseUrl() . Request::QUERY_SEPARATOR;
     $renderedPanels = array();
     $notificationPanels = $this->taskbar->getNotificationPanels();
     foreach ($notificationPanels as $panel) {
         $renderedPanels[] = $this->renderView($panel);
     }
     $applicationsMenu = $this->taskbar->getApplicationsMenu();
     $applicationsMenu->setBaseUrl($baseUrl);
     $settingsMenu = $this->taskbar->getSettingsMenu();
     $settingsMenu->setBaseUrl($baseUrl);
     $settingsMenu->orderItems();
     $this->set('applicationsMenu', $applicationsMenu);
     $this->set('settingsMenu', $settingsMenu);
     $this->set('notificationPanels', array_reverse($renderedPanels));
     $this->set('title', $this->taskbar->getTitle());
     $this->addStyle(self::STYLE_TASKBAR);
     $this->addJavascript(self::SCRIPT_CLICKMENU);
     $this->addInlineJavascript("\$('#taskbarApplications').clickMenu({start: 'left'}); \n \t\t\t\t" . "\$('#taskbarSettings').clickMenu({start: 'right'});");
     return parent::render($return);
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:31,代码来源:TaskbarView.php

示例8: tearDown

 public function tearDown()
 {
     try {
         Reflection::setProperty(Zibo::getInstance(), 'instance', null);
     } catch (ZiboException $e) {
     }
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:7,代码来源:DispatcherTest.php

示例9: getBaseUrl

 /**
  * Gets the base URL
  * @return string
  */
 protected function getBaseUrl()
 {
     if ($this->baseUrl) {
         return $this->baseUrl;
     }
     return $this->baseUrl = Zibo::getInstance()->getRequest()->getBaseUrl();
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:11,代码来源:AbstractContentMapper.php

示例10: run

 /**
  * Executes the callback in a different thread. All arguments to this method will be passed on to the callback.
  *
  * The callback will be invoked but the script will not wait for it to finish.
  * @return null
  */
 public function run()
 {
     $pid = @pcntl_fork();
     if ($pid == -1) {
         throw new ZiboException('Could not run the thread: unable to fork the callback');
     }
     if ($pid) {
         // parent process code
         $this->pid = $pid;
     } else {
         // child process code
         pcntl_signal(SIGTERM, array($this, 'signalHandler'));
         try {
             $this->callback->invokeWithArrayArguments(func_get_args());
         } catch (Exception $exception) {
             $message = $exception->getMessage();
             if (!$message) {
                 $message = get_class($exception);
             }
             Zibo::getInstance()->runEvent(Zibo::EVENT_LOG, $message, $exception->getTraceAsString(), 1);
             echo $message . "\n";
             echo $exception->getTraceAsString();
         }
         exit;
     }
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:32,代码来源:Thread.php

示例11: indexAction

 /**
  * Action to view and change the profile
  * @return null
  */
 public function indexAction()
 {
     $user = SecurityManager::getInstance()->getUser();
     if (!$user) {
         throw new UnauthorizedException();
     }
     $form = new ProfileForm($this->request->getBasePath(), $user);
     $form->addHook(new AccountProfileHook());
     Zibo::getInstance()->runEvent(self::EVENT_PREPARE_FORM, $form);
     if ($form->isSubmitted()) {
         try {
             $form->validate();
             $form->processSubmit($this);
             if (!$this->response->getView() && !$this->response->willRedirect()) {
                 $this->response->setRedirect($this->request->getBasePath());
             }
             return;
         } catch (ValidationException $exception) {
             $form->setValidationException($exception);
         }
     }
     $translator = $this->getTranslator();
     $view = new ProfileView($form);
     $view->setPageTitle($translator->translate(self::TRANSLATION_TITLE));
     $this->response->setView($view);
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:30,代码来源:ProfileController.php

示例12: smarty_function_image

function smarty_function_image($params, &$smarty)
{
    try {
        if (empty($params['src'])) {
            throw new Exception('No src parameter provided for the image');
        }
        $src = $params['src'];
        unset($params['src']);
        $image = new Image($src);
        if (!empty($params['thumbnail'])) {
            if (empty($params['width'])) {
                throw new Exception('No width parameter provided for the thumbnailer');
            }
            if (empty($params['height'])) {
                throw new Exception('No height parameter provided for the thumbnailer');
            }
            $image->setThumbnailer($params['thumbnail'], $params['width'], $params['height']);
            unset($params['thumbnail']);
            unset($params['width']);
            unset($params['height']);
        }
        foreach ($params as $key => $value) {
            $image->setAttribute($key, $value);
        }
        $html = $image->getHtml();
    } catch (Exception $exception) {
        Zibo::getInstance()->runEvent(Zibo::EVENT_LOG, $exception->getMessage(), $exception->getTraceAsString(), 1);
        $html = '<span class="red" style="color: red;">Could not load image: ' . $exception->getMessage() . '</span>';
    }
    return $html;
}
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:31,代码来源:function.image.php

示例13: indexAction

 /**
  * Action to ask for extra information and to send the error report
  * @return null
  */
 public function indexAction()
 {
     $zibo = Zibo::getInstance();
     $session = Session::getInstance();
     $recipient = $zibo->getConfigValue(Module::CONFIG_MAIL_RECIPIENT);
     $subject = $zibo->getConfigValue(Module::CONFIG_MAIL_SUBJECT);
     $report = $session->get(Module::SESSION_REPORT);
     if (!$report || !$recipient) {
         $this->response->setRedirect($this->request->getBaseUrl());
         return;
     }
     $form = new ReportForm($this->request->getBasePath());
     if ($form->isSubmitted()) {
         $comment = $form->getComment();
         if ($comment) {
             $report .= "\n\nComment:\n" . $comment;
         }
         if (!$subject) {
             list($subject, $null) = explode("\n", $report, 2);
         }
         $mail = new Message();
         $mail->setTo($recipient);
         $mail->setSubject($subject);
         $mail->setMessage($report);
         $mail->send();
         $session->set(Module::SESSION_REPORT);
         $this->addInformation(self::TRANSLATION_MAIL_SENT);
         $this->response->setRedirect($this->request->getBaseUrl());
         return;
     }
     $view = new ReportView($form, $report);
     $this->response->setView($view);
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:37,代码来源:ReportController.php

示例14: loadTypes

 /**
  * Loads the archive types from the Zibo configuration
  * @return null
  */
 private function loadTypes(Zibo $zibo)
 {
     $this->types = array();
     $types = $zibo->getConfigValue(self::CONFIG_TYPES, array());
     foreach ($types as $typeName => $className) {
         $this->register($typeName, $className);
     }
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:12,代码来源:ArchiveFactory.php

示例15: loadListeners

 private function loadListeners(Zibo $zibo)
 {
     $config = $zibo->getConfigValue(self::CONFIG_LOG);
     if (isset($config[self::CONFIG_LISTENER])) {
         unset($config[self::CONFIG_LISTENER]);
     }
     if (isset($config[self::CONFIG_FILTER])) {
         unset($config[self::CONFIG_FILTER]);
     }
     $listenerFactory = new LogListenerFactory($zibo);
     foreach ($config as $name => $parameters) {
         $listener = $listenerFactory->createListener($name);
         if ($listener != null) {
             $this->log->addLogListener($listener);
         }
     }
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:17,代码来源:Module.php


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