Changeset 3330977
- Timestamp:
- 07/20/2025 03:23:27 PM (9 months ago)
- Location:
- muchat-ai
- Files:
-
- 8 edited
- 1 copied
-
tags/2.0.40 (copied) (copied from muchat-ai/trunk)
-
tags/2.0.40/includes/Models/Page.php (modified) (4 diffs)
-
tags/2.0.40/includes/Models/Post.php (modified) (3 diffs)
-
tags/2.0.40/muchat-ai.php (modified) (2 diffs)
-
tags/2.0.40/readme.txt (modified) (2 diffs)
-
trunk/includes/Models/Page.php (modified) (4 diffs)
-
trunk/includes/Models/Post.php (modified) (3 diffs)
-
trunk/muchat-ai.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
muchat-ai/tags/2.0.40/includes/Models/Page.php
r3330738 r3330977 68 68 $args['post__not_in'] = $pages_to_exclude; 69 69 } 70 71 // Add a WHERE clause to filter out empty content72 add_filter('posts_where', function ($where) {73 global $wpdb;74 $where .= " AND {$wpdb->posts}.post_content != ''";75 return $where;76 }, 10, 1);77 78 70 79 71 // Set pagination parameters … … 151 143 152 144 /** 153 * Check if a page is valid (not a WooCommerce page and has content)154 *155 * @param \WP_Post $page156 * @return bool157 */158 private function is_valid_page($page)159 {160 if (empty($page) || empty($page->post_content)) {161 return false;162 }163 164 $pages_to_exclude = $this->get_pages_to_exclude();165 166 // If the page is one of the excluded system pages, return false167 if (in_array($page->ID, $pages_to_exclude)) {168 return false;169 }170 171 // Check that the content is not empty and not just whitespace characters172 $content = trim(wp_strip_all_tags($page->post_content));173 return !empty($content);174 }175 176 /**177 145 * Get page ID by slug 178 146 */ … … 212 180 protected function format_page($page) 213 181 { 214 if (empty($page->post_content)) {215 return null;216 }217 218 $pages_to_exclude = $this->get_pages_to_exclude();219 220 // If the page is one of the excluded system pages, return null221 if (in_array($page->ID, $pages_to_exclude)) {222 return null;223 }224 225 // Check that the content is not empty and not just whitespace characters226 $content = trim(wp_strip_all_tags($page->post_content));227 if (empty($content)) {228 return null;229 }230 231 182 $data = []; 232 183 $enabled_fields = $this->get_enabled_fields('page'); … … 259 210 } 260 211 261 return $this->formatter->remove_empty_values($data); 212 $cleaned_data = $this->formatter->remove_empty_values($data); 213 214 // Ensure the ID is always present to prevent the page from being filtered out 215 if (!isset($cleaned_data['id'])) { 216 $cleaned_data['id'] = $page->ID; 217 } 218 219 return $cleaned_data; 262 220 } 263 221 -
muchat-ai/tags/2.0.40/includes/Models/Post.php
r3330738 r3330977 63 63 } 64 64 65 // Add a meta query to exclude posts with empty content66 $args['meta_query'] = [67 [68 'key' => '_wp_old_slug', // A non-existent key to satisfy the structure, the real filtering is done by the where filter.69 ],70 ];71 72 // Add a WHERE clause to filter out empty content. This is more efficient than a meta_query on post_content.73 add_filter('posts_where', function ($where) {74 global $wpdb;75 $where .= " AND {$wpdb->posts}.post_content != ''";76 return $where;77 });78 79 65 // Set pagination parameters 80 66 $requested_offset = $params['skip'] ?? 0; … … 134 120 protected function format_post($post) 135 121 { 136 if (empty($post->post_content)) {137 return null;138 }139 140 // Check that the content is not empty and not just whitespace characters141 $content = trim(wp_strip_all_tags($post->post_content));142 if (empty($content)) {143 return null;144 }145 146 122 $data = []; 147 123 $enabled_fields = $this->get_enabled_fields('post'); … … 180 156 } 181 157 182 return $this->formatter->remove_empty_values($data); 158 $cleaned_data = $this->formatter->remove_empty_values($data); 159 160 // Ensure the ID is always present to prevent the post from being filtered out 161 if (!isset($cleaned_data['id'])) { 162 $cleaned_data['id'] = $post->ID; 163 } 164 165 return $cleaned_data; 183 166 } 184 167 -
muchat-ai/tags/2.0.40/muchat-ai.php
r3330925 r3330977 5 5 * Plugin URI: https://mu.chat 6 6 * Description: Muchat, a powerful tool for customer support using artificial intelligence 7 * Version: 2.0. 397 * Version: 2.0.40 8 8 * Author: Muchat 9 9 * Text Domain: muchat-ai … … 27 27 28 28 // Define plugin constants with unique prefix 29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0. 39');29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.40'); 30 30 // define('MUCHAT_AI_CHATBOT_CACHE_DURATION', HOUR_IN_SECONDS); 31 31 define('MUCHAT_AI_CHATBOT_PLUGIN_FILE', __FILE__); -
muchat-ai/tags/2.0.40/readme.txt
r3330925 r3330977 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 2.0. 396 Stable tag: 2.0.40 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 76 76 == Changelog == 77 77 78 = 2.0.40 = 79 * Bugfix: Fix pages api empty value 80 78 81 = 2.0.39 = 79 82 * Feature: Added check app status -
muchat-ai/trunk/includes/Models/Page.php
r3330738 r3330977 68 68 $args['post__not_in'] = $pages_to_exclude; 69 69 } 70 71 // Add a WHERE clause to filter out empty content72 add_filter('posts_where', function ($where) {73 global $wpdb;74 $where .= " AND {$wpdb->posts}.post_content != ''";75 return $where;76 }, 10, 1);77 78 70 79 71 // Set pagination parameters … … 151 143 152 144 /** 153 * Check if a page is valid (not a WooCommerce page and has content)154 *155 * @param \WP_Post $page156 * @return bool157 */158 private function is_valid_page($page)159 {160 if (empty($page) || empty($page->post_content)) {161 return false;162 }163 164 $pages_to_exclude = $this->get_pages_to_exclude();165 166 // If the page is one of the excluded system pages, return false167 if (in_array($page->ID, $pages_to_exclude)) {168 return false;169 }170 171 // Check that the content is not empty and not just whitespace characters172 $content = trim(wp_strip_all_tags($page->post_content));173 return !empty($content);174 }175 176 /**177 145 * Get page ID by slug 178 146 */ … … 212 180 protected function format_page($page) 213 181 { 214 if (empty($page->post_content)) {215 return null;216 }217 218 $pages_to_exclude = $this->get_pages_to_exclude();219 220 // If the page is one of the excluded system pages, return null221 if (in_array($page->ID, $pages_to_exclude)) {222 return null;223 }224 225 // Check that the content is not empty and not just whitespace characters226 $content = trim(wp_strip_all_tags($page->post_content));227 if (empty($content)) {228 return null;229 }230 231 182 $data = []; 232 183 $enabled_fields = $this->get_enabled_fields('page'); … … 259 210 } 260 211 261 return $this->formatter->remove_empty_values($data); 212 $cleaned_data = $this->formatter->remove_empty_values($data); 213 214 // Ensure the ID is always present to prevent the page from being filtered out 215 if (!isset($cleaned_data['id'])) { 216 $cleaned_data['id'] = $page->ID; 217 } 218 219 return $cleaned_data; 262 220 } 263 221 -
muchat-ai/trunk/includes/Models/Post.php
r3330738 r3330977 63 63 } 64 64 65 // Add a meta query to exclude posts with empty content66 $args['meta_query'] = [67 [68 'key' => '_wp_old_slug', // A non-existent key to satisfy the structure, the real filtering is done by the where filter.69 ],70 ];71 72 // Add a WHERE clause to filter out empty content. This is more efficient than a meta_query on post_content.73 add_filter('posts_where', function ($where) {74 global $wpdb;75 $where .= " AND {$wpdb->posts}.post_content != ''";76 return $where;77 });78 79 65 // Set pagination parameters 80 66 $requested_offset = $params['skip'] ?? 0; … … 134 120 protected function format_post($post) 135 121 { 136 if (empty($post->post_content)) {137 return null;138 }139 140 // Check that the content is not empty and not just whitespace characters141 $content = trim(wp_strip_all_tags($post->post_content));142 if (empty($content)) {143 return null;144 }145 146 122 $data = []; 147 123 $enabled_fields = $this->get_enabled_fields('post'); … … 180 156 } 181 157 182 return $this->formatter->remove_empty_values($data); 158 $cleaned_data = $this->formatter->remove_empty_values($data); 159 160 // Ensure the ID is always present to prevent the post from being filtered out 161 if (!isset($cleaned_data['id'])) { 162 $cleaned_data['id'] = $post->ID; 163 } 164 165 return $cleaned_data; 183 166 } 184 167 -
muchat-ai/trunk/muchat-ai.php
r3330925 r3330977 5 5 * Plugin URI: https://mu.chat 6 6 * Description: Muchat, a powerful tool for customer support using artificial intelligence 7 * Version: 2.0. 397 * Version: 2.0.40 8 8 * Author: Muchat 9 9 * Text Domain: muchat-ai … … 27 27 28 28 // Define plugin constants with unique prefix 29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0. 39');29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.40'); 30 30 // define('MUCHAT_AI_CHATBOT_CACHE_DURATION', HOUR_IN_SECONDS); 31 31 define('MUCHAT_AI_CHATBOT_PLUGIN_FILE', __FILE__); -
muchat-ai/trunk/readme.txt
r3330925 r3330977 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 2.0. 396 Stable tag: 2.0.40 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 76 76 == Changelog == 77 77 78 = 2.0.40 = 79 * Bugfix: Fix pages api empty value 80 78 81 = 2.0.39 = 79 82 * Feature: Added check app status
Note: See TracChangeset
for help on using the changeset viewer.