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


PHP waSystem::appExists方法代码示例

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


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

示例1: dispatch

 public function dispatch()
 {
     $url = $this->system->getConfig()->getRequestUrl();
     $url = preg_replace("!\\?.*\$!", '', $url);
     $url = urldecode($url);
     $r = $this->dispatchRoutes($this->getRoutes(), $url);
     if (!$r || $r['url'] == '*' && $url && strpos(substr($url, -5), '.') === false && substr($url, -1) !== '/') {
         $r2 = $this->dispatchRoutes($this->getRoutes(), $url . '/');
         if ($r2 && (!$r || $r2['url'] != '*')) {
             $this->system->getResponse()->redirect($this->system->getRootUrl() . $url . '/');
         }
     }
     // if route found and app exists
     if ($r && isset($r['app']) && $r['app'] && $this->system->appExists($r['app'])) {
         $this->setRoute($r);
         // dispatch app routes
         $params = waRequest::param();
         $u = $r['url'];
         if (preg_match_all('/<([a-z_]+):?([^>]*)?>/ui', $u, $match, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
             $offset = 0;
             foreach ($match as $m) {
                 $v = $m[1][0];
                 $s = isset($params[$v]) ? $params[$v] : '';
                 $u = substr($u, 0, $m[0][1] + $offset) . $s . substr($u, $m[0][1] + $offset + strlen($m[0][0]));
                 $offset += strlen($s) - strlen($m[0][0]);
             }
         }
         $this->root_url = self::clearUrl($u);
         $url = substr($url, strlen($this->root_url));
         $this->dispatchRoutes($this->getAppRoutes($r['app'], $r), $url);
     }
     return $r;
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:33,代码来源:waRouting.class.php

示例2: block

 public function block($id)
 {
     if ($id && $this->wa->appExists('site')) {
         wa('site');
         $model = new siteBlockModel();
         $block = $model->getById($id);
         if (!$block && strpos($id, '.') !== false) {
             list($app_id, $id) = explode('.', $id);
             $path = $this->wa->getConfig()->getAppsPath($app_id, 'lib/config/site.php');
             if (file_exists($path)) {
                 $site_config = (include $path);
                 if (isset($site_config['blocks'][$id])) {
                     if (!is_array($site_config['blocks'][$id])) {
                         $block = array('content' => $site_config['blocks'][$id]);
                     } else {
                         $block = $site_config['blocks'][$id];
                     }
                 }
             }
         }
         if ($block) {
             try {
                 return $this->view->fetch('string:' . $block['content']);
             } catch (Exception $e) {
                 if (waSystemConfig::isDebug()) {
                     return '<pre class="error">' . htmlentities($e->getMessage(), ENT_QUOTES, 'utf-8') . "</pre>";
                 } else {
                     waLog::log($e->__toString());
                     return '<div class="error">' . _ws('Syntax error at block') . ' ' . $id . '</div>';
                 }
             }
         }
     }
     return '';
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:35,代码来源:waViewHelper.class.php


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