Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -39,6 +39,8 @@ use Yoast\WP\Lib\Model;
*
* @property int $readability_score
*
* @property int $inclusive_language_score
*
* @property int $link_count
* @property int $incoming_link_count
* @property int $number_of_pages
@@ -75,6 +77,11 @@ use Yoast\WP\Lib\Model;
* @property bool $has_ancestors
*
* @property int $estimated_reading_time_minutes
*
* @property string $object_last_modified
* @property string $object_published_at
*
* @property int $version
*/
class Indexable extends Model {
@@ -107,6 +114,7 @@ class Indexable extends Model {
'is_public',
'is_protected',
'has_public_posts',
'has_ancestors',
];
/**
@@ -121,12 +129,14 @@ class Indexable extends Model {
'post_parent',
'primary_focus_keyword_score',
'readability_score',
'inclusive_language_score',
'link_count',
'incoming_link_count',
'number_of_pages',
'prominent_words_version',
'blog_id',
'estimated_reading_time_minutes',
'version',
];
/**
@@ -161,8 +171,8 @@ class Indexable extends Model {
$this->sanitize_permalink();
$this->permalink_hash = \strlen( $this->permalink ) . ':' . \md5( $this->permalink );
}
if ( \strlen( $this->primary_focus_keyword ) > 191 ) {
$this->primary_focus_keyword = \substr( $this->primary_focus_keyword, 0, 191 );
if ( \is_string( $this->primary_focus_keyword ) && \mb_strlen( $this->primary_focus_keyword ) > 191 ) {
$this->primary_focus_keyword = \mb_substr( $this->primary_focus_keyword, 0, 191, 'UTF-8' );
}
return parent::save();
@@ -174,6 +184,10 @@ class Indexable extends Model {
* @return void
*/
protected function sanitize_permalink() {
if ( $this->permalink === 'unindexed' ) {
return;
}
$permalink_structure = \get_option( 'permalink_structure' );
$permalink_parts = \wp_parse_url( $this->permalink );

View File

@@ -12,4 +12,14 @@ use Yoast\WP\Lib\Model;
* @property int $indexable_id The ID of the indexable in which the prominent word is located.
* @property float $weight Currently just the nr. of occurrences (of stemmed prominent word in indexable) But could be any weight value (higher means that it carries more weight in the final calculation).
*/
class Prominent_Words extends Model {}
class Prominent_Words extends Model {
/**
* Which columns contain float values.
*
* @var array
*/
protected $float_columns = [
'weight',
];
}