wp-jalali - Version 4.1

Version Description

Download this release

Release Info

Developer mani_monaj
Plugin Icon 128x128 wp-jalali
Version 4.1
Comparing to
See all releases

Code changes from version 4.0 to 4.1

images/wp-fa-logo.png CHANGED
Binary file
inc/dashboard-core.php CHANGED
@@ -16,12 +16,12 @@ $secondary_replacement =
16
  array (
17
  1 => array (
18
  'link' => 'http://planet.wordpress.org/',
19
- 'feed' => 'http://planet.wordpress.org/feed/',
20
  'title' => 'Other WordPress News'
21
  ),
22
  2 => array (
23
  'link' => 'http://planet.wp-persian.com/',
24
- 'feed' => 'http://planet.wp-persian.com/feed/',
25
  'title' => 'سیاره وردپرس فارسی'
26
  )
27
  );
16
  array (
17
  1 => array (
18
  'link' => 'http://planet.wordpress.org/',
19
+ 'feed' => 'http://localhost/w/?feed=rss2',
20
  'title' => 'Other WordPress News'
21
  ),
22
  2 => array (
23
  'link' => 'http://planet.wp-persian.com/',
24
+ 'feed' => 'http://localhost/w/?feed=rss2',
25
  'title' => 'سیاره وردپرس فارسی'
26
  )
27
  );
inc/editjalali-core.php CHANGED
@@ -77,8 +77,6 @@ function inject_jalali_div() { // injecting jalali input boxes and month list un
77
  }
78
 
79
  function jalali_timestamp_admin() {
80
- if ( current_user_can('edit_posts') ) :
81
- jalali_touch_time(($action == 'edit'));
82
- endif;
83
  }
84
  ?>
77
  }
78
 
79
  function jalali_timestamp_admin() {
80
+ if ( current_user_can('edit_posts') ) jalali_touch_time(($action == 'edit'));
 
 
81
  }
82
  ?>
inc/farsinum-core.php CHANGED
@@ -4,12 +4,19 @@ Originally written by Farhadi , www.farhadi.ir
4
  */
5
 
6
  function convertToFarsi($matches) {
7
- $out = '';
 
 
 
 
 
 
 
 
 
 
8
  if (isset($matches[1])) {
9
- return str_replace(
10
- array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."),
11
- array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", "/"),
12
- $matches[1]);
13
  }
14
  return $matches[0];
15
  }
4
  */
5
 
6
  function convertToFarsi($matches) {
7
+ $mps_jd_optionsDB = get_option(MPS_JD_OPTIONS_NAME);
8
+ $mps_jd_decimal = $mps_jd_optionsDB['mps_jd_decimal'];
9
+ if($mps_jd_decimal == true)
10
+ //$farsi_array = array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", "<sub><small>/</small></sub>");
11
+ $farsi_array = array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", "/");
12
+ else
13
+ $farsi_array = array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", ".");
14
+
15
+ $english_array = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".");
16
+
17
+ $out = '';
18
  if (isset($matches[1])) {
19
+ return str_replace($english_array, $farsi_array, $matches[1]);
 
 
 
20
  }
21
  return $matches[0];
22
  }
inc/widgets-core.php CHANGED
@@ -89,17 +89,21 @@ function widget_jarchive_init() {
89
  ?>
90
  <div dir="rtl" align="justify">
91
  <p style="text-align:right"><label for="jarchive_title">عنوان: <input style="width: 200px;" id="jarchive_title" name="jarchive_title" type="text" value="<?php echo $title; ?>" /></label></p>
92
- <input name="jarchive_type" type="radio" value="monthly" id="monthly" <?=$options['type']=='monthly' ? 'checked=\"checked\"':'' ?> /> <label for="monthly">ماهیانه</label><br />
93
- <input name="jarchive_type" type="radio" value="daily" id="daily" <?=$options['type']=='daily' ? 'checked=\"checked\"':'' ?> /> <label for="daily">روزانه</label><br />
94
- <input name="jarchive_type" type="radio" value="postbypost" id="postbypost" <?=$options['type']=='postbypost' ? 'checked=\"checked\"':'' ?> /> <label for="postbypost">نوشته به نوشته</label><br /><br />
95
- <input name="jarchive_show_post_count" type="checkbox" value="1" id="show_post_count" <?=$options['show_post_count']=='1' ? 'checked=\"checked\"':'' ?> /> <label for="show_post_count">نمایش تعداد نوشته ها (فقط برای بایگانی ماهیانه)</label><br />
96
- <input name="jarchives_dropdown" type="checkbox" value="1" id="dropdown" <?=$options['dropdown']=='1' ? 'checked=\"checked\"':'' ?> /> <label for="dropdown">نمایش به صورت لیست بازشو (فقط برای بایگانی ماهیانه)</label>
 
97
  <input type="hidden" id="jarchive_submit" name="jarchive_submit" value="1" />
98
  </div>
99
  <?php
100
  }
101
 
102
  register_sidebar_widget('Jalali Archive','jarchive_widget');
103
- register_widget_control('Jalali Archive', 'widget_jarchive_control', 300, 150);
 
 
 
104
  }
105
  ?>
89
  ?>
90
  <div dir="rtl" align="justify">
91
  <p style="text-align:right"><label for="jarchive_title">عنوان: <input style="width: 200px;" id="jarchive_title" name="jarchive_title" type="text" value="<?php echo $title; ?>" /></label></p>
92
+ <input name="jarchive_type" type="radio" value="yearly" id="yearly" <?=$options['type']=='yearly' ? 'checked="checked"':'' ?> /> <label for="yearly">سالیانه</label><br />
93
+ <input name="jarchive_type" type="radio" value="monthly" id="monthly" <?=$options['type']=='monthly' ? 'checked="checked"':'' ?> /> <label for="monthly">ماهیانه</label><br />
94
+ <input name="jarchive_type" type="radio" value="daily" id="daily" <?=$options['type']=='daily' ? 'checked="checked"':'' ?> /> <label for="daily">روزانه</label><br />
95
+ <input name="jarchive_type" type="radio" value="postbypost" id="postbypost" <?=$options['type']=='postbypost' ? 'checked="checked"':'' ?> /> <label for="postbypost">نوشته به نوشته</label><br /><br />
96
+ <input name="jarchive_show_post_count" type="checkbox" value="1" id="show_post_count" <?=$options['show_post_count']=='1' ? 'checked="checked"':'' ?> /> <label for="show_post_count">نمایش تعداد نوشته ها (فقط برای بایگانی ماهیانه و سالیانه)</label><br />
97
+ <input name="jarchives_dropdown" type="checkbox" value="1" id="dropdown" <?=$options['dropdown']=='1' ? 'checked="checked"':'' ?> /> <label for="dropdown">نمایش به صورت لیست بازشو (فقط برای بایگانی ماهیانه و سالیانه)</label>
98
  <input type="hidden" id="jarchive_submit" name="jarchive_submit" value="1" />
99
  </div>
100
  <?php
101
  }
102
 
103
  register_sidebar_widget('Jalali Archive','jarchive_widget');
104
+ if(get_bloginfo('version') < 2.5)
105
+ register_widget_control('Jalali Archive', 'widget_jarchive_control', 300, 150);
106
+ else
107
+ register_widget_control('Jalali Archive', 'widget_jarchive_control');
108
  }
109
  ?>
inc/yk-core.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  function mps_yk_solve_callback($matches) {
3
- $arabic = array("ي", "ك");
4
- $persian = array("ی", "ک");
5
 
6
  $clause = $matches[1];
7
  $phrase = $matches[2];
8
 
9
- $phrase_persian = str_replace($arabic,$persian,$phrase); //Pure Persian
10
- $phrase_arabic = str_replace($persian,$arabic,$phrase); //Pure Arabic
11
 
12
  $clause_persian = str_replace($phrase, $phrase_persian, $clause);
13
  $clause_arabic = str_replace($phrase, $phrase_arabic, $clause);
@@ -19,7 +19,7 @@ function mps_yk_solve_search($query) {
19
  $pattern = "/(\([^\)\(]* LIKE '([^']*)'\))/";
20
 
21
  if (strstr($query,"LIKE")) { //Is Search?
22
- if (strstr($query,"ی") || strstr($query,"ک") || strstr($query,"ي") || strstr($query,"ك")) {
23
  $query = preg_replace_callback($pattern, 'mps_yk_solve_callback', $query);
24
  }
25
 
@@ -28,15 +28,25 @@ function mps_yk_solve_search($query) {
28
  return $query;
29
  }
30
  function mps_yk_solve_persian($content) {
31
- $arabic = array("ي", "ك");
32
- $persian = array("ی", "ک");
33
- $content = str_replace($arabic,$persian,$content);
34
  return $content;
35
  }
36
 
 
 
37
  function mps_yk_solve_persian_debug($content) {
38
  print_r($content);
39
  }
 
40
 
 
 
 
 
 
 
 
41
 
42
  ?>
1
  <?php
2
  function mps_yk_solve_callback($matches) {
3
+ $arabic = array("ي", "ك", "٤", "٥", "٦");
4
+ $persian = array("ی", "ک", "۴", "۵", "۶");
5
 
6
  $clause = $matches[1];
7
  $phrase = $matches[2];
8
 
9
+ $phrase_persian = str_replace($arabic, $persian, $phrase); //Pure Persian
10
+ $phrase_arabic = str_replace($persian, $arabic, $phrase); //Pure Arabic
11
 
12
  $clause_persian = str_replace($phrase, $phrase_persian, $clause);
13
  $clause_arabic = str_replace($phrase, $phrase_arabic, $clause);
19
  $pattern = "/(\([^\)\(]* LIKE '([^']*)'\))/";
20
 
21
  if (strstr($query,"LIKE")) { //Is Search?
22
+ if (strstr($query,"ی") || strstr($query,"ک") || strstr($query,"ي") || strstr($query,"ك") || strstr($query,"٤") || strstr($query,"٥") || strstr($query,"٦") || strstr($query,"۴") || strstr($query,"۵") || strstr($query,"۶")) {
23
  $query = preg_replace_callback($pattern, 'mps_yk_solve_callback', $query);
24
  }
25
 
28
  return $query;
29
  }
30
  function mps_yk_solve_persian($content) {
31
+ $arabic = array("ي", "ك", "٤", "٥", "٦");
32
+ $persian = array("ی", "ک", "۴", "۵", "۶");
33
+ $content = str_replace($arabic, $persian, $content);
34
  return $content;
35
  }
36
 
37
+ /*
38
+ // for debug purpose only.
39
  function mps_yk_solve_persian_debug($content) {
40
  print_r($content);
41
  }
42
+ */
43
 
44
+ function shortcode_arabic($atts, $text) {
45
+ $arabic = array("ي", "ك", "٤", "٥", "٦");
46
+ $persian = array("ی", "ک", "۴", "۵", "۶");
47
+ return str_replace($persian, $arabic, $text);
48
+ }
49
+
50
+ add_shortcode('arabic','shortcode_arabic');
51
 
52
  ?>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === wp-jalali ===
2
- Contributors: mani_monaj
3
  Donate link: http://www.wishlistr.com/mani_monaj/
4
  Tags: Persian, Farsi, Jalali, Date, Calendar, i18n, l10n
5
  Requires at least: 2.1
6
- Tested up to: 2.5
7
- Stable tag: 4.0
8
 
9
  Turn you Wordpress into a full featured Persian (Iranian) Blogging Platform.
10
 
@@ -24,7 +24,7 @@ This plug-in is a "Full Jalali (خورشیدی - شمسی) Date and Persian (Far
24
  * Fully customizable through specific Wordpress admin page.
25
  * Jalali timestamp edit in new post and new page sections
26
 
27
- This plug-in is now part of [Persian Wordpress Project](http://www.wp-persian.com/ "پروژه وردپرس فارسی")
28
 
29
  == Installation ==
30
 
1
  === wp-jalali ===
2
+ Contributors: mani_monaj, Gonahkar
3
  Donate link: http://www.wishlistr.com/mani_monaj/
4
  Tags: Persian, Farsi, Jalali, Date, Calendar, i18n, l10n
5
  Requires at least: 2.1
6
+ Tested up to: 2.7-bleeding
7
+ Stable tag: 4.1
8
 
9
  Turn you Wordpress into a full featured Persian (Iranian) Blogging Platform.
10
 
24
  * Fully customizable through specific Wordpress admin page.
25
  * Jalali timestamp edit in new post and new page sections
26
 
27
+ This plug-in is now part of [Persian Wordpress Project](http://wp-persian.com/ "پروژه وردپرس فارسی")
28
 
29
  == Installation ==
30
 
screenshot-1.png CHANGED
Binary file
wp-jalali.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: wp-jalali
4
  Plugin URI: http://wp-persian.com/wp-jalali/
5
  Description: Full Jalali Date and Persian(Farsi) Support Package for wordpress, Full posts' and comments' dates convertion , Jalali Archive , Magic(Jalali/Gregorian) Calendar and Jalali/Gregorian Compaitables Permalinks, TinyMCE RTL/LTR activation, TinyMCE Persian Improvement, Cross browser Perisan keyboard support, Jalali Archive/Calendar widgets and Persian numbers, Great tool for Persian(Iranian) Users of WordPress, part of <a href="http://wp-persian.com" title="پروژه وردپرس فارسی">Persian Wordpress Project</a>.
6
- Version: 4.0
7
  Author: Vali Allah(Mani) Monajjemi
8
  Author URI: http://www.manionline.org/
9
  */
@@ -31,14 +31,14 @@ Special Thanks to :
31
  * Farsiweb.info for J2G and G2J Converstion Functions
32
  * Milad Raastian (miladmovie.com) for JDF (jdf.farsiprojects.com)
33
  * Nima Shyanfar (phpmystery.com) for Fast Farsi Number Conversion Method
34
- * Gonahkar (gonahkar.com) for WP-Jalali widgets plugin (gonahkar.com/archives/2007/02/26/wp-jalali-widgets-plugin/ ) and edit jalali timestamp in write/edit panel
35
  * Kaveh Ahmadi (ashoob.net/kaveh) for his valuable Farsi Keyboard Script (ashoob.net/farsitype)
36
  * Ali Sattari(corelist.net) for great support
37
  * Ali Farhadi (farhadi.ir) for improving Farsi Number Convertor.
38
 
39
  */
40
 
41
- define("MPS_JD_VER","4.0");
42
  define('MPS_JD_OPTIONS_NAME', "mps_jd_options"."_".MPS_JD_VER); // Name of the Option stored in the DB
43
  define('MPS_JD_DIR', dirname(__FILE__));
44
  define('MPS_JD_URI', get_settings('siteurl').'/wp-content/plugins/wp-jalali');
@@ -77,6 +77,7 @@ function mps_jd_menu(){
77
  $mps_jd_optionsDB['mps_jd_farsinum_title'] = $mps_jd_farsinum_title = true;
78
  $mps_jd_optionsDB['mps_jd_farsinum_category'] = $mps_jd_farsinum_category = true;
79
  $mps_jd_optionsDB['mps_jd_farsinum_date'] = $mps_jd_farsinum_date = true;
 
80
  $mps_jd_optionsDB['mps_jd_mcertl'] = $mps_jd_mcertl = true;
81
  $mps_jd_optionsDB['mps_jd_jperma'] = $mps_jd_jperma = true;
82
  $mps_jd_optionsDB['mps_jd_autoyk'] = $mps_jd_autoyk = true;
@@ -117,6 +118,7 @@ function mps_jd_optionpage(){
117
  $mps_jd_optionsDB['mps_jd_farsinum_title'] = $mps_jd_farsinum_title = $_POST['mps_jd_farsinum_title'];
118
  $mps_jd_optionsDB['mps_jd_farsinum_category'] = $mps_jd_farsinum_category = $_POST['mps_jd_farsinum_category'];
119
  $mps_jd_optionsDB['mps_jd_farsinum_date'] = $mps_jd_farsinum_date = $_POST['mps_jd_farsinum_date'];
 
120
  $mps_jd_optionsDB['mps_jd_mcertl'] = $mps_jd_mcertl = $_POST['mps_jd_mcertl'];
121
  $mps_jd_optionsDB['mps_jd_jperma'] = $mps_jd_jperma = $_POST['mps_jd_jperma'];
122
  $mps_jd_optionsDB['mps_jd_autoyk'] = $mps_jd_autoyk = $_POST['mps_jd_autoyk'];
@@ -147,6 +149,7 @@ function mps_jd_optionpage(){
147
  $mps_jd_farsinum_title = $mps_jd_optionsDB['mps_jd_farsinum_title'];
148
  $mps_jd_farsinum_category = $mps_jd_optionsDB['mps_jd_farsinum_category'];
149
  $mps_jd_farsinum_date = $mps_jd_optionsDB['mps_jd_farsinum_date'];
 
150
  $mps_jd_mcertl = $mps_jd_optionsDB['mps_jd_mcertl'];
151
  $mps_jd_jperma = $mps_jd_optionsDB['mps_jd_jperma'];
152
  $mps_jd_autoyk = $mps_jd_optionsDB['mps_jd_autoyk'];
@@ -217,9 +220,9 @@ function mps_jd_optionpage(){
217
  <th scope="row">نحوه نمایش اخبار</th>
218
  <td>
219
  <select name="mps_jd_dashboard" id="mps_jd_dashboard">
220
- <option value="0" <?=$mps_jd_dashboard==0? 'selected=\"selected\"':'' ?>>بر اساس تنظیمات فایل زبان</option>
221
- <option value="1" <?=$mps_jd_dashboard==1? 'selected=\"selected\"':'' ?>>نمایش اخبار اصلی وردپرس به زبان انگلیسی</option>
222
- <option value="2" <?=$mps_jd_dashboard==2?'selected=\"selected\"':'' ?>>نمایش اخبار وردپرس فارسی</option>
223
  </select>
224
  <br />
225
  در این نسخه از وردپرس، اخبار وردپرس فارسی در صفحه <a href="<?php echo get_option('siteurl'); ?>/wp-admin/">پیش خوان</a> (Dashboard) نمایش داده می شوند.
@@ -232,11 +235,11 @@ function mps_jd_optionpage(){
232
 
233
  <table class="form-table">
234
  <tr valign="top">
235
- <th scope="row">تبدیل خودکار تاریخ نوشته ها و نظرات به تاریخ خورشیدی(شمسی)</th>
236
  <td>
237
  <select name="mps_jd_autodate" id="mps_jd_autodate">
238
- <option value="1" <?=$mps_jd_autodate==true? 'selected=\"selected\"':'' ?>>فعال (پیشنهاد می شود)</option>
239
- <option value="0" <?=$mps_jd_autodate==false?'selected=\"selected\"':'' ?>>غیر فعال</option>
240
  </select>
241
  </td>
242
  </tr>
@@ -245,67 +248,80 @@ function mps_jd_optionpage(){
245
  <td>
246
  <table border="0" cellpadding="2" cellspacing="2">
247
  <tr>
248
- <td style="border-bottom-width: 0">متن نوشته ها</td>
249
- <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_content" <?=$mps_jd_farsinum_content==true? 'checked=\"checked\"':'' ?> /></td>
250
- <td style="border-bottom-width: 0">متن نظر ها</td>
251
- <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_comment" <?=$mps_jd_farsinum_comment==true? 'checked=\"checked\"':'' ?> /></td>
252
- <td style="border-bottom-width: 0">تعداد نظر ها</td>
253
- <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_commentnum" <?=$mps_jd_farsinum_commentnum==true? 'checked=\"checked\"':'' ?> /></td>
254
  </tr>
255
  <tr>
256
- <td style="border-bottom-width: 0">عنوان نوشته ها</td>
257
- <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_title" <?=$mps_jd_farsinum_title==true? 'checked=\"checked\"':'' ?> /></td>
258
- <td style="border-bottom-width: 0">تاریخ ها</td>
259
- <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_date" <?=$mps_jd_farsinum_date==true? 'checked=\"checked\"':'' ?> /></td>
260
- <td style="border-bottom-width: 0">فهرست دسته ها</td>
261
- <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_category" <?=$mps_jd_farsinum_category==true? 'checked=\"checked\"':'' ?> /></td>
262
  </tr>
263
  </table>
264
 
265
  </td>
266
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  <tr valign="top">
268
  <th scope="row">جهت ویرایشگر متنی صفحه نوشتن</th>
269
  <td>
270
  <select name="mps_jd_mcertl" id="mps_jd_mcertl">
271
- <option value="1" <?=$mps_jd_mcertl==true? 'selected=\"selected\"':'' ?>>راست به چپ</option>
272
- <option value="0" <?=$mps_jd_mcertl==false?'selected=\"selected\"':'' ?>>چپ به راست</option>
273
  </select>
274
  <br />
275
- در نگارش های بالاتر از وردپرس ۲/۳ در صورتی که زبان وردپرس خود را فارسی انتخاب کنید، جهت ویرایشگر به صورت خودکار راست به چپ خواهد بود. در این نگارش ها تنها در صورتی از این گزینه استفاده کنید که زبان وردپرس خود را انگلیسی انتخاب کرده باشید.
276
  </td>
277
  </tr>
278
  <tr valign="top">
279
- <th scope="row">تبدیل خودکار تاریخ در آدرس (URI) نوشته ها</th>
280
  <td>
281
  <select name="mps_jd_jperma" id="mps_jd_jperma">
282
- <option value="1" <?=$mps_jd_jperma==true? 'selected=\"selected\"':'' ?>>بله</option>
283
- <option value="0" <?=$mps_jd_jperma==false?'selected=\"selected\"':'' ?>>خیر</option>
284
  </select>
285
  <br />
286
- تبدیل خودکار تاریخ در آدرس نوشته ها، مثلا از yourblog.ir/2008/04/02/post به yourblog.ir/1387/01/13/post
287
  </td>
288
  </tr>
289
  <tr valign="top">
290
- <th scope="row">تبدیل هوشمند کاراکترهای عربی به فارسی</th>
291
  <td>
292
  <select name="mps_jd_autoyk" id="mps_jd_autoyk">
293
- <option value="1" <?=$mps_jd_autoyk==true? 'selected=\"selected\"':'' ?>>بله</option>
294
- <option value="0" <?=$mps_jd_autoyk==false?'selected=\"selected\"':'' ?>>خیر</option>
295
  </select>
296
  <br />
297
- تبدیل خودکار کاراکترهای (ي) و (ك) عربی به (ی) و (ک) فارسی در هنگام نمایش و جستجوی هوشمند برای تمامی ترکیب های ممکن در هنگام جستجو.
298
  </td>
299
  </tr>
300
  <tr valign="top">
301
- <th scope="row">ویرایش تاریخ نوشته ها و برگه ها</th>
302
  <td>
303
  <select name="mps_jd_editjalali" id="mps_jd_editjalali">
304
- <option value="1" <?=$mps_jd_editjalali==true? 'selected=\"selected\"':'' ?>>خورشیدی (شمسی)</option>
305
- <option value="0" <?=$mps_jd_editjalali==false?'selected=\"selected\"':'' ?>>میلادی</option>
306
  </select>
307
  <br />
308
- در نگارش های بالاتر از وردپرس ۲/۵ می توانید نحوه ویرایش تاریخ نوشته ها و برگه ها را تنظیم کنید.
309
  </td>
310
  </tr>
311
  </table>
@@ -328,15 +344,15 @@ function mps_jd_optionpage(){
328
  </tr>
329
  <tr>
330
  <th scope="row">&nbsp;</th>
331
- <td>فرمت های زیر مانند <a href="http://php.net/date">تابع <code>date()</code> PHP</a> می باشد. برای نمایش تغییرات این صفحه را به روز کنید.</td>
332
  </tr>
333
  <tr>
334
- <th scope="row">فرمت تاریخ پیش فرض</th>
335
  <td><input style="direction:rtl; text-align:left" name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br />
336
  خروجی : <strong><?php echo jdate(get_settings('date_format'), $gmt + (get_settings('gmt_offset') * 3600)); ?></strong></td>
337
  </tr>
338
  <tr>
339
- <th scope="row">فرمت زمان پیش فرض</th>
340
  <td><input style="direction:rtl; text-align:left" name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br />
341
  خروجی : <strong><?php echo jdate(get_settings('time_format'), $gmt + (get_settings('gmt_offset') * 3600)) ; ?></strong></td>
342
  </tr>
@@ -643,11 +659,13 @@ function mps_get_jarchives($type='', $limit='', $format='html', $before = '', $a
643
  if ('' == $type) {
644
  $type = 'monthly';
645
  }
646
-
647
- if ('' != $limit) {
648
  $limit = (int) $limit;
649
- $limit = ' LIMIT '.$limit;
650
  }
 
 
651
  // this is what will separate dates on weekly archive links
652
  $archive_week_separator = '&#8211;';
653
 
@@ -674,10 +692,34 @@ function mps_get_jarchives($type='', $limit='', $format='html', $before = '', $a
674
  $add_hours = intval(get_settings('gmt_offset'));
675
  $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
676
 
677
- $now = current_time('mysql');
678
-
679
- if ("monthly" == $type) {
680
- $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) as 'day',count(ID) as 'posts' FROM $wpdb->posts WHERE ".$_query_add." AND post_date < '$now' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC " . $limit);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
  if ($arcresults) {
682
  $afterafter = $after;
683
  $len = count($arcresults)-1;
@@ -692,6 +734,7 @@ function mps_get_jarchives($type='', $limit='', $format='html', $before = '', $a
692
  $jal_month = 1;
693
  $jal_year++;
694
  }
 
695
  while (jmaketime(0,0,0,$jal_month,1,$jal_year) >= jmaketime(0,0,0,$jal_startmonth,1,$jal_startyear)){
696
  $jal_nextmonth = $jal_month-1;
697
  $jal_nextyear = $jal_year;
@@ -702,7 +745,7 @@ function mps_get_jarchives($type='', $limit='', $format='html', $before = '', $a
702
  $gre_end = date("Y:m:d H:i:s",jmaketime(0,0,0,$jal_month,1,$jal_year));
703
  $gre_start = date("Y:m:d H:i:s",jmaketime(0,0,0,$jal_nextmonth,1,$jal_nextyear));
704
 
705
- $jal_post_count = $wpdb->get_results("SELECT COUNT(id) as 'post_count' FROM $wpdb->posts WHERE ".$_query_add." AND post_date < '$now' AND post_status = 'publish' AND post_date >= '$gre_start' AND post_date < '$gre_end'");
706
  $jal_posts = $jal_post_count[0]->post_count;
707
  if ($jal_posts > 0){
708
 
@@ -717,21 +760,20 @@ function mps_get_jarchives($type='', $limit='', $format='html', $before = '', $a
717
  } else {
718
  $jal_year_text = $jal_nextyear;
719
  }
720
-
721
- if ($show_post_count) {
722
- $text = sprintf('%s %s', $j_month_name[$jal_nextmonth], $jal_year_text);
723
  $after = '&nbsp;('.$jal_posts.')' . $afterafter;
724
- } else {
725
- $text = sprintf('%s %s', $j_month_name[$jal_nextmonth], $jal_year_text);
726
- }
727
  echo get_archives_link($url, $text, $format, $before, $after);
728
  }
729
  $jal_month = $jal_nextmonth;
730
  $jal_year = $jal_nextyear;
 
 
731
  }
732
  }
733
- } else if ("daily" == $type) {
734
- $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE ".$_query_add." AND post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
735
  if ($arcresults) {
736
  foreach ($arcresults as $arcresult) {
737
  list($jal_year,$jal_month,$jal_dayofmonth) = gregorian_to_jalali($arcresult->year,$arcresult->month,$arcresult->dayofmonth);
@@ -744,7 +786,7 @@ function mps_get_jarchives($type='', $limit='', $format='html', $before = '', $a
744
  }
745
  }
746
  } elseif ('postbypost' == $type) {
747
- $arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $wpdb->posts WHERE ".$_query_add." AND post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
748
  if ($arcresults) {
749
  foreach ($arcresults as $arcresult) {
750
  if ($arcresult->post_date != '0000-00-00 00:00:00') {
@@ -1229,9 +1271,15 @@ if (version_compare($_wp_version, '2', '<')) {
1229
 
1230
  /* Tags */
1231
 
 
1232
  function mps_loadjs() {
1233
  //wp_enqueue_script( 'jalalitags', MPS_JD_URI . '/inc/tags.js', array('jquery'), '1.1');
1234
  }
 
 
 
 
 
1235
 
1236
  add_filter("posts_where","mps_jalali_query");
1237
 
@@ -1275,8 +1323,11 @@ if ($mps_jd_autoyk) {
1275
  add_filter('the_excerpt','mps_yk_solve_persian',10,1);
1276
  add_filter('get_the_excerpt','mps_yk_solve_persian',10,1);
1277
  add_filter('link_title','mps_yk_solve_persian',10,1);
 
1278
  add_filter('the_title','mps_yk_solve_persian',10,1);
1279
  add_filter('the_title_rss','mps_yk_solve_persian',10,1);
 
 
1280
  add_filter('get_comment_excerpt','mps_yk_solve_persian',10,1);
1281
  add_filter('get_comment_text','mps_yk_solve_persian',10,1);
1282
  add_filter('get_comment_author','mps_yk_solve_persian',10,1);
@@ -1311,6 +1362,6 @@ if (!version_compare($_wp_version, '2.4', '<')) { //Wordpress 2.5+ Only
1311
  add_action('widgets_init', 'widget_jarchive_init');
1312
  add_action('widgets_init', 'widget_mps_calendar_init');
1313
 
1314
- add_action('wp_print_scripts', 'mps_loadjs');
1315
 
1316
  ?>
3
  Plugin Name: wp-jalali
4
  Plugin URI: http://wp-persian.com/wp-jalali/
5
  Description: Full Jalali Date and Persian(Farsi) Support Package for wordpress, Full posts' and comments' dates convertion , Jalali Archive , Magic(Jalali/Gregorian) Calendar and Jalali/Gregorian Compaitables Permalinks, TinyMCE RTL/LTR activation, TinyMCE Persian Improvement, Cross browser Perisan keyboard support, Jalali Archive/Calendar widgets and Persian numbers, Great tool for Persian(Iranian) Users of WordPress, part of <a href="http://wp-persian.com" title="پروژه وردپرس فارسی">Persian Wordpress Project</a>.
6
+ Version: 4.1
7
  Author: Vali Allah(Mani) Monajjemi
8
  Author URI: http://www.manionline.org/
9
  */
31
  * Farsiweb.info for J2G and G2J Converstion Functions
32
  * Milad Raastian (miladmovie.com) for JDF (jdf.farsiprojects.com)
33
  * Nima Shyanfar (phpmystery.com) for Fast Farsi Number Conversion Method
34
+ * Gonahkar (gonahkar.com) for WP-Jalali widgets plugin (gonahkar.com/archives/2007/02/26/wp-jalali-widgets-plugin/ ), edit jalali timestamp in write/edit panel and [arabic] writing shortcode.
35
  * Kaveh Ahmadi (ashoob.net/kaveh) for his valuable Farsi Keyboard Script (ashoob.net/farsitype)
36
  * Ali Sattari(corelist.net) for great support
37
  * Ali Farhadi (farhadi.ir) for improving Farsi Number Convertor.
38
 
39
  */
40
 
41
+ define("MPS_JD_VER","4.1");
42
  define('MPS_JD_OPTIONS_NAME', "mps_jd_options"."_".MPS_JD_VER); // Name of the Option stored in the DB
43
  define('MPS_JD_DIR', dirname(__FILE__));
44
  define('MPS_JD_URI', get_settings('siteurl').'/wp-content/plugins/wp-jalali');
77
  $mps_jd_optionsDB['mps_jd_farsinum_title'] = $mps_jd_farsinum_title = true;
78
  $mps_jd_optionsDB['mps_jd_farsinum_category'] = $mps_jd_farsinum_category = true;
79
  $mps_jd_optionsDB['mps_jd_farsinum_date'] = $mps_jd_farsinum_date = true;
80
+ $mps_jd_optionsDB['mps_jd_decimal'] = $mps_jd_decimal = true;
81
  $mps_jd_optionsDB['mps_jd_mcertl'] = $mps_jd_mcertl = true;
82
  $mps_jd_optionsDB['mps_jd_jperma'] = $mps_jd_jperma = true;
83
  $mps_jd_optionsDB['mps_jd_autoyk'] = $mps_jd_autoyk = true;
118
  $mps_jd_optionsDB['mps_jd_farsinum_title'] = $mps_jd_farsinum_title = $_POST['mps_jd_farsinum_title'];
119
  $mps_jd_optionsDB['mps_jd_farsinum_category'] = $mps_jd_farsinum_category = $_POST['mps_jd_farsinum_category'];
120
  $mps_jd_optionsDB['mps_jd_farsinum_date'] = $mps_jd_farsinum_date = $_POST['mps_jd_farsinum_date'];
121
+ $mps_jd_optionsDB['mps_jd_decimal'] = $mps_jd_decimal = $_POST['mps_jd_decimal'];
122
  $mps_jd_optionsDB['mps_jd_mcertl'] = $mps_jd_mcertl = $_POST['mps_jd_mcertl'];
123
  $mps_jd_optionsDB['mps_jd_jperma'] = $mps_jd_jperma = $_POST['mps_jd_jperma'];
124
  $mps_jd_optionsDB['mps_jd_autoyk'] = $mps_jd_autoyk = $_POST['mps_jd_autoyk'];
149
  $mps_jd_farsinum_title = $mps_jd_optionsDB['mps_jd_farsinum_title'];
150
  $mps_jd_farsinum_category = $mps_jd_optionsDB['mps_jd_farsinum_category'];
151
  $mps_jd_farsinum_date = $mps_jd_optionsDB['mps_jd_farsinum_date'];
152
+ $mps_jd_decimal = $mps_jd_optionsDB['mps_jd_decimal'];
153
  $mps_jd_mcertl = $mps_jd_optionsDB['mps_jd_mcertl'];
154
  $mps_jd_jperma = $mps_jd_optionsDB['mps_jd_jperma'];
155
  $mps_jd_autoyk = $mps_jd_optionsDB['mps_jd_autoyk'];
220
  <th scope="row">نحوه نمایش اخبار</th>
221
  <td>
222
  <select name="mps_jd_dashboard" id="mps_jd_dashboard">
223
+ <option value="0" <?=$mps_jd_dashboard==0? 'selected="selected"':'' ?>>بر اساس تنظیمات فایل زبان</option>
224
+ <option value="1" <?=$mps_jd_dashboard==1? 'selected="selected"':'' ?>>نمایش اخبار اصلی وردپرس به زبان انگلیسی</option>
225
+ <option value="2" <?=$mps_jd_dashboard==2?'selected="selected"':'' ?>>نمایش اخبار وردپرس فارسی</option>
226
  </select>
227
  <br />
228
  در این نسخه از وردپرس، اخبار وردپرس فارسی در صفحه <a href="<?php echo get_option('siteurl'); ?>/wp-admin/">پیش خوان</a> (Dashboard) نمایش داده می شوند.
235
 
236
  <table class="form-table">
237
  <tr valign="top">
238
+ <th scope="row">تبدیل خودکار تاریخ نوشته‌ها و نظرات به تاریخ خورشیدی(شمسی)</th>
239
  <td>
240
  <select name="mps_jd_autodate" id="mps_jd_autodate">
241
+ <option value="1" <?=$mps_jd_autodate==true? 'selected="selected"':'' ?>>فعال (پیشنهاد می شود)</option>
242
+ <option value="0" <?=$mps_jd_autodate==false?'selected="selected"':'' ?>>غیر فعال</option>
243
  </select>
244
  </td>
245
  </tr>
248
  <td>
249
  <table border="0" cellpadding="2" cellspacing="2">
250
  <tr>
251
+ <td style="border-bottom-width: 0">متن نوشته‌ها</td>
252
+ <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_content" <?=$mps_jd_farsinum_content==true? 'checked="checked"':'' ?> /></td>
253
+ <td style="border-bottom-width: 0">متن نظر‌ها</td>
254
+ <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_comment" <?=$mps_jd_farsinum_comment==true? 'checked="checked"':'' ?> /></td>
255
+ <td style="border-bottom-width: 0">تعداد نظر‌ها</td>
256
+ <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_commentnum" <?=$mps_jd_farsinum_commentnum==true? 'checked="checked"':'' ?> /></td>
257
  </tr>
258
  <tr>
259
+ <td style="border-bottom-width: 0">عنوان نوشته‌ها</td>
260
+ <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_title" <?=$mps_jd_farsinum_title==true? 'checked="checked"':'' ?> /></td>
261
+ <td style="border-bottom-width: 0">تاریخ‌ها</td>
262
+ <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_date" <?=$mps_jd_farsinum_date==true? 'checked="checked"':'' ?> /></td>
263
+ <td style="border-bottom-width: 0">فهرست دسته‌ها</td>
264
+ <td style="border-bottom-width: 0"><input type="checkbox" name="mps_jd_farsinum_category" <?=$mps_jd_farsinum_category==true? 'checked="checked"':'' ?> /></td>
265
  </tr>
266
  </table>
267
 
268
  </td>
269
+ </tr>
270
+ <tr>
271
+ <th scope="row">استفاده از <code>/</code> به‌جای نقطه به‌عنوان نشانه‌ی اعداد اعشاری</th>
272
+ <td>
273
+ <select name="mps_jd_decimal" id="mps_jd_decimal">
274
+ <option value="1" <?=$mps_jd_decimal==true? 'selected="selected"':'' ?>>بله</option>
275
+ <option value="0" <?=$mps_jd_decimal==false?'selected="selected"':'' ?>>خیر</option>
276
+ </select>
277
+ <br />
278
+ <strong>مثال:</strong> استفاده از ۲<sub><small>/</small></sub>۶ به‌جای ۲.۶
279
+ <br />
280
+ <strong>توضیح:</strong> همان‌طور که می‌دانیم نشانه‌ی اعشار در فارسی / است٬ اما به‌دلیل ناسازگاری برخی مرورگرها با اعداد ممیزدار٬ این گزینه را به‌انتخاب کاربران گذاشتیم.
281
+ </td>
282
+ </tr>
283
  <tr valign="top">
284
  <th scope="row">جهت ویرایشگر متنی صفحه نوشتن</th>
285
  <td>
286
  <select name="mps_jd_mcertl" id="mps_jd_mcertl">
287
+ <option value="1" <?=$mps_jd_mcertl==true? 'selected="selected"':'' ?>>راست به چپ</option>
288
+ <option value="0" <?=$mps_jd_mcertl==false?'selected="selected"':'' ?>>چپ به راست</option>
289
  </select>
290
  <br />
291
+ در نگارش‌های بالاتر از وردپرس ۲/۳ در صورتی که زبان وردپرس خود را فارسی انتخاب کنید، جهت ویرایشگر به صورت خودکار راست به چپ خواهد بود. در این نگارش‌ها تنها در صورتی از این گزینه استفاده کنید که زبان وردپرس خود را انگلیسی انتخاب کرده باشید.
292
  </td>
293
  </tr>
294
  <tr valign="top">
295
+ <th scope="row">تبدیل خودکار تاریخ در آدرس (URI) نوشته‌ها</th>
296
  <td>
297
  <select name="mps_jd_jperma" id="mps_jd_jperma">
298
+ <option value="1" <?=$mps_jd_jperma==true? 'selected="selected"':'' ?>>بله</option>
299
+ <option value="0" <?=$mps_jd_jperma==false?'selected="selected"':'' ?>>خیر</option>
300
  </select>
301
  <br />
302
+ تبدیل خودکار تاریخ در آدرس نوشته‌ها، مثلا از yourblog.ir/2008/04/02/post به yourblog.ir/1387/01/13/post
303
  </td>
304
  </tr>
305
  <tr valign="top">
306
+ <th scope="row">تبدیل هوشمند حروف عربی به فارسی</th>
307
  <td>
308
  <select name="mps_jd_autoyk" id="mps_jd_autoyk">
309
+ <option value="1" <?=$mps_jd_autoyk==true? 'selected="selected"':'' ?>>بله</option>
310
+ <option value="0" <?=$mps_jd_autoyk==false?'selected="selected"':'' ?>>خیر</option>
311
  </select>
312
  <br />
313
+ تبدیل خودکار حروف (ي) و (ك) عربی به (ی) و (ک) فارسی در هنگام نمایش و جستجوی هوشمند برای تمامی ترکیب‌های ممکن در هنگام جستجو.
314
  </td>
315
  </tr>
316
  <tr valign="top">
317
+ <th scope="row">ویرایش تاریخ نوشته‌ها و برگه‌ها</th>
318
  <td>
319
  <select name="mps_jd_editjalali" id="mps_jd_editjalali">
320
+ <option value="1" <?=$mps_jd_editjalali==true? 'selected="selected"':'' ?>>خورشیدی (شمسی)</option>
321
+ <option value="0" <?=$mps_jd_editjalali==false?'selected="selected"':'' ?>>میلادی</option>
322
  </select>
323
  <br />
324
+ در نگارش‌های بالاتر از وردپرس ۲/۵ می توانید نحوه ویرایش تاریخ نوشته‌ها و برگه‌ها را تنظیم کنید.
325
  </td>
326
  </tr>
327
  </table>
344
  </tr>
345
  <tr>
346
  <th scope="row">&nbsp;</th>
347
+ <td>ساختار‌های زیر مانند <a href="http://php.net/date">تابع <code>date()</code> PHP</a> می باشد. برای نمایش تغییرات این صفحه را به روز کنید.</td>
348
  </tr>
349
  <tr>
350
+ <th scope="row">ساختار تاریخ پیش‌فرض</th>
351
  <td><input style="direction:rtl; text-align:left" name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br />
352
  خروجی : <strong><?php echo jdate(get_settings('date_format'), $gmt + (get_settings('gmt_offset') * 3600)); ?></strong></td>
353
  </tr>
354
  <tr>
355
+ <th scope="row">ساختار زمان پیش‌فرض</th>
356
  <td><input style="direction:rtl; text-align:left" name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br />
357
  خروجی : <strong><?php echo jdate(get_settings('time_format'), $gmt + (get_settings('gmt_offset') * 3600)) ; ?></strong></td>
358
  </tr>
659
  if ('' == $type) {
660
  $type = 'monthly';
661
  }
662
+
663
+ if ('' != $limit && 0 != $limit) {
664
  $limit = (int) $limit;
665
+ if("daily" == $type || "postbypost" == $type) $limit = ' LIMIT '.$limit;
666
  }
667
+
668
+
669
  // this is what will separate dates on weekly archive links
670
  $archive_week_separator = '&#8211;';
671
 
692
  $add_hours = intval(get_settings('gmt_offset'));
693
  $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
694
 
695
+ if ("yearly" == $type) {
696
+ $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < NOW() AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC");
697
+ if ($arcresults) {
698
+ //$afterafter = $after;
699
+ $jal_years_array = array();
700
+ foreach ($arcresults as $arcresult) {
701
+ list($jal_year,$jal_month,$jal_dayofmonth) = gregorian_to_jalali($arcresult->year,$arcresult->month,$arcresult->dayofmonth);
702
+ $jal_years_array[] = $jal_year;
703
+ }
704
+
705
+ $jal_years = array_unique($jal_years_array);
706
+ $i = 1;
707
+ foreach($jal_years as $jal_year) {
708
+ $gre_start = date("Y-m-d H:i:s",jmaketime(0,0,0,1,1,$jal_year));
709
+ $gre_end = date("Y-m-d H:i:s",jmaketime(0,0,0,1,1,$jal_year+1));
710
+ $count_query = $wpdb->get_results("SELECT count(ID) as 'post_count' FROM $wpdb->posts WHERE post_date < NOW() AND post_type = 'post' AND post_status = 'publish' AND post_date >= '$gre_start' AND post_date < '$gre_end' ORDER BY post_date DESC");
711
+ $count_posts = farsi_num($count_query[0]->post_count);
712
+ $url = get_year_link($jal_year);
713
+ $text = farsi_num($jal_year);
714
+ if ($show_post_count)
715
+ $after = '&nbsp;('.$count_posts.')' . $afterafter;
716
+ echo get_archives_link($url, $text, $format, $before, $after);
717
+ if($i == $limit) break;
718
+ $i++;
719
+ }
720
+ }
721
+ } elseif ("monthly" == $type) {
722
+ $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) as 'day',count(ID) as 'posts' FROM $wpdb->posts WHERE ".$_query_add." AND post_date < NOW() AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC ");
723
  if ($arcresults) {
724
  $afterafter = $after;
725
  $len = count($arcresults)-1;
734
  $jal_month = 1;
735
  $jal_year++;
736
  }
737
+ $i = 1;
738
  while (jmaketime(0,0,0,$jal_month,1,$jal_year) >= jmaketime(0,0,0,$jal_startmonth,1,$jal_startyear)){
739
  $jal_nextmonth = $jal_month-1;
740
  $jal_nextyear = $jal_year;
745
  $gre_end = date("Y:m:d H:i:s",jmaketime(0,0,0,$jal_month,1,$jal_year));
746
  $gre_start = date("Y:m:d H:i:s",jmaketime(0,0,0,$jal_nextmonth,1,$jal_nextyear));
747
 
748
+ $jal_post_count = $wpdb->get_results("SELECT COUNT(id) as 'post_count' FROM $wpdb->posts WHERE ".$_query_add." AND post_date < NOW() AND post_status = 'publish' AND post_date >= '$gre_start' AND post_date < '$gre_end'");
749
  $jal_posts = $jal_post_count[0]->post_count;
750
  if ($jal_posts > 0){
751
 
760
  } else {
761
  $jal_year_text = $jal_nextyear;
762
  }
763
+
764
+ $text = sprintf('%s %s', $j_month_name[$jal_nextmonth], $jal_year_text);
765
+ if ($show_post_count)
766
  $after = '&nbsp;('.$jal_posts.')' . $afterafter;
 
 
 
767
  echo get_archives_link($url, $text, $format, $before, $after);
768
  }
769
  $jal_month = $jal_nextmonth;
770
  $jal_year = $jal_nextyear;
771
+ if($i == $limit) break;
772
+ $i++;
773
  }
774
  }
775
+ } elseif ("daily" == $type) {
776
+ $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE ".$_query_add." AND post_date < NOW() AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
777
  if ($arcresults) {
778
  foreach ($arcresults as $arcresult) {
779
  list($jal_year,$jal_month,$jal_dayofmonth) = gregorian_to_jalali($arcresult->year,$arcresult->month,$arcresult->dayofmonth);
786
  }
787
  }
788
  } elseif ('postbypost' == $type) {
789
+ $arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $wpdb->posts WHERE ".$_query_add." AND post_date < NOW() AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
790
  if ($arcresults) {
791
  foreach ($arcresults as $arcresult) {
792
  if ($arcresult->post_date != '0000-00-00 00:00:00') {
1271
 
1272
  /* Tags */
1273
 
1274
+ /*
1275
  function mps_loadjs() {
1276
  //wp_enqueue_script( 'jalalitags', MPS_JD_URI . '/inc/tags.js', array('jquery'), '1.1');
1277
  }
1278
+ */
1279
+
1280
+ /* Core changes */
1281
+ update_option('rss_language', 'fa'); // change rss language to fa for some rss reader like IE7 to understand that the direction is RTL.
1282
+ @define('WP_MEMORY_LIMIT', '64M'); // Increse memory limit because of translation pressure.
1283
 
1284
  add_filter("posts_where","mps_jalali_query");
1285
 
1323
  add_filter('the_excerpt','mps_yk_solve_persian',10,1);
1324
  add_filter('get_the_excerpt','mps_yk_solve_persian',10,1);
1325
  add_filter('link_title','mps_yk_solve_persian',10,1);
1326
+ add_filter('wp_title','mps_yk_solve_persian',10,1);
1327
  add_filter('the_title','mps_yk_solve_persian',10,1);
1328
  add_filter('the_title_rss','mps_yk_solve_persian',10,1);
1329
+ add_filter('get_the_title','mps_yk_solve_persian',10,1);
1330
+ add_filter('get_the_title_rss','mps_yk_solve_persian',10,1);
1331
  add_filter('get_comment_excerpt','mps_yk_solve_persian',10,1);
1332
  add_filter('get_comment_text','mps_yk_solve_persian',10,1);
1333
  add_filter('get_comment_author','mps_yk_solve_persian',10,1);
1362
  add_action('widgets_init', 'widget_jarchive_init');
1363
  add_action('widgets_init', 'widget_mps_calendar_init');
1364
 
1365
+ // add_action('wp_print_scripts', 'mps_loadjs');
1366
 
1367
  ?>