本文整理汇总了PHP中Manager::getOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::getOptions方法的具体用法?PHP Manager::getOptions怎么用?PHP Manager::getOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager::getOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
/**
* Verifica se a senha fornecida por um usuário é válida
* utilizando autenticação challenge-response.
*
* @param int $userId
* @param string $challenge
* @param string $response
* @return boolean
*/
public function authenticate($userId, $challenge, $response)
{
Manager::logMessage("[LOGIN] Authenticating {$userId} LdapMD5");
$login = NULL;
try {
if ($this->validate($userId, $challenge, $response)) {
$user = Manager::getModelMAD('user');
$user->getByLogin($userId);
$profile = $user->getProfileAtual();
$user->getByProfile($profile);
$login = new MLogin($user);
if (Manager::getOptions("dbsession")) {
$session = Manager::getModelMAD('session');
$session->lastAccess($login);
$session->registerIn($login);
}
$this->setLogin($login);
$this->setLoginLogUserId($user->getId());
$this->setLoginLog($login->getLogin());
Manager::logMessage("[LOGIN] Authenticated {$userId} LdapMD5");
return true;
}
} catch (Exception $e) {
Manager::logMessage("[LOGIN] {$userId} NOT Authenticated LdapMD5 - " . $e->getMessage());
}
Manager::logMessage("[LOGIN] {$userId} NOT Authenticated LdapMD5");
return false;
}
示例2: apply
public function apply($request, $response)
{
$response->status = MStatusCode::INTERNAL_ERROR;
$format = $request->format;
$response->setContentType($response->getMimeType("xx." + format));
$this->tracestack = str_replace('#', '<br>#', $this->exception->trace);
$errorHtml = "Not found";
try {
$template = new MTemplate();
$template->context('result', $this->exception);
$language = Manager::getOptions('language');
$errorHtml = $template->fetch("errors/{$language}/" . $response->status . "." . ($format == null ? "html" : $format));
if ($request->isAjax() && $format == "html") {
if ($this->ajax->isEmpty()) {
$this->ajax->setId('error');
$this->ajax->setType('page');
$this->ajax->setData($errorHtml);
}
$response->out = $this->ajax->returnData();
} else {
$response->out = $errorHtml;
}
} catch (Exception $e) {
throw new EMException($e);
}
}
示例3: getInstance
public static function getInstance()
{
if (self::$instance == NULL) {
self::$instance = new MKrono();
self::$instance->baseDate = '02/01/00';
// For day/month names
self::$instance->localeConv = localeConv();
self::$instance->separator = Manager::getOptions('separatorDate');
self::$instance->formatDate = Manager::getOptions('formatDate');
self::$instance->formatTimestamp = Manager::getOptions('formatTimestamp');
self::$instance->timeZone = Manager::getOptions('timezone');
}
return self::$instance;
}
示例4: _getNextValue
private function _getNextValue($sequence = 'admin')
{
$transaction = $this->db->beginTransaction();
$table = $this->db->getConfig('sequence.table');
$name = $this->db->getConfig('sequence.name');
$field = $this->db->getConfig('sequence.value');
$sql = new \Maestro\Database\MSQL($field, $table, "({$name} = '{$sequence}')");
$sql->setForUpdate(true);
$result = $this->db->query($sql);
$value = \Manager::getOptions('fetchStyle') == \FETCH_NUM ? $result[0][0] : $result[0][$field];
$nextValue = $value + 1;
$this->db->execute($sql->update($nextValue), $nextValue);
$transaction->commit();
return $value;
}
示例5: apply
public function apply($request, $response)
{
$response->status = MStatusCode::NOT_FOUND;
$format = $request->format;
if ($request->isAjax() && $format == "html") {
$format = "json";
}
$response->setContentType($response->getMimeType("xx." + format));
$errorHtml = "Not found";
try {
$template = new MTemplate();
$template->context('result', $this);
$language = Manager::getOptions('language');
$errorHtml = $template->fetch("errors/{$language}/404.html");
if ($request->isAjax()) {
$this->ajax->setResponse('html', $errorHtml);
$response->out = $this->ajax->returnData();
} else {
$response->out = $errorHtml;
}
} catch (EMException $e) {
}
}
示例6: asCSV
public function asCSV($showColumnName = false)
{
$this->getResult();
$result = $this->result;
if ($showColumnName) {
for ($i = 0; $i < $this->columnCount; $i++) {
$columns[] = ucfirst($this->metadata['fieldname'][$i]);
}
array_unshift($result, $columns);
}
$id = uniqid(md5(uniqid("")));
// generate a unique id to avoid name conflicts
$fileCSV = \Manager::getFilesPath($id . '.csv', true);
$csvDump = new \MCSVDump(\Manager::getOptions('csv'));
$csvDump->save($result, basename($fileCSV));
return $fileCSV;
}
示例7: setTemplate
/**
* Define template and template variables
*/
public function setTemplate()
{
$path = Manager::getThemePath();
$this->template = new MTemplate($path);
$this->template->context('manager', Manager::getInstance());
$this->template->context('page', $this);
$this->template->context('charset', Manager::getOptions('charset'));
$this->template->context('layout', $this->layout);
$this->template->context('template', $this->template);
}
示例8: init
public function init()
{
$this->dumpping = Manager::getOptions('dump');
// if it is a AJAX call, initialize MAjax
if (Manager::isAjaxCall()) {
Manager::$ajax = new MAjax();
Manager::$ajax->initialize(Manager::getOptions('charset'));
}
$this->addApplicationConf();
$this->addApplicationActions();
$this->addApplicationMessages();
Manager::getPage();
$this->controllerAction = '';
$this->forward = '';
}
示例9: fillCSV
function fillCSV($array, $fileInput, $fileOutput, $fileType, $parameters, $classPath, $save)
{
$params = $this->prepareParameters($parameters);
$params->put('REPORT_LOCALE', new Java("java.util.Locale", 'pt', 'BR'));
$extension = substr($fileInput, strrpos($fileInput, '.'));
try {
$sJfm = new JavaClass("net.sf.jasperreports.engine.JasperFillManager");
if ($extension == ".jrxml") {
$s1 = new JavaClass("net.sf.jasperreports.engine.xml.JRXmlLoader");
$jasperDesign = $s1->load($fileInput);
$sJcm = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager");
$report = $sJcm->compileReport($jasperDesign);
} else {
$report = $fileInput;
}
$csvDump = new MCSVDump(Manager::getOptions('csv'), MCSVDump::WINDOWS_EOL);
$fileCSV = str_replace('.pdf', '.csv', $fileOutput);
$csvDump->save($array, basename($fileCSV));
$sJds = new Java("net.sf.jasperreports.engine.data.JRCsvDataSource", $fileCSV, 'UTF8');
$sJds->setFieldDelimiter(Manager::getOptions('csv'));
$print = $sJfm->fillReport($report, $params, $sJds);
$sJem = new JavaClass("net.sf.jasperreports.engine.JasperExportManager");
$output = \Manager::getDownloadURL('report', basename($this->fileOutput), true);
$sJem->exportReportToPdfFile($print, $fileOutput);
} catch (Exception $e) {
dump_java_exception($e);
}
return $output;
}
示例10: __construct
public function __construct($request)
{
$this->isCore = false;
if (is_string($request)) {
$path = $request;
$this->url = $path;
} else {
$this->request = $request;
if ($this->request->querystring != '') {
parse_str($this->request->querystring, $this->vars);
}
$path = $this->request->getPathInfo();
$this->url = $this->request->path;
}
mtrace('Context path: ' . $path);
$pathParts = explode('/', $path);
$app = array_shift($pathParts);
if ($app != '') {
if ($app == 'core') {
$this->isCore = true;
$app = array_shift($pathParts);
}
$this->app = $app;
$part = array_shift($pathParts);
// check for module
$namespace = $this->getNamespace($this->app, $part);
if ($part && Manager::existsNS($namespace)) {
$this->module = $part;
$part = array_shift($pathParts);
} else {
$this->module = '';
}
// check for controller/component/service
$ctlr = $part;
$controller = $component = $service = '';
while ($part && ($controller == '' && $component == '' && $service == '')) {
$namespace = $this->getNamespace($this->app, $this->module, '', 'controllers');
$ns = $namespace . $part . 'Controller.php';
if (Manager::existsNS($ns)) {
$controller = $part;
$part = array_shift($pathParts);
} else {
$namespace = $this->getNamespace($this->app, $this->module, '', 'services');
$ns = $namespace . $part . 'Service.php';
if (Manager::existsNS($ns)) {
$service = $part;
$part = array_shift($pathParts);
} else {
$namespace = $this->getNamespace($this->app, $this->module, '', 'components');
$ns = $namespace . $part . '.php';
if (Manager::existsNS($ns)) {
$component = $part;
$part = array_shift($pathParts);
} else {
$part = array_shift($pathParts);
}
}
}
}
} else {
$this->app = Manager::getOptions('startup');
$controller = 'main';
}
if ($controller) {
$this->controller = $controller;
} elseif ($service) {
$this->service = $service;
} elseif ($component) {
$this->component = $component;
} else {
throw new ENotFoundException(_M("App: [%s], Module: [%s], Controller: [%s] : Not found!", array($this->app, $this->module, $ctlr)));
}
$this->action = $part ?: ($component == '' ? 'main' : '');
$this->actionTokens[0] = $this->controller;
$this->actionTokens[1] = $this->action;
$this->currentToken = 1 + ($this->module ? 1 : 0);
if ($n = count($pathParts)) {
for ($i = 0; $i < $n; $i++) {
$this->actionTokens[$i + 2] = $this->vars[$pathParts[$i]] = $pathParts[$i];
}
}
$this->id = $this->vars['item'] ?: $this->actionTokens[2];
if ($this->id !== '') {
$_REQUEST['id'] = $this->id;
}
Manager::getInstance()->application = $this->app;
mtrace('Context app: ' . $this->app);
mtrace('Context module: ' . $this->module);
mtrace('Context controller: ' . $this->controller);
mtrace('Context service: ' . $this->service);
mtrace('Context component: ' . $this->component);
mtrace('Context action: ' . $this->action);
mtrace('Context id: ' . $this->id);
}
示例11: renderJSON
public function renderJSON($json = '')
{
if (!Manager::isAjaxCall()) {
Manager::$ajax = new MAjax();
Manager::$ajax->initialize(Manager::getOptions('charset'));
}
$ajax = Manager::getAjax();
$ajax->setData($this->data);
$this->setResult(new MRenderJSON($json));
}
示例12: __construct
public function __construct($datetime = NULL, $format = '')
{
parent::__construct($datetime, $format ?: Manager::getOptions('formatTimestamp'));
}
示例13: __construct
public function __construct()
{
$this->host = $_SERVER['SERVER_NAME'];
$this->path = $this->getPathInfo();
mtrace('MRequest path = ' . $this->path);
$this->querystring = $this->getQueryString();
$this->method = $this->getRequestType();
$this->domain = $this->getServerName();
$this->remoteAddress = $this->getUserHostAddress();
$this->contentType = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '';
$this->port = $this->getPort();
$this->secure = $this->getIsSecureConnection();
$this->headers = $_SERVER;
$this->cookies = isset($_COOKIES) ? $_COOKIES : '';
$dispatch = Manager::getOptions('dispatch');
/*
$p = strpos($this->path,$dispatch);
if ($p !== false) {
$this->path = str_replace($dispatch, '', $this->path);
}
$this->baseUrl = Manager::getConf('url.base');
$p = ($this->path && $this->baseUrl) ? strpos($this->path,$this->baseUrl) : false;
if (($this->baseUrl != '') && ($p !== false)) {
$this->path = str_replace($this->baseUrl, '', $this->path);
}
*
*/
$this->baseUrl = $this->getBaseUrl();
$this->date = Manager::getSysTime();
$this->isNew = true;
$this->user = '';
$this->password = '';
$this->isLoopback = $this->remoteAddress == '127.0.0.1';
$this->params = $_REQUEST;
$this->url = $this->getUrl();
$this->dispatch = $this->getBase() . $dispatch;
$this->resolveFormat();
$auth = isset($_SERVER['AUTH_TYPE']) ? $_SERVER['AUTH_TYPE'] : '';
if ($auth != '' && substr($auth, 0, 6) == "Basic ") {
$this->user = $_SERVER['PHP_AUTH_USER'];
$this->password = $_SERVER['PHP_AUTH_PW'];
}
//mtrace('MRequest path = ' . $this->path);
//mtrace('MRequest base = ' . $this->getBase());
//mtrace('MRequest baseURL = ' . $this->getBaseURL());
//mtrace('MRequest url = ' . $this->url);
}
示例14: getFullName
public function getFullName($dayOfWeek = false)
{
$locale = \Manager::getOptions('locale');
$prefix = $dayOfWeek ? $this->getDayName() . ', ' : '';
if ($locale[0] == 'pt_BR') {
return $prefix . $this->getDay('j') . ' de ' . $this->getMonthName() . ' de ' . $this->getYear();
} else {
return $prefix . $this->getMonthName() . ' ' . $this->getDay('j') . ',' . $this->getYear();
}
}
示例15: getURL
public static function getURL($action = 'main/main', $args = array())
{
if (strtoupper(substr($action, 0, 4)) == 'HTTP') {
return $action;
}
if (Manager::getOptions('compatibility')) {
$action = str_replace(':', '/', $action);
}
$url = self::$instance->getContext()->buildURL($action, $args);
return $url;
}