Files
roi-theme/wp-content/plugins/seo-by-rank-math-pro/includes/modules/schema/video/class-wordpress.php
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

65 lines
1.2 KiB
PHP
Executable File

<?php
/**
* The WordPress
*
* @since 2.0.0
* @package RankMath
* @subpackage RankMath\Schema\Video
* @author Rank Math <support@rankmath.com>
*/
namespace RankMathPro\Schema\Video;
use RankMath\Helper;
use RankMath\Admin\Admin_Helper;
defined( 'ABSPATH' ) || exit;
/**
* WordPress class.
*/
class WordPress {
/**
* Match url.
*
* @param string $url Url to match.
* @return bool
*/
public static function match( $url ) {
$type = wp_check_filetype( $url, wp_get_mime_types() );
if ( ! in_array( strtolower( $type['ext'] ), wp_get_video_extensions(), true ) ) {
return [];
}
return self::fetch_data( $url );
}
/**
* Fetch data.
*
* @param string $url Video Source.
* @return array
*/
private static function fetch_data( $url ) {
$data = [];
$attachment_id = attachment_url_to_postid( $url );
if ( $attachment_id ) {
$video_details = wp_get_attachment_metadata( $attachment_id );
$data = [
'width' => ! empty( $video_details['width'] ) ? $video_details['width'] : '',
'height' => ! empty( $video_details['height'] ) ? $video_details['height'] : '',
];
}
return array_merge(
[
'src' => $url,
'embed' => false,
],
$data
);
}
}