晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
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/rainic/www/oldTZh/wp-content/plugins/persian-gravity-forms/includes/ |
Upload File : |
<?php
/**
* Developer : MahdiY
* Web Site : MahdiY.IR
* E-Mail : M@hdiY.IR
*/
defined( 'ABSPATH' ) || exit;
class GFPersian_Notice {
public function __construct() {
add_action( 'admin_notices', [ $this, 'admin_notices' ], 5 );
add_action( 'wp_ajax_persian_gf_dismiss_notice', [ $this, 'dismiss_notice' ] );
}
public function admin_notices() {
if ( ! current_user_can( 'manage_options' ) && ! current_user_can( 'manage_woocommerce' ) ) {
return;
}
if ( $this->is_dismiss( 'all' ) ) {
return;
}
foreach ( $this->notices() as $notice ) {
if ( $notice['condition'] == false || $this->is_dismiss( $notice['id'] ) ) {
continue;
}
$dismissible = $notice['dismiss'] ? 'is-dismissible' : '';
$notice_id = esc_attr( $notice['id'] );
$notice_content = strip_tags( $notice['content'], '<p><a><b><img><ul><ol><li>' );
printf( '<div class="notice persian_gf_notice notice-success %s" id="persian_gf_%s"><p>%s</p></div>', $dismissible, $notice_id, $notice_content );
break;
}
?>
<script type="text/javascript">
jQuery(document).ready(function ($) {
jQuery(document.body).on('click', '.notice-dismiss', function () {
let notice = jQuery(this).closest('.persian_gf_notice');
notice = notice.attr('id');
if (notice !== undefined && notice.indexOf('persian_gf_') !== -1) {
notice = notice.replace('persian_gf_', '');
jQuery.ajax({
url: "<?php echo admin_url( 'admin-ajax.php' ) ?>",
type: 'post',
data: {
notice: notice,
action: 'persian_gf_dismiss_notice',
nonce: "<?php echo wp_create_nonce( 'persian_gf_dismiss_notice' ); ?>"
}
});
}
});
});
</script>
<?php
}
public function notices(): array {
global $pagenow;
$page = sanitize_text_field( $_GET['page'] ?? null );
$view = sanitize_text_field( $_GET['view'] ?? null );
$subview = sanitize_text_field( $_GET['subview'] ?? null );
$has_gateland = is_plugin_active( 'gateland/gateland.php' );
$gateland_install_url = admin_url( 'plugin-install.php?tab=plugin-information&plugin=gateland' );
$notices = [
[
'id' => 'gateland_dashboard',
'content' => sprintf( '<b>افزونه درگاه پرداخت هوشمند «گیت لند»:</b> با گیتلند میتوانید فرمهای گرویتی فرمز را به بیش از ۳۴ درگاه پرداخت (واسط و مستقیم) متصل کنید: <a href="%s" target="_blank">نصب سریع و رایگان از مخزن وردپرس</a>', $gateland_install_url ),
'condition' => ! $has_gateland,
'dismiss' => 6 * MONTH_IN_SECONDS,
],
];
$_notices = get_option( 'persian_gf_notices', [] );
foreach ( $_notices['notices'] ?? [] as $_notice ) {
$_notice['condition'] = 1;
$rules = $_notice['rules'];
if ( isset( $rules['pagenow'] ) && $rules['pagenow'] != $pagenow ) {
$_notice['condition'] = 0;
}
if ( isset( $rules['page'] ) && $rules['page'] != $page ) {
$_notice['condition'] = 0;
}
if ( isset( $rules['view'] ) && $rules['view'] != $view ) {
$_notice['condition'] = 0;
}
if ( isset( $rules['subview'] ) && $rules['subview'] != $subview ) {
$_notice['condition'] = 0;
}
if ( isset( $rules['active'] ) && is_plugin_inactive( $rules['active'] ) ) {
$_notice['condition'] = 0;
}
if ( isset( $rules['inactive'] ) && is_plugin_active( $rules['inactive'] ) ) {
$_notice['condition'] = 0;
}
unset( $_notice['rules'] );
array_unshift( $notices, $_notice );
}
return $notices;
}
public function dismiss_notice() {
check_ajax_referer( 'persian_gf_dismiss_notice', 'nonce' );
$this->set_dismiss( $_POST['notice'] );
die();
}
public function set_dismiss( string $notice_id ) {
$notices = wp_list_pluck( $this->notices(), 'dismiss', 'id' );
if ( isset( $notices[ $notice_id ] ) && $notices[ $notice_id ] ) {
update_option( 'persian_gf_dismiss_notice_' . $notice_id, time() + intval( $notices[ $notice_id ] ), 'yes' );
update_option( 'persian_gf_dismiss_notice_all', time() + DAY_IN_SECONDS );
}
}
public function is_dismiss( $notice_id ): bool {
return intval( get_option( 'persian_gf_dismiss_notice_' . $notice_id ) ) >= time();
}
}
new GFPersian_Notice();