active = get_option($this->active_option_name, false); if ($this->active=='true') { $this->init(); } add_action('wp_ajax_update_active_option_canonical_'.$this->active_option_name, array($this, 'update_active_option_callback')); add_action('wp_ajax_nopriv_update_active_option_canonical_'.$this->active_option_name, array($this, 'update_active_option_callback')); } public function update_active_option_callback() { check_ajax_referer('aiautotool_nonce', 'security'); if (isset($_POST['active'])) { $active = sanitize_text_field($_POST['active']); update_option($this->active_option_name, $active,null, 'no'); print_r($active); } wp_die(); } public function init(){ add_action('admin_menu', array($this, 'add_menu')); add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); add_action('wp_ajax_import_from_json', array($this, 'import_posts_from_json')); add_action('wp_ajax_fetch_posts_by_urls', array($this, 'fetch_posts_by_urls_ajax')); add_action('wp_ajax_delete_post_not_in', array($this, 'delete_post_not_in_ajax')); add_action('wp_ajax_restore_trashed_posts_action', array($this, 'restore_trashed_posts_callback')); add_action('wp_ajax_get_post_details', array($this, 'get_post_details_ajax')); add_action('wp_ajax_import_from_json_file', array($this, 'import_from_json_file')); add_action('wp_ajax_aiautotool_backup_database', array($this, 'aiautotool_backup_database_ajax_handler')); } public function render_setting() { } public function render_tab_setting() { } public function render_feature(){ $autoToolBox = new AutoToolBox("Post Exporter", "Export & Import Post from list Url", "#", $this->active_option_name, $this->active,plugins_url('../images/logo.svg', __FILE__)); echo ($autoToolBox->generateHTML()); } public function add_menu() { add_submenu_page( MENUSUBPARRENT, ' Post Export', ' Post Export', 'manage_options', 'post_exporter_menu', array($this, 'render_page') ); } public function enqueue_scripts($hook) { wp_enqueue_script('post-exporter-script', plugin_dir_url(__FILE__) . '../js/post-exporter-script.js', array('jquery'), '1.2'.rand(), true); wp_localize_script('post-exporter-script', 'postExporterData', array( 'nonce' => wp_create_nonce('post_exporter_nonce'), )); } public function render_page() { ?>
Restore posts from trash: