prefix ; $id = sanitize_text_field($_POST['id']); $type = sanitize_text_field($_POST['type']); $resultz = $wpdb->get_results( 'SELECT * FROM '.$prefix.'aha_api WHERE id='.$id); if(!empty($resultz)){ $key = ($resultz[0]->api_key != '' ? $resultz[0]->api_key : '' ); } require dirname (dirname( __FILE__ ) ) .'/functions/aha_curl_function.php' ; $Curl = new Aha_curl_function; $settings = $Curl->aha_settings($id) ; $categories = json_decode($settings->categories); $book_id = $categories[0]; if($type == 'single'){ $key = $key.'-'.sanitize_text_field($_POST['limit']); $bookss = $setting->aha_main_crul($key,'https://www.ahathat.com/plugin-setup/all_books') ; $bookss=json_decode($bookss); // Display a Single AHAbook foreach($bookss as $result) { $cover = ($result->cover !='')? $result->cover : 'default_cover.jpg' ; $bookCoverUrl = plugins_url('/assets/images/books_cover/'.$cover,__DIR__); $defaultCoverUrl = plugins_url('/assets/images/books_cover/default_cover.jpg',__DIR__); $bookCoverUrl = @fopen($bookCoverUrl, 'r') ? $bookCoverUrl : $defaultCoverUrl; if($book_id == $result->id){ ?>