PHP code example of objectivco / cgd_eddsl_magic

1. Go to this page and download the library: Download objectivco/cgd_eddsl_magic library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

objectivco / cgd_eddsl_magic example snippets


if ( ! class_exists( 'CGD_EDDSL_Magic' ) ) {
	// load our custom updater
	

$updater = new CGD_EDDSL_Magic($prefix, $menu_slug,  $host_url, $plugin_version, $plugin_name, $plugin_author, $plugin_file, $theme = false, $beta = false, $home_url = false);

	add_action('admin_menu', 'add_key_nag', 11);
	function add_key_nag() {
		global $pagenow;

	    if( $pagenow == 'plugins.php' ) {
	        add_action( 'after_plugin_row_' . plugin_basename(__FILE__), 'after_plugin_row_message', 10, 2 );
	    }
	}

	function after_plugin_row_message() {
		$key_status = $this->updater->get_field_value('key_status');

		if ( empty($key_status) ) return;

		if ( $key_status != "valid" ) {
			$current = get_site_transient( 'update_plugins' );
			if ( isset( $current->response[ plugin_basename(__FILE__) ] ) ) return;

			if ( is_network_admin() || ! is_multisite() ) {
				$wp_list_table = _get_list_table('WP_Plugins_List_Table');
				echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
				echo keynag();
				echo '</div></td></tr>';
			}
		}
	}

	function keynag() {
		return "<span style='color:red'>You're missing out on important updates because your license key is missing, invalid, or expired.</span>";
	}
 php
$updater->admin_page();
 php
$this->updater->set_license_check_cron();
 php
$this->updater->unset_license_check_cron();