About Rentals User Help Section';
$content .= '
';
$content .= abr_is_about_end();
$content .= abr_premium_package_notification();
$content .= '
';
$content .= abr_retrieve_content();
$content .= '
';/*postbox-container Ends*/
$content .= '
';/*welcome-panel Ends*/
echo $content;
}
/**
** About rental premium package notifiation
*
* Displays notification html
*/
function abr_premium_package_notification(){
$version = get_option('abtrv', false);
$content = '';
$content .= '';
# Hide if premium version activated and show if trial version activated or licence expired
if($version==1||$version==''){
$content .= '
Get Premium Version
';
$content .= '
';
$content .= ' Please insert your licence key : ';
$content .= ' ';
$content .= ' Submit';
$content .= '
';
}
# Hide if trial version or premium version activated
if($version==''){
$content .= '
or
';
$content .= '
';
$content .= 'Continue Free Trial';
$content .= '
';
$content .= '
';
}
$content .= '
';
return $content;
}
/*
* Function: abr_is_expire
*
* Description: compares current date and expiry date of premium package
*
* @return Remaining Days
*/
function abr_check_expiry_date(){
$current_date = new DateTime(date("Y/m/d"));
//$start date = get_option('abtre_date', false);
$end_date = new DateTime(get_option('abtre_date', false));
$interval = $current_date->diff($end_date); //compare current date with expiry date
$interval = $interval->format('%a'); //$interval = Remaining Days
if($interval<=7&&$interval>=1){
return $interval;
}
else if($interval==0){
return 'end';
}
else{
return 'go';
}
}
/**
* abr_is_about_end
*
* @return: notification
*/
function abr_is_about_end(){
$status = abr_check_expiry_date();
if($status=='end'){
abr_start_trial_pack();
}
else if($status=='go'){}
else{
$version = get_option('abtrv', false);
if($version==2){
return abr_expire_notification($status);
}
}
}
/**
* Licenec expire notification
*
* @param: $status
* @return: html
*/
function abr_expire_notification($status){
$content = '';
$content .= '';
$content .= '
Your licence will be expire in '.$status.' days
';
$content .= '
To Continue the Service Please Renew Your Monthly Subscription';
$content .= '
';
return $content;
}
/**
* Update for trial package
* @return: trial pack
*/
function abr_start_trial_pack(){
return update_option('abtrv',1); // if subscription ends then trial version starts
}
function abr_retrieve_content(){
$url ='https://whiteirondata.com/master/wp-admin/admin-ajax.php?action=abr_page_html&page_slug=plugin-page-html';
$request = wp_remote_get($url);
$response = wp_remote_retrieve_body( $request );
$obj = json_decode( $response,true);
$response = $obj['response'];
$content = $obj['content'];
if($content){
return $content;
}
else{
return null;
}
}
/**
* Function: abr_check_saved_key
*
* Description: Checks for key after activation if key exist in database no need to enter key again
*/
function abr_find_saved_key(){
$key = get_option('abr_key', false);
$domain = get_option('abr_domain', false);
if((!empty($key))&&(!empty($domain))){
$url ='https://whiteirondata.com/master/wp-admin/admin-ajax.php?action=activation_ajax&key='.$key.'&domain='.$domain;
$request = wp_remote_get($url);
$response = wp_remote_retrieve_body( $request );
$obj = json_decode( $response,true);
$key_status= $obj['key_status'];
$key = get_option('abr_key');
$version=get_option('abtrv'); // 1= trial / 2= premium
if($key_status==1&&$key!=''&&$version!=1){
if(get_option('abtrv')){
update_option('abtrv',2);
}else {
add_option('abtrv',2);
}
}
}
}
function abr_admin_notice() {
?>
administration', 'abr' ); ?>