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; } }