当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::Session方法代码示例

本文整理汇总了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);
 }
开发者ID:Raul-mz,项目名称:web-erpcya,代码行数:34,代码来源:XmlTypeCleanQuote.php

示例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;
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:RegistryEditView.php


注:本文中的CBLib\Application\Application::Session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。