本文整理汇总了PHP中SettingsManager类的典型用法代码示例。如果您正苦于以下问题:PHP SettingsManager类的具体用法?PHP SettingsManager怎么用?PHP SettingsManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SettingsManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (empty(self::$me)) {
self::$me = new SettingsManager();
}
return self::$me;
}
示例2: log
public static function log($message, $level)
{
if ($level == self::LEVEL_DEBUG && !SettingsManager::getInstance()->isDebugMode()) {
return;
}
DBManager::getInstance()->append('log.log', date('Y.m.d H:i:s') . ' – ' . $level . ': ' . $message);
}
示例3: addWarning
public static function addWarning($text)
{
self::$warnings[] = $text;
if (SettingsManager::getInstance()->isDebugMode()) {
echo '<div class="warning">[Debug: Warning was added]' . $text . '</div>';
}
}
示例4: __construct
public function __construct()
{
self::$spFilename = dirname(__FILE__) . '/SettingsManager.specialpage.wikitext';
self::$mnName = dirname(__FILE__) . '/SettingsManager.settings.php';
self::$templatePageName = dirname(__FILE__) . '/settingsmanager.namespaces.template';
// help the user a bit by making sure
// the file is writable when it comes to update it.
@chmod(self::$mnName, 0644);
$this->canUpdateFile = true;
// Log related
global $wgLogTypes, $wgLogNames, $wgLogHeaders, $wgLogActions;
$wgLogTypes[] = 'mngs';
$wgLogNames['mngs'] = 'mngslogpage';
$wgLogHeaders['mngs'] = 'mngslogpagetext';
$wgLogActions['mngs/updtok'] = 'mngs' . '-updtok-entry';
$wgLogActions['mngs/updtfail1'] = 'mngs' . '-updtfail1-entry';
$wgLogActions['mngs/updtfail2'] = 'mngs' . '-updtfail2-entry';
$wgLogActions['mngs/updtfail3'] = 'mngs' . '-updtfail3-entry';
$wgLogActions['mngs/updtfail4'] = 'mngs' . '-updtfail4-entry';
// Messages.
global $wgMessageCache;
$msg = $GLOBALS['msg' . __CLASS__];
foreach ($msg as $key => $value) {
$wgMessageCache->addMessages($msg[$key], $key);
}
}
示例5: generateJson
public function generateJson($serverId)
{
$server = MurmurServer::fromIceObject(ServerInterface::getInstance()->getServer($serverId));
$tree = $server->getTree();
$array = array('id' => $server->getId(), 'name' => SettingsManager::getInstance()->getServerName($server->getId()), 'root' => $this->treeToJsonArray($tree));
return json_encode($array);
}
示例6: cap_cleanup
public static function cap_cleanup()
{
$files = glob(SettingsManager::getInstance()->getMainDir() . '/tmp/*');
foreach ($files as $filename) {
if (filectime($filename) < time() - 300) {
unlink($filename);
}
}
}
示例7: getTemplate
public static function getTemplate($name)
{
$filepath = SettingsManager::getInstance()->getThemeDir() . '/' . $name . '.template.php';
if (file_exists($filepath)) {
$template = file_get_contents($filepath);
} else {
HelperFunctions::addError('Template file not found when trying to parse template: ' . $name);
}
}
示例8: validateSave
public function validateSave($obj)
{
if (SettingsManager::getInstance()->getSetting("Attendance: Time-sheet Cross Check") == "1") {
$attendance = new Attendance();
$list = $attendance->Find("employee = ? and in_time <= ? and out_time >= ?", array($obj->employee, $obj->date_start, $obj->date_end));
if (empty($list) || count($list) == 0) {
return new IceResponse(IceResponse::ERROR, "The time entry can not be added since you have not marked attendance for selected period");
}
}
return new IceResponse(IceResponse::SUCCESS, "");
}
示例9: sendLeaveApplicationEmail
public function sendLeaveApplicationEmail($employee, $cancellation = false)
{
$sup = $this->getEmployeeSupervisor($employee);
if (empty($sup)) {
return false;
}
$params = array();
$params['supervisor'] = $sup->first_name . " " . $sup->last_name;
$params['name'] = $employee->first_name . " " . $employee->last_name;
$params['url'] = CLIENT_BASE_URL;
if ($cancellation) {
$email = $this->subActionManager->getEmailTemplate('leaveCancelled.html');
} else {
$email = $this->subActionManager->getEmailTemplate('leaveApplied.html');
}
$user = $this->subActionManager->getUserFromProfileId($sup->id);
$emailTo = null;
if (!empty($user)) {
$emailTo = $user->email;
}
if (!empty($emailTo)) {
if (!empty($this->emailSender)) {
$ccList = array();
$ccListStr = SettingsManager::getInstance()->getSetting("Leave: CC Emails");
if (!empty($ccListStr)) {
$arr = explode(",", $ccListStr);
$count = count($arr) <= 4 ? count($arr) : 4;
for ($i = 0; $i < $count; $i++) {
if (filter_var($arr[$i], FILTER_VALIDATE_EMAIL)) {
$ccList[] = $arr[$i];
}
}
}
$bccList = array();
$bccListStr = SettingsManager::getInstance()->getSetting("Leave: BCC Emails");
if (!empty($bccListStr)) {
$arr = explode(",", $bccListStr);
$count = count($arr) <= 4 ? count($arr) : 4;
for ($i = 0; $i < $count; $i++) {
if (filter_var($arr[$i], FILTER_VALIDATE_EMAIL)) {
$bccList[] = $arr[$i];
}
}
}
if ($cancellation) {
$this->emailSender->sendEmail("Leave Cancellation Request Received", $emailTo, $email, $params, $ccList, $bccList);
} else {
$this->emailSender->sendEmail("Leave Application Received", $emailTo, $email, $params, $ccList, $bccList);
}
}
} else {
LogManager::getInstance()->info("[sendLeaveApplicationEmail] email is empty");
}
}
示例10: init
public function init()
{
if (SettingsManager::getInstance()->getSetting("Api: REST Api Enabled") == "1") {
$user = BaseService::getInstance()->getCurrentUser();
$dbUser = new User();
$dbUser->Load("id = ?", array($user->id));
$resp = RestApiManager::getInstance()->getAccessTokenForUser($dbUser);
if ($resp->getStatus() != IceResponse::SUCCESS) {
LogManager::getInstance()->error("Error occured while creating REST Api acces token for " . $user->username);
}
}
}
示例11: getInstance
/**
* @return SettingsManager
*/
public static function getInstance()
{
// $obj=NULL){
if (!isset(self::$instance)) {
if (!isset($obj)) {
self::$instance = new SettingsManager();
} else {
self::$instance = $obj;
}
}
return self::$instance;
}
示例12: generateJson
public function generateJson($serverId)
{
$serverIce = ServerInterface::getInstance()->getServer($serverId);
if ($serverIce == null) {
return json_encode(array());
}
$server = MurmurServer::fromIceObject(ServerInterface::getInstance()->getServer($serverId));
$serverConnectAddress = SettingsManager::getInstance()->getServerAddress($server->getId());
$path = urlencode($serverConnectAddress);
$connecturlTemplate = $serverConnectAddress != null ? 'mumble://%s?version=1.2.0' : null;
$tree = $server->getTree();
$array = array('id' => $server->getId(), 'name' => SettingsManager::getInstance()->getServerName($server->getId()), 'x_connecturl' => sprintf($connecturlTemplate, $path), 'root' => $this->treeToJsonArray($tree, $connecturlTemplate, $path));
return json_encode($array);
}
示例13: generateReport
private function generateReport($report, $data)
{
$fileFirst = "Report_" . str_replace(" ", "_", $report->name) . "-" . date("Y-m-d_H-i-s");
$file = $fileFirst . ".csv";
$fileName = CLIENT_BASE_PATH . 'data/' . $file;
$fp = fopen($fileName, 'w');
foreach ($data as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
$uploadedToS3 = false;
$uploadFilesToS3 = SettingsManager::getInstance()->getSetting("Files: Upload Files to S3");
$uploadFilesToS3Key = SettingsManager::getInstance()->getSetting("Files: Amazon S3 Key for File Upload");
$uploadFilesToS3Secret = SettingsManager::getInstance()->getSetting("Files: Amazone S3 Secret for File Upload");
$s3Bucket = SettingsManager::getInstance()->getSetting("Files: S3 Bucket");
$s3WebUrl = SettingsManager::getInstance()->getSetting("Files: S3 Web Url");
if ($uploadFilesToS3 . '' == '1' && !empty($uploadFilesToS3Key) && !empty($uploadFilesToS3Secret) && !empty($s3Bucket) && !empty($s3WebUrl)) {
$uploadname = CLIENT_NAME . "/" . $file;
$s3FileSys = new S3FileSystem($uploadFilesToS3Key, $uploadFilesToS3Secret);
$res = $s3FileSys->putObject($s3Bucket, $uploadname, $fileName, 'authenticated-read');
if (empty($res)) {
return array("ERROR", $file);
}
unlink($fileName);
$file_url = $s3WebUrl . $uploadname;
$file_url = $s3FileSys->generateExpiringURL($file_url);
$uploadedToS3 = true;
}
$fileObj = new File();
$fileObj->name = $fileFirst;
$fileObj->filename = $file;
$fileObj->file_group = "Report";
$ok = $fileObj->Save();
if (!$ok) {
LogManager::getInstance()->info($fileObj->ErrorMsg());
return array("ERROR", "Error generating report");
}
$headers = array_shift($data);
if ($uploadedToS3) {
return array("SUCCESS", array($file_url, $headers, $data));
} else {
return array("SUCCESS", array($file, $headers, $data));
}
}
示例14: __construct
function __construct()
{
// Check that the PHP Ice extension is loaded.
if (!extension_loaded('ice')) {
MessageManager::addError(tr('error_noIceExtensionLoaded'));
} else {
$this->contextVars = SettingsManager::getInstance()->getDbInterface_iceSecrets();
if (!function_exists('Ice_intVersion') || Ice_intVersion() < 30400) {
// ice 3.3
global $ICE;
Ice_loadProfile();
$this->conn = $ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address());
$this->meta = $this->conn->ice_checkedCast("::Murmur::Meta");
// use IceSecret if set
if (!empty($this->contextVars)) {
$this->meta = $this->meta->ice_context($this->contextVars);
}
$this->meta = $this->meta->ice_timeout(10000);
} else {
// ice 3.4
$initData = new Ice_InitializationData();
$initData->properties = Ice_createProperties();
$initData->properties->setProperty('Ice.ImplicitContext', 'Shared');
$ICE = Ice_initialize($initData);
/*
* getImplicitContext() is not implemented for icePHP yet…
* $ICE->getImplicitContext();
* foreach ($this->contextVars as $key=>$value) {
* $ICE->getImplicitContext()->put($key, $value);
* }
*/
try {
$this->meta = Murmur_MetaPrxHelper::checkedCast($ICE->stringToProxy(SettingsManager::getInstance()->getDbInterface_address()));
$this->meta = $this->meta->ice_context($this->contextVars);
} catch (Ice_ConnectionRefusedException $exc) {
MessageManager::addError(tr('error_iceConnectionRefused'));
}
}
$this->connect();
}
}
示例15: tr
if (isset($_GET['action']) && $_GET['action'] == 'edit_texture') {
echo ' enctype="multipart/form-data"';
}
?>
>
<table class="fullwidth">
<tr><?php
// SERVER Information (not changeable)
?>
<td class="formitemname"><?php
echo tr('server');
?>
:</td>
<td>
<?php
echo SettingsManager::getInstance()->getServerName($_SESSION['serverid']);
?>
</td>
<td></td>
</tr>
<tr><?php
// USERNAME
?>
<td class="formitemname"><?php
echo tr('username');
?>
:</td>
<td>
<?php
if (isset($_GET['action']) && $_GET['action'] == 'edit_uname') {
?>