Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Tx_xxx_Controller_AbstractController extends Tx_Extbase_MVC_Controller_ActionController {
- /**
- * Session storage key used
- * @var string
- */
- protected $sessionDataStorageKey = 'tx_xxx';
- /**
- * The session data container
- * @var array
- */
- protected $sessionData = array();
- protected function getExtConf() {
- return unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['xxx']);
- }
- public function initializeAction() {
- $this->loadSessionData();
- if(!$this->sessionData['productcategory']){
- $this->sessionData['productcategory'] = 1;
- $this->storeSessionData();
- }
- }
- /**
- * Loads data from session
- * @return void
- */
- protected function loadSessionData() {
- $GLOBALS['TSFE']->fe_user->fetchSessionData();
- $this->sessionData = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->sessionDataStorageKey);
- }
- /**
- * Stores data to session
- * @return void
- */
- protected function storeSessionData() {
- $GLOBALS['TSFE']->fe_user->setKey('ses', $this->sessionDataStorageKey, $this->sessionData);
- $GLOBALS['TSFE']->fe_user->storeSessionData();
- }
- /**
- * removes all date from session
- * @return void
- */
- protected function clearSessionData() {
- $this->sessionData = array();
- $GLOBALS['TSFE']->fe_user->setKey('ses', $this->sessionDataStorageKey, $this->sessionData);
- $GLOBALS['TSFE']->fe_user->storeSessionData();
- }
- /**
- * fetches the cookie of a given name and handles magic quotes
- *
- * @param string $cookieName
- */
- protected static function getCookie($cookieName) {
- $cookie = $_COOKIE[$cookieName];
- if ($cookie && get_magic_quotes_gpc()) {
- $cookie = stripslashes($cookie);
- }
- return $cookie;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement