wp-parsidate.php
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Plugin Name: WP-Parsidate |
| 5 | * Version: 6.3 |
| 6 | * Plugin URI: https://wp-parsi.com/support/ |
| 7 | * Description: Persian package for WordPress, Adds full RTL and Shamsi (Jalali) support for: posts, comments, pages, archives, search, categories, permalinks and all admin sections and TinyMce editor, lists, quick editor. This package has Jalali archive widget. |
| 8 | * Author: WP-Parsi Team |
| 9 | * Author URI: https://wp-parsi.com/ |
| 10 | * Text Domain: wp-parsidate |
| 11 | * Domain Path: /languages |
| 12 | * Requires at least: 5.3 |
| 13 | * Requires PHP: 7.4 |
| 14 | * WC tested up to: 10.9.4 |
| 15 | * License: GPLv3 |
| 16 | * |
| 17 | * WP-Parsidate is free software: you can redistribute it and/or modify |
| 18 | * it under the terms of the GNU General Public License as published by |
| 19 | * the Free Software Foundation, either version 2 of the License, or |
| 20 | * any later version. |
| 21 | * |
| 22 | * WP-Parsidate is distributed in the hope that it will be useful, |
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 | * GNU General Public License for more details. |
| 26 | * |
| 27 | * You should have received a copy of the GNU General Public License |
| 28 | * along with WP-Parsidate. |
| 29 | * |
| 30 | * |
| 31 | * WordPress Parsi Package, Adds Persian language & Jalali date support to your blog |
| 32 | * |
| 33 | * Developers: |
| 34 | * Mobin Ghasempoor ( Developer & Founder ) |
| 35 | * Rest in peace, my friend. 🖤 |
| 36 | * You were not just a great developer, but a genuinely kind person and a wonderful friend. Your passion for technology, your creativity, and the moments we shared will always be remembered. |
| 37 | * The world has lost a great developer, but your code, your ideas, and the memories you left behind will live on. |
| 38 | * You may be gone, but you will never be forgotten. |
| 39 | * RIP, my friend. 🕊️ |
| 40 | * |
| 41 | * Morteza Geransayeh ( Developer & Founder ) |
| 42 | * HamidReza Yazdani ( Developer ) |
| 43 | * Saeed Fard ( Analyst & Developer ) |
| 44 | * Parsa Kafi ( Developer ) |
| 45 | * |
| 46 | * @author Mobin Ghasempoor |
| 47 | * @author Morteza Geransayeh |
| 48 | * @link https://wp-parsi.com/ |
| 49 | * @version 5.1.6 |
| 50 | * @license http://www.gnu.org/licenses/gpl-3.0.html GNU Public License v3.0 |
| 51 | * @package WP-Parsidate |
| 52 | * @subpackage Core |
| 53 | */ |
| 54 | |
| 55 | namespace WPParsidate; |
| 56 | |
| 57 | defined( 'ABSPATH' ) || exit; |
| 58 | |
| 59 | use WPParsidate\Addons\Addons; |
| 60 | use WPParsidate\Admin\Admin; |
| 61 | use WPParsidate\App\App; |
| 62 | use WPParsidate\Block\Blocks; |
| 63 | use WPParsidate\Core\Core; |
| 64 | use WPParsidate\Helper\WordPress; |
| 65 | use WPParsidate\Plugin\{Install, Plugin, WpNotice}; |
| 66 | use WPParsidate\Settings\Settings; |
| 67 | use WPParsidate\Widget\Widget; |
| 68 | |
| 69 | final class WP_Parsidate { |
| 70 | /** |
| 71 | * @var WP_Parsidate|null Class instance |
| 72 | */ |
| 73 | public static ?WP_Parsidate $instance = null; |
| 74 | |
| 75 | public function __construct() { |
| 76 | $this->define(); |
| 77 | $this->include(); |
| 78 | $this->instance(); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Define constant |
| 83 | * |
| 84 | * @return void |
| 85 | */ |
| 86 | private function define(): void { |
| 87 | if ( ! defined( 'WP_PARSI_KEY' ) ) { |
| 88 | define( 'WP_PARSI_KEY', 'wp_parsidate' ); |
| 89 | } |
| 90 | |
| 91 | if ( ! defined( 'WP_PARSI_KEY_SLUG' ) ) { |
| 92 | define( 'WP_PARSI_KEY_SLUG', 'wp-parsidate' ); |
| 93 | } |
| 94 | |
| 95 | if ( ! defined( 'WP_PARSI_KEY_CAP' ) ) { |
| 96 | define( 'WP_PARSI_KEY_CAP', 'WpParsiDate' ); |
| 97 | } |
| 98 | |
| 99 | if ( ! defined( 'WP_PARSI_ROOT' ) ) { |
| 100 | define( 'WP_PARSI_ROOT', __FILE__ ); |
| 101 | } |
| 102 | |
| 103 | if ( ! defined( 'WP_PARSI_DIR' ) ) { |
| 104 | define( 'WP_PARSI_DIR', rtrim( plugin_dir_path( WP_PARSI_ROOT ), '/' ) ); |
| 105 | } |
| 106 | |
| 107 | if ( ! defined( 'WP_PARSI_URL' ) ) { |
| 108 | define( 'WP_PARSI_URL', plugin_dir_url( WP_PARSI_ROOT ) ); |
| 109 | } |
| 110 | |
| 111 | if ( ! defined( 'WP_PARSI_CLASS_PREFIX' ) ) { |
| 112 | define( 'WP_PARSI_CLASS_PREFIX', 'wppd-' ); |
| 113 | } |
| 114 | |
| 115 | if ( ! defined( 'WP_PARSI_INPUT_PREFIX' ) ) { |
| 116 | define( 'WP_PARSI_INPUT_PREFIX', 'wp_parsidate_' ); |
| 117 | } |
| 118 | |
| 119 | add_action( 'after_setup_theme', static function () { |
| 120 | if ( ! function_exists( 'get_plugin_data' ) ) { |
| 121 | require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 122 | } |
| 123 | $pluginData = get_plugin_data( WP_PARSI_ROOT ); |
| 124 | define( 'WP_PARSI_VER', $pluginData['Version'] ); |
| 125 | }, 0 ); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Include required files |
| 130 | * |
| 131 | * @return void |
| 132 | */ |
| 133 | private function include(): void { |
| 134 | require_once __DIR__ . '/vendor/autoload.php'; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Instant classes |
| 139 | * |
| 140 | * @return void |
| 141 | */ |
| 142 | private function instance(): void { |
| 143 | if ( ! defined( 'WP_PARSI_DEBUG_MODE' ) ) { |
| 144 | define( 'WP_PARSI_DEBUG_MODE', Settings::get( 'debug_mode', false ) ); |
| 145 | } |
| 146 | |
| 147 | new Install(); |
| 148 | new Admin(); |
| 149 | new Addons(); |
| 150 | |
| 151 | if ( WordPress::isMultilingualActive() && Settings::get( 'multilingual_support', false ) ) { |
| 152 | if ( |
| 153 | ( defined( 'ICL_LANGUAGE_CODE' ) && 'fa_IR' !== ICL_LANGUAGE_CODE ) || |
| 154 | ( function_exists( 'pll_current_language' ) && ( pll_current_language() !== false && pll_current_language() !== "fa" ) ) |
| 155 | ) { |
| 156 | return; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | new WpNotice(); |
| 161 | new Plugin(); |
| 162 | new App(); |
| 163 | new Core(); |
| 164 | new Widget(); |
| 165 | new Blocks(); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Returns an instance of WP_Parsidate class, makes instance if not exists |
| 170 | * |
| 171 | * @return WP_Parsidate Instance of WP_Parsidate |
| 172 | * @since 2.0 |
| 173 | */ |
| 174 | public static function getInstance(): ?self { |
| 175 | if ( self::$instance === null ) { |
| 176 | self::$instance = new WP_Parsidate(); |
| 177 | } |
| 178 | |
| 179 | return self::$instance; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | WP_Parsidate::getInstance(); |
| 184 | register_activation_hook( __FILE__, array( Install::class, 'update' ) ); |
| 185 |