PluginProbe
پارسی دیت – Parsi Date / 3.0.2
پارسی دیت – Parsi Date v3.0.2
6.3 6.2.1 6.2 6.1 5.1.6 5.1.7 5.1.8 5.1.8.2 6.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.0.0-alpha 2.1 2.1.1 2.1.2 2.1.3 2.1.5 All 49 releases
wp-parsidate / wp-parsidate.php

wp-parsidate.php in پارسی دیت – Parsi Date 3.0.2, at wp-parsidate.php

213 lines 5.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WP-Parsidate
4 * Version: 3.0.2
5 * Plugin URI: https://wp-parsi.com/support/
6 * 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.
7 * Author: WP-Parsi Team
8 * Author URI: http://wp-parsi.com/
9 * Text Domain: wp-parsidate
10 * Domain Path: parsi-languages
11 * License: GPL3
12 *
13 * WP-Parsidate is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 2 of the License, or
16 * any later version.
17 *
18 * WP-Parsidate is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with WP-Parsidate.
25 *
26 *
27 * WordPress Parsi Package, Adds Persian language & Jalali date support to your blog
28 *
29 * Developers:
30 * Mobin Ghasempoor ( Senior programmer & Founder )
31 * Morteza Geransayeh ( Senior programmer & Manager )
32 * Alireza Dabiri Nejad ( Programmer )
33 * Ehsaan ( Programmer )
34 * Farhan Nisi ( Programmer )
35 * Parsa Kafi ( Programmer )
36 * Mostafa Soufi ( Programmer )
37 * Ali Aghdam ( Programmer )
38 * Kamran Khorsandi ( Programmer )
39 * Mehrshad Darzi ( Programmer )
40 * Saeed Fard ( Analyst )
41 *
42 * @author Mobin Ghasempoor
43 * @author Morteza Geransayeh
44 * @author Alireza Dabiri Nejad
45 * @link http://wp-parsi.com/
46 * @version 3.0.1
47 * @license http://www.gnu.org/licenses/gpl-3.0.html GNU Public License v3.0
48 * @package WP-Parsidate
49 * @subpackage Core
50 */
51
52
53 if (!defined('ABSPATH')) exit; //No direct access allowed
54
55 final class WP_Parsidate
56 {
57 /**
58 * @var WP_Parsidate Class instance
59 */
60 public static $instance = null;
61
62 private function __construct()
63 {
64 $this->define_const();
65 $this->setup_vars();
66 $this->include_files();
67 add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'parsi_settings_link'));
68 add_action('widgets_init', array($this, 'register_widget'));
69 }
70
71 /**
72 * Sets up constants for plugin
73 *
74 * @return void
75 * @since 2.0
76 */
77 private function define_const()
78 {
79 if (!defined('WP_PARSI_ROOT')) {
80 define('WP_PARSI_ROOT', __FILE__);
81 }
82
83 if (!defined('WP_PARSI_DIR')) {
84 define('WP_PARSI_DIR', plugin_dir_path(WP_PARSI_ROOT));
85 }
86
87 if (!defined('WP_PARSI_URL')) {
88 define('WP_PARSI_URL', plugin_dir_url(WP_PARSI_ROOT));
89 }
90
91 if (!defined('WP_PARSI_VER')) {
92 define('WP_PARSI_VER', '2.2');
93 }
94 }
95
96 /**
97 * Sets up global variables
98 *
99 * @return void
100 * @since 2.0
101 */
102 private function setup_vars()
103 {
104 global $persian_month_names;
105 $persian_month_names = array(
106 '',
107 'فروردین',
108 'اردیبهشت',
109 'خرداد',
110 'تیر',
111 '�
112 رداد',
113 'شهریور',
114 '�
115 هر',
116 'آبان',
117 'آذر',
118 'دی',
119 'به�
120 ن',
121 'اسفند'
122 );
123 }
124
125 /**
126 * Includes files for plugin
127 *
128 * @return void
129 * @since 2.0
130 */
131 public function include_files()
132 {
133 require_once(WP_PARSI_DIR . 'includes/settings.php');
134 global $wpp_settings;
135 $wpp_settings = wp_parsi_get_settings();
136
137 $files = array(
138 'parsidate',
139 'general',
140 'fixes-archive',
141 'fixes-permalinks',
142 'fixes-dates',
143 'fixes-misc',
144 'admin/styles-fix',
145 //'admin/datepicker-rtl',
146 'admin/gutenberg-jalali-calendar',
147 'admin/lists-fix',
148 'admin/widgets',
149 'fixes-calendar',
150 'fixes-archives',
151 'plugins/woocommerce',
152 //'plugins/fixes-woo',
153 'plugins/edd',
154 'plugins/disable',
155 'widget/widget_archive',
156 'widget/widget_calendar'
157 );
158
159 foreach ($files as $file) {
160 require_once(WP_PARSI_DIR . 'includes/' . $file . '.php');
161 }
162
163 if (get_locale() == 'fa_IR') {
164 load_textdomain('wp-parsidate', WP_PARSI_DIR . 'languages/fa_IR.mo');
165 }
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 get_instance()
175 {
176 if (self::$instance == null) {
177 self::$instance = new WP_Parsidate();
178 }
179
180 return self::$instance;
181 }
182
183 /**
184 * Add Setting Link To Install Plugin
185 *
186 * @param array $links
187 *
188 * @return array
189 */
190 public static function parsi_settings_link($links)
191 {
192 $settings_link = array('<a href="' . menu_page_url('wp-parsi-settings', false) . '">' . __('settings', 'wp-parsidate') . '</a>');
193
194 return array_merge($links, $settings_link);
195 }
196
197 /**
198 * Register Plugin Widgets
199 *
200 * @return boolean
201 * @since 2.0
202 */
203 public function register_widget()
204 {
205 register_widget('parsidate_archive');
206 register_widget('parsidate_calendar');
207
208 return true;
209 }
210 }
211
212 return WP_Parsidate::get_instance();
213