當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。