Retrieve the current session instance.
public static get_instance ( ) : boolean | WP_Session | ||
리턴 | boolean | WP_Session |
/** * Setup the WP_Session instance * * @access public * @since 1.5 * @return void */ public function init() { if ($this->use_php_sessions) { $this->session = isset($_SESSION['clef']) && is_array($_SESSION['clef']) ? $_SESSION['clef'] : array(); } else { $this->session = WP_Session::get_instance(); } return $this->session; }
/** * Setup the WP_Session instance */ public function init() { $this->session = WP_Session::get_instance(); $cart = $this->get('ubc-cart'); if (!empty($cart)) { $this->set_cart_cookie(); } else { $this->set_cart_cookie(false); } return $this->session; }
public static function setupCart() { $ufstore = UFStore::instance(); parent::$wp_session = WP_Session::get_instance(); if (!isset(parent::$wp_session['cart'])) { parent::$wp_session['cart'] = array(); } parent::$shoppingCart = parent::$wp_session['cart']->toArray(); }
/** * Setup the WP_Session instance * * @access public * @return void */ public function init() { if ($this->PHP_sessions) { $this->session = isset($_SESSION['screets_cx']) && is_array($_SESSION['screets_cx']) ? $_SESSION['screets_cx'] : array(); } else { $this->session = WP_Session::get_instance(); } return $this->session; }
/** * Instantiate the session * * @since 3.2 * @return void */ public function init() { if ($this->can_php_session()) { $key = 'wpas' . $this->prefix; // Set the session if necessary if (!array_key_exists($key, $_SESSION)) { $_SESSION[$key] = array(); } $this->session = $_SESSION[$key]; } else { $this->session = WP_Session::get_instance(); } }
function getSessionLang($par_lang = 'na') { global $wp_session; $wp_session = WP_Session::get_instance(); if (isset($wp_session['lang'])) { $lang = $wp_session['lang']; } else { if ($par_lang == "na") { $lang = 'en'; } else { $lang = $par_lang; } } return $lang; }
function new_products_lightspeed($atts) { /** * Featured Products shortcode * * @param array $atts * @return string */ global $woocommerce_loop, $products, $product; // include our handy API wrapper that makes it easy to call the API, it also depends on MOScURL to make the cURL call require_once "MOSAPICall.class.php"; extract(shortcode_atts(array('per_page' => '12', 'columns' => '4', 'orderby' => 'date', 'order' => 'desc'), $atts)); $woocommerce_loop['columns'] = $columns; ob_start(); $mosapi = new MOSAPICall("992e498dfa5ab5245f5bd5afee4ee1ce6ac6e0a1ee7d11e36480694a9b5282e7", "83442"); $emitter = 'https://api.merchantos.com/API/Account/83442/ItemMatrix'; $xml_query_string = 'limit=100&orderby=timeStamp&orderby_desc=1&load_relations=["ItemECommerce","Tags","Images"]'; $products = $mosapi->makeAPICall("Account.ItemMatrix", "Read", null, null, $emitter, $xml_query_string); $wp_session = WP_Session::get_instance(); $products = xml2array($products); $wp_session['products'] = $products; //var_dump($wp_session['products']); $i = 0; //if ( $products->children() ) : ?> <?php woocommerce_product_loop_start(); ?> <?php foreach ($products as $prod) { foreach ($prod as $product) { wc_get_template_part('content', 'lightspeedproduct'); } } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php //endif; return '<div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>'; }
function wpum_redirect_after_login($user_id, $values) { $wp_session = WP_Session::get_instance(); if ($wp_session['history']) { $history = $wp_session['history']->toArray(); $history_size = count($history); $referer = ''; if ($history_size > 0) { $referer = $history[$history_size - 1]; wp_redirect($referer); } else { wp_redirect(home_url()); } $wp_session['history'] = []; exit; } }
/** * Instantiate session object. Private constructor. * * @access private * @since 1.0.0 */ private function __construct() { if (!defined('WP_SESSION_COOKIE')) { define('WP_SESSION_COOKIE', 'charitable_session'); } if (!class_exists('Recursive_ArrayAccess')) { require_once charitable()->get_path('includes') . 'libraries/wp-session/class-recursive-arrayaccess.php'; } if (!class_exists('WP_Session')) { require_once charitable()->get_path('includes') . 'libraries/wp-session/class-wp-session.php'; require_once charitable()->get_path('includes') . 'libraries/wp-session/wp-session.php'; } /* Set the expiration length & variant of the session */ add_filter('wp_session_expiration', array($this, 'set_session_length'), 99999); add_filter('wp_session_expiration_variant', array($this, 'set_session_expiration_variant_length'), 99999); $this->session = WP_Session::get_instance(); }
public function init() { // Set our session preferences if ($this->use_php_sessions) { // Check if the session is already initialised $has_session = session_status() == PHP_SESSION_ACTIVE; if (!$has_session) { session_start(); } // The session is now active $this->session =& $_SESSION; } else { $this->session = WP_Session::get_instance(); } // Hook onto the gateway booking to set the session add_action('eventorganiser_pre_gateway_booking', array($this, 'set_booking_id')); return $this->session; }
<?php /* * Template Name: Freemium Result Template * Description: To display the result of freemium calculations. */ require ABSPATH . 'CI_config.php'; require ABSPATH . 'pp_config.php'; require ABSPATH . '/wp-content/themes/twentyeleven/freemium_calculations.php'; get_header(); $wf_session = WP_Session::get_instance(); //Extracting session values into array $freemium $freemium = array('state_id' => $wf_session['state_id'], 'system_size' => $wf_session['system_size'], 'installation_year' => $wf_session['installation_year'], 'financing_id' => $wf_session['financing_id'], 'system_prodn' => $wf_session['system_prodn']); $conservativeProfit = base64_decode($_GET['conservative']); $aggressiveProfit = base64_decode($_GET['aggressive']); //Rounding the profit to nearest thousand $conservativeNetprofit = number_format(round($conservativeProfit, -2)); $aggressiveNetProfit = number_format(round($aggressiveProfit, -2)); ?> <div class="banner-wrap set-banner-wrap" style="border: none;border-bottom: 5px solid #ddd !important"> <div class="frame"> <h3 class="inner-heading"style="padding:0"></h3> </div> </div> <div class="frame"> <div id="primary"> <div id="content" role="main"> <div class="entry-content"> <div class="frame-wrap water-mark"> <div class="unverified">Unverified</div> </div>
public static function lightspeed_product_brands($atts = array()) { extract(shortcode_atts(array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false), $atts)); ob_start(); $limit = 100; $output = 25; $tags = array(); $wp_session = WP_Session::get_instance(); //LI()->LI_cache->set("lightspeed_product_tags",null); $brands = LI()->LI_cache->get("lightspeed_product_tags"); $t = $wp_session['total_tags']; if ($tags == null) { $emitter = 'https://api.merchantos.com/API/Account/' . LI()->API_account . '/Tag'; $xml_query_string = 'limit=' . $limit; $terms = LI()->api->makeAPICall("Account.Tag", "Read", null, null, $emitter, $xml_query_string); $totalrecords = $terms->attributes()->count; $loop_size = $totalrecords / $limit; $feeds = array(); for ($i = 0; $i <= $loop_size; $i++) { $offset = $limit * $i; $feeds[] = $i === 0 ? $terms : LI()->api->makeAPICall("Account.Tag", "Read", null, null, $emitter, $xml_query_string . "&offset={$offset}"); } // For each feed, store the results as an array $grouped_results = array(); foreach ($feeds as $feed) { $xml = $feed; if (!$xml) { return false; } $json = json_encode($xml); $grouped_results[] = json_decode($json, TRUE); } foreach ($grouped_results as $v) { $tags = array_merge((array) $tags, (array) $v['Tag']); } LI()->LI_cache->set("lightspeed_product_tags", $tags); $wp_session['total_tags'] = (int) $totalrecords; } //get a random number out of total records $r = rand(0, $t); //slice 25 out of the array $tags = array_slice($tags, $r, 25); echo '<div class="tagcloud">'; foreach ($tags as $tag) { $slug = sanitize_title($tag['name']); $t = $tag['name']; echo '<a href="http://borealpaddle.lightspeedwebstore.com/' . $slug . '" target="_black">' . $t . '</a>'; } echo '</div>'; ob_end_flush(); }
/** * Destroy Session * * @return void */ function cx_destroy_session() { global $CX; if (CX_PHP_SESSIONS) { $CX->session->set('user_data', NULL); session_destroy(); } else { // Destroy session wp_session_unset(); // Clean expired sessions from DB wp_session_cleanup(); // Reassign WP Session $CX->session = WP_Session::get_instance(); } }
/** * Setup the WP_Session instance * * @access public * @since 2.9.18 * @return void */ public function init() { $this->session = WP_Session::get_instance(); return $this->session; }
/** * Initialize the plugin by setting localization and loading public scripts * and styles. * * @since 1.0.0 */ private function __construct() { // Dependencies erpPROPaths::requireOnce(erpPROPaths::$erpPRODBActions); erpPROPaths::requireOnce(erpPROPaths::$erpPROMainOpts); erpPROPaths::requireOnce(erpPROPaths::$erpPROWidOpts); erpPROPaths::requireOnce(erpPROPaths::$erpPROTracker); $this->wpSession = WP_Session::get_instance(); $this->DB = erpPRODBActions::getInstance(); $this->mainOpts = new erpPROMainOpts(); $this->widOpts = new erpPROWidOpts(); /** * Check if rating system is on in order to call tracker */ $tracker = new erpPROTracker($this->DB, $this->wpSession, $this->mainOpts->getDisableTrackingSystem()); add_action('init', array($tracker, 'tracker')); /** * Call content modifier */ add_filter('the_content', array($this, 'contentFilter'), 1000); // Load plugin text domain add_action('init', array($this, 'load_plugin_textdomain')); // Activate plugin when new blog is added add_action('wpmu_new_blog', array($this, 'activate_new_site')); // Load public-facing style sheet and JavaScript. add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); }
function get_product_catalog_session() { $wp_session = WP_Session::get_instance(); return $wp_session; }
/** * Setup the WP_Session instance * * @access public * @since 2.4.3 * @return void */ public function init() { if ($this->use_php_sessions) { $this->session = isset($_SESSION['vfb']) && is_array($_SESSION['vfb']) ? $_SESSION['vfb'] : array(); } else { $this->session = WP_Session::get_instance(); } $token = $this->get('vfb-token'); //$purchase = $this->get( 'edd_purchase' ); if (!empty($token)) { $this->set_cookie(); } else { $this->set_cookie(false); } return $this->session; }
/** * Handle emailing the content * * @since 1.0 * @uses wp_mail() E-mails a message */ public function email() { global $wp_session, $mail_lang; $wp_session = WP_Session::get_instance(); if (isset($wp_session['lang'])) { $mail_lang = $wp_session['lang']; } else { $mail_lang = "sk"; } require trailingslashit(plugin_dir_path(__FILE__)) . 'includes/email.php'; }
/** * Tracking logic * * @since 0.9 * @author Vagenas Panagiotis <*****@*****.**> */ function tracker() { if (is_admin()) { return; } $db = new dbActionsC(); $wp_session = WP_Session::get_instance(); // set session referer if (!isset($wp_session['referer']) && isset($_SERVER['HTTP_REFERER'])) { $wp_session['referer'] = $_SERVER['HTTP_REFERER']; } else { if (!isset($wp_session['referer'])) { $wp_session['referer'] = ''; } } if (!isset($wp_session['referer_name'])) { $wp_session['referer_name'] = $this->getRefererName(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''); } $refererName = $this->getRefererName(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''); $request = $this->getRequestString(); // Add request to request array if (isset($wp_session['request'])) { $push = unserialize($wp_session['request']); $cut = strpos($request, '?') ? strpos($request, '?') : strlen($request); array_push($push, substr($request, 0, $cut)); $wp_session['request'] = serialize($push); } else { $cut = strpos($request, '?') ? strpos($request, '?') : strlen($request); $wp_session['request'] = $request ? serialize(array(substr($request, 0, $cut))) : array(); } if ($refererName && $refererName !== 'local' && $refererName !== 'unknown') { // We have a referer and it is not local // Check to see if we have a valid keyword $parsedReq = $this->parseSearchQuery($request); $ckdKw = $this->checkForKeyword($parsedReq); if ($ckdKw) { // We have a valid keyword so it must be a paid request $wp_session['paid'] = TRUE; $wp_session['real_keyword'] = implode(', ', $ckdKw); $wp_session['query'] = $ckdKw; // Check content to define if it includes shortlinks // Change shortlinks to include keyword in get param $this->kw = $this->getArgsString($ckdKw); add_filter('the_content', array($this, 'modConShortLinks')); } } // check to see if it is a shortlink $shortLink = $this->isShortlink(); if ($shortLink) { if ($this->is_bot()) { wp_redirect(home_url()); exit; } $this->trackingVars = get_option('WPATOptTrackVars'); // we have a shortlink if (isset($wp_session['paid']) && $wp_session['paid']) { // We have a click $query = $wp_session['query']->toArray(); $ppc = array(); $ppc['ppc'] = $db->addPPC(array('short_link' => $shortLink['short_link'], 'referer' => $wp_session['referer_name'], 'real_keyword' => $query, 'via' => $wp_session['request'])); $ppc['keywords'] = $query; // add click $db->addClick($shortLink['id']); // set redirect url $redir = $this->getAffiRedirUrl($shortLink['affi_url'], $ppc); //TODO $shortLink['affi_url'] . $ppc; } else { // We have a click $keyWord = $this->getKeywords($wp_session['referer']); $seo['ppc'] = $db->addSEO(array('short_link' => $shortLink['short_link'], 'referer' => $wp_session['referer_name'], 'real_keyword' => empty($keyWord) || !$keyWord ? 'not provided' : $keyWord, 'via' => $wp_session['request'])); $seo['keywords'] = $keyWord; // add click $db->addClick($shortLink['id']); // set redirect url $redir = $this->getAffiRedirUrl($shortLink['affi_url'], $seo); } // clear session $wp_session->reset(); // redirect wp_redirect($redir); exit; } }
/** * * @param array $options * @author Panagiotis Vagenas <*****@*****.**> * @since 1.0.0 */ protected function __construct($options) { if (!class_exists('erpPROQueryFormater')) { erpPROPaths::requireOnce(erpPROPaths::$erpPROQueryFormater); } if (!class_exists('erpPRODBActions')) { erpPROPaths::requireOnce(erpPROPaths::$erpPRODBActions); } if (!class_exists('erpPRORatingSystem')) { erpPROPaths::requireOnce(erpPROPaths::$erpPRORatingSystem); } if (!class_exists('erpPRORelData')) { erpPROPaths::requireOnce(erpPROPaths::$erpPRORelData); } $this->options = $options; $this->dbActions = erpPRODBActions::getInstance(); $this->wpSession = WP_Session::get_instance(); }
/** * Write session data and end session */ function wp_session_write_close() { $wp_session = WP_Session::get_instance(); $wp_session->write_data(); do_action('wp_session_commit'); }
/** * Setup the WP_Session instance * * @access public * @since 1.5 * @return void */ public function init() { if ($this->use_php_sessions) { $this->session = isset($_SESSION['edd' . $this->prefix]) && is_array($_SESSION['edd' . $this->prefix]) ? $_SESSION['edd' . $this->prefix] : array(); } else { $this->session = WP_Session::get_instance(); } $use_cookie = $this->use_cart_cookie(); $cart = $this->get('edd_cart'); $purchase = $this->get('edd_purchase'); if ($use_cookie) { if (!empty($cart) || !empty($purchase)) { $this->set_cart_cookie(); } else { $this->set_cart_cookie(false); } } return $this->session; }