Merged in feature/314-dev-dev01 (pull request #24)
auto-patch 314-dev-dev01-2024-01-25T04_09_02 * auto-patch 314-dev-dev01-2024-01-25T04_09_02
This commit is contained in:
@@ -157,6 +157,8 @@ class Indexable_Builder {
|
||||
* @required
|
||||
*
|
||||
* @param Indexable_Repository $indexable_repository The indexable repository.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_indexable_repository( Indexable_Repository $indexable_repository ) {
|
||||
$this->indexable_repository = $indexable_repository;
|
||||
@@ -282,9 +284,8 @@ class Indexable_Builder {
|
||||
* the intended action may cause problems when moving from a staging to a
|
||||
* production environment because indexable permalinks may get set incorrectly.
|
||||
*
|
||||
* @param Indexable $indexable The indexable to be saved.
|
||||
*
|
||||
* @api bool $intend_to_save True if YoastSEO intends to save the indexable.
|
||||
* @param bool $intend_to_save True if YoastSEO intends to save the indexable.
|
||||
* @param Indexable $indexable The indexable to be saved.
|
||||
*/
|
||||
$intend_to_save = \apply_filters( 'wpseo_should_save_indexable', $intend_to_save, $indexable );
|
||||
|
||||
@@ -300,9 +301,8 @@ class Indexable_Builder {
|
||||
* Action: 'wpseo_save_indexable' - Allow developers to perform an action
|
||||
* when the indexable is updated.
|
||||
*
|
||||
* @param Indexable $indexable The saved indexable.
|
||||
* @param Indexable $indexable_before The indexable before saving.
|
||||
*
|
||||
* @api Indexable $indexable The saved indexable.
|
||||
*/
|
||||
\do_action( 'wpseo_save_indexable', $indexable, $indexable_before );
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ class Indexable_Hierarchy_Builder {
|
||||
* @required
|
||||
*
|
||||
* @param Indexable_Repository $indexable_repository The indexable repository.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_indexable_repository( Indexable_Repository $indexable_repository ) {
|
||||
$this->indexable_repository = $indexable_repository;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Yoast\WP\SEO\Builders;
|
||||
|
||||
use wpdb;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Post_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Url_Helper;
|
||||
|
||||
@@ -238,7 +238,7 @@ class Indexable_Link_Builder {
|
||||
$attribute = \apply_filters( 'wpseo_image_attribute_containing_id', 'class' );
|
||||
|
||||
while ( $processor->next_tag( $query ) ) {
|
||||
$src = \htmlentities( $processor->get_attribute( 'src' ), ( ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ), \get_bloginfo( 'charset' ) );
|
||||
$src = \htmlentities( $processor->get_attribute( 'src' ), ( \ENT_QUOTES | \ENT_SUBSTITUTE | \ENT_HTML401 ), \get_bloginfo( 'charset' ) );
|
||||
$classes = $processor->get_attribute( $attribute );
|
||||
$id = $this->extract_id_of_classes( $classes );
|
||||
|
||||
@@ -268,13 +268,13 @@ class Indexable_Link_Builder {
|
||||
*/
|
||||
$attribute = \apply_filters( 'wpseo_image_attribute_containing_id', 'class' );
|
||||
|
||||
libxml_use_internal_errors( true );
|
||||
\libxml_use_internal_errors( true );
|
||||
$post_dom = new DOMDocument();
|
||||
$post_dom->loadHTML( '<?xml encoding="' . $charset . '">' . $content );
|
||||
libxml_clear_errors();
|
||||
\libxml_clear_errors();
|
||||
|
||||
foreach ( $post_dom->getElementsByTagName( 'img' ) as $img ) {
|
||||
$src = \htmlentities( $img->getAttribute( 'src' ), ( ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ), $charset );
|
||||
$src = \htmlentities( $img->getAttribute( 'src' ), ( \ENT_QUOTES | \ENT_SUBSTITUTE | \ENT_HTML401 ), $charset );
|
||||
$classes = $img->getAttribute( $attribute );
|
||||
$id = $this->extract_id_of_classes( $classes );
|
||||
|
||||
@@ -311,7 +311,7 @@ class Indexable_Link_Builder {
|
||||
|
||||
$matches = [];
|
||||
|
||||
if ( preg_match( $pattern, $classes, $matches ) ) {
|
||||
if ( \preg_match( $pattern, $classes, $matches ) ) {
|
||||
return (int) $matches[1];
|
||||
}
|
||||
|
||||
@@ -345,11 +345,11 @@ class Indexable_Link_Builder {
|
||||
* @since 21.1
|
||||
*/
|
||||
$should_not_parse_content = \apply_filters( 'wpseo_force_skip_image_content_parsing', $should_not_parse_content );
|
||||
if ( ! $should_not_parse_content && class_exists( WP_HTML_Tag_Processor::class ) ) {
|
||||
if ( ! $should_not_parse_content && \class_exists( WP_HTML_Tag_Processor::class ) ) {
|
||||
return $this->gather_images_wp( $content );
|
||||
}
|
||||
|
||||
if ( ! $should_not_parse_content && class_exists( DOMDocument::class ) ) {
|
||||
if ( ! $should_not_parse_content && \class_exists( DOMDocument::class ) ) {
|
||||
return $this->gather_images_DOMDocument( $content );
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ class Indexable_Link_Builder {
|
||||
$home_url = \wp_parse_url( \home_url() );
|
||||
$current_url = \wp_parse_url( $indexable->permalink );
|
||||
$links = \array_map(
|
||||
function( $link ) use ( $home_url, $indexable ) {
|
||||
function ( $link ) use ( $home_url, $indexable ) {
|
||||
return $this->create_internal_link( $link, $home_url, $indexable );
|
||||
},
|
||||
$links
|
||||
@@ -633,7 +633,7 @@ class Indexable_Link_Builder {
|
||||
return \array_udiff(
|
||||
$links_a,
|
||||
$links_b,
|
||||
static function( SEO_Links $link_a, SEO_Links $link_b ) {
|
||||
static function ( SEO_Links $link_a, SEO_Links $link_b ) {
|
||||
return \strcmp( $link_a->url, $link_b->url );
|
||||
}
|
||||
);
|
||||
|
||||
@@ -83,6 +83,8 @@ class Indexable_Post_Builder {
|
||||
* @required
|
||||
*
|
||||
* @param Indexable_Repository $indexable_repository The indexable repository.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_indexable_repository( Indexable_Repository $indexable_repository ) {
|
||||
$this->indexable_repository = $indexable_repository;
|
||||
|
||||
@@ -44,6 +44,8 @@ trait Indexable_Social_Image_Trait {
|
||||
* @param Image_Helper $image The image helper.
|
||||
* @param Open_Graph_Image_Helper $open_graph_image The Open Graph image helper.
|
||||
* @param Twitter_Image_Helper $twitter_image The Twitter image helper.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_social_image_helpers(
|
||||
Image_Helper $image,
|
||||
@@ -60,6 +62,8 @@ trait Indexable_Social_Image_Trait {
|
||||
*
|
||||
* @param array $alternative_image The alternative image to set.
|
||||
* @param Indexable $indexable The indexable to set image for.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_alternative_image( array $alternative_image, Indexable $indexable ) {
|
||||
if ( ! empty( $alternative_image['image_id'] ) ) {
|
||||
@@ -94,6 +98,8 @@ trait Indexable_Social_Image_Trait {
|
||||
* Sets the Open Graph image meta data for an og image
|
||||
*
|
||||
* @param Indexable $indexable The indexable.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_open_graph_image_meta_data( Indexable $indexable ) {
|
||||
if ( ! $indexable->open_graph_image_id ) {
|
||||
@@ -112,6 +118,8 @@ trait Indexable_Social_Image_Trait {
|
||||
* Handles the social images.
|
||||
*
|
||||
* @param Indexable $indexable The indexable to handle.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function handle_social_images( Indexable $indexable ) {
|
||||
// When the image or image id is set.
|
||||
@@ -144,6 +152,8 @@ trait Indexable_Social_Image_Trait {
|
||||
* Resets the social images.
|
||||
*
|
||||
* @param Indexable $indexable The indexable to set images for.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function reset_social_images( Indexable $indexable ) {
|
||||
$indexable->open_graph_image = null;
|
||||
|
||||
@@ -16,7 +16,7 @@ class Indexable_System_Page_Builder {
|
||||
/**
|
||||
* Mapping of object type to title option keys.
|
||||
*/
|
||||
const OPTION_MAPPING = [
|
||||
public const OPTION_MAPPING = [
|
||||
'search-result' => [
|
||||
'title' => 'title-search-wpseo',
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user