本文整理汇总了PHP中Configuration::createInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::createInstance方法的具体用法?PHP Configuration::createInstance怎么用?PHP Configuration::createInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration::createInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: errorHandler
function errorHandler($iErrCode, $sErrMsg, $sFile, $iLine, $aContext)
{
// Fatalt?
if ($iErrCode = E_USER_ERROR) {
// TODO: Gör till EN, enda skillnad die() om ERROR
// Logga och dö
$sMsg = time() . ": " . $sFile . ": " . $iLine . ": " . $sErrMsg;
error_log($sMsg, 3, FATAL_ERRORLOG);
die("A fatal error has occured.<BR>Errormessage: " . $sErrMsg . "<BR>Please contact the sysadmin and give the following code: " . time());
} elseif ($aContext['this']) {
// Felet inträffade i en klass, skicka vidare till klassens felhanterare
// Men tryck först in felmeddelanden
$oConfig &= Configuration::createInstance();
$iCodeLen = strspn($sErrMsg, "1234567890");
$sErrMsg = substr_replace($sErrMsg, $oConfig->getErrorMsg($iErrNo = substr($sErrMsg, 0, $iCodeLen)), 0, $iCodeLen);
$sErrMsg .= " (" . $iErrNo . ")";
$aContext['this']->errorHandler($iErrNo, $sErrMsg);
} else {
// Skriv ut felet lite fint
// TODO: Koda
// TODO: Anropa loggobjekt
}
// Returnera
return NULL;
}
示例2: fixDateFormat
function fixDateFormat($iTimestamp, $iVersion = 1)
{
if (!$iTimestamp) {
return "";
}
$oConfiguration =& Configuration::createInstance();
$iRest = time() % 86400;
if (($iTime = time()) - $iTimestamp < $iRest) {
return date($oConfiguration->getCustomValue("DateFormatToday" . $iVersion), $iTimestamp);
} elseif ($iTime - $iTimestamp < $iRest + 86400) {
return date($oConfiguration->getCustomValue("DateFormatYesterday" . $iVersion), $iTimestamp);
} else {
return date($oConfiguration->getCustomValue("DateFormat" . $iVersion), $iTimestamp);
}
}
示例3: validUser
function validUser()
{
// Kolla grejer
if (isset($_SESSION['oUser']) and $_SESSION['iValidUntil'] > time() and $_SESSION['sIP'] == $_SERVER['REMOTE_ADDR']) {
// Inloggad användare
// Konfigurationsobjekt
$oConfiguration =& Configuration::createInstance();
// Uppdatera validitet
$_SESSION['iValidUntil'] = time() + $oConfiguration->getCustomValue("ValidTime") * 60;
// Returnera
return TRUE;
} else {
// Ej inloggad
return FALSE;
}
}
示例4: open
function open()
{
// Konfigurationsobjekt
$oConfig =& Configuration::createInstance();
// Anslut
if (!($this->rMySQL = mysql_connect($oConfig->getMysqlHost(), $oConfig->getMysqlUser(), $oConfig->getMysqlPass()))) {
trigger_error(mysql_error(), E_USER_WARNING);
return FALSE;
}
// V?lj databas
if (!mysql_select_db($oConfig->getMysqlDb(), $this->rMySQL)) {
trigger_error(mysql_error($this->rMySQL), E_USER_WARNING);
return FALSE;
}
// Returnera
return TRUE;
}
示例5: ini_set
<?php
// RegisterUser.php
// Skriven av Eli Kaufman för Daft
// Copyright Daft 2003 under GPL
// This file is part of PHPDaft.
// PHPDaft is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// PHPDaft is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with PHPDaft; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Visa var filerna finns
ini_set("include_path", "/home/daft/konferens/");
// Inkludera filer
require "Classes/class_Configuration.php";
require "Classes/yapter.php";
$oConfiguration =& Configuration::createInstance();
// Template
$oTemplate = new Template("/home/daft/Templates/RegisterUser.tpl");
$oTemplate->set("Title", $oConfiguration->getCustomValue("Title"));
// Tryck ut
$oTemplate->parse();
$oTemplate->spit();
示例6: createPasswordAndSend
function createPasswordAndSend()
{
// Konfiguration
$oConfiguration =& Configuration::createInstance();
// Templat
$oTemplate = new Template(TEMPLATE_PATH);
$oTemplate->setParseMode(TRUE);
// Skapa password
$this->setPassword($sPassword = randStr($oConfiguration->getCustomValue("PasswordLen")));
// Definiera
$oTemplate->set("UserName", $this->sName);
$oTemplate->set("Password", $sPassword);
// Hämta output
$oTemplate->parse();
$sData = $oTemplate->getContents();
// Maila
if (!mail($this->sEmail, $oConfiguration->getCustomValue("MailSubject"), $sData, "From: " . $oConfiguration->getCustomValue("MailFrom") . " <noreply@at.all>")) {
trigger_error("41", E_USER_WARNING);
return FALSE;
}
// Returnera
return TRUE;
}