本文整理汇总了PHP中Environment::getVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::getVariable方法的具体用法?PHP Environment::getVariable怎么用?PHP Environment::getVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::getVariable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formLoginAjaxSubmitted
public function formLoginAjaxSubmitted($form)
{
$values = $form->getValues();
if ($form->isValid()) {
$login = $values['login'];
$password = $values['password'];
$user = Environment::getUser();
$user->setAuthenticationHandler(new Admin_UserModel());
try {
$user->authenticate($login, $password);
$session_conf = Environment::getVariable('session');
$user->setExpiration($session_conf['expiration'], true);
//$session = $this->getSession('backlink');
//$session->in_application = true;
//$this->getApplication()->restoreRequest($session['backlink']);
//$this->redirect('Dashboard:default');
$this->payload->cmds = array();
$this->payload->cmds[] = 'login_ok';
$this->flash('Login OK');
if ($this->isAjax()) {
$this->sendPayload();
$this->terminate();
}
} catch (AuthenticationException $e) {
$form->setValues($values);
$this->invalidateControl('frmLogin');
if ($this->isAjax()) {
$this->invalidateControl('formLoginAjax');
}
//$this->flash('Error: '. $e->getMessage());
$this->payload->error = $e - getMessage();
}
}
}
示例2: createTemplate
/**
* @return ITemplate
*/
protected function createTemplate()
{
$template = new Template();
$presenter = $this->getPresenter(FALSE);
// default parameters
$template->component = $this;
// DEPRECATED!
$template->control = $this;
$template->presenter = $presenter;
$template->baseUri = Environment::getVariable('baseUri');
// flash message
if ($presenter !== NULL && $presenter->hasFlashSession()) {
$id = $this->getParamId('flash');
$template->flashes = $presenter->getFlashSession()->{$id};
}
if (!isset($template->flashes) || !is_array($template->flashes)) {
$template->flashes = array();
}
// default helpers
$template->registerHelper('escape', 'Nette\\Templates\\TemplateHelpers::escapeHtml');
$template->registerHelper('cache', 'Nette\\Templates\\CachingHelper::create');
$template->registerHelper('snippet', 'Nette\\Templates\\SnippetHelper::create');
$template->registerHelper('stripTags', 'strip_tags');
$template->registerHelper('nl2br', 'nl2br');
$template->registerHelperLoader('Nette\\Templates\\TemplateHelpers::loader');
return $template;
}
示例3: authenticate
public function authenticate(array $credentials)
{
$login = $credentials['username'];
$password = $this->phash($credentials['password']);
$super_admin = Environment::getVariable('admin');
if ($login == $super_admin['login']) {
if ($password == $super_admin['password']) {
$super_admin['roles'] = array('super admin');
$super_admin['id'] = 0;
$row = new DibiRow($super_admin);
MokujiServiceLocator::addService('UserAuthorizator', new Admin_UserModel());
} else {
throw new AuthenticationException("Invalid password.", self::INVALID_CREDENTIAL);
}
} else {
try {
$login_manager = Environment::getService('UserAuthenticator');
$row = $login_manager->authenticate($credentials);
} catch (InvalidStateException $e) {
throw new AuthenticationException("Login and password combination failed.", self::INVALID_CREDENTIAL);
}
}
$identity = new Identity($row->id, $row->roles, $row);
$identity->id = $row->id;
return $identity;
}
示例4: __construct
/**
* Construct
*/
public function __construct()
{
parent::__construct();
// output
$this->setOutputMode(self::HTML4_TRANSITIONAL);
$this->htmlOutputModule->removeOptional = false;
self::$advertisingNotice = false;
// headings
$this->headingModule->balancing = TexyHeadingModule::FIXED;
// phrases
$this->allowed['phrase/ins'] = true;
// ++inserted++
$this->allowed['phrase/del'] = true;
// --deleted--
$this->allowed['phrase/sup'] = true;
// ^^superscript^^
$this->allowed['phrase/sub'] = true;
// __subscript__
$this->allowed['phrase/cite'] = true;
// ~~cite~~
$this->allowed['deprecated/codeswitch'] = true;
// `=code
// images
$this->imageModule->fileRoot = WWW_DIR . "/files";
$this->imageModule->root = Environment::getVariable("baseUri") . "files/";
// flash, youtube.com, stream.cz handlers
$this->addHandler('image', array($this, 'youtubeHandler'));
$this->addHandler('image', array($this, 'streamHandler'));
$this->addHandler('image', array($this, 'flashHandler'));
}
示例5: createTemplate
/**
* @return ITemplate
*/
protected function createTemplate()
{
$template = new Template();
$presenter = $this->getPresenter(FALSE);
$template->onPrepareFilters[] = array($this, 'templatePrepareFilters');
// default parameters
$template->component = $this;
// DEPRECATED!
$template->control = $this;
$template->presenter = $presenter;
$template->baseUri = Environment::getVariable('baseUri');
$template->basePath = rtrim($template->baseUri, '/');
// flash message
if ($presenter !== NULL && $presenter->hasFlashSession()) {
$id = $this->getParamId('flash');
$template->flashes = $presenter->getFlashSession()->{$id};
}
if (!isset($template->flashes) || !is_array($template->flashes)) {
$template->flashes = array();
}
// default helpers
$template->registerHelper('escape', 'Nette\\Templates\\TemplateHelpers::escapeHtml');
$template->registerHelper('escapeUrl', 'rawurlencode');
$template->registerHelper('stripTags', 'strip_tags');
$template->registerHelper('nl2br', 'nl2br');
$template->registerHelper('substr', 'iconv_substr');
$template->registerHelper('repeat', 'str_repeat');
$template->registerHelper('implode', 'implode');
$template->registerHelper('number', 'number_format');
$template->registerHelperLoader('Nette\\Templates\\TemplateHelpers::loader');
return $template;
}
示例6: createComponentTexyla
protected function createComponentTexyla()
{
$texyla = new TexylaLoader();
$texyla->filters[] = array("baseUri" => Environment::getVariable("baseUri"), "previewPath" => $this->link("Texyla:preview"), "filesPath" => $this->link("Texyla:listFiles"), "filesUploadPath" => $this->link("Texyla:upload"), "filesMkDirPath" => $this->link("Texyla:mkDir"), "filesRenamePath" => $this->link("Texyla:rename"), "filesDeletePath" => $this->link("Texyla:delete"));
$texyla->addFile(WWW_DIR . "/js/texyla-init.js");
return $texyla;
}
示例7: __construct
public function __construct($locale = NULL)
{
if ($locale === NULL) {
$this->currentLocale = Environment::getVariable('lang');
} else {
$this->currentLocale = $locale;
}
}
示例8: renderManufacturer
public function renderManufacturer()
{
$this->template->paginator = new Paginator();
$this->template->paginator->setItemCount(mapper::products()->countByManufacturer($this->template->manufacturer, $this->template->letter));
$this->template->paginator->setItemsPerPage(Environment::getVariable('itemsPerPage', 30));
$this->template->paginator->setPage($this->template->page_number);
$this->template->products = mapper::products()->findByManufacturer($this->template->manufacturer, $this->template->paginator->getLength(), $this->template->paginator->getOffset(), $this->template->letter);
}
示例9: __construct
public function __construct(array $items = NULL)
{
$this->items = array('--temp' => array('callback' => callback($this, 'clearDir'), 'name' => "Clear Temp", 'args' => array(Environment::getVariable('tempDir'))), '--log' => array('callback' => callback($this, 'clearDir'), 'name' => "Clear Logs", 'args' => array(Environment::getVariable('logDir'))), '--sessions' => array('callback' => callback($this, 'clearDir'), 'name' => "Clear Sessions", 'args' => array(Environment::getVariable('sessionDir'))));
if (!empty($items)) {
$this->items = array_merge($this->items, $items);
}
$this->processRequest();
}
示例10: __construct
/**
* Construct
* @param IComponentContainer parent
* @param string name
*/
public function __construct(IComponentContainer $parent = null, $name = null)
{
parent::__construct($parent, $name);
$this->tempUri = Environment::getVariable("baseUri") . "webtemp";
$this->tempPath = WWW_DIR . "/webtemp";
$this->sourcePath = WWW_DIR . "/texyla/";
$this->addFiles(array("js/texyla.js", "js/selection.js", "js/texy.js", "js/buttons.js", "js/dom.js", "js/view.js", "js/ajaxupload.js", "languages/cs.js", "languages/sk.js", "languages/en.js", "plugins/keys/keys.js", "plugins/window/window.js", "plugins/resizableTextarea/resizableTextarea.js", "plugins/img/img.js", "plugins/table/table.js", "plugins/link/link.js", "plugins/emoticon/emoticon.js", "plugins/symbol/symbol.js", "plugins/files/files.js", "plugins/color/color.js", "plugins/textTransform/textTransform.js", "plugins/youtube/youtube.js"));
$this->filters[] = "JSMin::minify";
}
示例11: startup
/**
* Startup
*/
public function startup()
{
parent::startup();
$texy = Environment::getService("Texy");
$this->baseFolderPath = $texy->imageModule->fileRoot;
$this->baseFolderUri = $texy->imageModule->root;
$this->tempDir = WWW_DIR . "/webtemp";
$this->tempUri = Environment::getVariable("baseUri") . "/webtemp";
}
示例12: actionDefault
public function actionDefault()
{
$this->view = 'dashboard';
$this->template->registerHelper('count', 'count');
$this->template->pages = $this->model('pages')->getAll();
$this->template->categories = $this->model('categories')->getAll();
$this->template->menus = $this->model('menu')->getAll();
$this->template->modules = $this->model('modules')->getAll();
$this->template->loadedModules = Environment::getVariable('LoadedModules', array());
}
示例13: copy
/**
* copy $path to webmodulePublicDir/$path
*/
protected function copy($path)
{
$dest = Environment::getVariable('webtempDir') . '/' . static::ID . '/' . $path;
$src = $this->buildSrcPath() . $path;
if (!file_exists($dest)) {
if (file_exists($src)) {
Basic::copyr($src, $dest);
} else {
throw new ArgumentOutOfRangeException("Source path '{$src}' does NOT exist");
}
}
}
示例14: __construct
public function __construct($lang)
{
//translator
$this->lang = $lang;
//suppres the query for one-language
$langs = Environment::getVariable('langs');
if (count($langs) <= 1) {
return self::$cache[$lang] = array();
}
//fill the cache
try {
self::$cache[$lang] = dibi::query('SELECT * FROM translations')->fetchPairs('key', $lang);
} catch (Exception $e) {
self::$cache[$lang] = array();
}
}
示例15: beforeRender
protected function beforeRender()
{
parent::beforeRender();
//copy assets to webtemp
$relPath = "/webtemp/acl";
$src = __DIR__ . "/../../assets";
$dest = WWW_DIR . $relPath;
if (!file_exists($dest)) {
if (file_exists($src)) {
Basic::copyr($src, $dest);
} else {
throw new ArgumentOutOfRangeException("Source path '{$src}' does NOT exist");
}
}
$this->template->assetsBasePath = Environment::getVariable('basePath') . $relPath;
$this->template->current = $this->getPresenter()->getName();
}