'; private $client = null; public $notices = []; public $limit = AIAUTOTOOL_FREE; private $plan_limit_aiautotool ; public $name_plan ; public $config = array(); public $notice ; public $aiautotool_setting_cloudflare_image; public function __construct() { $this->name_plan = __('Prompt Manager','ai-auto-tool'); $this->plan_limit_aiautotool = 'plan_limit_aiautotool_'.$this->active_option_name; $this->notice = new aiautotool_Warning_Notice(); $this->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('init', [$this, 'register_prompt_cpt']); add_action('admin_menu', [$this, 'add_prompt_to_menu']); add_action('add_meta_boxes', [$this, 'add_metabox']); add_action('save_post', [$this, 'save_metabox']); add_action('wp_ajax_aiautotool_load_customer_prompt_properties', [$this, 'aiautotool_load_customer_prompt_properties']); } public function aiautotool_load_customer_prompt_properties() { $arr_replace_prompt = ['%TITLE%','%CONTENT%','%AUTHOR%','%CATEGORIES_NAME%','%TAGS_NAME%']; $prompt_id = isset($_POST['prompt_id']) ? sanitize_text_field($_POST['prompt_id']) : ''; $postprompt = get_post($prompt_id); if (!empty($prompt_id)) { $params = get_post_meta($prompt_id, '_aiautotool_prompt_params', true); $arr = array(); $arr['prompt_content'] = esc_html($postprompt->post_content); $arr['prompt_params'] = $params; $arr['prompt_arr_replace'] = esc_html($arr_replace_prompt); echo wp_send_json_success($arr); wp_die(); } wp_die('Invalid prompt ID'); } public function render_select_prompt(){ $allprompt = get_option('aiautotool_prompt_options',array()); $artcle_prompt = ''; if(isset($allprompt['aiautotool_prompt_artcile'])) { $artcle_prompt = $allprompt['aiautotool_prompt_artcile']; } ?>
Prompt : access code : %%title%% , %%lang%%, %%blog%%, %%cate%%, %%content%%
Select Your Prompts in List: ' . esc_html(__('Add Prompt','ai-auto-tool')) . ''; ?>
__('Prompts', 'ai-auto-tool'), 'singular_name' => __('Prompt', 'ai-auto-tool'), 'menu_name' => __('Prompts', 'ai-auto-tool'), 'name_admin_bar' => __('Prompt', 'ai-auto-tool'), 'add_new' => __('Add New', 'ai-auto-tool'), 'add_new_item' => __('Add New Prompt', 'ai-auto-tool'), 'new_item' => __('New Prompt', 'ai-auto-tool'), 'edit_item' => __('Edit Prompt', 'ai-auto-tool'), 'view_item' => __('View Prompt', 'ai-auto-tool'), 'all_items' => __('All Prompts', 'ai-auto-tool'), 'search_items' => __('Search Prompts', 'ai-auto-tool'), 'not_found' => __('No Prompts found.', 'ai-auto-tool'), 'not_found_in_trash' => __('No Prompts found in Trash.', 'ai-auto-tool'), ]; $args = [ 'labels' => $labels, 'public' => false, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => 'aiautotool_prompts', 'query_var' => true, 'rewrite' => ['slug' => 'aiautotool_prompts'], 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => MENUSUBPARRENT, 'supports' => ['title', 'editor'], ]; register_post_type('aiautotool_prompts', $args); } public static function add_prompt_to_menu() { add_submenu_page( MENUSUBPARRENT, 'Prompts Manager', 'Prompts Manager', 'manage_options', 'edit.php?post_type=aiautotool_prompts' ); } public function render_setting() { if($this->active!="true"){ return ''; } } public function render_tab_setting() { if($this->active=="true"){ } } public function render_feature() { $autoToolBox = new AutoToolBox($this->icon.' '.$this->name_plan, __('Prompt Manager.','ai-auto-tool'), "#", $this->active_option_name, $this->active,plugins_url('../images/logo.svg', __FILE__)); echo ($autoToolBox->generateHTML()); } public static function add_metabox() { add_meta_box( 'aiautotool_prompt_params', __('Prompt Parameters', 'ai-auto-tool'), [self::class, 'render_metabox'], 'aiautotool_prompts', 'normal', 'high' ); } public static function render_metabox($post) { wp_nonce_field('aiautotool_prompt_save_meta', 'aiautotool_prompt_meta_nonce'); $params = get_post_meta($post->ID, '_aiautotool_prompt_params', true); echo '