PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.8.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.8.0
2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk 1.0.0 1.0.1 1.0.2 1.1.0 All 49 releases
← All changes | includes/seo/class-ai-content-analyzer.php +8 -2 1.0.22.8.0 View file →
@@ -14,8 +14,13 @@
14 14 declare(strict_types=1);
15 15
16 16 namespace ThinkRank\SEO;
17 17
18 +// Prevent direct access
19 +if (!defined('ABSPATH')) {
20 + exit;
21 +}
22 +
18 23 /**
19 24 * AI Content Analyzer Class
20 25 *
21 26 * Provides comprehensive content analysis using real AI algorithms including
@@ -838,8 +843,9 @@
838 843 private function find_keyword_positions(string $content, string $keyword): array {
839 844 $positions = [];
840 845 $offset = 0;
841 846
847 + // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition -- the canonical strpos() scan loop; hoisting it needs a duplicated call.
842 848 while (($pos = strpos($content, $keyword, $offset)) !== false) {
843 849 $positions[] = $pos;
844 850 $offset = $pos + 1;
845 851 }
@@ -938,9 +944,9 @@
938 944 // Get recent posts for blog homepage
939 945 $recent_posts = get_posts(['numberposts' => 3]);
940 946 $content_parts = [];
941 947 foreach ($recent_posts as $post) {
942 - $content_parts[] = $post->post_title . ' ' . wp_trim_words($post->post_content, 100);
948 + $content_parts[] = $post->post_title . ' ' . \ThinkRank\Core\Seo_Text::trim_words($post->post_content, 100, '...', 1000);
943 949 }
944 950 $content = implode(' ', $content_parts);
945 951 }
946 952 break;
@@ -1008,9 +1014,9 @@
1008 1014 'recommendations' => wp_json_encode($results['recommendations'] ?? []),
1009 1015 'analyzed_by' => get_current_user_id()
1010 1016 ];
1011 1017
1012 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- Analysis results storage requires direct database access
1018 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Analysis results storage requires direct database access
1013 1019 $result = $wpdb->insert($table_name, $data);
1014 1020
1015 1021 return $result !== false;
1016 1022 }