Changeset 3411699
- Timestamp:
- 12/05/2025 05:06:43 AM (3 months ago)
- Location:
- ai-auto-tool
- Files:
-
- 2 edited
-
tags/2.3.2/Ai-Auto-Tool.php (modified) (3 diffs)
-
trunk/Ai-Auto-Tool.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ai-auto-tool/tags/2.3.2/Ai-Auto-Tool.php
r3411694 r3411699 757 757 $inc_dir = plugin_dir_path(__FILE__) . 'inc/'; 758 758 759 // Define all feature files with their metadata 760 // NOTE: Descriptions are hardcoded here to avoid calling get_feature_description() 761 // which could trigger recursive loading 762 $feature_files = array( 763 'features/canonical-manager/canonical-manager.php' => array( 764 'class' => 'AIAutoTool\Features\CanonicalManager\CanonicalManager', 765 'active_option' => 'Aiautotool_Canonical_active', 766 'title' => 'Canonical Manager', 767 'description' => $this->get_feature_description('canonical', 'Manage canonical URLs and redirects'), 768 'icon' => '<i class="fa-solid fa-link"></i>' 769 ), 770 'features/external-links/external-links.php' => array( 771 'class' => 'AIAutoTool\Features\ExternalLinks\ExternalLinks', 772 'active_option' => 'Aiautotool_exLink_backlink_active', 773 'title' => 'Auto External Links', 774 'description' => $this->get_feature_description('microsite_backlink', 'Automatically manage external links and backlinks'), 775 'icon' => '<i class="fa-solid fa-external-link-alt"></i>' 776 ), 777 'features/submit-index/submit-index.php' => array( 778 'class' => 'AIAutoTool\Features\SubmitIndex\SubmitIndex', 779 'active_option' => 'AIAutoTool_SubmitIndex_active', 780 'title' => 'Submit Index', 781 'description' => $this->get_feature_description('google_index', 'Submit URLs to search engines for indexing'), 782 'icon' => '<i class="fa-solid fa-paper-plane"></i>' 783 ), 784 'features/post-exporter/post-exporter.php' => array( 785 'class' => 'AIAutoTool\Features\PostExporter\PostExporter', 786 'active_option' => 'Post_Exporter_Plugin_active', 787 'title' => 'Post Exporter', 788 'description' => $this->get_feature_description('post_exporter', 'Export posts and content to various formats'), 789 'icon' => '<i class="fa-solid fa-download"></i>' 790 ), 791 'features/keyword-autopost/keyword-autopost.php' => array( 792 'class' => 'AIAutoTool\Features\KeywordAutopost\KeywordAutopost', 793 'active_option' => 'aiautotool_keyword_autopost_active', 794 'title' => 'Keyword Autopost', 795 'description' => $this->get_feature_description('keyword_autopost', 'Automatically create posts based on keywords'), 796 'icon' => '<i class="fa-solid fa-key"></i>' 797 ), 798 'features/single-ai/single-ai.php' => array( 799 'class' => 'AIAutoTool\Features\SingleAI\SingleAI', 800 'active_option' => 'AIAutoToolsinglepost_active', 801 'title' => 'Single AI Post', 802 'description' => $this->get_feature_description('single_ai', 'Create individual AI-powered posts'), 803 'icon' => '<i class="fa-solid fa-file-alt"></i>' 804 ), 805 'features/image-scanner/image-scanner.php' => array( 806 'class' => 'AIAutoTool\Features\ImageScanner\ImageScanner', 807 'active_option' => 'AIAutotool_Image404Scanner_active', 808 'title' => 'Image Scanner', 809 'description' => $this->get_feature_description('thumb_fix', 'Scan and manage images for 404 errors'), 810 'icon' => '<i class="fa-solid fa-image"></i>' 811 ), 812 'features/auto-comment/auto-comment.php' => array( 813 'class' => 'AIAutoTool\Features\AutoComment\AutoComment', 814 'active_option' => 'AIautotool_autocomment_active', 815 'title' => 'Auto Comment', 816 'description' => $this->get_feature_description('auto_comment', 'Automatically generate and post comments using AI'), 817 'icon' => '<i class="fa-solid fa-comments"></i>' 818 ), 819 'features/auto-create-tags/auto-create-tags.php' => array( 820 'class' => 'AIAutoTool\Features\AutoCreateTags\AutoCreateTags', 821 'active_option' => 'AIautotool_autocreatetags_active', 822 'title' => 'Auto Create Tags', 823 'description' => $this->get_feature_description('auto_create_tag', 'Automatically create and assign tags to posts'), 824 'icon' => '<i class="fa-solid fa-tags"></i>' 825 ), 826 'features/cloudflare-ai/cloudflare-ai.php' => array( 827 'class' => 'AIAutoTool\Features\CloudflareAI\CloudflareAI', 828 'active_option' => 'AI_AutoTool_cloudflareAI_active', 829 'title' => 'Cloudflare AI', 830 'description' => $this->get_feature_description('cloudflare_ai', 'Integrate with Cloudflare AI services'), 831 'icon' => '<i class="fa-solid fa-cloud"></i>' 832 ), 833 'features/suggest-auto/suggest-auto.php' => array( 834 'class' => 'AIAutoTool\Features\SuggestAuto\SuggestAuto', 835 'active_option' => 'AI_AutoTool_suggetauto_active', 836 'title' => 'Suggest Auto', 837 'description' => $this->get_feature_description('suggest_auto', 'Automatically suggest content improvements'), 838 'icon' => '<i class="fa-solid fa-lightbulb"></i>' 839 ), 840 'features/prompt-cpt/prompt-cpt.php' => array( 841 'class' => 'AIAutoTool\Features\PromptCPT\PromptCPT', 842 'active_option' => 'AIautotool_Prompt_CPT_active', 843 'title' => 'Prompt CPT', 844 'description' => $this->get_feature_description('prompt_manager', 'Manage custom post types for prompts'), 845 'icon' => '<i class="fa-solid fa-clipboard"></i>' 846 ), 847 848 // Temporarily disabled due to HTML output issues 849 'features/bot-security/bot-security.php' => array( 850 'class' => 'AIAutoTool\Features\BotSecurity\BotSecurity', 851 'active_option' => 'AIAutoToolSecurityBot_active', 852 'title' => 'Bot Security', 853 'description' => 'Security features for bot protection', 854 'icon' => '<i class="fa-solid fa-shield"></i>' 855 ), 856 'features/web-stories/web-stories.php' => array( 857 'class' => 'AIAutoTool\Features\WebStories\WebStories', 858 'active_option' => 'AIautotool_Web_Stories_active', 859 'title' => 'Web Stories', 860 'description' => $this->get_feature_description('webstories', 'Create and manage web stories'), 861 'icon' => '<i class="fa-solid fa-book-open"></i>' 862 ), 863 'features/install-plugin/install-plugin.php' => array( 864 'class' => 'AIAutoTool\Features\InstallPlugin\InstallPlugin', 865 'active_option' => 'Aiautotool_Install_Plugin_active', 866 'title' => 'Install Plugin', 867 'description' => $this->get_feature_description('install_plugin', 'Install and manage plugins'), 868 'icon' => '<i class="fa-solid fa-download"></i>' 869 ), 870 'features/footer-base/footer-base.php' => array( 871 'class' => 'AIAutoTool\Features\FooterBase\FooterBase', 872 'active_option' => 'Aiautotool_footer_base_active', 873 'title' => 'Footer Base', 874 'description' => 'Manage footer content and base elements', 875 'icon' => '<i class="fa-solid fa-window-maximize"></i>' 876 ), 877 'features/username-generator/username-generator.php' => array( 878 'class' => 'AIAutoTool\Features\UsernameGenerator\UsernameGenerator', 879 'active_option' => 'aiautotool_AutoGenerateUsername_active', 880 'title' => 'Auto Generate Username', 881 'description' => 'Automatically generate usernames', 882 'icon' => '<i class="fa-solid fa-user-plus"></i>' 883 ), 884 'features/autoblogging/autoblogging.php' => array( 885 'class' => 'AIAutoTool\Features\Autoblogging\Autoblogging', 886 'active_option' => 'AI_AutoTool_Autoblogging_active', 887 'title' => 'Autoblogging', 888 'description' => 'Automatically create blog posts from URLs using AI', 889 'icon' => '<i class="fa-solid fa-blog"></i>' 890 ), 891 'features/auto-create-categories/auto-create-categories.php' => array( 892 'class' => 'AIAutoTool_AutoCreateCategories', 893 'active_option' => 'AIAutoTool_auto_create_categories_active', 894 'title' => 'Auto Create Categories', 895 'description' => $this->get_feature_description('auto_create_categories', 'Tự động tạo danh sách category dạng cây thư mục bằng AI, tối ưu SEO theo topic cluster'), 896 'icon' => '<i class="fa-solid fa-sitemap"></i>' 897 ), 898 'features/crawlcampaign/crawlcampaign.php' => array( 899 'class' => 'AIAutoTool\Features\CrawlCampaign\CrawlCampaign', 900 'active_option' => 'aiautotool_crawlcampaign_active', 901 'title' => 'Crawl Campaign', 902 'description' => $this->get_feature_description('crawlcampaign', 'Tự động crawl và đăng bài từ nhiều nguồn (RSS, YouTube, Amazon, Facebook, Instagram, Twitter, etc.)'), 903 'icon' => '<i class="fa-solid fa-spider"></i>' 904 ), 905 // 'cron-status-widget/cron-status-widget.php' => array( 906 // 'class' => 'AIAutoTool_Cron_Status_Widget', 907 // 'active_option' => 'AIAutoTool_Cron_Status_Widget_active', 908 // 'title' => 'Cron Status Widget', 909 // 'description' => 'Monitor and manage WordPress cron jobs', 910 // 'icon' => '<i class="fa-solid fa-clock"></i>' 911 // ), 912 ); 913 759 // Get feature registry from centralized method 760 $feature_files = $this->get_feature_registry(); 761 762 // Separate features into active and disabled arrays 763 $active_features = array(); 764 $disabled_features = array(); 914 765 915 766 foreach ($feature_files as $file => $config) { … … 934 785 } else { 935 786 if (!isset($option_cache[$active_option])) { 936 $option_cache[$active_option] = get_option($active_option, false); 787 // Try to get option with original name first 788 $is_active = get_option($active_option, false); 789 790 // If not found, try normalized name (in case it was saved with normalized name) 791 if ($is_active === false) { 792 $normalized_option = $active_option; 793 if (strpos($normalized_option, 'aiautotool_') !== 0) { 794 $normalized_option = 'aiautotool_' . $normalized_option; 795 } 796 $is_active = get_option($normalized_option, false); 797 798 // If found with normalized name, migrate it to original name for consistency 799 if ($is_active !== false) { 800 update_option($active_option, $is_active, false); 801 delete_option($normalized_option); 802 } 803 } 804 805 // Also try using FeatureOptions if available 806 if ($is_active === false && class_exists('AIAutoTool_FeatureOptions')) { 807 $is_active = AIAutoTool_FeatureOptions::get_option($active_option, false); 808 } 809 810 $option_cache[$active_option] = $is_active; 937 811 } 938 812 $is_active = $option_cache[$active_option]; 939 813 } 940 814 $active = ($is_active === 'true' || $is_active === true); 815 816 // Store feature data for later rendering 817 $feature_data = array( 818 'file' => $file, 819 'config' => $config, 820 'active' => $active, 821 'active_option' => $active_option 822 ); 823 824 // Categorize feature 825 if ($active) { 826 $active_features[] = $feature_data; 827 } else { 828 $disabled_features[] = $feature_data; 829 } 830 } 831 } 832 833 // Render Active Features Section 834 if (!empty($active_features)) { 835 echo '<div class="aiautotool-features-section aiautotool-features-active">'; 836 echo '<div class="aiautotool-section-header">'; 837 echo '<h2>'; 838 echo '<i class="fa-solid fa-check-circle"></i>'; 839 echo __('Active Features', 'ai-auto-tool'); 840 echo ' <span class="feature-count">' . count($active_features) . '</span>'; 841 echo '</h2>'; 842 echo '<p>' . __('These features are currently enabled and active on your site', 'ai-auto-tool') . '</p>'; 843 echo '</div>'; 844 echo '<div class="aiautotool-features-grid">'; 845 846 foreach ($active_features as $feature_data) { 847 $config = $feature_data['config']; 848 $active = $feature_data['active']; 849 $active_option = $feature_data['active_option']; 941 850 942 851 // Create AutoToolBox for this feature 943 852 $box = new AutoToolBox( 944 $ icon . ' ' . $title,945 $ description,853 $config['icon'] . ' ' . $config['title'], 854 $config['description'], 946 855 admin_url('admin.php?page=aiautotool_integrations'), 947 856 $active_option, … … 954 863 echo $box->generateHTML(); 955 864 } 865 866 echo '</div>'; 867 echo '</div>'; 868 } 869 870 // Render Disabled Features Section 871 if (!empty($disabled_features)) { 872 echo '<div class="aiautotool-features-section aiautotool-features-disabled">'; 873 echo '<div class="aiautotool-section-header">'; 874 echo '<h2>'; 875 echo '<i class="fa-solid fa-times-circle"></i>'; 876 echo __('Disabled Features', 'ai-auto-tool'); 877 echo ' <span class="feature-count">' . count($disabled_features) . '</span>'; 878 echo '</h2>'; 879 echo '<p>' . __('These features are currently disabled and not active on your site', 'ai-auto-tool') . '</p>'; 880 echo '</div>'; 881 echo '<div class="aiautotool-features-grid">'; 882 883 foreach ($disabled_features as $feature_data) { 884 $config = $feature_data['config']; 885 $active = $feature_data['active']; 886 $active_option = $feature_data['active_option']; 887 888 // Create AutoToolBox for this feature 889 $box = new AutoToolBox( 890 $config['icon'] . ' ' . $config['title'], 891 $config['description'], 892 admin_url('admin.php?page=aiautotool_integrations'), 893 $active_option, 894 $active, 895 '', 896 false 897 ); 898 899 // Render the box 900 echo $box->generateHTML(); 901 } 902 903 echo '</div>'; 904 echo '</div>'; 956 905 } 957 906 958 907 $features_rendered = true; 908 } 909 910 /** 911 * Get feature registry - extracted from render_all_features for reuse 912 * 913 * @return array Feature registry with file paths and metadata 914 */ 915 private function get_feature_registry() { 916 return array( 917 'features/canonical-manager/canonical-manager.php' => array( 918 'class' => 'AIAutoTool\Features\CanonicalManager\CanonicalManager', 919 'active_option' => 'Aiautotool_Canonical_active', 920 'title' => 'Canonical Manager', 921 'description' => $this->get_feature_description('canonical', 'Manage canonical URLs and redirects'), 922 'icon' => '<i class="fa-solid fa-link"></i>' 923 ), 924 'features/external-links/external-links.php' => array( 925 'class' => 'AIAutoTool\Features\ExternalLinks\ExternalLinks', 926 'active_option' => 'Aiautotool_exLink_backlink_active', 927 'title' => 'Auto External Links', 928 'description' => $this->get_feature_description('microsite_backlink', 'Automatically manage external links and backlinks'), 929 'icon' => '<i class="fa-solid fa-external-link-alt"></i>' 930 ), 931 'features/submit-index/submit-index.php' => array( 932 'class' => 'AIAutoTool\Features\SubmitIndex\SubmitIndex', 933 'active_option' => 'AIAutoTool_SubmitIndex_active', 934 'title' => 'Submit Index', 935 'description' => $this->get_feature_description('google_index', 'Submit URLs to search engines for indexing'), 936 'icon' => '<i class="fa-solid fa-paper-plane"></i>' 937 ), 938 'features/post-exporter/post-exporter.php' => array( 939 'class' => 'AIAutoTool\Features\PostExporter\PostExporter', 940 'active_option' => 'Post_Exporter_Plugin_active', 941 'title' => 'Post Exporter', 942 'description' => $this->get_feature_description('post_exporter', 'Export posts and content to various formats'), 943 'icon' => '<i class="fa-solid fa-download"></i>' 944 ), 945 'features/keyword-autopost/keyword-autopost.php' => array( 946 'class' => 'AIAutoTool\Features\KeywordAutopost\KeywordAutopost', 947 'active_option' => 'aiautotool_keyword_autopost_active', 948 'title' => 'Keyword Autopost', 949 'description' => $this->get_feature_description('keyword_autopost', 'Automatically create posts based on keywords'), 950 'icon' => '<i class="fa-solid fa-key"></i>' 951 ), 952 'features/single-ai/single-ai.php' => array( 953 'class' => 'AIAutoTool\Features\SingleAI\SingleAI', 954 'active_option' => 'AIAutoToolsinglepost_active', 955 'title' => 'Single AI Post', 956 'description' => $this->get_feature_description('single_ai', 'Create individual AI-powered posts'), 957 'icon' => '<i class="fa-solid fa-file-alt"></i>' 958 ), 959 'features/image-scanner/image-scanner.php' => array( 960 'class' => 'AIAutoTool\Features\ImageScanner\ImageScanner', 961 'active_option' => 'AIAutotool_Image404Scanner_active', 962 'title' => 'Image Scanner', 963 'description' => $this->get_feature_description('thumb_fix', 'Scan and manage images for 404 errors'), 964 'icon' => '<i class="fa-solid fa-image"></i>' 965 ), 966 'features/auto-comment/auto-comment.php' => array( 967 'class' => 'AIAutoTool\Features\AutoComment\AutoComment', 968 'active_option' => 'AIautotool_autocomment_active', 969 'title' => 'Auto Comment', 970 'description' => $this->get_feature_description('auto_comment', 'Automatically generate and post comments using AI'), 971 'icon' => '<i class="fa-solid fa-comments"></i>' 972 ), 973 'features/auto-create-tags/auto-create-tags.php' => array( 974 'class' => 'AIAutoTool\Features\AutoCreateTags\AutoCreateTags', 975 'active_option' => 'AIautotool_autocreatetags_active', 976 'title' => 'Auto Create Tags', 977 'description' => $this->get_feature_description('auto_create_tag', 'Automatically create and assign tags to posts'), 978 'icon' => '<i class="fa-solid fa-tags"></i>' 979 ), 980 'features/cloudflare-ai/cloudflare-ai.php' => array( 981 'class' => 'AIAutoTool\Features\CloudflareAI\CloudflareAI', 982 'active_option' => 'AI_AutoTool_cloudflareAI_active', 983 'title' => 'Cloudflare AI', 984 'description' => $this->get_feature_description('cloudflare_ai', 'Integrate with Cloudflare AI services'), 985 'icon' => '<i class="fa-solid fa-cloud"></i>' 986 ), 987 'features/suggest-auto/suggest-auto.php' => array( 988 'class' => 'AIAutoTool\Features\SuggestAuto\SuggestAuto', 989 'active_option' => 'AI_AutoTool_suggetauto_active', 990 'title' => 'Suggest Auto', 991 'description' => $this->get_feature_description('suggest_auto', 'Automatically suggest content improvements'), 992 'icon' => '<i class="fa-solid fa-lightbulb"></i>' 993 ), 994 'features/prompt-cpt/prompt-cpt.php' => array( 995 'class' => 'AIAutoTool\Features\PromptCPT\PromptCPT', 996 'active_option' => 'AIautotool_Prompt_CPT_active', 997 'title' => 'Prompt CPT', 998 'description' => $this->get_feature_description('prompt_manager', 'Manage custom post types for prompts'), 999 'icon' => '<i class="fa-solid fa-clipboard"></i>' 1000 ), 1001 'features/prompt-customer/prompt-customer.php' => array( 1002 'class' => 'AIAutoTool\Features\PromptCustomer\PromptCustomer', 1003 'active_option' => 'AI_AutoTool_Prompt_Customer_active', 1004 'title' => 'Prompt Customer', 1005 'description' => $this->get_feature_description('prompt_customer', 'Customer prompt management and customization'), 1006 'icon' => '<i class="fa-solid fa-user"></i>' 1007 ), 1008 'features/bot-security/bot-security.php' => array( 1009 'class' => 'AIAutoTool\Features\BotSecurity\BotSecurity', 1010 'active_option' => 'AIAutoToolSecurityBot_active', 1011 'title' => 'Bot Security', 1012 'description' => 'Security features for bot protection', 1013 'icon' => '<i class="fa-solid fa-shield"></i>' 1014 ), 1015 'features/web-stories/web-stories.php' => array( 1016 'class' => 'AIAutoTool\Features\WebStories\WebStories', 1017 'active_option' => 'AIautotool_Web_Stories_active', 1018 'title' => 'Web Stories', 1019 'description' => $this->get_feature_description('webstories', 'Create and manage web stories'), 1020 'icon' => '<i class="fa-solid fa-book-open"></i>' 1021 ), 1022 'features/install-plugin/install-plugin.php' => array( 1023 'class' => 'AIAutoTool\Features\InstallPlugin\InstallPlugin', 1024 'active_option' => 'Aiautotool_Install_Plugin_active', 1025 'title' => 'Install Plugin', 1026 'description' => $this->get_feature_description('install_plugin', 'Install and manage plugins'), 1027 'icon' => '<i class="fa-solid fa-download"></i>' 1028 ), 1029 'features/footer-base/footer-base.php' => array( 1030 'class' => 'AIAutoTool\Features\FooterBase\FooterBase', 1031 'active_option' => 'Aiautotool_footer_base_active', 1032 'title' => 'Footer Base', 1033 'description' => 'Manage footer content and base elements', 1034 'icon' => '<i class="fa-solid fa-window-maximize"></i>' 1035 ), 1036 'features/username-generator/username-generator.php' => array( 1037 'class' => 'AIAutoTool\Features\UsernameGenerator\UsernameGenerator', 1038 'active_option' => 'aiautotool_AutoGenerateUsername_active', 1039 'title' => 'Auto Generate Username', 1040 'description' => 'Automatically generate usernames', 1041 'icon' => '<i class="fa-solid fa-user-plus"></i>' 1042 ), 1043 'features/autoblogging/autoblogging.php' => array( 1044 'class' => 'AIAutoTool\Features\Autoblogging\Autoblogging', 1045 'active_option' => 'AI_AutoTool_Autoblogging_active', 1046 'title' => 'Autoblogging', 1047 'description' => 'Automatically create blog posts from URLs using AI', 1048 'icon' => '<i class="fa-solid fa-blog"></i>' 1049 ), 1050 'features/auto-create-categories/auto-create-categories.php' => array( 1051 'class' => 'AIAutoTool_AutoCreateCategories', 1052 'active_option' => 'AIAutoTool_auto_create_categories_active', 1053 'title' => 'Auto Create Categories', 1054 'description' => $this->get_feature_description('auto_create_categories', 'Tự động tạo danh sách category dạng cây thư mục bằng AI, tối ưu SEO theo topic cluster'), 1055 'icon' => '<i class="fa-solid fa-sitemap"></i>' 1056 ), 1057 'features/crawlcampaign/crawlcampaign.php' => array( 1058 'class' => 'AIAutoTool\Features\CrawlCampaign\CrawlCampaign', 1059 'active_option' => 'aiautotool_crawlcampaign_active', 1060 'title' => 'Crawl Campaign', 1061 'description' => $this->get_feature_description('crawlcampaign', 'Tự động crawl và đăng bài từ nhiều nguồn (RSS, YouTube, Amazon, Facebook, Instagram, Twitter, etc.)'), 1062 'icon' => '<i class="fa-solid fa-spider"></i>' 1063 ), 1064 ); 959 1065 } 960 1066 -
ai-auto-tool/trunk/Ai-Auto-Tool.php
r3411688 r3411699 757 757 $inc_dir = plugin_dir_path(__FILE__) . 'inc/'; 758 758 759 // Define all feature files with their metadata 760 // NOTE: Descriptions are hardcoded here to avoid calling get_feature_description() 761 // which could trigger recursive loading 762 $feature_files = array( 763 'features/canonical-manager/canonical-manager.php' => array( 764 'class' => 'AIAutoTool\Features\CanonicalManager\CanonicalManager', 765 'active_option' => 'Aiautotool_Canonical_active', 766 'title' => 'Canonical Manager', 767 'description' => $this->get_feature_description('canonical', 'Manage canonical URLs and redirects'), 768 'icon' => '<i class="fa-solid fa-link"></i>' 769 ), 770 'features/external-links/external-links.php' => array( 771 'class' => 'AIAutoTool\Features\ExternalLinks\ExternalLinks', 772 'active_option' => 'Aiautotool_exLink_backlink_active', 773 'title' => 'Auto External Links', 774 'description' => $this->get_feature_description('microsite_backlink', 'Automatically manage external links and backlinks'), 775 'icon' => '<i class="fa-solid fa-external-link-alt"></i>' 776 ), 777 'features/submit-index/submit-index.php' => array( 778 'class' => 'AIAutoTool\Features\SubmitIndex\SubmitIndex', 779 'active_option' => 'AIAutoTool_SubmitIndex_active', 780 'title' => 'Submit Index', 781 'description' => $this->get_feature_description('google_index', 'Submit URLs to search engines for indexing'), 782 'icon' => '<i class="fa-solid fa-paper-plane"></i>' 783 ), 784 'features/post-exporter/post-exporter.php' => array( 785 'class' => 'AIAutoTool\Features\PostExporter\PostExporter', 786 'active_option' => 'Post_Exporter_Plugin_active', 787 'title' => 'Post Exporter', 788 'description' => $this->get_feature_description('post_exporter', 'Export posts and content to various formats'), 789 'icon' => '<i class="fa-solid fa-download"></i>' 790 ), 791 'features/keyword-autopost/keyword-autopost.php' => array( 792 'class' => 'AIAutoTool\Features\KeywordAutopost\KeywordAutopost', 793 'active_option' => 'aiautotool_keyword_autopost_active', 794 'title' => 'Keyword Autopost', 795 'description' => $this->get_feature_description('keyword_autopost', 'Automatically create posts based on keywords'), 796 'icon' => '<i class="fa-solid fa-key"></i>' 797 ), 798 'features/single-ai/single-ai.php' => array( 799 'class' => 'AIAutoTool\Features\SingleAI\SingleAI', 800 'active_option' => 'AIAutoToolsinglepost_active', 801 'title' => 'Single AI Post', 802 'description' => $this->get_feature_description('single_ai', 'Create individual AI-powered posts'), 803 'icon' => '<i class="fa-solid fa-file-alt"></i>' 804 ), 805 'features/image-scanner/image-scanner.php' => array( 806 'class' => 'AIAutoTool\Features\ImageScanner\ImageScanner', 807 'active_option' => 'AIAutotool_Image404Scanner_active', 808 'title' => 'Image Scanner', 809 'description' => $this->get_feature_description('thumb_fix', 'Scan and manage images for 404 errors'), 810 'icon' => '<i class="fa-solid fa-image"></i>' 811 ), 812 'features/auto-comment/auto-comment.php' => array( 813 'class' => 'AIAutoTool\Features\AutoComment\AutoComment', 814 'active_option' => 'AIautotool_autocomment_active', 815 'title' => 'Auto Comment', 816 'description' => $this->get_feature_description('auto_comment', 'Automatically generate and post comments using AI'), 817 'icon' => '<i class="fa-solid fa-comments"></i>' 818 ), 819 'features/auto-create-tags/auto-create-tags.php' => array( 820 'class' => 'AIAutoTool\Features\AutoCreateTags\AutoCreateTags', 821 'active_option' => 'AIautotool_autocreatetags_active', 822 'title' => 'Auto Create Tags', 823 'description' => $this->get_feature_description('auto_create_tag', 'Automatically create and assign tags to posts'), 824 'icon' => '<i class="fa-solid fa-tags"></i>' 825 ), 826 'features/cloudflare-ai/cloudflare-ai.php' => array( 827 'class' => 'AIAutoTool\Features\CloudflareAI\CloudflareAI', 828 'active_option' => 'AI_AutoTool_cloudflareAI_active', 829 'title' => 'Cloudflare AI', 830 'description' => $this->get_feature_description('cloudflare_ai', 'Integrate with Cloudflare AI services'), 831 'icon' => '<i class="fa-solid fa-cloud"></i>' 832 ), 833 'features/suggest-auto/suggest-auto.php' => array( 834 'class' => 'AIAutoTool\Features\SuggestAuto\SuggestAuto', 835 'active_option' => 'AI_AutoTool_suggetauto_active', 836 'title' => 'Suggest Auto', 837 'description' => $this->get_feature_description('suggest_auto', 'Automatically suggest content improvements'), 838 'icon' => '<i class="fa-solid fa-lightbulb"></i>' 839 ), 840 'features/prompt-cpt/prompt-cpt.php' => array( 841 'class' => 'AIAutoTool\Features\PromptCPT\PromptCPT', 842 'active_option' => 'AIautotool_Prompt_CPT_active', 843 'title' => 'Prompt CPT', 844 'description' => $this->get_feature_description('prompt_manager', 'Manage custom post types for prompts'), 845 'icon' => '<i class="fa-solid fa-clipboard"></i>' 846 ), 847 848 // Temporarily disabled due to HTML output issues 849 'features/bot-security/bot-security.php' => array( 850 'class' => 'AIAutoTool\Features\BotSecurity\BotSecurity', 851 'active_option' => 'AIAutoToolSecurityBot_active', 852 'title' => 'Bot Security', 853 'description' => 'Security features for bot protection', 854 'icon' => '<i class="fa-solid fa-shield"></i>' 855 ), 856 'features/web-stories/web-stories.php' => array( 857 'class' => 'AIAutoTool\Features\WebStories\WebStories', 858 'active_option' => 'AIautotool_Web_Stories_active', 859 'title' => 'Web Stories', 860 'description' => $this->get_feature_description('webstories', 'Create and manage web stories'), 861 'icon' => '<i class="fa-solid fa-book-open"></i>' 862 ), 863 'features/install-plugin/install-plugin.php' => array( 864 'class' => 'AIAutoTool\Features\InstallPlugin\InstallPlugin', 865 'active_option' => 'Aiautotool_Install_Plugin_active', 866 'title' => 'Install Plugin', 867 'description' => $this->get_feature_description('install_plugin', 'Install and manage plugins'), 868 'icon' => '<i class="fa-solid fa-download"></i>' 869 ), 870 'features/footer-base/footer-base.php' => array( 871 'class' => 'AIAutoTool\Features\FooterBase\FooterBase', 872 'active_option' => 'Aiautotool_footer_base_active', 873 'title' => 'Footer Base', 874 'description' => 'Manage footer content and base elements', 875 'icon' => '<i class="fa-solid fa-window-maximize"></i>' 876 ), 877 'features/username-generator/username-generator.php' => array( 878 'class' => 'AIAutoTool\Features\UsernameGenerator\UsernameGenerator', 879 'active_option' => 'aiautotool_AutoGenerateUsername_active', 880 'title' => 'Auto Generate Username', 881 'description' => 'Automatically generate usernames', 882 'icon' => '<i class="fa-solid fa-user-plus"></i>' 883 ), 884 'features/autoblogging/autoblogging.php' => array( 885 'class' => 'AIAutoTool\Features\Autoblogging\Autoblogging', 886 'active_option' => 'AI_AutoTool_Autoblogging_active', 887 'title' => 'Autoblogging', 888 'description' => 'Automatically create blog posts from URLs using AI', 889 'icon' => '<i class="fa-solid fa-blog"></i>' 890 ), 891 'features/auto-create-categories/auto-create-categories.php' => array( 892 'class' => 'AIAutoTool_AutoCreateCategories', 893 'active_option' => 'AIAutoTool_auto_create_categories_active', 894 'title' => 'Auto Create Categories', 895 'description' => $this->get_feature_description('auto_create_categories', 'Tự động tạo danh sách category dạng cây thư mục bằng AI, tối ưu SEO theo topic cluster'), 896 'icon' => '<i class="fa-solid fa-sitemap"></i>' 897 ), 898 'features/crawlcampaign/crawlcampaign.php' => array( 899 'class' => 'AIAutoTool\Features\CrawlCampaign\CrawlCampaign', 900 'active_option' => 'aiautotool_crawlcampaign_active', 901 'title' => 'Crawl Campaign', 902 'description' => $this->get_feature_description('crawlcampaign', 'Tự động crawl và đăng bài từ nhiều nguồn (RSS, YouTube, Amazon, Facebook, Instagram, Twitter, etc.)'), 903 'icon' => '<i class="fa-solid fa-spider"></i>' 904 ), 905 // 'cron-status-widget/cron-status-widget.php' => array( 906 // 'class' => 'AIAutoTool_Cron_Status_Widget', 907 // 'active_option' => 'AIAutoTool_Cron_Status_Widget_active', 908 // 'title' => 'Cron Status Widget', 909 // 'description' => 'Monitor and manage WordPress cron jobs', 910 // 'icon' => '<i class="fa-solid fa-clock"></i>' 911 // ), 912 ); 913 759 // Get feature registry from centralized method 760 $feature_files = $this->get_feature_registry(); 761 762 // Separate features into active and disabled arrays 763 $active_features = array(); 764 $disabled_features = array(); 914 765 915 766 foreach ($feature_files as $file => $config) { … … 934 785 } else { 935 786 if (!isset($option_cache[$active_option])) { 936 $option_cache[$active_option] = get_option($active_option, false); 787 // Try to get option with original name first 788 $is_active = get_option($active_option, false); 789 790 // If not found, try normalized name (in case it was saved with normalized name) 791 if ($is_active === false) { 792 $normalized_option = $active_option; 793 if (strpos($normalized_option, 'aiautotool_') !== 0) { 794 $normalized_option = 'aiautotool_' . $normalized_option; 795 } 796 $is_active = get_option($normalized_option, false); 797 798 // If found with normalized name, migrate it to original name for consistency 799 if ($is_active !== false) { 800 update_option($active_option, $is_active, false); 801 delete_option($normalized_option); 802 } 803 } 804 805 // Also try using FeatureOptions if available 806 if ($is_active === false && class_exists('AIAutoTool_FeatureOptions')) { 807 $is_active = AIAutoTool_FeatureOptions::get_option($active_option, false); 808 } 809 810 $option_cache[$active_option] = $is_active; 937 811 } 938 812 $is_active = $option_cache[$active_option]; 939 813 } 940 814 $active = ($is_active === 'true' || $is_active === true); 815 816 // Store feature data for later rendering 817 $feature_data = array( 818 'file' => $file, 819 'config' => $config, 820 'active' => $active, 821 'active_option' => $active_option 822 ); 823 824 // Categorize feature 825 if ($active) { 826 $active_features[] = $feature_data; 827 } else { 828 $disabled_features[] = $feature_data; 829 } 830 } 831 } 832 833 // Render Active Features Section 834 if (!empty($active_features)) { 835 echo '<div class="aiautotool-features-section aiautotool-features-active">'; 836 echo '<div class="aiautotool-section-header">'; 837 echo '<h2>'; 838 echo '<i class="fa-solid fa-check-circle"></i>'; 839 echo __('Active Features', 'ai-auto-tool'); 840 echo ' <span class="feature-count">' . count($active_features) . '</span>'; 841 echo '</h2>'; 842 echo '<p>' . __('These features are currently enabled and active on your site', 'ai-auto-tool') . '</p>'; 843 echo '</div>'; 844 echo '<div class="aiautotool-features-grid">'; 845 846 foreach ($active_features as $feature_data) { 847 $config = $feature_data['config']; 848 $active = $feature_data['active']; 849 $active_option = $feature_data['active_option']; 941 850 942 851 // Create AutoToolBox for this feature 943 852 $box = new AutoToolBox( 944 $ icon . ' ' . $title,945 $ description,853 $config['icon'] . ' ' . $config['title'], 854 $config['description'], 946 855 admin_url('admin.php?page=aiautotool_integrations'), 947 856 $active_option, … … 954 863 echo $box->generateHTML(); 955 864 } 865 866 echo '</div>'; 867 echo '</div>'; 868 } 869 870 // Render Disabled Features Section 871 if (!empty($disabled_features)) { 872 echo '<div class="aiautotool-features-section aiautotool-features-disabled">'; 873 echo '<div class="aiautotool-section-header">'; 874 echo '<h2>'; 875 echo '<i class="fa-solid fa-times-circle"></i>'; 876 echo __('Disabled Features', 'ai-auto-tool'); 877 echo ' <span class="feature-count">' . count($disabled_features) . '</span>'; 878 echo '</h2>'; 879 echo '<p>' . __('These features are currently disabled and not active on your site', 'ai-auto-tool') . '</p>'; 880 echo '</div>'; 881 echo '<div class="aiautotool-features-grid">'; 882 883 foreach ($disabled_features as $feature_data) { 884 $config = $feature_data['config']; 885 $active = $feature_data['active']; 886 $active_option = $feature_data['active_option']; 887 888 // Create AutoToolBox for this feature 889 $box = new AutoToolBox( 890 $config['icon'] . ' ' . $config['title'], 891 $config['description'], 892 admin_url('admin.php?page=aiautotool_integrations'), 893 $active_option, 894 $active, 895 '', 896 false 897 ); 898 899 // Render the box 900 echo $box->generateHTML(); 901 } 902 903 echo '</div>'; 904 echo '</div>'; 956 905 } 957 906 958 907 $features_rendered = true; 908 } 909 910 /** 911 * Get feature registry - extracted from render_all_features for reuse 912 * 913 * @return array Feature registry with file paths and metadata 914 */ 915 private function get_feature_registry() { 916 return array( 917 'features/canonical-manager/canonical-manager.php' => array( 918 'class' => 'AIAutoTool\Features\CanonicalManager\CanonicalManager', 919 'active_option' => 'Aiautotool_Canonical_active', 920 'title' => 'Canonical Manager', 921 'description' => $this->get_feature_description('canonical', 'Manage canonical URLs and redirects'), 922 'icon' => '<i class="fa-solid fa-link"></i>' 923 ), 924 'features/external-links/external-links.php' => array( 925 'class' => 'AIAutoTool\Features\ExternalLinks\ExternalLinks', 926 'active_option' => 'Aiautotool_exLink_backlink_active', 927 'title' => 'Auto External Links', 928 'description' => $this->get_feature_description('microsite_backlink', 'Automatically manage external links and backlinks'), 929 'icon' => '<i class="fa-solid fa-external-link-alt"></i>' 930 ), 931 'features/submit-index/submit-index.php' => array( 932 'class' => 'AIAutoTool\Features\SubmitIndex\SubmitIndex', 933 'active_option' => 'AIAutoTool_SubmitIndex_active', 934 'title' => 'Submit Index', 935 'description' => $this->get_feature_description('google_index', 'Submit URLs to search engines for indexing'), 936 'icon' => '<i class="fa-solid fa-paper-plane"></i>' 937 ), 938 'features/post-exporter/post-exporter.php' => array( 939 'class' => 'AIAutoTool\Features\PostExporter\PostExporter', 940 'active_option' => 'Post_Exporter_Plugin_active', 941 'title' => 'Post Exporter', 942 'description' => $this->get_feature_description('post_exporter', 'Export posts and content to various formats'), 943 'icon' => '<i class="fa-solid fa-download"></i>' 944 ), 945 'features/keyword-autopost/keyword-autopost.php' => array( 946 'class' => 'AIAutoTool\Features\KeywordAutopost\KeywordAutopost', 947 'active_option' => 'aiautotool_keyword_autopost_active', 948 'title' => 'Keyword Autopost', 949 'description' => $this->get_feature_description('keyword_autopost', 'Automatically create posts based on keywords'), 950 'icon' => '<i class="fa-solid fa-key"></i>' 951 ), 952 'features/single-ai/single-ai.php' => array( 953 'class' => 'AIAutoTool\Features\SingleAI\SingleAI', 954 'active_option' => 'AIAutoToolsinglepost_active', 955 'title' => 'Single AI Post', 956 'description' => $this->get_feature_description('single_ai', 'Create individual AI-powered posts'), 957 'icon' => '<i class="fa-solid fa-file-alt"></i>' 958 ), 959 'features/image-scanner/image-scanner.php' => array( 960 'class' => 'AIAutoTool\Features\ImageScanner\ImageScanner', 961 'active_option' => 'AIAutotool_Image404Scanner_active', 962 'title' => 'Image Scanner', 963 'description' => $this->get_feature_description('thumb_fix', 'Scan and manage images for 404 errors'), 964 'icon' => '<i class="fa-solid fa-image"></i>' 965 ), 966 'features/auto-comment/auto-comment.php' => array( 967 'class' => 'AIAutoTool\Features\AutoComment\AutoComment', 968 'active_option' => 'AIautotool_autocomment_active', 969 'title' => 'Auto Comment', 970 'description' => $this->get_feature_description('auto_comment', 'Automatically generate and post comments using AI'), 971 'icon' => '<i class="fa-solid fa-comments"></i>' 972 ), 973 'features/auto-create-tags/auto-create-tags.php' => array( 974 'class' => 'AIAutoTool\Features\AutoCreateTags\AutoCreateTags', 975 'active_option' => 'AIautotool_autocreatetags_active', 976 'title' => 'Auto Create Tags', 977 'description' => $this->get_feature_description('auto_create_tag', 'Automatically create and assign tags to posts'), 978 'icon' => '<i class="fa-solid fa-tags"></i>' 979 ), 980 'features/cloudflare-ai/cloudflare-ai.php' => array( 981 'class' => 'AIAutoTool\Features\CloudflareAI\CloudflareAI', 982 'active_option' => 'AI_AutoTool_cloudflareAI_active', 983 'title' => 'Cloudflare AI', 984 'description' => $this->get_feature_description('cloudflare_ai', 'Integrate with Cloudflare AI services'), 985 'icon' => '<i class="fa-solid fa-cloud"></i>' 986 ), 987 'features/suggest-auto/suggest-auto.php' => array( 988 'class' => 'AIAutoTool\Features\SuggestAuto\SuggestAuto', 989 'active_option' => 'AI_AutoTool_suggetauto_active', 990 'title' => 'Suggest Auto', 991 'description' => $this->get_feature_description('suggest_auto', 'Automatically suggest content improvements'), 992 'icon' => '<i class="fa-solid fa-lightbulb"></i>' 993 ), 994 'features/prompt-cpt/prompt-cpt.php' => array( 995 'class' => 'AIAutoTool\Features\PromptCPT\PromptCPT', 996 'active_option' => 'AIautotool_Prompt_CPT_active', 997 'title' => 'Prompt CPT', 998 'description' => $this->get_feature_description('prompt_manager', 'Manage custom post types for prompts'), 999 'icon' => '<i class="fa-solid fa-clipboard"></i>' 1000 ), 1001 'features/prompt-customer/prompt-customer.php' => array( 1002 'class' => 'AIAutoTool\Features\PromptCustomer\PromptCustomer', 1003 'active_option' => 'AI_AutoTool_Prompt_Customer_active', 1004 'title' => 'Prompt Customer', 1005 'description' => $this->get_feature_description('prompt_customer', 'Customer prompt management and customization'), 1006 'icon' => '<i class="fa-solid fa-user"></i>' 1007 ), 1008 'features/bot-security/bot-security.php' => array( 1009 'class' => 'AIAutoTool\Features\BotSecurity\BotSecurity', 1010 'active_option' => 'AIAutoToolSecurityBot_active', 1011 'title' => 'Bot Security', 1012 'description' => 'Security features for bot protection', 1013 'icon' => '<i class="fa-solid fa-shield"></i>' 1014 ), 1015 'features/web-stories/web-stories.php' => array( 1016 'class' => 'AIAutoTool\Features\WebStories\WebStories', 1017 'active_option' => 'AIautotool_Web_Stories_active', 1018 'title' => 'Web Stories', 1019 'description' => $this->get_feature_description('webstories', 'Create and manage web stories'), 1020 'icon' => '<i class="fa-solid fa-book-open"></i>' 1021 ), 1022 'features/install-plugin/install-plugin.php' => array( 1023 'class' => 'AIAutoTool\Features\InstallPlugin\InstallPlugin', 1024 'active_option' => 'Aiautotool_Install_Plugin_active', 1025 'title' => 'Install Plugin', 1026 'description' => $this->get_feature_description('install_plugin', 'Install and manage plugins'), 1027 'icon' => '<i class="fa-solid fa-download"></i>' 1028 ), 1029 'features/footer-base/footer-base.php' => array( 1030 'class' => 'AIAutoTool\Features\FooterBase\FooterBase', 1031 'active_option' => 'Aiautotool_footer_base_active', 1032 'title' => 'Footer Base', 1033 'description' => 'Manage footer content and base elements', 1034 'icon' => '<i class="fa-solid fa-window-maximize"></i>' 1035 ), 1036 'features/username-generator/username-generator.php' => array( 1037 'class' => 'AIAutoTool\Features\UsernameGenerator\UsernameGenerator', 1038 'active_option' => 'aiautotool_AutoGenerateUsername_active', 1039 'title' => 'Auto Generate Username', 1040 'description' => 'Automatically generate usernames', 1041 'icon' => '<i class="fa-solid fa-user-plus"></i>' 1042 ), 1043 'features/autoblogging/autoblogging.php' => array( 1044 'class' => 'AIAutoTool\Features\Autoblogging\Autoblogging', 1045 'active_option' => 'AI_AutoTool_Autoblogging_active', 1046 'title' => 'Autoblogging', 1047 'description' => 'Automatically create blog posts from URLs using AI', 1048 'icon' => '<i class="fa-solid fa-blog"></i>' 1049 ), 1050 'features/auto-create-categories/auto-create-categories.php' => array( 1051 'class' => 'AIAutoTool_AutoCreateCategories', 1052 'active_option' => 'AIAutoTool_auto_create_categories_active', 1053 'title' => 'Auto Create Categories', 1054 'description' => $this->get_feature_description('auto_create_categories', 'Tự động tạo danh sách category dạng cây thư mục bằng AI, tối ưu SEO theo topic cluster'), 1055 'icon' => '<i class="fa-solid fa-sitemap"></i>' 1056 ), 1057 'features/crawlcampaign/crawlcampaign.php' => array( 1058 'class' => 'AIAutoTool\Features\CrawlCampaign\CrawlCampaign', 1059 'active_option' => 'aiautotool_crawlcampaign_active', 1060 'title' => 'Crawl Campaign', 1061 'description' => $this->get_feature_description('crawlcampaign', 'Tự động crawl và đăng bài từ nhiều nguồn (RSS, YouTube, Amazon, Facebook, Instagram, Twitter, etc.)'), 1062 'icon' => '<i class="fa-solid fa-spider"></i>' 1063 ), 1064 ); 959 1065 } 960 1066
Note: See TracChangeset
for help on using the changeset viewer.