Submit
Path:
~
/
home
/
b
/
f
/
x
/
bfxleof
/
www
/
wp-content
/
plugins
/
wordpress-seo
/
src
/
builders
/
File Content:
indexable-social-image-trait.php
<?php namespace Yoast\WP\SEO\Builders; use WPSEO_Utils; use Yoast\WP\SEO\Helpers\Image_Helper; use Yoast\WP\SEO\Helpers\Open_Graph\Image_Helper as Open_Graph_Image_Helper; use Yoast\WP\SEO\Helpers\Twitter\Image_Helper as Twitter_Image_Helper; use Yoast\WP\SEO\Models\Indexable; /** * Trait for determine the social image to use in the indexable. * * Represents the trait used in builders for handling social images. */ trait Indexable_Social_Image_Trait { /** * The image helper. * * @var Image_Helper */ protected $image; /** * The Open Graph image helper. * * @var Open_Graph_Image_Helper */ protected $open_graph_image; /** * The Twitter image helper. * * @var Twitter_Image_Helper */ protected $twitter_image; /** * Sets the helpers for the trait. * * @required * * @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. */ public function set_social_image_helpers( Image_Helper $image, Open_Graph_Image_Helper $open_graph_image, Twitter_Image_Helper $twitter_image ) { $this->image = $image; $this->open_graph_image = $open_graph_image; $this->twitter_image = $twitter_image; } /** * Sets the alternative on an indexable. * * @param array $alternative_image The alternative image to set. * @param Indexable $indexable The indexable to set image for. */ protected function set_alternative_image( array $alternative_image, Indexable $indexable ) { if ( ! empty( $alternative_image['image_id'] ) ) { if ( ! $indexable->open_graph_image_source && ! $indexable->open_graph_image_id ) { $indexable->open_graph_image_id = $alternative_image['image_id']; $indexable->open_graph_image_source = $alternative_image['source']; $this->set_open_graph_image_meta_data( $indexable ); } if ( ! $indexable->twitter_image && ! $indexable->twitter_image_id ) { $indexable->twitter_image = $this->twitter_image->get_by_id( $alternative_image['image_id'] ); $indexable->twitter_image_id = $alternative_image['image_id']; $indexable->twitter_image_source = $alternative_image['source']; } } if ( ! empty( $alternative_image['image'] ) ) { if ( ! $indexable->open_graph_image_source && ! $indexable->open_graph_image_id ) { $indexable->open_graph_image = $alternative_image['image']; $indexable->open_graph_image_source = $alternative_image['source']; } if ( ! $indexable->twitter_image && ! $indexable->twitter_image_id ) { $indexable->twitter_image = $alternative_image['image']; $indexable->twitter_image_source = $alternative_image['source']; } } } /** * Sets the Open Graph image meta data for an og image * * @param Indexable $indexable The indexable. */ protected function set_open_graph_image_meta_data( Indexable $indexable ) { if ( ! $indexable->open_graph_image_id ) { return; } $image = $this->open_graph_image->get_image_by_id( $indexable->open_graph_image_id ); if ( ! empty( $image ) ) { $indexable->open_graph_image = $image['url']; $indexable->open_graph_image_meta = WPSEO_Utils::format_json_encode( $image ); } } /** * Handles the social images. * * @param Indexable $indexable The indexable to handle. */ protected function handle_social_images( Indexable $indexable ) { // When the image or image id is set. if ( $indexable->open_graph_image || $indexable->open_graph_image_id ) { $indexable->open_graph_image_source = 'set-by-user'; $this->set_open_graph_image_meta_data( $indexable ); } if ( $indexable->twitter_image || $indexable->twitter_image_id ) { $indexable->twitter_image_source = 'set-by-user'; } if ( $indexable->twitter_image_id ) { $indexable->twitter_image = $this->twitter_image->get_by_id( $indexable->twitter_image_id ); } // When image sources are set already. if ( $indexable->open_graph_image_source && $indexable->twitter_image_source ) { return; } $alternative_image = $this->find_alternative_image( $indexable ); if ( ! empty( $alternative_image ) ) { $this->set_alternative_image( $alternative_image, $indexable ); } } /** * Resets the social images. * * @param Indexable $indexable The indexable to set images for. */ protected function reset_social_images( Indexable $indexable ) { $indexable->open_graph_image = null; $indexable->open_graph_image_id = null; $indexable->open_graph_image_source = null; $indexable->open_graph_image_meta = null; $indexable->twitter_image = null; $indexable->twitter_image_id = null; $indexable->twitter_image_source = null; } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
.DS_Store
10234 bytes
0644
20200616130143_ReplacePermalinkHashIndex.php
2293 bytes
0644
AjaxController-20260704221224.php
2162 bytes
0644
AjaxController.php
2162 bytes
0644
DownloadConfController.php
945 bytes
0644
JsonSerializable.php
577 bytes
0644
LimitStream.php
4209 bytes
0644
article-modified-time-presenter.php
609 bytes
0644
class-admin-utils-20260622095013.php
2147 bytes
0644
class-metabox-formatter.php
12602 bytes
0644
class-sitemaps-admin-20260703023908.php
3665 bytes
0644
class-sitemaps-admin.php
3665 bytes
0644
class-taxonomy-columns.php
7324 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
class.web.services-20260704233826.php
7748 bytes
0644
class.web.services.php
7748 bytes
0644
define.php
4567 bytes
0644
duplicator.php
1781 bytes
0644
elFinderPlugin-20260706080701.php
3331 bytes
0644
elFinderPlugin.php
3331 bytes
0644
elFinderVolumeDropbox.class.php
41782 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260624113005.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
environment-helper.php
596 bytes
0644
estimated-reading-time.php
1111 bytes
0644
exceptions-20260707093653.php
708 bytes
0644
exceptions.php
708 bytes
0644
get-request-conditional.php
466 bytes
0644
image-helper.php
10231 bytes
0644
inc.data.php
5121 bytes
0644
inc.validator.php
5401 bytes
0644
index.php
0 bytes
0644
indexable-author-builder.php
3338 bytes
0644
indexable-date-archive-builder.php
1203 bytes
0644
indexable-hierarchy-builder.php
11018 bytes
0644
indexable-home-page-builder.php
2391 bytes
0644
indexable-post-type-archive-builder.php
2379 bytes
0644
indexable-social-image-trait.php
4827 bytes
0644
indexable-system-page-builder.php
1708 bytes
0644
indexable-term-builder.php
5519 bytes
0644
interface-sitemap-cache-data.php
1208 bytes
0644
loco.php
5626 bytes
0644
loco.xml
657 bytes
0644
manager.php
14659 bytes
0644
module.php
1297 bytes
0644
primary-category.php
1998 bytes
0644
quick-edit-handler-1650.js
1848 bytes
0644
uninstall.php
4401 bytes
0644
wordpress-seo-es_ES.json
25583 bytes
0644
wordpress-seojs-ar.json
25925 bytes
0644
wordpress-seojs-bs_BA.json
13790 bytes
0644
wordpress-seojs-gl_ES.json
20143 bytes
0644
wordpress-seojs-ja.json
21424 bytes
0644
wordpress-seojs-uk.json
26506 bytes
0644
N4ST4R_ID | Naxtarrr