本文整理汇总了PHP中settings::load方法的典型用法代码示例。如果您正苦于以下问题:PHP settings::load方法的具体用法?PHP settings::load怎么用?PHP settings::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings
的用法示例。
在下文中一共展示了settings::load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: settings
switch ($_GET['action']) {
case 'open':
$settings = new settings();
echo $settings->open();
break;
case 'save':
$settings = new settings();
if (isset($_POST['content'])) {
echo $settings->save($_POST['content']);
} else {
echo '{"status":"error","message":"Missing Parameters!"}';
}
break;
case 'load':
$settings = new settings();
echo $settings->load();
break;
case 'saveCommands':
if (isset($_POST['commands'])) {
$result = file_put_contents("default.commands.json", $_POST['commands']);
if ($result === false) {
echo '{"status":"error","message":"Failed to save default commands!"}';
} else {
echo '{"status":"success","message":"Commands saved."}';
}
} else {
echo '{"status":"error","message":"Missing Parameters!"}';
}
break;
default:
echo '{"status":"error","message":"No Type"}';
示例2: myescstr
$out = '';
if (getcache($id, $out)) {
$sql = 'UPDATE ' . TBL_CACHE . ' SET value = "' . myescstr($value) . '" WHERE id = ' . $id;
} else {
$sql = 'INSERT INTO ' . TBL_CACHE . ' SET id = ' . $id . ', value = "' . myescstr($value) . '"';
}
$varcache[$id] = $value;
db_execquery($sql);
}
$setctl = new settings();
if (db_gconnect()) {
define('DBCONNECTION', true);
if (UTF8MODE) {
db_execquery('SET NAMES utf8 COLLATE utf8_unicode_ci');
}
$setctl->load();
if ($resetconfiguration) {
$setctl->defaults();
echo 'Configuration has been reset. Set $resetconfiguration = false; and reload.';
die;
}
if (!$setctl->get('bundleconfigured')) {
if (isset($bundleconfig) && is_array($bundleconfig)) {
foreach ($bundleconfig as $name => $val) {
$tval = $setctl->get($name);
if (strlen($tval) == 0 || $tval == false || $tval == 0) {
$setctl->set($name, $val);
}
}
$setctl->set('bundleconfigured', 1);
}
示例3: templateName
static function templateName($name = false)
{
global $page;
$template = $name ? $name : $page->template();
$settings = settings::load($template);
return $settings ? a::get($settings, 'title', str::ucfirst($template)) : str::ucfirst($template);
}