'15096', 'slug' => 'ai-auto-tool', 'premium_slug' => 'ai-auto-tool-pay', 'type' => 'plugin', 'public_key' => 'pk_a1bb06b76f38f9ff1132089d99b21', 'is_premium' => false, 'has_premium_version' => false, 'has_addons' => false, 'has_paid_plans' => true, 'has_affiliation' => 'all', 'menu' => array( 'slug' => 'ai_auto_tool', 'contact' => true, 'support' => false, 'network' => true, ), ) ); } return $aiautotool_premium; } // Move Freemius initialization to plugins_loaded hook add_action('plugins_loaded', function() { aiautotool_premium(); do_action( 'aiautotool_premium_loaded' ); aiautotool_premium()->add_filter( 'hide_freemius_powered_by', '__return_true' ); /* translators: %s là đường dẫn tới trang nâng cấp lên bản Pro của AI Auto Tool.*/ $Upgrade_notifice = sprintf('AI Auto Tool Limit Quota. Please Upgrade Pro', aiautotool_premium()->get_upgrade_url()); define('AIAUTOTOOL_TITLE_UPGRADE', $Upgrade_notifice); }); } function aiautotool_activate() { require_once esc_html( plugin_dir_path( __FILE__ ) ) . 'vendor/aiautotool/class-ai-auto-tool-activator.php'; Ai_auto_tool_Activator::activate(); } function aiautotool_deactivate() { require_once esc_html( plugin_dir_path( __FILE__ ) ) . 'vendor/aiautotool/class-ai-auto-tool-deactivator.php'; Ai_auto_tool_Deactivator::deactivate(); } register_activation_hook( __FILE__, 'aiautotool_activate' ); register_deactivation_hook( __FILE__, 'aiautotool_deactivate' ); if( ! class_exists( 'AI_Auto_Tool' ) ) { class AI_Auto_Tool { protected $subclasses = []; private $aiautotool_config_settings; public function __construct() { add_action('init', array($this, 'load_textdomain')); add_action( 'admin_menu', array( $this, 'add_menu_page' ) , 10, 2); add_action( 'admin_init', array( $this, 'register_settings' ) ); add_action( 'rest_api_init', array($this,'create_post_route')); add_action( 'wp_ajax_aiautotool_check', array( $this, 'aiautotool_check' )); add_action( 'wp_ajax_nopriv_aiautotool_check', array( $this, 'aiautotool_check' ) ); add_action('wp_ajax_aiautotool_insert_post', array( $this, 'aiautotool_insert_post_ajax' )); add_action('wp_ajax_nopriv_aiautotool_insert_post', array( $this, 'aiautotool_insert_post_ajax' )); add_action( 'wp_ajax_aiautotool_get_cate', array( $this, 'aiautotool_get_cate' )); add_action( 'wp_ajax_nopriv_aiautotool_get_cate', array( $this, 'aiautotool_get_cate' )); add_action( 'wp_ajax_get_all_media', array( $this, 'get_all_media_callback' )); add_action( 'wp_ajax_nopriv_get_all_media', array( $this, 'get_all_media_callback' )); add_action( 'wp_ajax_aiautotool_save_image', array( $this, 'aiautotool_save_image' )); self::load_lib(); self::load_inc(); self::aiautotool_new_object(); add_action( 'admin_enqueue_scripts', array( $this, 'add_aiautotool_button_js' ) ); add_filter('plugin_action_links', array( $this, 'add_ai_auto_tool_settings_link' ), 10, 2); add_action('wp_ajax_ai_auto_tool_process_posts', array($this, 'process_posts_callback')); add_action('wp_ajax_nopriv_ai_auto_tool_process_posts', array($this, 'process_posts_callback')); add_action('wp_ajax_ai_auto_tool_process_img_404_posts', array($this, 'process_img_404_posts_callback')); add_action('wp_ajax_nopriv_ai_auto_tool_process_img_404_posts', array($this, 'process_img_404_posts_callback')); register_activation_hook(__FILE__, array($this, 'activate')); register_deactivation_hook(__FILE__, array($this, 'deactivate')); $aiautotool_Warning_Notice = new aiautotool_Warning_Notice(array( 'icon_url' => plugins_url('/images/logo.svg', __FILE__), 'title' => 'Aiautotool Plugin ', 'content' => 'The plugin is available for free so if it benefits you. Join the plugin support group here.', 'button_text' => 'Join group support Ai auto Tool Plugin', 'button_url' => 'https://t.me/aiautotoolchat', )); } public function init_settings() { } private function aiautotool_getdata() { return rendersetting::aiautotool_getdata(); } public function load_textdomain() { load_plugin_textdomain('ai-auto-tool', false, dirname(plugin_basename(__FILE__)) . '/languages/'); } public function activate() { if (class_exists('activeCallBack')) { $activeCallBack = new activeCallBack(); $activeCallBack->activate(); } } public function deactivate(){ $siteurl = get_option('siteurl'); $siteurl = str_replace('https://', 'http://', $siteurl); update_option('siteurl', $siteurl); // } $home = get_option('home'); $home = str_replace('https://', 'http://', $home); update_option('home', $home); if (class_exists('activeCallBack')) { $activeCallBack = new activeCallBack(); $activeCallBack->deactivate(); } global $wpdb; $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'aiautotool_%'" ); $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'fs_%'" ); } function add_ai_auto_tool_settings_link($links, $file) { if (false !== strpos($file, 'ai-auto-tool/Ai-Auto-Tool.php')) { $settings_link = 'Settings'; array_unshift($links, $settings_link); } return $links; } public function addSubclass($subclass) { $this->subclasses[] = $subclass; } public function aiautotool_new_object(){ if (class_exists('URL_Scanner_Plugin')) { $url_scanner_plugin = new URL_Scanner_Plugin(); $this->addSubclass($url_scanner_plugin); } if (class_exists('AIAutoToolsinglepost')) { $AIAutoToolsinglepost = new AIAutoToolsinglepost(); $this->addSubclass($AIAutoToolsinglepost); } if (class_exists('AIautotool_autocomment')) { $AIautotool_autocomment = new AIautotool_autocomment(); $this->addSubclass($AIautotool_autocomment); } if (class_exists('AIautotool_autocreatetags')) { $AIautotool_autocreatetags = new AIautotool_autocreatetags(); $this->addSubclass($AIautotool_autocreatetags); } if (class_exists('AI_AutoTool_cloudflareAI')) { $AI_AutoTool_cloudflareAI = new AI_AutoTool_cloudflareAI (); $this->addSubclass($AI_AutoTool_cloudflareAI); } if (class_exists('AI_AutoTool_suggetauto')) { $AI_AutoTool_suggetauto = new AI_AutoTool_suggetauto (); $this->addSubclass($AI_AutoTool_suggetauto); } if (class_exists('AIautotool_Prompt_CPT')) { $AIautotool_Prompt_CPT = new AIautotool_Prompt_CPT (); $this->addSubclass($AIautotool_Prompt_CPT); } if (class_exists('AIAutoTool_SubmitIndex')) { $AIAutoTool_SubmitIndex = new AIAutoTool_SubmitIndex(); $this->addSubclass($AIAutoTool_SubmitIndex); } if (class_exists('Aiautotool_exLink_backlink')) { $Aiautotool_exLink_backlink = new Aiautotool_exLink_backlink(); $this->addSubclass($Aiautotool_exLink_backlink); } if (class_exists('Aiautotool_Canonical')) { $Aiautotool_Canonical = new Aiautotool_Canonical(); $this->addSubclass($Aiautotool_Canonical); } if (class_exists('Aiautotool_tool_extra_config')) { $Aiautotool_tool_extra_config = new Aiautotool_tool_extra_config(); $this->addSubclass($Aiautotool_tool_extra_config); } // if (class_exists('AIautotool_Web_Stories')) { // $AIautotool_Web_Stories = new AIautotool_Web_Stories(); // $this->addSubclass($AIautotool_Web_Stories); // } if (class_exists('AIAutoToolSecurityBot')) { $AIAutoToolSecurityBot = new AIAutoToolSecurityBot(); $this->addSubclass($AIAutoToolSecurityBot); } // if (class_exists('AIAutotool_ThumbPlusSettings')) { // $AIAutotool_ThumbPlusSettings = new AIAutotool_ThumbPlusSettings(); // $this->addSubclass($AIAutotool_ThumbPlusSettings); // } if (class_exists('aiautotool_AutoGenerateUsername')) { $aiautotool_AutoGenerateUsername = new aiautotool_AutoGenerateUsername(); $this->addSubclass($aiautotool_AutoGenerateUsername); } if (class_exists('Post_Exporter_Plugin')) { $Post_Exporter_Plugin = new Post_Exporter_Plugin(); $this->addSubclass($Post_Exporter_Plugin); } if (class_exists('Auto_Install_Plugins')) { $Auto_Install_Plugins = new Auto_Install_Plugins(); $this->addSubclass($Auto_Install_Plugins); } // if (class_exists('Aiautotool_Footer_Base')) { // $Aiautotool_Footer_Base = new Aiautotool_Footer_Base(); // $this->addSubclass($Aiautotool_Footer_Base); // } // if (class_exists('aiautotool_SSL_active')) { // $aiautotool_SSL_active = new aiautotool_SSL_active(); // $this->addSubclass($aiautotool_SSL_active); // } if (class_exists('activeCallBack')) { $activeCallBack = new activeCallBack(); } if (class_exists('AI_AutoTool_Prompt_Customer')) { $AI_AutoTool_Prompt_Customer = new AI_AutoTool_Prompt_Customer(); } } public function show_render_setting() { foreach ($this->subclasses as $subclass) { $subclass->render_setting(); } } public function show_render_tab_setting() { foreach ($this->subclasses as $subclass) { $subclass->render_tab_setting(); } } public function render_list_feature(){ foreach ($this->subclasses as $subclass) { $subclass->render_feature(); } } public function render_plan(){ foreach ($this->subclasses as $subclass) { $subclass->render_plan(); } } public function load_inc() { // Đường dẫn đến thư mục "inc" $inc_directory = plugin_dir_path(__FILE__) . 'inc'; $inc_files = glob($inc_directory . '/*.php'); if ($inc_files) { foreach ($inc_files as $file) { if (is_file($file)) { include $file; } } } } public function load_lib() { $inc_directory = plugin_dir_path(__FILE__) . 'lib'; $inc_files = glob($inc_directory . '/*.php'); if ($inc_files) { foreach ($inc_files as $file) { if (is_file($file)) { include $file; } } } } function replace_links_in_content($links,$content){ if (count($links) > 3) { shuffle($links); $links = array_slice($links, 0, 3); } $nofollow = " "; $newwindow = " target='_blank' "; $before = "([\s,\(\);:]*?[A-Za-z0-9\x80-\xFF+]*?[\s,\)\(;:]){0,0}"; $after = "([\s,\(\);:]*?[A-Za-z0-9\x80-\xFF+]*?[\s,\)\(;:]){0,0}"; $insensitive = 'i'; $contentbefor = $content; foreach ($links as $link) { $content = ai_internal_link_building_blocks::findtags($content); $anchor_text = $link->archortext; $url = $link->url; $name = $anchor_text; $replace1 = ''; $replace2 = ''; $escapes = array('.','$','^','[',']','?','+','(',')','*','|','\\'); foreach($escapes as $s){ $r = '\\\\'.$s; $name = str_replace($s, stripslashes($r), $name); } $needle ='@()('.$before.$name.'\b'.$after.')()@'; $content = ai_internal_link_building_blocks::findtags($content,false); blocks. $content = ai_internal_link_building::replace($content, $needle, $replace1, $replace2, 1,$insensitive); $content = ai_internal_link_building_blocks::findblocks($content); $content = ai_internal_link_building_blocks::findblocks($content); $content = ai_internal_link_building_blocks::findblocks($content); $protectblocks = array(); $content = trim($content, ' '); if (md5($content)!=md5($contentbefor)) { }else{ $pos = strpos($content, "
"); if ($pos !== false) { $p_tags = explode('', $content); $p_tag_count = count($p_tags); if ($p_tag_count > 1) { $random_pos = rand(1, $p_tag_count - 1); $pos = strpos($content, '' . $p_tags[$random_pos]); } $replacement = "" . $anchor_text . ""; $content = substr($content, 0, $pos + strlen("")) . $replacement . substr($content, $pos + strlen("")); } else { $content .= "" . $anchor_text . ""; } } } return $content; } public function add_aiautotool_button_js() { $setting = new rendersetting(); wp_enqueue_style( 'font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css' ,array(), '1.2'.rand()); wp_enqueue_style('aiautotool', plugin_dir_url(__FILE__) . 'css/aiautotool.css', array(), '1.2'.rand()); wp_enqueue_script('jquery'); wp_enqueue_media(); wp_enqueue_script('socket-io', 'https://cdn.socket.io/4.6.0/socket.io.min.js', array(), '4.6.0'); wp_enqueue_script('sweetalert2', 'https://cdn.jsdelivr.net/npm/sweetalert2@11"', array(), '4.6.0'); $langcodedefault = explode('-',get_bloginfo("language")); $langcodedefault = $langcodedefault[0]; $langcodedefault = get_option('aiautotool_default_language', 'vi'); wp_register_script('kct_cr_scriptx', plugin_dir_url( __FILE__ ) .'js/aiautotool.js', array(), '1.2'.rand(), true); global $post; //$settingseditornumberline = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); $settingseditornumberline = ''; // wp_localize_script('jquery', 'cm_settings', $settings); // wp_enqueue_style('wp-codemirror'); if(isset($post->ID)){ wp_localize_script( 'kct_cr_scriptx', 'aiautotool_js_setting',array( 'ajax_url' => admin_url( 'admin-ajax.php') , 'postID' => $post->ID, 'postTitle' => $post->post_title,'security' => wp_create_nonce('aiautotool_nonce'),'languageCodes'=>$setting->languageCodes, 'langcodedefault'=>$langcodedefault , 'fsdata'=>$this->aiautotool_getdata(), 'code_mirrror'=>$settingseditornumberline, 'gemini_api'=>AIAUTOTOOL_API_GEM, 'gpt_api'=>AIAUTOTOOL_API_GTP, 'prompt'=>get_option('aiautotool_prompt_options') )); }else{ wp_localize_script( 'kct_cr_scriptx', 'aiautotool_js_setting',array( 'ajax_url' => admin_url( 'admin-ajax.php') , 'security' => wp_create_nonce('aiautotool_nonce'), 'languageCodes'=>$setting->languageCodes, 'langcodedefault'=>$langcodedefault, 'fsdata'=>$this->aiautotool_getdata(), 'code_mirrror'=>$settingseditornumberline, 'gemini_api'=>AIAUTOTOOL_API_GEM, 'gpt_api'=>AIAUTOTOOL_API_GTP, 'prompt'=>get_option('aiautotool_prompt_options') )); } wp_enqueue_script('kct_cr_scriptx'); } public function aiautotool_hook_script(){ wp_enqueue_script( 'codemirror-js', plugin_dir_url(__FILE__) .'vendor/codemirror/codemirror.min.js', array(), false, true ); wp_enqueue_style( 'codemirror-css', plugin_dir_url(__FILE__) .'vendor/codemirror/codemirror.min.css' ); wp_enqueue_script( 'codemirror-mode-perl', plugin_dir_url(__FILE__) .'vendor/codemirror/perl.min.js', array('codemirror-js'), false, true ); wp_enqueue_style( 'codemirror-theme', plugin_dir_url(__FILE__) .'vendor/codemirror/cobalt.css' ); } public function add_menu_page() { add_menu_page( ' Ai Auto Tool', ' Ai Auto Tool', 'manage_options', MENUSUBPARRENT, array( $this, 'menu_page' ), 'data:image/svg+xml;base64,' . base64_encode(file_get_contents(plugin_dir_path(__FILE__) . '/images/logo.svg')), 3 ); add_submenu_page( MENUSUBPARRENT, ' Integrations', ' Integrations', 'manage_options', 'aiautotool_integrations', array($this, 'aiautotool_integrations') ); } public function aiautotool_integrations(){ ?>New API key added.
Reset log Images Success!!!!.
Remove log item image Success!!!!.
Domain: ".esc_html($domain)."
"; echo "Plugin Version: " . esc_html(AIAUTOTOOL_VS) . "
"; echo 'Current Plan: ".esc_html($accountType)."
"; echo ' Total limit: ' . esc_html(AIAUTOTOOL_FREE) . ' Request (Post, Tag, Comment)
Current Plan: ".esc_html($accountType)."
"; if($plan_id==25184){ echo ' Total limit: 5000 Request (Post, Tag, Comment)
Total limit: Unlimited Request (Post, Tag, Comment)