本文整理汇总了PHP中CBLib\Application\Application::Session方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::Session方法的具体用法?PHP Application::Session怎么用?PHP Application::Session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBLib\Application\Application
的用法示例。
在下文中一共展示了Application::Session方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _globalConv
/**
* Gets a cleaned value from a PHP global
*
* @param string $arn
* @param string $name
* @param mixed $def
* @return mixed
*/
protected static function _globalConv($arn, $name, $def = null)
{
switch ($arn) {
case 'request':
$value = Application::Input()->get($name, 0, GetterInterface::STRING);
break;
case 'get':
case 'post':
case 'cookie':
case 'server':
case 'env':
$value = Application::Input()->get($arn . '/' . $name, 0, GetterInterface::STRING);
break;
case 'session':
$value = Application::Session()->get($name, null, GetterInterface::STRING);
break;
case 'cbcookie':
$value = CBCookie::getcookie($name, $def);
break;
default:
trigger_error(sprintf('SQLXML::globalconv error: unknown type %s for %s.', $arn, $name), E_USER_NOTICE);
$value = null;
break;
}
return stripslashes($value);
}
示例2: phpCleanType
/**
* Returns safe PHP-typed values with type-defined sources
* $type can be:
* 'const:type' for constant of $fieldValue
* 'param:type' for the actual data from the model
* 'pluginparam:type' for a parameter from the plugin
* 'cmsversion:type' for the cmsversion attribute of type
* 'cbconfig:type' for the config parameter of CB
* 'datavalue:type' for the actual data from the model, but allowing a path
*
* @param mixed $fieldValue The value to PHP-format safely
* @param string $type The type of the value that is wanted (see above for types)
* @param SimpleXMLElement $element The element for additional attributes
* @param string $leftRight The prefix for additional attributes
* @return string|float|int The safely formatted PHP value
*/
function phpCleanType( $fieldValue, $type, $element, $leftRight ) {
$typeArray = explode( ':', $type, 3 );
if ( count( $typeArray ) < 2 ) {
$typeArray = array( 'const' , $type );
}
switch ( $typeArray[0] ) {
case 'const':
break;
case 'param':
$fieldValue = $this->getModelOfData()->get( $fieldValue );
break;
case 'pluginparams':
$fieldValue = $this->_pluginParams->get( $fieldValue );
break;
case 'cmsversion':
$fieldValue = checkJversion( ( $fieldValue ? $fieldValue : 'api' ) );
break;
case 'cbconfig':
global $ueConfig;
$fieldValue = ( array_key_exists( $fieldValue, $ueConfig ) ? $ueConfig[$fieldValue] : '' );
break;
case 'datavalue':
$fieldValue = $this->get( $fieldValue ); //TBD: missing default value, but not easy to find, as it's in the view param for now: $param->attributes( 'default' ) );
break;
case 'data':
$leftRightElem = $element->getChildByNameAttributes( $leftRight );
if ( $leftRightElem ) {
$fieldValue = $this->renderAllParams( $leftRightElem, 'params', null, 'view', 'none' );
} else {
trigger_error( 'XMLifCondition::phpCleanQuote:name: missing ' . $leftRight . ' element for type ' . htmlspecialchars( $type ), E_USER_NOTICE );
}
break;
case 'user':
// TODO: Change this to use Inversion Of Control, and allow XML valuetypes to be extended dynamically (e.g. instead of calling specifically CBLib\CB\User or similar when available, it is CB that adds the type and a closure to handle that type.
if ( $fieldValue == 'viewaccesslevels' ) {
$fieldValue = Application::MyUser()->getAuthorisedViewLevels();
} else {
if ( $fieldValue == 'usergroups' ) {
$fieldValue = Application::MyUser()->getAuthorisedGroups( false );
} else {
$fieldValue = \CBuser::getMyUserDataInstance()->get( $fieldValue );
}
}
break;
case 'request':
$fieldValue = $this->input->get( $fieldValue, 0, GetterInterface::STRING );
break;
case 'get':
case 'post':
case 'cookie':
case 'server':
case 'env':
$fieldValue = $this->input->get( $typeArray[0] . '/' . $fieldValue, 0, GetterInterface::STRING );
break;
case 'session':
$fieldValue = Application::Session()->get( $fieldValue, null, GetterInterface::STRING );
break;
default:
trigger_error( 'XMLifCondition::phpCleanQuote:name: ERROR_UNKNOWN_TYPE: ' . htmlspecialchars( $type ), E_USER_NOTICE );
break;
}
if ( is_array( $fieldValue ) ) {
$fieldValue = implode( '|*|', $fieldValue );
}
switch ( $typeArray[1] ) {
case 'int':
case 'integer':
$value = (int) $fieldValue;
break;
case 'float':
case 'number':
$value = (float) $fieldValue;
break;
case 'formula':
$value = $fieldValue;
//.........这里部分代码省略.........