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


PHP Kwf_Setup::getBaseUrl方法代码示例

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


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

示例1: processInput

 public function processInput($postData)
 {
     if (isset($postData['redirectAuth'])) {
         $authMethods = Kwf_Registry::get('userModel')->getAuthMethods();
         if (!isset($authMethods[$postData['redirectAuth']])) {
             throw new Kwf_Exception_NotFound();
         }
         $auth = $authMethods[$postData['redirectAuth']];
         if (!$auth instanceof Kwf_User_Auth_Interface_Redirect) {
             throw new Kwf_Exception_NotFound();
         }
         $formValues = array();
         foreach ($auth->getLoginRedirectFormOptions() as $option) {
             if ($option['type'] == 'select') {
                 $formValues[$option['name']] = $postData[$option['name']];
             }
         }
         $redirectBackUrl = Kwf_Setup::getBaseUrl() . '/';
         $f = new Kwf_Filter_StrongRandom();
         $state = 'activate-' . $postData['redirectAuth'] . '-' . $f->filter(null) . '-' . $postData['code'] . '-' . $redirectBackUrl;
         //save state in namespace to validate it later
         $ns = new Kwf_Session_Namespace('kwf-login-redirect');
         $ns->state = $state;
         $url = $auth->getLoginRedirectUrl($this->_getRedirectBackUrl(), $state, $formValues);
         header("Location: " . $url);
         exit;
     }
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:28,代码来源:Component.php

示例2: afterStart

 public static function afterStart()
 {
     static $validatorsRegistered = false;
     if (!$validatorsRegistered) {
         if (isset($_SESSION['__KWF']['VALID'])) {
             self::_processValidators();
         }
         //sessions timeout after 15-20 minutes of inactivity
         //this is in addition to gc_maxlifetime (which isn't reliable enough)
         $sessionTimeout = 20 * 60;
         if (!isset($_SESSION['kwfTimeout'])) {
             $_SESSION['kwfTimeout'] = time() + $sessionTimeout;
         } else {
             if ($_SESSION['kwfTimeout'] - time() < 0) {
                 $_SESSION = array();
                 $_SESSION['kwfTimeout'] = time() + $sessionTimeout;
                 Zend_Session::regenerateId();
             } else {
                 if ($_SESSION['kwfTimeout'] - time() < $sessionTimeout - 5 * 60) {
                     //extend timeout every 5 minutes (not in every request for better performance)
                     $_SESSION['kwfTimeout'] = time() + $sessionTimeout;
                 }
             }
         }
         if (!isset($_SESSION['__KWF']['VALID'])) {
             Zend_Session::registerValidator(new Kwf_Session_Validator_HttpHost());
             if (Kwf_Setup::getBaseUrl()) {
                 Zend_Session::registerValidator(new Kwf_Session_Validator_BasePath());
             }
             Zend_Session::registerValidator(new Kwf_Session_Validator_RemoteAddr());
         }
         $validatorsRegistered = true;
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:34,代码来源:Session.php

示例3: getUrl

 /**
  *
  * @param string
  * @param string
  * @param string
  * @param string
  * @param int Kann gesetzt werden wenn wir in diesem web auf das bild nicht direkten zugriff haben
  *            sondern nur für ein anderes web die url generieren
  */
 public static function getUrl($class, $id, $type, $filename, $time = null)
 {
     if ($filename instanceof Kwf_Uploads_Row) {
         $filename = $filename->filename . '.' . $filename->extension;
     }
     if ($filename == '.') {
         $filename = '';
     }
     //Replace Slashes and Backslashes with an underscore
     //Otherwise we would get a wrong url
     //e.g. $filename = foo/bar.png -> /media/FooModel/1/default/ab123/1234/foo/bar.png
     $filename = str_replace('/', '_', $filename);
     $filename = str_replace('\\', '_', $filename);
     $checksumType = $type;
     if (substr($type, 0, strlen(Kwf_Media::DONT_HASH_TYPE_PREFIX)) == Kwf_Media::DONT_HASH_TYPE_PREFIX) {
         $checksumType = Kwf_Media::DONT_HASH_TYPE_PREFIX;
     }
     $class = rawurlencode($class);
     $checksum = self::getChecksum($class, $id, $checksumType, rawurlencode($filename));
     $prefix = Kwf_Setup::getBaseUrl();
     if ($r = Kwf_Component_Data_Root::getInstance()) {
         if ($r->filename) {
             $prefix .= '/' . $r->filename;
         }
     }
     if (is_null($time)) {
         $cacheId = 'mtime-' . self::createCacheId($class, $id, $type);
         $time = Kwf_Media_MemoryCache::getInstance()->load($cacheId);
         if (!$time) {
             $time = time();
             Kwf_Media_MemoryCache::getInstance()->save($time, $cacheId);
         }
     }
     return $prefix . '/media/' . $class . '/' . $id . '/' . $type . '/' . $checksum . '/' . $time . '/' . rawurlencode($filename);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:44,代码来源:Media.php

示例4: output

 public static function output()
 {
     $baseUrl = Kwf_Setup::getBaseUrl();
     $contents = "User-agent: *\n" . "Disallow: {$baseUrl}/admin/\n";
     $contents .= "Sitemap: http" . (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER['HTTP_HOST'] . $baseUrl . "/sitemap.xml\n";
     Kwf_Media_Output::output(array('contents' => $contents, 'mimeType' => 'text/plain'));
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:7,代码来源:RobotsTxt.php

示例5: output

 public static function output()
 {
     $baseUrl = Kwf_Setup::getBaseUrl();
     $contents = "User-agent: *\n" . "Disallow: {$baseUrl}/admin/\n" . "Disallow: {$baseUrl}/kwf/util/kwc/render\n";
     //used to load eg. lightbox content async, we don't want getting that indexed
     $contents .= "Sitemap: http" . (isset($_SERVER['HTTPS']) ? 's' : '') . "://" . $_SERVER['HTTP_HOST'] . $baseUrl . "/sitemap.xml\n";
     Kwf_Media_Output::output(array('contents' => $contents, 'mimeType' => 'text/plain'));
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:RobotsTxt.php

示例6: render

 public function render($ignoreCli = false)
 {
     if (!Kwf_Registry::get('config')->setupFinished) {
         echo "<h1>" . Kwf_Config::getValue('application.name') . "</h1>\n";
         echo "<a href=\"" . Kwf_Setup::getBaseUrl() . "/kwf/maintenance/setup\">[start setup]</a>\n";
         exit;
     }
     parent::render($ignoreCli);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:9,代码来源:DatabaseNotConfiguredException.php

示例7: indexAction

 public function indexAction()
 {
     Zend_Registry::set('db', false);
     Kwf_Test_SeparateDb::setDbFromCookie();
     // setzt es nur wenn es das cookie wirklich gibt
     //FnF models setzen damit tests nicht in echte tabellen schreiben
     Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
     Kwf_Component_Cache_Memory::setInstance(new Kwf_Component_Cache_MemoryBlackHole());
     /*
     if (class_exists('APCIterator')) {
         $prefix = Kwf_Cache::getUniquePrefix();
         apc_delete_file(new APCIterator('user', '#^'.$prefix.'#'));
     } else {
         apc_clear_cache('user');
     }
     */
     Kwf_Component_Data_Root::setComponentClass($this->_getParam('root'));
     Zend_Registry::set('testRootComponentClass', $this->_getParam('root'));
     $root = Kwf_Component_Data_Root::getInstance();
     $root->setFilename('kwf/kwctest/' . $this->_getParam('root'));
     $url = $this->_getParam('url');
     $urlParts = explode('/', $url);
     if (is_array($urlParts) && $urlParts[0] == 'media') {
         if (sizeof($urlParts) != 7) {
             throw new Kwf_Exception_NotFound();
         }
         $class = $urlParts[1];
         $id = $urlParts[2];
         $type = $urlParts[3];
         $checksum = $urlParts[4];
         // time() wäre der 5er, wird aber nur wegen browsercache benötigt
         $filename = $urlParts[6];
         if ($checksum != Kwf_Media::getChecksum($class, $id, $type, $filename)) {
             throw new Kwf_Exception_AccessDenied('Access to file not allowed.');
         }
         Kwf_Media_Output::output(Kwf_Media::getOutput($class, $id, $type));
     }
     if ($url == 'kwf/util/kwc/render') {
         if (isset($_REQUEST['url'])) {
             $_REQUEST['url'] = str_replace('/' . $root->filename, '', $_REQUEST['url']);
         }
         Kwf_Util_Component::dispatchRender();
     }
     $domain = 'http://' . Zend_Registry::get('config')->server->domain;
     $data = $root->getPageByUrl($domain . Kwf_Setup::getBaseUrl() . '/' . $url, null);
     if (!$data) {
         throw new Kwf_Exception_NotFound();
     }
     $root->setCurrentPage($data);
     $contentSender = Kwc_Abstract::getSetting($data->componentClass, 'contentSender');
     $contentSender = new $contentSender($data);
     $contentSender->sendContent(true);
     Kwf_Benchmark::shutDown();
     Kwf_Benchmark::output();
     exit;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:56,代码来源:RenderComponentController.php

示例8: redirect

 public static function redirect($url)
 {
     $url = (string) $url;
     if (!$url) {
         $url = '/';
     }
     if (substr($url, 0, strlen(Kwf_Setup::getBaseUrl()) + 1) !== Kwf_Setup::getBaseUrl() . '/') {
         throw new Kwf_Exception('Invalid Url');
     }
     header('Location: ' . $url);
     exit;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:12,代码来源:Redirect.php

示例9: indexAction

 public function indexAction()
 {
     $this->view->config = array('responsive' => Kwf_Config::getValue('kwc.responsive'));
     $this->view->xtype = 'kwf.component.preview';
     $this->view->initialUrl = null;
     if (preg_match('#^https?://#', $this->_getParam('url'))) {
         $this->view->initialUrl = $this->_getParam('url');
     }
     if (!$this->view->initialUrl) {
         $this->view->initialUrl = 'http://' . $_SERVER['HTTP_HOST'] . Kwf_Setup::getBaseUrl() . '/';
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:12,代码来源:PreviewController.php

示例10: image

 public function image($image, $alt = '', $attributes = null)
 {
     if (!$image) {
         return '';
     }
     $url = $this->_getImageUrl($image);
     if ($url == '') {
         return '';
     }
     if (substr($url, 0, 8) == '/assets/') {
         if (Kwf_Setup::getBaseUrl()) {
             $url = Kwf_Setup::getBaseUrl() . $url;
         }
         $subroot = null;
         if ($this->_getView() && $this->_getView()->component) {
             $subroot = $this->_getView()->component->getSubroot();
         }
         $ev = new Kwf_Events_Event_CreateAssetUrl(get_class($this), $url, $subroot);
         Kwf_Events_Dispatcher::fireEvent($ev);
         $url = $ev->url;
     }
     $class = '';
     if (is_string($attributes)) {
         $class = $attributes;
     }
     if (is_string($image)) {
         if (file_exists(str_replace('/images/', '/images/dpr2/', $this->_getAssetPath($image)))) {
             $class .= ' kwfReplaceImageDpr2';
         }
     }
     $class = trim($class);
     if (!is_array($attributes)) {
         $attributes = array();
     }
     if ($class != '') {
         $attributes['class'] = $class;
     }
     $size = $this->_getImageSize($image);
     if (!isset($attributes['width'])) {
         $attributes['width'] = $size['width'];
     }
     if (!isset($attributes['height'])) {
         $attributes['height'] = $size['height'];
     }
     $attr = '';
     foreach ($attributes as $k => $i) {
         $attr .= ' ' . $k . '="' . $i . '"';
     }
     return "<img src=\"{$url}\"{$attr} alt=\"{$alt}\" />";
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:50,代码来源:Image.php

示例11: indexAction

 public function indexAction()
 {
     $this->view->kwfVersion = Kwf_Config::getValue('application.kwf.name') . ' ' . trlKwf('Version') . ' ' . Kwf_Config::getValue('application.kwf.version');
     $this->view->appVersion = Kwf_Config::getValue('application.name');
     $this->view->baseUrl = Kwf_Setup::getBaseUrl();
     $this->view->defaultDbName = Kwf_Config::getValue('application.id');
     $this->view->possibleConfigSections = array();
     $cfg = new Kwf_Config_Ini('config.ini');
     foreach ($cfg as $k => $i) {
         $this->view->possibleConfigSections[] = array($k, $k);
     }
     $this->view->assetsPackage = Kwf_Assets_Package_Maintenance::getInstance('Maintenance');
     $this->view->viewport = 'Kwf.Maintenance.Viewport';
     $this->view->xtype = 'kwf.maintenance.setup';
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:15,代码来源:SetupController.php

示例12: load

 public function load($row)
 {
     $model = Kwc_Abstract::createOwnModel($this->_class);
     $componentId = $row->component_id . '-' . $row->id;
     if ($this->_subComponent) {
         $componentId .= $this->_subComponent;
     }
     $row = $model->getRow($componentId);
     if ($row && $row->kwf_upload_id) {
         $hashKey = Kwf_Util_Hash::hash($row->kwf_upload_id);
         return Kwf_Setup::getBaseUrl() . '/kwf/media/upload/preview?uploadId=' . $row->kwf_upload_id . '&hashKey=' . $hashKey . '&size=' . $this->_size;
     } else {
         return '';
     }
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:15,代码来源:Image.php

示例13: __get

 public function __get($var)
 {
     if ($var == 'url') {
         $c = $this;
         while ($c) {
             if (Kwf_Component_Abstract::getFlag($c->componentClass, 'hasHome') && $c->isPseudoPage) {
                 return $c->_getPseudoPageUrl();
             }
             $c = $c->parent;
         }
         $baseUrl = Kwf_Setup::getBaseUrl();
         return $baseUrl . '/';
     }
     return parent::__get($var);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:15,代码来源:Home.php

示例14: jsonDataAction

 public function jsonDataAction()
 {
     $showLogout = true;
     $acl = $this->_getAcl();
     $menus = $acl->getMenuConfig($this->_getAuthData());
     if (empty($menus) && $this->_getUserRole() == 'guest') {
         $menu = array();
         $menu['type'] = 'commandDialog';
         $menu['menuConfig']['text'] = trlKwf('Login');
         $menu['commandClass'] = 'Kwf.User.Login.Dialog';
         $menus[] = $menu;
         $showLogout = false;
     }
     $model = Kwf_Registry::get('userModel')->getEditModel();
     if ($this->_getAuthData() && $model->getRowByKwfUser($this->_getAuthData())) {
         foreach ($acl->getAllResources() as $resource) {
             if ($resource instanceof Kwf_Acl_Resource_UserSelf && $acl->isAllowedUser($this->_getAuthData(), $resource, 'view')) {
                 $this->view->userSelfControllerUrl = $resource->getControllerUrl();
                 break;
             }
         }
     }
     $authData = $this->_getAuthData();
     $this->view->menus = $menus;
     $this->view->showLogout = $showLogout;
     $this->view->userId = $authData ? $authData->id : null;
     $this->view->fullname = $authData ? $authData->__toString() : '';
     $role = Zend_Registry::get('userModel')->getAuthedChangedUserRole();
     $this->view->changeUser = $acl->isAllowed($role, 'kwf_user_changeuser', 'view');
     $this->view->frontendUrls = array();
     if (Kwf_Registry::get('acl')->has('kwf_component_pages')) {
         foreach (Kwc_Abstract::getComponentClasses() as $c) {
             if (Kwc_Abstract::hasSetting($c, 'baseProperties') && in_array('domain', Kwc_Abstract::getSetting($c, 'baseProperties'))) {
                 $domains = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($c, array('ignoreVisible' => true));
                 foreach ($domains as $domain) {
                     if ($acl->getComponentAcl()->isAllowed($authData, $domain)) {
                         $this->view->frontendUrls[] = array('href' => Kwf_Setup::getBaseUrl() . '/admin/component/preview?url=' . urlencode($domain->getAbsoluteUrl(true)), 'text' => $domain->name);
                     }
                 }
             }
         }
         if (!$this->view->frontendUrls) {
             $this->view->frontendUrls[] = array('href' => Kwf_Setup::getBaseUrl() . '/admin/component/preview', 'text' => trlKwf('Frontend'));
         }
     }
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:46,代码来源:MenuController.php

示例15: image

 public function image($image, $alt = '', $attributes = null)
 {
     if (!$image) {
         return '';
     }
     $url = $this->_getImageUrl($image);
     if ($url == '') {
         return '';
     }
     if (Kwf_Config::getValue('assetsCacheUrl') && substr($url, 0, 8) == '/assets/') {
         $url = Kwf_Config::getValue('assetsCacheUrl') . '?web=' . Kwf_Config::getValue('application.id') . '&section=' . Kwf_Setup::getConfigSection() . '&url=' . substr($url, 1);
     } else {
         if (Kwf_Setup::getBaseUrl() && substr($url, 0, 8) == '/assets/') {
             $url = Kwf_Setup::getBaseUrl() . $url;
         }
     }
     $class = '';
     if (is_string($attributes)) {
         $class = $attributes;
     }
     if (is_string($image)) {
         if (file_exists(str_replace('/images/', '/images/dpr2/', $this->_getAssetPath($image)))) {
             $class .= ' kwfReplaceImageDpr2';
         }
     }
     $class = trim($class);
     if (!is_array($attributes)) {
         $attributes = array();
     }
     if ($class != '') {
         $attributes['class'] = $class;
     }
     $size = $this->_getImageSize($image);
     if (!isset($attributes['width'])) {
         $attributes['width'] = $size['width'];
     }
     if (!isset($attributes['height'])) {
         $attributes['height'] = $size['height'];
     }
     $attr = '';
     foreach ($attributes as $k => $i) {
         $attr .= ' ' . $k . '="' . $i . '"';
     }
     return "<img src=\"{$url}\"{$attr} alt=\"{$alt}\" />";
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:45,代码来源:Image.php


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