晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
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/public_html/oldTZh/wp-content/plugins/persian-elementor/ |
Upload File : |
<?php
declare(strict_types=1);
namespace PersianElementor;
/**
* Persian Elementor Core Class
* Handles RTL styles, Persian fonts, and template library integration
*/
class PersianElementorCore {
/** @var self Singleton instance */
private static $instance = null;
/** @var string Plugin version */
private const VERSION = '2.7.14';
/** @var array Default plugin options */
private const DEFAULT_OPTIONS = [
'efa-panel-font' => '1',
'efa-iranian-icon' => '1',
'efa-elementor-pro' => '1',
'efa-elementor' => '1',
'efa-all-font' => '1',
'efa-zarinpal-button' => '1'
];
/** @var array Plugin options */
private $options;
/** @return self Get singleton instance */
public static function instance() {
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
/** Constructor */
private function __construct() {
$this->load_options();
$this->init_hooks();
}
/** Load and initialize plugin options */
private function load_options() {
$saved_options = get_option('persian_elementor', []);
$this->options = array_merge(self::DEFAULT_OPTIONS, $saved_options);
// Only update if options are different from saved options
if ($saved_options !== $this->options) {
update_option('persian_elementor', $this->options);
}
}
/** Prevent cloning of the instance */
private function __clone() {}
/** Prevent unserializing of the instance */
public function __wakeup() {}
/** Initialize hooks based on plugin options */
private function init_hooks() {
// RTL styles hooks
if (!empty($this->options['efa-panel-font'])) {
$this->register_rtl_style_hooks();
}
// Persian font hooks
if (!empty($this->options['efa-all-font'])) {
add_action('elementor/frontend/after_enqueue_styles', [$this, 'enqueue_persian_font']);
}
// Iranian icons hooks
if (!empty($this->options['efa-iranian-icon'])) {
add_action('elementor/editor/before_enqueue_scripts', [$this, 'enqueue_icon_styles']);
add_action('elementor/frontend/before_enqueue_styles', [$this, 'enqueue_icon_styles']);
}
// Template library integration
$this->init_template_library();
// Dashboard widget version display
add_action('elementor/admin/dashboard_overview_widget/after_version', [$this, 'add_version_to_dashboard_header']);
}
/** Register RTL style hooks for different contexts */
private function register_rtl_style_hooks() {
add_action('elementor/editor/before_enqueue_scripts', [$this, 'enqueue_rtl_styles']);
add_action('elementor/preview/enqueue_styles', [$this, 'enqueue_rtl_styles']);
add_action('elementor/app/init', [$this, 'enqueue_rtl_styles']);
add_action('admin_enqueue_scripts', [$this, 'enqueue_rtl_styles']);
}
// ASSETS ENQUEUING
/** Enqueue RTL styles based on current context */
public function enqueue_rtl_styles() {
$current_hook = current_filter();
$style_suffix = 'common-rtl.css';
if ($current_hook === 'elementor/editor/before_enqueue_scripts') {
$style_suffix = 'editor-rtl.min.css';
} elseif ($current_hook === 'elementor/preview/enqueue_styles') {
$style_suffix = 'preview-rtl.css';
}
wp_enqueue_style(
'persian-elementor-rtl',
plugins_url("assets/css/$style_suffix", __FILE__),
[],
self::VERSION
);
}
/** Enqueue Persian font styles */
public function enqueue_persian_font() {
wp_enqueue_style(
'persian-elementor-font',
plugins_url('assets/css/font.css', __FILE__),
[],
self::VERSION
);
}
/** Enqueue frontend styles */
public function enqueue_frontend_styles() {
wp_enqueue_style(
'persian-elementor-front',
plugins_url('assets/css/front-rtl.css', __FILE__),
[],
self::VERSION
);
}
/** Enqueue icon styles */
public function enqueue_icon_styles() {
wp_enqueue_style(
'persian-elementor-icon',
plugins_url('includes/icons/efaicons/style.css', __FILE__),
[],
self::VERSION
);
}
// TEMPLATE LIBRARY
/** Initialize the template library functionality */
private function init_template_library() {
add_action('elementor/editor/after_enqueue_scripts', [$this, 'enqueue_template_editor_scripts']);
}
/**
* Enqueue editor scripts for template library
* Injects JavaScript to add the Temply tab to Elementor's template library
*/
public function enqueue_template_editor_scripts() {
wp_add_inline_script('elementor-editor', '
elementor.on("document:loaded", function() {
if ($e.components.get("library").hasTab("templates/temply")) {
return;
}
$e.components.get("library").addTab("templates/temply", {
title: "<a href=\"https://temply.ir/\" target=\"_blank\" style=\"color: #0c0d0e; padding:17px 25px\">قالب های ایرانی</a>",
}, 5);
});
');
}
/** @deprecated Use enqueue_template_editor_scripts() instead */
public function enqueue_template_script() {
$this->enqueue_template_editor_scripts();
}
/** Add Persian Elementor version to Elementor dashboard widget header */
public function add_version_to_dashboard_header() {
echo '<span class="e-overview__version">المنتور فارسی v' . esc_html(self::VERSION) . '</span>';
}
/** @return string The plugin version */
public function get_version() {
return self::VERSION;
}
}
// Initialize plugin
PersianElementorCore::instance();