本文整理匯總了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);
}