• 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_License::__construct() – Class constructor

You appear to be a bot. Output may be restricted

Description

Class constructor

Usage

EDD_License::__construct( $_file, $_item_name, $_version, $_author, $_optname, $_api_url, $_item_id );

Parameters

$_file
( string ) required –
$_item_name
( string ) required –
$_version
( string ) required –
$_author
( string ) required –
$_optname
( string ) optional –
$_api_url
( string ) optional –
$_item_id
( int ) optional –

Returns

void

Source

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

1 to 50 of 50
  function __construct( $_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_item_id = null ) {
    $this->file = $_file;
    $this->item_name = $_item_name;

    if ( is_numeric( $_item_id ) ) {
      $this->item_id = absint( $_item_id );
    }

    $this->item_shortname = 'edd_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) );
    $this->version        = $_version;
    $this->license        = trim( edd_get_option( $this->item_shortname . '_license_key', '' ) );
    $this->author         = $_author;
    $this->api_url        = is_null( $_api_url ) ? $this->api_url : $_api_url;

    
/**
 * Allows for backwards compatibility with old license options,
 * i.e. if the plugins had license key fields previously, the license
 * handler will automatically pick these up and use those in lieu of the
 * user having to reactive their license.
 */
    if ( ! empty( $_optname ) ) {
      $opt = edd_get_option( $_optname, false );

      if( isset( $opt ) && empty( $this->license ) ) {
        $this->license = trim( $opt );
      }
    }

    // Setup hooks
    $this->includes();
    $this->hooks();

    
/**
 * Maintain an array of active, licensed plugins that have a license key entered.
 * This is to help us more easily determine if the site has a license key entered
 * at all. Initializing it this way helps us limit the data to activated plugins only.
 * If we relied on the options table (`edd_%_license_active`) then we could accidentally
 * be picking up plugins that have since been deactivated.
 *
 * @see \EDD\Admin\Promos\Notices\License_Upgrade_Notice::__construct()
 */
    if ( ! empty( $this->license ) ) {
      global $edd_licensed_products;
      if ( ! is_array( $edd_licensed_products ) ) {
        $edd_licensed_products = array();
      }
      $edd_licensed_products[] = $this->item_shortname;
    }

  }
 

 View on GitHub View on Trac

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

Primary Sidebar

Information

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

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 6.0
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