本文整理汇总了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">';
}
示例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);
}
}
示例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("/");
}
}
示例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;
}
示例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;
}
}
示例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");
}
}
示例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("/");
}
}
示例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()));
}
}
示例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"];
示例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>
示例11: isAdmin
public function isAdmin()
{
return $this->user['role'] == CApp::settings("USER_ROLES")->ADMIN ? true : false;
}
示例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();