本文整理汇总了PHP中JApplication::getUserState方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplication::getUserState方法的具体用法?PHP JApplication::getUserState怎么用?PHP JApplication::getUserState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplication
的用法示例。
在下文中一共展示了JApplication::getUserState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setReturnURL
/**
* Grabs the login form return url and sets it to all available cb login forms on the page
*
* @param JApplication $app
*/
private function setReturnURL($app)
{
if (!$this->getUserIsGuest()) {
return;
}
static $cache = 0;
if (!$cache++) {
if ($this->params->get('return_urls', 1)) {
$redirect = $app->getUserState('users.login.form.return', null);
if (!$redirect) {
$data = $app->getUserState('users.login.form.data', array());
$redirect = isset($data['return']) ? $data['return'] : null;
if ($redirect) {
$data['return'] = null;
$app->setUserState('users.login.form.data', $data);
}
} else {
$app->setUserState('users.login.form.return', null);
}
if ($redirect) {
$document = JFactory::getDocument();
$js = "function cbLoginReturn() {" . "var pageForms = document.forms;" . "if ( pageForms ) for ( i = 0; i < pageForms.length; i++ ) {" . "if ( pageForms[i].id == 'login-form' ) {" . "pageForms[i].return.value = '" . addslashes('B:' . base64_encode($redirect)) . "';" . "}" . "}" . "}" . "if ( window.addEventListener ) {" . "window.addEventListener( 'load', cbLoginReturn, false );" . "} else if ( window.attachEvent ) {" . "window.attachEvent( 'onload', cbLoginReturn );" . "}";
$document->addScriptDeclaration($js);
}
}
}
}
示例2: getUserState
/**
* Gets a session-based user-state
*
* @param string $stateName Unique name of state
* @param string $default First value if not initialized
* @return string State
*/
function getUserState($stateName, $default = null)
{
return $this->_baseFramework->getUserState($stateName, $default);
}
示例3: getUserState
function getUserState($stateName)
{
return $this->_baseFramework->getUserState($stateName);
}