本文整理汇总了PHP中SettingsManager::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP SettingsManager::getInstance方法的具体用法?PHP SettingsManager::getInstance怎么用?PHP SettingsManager::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SettingsManager
的用法示例。
在下文中一共展示了SettingsManager::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addWarning
public static function addWarning($text)
{
self::$warnings[] = $text;
if (SettingsManager::getInstance()->isDebugMode()) {
echo '<div class="warning">[Debug: Warning was added]' . $text . '</div>';
}
}
示例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: 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);
}
示例4: cap_cleanup
public static function cap_cleanup()
{
$files = glob(SettingsManager::getInstance()->getMainDir() . '/tmp/*');
foreach ($files as $filename) {
if (filectime($filename) < time() - 300) {
unlink($filename);
}
}
}
示例5: 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);
}
}
示例6: 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, "");
}
示例7: 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");
}
}
示例8: 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);
}
}
}
示例9: 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);
}
示例10: 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));
}
}
示例11: __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();
}
}
示例12: Find
public function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
{
$shift = intval(SettingsManager::getInstance()->getSetting("Attendance: Shift (Minutes)"));
$employee = new Employee();
$data = array();
$employees = $employee->Find("1=1");
$attendance = new Attendance();
$attendanceToday = $attendance->Find("date(in_time) = ?", array(date("Y-m-d")));
$attendanceData = array();
//Group by employee
foreach ($attendanceToday as $attendance) {
if (isset($attendanceData[$attendance->employee])) {
$attendanceData[$attendance->employee][] = $attendance;
} else {
$attendanceData[$attendance->employee] = array($attendance);
}
}
foreach ($employees as $employee) {
$entry = new stdClass();
$entry->id = $employee->id;
$entry->employee = $employee->id;
if (isset($attendanceData[$employee->id])) {
$attendanceEntries = $attendanceData[$employee->id];
foreach ($attendanceEntries as $atEntry) {
if ($atEntry->out_time == "0000-00-00 00:00:00" || empty($atEntry->out_time)) {
if (strtotime($atEntry->in_time) < time() + $shift * 60) {
$entry->status = "Clocked In";
$entry->statusId = 0;
}
}
}
if (empty($entry->status)) {
$entry->status = "Clocked Out";
$entry->statusId = 1;
}
} else {
$entry->status = "Not Clocked In";
$entry->statusId = 2;
}
$data[] = $entry;
}
function cmp($a, $b)
{
return $a->statusId - $b->statusId;
}
usort($data, "cmp");
return $data;
}
示例13: str_replace
$saveFileName = str_replace(".", "-", $saveFileName);
}
$file = new File();
$file->Load("name = ?", array($saveFileName));
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
$allowedExtensions = explode(',', "csv,doc,xls,docx,xlsx,txt,ppt,pptx,rtf,pdf,xml,jpg,bmp,gif,png,jpeg");
// max file size in bytes
$sizeLimit = MAX_FILE_SIZE_KB * 1024;
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload(CLIENT_BASE_PATH . 'data/', $saveFileName);
// to pass data through iframe you will need to encode all html tags
$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");
$uploadedToS3 = false;
LogManager::getInstance()->info($uploadFilesToS3 . "|" . $uploadFilesToS3Key . "|" . $uploadFilesToS3Secret . "|" . $s3Bucket . "|" . $s3WebUrl . "|" . CLIENT_NAME);
if ($uploadFilesToS3 . '' == '1' && !empty($uploadFilesToS3Key) && !empty($uploadFilesToS3Secret) && !empty($s3Bucket) && !empty($s3WebUrl)) {
$localFile = CLIENT_BASE_PATH . 'data/' . $result['filename'];
$f_size = filesize($localFile);
$uploadname = CLIENT_NAME . "/" . $result['filename'];
LogManager::getInstance()->info("Upload file to s3:" . $uploadname);
LogManager::getInstance()->info("Local file:" . $localFile);
LogManager::getInstance()->info("Local file size:" . $f_size);
$s3FileSys = new S3FileSystem($uploadFilesToS3Key, $uploadFilesToS3Secret);
$res = $s3FileSys->putObject($s3Bucket, $uploadname, $localFile, 'authenticated-read');
$file_url = $s3WebUrl . $uploadname;
$file_url = $s3FileSys->generateExpiringURL($file_url);
LogManager::getInstance()->info("Response from s3 file sys:" . print_r($res, true));
unlink($localFile);
示例14: fixJSON
public function fixJSON($json)
{
$noJSONRequests = SettingsManager::getInstance()->getSetting("System: Do not pass JSON in request");
if ($noJSONRequests . "" == "1") {
$json = str_replace("|", '"', $json);
}
return $json;
}
示例15: htmlspecialchars
echo !empty($rootName) ? htmlspecialchars($rootName) : 'Root';
?>
';
// create chan and user images as dom objects (for faster draw, especially SVG)
<?php
$chanImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/channel_12.png';
$chanImgHtmlObj = '<img src="' . $chanImgUrl . '" alt=""/>';
if (SettingsManager::getInstance()->isViewerSVGImagesEnabled()) {
$chanImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/channel.svg';
$chanImgHtmlObj = '<object data="' . $chanImgUrl . '" type="image/svg+xml" width="12" height="12">' . $chanImgHtmlObj . '</object>';
}
$userImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/talking_off_12.png';
$userImgHtmlObj = '<img src="' . $userImgUrl . '" alt=""/>';
if (SettingsManager::getInstance()->isViewerSVGImagesEnabled()) {
$userImgUrl = SettingsManager::getInstance()->getMainUrl() . '/img/mumble/talking_off.svg';
$userImgHtmlObj = '<object data="' . $userImgUrl . '" type="image/svg+xml" width="12" height="12">' . $userImgHtmlObj . '</object>';
}
?>
var mumpiChanImgHtmlObj = jQuery('<?php
echo $chanImgHtmlObj;
?>
');
var mumpiUserImgHtmlObj = jQuery('<?php
echo $userImgHtmlObj;
?>
');
function refreshTree()
{
showAjaxLoading();