• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / EDD_Session::__construct() – Get things started

You appear to be a bot. Output may be restricted

Description

Get things started

Defines our WP_Session constants, includes the necessary libraries and retrieves the WP Session instance

Usage

EDD_Session::__construct();

Parameters

Returns

void

Source

File name: easy-digital-downloads/includes/class-edd-session.php
Lines:

1 to 48 of 48
  public function __construct() {

    $this->use_php_sessions = $this->use_php_sessions();

    if( $this->use_php_sessions ) {

      if( is_multisite() ) {

        $this->prefix = '_' . get_current_blog_id();

      }

      // Use PHP SESSION (must be enabled via the EDD_USE_PHP_SESSIONS constant)
      add_action( 'init', array( $this, 'maybe_start_session' ), -2 );

    } else {

      if( ! $this->should_start_session() ) {
        return;
      }

      // Use WP_Session (default)

      if ( ! defined( 'WP_SESSION_COOKIE' ) ) {
        define( 'WP_SESSION_COOKIE', 'edd_wp_session' );
      }

      if ( ! class_exists( 'Recursive_ArrayAccess' ) ) {
        require_once EDD_PLUGIN_DIR . 'includes/libraries/class-recursive-arrayaccess.php';
      }

      if ( ! class_exists( 'WP_Session' ) ) {
        require_once EDD_PLUGIN_DIR . 'includes/libraries/class-wp-session.php';
        require_once EDD_PLUGIN_DIR . 'includes/libraries/wp-session.php';
      }

      add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
      add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );

    }

    if ( empty( $this->session ) && ! $this->use_php_sessions ) {
      add_action( 'plugins_loaded', array( $this, 'init' ), -1 );
    } else {
      add_action( 'init', array( $this, 'init' ), -1 );
    }

  }
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 12th September 2021

Primary Sidebar

Information

Function name: EDD_Session::__construct
Class ref: EDD_Session
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/class-edd-session.php
File ref: includes/class-edd-session.php
Deprecated?: No
API Letters: C,E,S

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.9.3
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites