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


PHP CApp::settings方法代码示例

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


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

示例1: linkCss

 public static function linkCss($link)
 {
     if (strstr($link, 'css/') == 0) {
         $link = CApp::settings("APPLICATION")->template_path . $link;
     }
     return '<link href="' . $link . '" type="text/css" rel="stylesheet">';
 }
开发者ID:ennjamusic,项目名称:study,代码行数:7,代码来源:CAssets.php

示例2: __construct

 public function __construct($class, $msg = NULL)
 {
     if ($msg != NULL) {
         $this->message = $msg . " в файле " . $this->file . " в строке #" . $this->line;
     }
     if (CApp::settings("APPLICATION")->settings['logs_on']) {
         $log = new CLog();
         $log->logging($class, $this->message);
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:10,代码来源:CException.php

示例3: deleteAction

 public function deleteAction($id)
 {
     if ($_SESSION["userRole"] == CApp::settings("USER_ROLES")->ADMIN && $_GET["view"] == "delete" && !empty($_GET["id"])) {
         $model = new UserModel();
         $model->deleteById($id);
         CApp::redirect(CApp::getLink(array("controller" => "user", "view" => "index")));
     } else {
         CApp::redirect("/");
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:10,代码来源:UserController.php

示例4: getTranslateAll

 public static function getTranslateAll($key = null)
 {
     $jsonStr = file_get_contents($_SERVER["DOCUMENT_ROOT"] . CApp::settings('APPLICATION')->template_path . "lang/" . CApp::settings('APPLICATION')->lang . "/lang.json");
     $arrLang = json_decode($jsonStr, true);
     $result = "";
     if (isset($arrLang[$key]) && !empty($arrLang[$key])) {
         $result = $arrLang[$key];
     } else {
         $result = $arrLang;
     }
     return $result;
 }
开发者ID:ennjamusic,项目名称:study,代码行数:12,代码来源:CApp.php

示例5: getInstance

 public static function getInstance()
 {
     if (self::$instance == null) {
         $dsn = CApp::settings('APPLICATION')->db['dsn'];
         $user = CApp::settings('APPLICATION')->db['db_user'];
         $pass = CApp::settings('APPLICATION')->db['db_pass'];
         self::$instance = new CModelConnectDB($dsn, $user, $pass);
         return self::$instance->getDBConnection();
     } else {
         /**
          * Using the one connection to Database for all
          *
          * if it need, it may return false to deny for all other except one
          */
         return false;
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:17,代码来源:CModelConnectDB.php

示例6: indexAction

 public function indexAction()
 {
     //        debug($_SESSION);
     if ($_SESSION["GMVC_AUTH"] != "Y") {
         if ($_POST["enter"] && !empty($_POST["password"])) {
             $pass = filterGetValue($_POST["password"]);
             //                debug($_SESSION);
             if ($pass == CApp::settings("APPLICATION")->components['gmvc']['gmvc_pass']) {
                 $_SESSION["GMVC_AUTH"] = "Y";
                 CApp::redirect("");
             }
         }
         $this->render("login");
     } else {
         $this->render("index");
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:17,代码来源:GmvcController.php

示例7: settingsAction

 public function settingsAction()
 {
     if ($_SESSION["userRole"] == CApp::settings("USER_ROLES")->ADMIN) {
         CApp::setTitle(CApp::getAppName() . " | " . CApp::getTranslate('settings'));
         $arrResult = CApp::getSettingsArray();
         if (!empty($_POST["SETTINGS"])) {
             $settingsArray = array();
             foreach ($_POST["SETTINGS"] as $key => $value) {
                 $settingsArray[$key] = filterGetValue($value);
             }
             $model = new SiteModel();
             $arrResult = $model->update($settingsArray);
         }
         $this->render("settings", "site", $arrResult);
     } else {
         CApp::redirect("/");
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:18,代码来源:SiteController.php

示例8: render

 protected function render($view, $controller = "site", $arrResult = [], $template = null)
 {
     if ($template == null) {
         $template = CApp::settings('APPLICATION')->templates['default'];
     }
     $cache = new CCache(604800);
     $flagCache = false;
     if (!$cache->cacheExists(CApp::getHashCurPage()) && CApp::settings("APPLICATION")->settings['cache_on']) {
         $flagCache = true;
         $cache->startCache();
     }
     include $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/header.php";
     include $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/views/" . strtolower($controller) . "/" . $view . ".php";
     include $_SERVER["DOCUMENT_ROOT"] . "/engine/templates/" . $template . "/footer.php";
     if ($flagCache) {
         $cache->writeCache(filterGetValue(CApp::getHashCurPage()));
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:18,代码来源:CController.php

示例9:

        <tr>
            <td><?php 
echo CApp::getTranslate("role");
?>
</td>
            <td>
                <select name="user[role]">
                    <option value="1" <?php 
echo $arrResult["role"] == CApp::settings("USER_ROLES")->ADMIN ? "selected" : "";
?>
><?php 
echo CApp::getTranslate("admin");
?>
</option>
                    <option value="0"  <?php 
echo $arrResult["role"] == CApp::settings("USER_ROLES")->GUEST ? "selected" : "";
?>
><?php 
echo CApp::getTranslate("user");
?>
</option>
                </select>
            </td>
        </tr>
        <tr>
            <td><?php 
echo CApp::getTranslate("name");
?>
</td>
            <td><input type="text" name="user[name]" value="<?php 
echo $arrResult["name"];
开发者ID:ennjamusic,项目名称:study,代码行数:31,代码来源:view.php

示例10:

"><?php 
    echo $arItem["date_register"];
    ?>
</a></td>
                <td><a href="<?php 
    echo $linkView;
    ?>
"><?php 
    echo $arItem["phone"];
    ?>
</a></td>
                <td><a href="<?php 
    echo $linkView;
    ?>
"><?php 
    echo $arItem["email"];
    ?>
</a></td>
                <td><a href="<?php 
    echo $linkDelete;
    ?>
"><img src="<?php 
    echo CApp::settings("APPLICATION")->template_path . "img";
    ?>
/del.gif" /></a></td>
            </tr>
        <?php 
}
?>
    </table>
</div>
开发者ID:ennjamusic,项目名称:study,代码行数:31,代码来源:viewList.php

示例11: isAdmin

 public function isAdmin()
 {
     return $this->user['role'] == CApp::settings("USER_ROLES")->ADMIN ? true : false;
 }
开发者ID:ennjamusic,项目名称:study,代码行数:4,代码来源:UserModel.php

示例12: debug

<?php

include_once $_SERVER["DOCUMENT_ROOT"] . "/engine/protected/core/base/CFiles.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/engine/protected/core/exceptions/CException.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/engine/protected/core/cache/CCache.php";
// it is required files
CFiles::includeAllDir($_SERVER["DOCUMENT_ROOT"] . "/engine/protected/core/base");
// if db enabled in file /protected/config/config.php then it is include files from protected/core/db
if (CApp::settings("APPLICATION")->db['db_enabled']) {
    CFiles::includeAllDir($_SERVER["DOCUMENT_ROOT"] . "/engine/protected/core/db");
}
spl_autoload_register(function ($className) {
    $classInfo = [];
    $autoloadClasses = [];
    $autoloadClasses = (include $_SERVER["DOCUMENT_ROOT"] . "/engine/protected/core/system/system.php");
    $classType = CFiles::getClassType($className);
    CFiles::autoInclude($className, $autoloadClasses[$classType]);
});
function debug($var)
{
    echo "<pre>";
    print_r($var);
    echo "</pre>";
}
function filterGetValue($var)
{
    return trim(strip_tags(addslashes($var)));
}
$settings = CApp::getSettingsArray();
session_start();
开发者ID:ennjamusic,项目名称:study,代码行数:30,代码来源:autoload.php


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