PluginProbe
پارسی دیت – Parsi Date / 2.2.0
پارسی دیت – Parsi Date v2.2.0
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 2.2.0, at wp-parsidate.php

178 lines 4.7 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: 2.2
5 * Plugin URI: http://forum.wp-parsi.com/
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 *
12 * WordPress Parsi Package, Adds Persian language & Jalali date support to your blog
13 *
14 * Developers:
15 * Mobin Ghasempoor ( Senior programmer & Founder )
16 * Morteza Geransayeh ( Senior programmer & Manager )
17 * Ehsaan ( Programmer )
18 * Farhan Nisi ( Programmer )
19 * Parsa Kafi ( Programmer )
20 * Saeed Fard ( Analyst )
21 *
22 * @author Mobin Ghasempoor
23 * @author Morteza Geransayeh
24 * @author Farhan Nisi
25 * @author Ehsaan
26 * @link http://wp-parsi.com/
27 * @version 2.2
28 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License v2.0
29 * @package WP-Parsidate
30 * @subpackage Core
31 */
32
33
34 if ( ! defined( 'ABSPATH' ) ) exit; // No direct access allowed
35
36 final class WP_Parsidate {
37 /**
38 * @var WP_Parsidate Class instance
39 */
40 public static $instance = null;
41
42 /**
43 * Returns an instance of WP_Parsidate class, makes instance if not exists
44 *
45 * @since 2.0
46 * @return WP_Parsidate Instance of WP_Parsidate
47 */
48 public static function get_instance() {
49 if ( self::$instance == null )
50 self::$instance = new WP_Parsidate();
51
52 return self::$instance;
53 }
54
55 private function __construct() {
56 $this->consts();
57 $this->setup_vars();
58 $this->include_files();
59 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'parsi_settings_link' ) );
60 }
61
62 /**
63 * Add Setting Link To Install Plugin
64 *
65 * @param string $links
66 * @return array
67 */
68 public static function parsi_settings_link( $links ) {
69 $mylinks = array('<a href="'.menu_page_url('wp-parsi-settings',FALSE).'">'.__('settings','wp-parsidate').'</a>');
70 return array_merge( $links, $mylinks );
71 }
72
73 /**
74 * Sets up constants for plugin
75 *
76 * @since 2.0
77 * @return void
78 */
79 private function consts() {
80 if ( ! defined( 'WP_PARSI_ROOT' ) )
81 define( 'WP_PARSI_ROOT', __FILE__ );
82
83 if ( ! defined( 'WP_PARSI_DIR' ) )
84 define( 'WP_PARSI_DIR', plugin_dir_path( WP_PARSI_ROOT ) );
85
86 if ( ! defined( 'WP_PARSI_URL' ) )
87 define( 'WP_PARSI_URL', plugin_dir_url( WP_PARSI_ROOT ) );
88
89 if ( ! defined( 'WP_PARSI_VER' ) )
90 define( 'WP_PARSI_VER', '2.2' );
91 }
92
93 /**
94 * Includes files for plugin
95 *
96 * @since 2.0
97 * @return void
98 */
99 public function include_files() {
100 require_once( WP_PARSI_DIR . 'includes/settings.php' );
101 global $wpp_settings;
102 $wpp_settings = wp_parsi_get_settings();
103
104 $files = array(
105 'parsidate',
106 'general',
107 'fixes-archive',
108 'fixes-permalinks',
109 'fixes-dates',
110 'fixes-misc',
111 'admin/styles-fix',
112 'admin/lists-fix',
113 'admin/other-fix',
114 'fixes-calendar',
115 'fixes-archives',
116 'plugins/woocommerce',
117 'plugins/edd',
118 'widget/widget_archive',
119 'widget/widget_calendar'
120 );
121
122 foreach( $files as $file )
123 require_once( WP_PARSI_DIR . 'includes/' . $file . '.php' );
124
125 if ( get_locale() == 'fa_IR' )
126 load_textdomain( 'wp-parsidate', WP_PARSI_DIR . 'parsi-languages/fa_IR.mo' );
127
128 add_action( 'widgets_init', array( $this, 'register_widget' ) );
129 }
130
131 /**
132 * Sets up global variables
133 *
134 * @since 2.0
135 * @return void
136 */
137 private function setup_vars() {
138 global $persian_month_names, $timezone;
139 $persian_month_names = array( '',
140 'فروردین',
141 'اردیبهشت',
142 'خرداد',
143 'تیر',
144 '�
145 رداد',
146 'شهریور',
147 '�
148 هر',
149 'آبان',
150 'آذر',
151 'دی',
152 'به�
153 ن',
154 'اسفند'
155 );
156
157 $timezone = get_option( 'timezone_string' );
158 if ( $timezone != '' )
159 date_default_timezone_set( $timezone );
160 else
161 date_default_timezone_set( 'Asia/Tehran' );
162 }
163
164 /**
165 * Register Plugin Widgets
166 *
167 * @since 2.0
168 * @return boolean
169 */
170 public function register_widget() {
171 register_widget('parsidate_archive');
172 register_widget('parsidate_calendar');
173 return true;
174 }
175 }
176
177 return WP_Parsidate::get_instance();
178