Skip to content

Instantly share code, notes, and snippets.

@seedprod
Created November 27, 2017 17:08
Show Gist options
  • Save seedprod/22dc5be5ac96a7cca554026bb8fe7095 to your computer and use it in GitHub Desktop.
Save seedprod/22dc5be5ac96a7cca554026bb8fe7095 to your computer and use it in GitHub Desktop.
/**
* API Updates
*/
if( !class_exists( 'SeedProd_Updater_cspv5' ) ) {
// load our custom updater
include( dirname( __FILE__ ) . '/seedprod-updater-cspv5.php' );
}
function seed_cspv5_plugin_updater() {
$seed_cspv5_api_key = '';
$seed_emaillist = "";
$seed_admin_email = get_option( 'admin_email','' );
if(defined('SEED_CSP_API_KEY')){
$seed_cspv5_api_key = SEED_CSP_API_KEY;
}
if(empty($seed_cspv5_api_key)){
$seed_cspv5_api_key = get_option('seed_cspv5_license_key');
}
$csp_page_id = get_option('seed_cspv5_coming_soon_page_id');
if(!empty($csp_page_id)){
$page_id = get_option('seed_cspv5_coming_soon_page_id');
global $wpdb;
$tablename = $wpdb->prefix . SEED_CSPV5_PAGES_TABLENAME;
$sql = "SELECT * FROM $tablename WHERE id= %d";
$safe_sql = $wpdb->prepare($sql,$page_id);
$page = $wpdb->get_row($safe_sql);
if(!empty($page->mailprovider)){
$seed_emaillist = $page->mailprovider;
}
}
$data = array();
$data['emaillist'] = $seed_emaillist;
$data['admin_email'] = $seed_admin_email;
// retrieve our license key from the DB
//$license_key = trim( get_option( 'edd_sample_license_key' ) );
// setup the updater
$seedprod_updater = new SeedProd_Updater_cspv5( SEED_CSPV5_API_URL, __FILE__, array(
'license' => $seed_cspv5_api_key, // license key (used get_option above to retrieve from DB)
'data' => $data
)
);
}
add_action( 'admin_init', 'seed_cspv5_plugin_updater', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment