Welcome to GPLDL - we are still beta - please report any bugs via the contact form.

GPLDLGPLDL
GPLDL
Download the most popular GPL licensed Premium WordPress Themes & Plugins and WooCommerce Extensions for FREE!
  • Blog
    • Blog Articles
    • Latest Updates & Additions
  • Repository
    • Full Repository
    • Premium WordPress Themes
    • Premium WordPress Plugins
    • Premium WooCommerce Extensions
    • Special Gifts for Premium Members
    • Tutorials
  • Forum
  • Free Membership
  • Donations
  • My GPLDL Account
  • Sign In
Menu back  

Reply To: YITH premium plugin activation

March 7, 2019 at 9:25 am #21166
Ruffo Valiente
Participant

Hey there!

please only copy all code to your file: please note the path:

/wp-content/plugins/yith-woocommerce-stripe-premium/plugin-fw/licence/lib

<?php
/**
* This file belongs to the YIT Plugin Framework.
*
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.gnu.org/licenses/gpl-3.0.txt
*/

if ( !defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly

if ( !class_exists( 'YIT_Plugin_Licence' ) ) {
/**
* YIT Plugin Licence Panel
*
* Setting Page to Manage Plugins
*
* @class YIT_Plugin_Licence
* @package YITH
* @since 1.0
* @author Andrea Grillo <[email protected]>
*/
class YIT_Plugin_Licence extends YIT_Licence {

/**
* @var array The settings require to add the submenu page "Activation"
* @since 1.0
*/
protected $_settings = array();

/**
* @var object The single instance of the class
* @since 1.0
*/
protected static $_instance = null;

/**
* @var string Option name
* @since 1.0
*/
protected $_licence_option = 'yit_plugin_licence_activation';

/**
* @var string product type
* @since 1.0
*/
protected $_product_type = 'plugin';

/**
* Constructor
*
* @since 1.0
* @author Andrea Grillo <[email protected]>
*/
public function __construct() {
parent::__construct();

if ( !is_admin() ) {
return;
}

$this->_settings = array(
'parent_page' => 'yith_plugin_panel',
'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
'capability' => 'manage_options',
'page' => 'yith_plugins_activation',
);

add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
add_action( "wp_ajax_yith_activate-{$this->_product_type}", array( $this, 'activate' ) );
add_action( "wp_ajax_yith_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
add_action( "wp_ajax_yith_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
add_action( 'yit_licence_after_check', 'yith_plugin_fw_force_regenerate_plugin_update_transient' );

/** @since 3.0.0 */
if( version_compare( PHP_VERSION, '7.0', '>=' ) ) {
add_action( 'admin_notices', function () {
$this->activate_license_notice();
}, 15 );
}

else {
add_action( 'admin_notices', array( $this, 'activate_license_notice' ), 15 );
}
}

private function _show_activate_license_notice() {
$current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : true;
$show_license_notice = current_user_can( 'update_plugins' ) &&
( !isset( $_GET[ 'page' ] ) || 'yith_plugins_activation' !== $_GET[ 'page' ] ) &&
!( $current_screen && method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() );
global $wp_filter;

if ( isset( $wp_filter[ 'yith_plugin_fw_show_activate_license_notice' ] ) ) {
$filter = $wp_filter[ 'yith_plugin_fw_show_activate_license_notice' ];
$v = yith_plugin_fw_get_version();
$a = explode( '.', $v );
$l = end( $a );
$p = absint( $l );
$allowed_hook = isset( $filter[ $p ] ) ? $filter[ $p ] : false;
remove_all_filters( 'yith_plugin_fw_show_activate_license_notice' );

if ( $allowed_hook && is_array( $allowed_hook ) ) {
$cb = current( $allowed_hook );
if ( isset( $cb[ 'function' ] ) && isset( $cb[ 'accepted_args' ] ) ) {
add_filter( 'yith_plugin_fw_show_activate_license_notice', $cb[ 'function' ], 10, $cb[ 'accepted_args' ] );
}
}

}

return apply_filters( 'yith_plugin_fw_show_activate_license_notice', $show_license_notice );
}

/**
* print notice with products to activate
*
* @since 3.0.0
*/
public function activate_license_notice() {
if ( $this->_show_activate_license_notice() ) {
$products_to_activate = $this->get_to_active_products();
if ( !!$products_to_activate ) {
$product_names = array();
foreach ( $products_to_activate as $init => $product ) {
if ( !empty( $product[ 'Name' ] ) )
$product_names[] = $product[ 'Name' ];

}
}
}
}

/**
* Main plugin Instance
*
* @static
* @return object Main instance
*
* @since 1.0
* @author Andrea Grillo <[email protected]>
*/
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}

return self::$_instance;
}

/**
* Add "Activation" submenu page under YITH Plugins
*
* @return void
* @since 1.0
* @author Andrea Grillo <[email protected]>
*/
public function add_submenu_page() {
add_submenu_page(
$this->_settings[ 'parent_page' ],
$this->_settings[ 'page_title' ],
$this->_settings[ 'menu_title' ],
$this->_settings[ 'capability' ],
$this->_settings[ 'page' ],
array( $this, 'show_activation_panel' )
);
}

/**
* Premium plugin registration
*
* @param $plugin_init | string | The plugin init file
* @param $secret_key | string | The product secret key
* @param $product_id | string | The plugin slug (product_id)
*
* @return void
*
* @since 1.0
* @author Andrea Grillo <[email protected]>
*/
public function register( $plugin_init, $secret_key, $product_id ) {
if ( !function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}

$plugins = get_plugins();
$plugins[ $plugin_init ][ 'secret_key' ] = $secret_key;
$plugins[ $plugin_init ][ 'product_id' ] = $product_id;
$this->_products[ $plugin_init ] = $plugins[ $plugin_init ];
}

public function get_product_type() {
return $this->_product_type;
}

/**
* Get license activation URL
*
* @author Andrea Grillo <[email protected]>
* @since 3.0.17
*/
public static function get_license_activation_url(){
return add_query_arg( array( 'page' => 'yith_plugins_activation' ), admin_url( 'admin.php' ) );
}
}
}

/**
* Main instance of plugin
*
* @return YIT_Plugin_Licence object of license class
* @since 1.0
* @author Andrea Grillo <[email protected]>
*/
if ( !function_exists( 'YIT_Plugin_Licence' ) ) {
function YIT_Plugin_Licence() {
return YIT_Plugin_Licence::instance();
}
}

Search the Repository
We reward your Donations!
We need your Donation to maintain and grow the GPLDL WordPress Repository - and we reward your generosity with Premium Memberships allowing you to download even more files.

Learn more about donations & rewards...
News from our blog
  • What is the Battle Between WordPress’s Matt Mullenweg and WP Engine about?
    October 31, 2024
  • Why GPLDL Cannot Accept Your WordPress Plugin or Theme Submission
    February 20, 2024
  • How to Ensure Your WordPress Plugin or Theme is Authentic and Secure
    January 25, 2024
Latest Updates & Additions
  • GPLDL News: 154 Updates & Additions today – Download 2844 Premium WordPress items!
    May 11, 2025
  • GPLDL News: 108 Updates & Additions today – Download 2842 Premium WordPress items!
    May 2, 2025
  • GPLDL News: 176 Updates & Additions today – Download 2840 Premium WordPress items!
    April 27, 2025
Free Downloads?

Most of the WordPress Plugins & Themes in the GPLDL repository are available for free download - yes, free! - that is even better than buying at a discount, rebate, promotion or with a coupon code.

After signing up for a free membership, you will instantly get a download link to GPLDL's WordPress plugins and themes including future updates.

Where is the catch? There is none. We re-distribute 100% exact copies of GPL-licensedWordPress items, completely unmodified - that means *not* nulled, cracked or otherwise modified code without any serial numbers, API keys or support.

How can you help? If you like our service, please spread the word. If you can afford to financially support us, please make a donation. All donations will be used for (recurring) subscriptions of WordPress plugins & themes and to grow the catalog!

Tags
authenticity check code collaboration commercial copyleft Copyright developers distribution Download Extensions fork Free fsf functions.php GNU Public License GPL Guide HowTo Instructions Legal license malware Modify nulled open source Plugin Plugins Premium redistribution remove Rights secure Security serial Software software development Themes tutorial Update Website WooCommerce wordpress WordPress Plugins WordPress Themes
Welcome to GPLDL!
scr02We love innovation and we believe in free software!

That's why we strive to make the world's best Premium WordPress Themes & Plugins and WooCommerce Extensions & Themes available for everyone!

Find us on:

FacebookTwitterRssPinterestWebsite
Latest Blog Posts
  • What is the Battle Between WordPress’s Matt Mullenweg and WP Engine about?
    October 31, 2024
  • Why GPLDL Cannot Accept Your WordPress Plugin or Theme Submission
    February 20, 2024
  • How to Ensure Your WordPress Plugin or Theme is Authentic and Secure
    January 25, 2024
Latest Updates & Additions
  • GPLDL News: 154 Updates & Additions today – Download 2844 Premium WordPress items!
    May 11, 2025
  • GPLDL News: 108 Updates & Additions today – Download 2842 Premium WordPress items!
    May 2, 2025
  • GPLDL News: 176 Updates & Additions today – Download 2840 Premium WordPress items!
    April 27, 2025
About GPLDL
  • About GPLDL
  • Need Help?
  • F.A.Q.
  • Terms of Service
  • Privacy Policy
  • Contact
GPLDL - all Rights reserved.
  • About GPLDL
  • Need Help?
  • F.A.Q.
  • Terms of Service
  • Privacy Policy
  • Contact
  • Sign In
GPLDL Widget Menu