SpeedyCache Pro depends on the free version of SpeedyCache, so you need to update the free version to use SpeedyCache without any issue.
Install Now '; } function speedycache_pro_img_stats(){ check_ajax_referer('speedycache_ajax_nonce', 'security'); if(!current_user_can('manage_options')){ wp_die('Must be admin'); } if(!class_exists('\SpeedyCache\Image')){ wp_send_json_error(__('The file required to Process Image optimization is not present', 'speedycache')); } $res = \SpeedyCache\Image::statics_data(); wp_send_json($res); } function speedycache_pro_optimize_image(){ check_ajax_referer('speedycache_ajax_nonce', 'security'); if(!current_user_can('manage_options')){ wp_die('Must be admin'); } if(!class_exists('\SpeedyCache\Image')){ wp_send_json_error(__('The file required to Process Image optimization is not present', 'speedycache')); } $id = null; if(!empty($_POST['img_id'])){ $id = (int) sanitize_text_field(wp_unslash($_POST['img_id'])); if(empty($id)){ wp_send_json_error('Empty Image ID'); } } $res = \SpeedyCache\Image::optimize_single($id); $res[1] = isset($res[1]) ? $res[1] : ''; $res[2] = isset($res[2]) ? $res[2] : ''; $res[3] = isset($res[3]) ? $res[3] : ''; $response = array( 'message' => $res[0], 'success' => $res[1], 'id' => $res[2], 'percentage' => $res[3], ); wp_send_json($response); } function speedycache_pro_save_img_settings(){ check_ajax_referer('speedycache_ajax_nonce', 'security'); if(!current_user_can('manage_options')){ wp_die('Must be admin'); } global $speedycache; $settings = speedycache_optpost('settings'); foreach($settings as $key => $setting){ $new_key = str_replace('img_', '', $key); $settings[$new_key] = $setting; unset($settings[$key]); } $speedycache->image['settings'] = $settings; if(update_option('speedycache_img', $speedycache->image['settings'])){ wp_send_json_success(); } wp_send_json_error(); } function speedycache_pro_list_imgs(){ check_ajax_referer('speedycache_ajax_nonce', 'security'); if(!current_user_can('manage_options')){ wp_die('Must be admin'); } $query_images_args = array(); $query_images_args['offset'] = intval(speedycache_optget('page')) * intval(speedycache_optget('per_page')); $query_images_args['order'] = 'DESC'; $query_images_args['orderby'] = 'ID'; $query_images_args['post_type'] = 'attachment'; $query_images_args['post_mime_type'] = array('image/jpeg', 'image/png', 'image/gif'); $query_images_args['post_status'] = 'inherit'; $query_images_args['posts_per_page'] = speedycache_optget('per_page'); $query_images_args['meta_query'] = array( array( 'key' => 'speedycache_optimisation', 'compare' => 'EXISTS' ) ); $query_images_args['s'] = speedycache_optget('search'); if(!empty($_GET['filter'])){ if(speedycache_optget('filter') == 'error_code'){ $filter = array( 'key' => 'speedycache_optimisation', 'value' => base64_encode('"error_code"'), 'compare' => 'LIKE' ); $filter_second = array( 'key' => 'speedycache_optimisation', 'compare' => 'NOT LIKE' ); array_push($query_images_args['meta_query'], $filter); array_push($query_images_args['meta_query'], $filter_second); } } $result = array( 'content' => \SpeedyCache\Image::list_content($query_images_args), 'result_count' => \SpeedyCache\Image::count_query($query_images_args) ); wp_send_json($result); } function speedycache_pro_revert_img(){ check_ajax_referer('speedycache_ajax_nonce', 'security'); if(!current_user_can('manage_options')){ wp_die('Must Be admin'); } global $speedycache; if(!empty($_GET['id'])){ $speedycache->image['id'] = (int) speedycache_optget('id'); } wp_send_json(\SpeedyCache\Image::revert()); } function speedycache_pro_revert_all_imgs(){ check_ajax_referer('speedycache_ajax_nonce', 'security'); if(!current_user_can('manage_options')){ wp_die('Must be admin'); } \SpeedyCache\Image::revert_all(); } function speedycache_pro_verify_license(){ if(!wp_verify_nonce($_GET['security'], 'speedycache_license')){ wp_send_json_error(__('Security Check Failed', 'speedycache')); } if(!current_user_can('manage_options')){ wp_send_json_error(__('You do not have required permission.', 'speedycache')); } global $speedycache; $license = sanitize_key($_GET['license']); if(empty($license)){ wp_send_json_error(__('The license key was not submitted', 'speedycache')); } $resp = wp_remote_get(SPEEDYCACHE_API.'license.php?license='.$license.'&url='.rawurlencode(site_url()), array('timeout' => 30)); if(!is_array($resp)){ wp_send_json_error(__('The response was malformed'.esc_html__('Speed Test Results:', 'speedycache-pro').'
'.esc_html__('Before Optimization', 'speedycache-pro').'
'.esc_html__('After Optimization', 'speedycache-pro').'
'.$msg. '