Пример #1
0
 function plugin_details($result = false, $action = null, $args = null)
 {
     // vars
     $slug = acf_get_setting('slug');
     $info = acf_pro_get_remote_response('get-info');
     // bail ealry if no info
     if (empty($info)) {
         return false;
     }
     // json decode
     $info = json_decode($info);
     // sections
     $sections = array('description' => '', 'installation' => '', 'changelog' => '', 'upgrade_notice' => '');
     foreach ($sections as $k => $v) {
         $sections[$k] = $info->{$k};
         unset($info->{$k});
     }
     $info->sections = $sections;
     // return
     return $info;
 }
Пример #2
0
function acf_pro_get_remote_info()
{
    // clear transient if force check is enabled
    if (!empty($_GET['force-check'])) {
        // only allow transient to be deleted once per page load
        if (empty($_GET['acf-ignore-force-check'])) {
            delete_transient('acf_pro_get_remote_info');
        }
        // update $_GET
        $_GET['acf-ignore-force-check'] = true;
    }
    // get transient
    $transient = get_transient('acf_pro_get_remote_info');
    if ($transient !== false) {
        return $transient;
    }
    // vars
    $info = acf_pro_get_remote_response('get-info');
    $timeout = 12 * HOUR_IN_SECONDS;
    // decode
    if (!empty($info)) {
        $info = json_decode($info, true);
        // fake info version
        //$info['version'] = '6.0.0';
    } else {
        $info = 0;
        // allow transient to be returned, but empty to validate
        $timeout = 2 * HOUR_IN_SECONDS;
    }
    // update transient
    set_transient('acf_pro_get_remote_info', $info, $timeout);
    // return
    return $info;
}
 function deactivate_pro_licence()
 {
     // validate
     if (!acf_pro_is_license_active()) {
         return;
     }
     // connect
     $args = array('_nonce' => wp_create_nonce('deactivate_pro_licence'), 'acf_license' => acf_pro_get_license(), 'wp_url' => home_url());
     // connect
     $response = acf_pro_get_remote_response('deactivate-license', $args);
     // validate
     if (empty($response)) {
         acf_add_admin_notice(__('<b>Connection Error</b>. Sorry, please try again', 'acf'), 'error');
         return;
     }
     // vars
     $response = json_decode($response, true);
     $class = '';
     // allways clear DB
     acf_pro_update_license('');
     // action
     if ($response['status'] == 1) {
     } else {
         $class = 'error';
     }
     // show message
     if ($response['message']) {
         acf_add_admin_notice($response['message'], $class);
     }
 }
Пример #4
0
function wpa__prelicense()
{
    if (function_exists('acf_pro_is_license_active') && !acf_pro_is_license_active()) {
        $args = array('_nonce' => wp_create_nonce('activate_pro_licence'), 'acf_license' => base64_encode('order_id=37918|type=personal|date=2014-08-21 15:02:59'), 'acf_version' => acf_get_setting('version'), 'wp_name' => get_bloginfo('name'), 'wp_url' => home_url(), 'wp_version' => get_bloginfo('version'), 'wp_language' => get_bloginfo('language'), 'wp_timezone' => get_option('timezone_string'));
        $response = acf_pro_get_remote_response('activate-license', $args);
        $response = json_decode($response, true);
        if ($response['status'] == 1) {
            acf_pro_update_license($response['license']);
        }
    }
}