← All changes
|
includes/abilities/content/class-get-post-content.php
+3
-11
2.14.2
→
2.14.1
View file →
| @@ -10,9 +10,8 @@ | ||
| 10 | 10 | namespace ThinkRank\Abilities\Content; |
| 11 | 11 | |
| 12 | 12 | use ThinkRank\Abilities\Ability_Base; |
| 13 | 13 | use ThinkRank\SEO\Builder_Content; |
| 14 | -use ThinkRank\SEO\Word_Count_Index; | |
| 15 | 14 | |
| 16 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | 16 | exit; // Exit if accessed directly. |
| 18 | 17 | } |
| @@ -159,18 +158,11 @@ | ||
| 159 | 158 | [ 'status' => 403 ] |
| 160 | 159 | ); |
| 161 | 160 | } |
| 162 | 161 | |
| 163 | - $source = Builder_Content::resolve( $post ); | |
| 164 | - $resolved = trim( wp_strip_all_tags( $source ) ); | |
| 165 | - // Counted over the reading text rather than the body returned, so shortcode | |
| 166 | - // syntax is not counted as words and two words split only by a tag stay | |
| 167 | - // two (#893), and a token of punctuation alone is not a word. Words, | |
| 168 | - // whatever the locale: the field says words. | |
| 169 | - $reading = Word_Count_Index::reading_text( $source ); | |
| 162 | + $resolved = trim( wp_strip_all_tags( Builder_Content::resolve( $post ) ) ); | |
| 163 | + $builder = $this->builder_for( $post_id ); | |
| 170 | 164 | |
| 171 | - $builder = $this->builder_for( $post_id ); | |
| 172 | - | |
| 173 | 165 | $body = $resolved; |
| 174 | 166 | $truncated = false; |
| 175 | 167 | |
| 176 | 168 | if ( isset( $input['max_chars'] ) ) { |
| @@ -193,9 +185,9 @@ | ||
| 193 | 185 | 'content' => $body, |
| 194 | 186 | 'post_content' => (string) $post->post_content, |
| 195 | 187 | 'content_source' => null === $builder ? 'post_content' : 'builder', |
| 196 | 188 | 'builder' => $builder, |
| 197 | - 'word_count' => Word_Count_Index::count_words( $reading ), | |
| 189 | + 'word_count' => '' === $resolved ? 0 : count( preg_split( '/\s+/u', $resolved ) ?: [] ), | |
| 198 | 190 | 'truncated' => $truncated, |
| 199 | 191 | ]; |
| 200 | 192 | } |
| 201 | 193 | |