本文整理汇总了PHP中Zend\Session\Container::offsetUnset方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::offsetUnset方法的具体用法?PHP Container::offsetUnset怎么用?PHP Container::offsetUnset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Session\Container
的用法示例。
在下文中一共展示了Container::offsetUnset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logoutAction
/**
* Logout from password preview area
*
* @return \Zend\Http\Response
*/
public function logoutAction()
{
$session = new SessionContainer();
$session->offsetUnset('preview_area_ok');
$session->offsetUnset('preview_area_logintimeout');
return $this->redirect()->toRoute('main');
}
示例2: clear
/**
* Clear datas with $uid key
* @param mixed $uid
* @return void
*/
public function clear($uid = null)
{
$this->alloc();
if ($uid) {
return $this->session->offsetUnset($uid);
}
return $this->session->exchangeArray(array());
}
示例3: registerAction
/**
* @return array
*/
public function registerAction()
{
$form = new Register($this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager'));
$form->get('primary')->setValue($this->getAuthenticationService()->getIdentity()->getId());
$status = null;
// Step 3: Returned from PayPal
if ($this->params()->fromRoute('payum_token')) {
$status = $this->getDogService()->completePayment($this);
$details = $status->getFirstModel();
if ($details instanceof DetailsAggregateInterface) {
$details = $details->getDetails();
if ($details instanceof \Traversable) {
$details = iterator_to_array($details);
}
}
$form->setData($details['dogData']);
if ($status->isCaptured()) {
$this->getDogService()->registerNewDog($details['dogData']);
return $this->redirect()->toRoute('home');
}
// Step 2: Confirm dog information and redirect to PayPal
} elseif ($dogData = $this->session->offsetGet('dogData')) {
$this->session->offsetUnset('dogData');
$request = $this->getRequest();
if ($request->isPost() && $request->getPost('confirm') !== null) {
$token = $this->getDogService()->preparePayment($dogData, $this->getAuthenticationService()->getIdentity());
return $this->redirect()->toUrl($token->getTargetUrl());
}
$form->setData($dogData);
// Step 1: Collect dog information
} else {
$request = $this->getRequest();
if ($request->isPost()) {
if ($request->getPost('cancel') !== null) {
return $this->redirect()->toRoute('home');
}
$form->setData($request->getPost());
if ($form->isValid()) {
$dogData = $form->getData();
$dogData['breedName'] = $this->getDogService()->getBreed($dogData['breed'])->getName();
$this->session->offsetSet('dogData', $dogData);
$form = new Confirm();
}
}
}
// Remove payum token from form action url if necessary
$form->setAttribute('action', $this->url()->fromRoute('dog/register'));
return array('form' => $form, 'status' => $status, 'dogData' => $this->session->offsetGet('dogData'));
}
示例4: unsetsearchAction
/**
* Unset session search
*
* @return \Zend\Http\Response
*/
public function unsetsearchAction()
{
$sessioContainer = new SessionContainer();
$sessioContainer->offsetUnset(self::sessionIdentifier);
$referer = $this->getRequest()->getHeader('Referer');
if (is_object($referer)) {
return $this->redirect()->toUrl($referer->getUri());
}
return $this->redirect()->toRoute('main');
}
示例5: denyAction
/**
* @return \Zend\Http\Response
*/
public function denyAction()
{
$session = new SessionContainer();
$session->offsetUnset('cookie-warning');
$referer = $this->getRequest()->getHeader('Referer');
if ($referer) {
return $this->redirect()->toUrl($referer->getUri());
}
return $this->redirect()->toRoute('main', array('action' => 'index'));
}
示例6: index03Action
public function index03Action()
{
$ssUser = new Container("user");
$ssUser->offsetUnset("name");
if ($ssUser->offsetExists("name")) {
echo $ssUser->offsetGet("name");
} else {
echo "Noooooooo session";
}
return false;
}
示例7: filterAction
public function filterAction()
{
if ($this->request->isPost()) {
$ssOrder = new Container(__CLASS__);
//$ssOrder->offsetSet("order",$order); default way
$ssOrder->order = $this->_mainParam['data']['order'];
//new Way
$ssOrder->order_by = $this->_mainParam['data']['order_by'];
$ssOrder->filter_status = $this->_mainParam['data']['filter_status'];
$ssOrder->search_value = $this->_mainParam['data']['search_value'];
$ssOrder->search_key = $this->_mainParam['data']['search_key'];
$ssOrder->filter_level = $this->_mainParam['data']['filter_level'];
if (isset($this->_mainParam['data']['btn_clear'])) {
$ssOrder->offsetUnset("search_value");
$ssOrder->offsetUnset("search_key");
}
}
// return false;
return $this->toAction();
}
示例8: getToken
public function getToken()
{
if ($this->session->fbToken && $this->session->fbTokenExpires) {
if (time() <= $this->session->fbTokenExpires) {
return $this->session->fbToken;
}
}
$code = $this->getCode();
$this->http->setUri(self::FACEBOOK_AUTH_URI);
$this->http->setParameterGet(array('client_id' => $this->fbClientId, 'redirect_uri' => 'http://' . $_SERVER['HTTP_HOST'] . '/', 'client_secret' => $this->fbSecret, 'code' => $code));
$response = $this->http->send();
if ($response->getStatusCode() != \Zend\Http\Response::STATUS_CODE_200) {
throw new Exception\AuthException('Bad response from Facebook OAuth');
}
parse_str($response->getBody(), $parsedResponse);
if (!array_key_exists('access_token', $parsedResponse) || !array_key_exists('expires', $parsedResponse)) {
throw new Exception\AuthException('Bad parse from Facebook OAuth');
}
$this->session->fbToken = $parsedResponse['access_token'];
$this->session->fbTokenExpires = time() + $parsedResponse['expires'];
$this->session->offsetUnset('fbCode');
return $this->session->fbToken;
}
示例9: logoutAction
public function logoutAction()
{
$session = new Container('base');
$session->offsetUnset('user');
return $this->redirectToLoginPage('User has been logout!', array());
}
示例10: paymentAction
//.........这里部分代码省略.........
} else {
if ($details->cardType == "MasterCard") {
$card_type = 2;
} else {
if ($details->cardType == "American Express") {
$card_type = 3;
}
}
}
}
/* get saved card details : statr */
$data['customerDetails_id'] = $cardDetails['customerDetails_id'];
$data['paymentMethodToken'] = $cardDetails['creditCardDetails_token'];
$data['amount'] = $subscriptionsession->serviceprice;
$data['currency'] = $subscriptionsession->currency;
$result = $trans->processPayment($this->getServiceLocator()->get('Config'), $data, '1');
}
if ($result['status'] == 1) {
// save user card details
if ($data['rememberme'] == 1 || $data['use_for_renew'] == "1") {
$usersCardDetails = array();
$usersCardDetails['user_id'] = $session->userid;
$usersCardDetails['creditCardDetails_token'] = $result['creditCardDetails_token'];
$usersCardDetails['customerDetails_id'] = $result['customerDetails_id'];
$usersCardDetails['use_for_renew'] = $data['use_for_renew'] == 1 || $data['use_for_renew'] == "1" ? 1 : 0;
$usersCardDetails['card_expiration_hash'] = md5($data['month'] . '-' . $data['year']);
//$response = $bookingModel->addUsersCardDetails($api_url, $usersCardDetails);
$response = $trans->updateCard($this->getServiceLocator()->get('Config'), $usersCardDetails);
}
$subscriptionData = array();
$subscriptionData['subscription_duration_id'] = $subscriptionsession->subscription_duration_id;
$subscriptionData['payment_status_id'] = 7;
$subscriptionData['site_commision'] = "0";
$subscriptionData['status_id'] = 1;
$subscriptionData['user_id'] = $session->userid;
$subscriptionData['invoice_total'] = str_replace(array('USD$', 'CAD$', '$'), array('', '', ''), $subscriptionsession->serviceprice);
$subscriptionData['created_by'] = $session->userid;
$subscriptionData['invoice_status'] = 1;
$subscriptionData['amount'] = str_replace(array('USD$', 'CAD$', '$'), array('', '', ''), $subscriptionsession->serviceprice);
$subscriptionData['currency'] = $subscriptionsession->currency;
$subscriptionData['payment_date'] = date('Y-m-d H:i:s');
$subscriptionData['amount_paid'] = $subscriptionsession->serviceprice;
$subscriptionData['transaction_id'] = $result['transaction_id'];
$subscriptionData['payment_instrument_no'] = strlen($data['card_no']) > 4 ? substr($data['card_no'], strlen($data['card_no']) - 4, 4) : $data['card_no'];
$subscriptionData['payment_method_id'] = $card_type;
$subscriptionData['payment_status'] = 7;
$subscriptionData['subscription_start_date'] = date('Y-m-d');
$subscriptionData['sale_type'] = 1;
/* 1 for subscription */
$subscriptionData['subscription_end_date'] = $subscriptionsession->subscription_end_date;
//$subscriptionData['user_card_id'] = $result['user_card_id'];
$response = $bookingModel->addBooking($api_url, $subscriptionData);
if ($response['status'] == 1 && isset($response['id'])) {
/* Send email code starts here */
$common = new Common();
if ($template = $common->emailTemplate($api_url, 11)) {
//$sp_details = $model->getSPDetails($api_url, $bookingsession->sp_id);
//$user_details = $consumer->getConsumerdetails($api_url, $session->userid);
$user_details = $model->getSPDetails($api_url, $session->userid);
$user_details['address'] = json_decode($user_details['address'][0], true);
$user_details['contact'] = json_decode($user_details['contact'][0], true);
$data = $bookingModel->getBookings($api_url, '', '', '', '', '', '', $response['id'], 'subscription');
$view = new viewModel(array('booking_details' => $data['results'], 'user_details' => $user_details));
$view->setTemplate('application/membership/printinvoice.phtml');
$printData = $this->getServiceLocator()->get('viewrenderer')->render($view);
// Store in PDF format
$dompdf = new \DOMPDF();
$dompdf->load_html($printData);
$dompdf->render();
$output = $dompdf->output();
$attachment = new MimePart($output);
$attachment->type = 'application/pdf';
$attachment->filename = 'invoice.pdf';
$attachment->encoding = \Zend\Mime\Mime::ENCODING_BASE64;
$attachment->disposition = \Zend\Mime\Mime::DISPOSITION_ATTACHMENT;
$mail = new Message();
$transport = new \Zend\Mail\Transport\Sendmail();
$html = new MimePart(preg_replace('/{{user_name}}/i', '<strong>' . $user_details['first_name'] . ' ' . $user_details['last_name'] . '</strong>', $template['content']));
$html->type = "text/html";
$body = new MimeMessage();
$body->setParts(array($html, $attachment));
$mail->setBody($body)->setFrom($template['fromEmail'], 'Ovessence')->addTo($user_details['email'], '')->setSubject($template['subject']);
$transport->send($mail);
/* Send email code ends here */
}
// unset all sessions
$subscriptionsession->offsetUnset('currency');
$subscriptionsession->offsetUnset('serviceprice');
$subscriptionsession->offsetUnset('subscription_duration_id');
$subscriptionsession->offsetUnset('subscription_end_date');
echo json_encode(array('status' => '1', 'msg' => 'Subscription updated successfully. <br /> Redirecting to invoice page..!!', 'subscription_id' => $response['id']));
} else {
echo json_encode(array('status' => '0', 'msg' => 'Transaction completed successfully with Transaction Id <strong>' . $result['transaction_id'] . '</strong>. <br /> Failed to complete your request. Please contact to site admin..!!', 'errors' => $response['data']));
}
} else {
echo json_encode($result);
}
}
exit;
}
示例11: getUserData
/**
* @return bool|NormalizedData
*/
public function getUserData()
{
if ($this->data) {
return $this->data;
}
$config = array('consumerKey' => $this->consumerKey, 'consumerSecret' => $this->consumerSecret, 'siteUrl' => 'https://api.twitter.com/oauth');
$httpClientOptions = array('adapter' => 'Zend\\Http\\Client\\Adapter\\Curl', 'curloptions' => array(CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false));
$consumer = new Consumer($config);
$consumer->setHttpClient($consumer->getHttpClient()->setOptions($httpClientOptions));
$tw_session = new Container('twitter');
if (!empty($this->getParams) && $tw_session->offsetExists('request_token')) {
try {
$tw_request_token = $tw_session->offsetGet('request_token');
$token = $consumer->getAccessToken($this->getParams, unserialize($tw_request_token));
$tw_session->offsetUnset('request_token');
$client = $token->getHttpClient($config, null, array('adapter' => new Client\Adapter\Curl()));
$client->setUri('https://api.twitter.com/1.1/account/verify_credentials.json');
$client->setMethod(Request::METHOD_GET);
$adapter = new Client\Adapter\Curl();
$adapter->setCurlOption(CURLOPT_SSL_VERIFYHOST, false);
$adapter->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
$client->setAdapter($adapter);
$response = $client->send();
$data = Json::decode($response->getBody(), Json::TYPE_ARRAY);
$data['token'] = serialize($token);
$this->isValid = true;
return new NormalizedData(NormalizedData::PROVIDER_TYPE_TWITTER, $data);
} catch (\Exception $e) {
return false;
}
}
return false;
}
示例12: paymentAction
public function paymentAction()
{
$request = $this->getRequest();
if ($request->isPost()) {
$bookingsession = new Container('bookingsession');
$session = new Container('frontend');
$bookingModel = new Bookings();
$trans = new Transactions();
$model = new Practitioners();
$consumer = new Consumers();
$common = new Common();
$api_url = $this->getServiceLocator()->get('config')['api_url']['value'];
$data['name'] = $request->getPost('name_on_card');
$data['email'] = $request->getPost('emailid');
$card_type = $request->getPost('card_type');
$data['card_no'] = $request->getPost('card_no');
$data['month'] = $request->getPost('month');
$data['year'] = $request->getPost('year');
$data['cvv_no'] = $request->getPost('cvv_no');
$data['amount'] = $bookingsession->price;
$data['currency'] = $bookingsession->currency;
$result = $trans->processPayment($this->getServiceLocator()->get('Config'), $data);
if ($result['status'] == 1) {
//if (1 == 1) {
$bookingData = array();
$bookingData['transaction_id'] = $result['transaction_id'];
$bookingData['service_provider_id'] = $bookingsession->sp_id;
$bookingData['user_id'] = $session->userid;
$bookingData['service_provider_service_id'] = $bookingsession->durationid;
//$bookingData['booked_date'] = $bookingsession->servicedate;
$bookingData['booked_date'] = date('Y-m-d H:i:s', strtotime(str_replace('/', '-', $bookingsession->servicedate)));
$bookingData['booking_status'] = 5;
$bookingData['payment_status'] = 7;
$bookingData['status_id'] = 1;
$bookingData['sale_type'] = 3;
$bookingData['currency'] = $bookingsession->currency;
$bookingData['amount'] = str_replace(array('USD$', 'CAD$', 'USD ', 'CAD ', 'USD', 'CAD', '$'), array('', '', '', '', '', '', ''), $bookingsession->serviceprice);
// as suggested by kanhaiya sir on 1-8-2014
$bookingData['site_commision'] = $data['amount'];
$bookingData['invoice_total'] = str_replace(array('USD$', 'CAD$', 'USD ', 'CAD ', 'USD', 'CAD', '$'), array('', '', '', '', '', '', ''), $bookingsession->serviceprice);
// as suggested by kanhaiya sir on 1-8-2014
$bookingData['invoice_status'] = 1;
$bookingData['payment_status_id'] = 7;
$bookingData['amount_paid'] = $data['amount'];
$bookingData['payment_date'] = date('Y-m-d H:i:s');
$bookingData['payment_instrument_no'] = substr($data['card_no'], strlen($data['card_no']) - 4, 4);
$bookingData['payment_method_id'] = $card_type;
$bookingData['created_by'] = $session->userid;
$bookingData['service_address_id'] = $bookingsession->locationid;
//print_r($bookingData); exit;
$response = $bookingModel->addBooking($api_url, $bookingData);
if ($response['status'] == 1 && isset($response['id'])) {
//if (1==1) {
/* Generate attachment code starts here*/
$sp_details = $model->getSPDetails($api_url, $bookingsession->sp_id);
$sp_details['contact'] = json_decode($sp_details['contact'][0], true);
$user_details = $consumer->getConsumerdetails($api_url, $session->userid);
$user_details['address'] = json_decode($user_details['address'][0], true);
$user_details['contact'] = json_decode($user_details['contact'][0], true);
$data = $bookingModel->getBookings($api_url, '', $session->userid, '', '', '', '', $response['id']);
$service_rendering_address = $data['results'][0]['service_address_id'] != '' && $data['results'][0]['service_address_id'] != 'None' ? $common->address($api_url, $data['results'][0]['service_address_id']) : 'Not Available';
$view = new viewModel(array('booking_details' => $data['results'], 'user_details' => $user_details, 'service_rendering_address' => $service_rendering_address, 'service_rendering_details' => $sp_details));
$view->setTemplate('application/booking/printinvoice.phtml');
$printData = $this->getServiceLocator()->get('viewrenderer')->render($view);
// Store in PDF format
$dompdf = new \DOMPDF();
$dompdf->load_html($printData);
$dompdf->render();
$output = $dompdf->output();
$attachment = new MimePart($output);
$attachment->type = 'application/pdf';
$attachment->filename = 'invoice.pdf';
$attachment->encoding = \Zend\Mime\Mime::ENCODING_BASE64;
$attachment->disposition = \Zend\Mime\Mime::DISPOSITION_ATTACHMENT;
/* Generate attachment code ends here*/
/* Send email code starts here */
$common = $this->getServiceLocator()->get('Application\\Model\\Common');
$pattern = array('/{{user_name}}/i');
$userreplace = array('<strong>' . $user_details['first_name'] . ' ' . $user_details['last_name'] . '</strong>');
$spreplace = array('<strong>' . $sp_details['first_name'] . ' ' . $sp_details['last_name'] . '</strong>');
$common->sendMail($api_url, $user_details['email'], '', 9, '', $pattern, $userreplace, $attachment);
$subscriptionDetails = $common->getSubscriptiondetails($api_url, $bookingData['service_provider_id'], true);
// getting service provider subscription details
$userFeatures = $common->getFeatures($api_url, $bookingData['service_provider_id']);
if (isset($subscriptionDetails['features']) && is_array($subscriptionDetails['features']) && in_array(11, $subscriptionDetails['features']) && $userFeatures['email'] == 1) {
$common->sendMail($api_url, $sp_details['email'], '', 10, '', $pattern, $spreplace);
}
if (isset($subscriptionDetails['features']) && is_array($subscriptionDetails['features']) && in_array(12, $subscriptionDetails['features']) && $userFeatures['sms'] == 1) {
$common->sendMsg($sp_details['contact']['phone_number'], 1, '', $pattern, array($sp_details['first_name'] . ' ' . $sp_details['last_name']));
}
/* Send email code ends here */
// unset all sessions
$bookingsession->offsetUnset('sp_id');
$bookingsession->offsetUnset('user_id');
$bookingsession->offsetUnset('price');
$bookingsession->offsetUnset('locationid');
$bookingsession->offsetUnset('serviceid');
$bookingsession->offsetUnset('durationid');
$bookingsession->offsetUnset('servicedate');
$bookingsession->offsetUnset('serviceprice');
//.........这里部分代码省略.........
示例13: clearCart
/**
* @return bool
*/
public function clearCart()
{
$this->container->offsetUnset('cart');
return true;
}
示例14: vimeologinAction
public function vimeologinAction()
{
$session = new Container('vimeo');
// Getting session values
if ($_REQUEST['clear'] == 'all') {
$session->offsetUnset('file');
$session->offsetUnset('mode');
$session->offsetUnset('media_id');
$session->offsetUnset('returnUrl');
$session->offsetUnset('old_video');
$session->offsetUnset('vimeo_state');
$session->offsetUnset('oauth_access_token');
$session->offsetUnset('oauth_access_token_secret');
echo 'cleared';
exit;
}
if (isset($session->returnUrl) && $session->returnUrl != "") {
$config = $this->getServiceLocator()->get('Config');
$vimeo = new \phpVimeo($config['Vimeo']['clientId'], $config['Vimeo']['clientSecrate']);
//$vimeo->enableCache(\phpVimeo::CACHE_FILE, 'cache', 300);
if (!isset($session->oauth_access_token) || !isset($session->oauth_access_token_secret)) {
if (isset($session->vimeo_state) && $session->vimeo_state == 'start') {
$session->vimeo_state = 'returned';
} else {
$session->vimeo_state = 'start';
}
if ($session->vimeo_state == 'start') {
// Get a new request token
$token = $vimeo->getRequestToken();
// Store it in the session
$session->oauth_request_token = $token['oauth_token'];
$session->oauth_request_token_secret = $token['oauth_token_secret'];
$session->vimeo_state = 'start';
$mode = isset($session->old_video) && $session->old_video != "" ? 'delete' : $session->mode;
// setting request mode
header('Location: ' . $vimeo->getAuthorizeUrl($token['oauth_token'], $mode));
exit;
} else {
if ($session->vimeo_state == 'returned') {
$vimeo->setToken($session->oauth_request_token, $session->oauth_request_token_secret);
$token = $vimeo->getAccessToken($_REQUEST['oauth_verifier']);
// storing oath tokens
$session->oauth_access_token = $token['oauth_token'];
$session->oauth_access_token_secret = $token['oauth_token_secret'];
$vimeo->setToken($session->oauth_access_token, $session->oauth_access_token_secret);
}
}
}
if (isset($session->mode) && $session->mode == 'write') {
$vimeo = new \phpVimeo($config['Vimeo']['clientId'], $config['Vimeo']['clientSecrate'], $session->oauth_access_token, $session->oauth_access_token_secret);
if (isset($session->file) && file_exists($session->file)) {
$video_id = $vimeo->upload($session->file);
// uploading file on vimeo
if ($video_id != false) {
@unlink($session->file);
// Deleting file from our server
if (isset($session->old_video) && $session->old_video != '' && ($info = $vimeo->call('vimeo.videos.getInfo', array('video_id' => $session->old_video)))) {
$vimeo->call('vimeo.videos.delete', array('video_id' => $session->old_video));
// deleting previous video
}
/* Updating database records */
$this->getMediaTable()->updateMedia('media_url', $video_id, $session->media_id);
isset($session->old_video) && $session->old_video != "" ? $this->flashMessenger()->addSuccessMessage('Media updated successfully..!!') : $this->flashMessenger()->addSuccessMessage('Media added successfully..!!');
/* Clearing session variables */
$session->offsetUnset('msg');
$session->offsetUnset('mode');
$session->offsetUnset('file');
$session->offsetUnset('old_video');
$session->offsetUnset('oauth_access_token');
$session->offsetUnset('oauth_access_token_secret');
} else {
isset($session->msg) && $session->msg != "" ? $this->flashMessenger()->addErrorMessage($session->msg) : $this->flashMessenger()->addErrorMessage('Video not uploaded..!!');
}
} else {
if (isset($session->files) && count($session->files) > 0) {
foreach ($session->files as $media_id => $file) {
if (file_exists($file)) {
$video_id = $vimeo->upload($file);
// uploading file on vimeo
if ($video_id != false) {
@unlink($file);
// Deleting file from our server
/* Updating database records */
$this->getMediaTable()->updateMedia('media_url', $video_id, $media_id);
$this->getMediaTable()->changeStatus($media_id, '9');
$this->flashMessenger()->addSuccessMessage('Status changed successfully..!!');
} else {
isset($session->msg) && $session->msg != "" ? $this->flashMessenger()->addErrorMessage($session->msg) : $this->flashMessenger()->addErrorMessage('Video not uploaded..!!');
}
} else {
$this->flashMessenger()->addErrorMessage('File not found to upload..!!');
}
}
} else {
$this->flashMessenger()->addErrorMessage('File not found to upload..!!');
}
}
/* Clearing session variables */
$session->offsetUnset('msg');
$session->offsetUnset('mode');
//.........这里部分代码省略.........
示例15: logoutAction
public function logoutAction()
{
$session_user = new Container('userlogin');
$session_user->offsetUnset('username');
$session_user->offsetUnset('idus');
$this->redirect()->toUrl(WEBPATH . '/apotraviny/index');
}