晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
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/tabatabaei/.trash/wp-content.1/themes/yuma/inc/ |
Upload File : |
<?php
/**
* Page/Post Metabox
*
* @package yuma
*/
/**
* Class to Renders and save metabox options
*
* @since Yuma 1.0.0
*/
class Yuma_MetaBox {
private $meta_box;
private $fields;
/**
* Constructor
*
* @since Yuma 1.0.0
*
* @access public
*
*/
public function __construct( $meta_box_id, $meta_box_title, $post_type ) {
$this->meta_box = array (
'id' => $meta_box_id,
'title' => $meta_box_title,
'post_type' => $post_type,
);
$this->fields = array(
'yuma-sidebar-position',
'yuma-selected-sidebar',
);
// Add metaboxes
add_action( 'add_meta_boxes', array( $this, 'add' ) );
add_action( 'save_post', array( $this, 'save' ) );
}
/**
* Add Meta Box for multiple post types.
*
* @since Yuma 1.0.0
*
* @access public
*/
public function add($postType) {
if( in_array( $postType, $this->meta_box['post_type'] ) ) {
add_meta_box( $this->meta_box['id'], $this->meta_box['title'], array( $this, 'show' ), $postType );
}
}
/**
* Renders metabox
*
* @since Yuma 1.0.0
*
* @access public
*/
public function show() {
global $post;
$layout_options = yuma_sidebar_position();
$sidebar_options = yuma_selected_sidebar();
// Use nonce for verification
wp_nonce_field( basename( __FILE__ ), 'yuma_custom_meta_box_nonce' );
// Begin the field table and loop ?>
<div id="yuma-ui-tabs" class="ui-tabs">
<ul class="yuma-ui-tabs-nav" id="yuma-ui-tabs-nav">
<li><a href="#frag1"><?php esc_html_e( 'Layout Options', 'yuma' ); ?></a></li>
<li><a href="#frag2"><?php esc_html_e( 'Select Sidebar', 'yuma' ); ?></a></li>
</ul>
<div id="frag1">
<table id="layout-options" class="form-table" width="100%">
<tbody>
<tr>
<?php
$metalayout = get_post_meta( $post->ID, 'yuma-sidebar-position', true );
if( empty( $metalayout ) ){
$metalayout='';
}
foreach ( $layout_options as $value => $url ) :
echo '<label>';
echo '<input type="radio" name="yuma-sidebar-position" value="' . esc_attr( $value ) . '" ' . checked( $metalayout, $value, false ) . ' />';
echo '<img title="' . esc_attr( $value ) . '" src="' . esc_url( $url ) . '"/>';
echo '</label>';
endforeach;
?>
</tr>
</tbody>
</table>
</div>
<div id="frag2">
<table id="sidebar-metabox" class="form-table" width="100%">
<tbody>
<tr>
<?php
$metasidebar = get_post_meta( $post->ID, 'yuma-selected-sidebar', true );
if ( empty( $metasidebar ) ){
$metasidebar='sidebar-1';
}
foreach ( $sidebar_options as $field => $value ) {
?>
<td style="vertical-align: top;">
<label class="description">
<input type="radio" name="yuma-selected-sidebar" value="<?php echo esc_attr( $field ); ?>" <?php checked( $field, $metasidebar ); ?>/> <?php echo esc_html( $value ); ?>
</label>
</td>
<?php
} // end foreach
?>
</tr>
</tbody>
</table>
</div>
</div>
<?php
}
/**
* Save custom metabox data
*
* @action save_post
*
* @since Yuma 1.0.0
*
* @access public
*/
public function save( $post_id ) {
// Checks save status
$is_autosave = wp_is_post_autosave( $post_id );
$is_revision = wp_is_post_revision( $post_id );
$is_valid_nonce = ( isset( $_POST[ 'yuma_nonce' ] ) && wp_verify_nonce( sanitize_key( $_POST[ 'yuma_nonce' ] ), basename( __FILE__ ) ) ) ? 'true' : 'false';
// Exits script depending on save status
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
return;
}
$layout_options = yuma_sidebar_position();
$sidebar_options = yuma_selected_sidebar();
foreach ( $this->fields as $field ) {
// Checks for input and sanitizes/saves if needed
if( isset( $_POST[ $field ] ) ) {
$choices = ( 'yuma-sidebar-position' == $field ) ? $layout_options : $sidebar_options;
update_post_meta( $post_id, $field, yuma_sanitize_meta_select( wp_unslash( $_POST[ $field ] ), $choices ) );
}
} // end foreach
}
}
$post_types = array( 'page', 'post' );
$yuma_metabox = new Yuma_MetaBox(
'yuma-options', //metabox id
esc_html__( 'Yuma Meta Options', 'yuma' ), //metabox title
$post_types //metabox post types
);
/**
* Enqueue scripts and styles for Metaboxes
* @uses wp_enqueue_script, and wp_enqueue_style
*
* @since Yuma 1.0.0
*/
function yuma_enqueue_metabox_scripts( $hook ) {
if( $hook == 'post.php' || $hook == 'post-new.php' ){
//Scripts
wp_enqueue_script( 'yuma-metabox', get_template_directory_uri() . '/assets/js/metabox' . yuma_min() . '.js', array( 'jquery', 'jquery-ui-tabs' ), '2013-10-05' );
//CSS Styles
wp_enqueue_style( 'yuma-metabox-tabs', get_template_directory_uri() . '/assets/css/metabox' . yuma_min() . '.css' );
}
return;
}
add_action( 'admin_enqueue_scripts', 'yuma_enqueue_metabox_scripts', 20 );