晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
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/classes/ |
Upload File : |
<?php
/**
* @package Admin
* @since 1.6.0
* @version 1.6.0
*/
// Avoid direct calls to this file.
if ( ! class_exists( 'WPSEO_Video_Sitemap' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
if ( ! class_exists( 'WPSEO_Video_Metabox' ) ) {
/**
* This class adds the Video tab to the WP SEO metabox and makes sure the settings are saved.
*/
class WPSEO_Video_Metabox extends WPSEO_Metabox {
/**
* Class constructor
*/
public function __construct() {
add_action( 'wpseo_tab_translate', array( $this, 'translate_meta_boxes' ) );
add_filter( 'wpseo_save_metaboxes', array( $this, 'save_meta_boxes' ), 10, 1 );
add_filter( 'wpseo_do_meta_box_field_videositemap-duration', array( $this, 'do_number_field' ), 10, 4 );
add_filter( 'wpseo_do_meta_box_field_videositemap-rating', array( $this, 'do_number_field' ), 10, 4 );
add_filter( 'yoast_free_additional_metabox_sections', array( $this, 'add_metabox_section' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
}
/**
* Translate text strings for use in the meta box
*
* IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to
* the main meta box definition array in the class WPSEO_Meta() as well!!!!
*/
public static function translate_meta_boxes() {
WPSEO_Meta::$meta_fields['video']['videositemap-disable']['title'] = __( 'Disable video', 'yoast-video-seo' );
/* translators: %s: post type name. */
WPSEO_Meta::$meta_fields['video']['videositemap-disable']['expl'] = __( 'Disable video for this %s', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-thumbnail']['title'] = __( 'Video Thumbnail', 'yoast-video-seo' );
/* translators: 1: link open tag; 2: link closing tag. */
WPSEO_Meta::$meta_fields['video']['videositemap-thumbnail']['description'] = __( 'Now set to %1$sthis image%2$s based on the embed code.', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-thumbnail']['placeholder'] = __( 'URL to thumbnail image (remember it\'ll be displayed as 16:9)', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-duration']['title'] = __( 'Video Duration', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-duration']['description'] = __( 'Overwrite the video duration, or enter one if it\'s empty.', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-tags']['title'] = __( 'Tags', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-tags']['description'] = __( 'Add extra tags for this video', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-category']['title'] = __( 'Category', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-category']['description'] = __( 'Override video category for this video', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-rating']['title'] = __( 'Rating', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-rating']['description'] = __( 'Set a rating between 0 and 5.', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-not-family-friendly']['title'] = __( 'Not Family-friendly', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-not-family-friendly']['expl'] = __( 'Mark this video as not Family-friendly', 'yoast-video-seo' );
WPSEO_Meta::$meta_fields['video']['videositemap-not-family-friendly']['description'] = __( 'If this video should not be available for safe search users, check this box.', 'yoast-video-seo' );
}
/**
* Helper function to check if the metabox functionality should be loaded
*
* @return bool
*/
public function has_video() {
if ( isset( $GLOBALS['post']->ID ) ) {
$video = WPSEO_Meta::get_value( 'video_meta', $GLOBALS['post']->ID );
if ( is_array( $video ) && $video !== array() ) {
return true;
}
}
return false;
}
/**
* Adds a video section to the metabox sections array.
*
* @param array $sections The sections to add.
*
* @return array
*/
public function add_metabox_section( $sections ) {
if ( ! $this->should_show_metabox() ) {
return $sections;
}
if ( $this->has_video() ) {
$content = '';
foreach ( WPSEO_Meta::get_meta_field_defs( 'video' ) as $meta_key => $meta_field ) {
$content .= $this->do_meta_box( $meta_field, $meta_key );
}
}
else {
$content = '<p>' . __( 'It looks like your content does not yet contain a video. Please add a video and save your draft in order for Video SEO to work.', 'yoast-video-seo' ) . '</p>';
}
$sections[] = array(
'name' => 'video',
'link_content' => '<span class="dashicons dashicons-admin-plugins"></span>' . esc_html__( 'Video', 'yoast-video-seo' ),
'content' => $content,
);
return $sections;
}
/**
* Filter over the meta boxes to save, this function adds the Video meta box fields.
*
* @param array $field_defs Array of metaboxes to save.
*
* @return array
*/
public function save_meta_boxes( $field_defs ) {
return array_merge( $field_defs, WPSEO_Meta::get_meta_field_defs( 'video' ) );
}
/**
* Form field generator for number fields in WPSEO metabox
*
* @param string $content The current content of the metabox.
* @param mixed $meta_value The meta value to use for the form field.
* @param string $esc_form_key The pre-escaped key for the form field.
* @param array $options Contains the min and max value of the number field, if relevant.
*
* @return string
*/
public function do_number_field( $content, $meta_value, $esc_form_key, $options = array() ) {
$options = $options['options'];
$minvalue = '';
$maxvalue = '';
$step = '';
if ( isset( $options['min_value'] ) ) {
$minvalue = ' min="' . $options['min_value'] . '" ';
}
if ( isset( $options['max_value'] ) ) {
$maxvalue = ' max="' . $options['max_value'] . '" ';
}
if ( isset( $options['step'] ) ) {
$step = ' step="' . $options['step'] . '" ';
}
$content .= '<input type="number" id="' . $esc_form_key . '" name="' . $esc_form_key . '" value="' . $meta_value . '"' . $minvalue . $maxvalue . $step . 'class="small-text" /><br />';
return $content;
}
/**
* Flattens a version number for use in a filename
*
* @param string $version The original version number.
*
* @return string The flattened version number.
*/
public function flatten_version( $version ) {
$parts = explode( '.', $version );
if ( count( $parts ) === 2 && preg_match( '/^\d+$/', $parts[1] ) === 1 ) {
$parts[] = '0';
}
return implode( '', $parts );
}
/**
* Enqueues the plugin scripts.
*/
public function enqueue_scripts() {
global $pagenow;
wp_enqueue_script( 'wp-seo-video-seo', plugins_url( 'js/yoast-video-seo-plugin-' . $this->flatten_version( WPSEO_VIDEO_VERSION ) . WPSEO_CSSJS_SUFFIX . '.js', WPSEO_VIDEO_FILE ), array(), WPSEO_VERSION, true );
if ( $pagenow === 'post.php' || $pagenow === 'post-new.php' ) {
wp_enqueue_style( 'wpseo-video-admin-metabox-css', plugins_url( 'css/admin-metabox' . WPSEO_CSSJS_SUFFIX . '.css', WPSEO_VIDEO_FILE ), array(), WPSEO_VIDEO_VERSION );
}
wp_localize_script( 'wp-seo-video-seo', 'wpseoVideoL10n', $this->localize_video_script() );
}
/**
* Check if the post type the user is currently editing is shown in the sitemaps. If so, the video metabox should be shown.
*
* @return bool
*/
private function should_show_metabox() {
return WPSEO_Video_Utils::is_videoseo_active_for_posttype( get_post_type() );
}
/**
* Localizes scripts for the videoplugin.
*
* @return array
*/
private function localize_video_script() {
return array(
'has_video' => $this->has_video(),
'script_url' => plugins_url( 'js/yoast-video-seo-worker-' . $this->flatten_version( WPSEO_VIDEO_VERSION ) . WPSEO_CSSJS_SUFFIX . '.js', WPSEO_VIDEO_FILE ),
'video' => __( 'video', 'yoast-video-seo' ),
'video_title_ok' => __( 'You should consider adding the word "video" in your title, to optimize your ability to be found by people searching for video.', 'yoast-video-seo' ),
'video_title_good' => __( 'You\'re using the word "video" in your title, this optimizes your ability to be found by people searching for video.', 'yoast-video-seo' ),
'video_body_short' => __( 'Your body copy is too short for Search Engines to understand the topic of your video, add some more content describing the contents of the video.', 'yoast-video-seo' ),
'video_body_good' => __( 'Your body copy is at optimal length for your video to be recognized by Search Engines.', 'yoast-video-seo' ),
/* translators: 1: links to https://yoast.com/video-not-showing-search-results, 2: closing link tag */
'video_body_long' => __( 'Your body copy is quite long, make sure that the video is the most important asset on the page, read %1$sthis post%2$s for more info.', 'yoast-video-seo' ),
'video_body_long_url' => '<a target="new" href="https://yoast.com/video-not-showing-search-results/">',
);
}
/* ********************* DEPRECATED METHODS ********************* */
/**
* Output the tab header for the Video tab in the WordPress SEO meta box on edit post pages.
*
* @deprecated 11.9
* @codeCoverageIgnore
*/
public function tab_header() {
_deprecated_function( __METHOD__, '11.9' );
}
/**
* Output the tab content for the Video tab in the WordPress SEO meta box on edit post pages.
*
* @deprecated 11.9
* @codeCoverageIgnore
*/
public function tab_content() {
_deprecated_function( __METHOD__, '11.9' );
}
} /* End of class */
} /* End of class-exists wrapper */