本文整理汇总了PHP中Settings::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::getInstance方法的具体用法?PHP Settings::getInstance怎么用?PHP Settings::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
$host = Settings::getInstance()->get("host");
echo "<div style=\"width:300px;margin-right:10px;float:left;\"><h2>" . Language::DirectTranslateHtml("DATATYPES") . "</h2>";
$list = new LinkList();
$url = UrlRewriting::GetUrlByAlias("admin/data", "show=");
$list->fillSelect = "SELECT displayName as text, CONCAT('" . $url . "',id) as href FROM {'dbprefix'}datatypes ORDER BY displayName";
$list->display();
echo "</div>";
if (is_numeric($_GET['show'])) {
$id = DataBase::Current()->EscapeString($_GET['show']);
$datatype = DataBase::Current()->ReadRow("SELECT * FROM {'dbprefix'}datatypes WHERE id = '" . $id . "' ORDER BY displayName");
echo "<div><h2>" . htmlentities($datatype->displayName) . "</h2><p>" . htmlentities($datatype->description) . "</p><h2>" . Language::DirectTranslateHtml("PROPERTIES") . "</h2>";
$table = new Table();
$displayName = new TableColumn("displayName", "Name");
$dataName = new TableColumn("dataName", "Datenname");
$validator = new TableColumn("validator_name", "Inhalt", "IFNULL((SELECT name FROM {'dbprefix'}data_validator WHERE id = {'dbprefix'}datafields.validator),'')");
$table->columns->add($displayName);
$table->columns->add($dataName);
$table->columns->add($validator);
$displayName->autoWidth = true;
$validator->autoWidth = true;
$table->condition = "dataType = '" . DataBase::Current()->EscapeString($_GET['show']) . "'";
$table->name = "{'dbprefix'}datafields";
$table->orderBy = "displayName";
$table->display();
echo "</div>";
$this->displayEvents();
$this->displaySharing();
}
}
示例2: __construct
/**
* Exception, if access is denied
* @param string $message message for the user
* @param int $code errorcode for automatic handling
*/
public function __construct($message, $code = 0)
{
parent::__construct($message, $code);
$page = new Page();
$page->loadPropertiesById(Settings::getInstance()->get("accessdenied"));
parent::setErrorPage($page);
}
示例3: display
/**
*
* @param Page $page
* @param string $separator
* @param string $class
* @param string $idpraefix
*/
public static function display(Page $page, $separator, $class, $idpraefix)
{
$host = Settings::getInstance()->get("host");
$i = 1;
$breadcrumb = $page->getBreadcrumb();
$j = 0;
foreach ($breadcrumb as $item) {
$breadcrumb[$j][0] = UrlRewriting::GetShortUrlByAlias($breadcrumb[$j][0]);
$j++;
}
$currentItem = array_pop($breadcrumb);
$fulldir = "";
foreach (explode("/", $_SESSION['dir']) as $dir) {
if ($dir != "") {
$url = UrlRewriting::GetShortUrlByAlias("admin/home", "dir=" . $fulldir . "/" . $dir);
$breadcrumb[] = array($url, $dir);
$fulldir .= "/" . $dir;
}
}
$breadcrumb[] = $currentItem;
while ($i <= count($breadcrumb)) {
echo "<a style='display:inline' href=\"" . $host . $breadcrumb[$i - 1][0] . "\" class=\"" . $class . "\" \n id=\"" . $idpraefix . $i . "\">" . $breadcrumb[$i - 1][1] . "</a>";
if ($i < count($breadcrumb)) {
echo $separator;
}
$i++;
}
}
示例4: upload
protected function upload()
{
$template = new Template();
$template->load("upload");
$template->assign_var("REFERRER", $_POST['referrer']);
$template->show_if("SHOW_MEDIALIBARY", false);
if (!file_exists(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'])) {
mkdir(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir']);
}
if (FileServer::upload(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'], $_FILES['file'])) {
$name = $_FILES['file']['name'];
$template->assign_var("MESSAGE", str_replace("{FILENAME}", $name, Language::DirectTranslate("FILE_UPLOADED")));
$path_info = pathinfo(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
if (strtolower($path_info['extension'] == 'jpg') or strtolower($path_info['extension'] == 'jpeg') or strtolower($path_info['extension'] == 'gif') or strtolower($path_info['extension'] == 'png') or strtolower($path_info['extension'] == 'bmp')) {
$template->show_if("SHOW_MEDIALIBARY", true);
$template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/media/addimage"));
$template->assign_var("FILE_PATH", Settings::getInstance()->get("host") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
}
} else {
if (FileServer::$uploadFailure != "") {
$template->assign_var("MESSAGE", FileServer::$uploadFailure);
} else {
$template->assign_var("MESSAGE", Language::DirectTranslate("FILE_NOT_UPLOADED"));
}
}
$template->output();
}
示例5: UpdateCurrs
public function UpdateCurrs()
{
$setting = Settings::getInstance();
$systemcurr = $setting->Get('system.currency');
$systemcurrrate = NULL;
$provider = $setting->Get('system.currency.autoupdate') . 'curprovider';
$ecb = $provider::getInstance();
$provinfo = $ecb->Info();
$currs = $ecb->GetButch();
//find system curr exchange rate
for ($i = 0; $i < count($currs); $i++) {
if (array_key_exists($systemcurr, $currs[$i])) {
$systemcurrrate = $currs[$i][$systemcurr];
}
}
if ($systemcurr == $provinfo['default']) {
$systemcurrrate = 1;
} elseif ($systemcurrrate == NULL) {
throw new Exception("system default currency doesnt exists in provided data");
}
for ($i = 0; $i < count($currs); $i++) {
$tempkey = array_keys($currs[$i]);
$id = $this->GetID($tempkey[0], 'name');
$rate = $currs[$i][$tempkey[0]] / $systemcurrrate;
if (!$id) {
$this->Create(array('name' => $tempkey[0], 'rate' => $rate));
} else {
$this->Update('rate', $rate, $id);
}
}
return true;
}
示例6: runUpdate
public function runUpdate()
{
$path = Settings::getInstance()->get('root') . "/" . $this->path;
if (!file_exists($path)) {
mkdir($path);
}
}
示例7: getInstance
public static function getInstance()
{
if (self::$_instance === null) {
$settings = Settings::getInstance();
self::$_instance = new self($settings->db_host(), $settings->db_name(), $settings->db_user(), $settings->db_pass());
}
return self::$_instance;
}
示例8: execute
public function execute()
{
EventManager::RaiseEvent("before_executing_task", array("task" => $this));
$script = DataBase::Current()->EscapeString($this->script);
DataBase::Current()->Execute("UPDATE {'dbprefix'}tasks SET lastExecution = NOW() WHERE script = '" . $script . "'");
include Settings::getInstance()->get("root") . $this->script;
EventManager::RaiseEvent("after_executing_task", array("task" => $this));
}
示例9: Send
public function Send($users, $data = false, $templatetype = false, $subject = false, $message = false)
{
$nt = NotifyTemplate::getInstance();
//$ntdata = $nt->FetchData($templateid);
$us = UserSettings::getInstance();
$setting = Settings::getInstance();
$nm = NotificationModule::getInstance();
$user = User::getInstance();
$lang = Lang::getInstance();
for ($i = 0; $i < count($users); $i++) {
$usersettings = $us->Get($users[$i]['id']);
if (@$usersettings[$templatetype] != "0") {
if (is_numeric($usersettings['language'])) {
$langdata = $lang->FetchData($usersettings['language']);
$langcode = $langdata['code'];
} else {
$langcode = $setting->Get('system.lang.default');
}
if (strlen($langcode) != 2) {
throw new Exception("Lang code not found or in wrong format");
}
if (is_array($data) && $templatetype != '' && $templatetype != false) {
if (!is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = '" . $langcode . "'")) && !is_numeric($templateid = $nt->GetID($templatetype, 'type', "`langcode` = 'en'"))) {
throw new Exception("Notify Template not found with type " . $templatetype . " and language " . $langcode);
}
$ntdata = $nt->FetchData($templateid);
if (!is_array($ntdata)) {
continue;
}
$message = $this->prepare_template($ntdata['text'], $data);
} elseif (is_string($subject) && is_string($message)) {
$ntdata['subject'] = $subject;
} else {
throw new Exception("Wrong parameters specified");
}
if (is_numeric($usersettings['notifymodule']) && is_string($usersettings['notifyaddress'])) {
$moduleid = $usersettings['notifymodule'];
$address = $usersettings['notifyaddress'];
} else {
$userdata = $user->FetchData($users[$i]['id']);
$moduleid = $setting->Get('system.notifymodule.default');
$address = $userdata['email'];
}
if (strlen($address) < 2 || !is_numeric($moduleid)) {
continue;
}
if ($nm->Send($moduleid, $address, $ntdata['subject'], $message)) {
$status = 'Done';
} else {
$status = 'Fail';
}
$this->Create(array('userid' => $users[$i]['id'], 'moduleid' => $moduleid, 'subject' => $ntdata['subject'], 'text' => $message, 'address' => $address, 'status' => $status));
} else {
return true;
}
}
return true;
}
示例10: AddInfo
private function AddInfo($plugin_name)
{
$pluginpath = Settings::getInstance()->get("root") . "system/plugins";
if (is_dir($pluginpath . "/" . $plugin_name)) {
if (file_exists($pluginpath . "/" . $plugin_name . "/info.php")) {
include $pluginpath . "/" . $plugin_name . "/info.php";
}
}
}
示例11: runUpdate
public function runUpdate()
{
$destination = fopen(Settings::getInstance()->get("root") . $this->toPath, "w");
$source = fopen($this->fromPath, "r");
while ($a = fread($source, 1024)) {
fwrite($destination, $a);
}
fclose($source);
fclose($destination);
}
示例12: G_requestUrl
function G_requestUrl()
{
$reqUri = $_SERVER["REQUEST_URI"];
$base = Settings::getInstance()->getPar('baseUrl');
if (str_starts_with($reqUri, $base)) {
$reqUri = substr($reqUri, strlen($base));
}
$reqUri = '/' . url_trimAndClean($reqUri);
return $reqUri;
}
示例13: getDestination
/**
*
* @param array $params
* @return string
*/
public function getDestination($params)
{
$res = $this->destination;
foreach ($params as $key => $value) {
$res = str_replace("{VAR:" . strtoupper($key) . "}", $value, $res);
}
$res = str_replace("{VAR:ROOT}", Settings::getInstance()->get("root"), $res);
$res = str_replace("{VAR:HOST}", Settings::getInstance()->get("host"), $res);
return $res;
}
示例14: getIcon
/**
*
* @param string $name
* @return string
*/
public static function getIcon($name)
{
$res = Settings::getInstance()->get("host");
if (file_exists("../system/skins/" . SkinController::getCurrentSkinName() . "/icons/" . strtolower($name) . ".png")) {
$res .= "system/skins/" . SkinController::getCurrentSkinName() . "/icons/" . strtolower($name) . ".png";
} else {
$res .= "system/images/icons/" . Settings::getInstance()->get("iconset") . "/" . strtolower($name) . ".png";
}
return $res;
}
示例15: __construct
function __construct()
{
/*
* Object of Settings class
*
* @var Settings
* */
$settings = Settings::getInstance();
$this->db = DataBase::getInstance();
$this->db_config = $settings->getDBConfig();
}