403Webshell
Server IP : 172.67.158.161  /  Your IP : 18.216.190.57
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/self/cwd/wp-content/plugins/wordpress-seo/frontend/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/self/cwd/wp-content/plugins/wordpress-seo/frontend//class-opengraph-oembed.php
<?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Frontend
 */

/**
 * Class WPSEO_OpenGraph_OEmbed.
 */
class WPSEO_OpenGraph_OEmbed implements WPSEO_WordPress_Integration {

	/**
	 * Registers the hooks.
	 */
	public function register_hooks() {
		// Check to make sure opengraph is enabled before adding filter.
		if ( WPSEO_Options::get( 'opengraph' ) ) {
			add_filter( 'oembed_response_data', [ $this, 'set_oembed_data' ], 10, 2 );
		}
	}

	/**
	 * Callback function to pass to the oEmbed's response data that will enable
	 * support for using the image and title set by the WordPress SEO plugin's fields. This
	 * address the concern where some social channels/subscribed use oEmebed data over OpenGraph data
	 * if both are present.
	 *
	 * @param array   $data The oEmbed data.
	 * @param WP_Post $post The current Post object.
	 *
	 * @link https://developer.wordpress.org/reference/hooks/oembed_response_data/ for hook info.
	 *
	 * @return array $filter_data - An array of oEmbed data with modified values where appropriate.
	 */
	public function set_oembed_data( $data, $post ) {
		// Data to be returned.
		$filter_data = $data;

		// Look for the Yoast meta values (image and title)...
		$opengraph_title = WPSEO_Meta::get_value( 'opengraph-title', $post->ID );
		$opengraph_image = WPSEO_Meta::get_value( 'opengraph-image', $post->ID );

		// If yoast has a title set, update oEmbed with Yoast's title.
		if ( ! empty( $opengraph_title ) ) {
			$filter_data['title'] = $opengraph_title;
		}

		// If WPSEO Image was _not_ set, return the `$filter_data` as it currently is.
		if ( empty( $opengraph_image ) ) {
			return $filter_data;
		}

		// Since the a WPSEO Image was set, update the oEmbed data with the Yoast Image's info.
		// Get the image's ID from a URL.
		$image_id = WPSEO_Image_Utils::get_attachment_by_url( $opengraph_image );

		// Get the image's info from it's ID.
		$image_info = wp_get_attachment_metadata( $image_id );

		// Update the oEmbed data.
		$filter_data['thumbnail_url'] = $opengraph_image;
		if ( ! empty( $image_info['height'] ) ) {
			$filter_data['thumbnail_height'] = $image_info['height'];
		}
		if ( ! empty( $image_info['width'] ) ) {
			$filter_data['thumbnail_width'] = $image_info['width'];
		}

		return $filter_data;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit