Ultimate Manga Scraper: Madara Enhancements

Credits to ThuGie

Set Manga Fetch URL


Search Manga


Manga Loaded: 0

$manga): ?>
# Title Cover Image Description Genres Status Last Updated Latest Chapter Actions
<?php echo esc_attr($manga['title']); ?>
delete('ums_manga_generic_list', 'options'); // Get current rules $rules = get_option('ums_manga_generic_list', []); // Validate the schedule format $schedule = '24'; if (!is_numeric($schedule) || $schedule <= 0) { $schedule = '24'; } $new_rule = [ trim($manga['url']), $schedule, '1', (new DateTime())->modify('-24 hours -5 minutes')->format('Y-m-d H:i:s'), '1000', 'publish', 'admin', '', '', 'genre', 'genre', '', '1', '0', '1', '0', '0', '0', '0', ]; $rules[] = $new_rule; update_option('ums_manga_generic_list', $rules); // Update the rules option } // Enqueue scripts for the admin page public static function enqueue_scripts() { wp_enqueue_script('madara-enhancements', plugin_dir_url(__FILE__) . '../assets/js/madara-enhancements.js', ['jquery'], null, true); wp_localize_script('madara-enhancements', 'madaraEnhancements', [ 'ajaxUrl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('madara_enhancements_nonce'), ]); } // Handle AJAX request to search manga // Handle AJAX request to search manga public static function search_manga() { check_ajax_referer('madara_enhancements_nonce', '_ajax_nonce'); // Verify nonce for security $query = isset($_POST['query']) ? sanitize_text_field($_POST['query']) : ''; // Get the search query $type = isset($_POST['type']) ? sanitize_text_field($_POST['type']) : ''; // Get the search type $page = isset($_POST['page']) ? intval($_POST['page']) : 0; // Get the page number // Fetch manga data from the URL $manga_list = UMS_Madara_Fetcher::get_manga_data($page, $query, $type); // Check if there was an error fetching the manga data if (isset($manga_list['error'])) { wp_send_json_error($manga_list['error']); // Send error response if there's an error return; } $existing_manga_urls = array_map('trim', array_column(get_option('ums_manga_generic_list', []), 0)); // Get the list of existing manga URLs // Filter out existing manga from the list $filtered_manga_list = array_filter($manga_list, function($manga) use ($existing_manga_urls) { return !in_array(trim($manga['url']), $existing_manga_urls); }); // Get the current madara_manga_list $current_manga_list = get_option('madara_manga_list', []); // Merge the current list with the new filtered list $updated_manga_list = array_merge($current_manga_list, $filtered_manga_list); // Update the madara_manga_list with the combined list update_option('madara_manga_list', $updated_manga_list); wp_send_json_success(array_values($filtered_manga_list)); // Send success response with the filtered manga list } // Handle AJAX request to save the manga fetch URL public static function save_manga_fetch_url() { check_ajax_referer('madara_enhancements_nonce', '_ajax_nonce'); // Verify nonce for security $manga_fetch_url = isset($_POST['manga_fetch_url']) ? esc_url_raw($_POST['manga_fetch_url']) : ''; // Get the manga fetch URL if ($manga_fetch_url) { update_option('manga_fetch_url', $manga_fetch_url); // Update the manga fetch URL option wp_send_json_success(); // Send success response } else { wp_send_json_error('Invalid URL.'); // Send error response if the URL is invalid } } }