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


PHP LuLu::getApp方法代码示例

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


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

示例1: execute

 public function execute($role, $permission, $params = [])
 {
     $actionId = isset($params['actionId']) ? $params['actionId'] : LuLu::getApp()->requestedAction->id;
     $actions = $permission['value'];
     if (in_array($actionId, $actions)) {
         return true;
     }
     $method = LuLu::getApp()->request->method;
     $method = strtolower($method);
     if (in_array($actionId . ':' . $method, $actions)) {
         return true;
     }
     return false;
 }
开发者ID:ruzuojun,项目名称:lulucms2,代码行数:14,代码来源:ControllerRule.php

示例2: getAdminMenu

 public static function getAdminMenu()
 {
     $html = '';
     $adminUrl = Resource::getAdminUrl();
     $action = LuLu::getApp()->requestedAction;
     $urlArray = explode('/', $action->uniqueId);
     $roots = self::getChildren('admin', 0, 1);
     foreach ($roots as $menu) {
         $url = $menu['url'] === '#' ? '#' : Url::to([$menu['url']]);
         $title = '<span class="da-nav-icon"><img src="' . $adminUrl . '/images/icons/black/32/' . $menu['thumb'] . '" alt="' . $menu['name'] . '" /></span>' . $menu['name'];
         $html .= '<li id="menu-item-' . $menu['id'] . '"><a href="' . $url . '">' . $title . '</a>';
         $children = self::getChildren('admin', $menu['id'], 1);
         if (count($children) > 0) {
             $opened = false;
             $childHtml = '';
             foreach ($children as $child) {
                 $menuUrlArray = explode('/', trim($child['url'], '/'));
                 if (in_array($urlArray[0], $menuUrlArray)) {
                     $opened = true;
                 }
                 $childUrl = $child['url'] === '#' ? '#' : Url::to([$child['url']]);
                 $childHtml .= '<li id="menu-item-' . $child['id'] . '"><a href="' . $childUrl . '">' . $child['name'] . '</a></li>';
             }
             $html .= $opened ? '<ul>' : '<ul class="closed">';
             $html .= $childHtml;
             $html .= '</ul>';
         }
         $html .= '</li>';
     }
     return $html;
 }
开发者ID:hucongyang,项目名称:lulucms2,代码行数:31,代码来源:Menu.php

示例3: setDb

 private function setDb($dbConfig)
 {
     self::_appendLog('设置数据库信息。。。');
     $dbHost = LuLu::getPostValue('dbHost');
     $dbName = LuLu::getPostValue('dbName');
     $dbUsername = LuLu::getPostValue('dbUsername');
     $dbPassword = LuLu::getPostValue('dbPassword');
     $tbPre = LuLu::getPostValue('tbPre');
     try {
         $db = new Connection($dbConfig);
         LuLu::getApp()->set('db', $db);
         $db->createCommand("USE {$dbName}")->execute();
         $db->createCommand("SET NAMES 'utf8',character_set_client=binary,sql_mode=''")->execute();
         self::_appendLog('数据库信息设置成功');
         return $db;
     } catch (\Exception $e) {
         $message = self::getDbError($e->getMessage(), ['dbHost' => $dbHost, 'dbName' => $dbName]);
         self::_appendLog($message, true);
         return false;
     }
 }
开发者ID:sym660,项目名称:lulucms2,代码行数:21,代码来源:SiteController.php

示例4:

<?php

use yii\helpers\Html;
use source\LuLu;
/* @var $this yii\web\View */
/* @var $name string */
/* @var $message string */
/* @var $exception Exception */
$this->title = $name;
?>
<div id="da-error-wrapper">
                	                   
	<h1 class="da-error-heading"><?php 
echo $message;
?>
</h1>

	<p><a href="<?php 
echo LuLu::getApp()->request->getReferrer();
?>
">返回上一页</a></p>
	
</div>

开发者ID:Brother-Simon,项目名称:lulucms2,代码行数:23,代码来源:error.php

示例5: checkHomePermission

 public function checkHomePermission($permission = null, $params = [], $user = null)
 {
     if ($user === null) {
         $user = LuLu::getIdentity()->username;
     }
     if ($permission === null) {
         $permission = LuLu::getApp()->controller->uniqueId;
     }
     $permission = 'home_' . $permission;
     $rows = $this->getPermissionsByUser($user);
     if (!isset($rows[$permission])) {
         return false;
     }
     return $this->executeRule($rows[$permission], $params, $user);
 }
开发者ID:hucongyang,项目名称:lulucms2,代码行数:15,代码来源:RbacService.php

示例6: checkSkipActions

 private function checkSkipActions()
 {
     if (empty($this->skipActions)) {
         return false;
     }
     $actionId = LuLu::getApp()->requestedAction->uniqueId;
     if (LuLu::getApp() instanceof FrontApplication) {
         $actionId = 'home_' . $actionId;
     }
     return in_array($actionId, $this->skipActions);
 }
开发者ID:ruzuojun,项目名称:lulucms2,代码行数:11,代码来源:RbacService.php

示例7: checkPermission

 public function checkPermission($role = null, $permission = null, $params = [])
 {
     if ($role === null) {
         $role = LuLu::getIdentity()->role;
     }
     if ($permission === null) {
         $m = LuLu::getApp()->controller->module->id;
         $c = LuLu::getApp()->controller->id;
         $permission = empty($m) ? $c : $m . '/' . $c;
     }
     $rows = $this->getPermissionsByRole($role);
     if (!isset($rows[$permission])) {
         return false;
     }
     return $this->executeRule($role, $rows[$permission], $params);
 }
开发者ID:snowbai,项目名称:lulucms2,代码行数:16,代码来源:RbacService.php


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