晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/stando/www/wp-content/plugins/wpseo-video/detail-retrieval/ |
Upload File : |
<?php
/**
* @package Internals
* @since 1.7.0
* @version 1.7.0
*/
// Avoid direct calls to this file.
if ( ! class_exists( 'WPSEO_Video_Sitemap' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
/**
*****************************************************************
* Viddler Video SEO Details
*
* Full remote response (serialized) format [2014/7/22] - see below class.
* Also offers oembed support at http://www.viddler.com/oembed/?format=json&url=
*
* @link http://developers.viddler.com/documentation/api-v2/
* @link http://developers.viddler.com/documentation/oembed/
*/
if ( ! class_exists( 'WPSEO_Video_Details_Viddler' ) ) {
/**
* Class WPSEO_Video_Details_Viddler
*/
class WPSEO_Video_Details_Viddler extends WPSEO_Video_Details {
/**
* Regular expression to retrieve a video ID from a known video URL.
*
* @var string
*/
protected $id_regex = '`[/\.]viddler\.com/(?:embed|v|player|file)/([a-z0-9]+)(?:$|[/#\?])`i';
/**
* Sprintf template to create a URL from an ID.
*
* @var string
*/
protected $url_template = 'http://www.viddler.com/v/%s';
/**
* Information on the remote URL to use for retrieving the video details.
*
* @var array
*/
protected $remote_url = array(
'pattern' => 'http://api.viddler.com/api/v2/viddler.videos.getDetails.php?key=0118093f713643444556524f452f&add_embed_code=1&video_id=%s',
'replace_key' => 'id',
'response_type' => 'serial',
);
/**
* The file from the files array which contains the data we need.
*
* @var array
*/
private $video_file = array();
/**
* Use the "new" post data with the old video data, to prevent the need for an external video
* API call when the video hasn't changed.
*
* Match whether old data can be used on video id or on video url if id is not available
*
* @param string $match_on Array key to use in the $vid array to determine whether or not to use the old data
* Defaults to 'url' for this implementation.
*
* @return bool Whether or not valid old data was found (and used)
*/
protected function maybe_use_old_video_data( $match_on = 'url' ) {
if ( ( isset( $this->old_vid['id'] ) && isset( $this->vid['id'] ) ) && $this->old_vid['id'] == $this->vid['id'] ) {
$match_on = 'id';
}
return parent::maybe_use_old_video_data( $match_on );
}
/**
* Retrieve information on a video via a remote API call
*
* Change the $remote_url parameters if id is not available, before passing off to the parent
*
* @return void
*/
protected function get_remote_video_info() {
if ( empty( $this->vid['id'] ) && ! empty( $this->vid['url'] ) ) {
$this->remote_url['pattern'] = str_replace( '&video_id=%s', '&url=%s', $this->remote_url['pattern'] );
$this->remote_url['replace_key'] = 'url';
}
parent::get_remote_video_info();
}
/**
* Check if the response is for a valid video
*
* @return bool
*/
protected function is_video_response() {
return ( ! empty( $this->decoded_response['video'] ) && is_array( $this->decoded_response['video'] ) );
}
/**
* Set video details to their new values (mostly by passing off to the parent method)
*/
protected function put_video_details() {
$this->get_video_file_data();
parent::put_video_details();
}
/**
* Retrieve the file we want to use from the remote response
*/
protected function get_video_file_data() {
if ( isset( $this->decoded_response['video']['files'] ) && is_array( $this->decoded_response['video']['files'] ) && $this->decoded_response['video']['files'] !== array() ) {
foreach ( $this->decoded_response['video']['files'] as $file ) {
if ( ( isset( $file['ext'] ) && $file['ext'] === 'mp4' ) && ( isset( $file['status'] ) && $file['status'] === 'ready' && isset( $file['url'] ) ) && ( is_string( $file['url'] ) && $file['url'] !== '' ) ) {
$this->video_file = $file;
break;
}
}
}
}
/**
* Set the content location
*/
protected function set_content_loc() {
if ( isset( $this->video_file['url'] ) && ( is_string( $this->video_file['url'] ) && $this->video_file['url'] !== '' ) ) {
$this->vid['content_loc'] = $this->video_file['url'];
}
// @todo needs checking if this gives a valid return value, but don't have enough sample data
elseif ( ! empty( $this->decoded_response['video']['html5_video_source'] ) ) {
$this->vid['content_loc'] = $this->decoded_response['video']['html5_video_source'];
}
}
/**
* Set the video duration
*/
protected function set_duration() {
if ( ! empty( $this->decoded_response['video']['length'] ) ) {
$this->vid['duration'] = $this->decoded_response['video']['length'];
}
}
/**
* Set the video height
*/
protected function set_height() {
if ( ! empty( $this->video_file['height'] ) ) {
$this->vid['height'] = $this->video_file['height'];
}
elseif ( ! empty( $this->decoded_response['video']['embed_code'] ) && preg_match( '`<(?:iframe|video).*? height="([0-9]+)"`', $this->decoded_response['video']['embed_code'], $match ) ) {
$this->vid['height'] = $match[1];
}
}
/**
* (Re-)Set the video id
*/
protected function set_id() {
if ( ! empty( $this->decoded_response['video']['id'] ) ) {
$this->vid['id'] = $this->decoded_response['video']['id'];
}
}
/**
* Set the player location
*/
protected function set_player_loc() {
if ( ! empty( $this->vid['id'] ) ) {
$this->vid['player_loc'] = 'http://www.viddler.com/player/' . rawurlencode( $this->vid['id'] ) . '/';
}
}
/**
* Set the thumbnail location
*/
protected function set_thumbnail_loc() {
if ( isset( $this->decoded_response['video']['thumbnail_url'] ) && is_string( $this->decoded_response['video']['thumbnail_url'] ) && $this->decoded_response['video']['thumbnail_url'] !== '' ) {
$image = $this->make_image_local( $this->decoded_response['video']['thumbnail_url'] );
if ( is_string( $image ) && $image !== '' ) {
$this->vid['thumbnail_loc'] = $image;
}
}
}
/**
* Set the video view count
*/
protected function set_view_count() {
if ( ! empty( $this->decoded_response['video']['view_count'] ) ) {
$this->vid['view_count'] = $this->decoded_response['video']['view_count'];
}
}
/**
* Set the video width
*/
protected function set_width() {
if ( ! empty( $this->video_file['width'] ) ) {
$this->vid['width'] = $this->video_file['width'];
}
elseif ( ! empty( $this->decoded_response['video']['embed_code'] ) && preg_match( '`<(?:iframe|video).*? width="([0-9]+)"`', $this->decoded_response['video']['embed_code'], $match ) ) {
$this->vid['width'] = $match[1];
}
}
} /* End of class */
} /* End of class-exists wrapper */
/**
* Remote response (unserialized version of serialized response) format [2014/7/22]:
*
Array
(
[video] => Array
(
[id] => 1646c55
[status] => ready
[author] => cdevroe
[title] => iPhone macro lens demonstration
[upload_time] => 1206114091
[updated_at] => 1206103291
[made_public_time] => 1206104030
[length] => 245
[description] => This video has a better description <a href="http://cdevroe.com/videos/iphone-macrolens-demo/">on my site</a>.
[age_limit] =>
[url] => http://www.viddler.com/v/1646c55
[thumbnail_url] => http://thumbs.cdn-ec.viddler.com/thumbnail_2_1646c55_v1.jpg
[thumbnail_version] => v1
[permalink] => http://www.viddler.com/v/1646c55
[html5_video_source] => http://www.viddler.com/file/1646c55/html5
[view_count] => 8482
[impression_count] => 24042
[favorite] => 0
[comment_count] => 21
[tags] => Array
(
[0] => Array
(
[type] => global
[text] => Colin Devroe
)
[1] => Array
(
[type] => global
[text] => handmade
)
[2] => Array
(
[type] => global
[text] => demo
)
[3] => Array
(
[type] => global
[text] => apple
)
[4] => Array
(
[type] => global
[text] => mobile
)
[5] => Array
(
[type] => global
[text] => diy
)
[6] => Array
(
[type] => global
[text] => iphone
)
[7] => Array
(
[type] => global
[text] => timed
)
[8] => Array
(
[type] => global
[text] => macro
)
[9] => Array
(
[type] => global
[text] => lens
)
[10] => Array
(
[type] => global
[text] => photography
)
[11] => Array
(
[type] => timed
[text] => lens
[offset] => 11390
[thumbnail_url] => http://thumbs.cdn-ec.viddler.com/tagthumbnail_2_718102594727e1ee.jpg
)
[12] => Array
(
[type] => timed
[text] => 66
[offset] => 1870
[thumbnail_url] => http://thumbs.cdn-ec.viddler.com/tagthumbnail_2_7186005b4123e1ee.jpg
)
[13] => Array
(
[type] => timed
[text] => iphone
[offset] => 11390
[thumbnail_url] => http://thumbs.cdn-ec.viddler.com/tagthumbnail_2_718102594725e1ee.jpg
)
)
[embed_code] => <!--[if IE]><object width="545" height="349" id="viddlerOuter-1646c55" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="movie" value="//www.viddler.com/player/1646c55/"><param name="allowScriptAccess" value="always"><param name="allowNetworking" value="all"><param name="allowFullScreen" value="true"><param name="flashVars" value="f=1"><object id="viddlerInner-1646c55"><video id="viddlerVideo-1646c55" src="//www.viddler.com/file/1646c55/html5mobile/" type="video/mp4" width="545" height="307" poster="//www.viddler.com/thumbnail/1646c55/" controls="controls" x-webkit-airplay="allow"></video></object></object><![endif]--> <!--[if !IE]> <!--> <object width="545" height="349" id="viddlerOuter-1646c55" type="application/x-shockwave-flash" data="//www.viddler.com/player/1646c55/"> <param name="movie" value="//www.viddler.com/player/1646c55/"> <param name="allowScriptAccess" value="always"><param name="allowNetworking" value="all"><param name="allowFullScreen" value="true"><param name="flashVars" value="f=1"><object id="viddlerInner-1646c55"> <video id="viddlerVideo-1646c55" src="//www.viddler.com/file/1646c55/html5mobile/" type="video/mp4" width="545" height="307" poster="//www.viddler.com/thumbnail/1646c55/" controls="controls" x-webkit-airplay="allow"></video> </object></object> <!--<![endif]-->
[player_type] => Array
(
[player_type_id] => 1
[player_type] => full
)
[display_aspect_ratio] => 16:9
[closed_captioning_list] => Array
(
)
)
)
*/