Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/wordpres.../src/models
File: indexable.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Models;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\Lib\Model;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Indexable table definition.
[7] Fix | Delete
*
[8] Fix | Delete
* @property int $id
[9] Fix | Delete
* @property int $object_id
[10] Fix | Delete
* @property string $object_type
[11] Fix | Delete
* @property string $object_sub_type
[12] Fix | Delete
*
[13] Fix | Delete
* @property int $author_id
[14] Fix | Delete
* @property int $post_parent
[15] Fix | Delete
*
[16] Fix | Delete
* @property string $created_at
[17] Fix | Delete
* @property string $updated_at
[18] Fix | Delete
*
[19] Fix | Delete
* @property string $permalink
[20] Fix | Delete
* @property string $permalink_hash
[21] Fix | Delete
* @property string $canonical
[22] Fix | Delete
*
[23] Fix | Delete
* @property bool $is_robots_noindex
[24] Fix | Delete
* @property bool $is_robots_nofollow
[25] Fix | Delete
* @property bool $is_robots_noarchive
[26] Fix | Delete
* @property bool $is_robots_noimageindex
[27] Fix | Delete
* @property bool $is_robots_nosnippet
[28] Fix | Delete
*
[29] Fix | Delete
* @property string $title
[30] Fix | Delete
* @property string $description
[31] Fix | Delete
* @property string $breadcrumb_title
[32] Fix | Delete
*
[33] Fix | Delete
* @property bool $is_cornerstone
[34] Fix | Delete
*
[35] Fix | Delete
* @property string $primary_focus_keyword
[36] Fix | Delete
* @property int $primary_focus_keyword_score
[37] Fix | Delete
*
[38] Fix | Delete
* @property int $readability_score
[39] Fix | Delete
*
[40] Fix | Delete
* @property int $link_count
[41] Fix | Delete
* @property int $incoming_link_count
[42] Fix | Delete
* @property int $number_of_pages
[43] Fix | Delete
*
[44] Fix | Delete
* @property string $open_graph_title
[45] Fix | Delete
* @property string $open_graph_description
[46] Fix | Delete
* @property string $open_graph_image
[47] Fix | Delete
* @property string $open_graph_image_id
[48] Fix | Delete
* @property string $open_graph_image_source
[49] Fix | Delete
* @property string $open_graph_image_meta
[50] Fix | Delete
*
[51] Fix | Delete
* @property string $twitter_title
[52] Fix | Delete
* @property string $twitter_description
[53] Fix | Delete
* @property string $twitter_image
[54] Fix | Delete
* @property string $twitter_image_id
[55] Fix | Delete
* @property string $twitter_image_source
[56] Fix | Delete
* @property string $twitter_card
[57] Fix | Delete
*
[58] Fix | Delete
* @property int $prominent_words_version
[59] Fix | Delete
*
[60] Fix | Delete
* @property bool $is_public
[61] Fix | Delete
* @property bool $is_protected
[62] Fix | Delete
* @property string $post_status
[63] Fix | Delete
* @property bool $has_public_posts
[64] Fix | Delete
*
[65] Fix | Delete
* @property int $blog_id
[66] Fix | Delete
*
[67] Fix | Delete
* @property string $language
[68] Fix | Delete
* @property string $region
[69] Fix | Delete
*
[70] Fix | Delete
* @property string $schema_page_type
[71] Fix | Delete
* @property string $schema_article_type
[72] Fix | Delete
*
[73] Fix | Delete
* @property bool $has_ancestors
[74] Fix | Delete
*
[75] Fix | Delete
* @property int $estimated_reading_time_minutes
[76] Fix | Delete
*
[77] Fix | Delete
* @property int $version
[78] Fix | Delete
*/
[79] Fix | Delete
class Indexable extends Model {
[80] Fix | Delete
[81] Fix | Delete
/**
[82] Fix | Delete
* Holds the ancestors.
[83] Fix | Delete
*
[84] Fix | Delete
* @var Indexable[]
[85] Fix | Delete
*/
[86] Fix | Delete
public $ancestors = [];
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* Whether nor this model uses timestamps.
[90] Fix | Delete
*
[91] Fix | Delete
* @var bool
[92] Fix | Delete
*/
[93] Fix | Delete
protected $uses_timestamps = true;
[94] Fix | Delete
[95] Fix | Delete
/**
[96] Fix | Delete
* Which columns contain boolean values.
[97] Fix | Delete
*
[98] Fix | Delete
* @var array
[99] Fix | Delete
*/
[100] Fix | Delete
protected $boolean_columns = [
[101] Fix | Delete
'is_robots_noindex',
[102] Fix | Delete
'is_robots_nofollow',
[103] Fix | Delete
'is_robots_noarchive',
[104] Fix | Delete
'is_robots_noimageindex',
[105] Fix | Delete
'is_robots_nosnippet',
[106] Fix | Delete
'is_cornerstone',
[107] Fix | Delete
'is_public',
[108] Fix | Delete
'is_protected',
[109] Fix | Delete
'has_public_posts',
[110] Fix | Delete
];
[111] Fix | Delete
[112] Fix | Delete
/**
[113] Fix | Delete
* Which columns contain int values.
[114] Fix | Delete
*
[115] Fix | Delete
* @var array
[116] Fix | Delete
*/
[117] Fix | Delete
protected $int_columns = [
[118] Fix | Delete
'id',
[119] Fix | Delete
'object_id',
[120] Fix | Delete
'author_id',
[121] Fix | Delete
'post_parent',
[122] Fix | Delete
'primary_focus_keyword_score',
[123] Fix | Delete
'readability_score',
[124] Fix | Delete
'link_count',
[125] Fix | Delete
'incoming_link_count',
[126] Fix | Delete
'number_of_pages',
[127] Fix | Delete
'prominent_words_version',
[128] Fix | Delete
'blog_id',
[129] Fix | Delete
'estimated_reading_time_minutes',
[130] Fix | Delete
'version',
[131] Fix | Delete
];
[132] Fix | Delete
[133] Fix | Delete
/**
[134] Fix | Delete
* The loaded indexable extensions.
[135] Fix | Delete
*
[136] Fix | Delete
* @var Indexable_Extension[]
[137] Fix | Delete
*/
[138] Fix | Delete
protected $loaded_extensions = [];
[139] Fix | Delete
[140] Fix | Delete
/**
[141] Fix | Delete
* Returns an Indexable_Extension by its name.
[142] Fix | Delete
*
[143] Fix | Delete
* @param string $class_name The class name of the extension to load.
[144] Fix | Delete
*
[145] Fix | Delete
* @return Indexable_Extension|bool The extension.
[146] Fix | Delete
*/
[147] Fix | Delete
public function get_extension( $class_name ) {
[148] Fix | Delete
if ( ! $this->loaded_extensions[ $class_name ] ) {
[149] Fix | Delete
$this->loaded_extensions[ $class_name ] = $this->has_one( $class_name, 'indexable_id', 'id' )->find_one();
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
return $this->loaded_extensions[ $class_name ];
[153] Fix | Delete
}
[154] Fix | Delete
[155] Fix | Delete
/**
[156] Fix | Delete
* Enhances the save method.
[157] Fix | Delete
*
[158] Fix | Delete
* @return bool True on success.
[159] Fix | Delete
*/
[160] Fix | Delete
public function save() {
[161] Fix | Delete
if ( $this->permalink ) {
[162] Fix | Delete
$this->sanitize_permalink();
[163] Fix | Delete
$this->permalink_hash = \strlen( $this->permalink ) . ':' . \md5( $this->permalink );
[164] Fix | Delete
}
[165] Fix | Delete
if ( \strlen( $this->primary_focus_keyword ) > 191 ) {
[166] Fix | Delete
$this->primary_focus_keyword = \mb_substr( $this->primary_focus_keyword, 0, 191, 'UTF-8' );
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
return parent::save();
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
/**
[173] Fix | Delete
* Sanitizes the permalink.
[174] Fix | Delete
*
[175] Fix | Delete
* @return void
[176] Fix | Delete
*/
[177] Fix | Delete
protected function sanitize_permalink() {
[178] Fix | Delete
if ( $this->permalink === 'unindexed' ) {
[179] Fix | Delete
return;
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
$permalink_structure = \get_option( 'permalink_structure' );
[183] Fix | Delete
$permalink_parts = \wp_parse_url( $this->permalink );
[184] Fix | Delete
[185] Fix | Delete
if ( ! isset( $permalink_parts['path'] ) ) {
[186] Fix | Delete
$permalink_parts['path'] = '/';
[187] Fix | Delete
}
[188] Fix | Delete
if ( \substr( $permalink_structure, -1, 1 ) === '/' && \strpos( \substr( $permalink_parts['path'], -5 ), '.' ) === false ) {
[189] Fix | Delete
$permalink_parts['path'] = \trailingslashit( $permalink_parts['path'] );
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
$permalink = '';
[193] Fix | Delete
if ( isset( $permalink_parts['scheme'] ) ) {
[194] Fix | Delete
$permalink .= $permalink_parts['scheme'] . '://';
[195] Fix | Delete
}
[196] Fix | Delete
if ( isset( $permalink_parts['host'] ) ) {
[197] Fix | Delete
$permalink .= $permalink_parts['host'];
[198] Fix | Delete
}
[199] Fix | Delete
if ( isset( $permalink_parts['port'] ) ) {
[200] Fix | Delete
$permalink .= ':' . $permalink_parts['port'];
[201] Fix | Delete
}
[202] Fix | Delete
if ( isset( $permalink_parts['path'] ) ) {
[203] Fix | Delete
$permalink .= $permalink_parts['path'];
[204] Fix | Delete
}
[205] Fix | Delete
if ( isset( $permalink_parts['query'] ) ) {
[206] Fix | Delete
$permalink .= '?' . $permalink_parts['query'];
[207] Fix | Delete
}
[208] Fix | Delete
// We never set the fragment as the fragment is intended to be client-only.
[209] Fix | Delete
$this->permalink = $permalink;
[210] Fix | Delete
}
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function