Changeset 3464114
- Timestamp:
- 02/18/2026 09:29:50 AM (2 days ago)
- Location:
- contentpen
- Files:
-
- 6 edited
- 1 copied
-
tags/1.0.11 (copied) (copied from contentpen/trunk)
-
tags/1.0.11/README.txt (modified) (3 diffs)
-
tags/1.0.11/contentpen-plugin.php (modified) (2 diffs)
-
tags/1.0.11/includes/class-contentpen-api.php (modified) (4 diffs)
-
trunk/README.txt (modified) (3 diffs)
-
trunk/contentpen-plugin.php (modified) (2 diffs)
-
trunk/includes/class-contentpen-api.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
contentpen/tags/1.0.11/README.txt
r3463958 r3464114 4 4 Requires at least: 5.8 5 5 Tested up to: 6.9.1 6 Stable tag: 1.0.1 06 Stable tag: 1.0.11 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 55 55 == Changelog == 56 56 57 = 1.0.11 = 58 * Added support for Rank Math and All in One SEO plugins 59 57 60 = 1.0.10 = 58 61 * Removed unused GET /posts endpoint that caused route conflicts in some wordpress versions. … … 76 79 == Upgrade Notice == 77 80 81 = 1.0.11 = 82 * Added support for Rank Math and All in One SEO plugins 83 78 84 = 1.0.10 = 79 85 * Removed unused GET /posts endpoint that caused route conflicts in some wordpress versions. -
contentpen/tags/1.0.11/contentpen-plugin.php
r3463958 r3464114 5 5 * Plugin URI: https://contentpen.ai 6 6 * Description: Contentpen is an AI-powered content writing assistant designed to help businesses create, optimize, and publish SEO-friendly blog posts at scale. By combining deep research with your brand's unique voice, Contentpen crafts high-impact articles that outperform your competition. 7 * Version: 1.0.1 07 * Version: 1.0.11 8 8 * Requires at least: 5.8 9 9 * Requires PHP: 7.4 … … 20 20 } 21 21 22 define('CONTENTPEN_VERSION', '1.0.1 0');22 define('CONTENTPEN_VERSION', '1.0.11'); 23 23 define('CONTENTPEN_PLUGIN_DIR', plugin_dir_path(__FILE__)); 24 24 define('CONTENTPEN_PLUGIN_URL', plugin_dir_url(__FILE__)); -
contentpen/tags/1.0.11/includes/class-contentpen-api.php
r3463958 r3464114 220 220 $this->set_post_slug($post_id, isset($params['custom_slug']) ? $params['custom_slug'] : null); 221 221 222 // Handle Yoast SEO if active 223 if ($this->is_yoast_active()) { 224 $this->set_yoast_seo($post_id, $params); 225 } 226 227 // Handle All in One SEO if active 228 if ($this->is_all_in_one_seo_active()) { 229 $this->set_all_in_one_seo($post_id, $params); 230 } 222 // Handle SEO plugins 223 $this->set_seo_meta($post_id, $params); 231 224 232 225 // Handle featured image … … 275 268 private function is_yoast_active() 276 269 { 277 $active_plugins = apply_filters('active_plugins', get_option('active_plugins')); 278 foreach ($active_plugins as $plugin) { 279 if (strpos($plugin, 'wp-seo')) { 280 return true; 281 } 282 } 283 return false; 270 return defined('WPSEO_VERSION') || class_exists('WPSEO_Meta'); 271 } 272 273 private function is_rankmath_active() 274 { 275 return class_exists('RankMath') || defined('RANK_MATH_VERSION'); 284 276 } 285 277 286 278 private function is_all_in_one_seo_active() 287 279 { 288 $active_plugins = apply_filters('active_plugins', get_option('active_plugins')); 289 foreach ($active_plugins as $plugin) { 290 if (strpos($plugin, 'all_in_one_seo_pack')) { 291 return true; 292 } 293 } 294 return false; 295 } 296 297 private function set_yoast_seo($post_id, $params) 298 { 299 // Check if Yoast SEO meta entry exists and create if needed 300 // Using WordPress functions instead of direct database queries 280 return defined('AIOSEO_VERSION') || class_exists('AIOSEO\\Plugin\\AIOSEO'); 281 } 282 283 private function set_seo_meta($post_id, $params) 284 { 285 $meta_title = !empty($params['meta_title']) ? sanitize_text_field($params['meta_title']) : ''; 286 $meta_description = !empty($params['meta_description']) ? sanitize_text_field($params['meta_description']) : ''; 287 288 if (empty($meta_title) && empty($meta_description)) { 289 return; 290 } 291 292 if ($this->is_yoast_active()) { 293 $this->set_yoast_seo($post_id, $meta_title, $meta_description); 294 } 295 296 if ($this->is_rankmath_active()) { 297 $this->set_rankmath_seo($post_id, $meta_title, $meta_description); 298 } 299 300 if ($this->is_all_in_one_seo_active()) { 301 $this->set_all_in_one_seo($post_id, $meta_title, $meta_description); 302 } 303 } 304 305 private function set_yoast_seo($post_id, $meta_title, $meta_description) 306 { 301 307 $internal_link_count = get_post_meta($post_id, '_yoast_wpseo_internal_link_count', true); 302 308 if ($internal_link_count === '') { 303 // Initialize Yoast SEO meta values if they don't exist304 309 update_post_meta($post_id, '_yoast_wpseo_internal_link_count', 0); 305 310 update_post_meta($post_id, '_yoast_wpseo_incoming_link_count', 0); 306 311 } 307 312 308 // Add title and description 309 if (!empty($params['meta_title'])) { 310 update_post_meta($post_id, '_yoast_wpseo_title', sanitize_text_field($params['meta_title'])); 311 } 312 if (!empty($params['meta_description'])) { 313 update_post_meta($post_id, '_yoast_wpseo_metadesc', sanitize_text_field($params['meta_description'])); 313 if (!empty($meta_title)) { 314 update_post_meta($post_id, '_yoast_wpseo_title', $meta_title); 315 } 316 if (!empty($meta_description)) { 317 update_post_meta($post_id, '_yoast_wpseo_metadesc', $meta_description); 318 } 319 } 320 321 private function set_rankmath_seo($post_id, $meta_title, $meta_description) 322 { 323 if (!empty($meta_title)) { 324 update_post_meta($post_id, 'rank_math_title', $meta_title); 325 } 326 if (!empty($meta_description)) { 327 update_post_meta($post_id, 'rank_math_description', $meta_description); 314 328 } 315 329 } … … 496 510 } 497 511 498 private function set_all_in_one_seo($post_id, $params) 499 { 500 if (!empty($params['meta_title'])) { 501 update_post_meta($post_id, '_aioseop_title', sanitize_text_field($params['meta_title'])); 502 } 503 if (!empty($params['meta_description'])) { 504 update_post_meta($post_id, '_aioseop_description', sanitize_text_field($params['meta_description'])); 512 private function set_all_in_one_seo($post_id, $meta_title, $meta_description) 513 { 514 // AIOSEO v4+ stores data in custom table (wp_aioseo_posts), not postmeta 515 if (class_exists('AIOSEO\\Plugin\\Models\\Post')) { 516 $aioseo_post = \AIOSEO\Plugin\Models\Post::getPost($post_id); 517 518 if (!empty($meta_title)) { 519 $aioseo_post->title = $meta_title; 520 } 521 if (!empty($meta_description)) { 522 $aioseo_post->description = $meta_description; 523 } 524 525 $aioseo_post->save(); 526 return; 527 } 528 529 // Fallback: Direct database insert/update for AIOSEO v4+ 530 if (defined('AIOSEO_VERSION')) { 531 global $wpdb; 532 $table_name = $wpdb->prefix . 'aioseo_posts'; 533 534 if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") === $table_name) { 535 $existing = $wpdb->get_row($wpdb->prepare( 536 "SELECT id FROM $table_name WHERE post_id = %d", 537 $post_id 538 )); 539 540 $data = array( 541 'post_id' => $post_id, 542 'title' => $meta_title ?: null, 543 'description' => $meta_description ?: null, 544 'updated' => current_time('mysql') 545 ); 546 547 if ($existing) { 548 $wpdb->update($table_name, $data, array('post_id' => $post_id)); 549 } else { 550 $data['created'] = current_time('mysql'); 551 $wpdb->insert($table_name, $data); 552 } 553 return; 554 } 555 } 556 557 // Legacy AIOSEO (pre v4) fallback using postmeta 558 if (!empty($meta_title)) { 559 update_post_meta($post_id, '_aioseop_title', $meta_title); 560 } 561 if (!empty($meta_description)) { 562 update_post_meta($post_id, '_aioseop_description', $meta_description); 505 563 } 506 564 } … … 668 726 $this->set_post_slug($post_id, isset($params['custom_slug']) ? $params['custom_slug'] : null); 669 727 670 // Handle Yoast SEO if active 671 if ($this->is_yoast_active()) { 672 $this->set_yoast_seo($post_id, $params); 673 } 674 675 // Handle All in One SEO if active 676 if ($this->is_all_in_one_seo_active()) { 677 $this->set_all_in_one_seo($post_id, $params); 678 } 728 // Handle SEO plugins 729 $this->set_seo_meta($post_id, $params); 679 730 680 731 // Handle featured image -
contentpen/trunk/README.txt
r3463958 r3464114 4 4 Requires at least: 5.8 5 5 Tested up to: 6.9.1 6 Stable tag: 1.0.1 06 Stable tag: 1.0.11 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 55 55 == Changelog == 56 56 57 = 1.0.11 = 58 * Added support for Rank Math and All in One SEO plugins 59 57 60 = 1.0.10 = 58 61 * Removed unused GET /posts endpoint that caused route conflicts in some wordpress versions. … … 76 79 == Upgrade Notice == 77 80 81 = 1.0.11 = 82 * Added support for Rank Math and All in One SEO plugins 83 78 84 = 1.0.10 = 79 85 * Removed unused GET /posts endpoint that caused route conflicts in some wordpress versions. -
contentpen/trunk/contentpen-plugin.php
r3463958 r3464114 5 5 * Plugin URI: https://contentpen.ai 6 6 * Description: Contentpen is an AI-powered content writing assistant designed to help businesses create, optimize, and publish SEO-friendly blog posts at scale. By combining deep research with your brand's unique voice, Contentpen crafts high-impact articles that outperform your competition. 7 * Version: 1.0.1 07 * Version: 1.0.11 8 8 * Requires at least: 5.8 9 9 * Requires PHP: 7.4 … … 20 20 } 21 21 22 define('CONTENTPEN_VERSION', '1.0.1 0');22 define('CONTENTPEN_VERSION', '1.0.11'); 23 23 define('CONTENTPEN_PLUGIN_DIR', plugin_dir_path(__FILE__)); 24 24 define('CONTENTPEN_PLUGIN_URL', plugin_dir_url(__FILE__)); -
contentpen/trunk/includes/class-contentpen-api.php
r3463958 r3464114 220 220 $this->set_post_slug($post_id, isset($params['custom_slug']) ? $params['custom_slug'] : null); 221 221 222 // Handle Yoast SEO if active 223 if ($this->is_yoast_active()) { 224 $this->set_yoast_seo($post_id, $params); 225 } 226 227 // Handle All in One SEO if active 228 if ($this->is_all_in_one_seo_active()) { 229 $this->set_all_in_one_seo($post_id, $params); 230 } 222 // Handle SEO plugins 223 $this->set_seo_meta($post_id, $params); 231 224 232 225 // Handle featured image … … 275 268 private function is_yoast_active() 276 269 { 277 $active_plugins = apply_filters('active_plugins', get_option('active_plugins')); 278 foreach ($active_plugins as $plugin) { 279 if (strpos($plugin, 'wp-seo')) { 280 return true; 281 } 282 } 283 return false; 270 return defined('WPSEO_VERSION') || class_exists('WPSEO_Meta'); 271 } 272 273 private function is_rankmath_active() 274 { 275 return class_exists('RankMath') || defined('RANK_MATH_VERSION'); 284 276 } 285 277 286 278 private function is_all_in_one_seo_active() 287 279 { 288 $active_plugins = apply_filters('active_plugins', get_option('active_plugins')); 289 foreach ($active_plugins as $plugin) { 290 if (strpos($plugin, 'all_in_one_seo_pack')) { 291 return true; 292 } 293 } 294 return false; 295 } 296 297 private function set_yoast_seo($post_id, $params) 298 { 299 // Check if Yoast SEO meta entry exists and create if needed 300 // Using WordPress functions instead of direct database queries 280 return defined('AIOSEO_VERSION') || class_exists('AIOSEO\\Plugin\\AIOSEO'); 281 } 282 283 private function set_seo_meta($post_id, $params) 284 { 285 $meta_title = !empty($params['meta_title']) ? sanitize_text_field($params['meta_title']) : ''; 286 $meta_description = !empty($params['meta_description']) ? sanitize_text_field($params['meta_description']) : ''; 287 288 if (empty($meta_title) && empty($meta_description)) { 289 return; 290 } 291 292 if ($this->is_yoast_active()) { 293 $this->set_yoast_seo($post_id, $meta_title, $meta_description); 294 } 295 296 if ($this->is_rankmath_active()) { 297 $this->set_rankmath_seo($post_id, $meta_title, $meta_description); 298 } 299 300 if ($this->is_all_in_one_seo_active()) { 301 $this->set_all_in_one_seo($post_id, $meta_title, $meta_description); 302 } 303 } 304 305 private function set_yoast_seo($post_id, $meta_title, $meta_description) 306 { 301 307 $internal_link_count = get_post_meta($post_id, '_yoast_wpseo_internal_link_count', true); 302 308 if ($internal_link_count === '') { 303 // Initialize Yoast SEO meta values if they don't exist304 309 update_post_meta($post_id, '_yoast_wpseo_internal_link_count', 0); 305 310 update_post_meta($post_id, '_yoast_wpseo_incoming_link_count', 0); 306 311 } 307 312 308 // Add title and description 309 if (!empty($params['meta_title'])) { 310 update_post_meta($post_id, '_yoast_wpseo_title', sanitize_text_field($params['meta_title'])); 311 } 312 if (!empty($params['meta_description'])) { 313 update_post_meta($post_id, '_yoast_wpseo_metadesc', sanitize_text_field($params['meta_description'])); 313 if (!empty($meta_title)) { 314 update_post_meta($post_id, '_yoast_wpseo_title', $meta_title); 315 } 316 if (!empty($meta_description)) { 317 update_post_meta($post_id, '_yoast_wpseo_metadesc', $meta_description); 318 } 319 } 320 321 private function set_rankmath_seo($post_id, $meta_title, $meta_description) 322 { 323 if (!empty($meta_title)) { 324 update_post_meta($post_id, 'rank_math_title', $meta_title); 325 } 326 if (!empty($meta_description)) { 327 update_post_meta($post_id, 'rank_math_description', $meta_description); 314 328 } 315 329 } … … 496 510 } 497 511 498 private function set_all_in_one_seo($post_id, $params) 499 { 500 if (!empty($params['meta_title'])) { 501 update_post_meta($post_id, '_aioseop_title', sanitize_text_field($params['meta_title'])); 502 } 503 if (!empty($params['meta_description'])) { 504 update_post_meta($post_id, '_aioseop_description', sanitize_text_field($params['meta_description'])); 512 private function set_all_in_one_seo($post_id, $meta_title, $meta_description) 513 { 514 // AIOSEO v4+ stores data in custom table (wp_aioseo_posts), not postmeta 515 if (class_exists('AIOSEO\\Plugin\\Models\\Post')) { 516 $aioseo_post = \AIOSEO\Plugin\Models\Post::getPost($post_id); 517 518 if (!empty($meta_title)) { 519 $aioseo_post->title = $meta_title; 520 } 521 if (!empty($meta_description)) { 522 $aioseo_post->description = $meta_description; 523 } 524 525 $aioseo_post->save(); 526 return; 527 } 528 529 // Fallback: Direct database insert/update for AIOSEO v4+ 530 if (defined('AIOSEO_VERSION')) { 531 global $wpdb; 532 $table_name = $wpdb->prefix . 'aioseo_posts'; 533 534 if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") === $table_name) { 535 $existing = $wpdb->get_row($wpdb->prepare( 536 "SELECT id FROM $table_name WHERE post_id = %d", 537 $post_id 538 )); 539 540 $data = array( 541 'post_id' => $post_id, 542 'title' => $meta_title ?: null, 543 'description' => $meta_description ?: null, 544 'updated' => current_time('mysql') 545 ); 546 547 if ($existing) { 548 $wpdb->update($table_name, $data, array('post_id' => $post_id)); 549 } else { 550 $data['created'] = current_time('mysql'); 551 $wpdb->insert($table_name, $data); 552 } 553 return; 554 } 555 } 556 557 // Legacy AIOSEO (pre v4) fallback using postmeta 558 if (!empty($meta_title)) { 559 update_post_meta($post_id, '_aioseop_title', $meta_title); 560 } 561 if (!empty($meta_description)) { 562 update_post_meta($post_id, '_aioseop_description', $meta_description); 505 563 } 506 564 } … … 668 726 $this->set_post_slug($post_id, isset($params['custom_slug']) ? $params['custom_slug'] : null); 669 727 670 // Handle Yoast SEO if active 671 if ($this->is_yoast_active()) { 672 $this->set_yoast_seo($post_id, $params); 673 } 674 675 // Handle All in One SEO if active 676 if ($this->is_all_in_one_seo_active()) { 677 $this->set_all_in_one_seo($post_id, $params); 678 } 728 // Handle SEO plugins 729 $this->set_seo_meta($post_id, $params); 679 730 680 731 // Handle featured image
Note: See TracChangeset
for help on using the changeset viewer.