| @@ -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 | * Content Optimization Manager Class |
| 20 | 25 | * |
| 21 | 26 | * Provides comprehensive content optimization with real-time scoring, |
| @@ -1044,9 +1049,9 @@ | ||
| 1044 | 1049 | // Get recent posts for blog homepage |
| 1045 | 1050 | $recent_posts = get_posts(['numberposts' => 3]); |
| 1046 | 1051 | $content_parts = []; |
| 1047 | 1052 | foreach ($recent_posts as $post) { |
| 1048 | - $content_parts[] = $post->post_title . ' ' . wp_trim_words($post->post_content, 100); | |
| 1053 | + $content_parts[] = $post->post_title . ' ' . \ThinkRank\Core\Seo_Text::trim_words($post->post_content, 100, '...', 1000); | |
| 1049 | 1054 | } |
| 1050 | 1055 | $content = implode(' ', $content_parts); |
| 1051 | 1056 | } |
| 1052 | 1057 | break; |
| @@ -1137,9 +1142,9 @@ | ||
| 1137 | 1142 | 'recommendations' => wp_json_encode($results['recommendations'] ?? []), |
| 1138 | 1143 | 'analyzed_by' => get_current_user_id() |
| 1139 | 1144 | ]; |
| 1140 | 1145 | |
| 1141 | - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- Optimization results storage requires direct database access | |
| 1146 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter -- Optimization results storage requires direct database access | |
| 1142 | 1147 | $result = $wpdb->insert($table_name, $data); |
| 1143 | 1148 | |
| 1144 | 1149 | return $result !== false; |
| 1145 | 1150 | } |
| @@ -1397,9 +1402,9 @@ | ||
| 1397 | 1402 | // Word count recommendations |
| 1398 | 1403 | if (!empty($compliance['word_count_compliance']) && |
| 1399 | 1404 | $compliance['word_count_compliance']['status'] === 'non_compliant') { |
| 1400 | 1405 | $needed = $compliance['word_count_compliance']['min_required'] - |
| 1401 | - $compliance['word_count_compliance']['current_count']; | |
| 1406 | + $compliance['word_count_compliance']['current_count']; | |
| 1402 | 1407 | $recommendations[] = [ |
| 1403 | 1408 | 'type' => 'word_count', |
| 1404 | 1409 | 'priority' => 'high', |
| 1405 | 1410 | 'message' => "Add {$needed} more words to meet minimum requirements", |