wp-jalali - Version 4.4

Version Description

Download this release

Release Info

Developer Gonahkar
Plugin Icon 128x128 wp-jalali
Version 4.4
Comparing to
See all releases

Code changes from version 4.3 to 4.4

images/logo.png ADDED
Binary file
inc/editjalali-core.php CHANGED
@@ -47,6 +47,8 @@ function jalali_touch_time( $edit = 1, $for_post = 1 ) {
47
 
48
  function inject_jalali_div() { // use for injecting jalali input boxes and month list under the default georgian date place
49
  jQuery("#timestampdiv *").hide();
 
 
50
  jQuery("#timestampdiv").append('<div id="jalalitimestamp"></div>');
51
  jQuery("#jalalitimestamp").append('<select tabindex="501" onchange="jalali_timestamp_func()" name="jm" id="jm_select"></select> ');
52
  <?php
@@ -62,9 +64,12 @@ function jalali_touch_time( $edit = 1, $for_post = 1 ) {
62
  jQuery("#jalalitimestamp").append('<br />ساعت: <input tabindex="503" type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="jalali_timestamp_func()" /> : <input tabindex="504" type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="jalali_timestamp_func()" /> دقیقه');
63
 
64
  jQuery("select#mm, input#jj, input#aa").attr("onchange","georgian_timestamp_func()");
65
- <?php
 
 
 
66
  if ( $edit ) {
67
- echo "jQuery(\"a.edit-timestamp\").before('" . farsi_num(sprintf( __('<br /> %2$s %1$s / %3$s در %4$s:%5$s' ), $j_month_name[$jm], $jd, $jy, $hh, $mn )) . " <br />');\n";
68
  }
69
  ?>
70
  }
47
 
48
  function inject_jalali_div() { // use for injecting jalali input boxes and month list under the default georgian date place
49
  jQuery("#timestampdiv *").hide();
50
+ jQuery("#timestampdiv p *").show();
51
+ jQuery("#timestampdiv p").show();
52
  jQuery("#timestampdiv").append('<div id="jalalitimestamp"></div>');
53
  jQuery("#jalalitimestamp").append('<select tabindex="501" onchange="jalali_timestamp_func()" name="jm" id="jm_select"></select> ');
54
  <?php
64
  jQuery("#jalalitimestamp").append('<br />ساعت: <input tabindex="503" type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="jalali_timestamp_func()" /> : <input tabindex="504" type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="jalali_timestamp_func()" /> دقیقه');
65
 
66
  jQuery("select#mm, input#jj, input#aa").attr("onchange","georgian_timestamp_func()");
67
+ jQuery(".save-timestamp").click(function(){
68
+ jQuery("#jalali-edit-date").text(jQuery('#jd').attr('value')+' '+ jQuery('select#jm_select > option:selected').text()+ ' ' + jQuery('#jy').attr('value') + ' در ' + jQuery('#hh').attr('value') + ':' + jQuery('#mn').attr('value'));
69
+ });
70
+ <?php
71
  if ( $edit ) {
72
+ echo "jQuery(\"a.edit-timestamp\").before('" . farsi_num(sprintf( __('<br /><span style="text-align:right;direction:rtl;" id="jalali-edit-date"> %2$s %1$s / %3$s در %4$s:%5$s' ), $j_month_name[$jm], $jd, $jy, $hh, $mn )) . " </span> ');\n";
73
  }
74
  ?>
75
  }
inc/tables-date.php CHANGED
@@ -1,6 +1,12 @@
1
  <?php
 
 
 
 
 
 
 
2
  add_filter('post_date_column_time', 'wp_fa_date_columns');
3
- //add_filter('media_date_column_time', 'wp_fa_date_columns');
4
  function wp_fa_date_columns($time) {
5
  $arrtime = split('/', $time);
6
  if(count($arrtime) == 1)
@@ -9,12 +15,12 @@ function wp_fa_date_columns($time) {
9
  $time = jdate('d M Y',$gmt);
10
  return $time;
11
  }
12
- function wp_fa_media_date_columns($time) {
13
- //print_r($time);
14
- }
15
 
16
- add_action('restrict_manage_posts', 'wp_fa_restrict_manage_posts');
17
 
 
 
 
 
18
  function wp_fa_restrict_manage_posts() {
19
  global $post_type, $wpdb, $wp_locale;
20
 
@@ -53,11 +59,61 @@ function wp_fa_restrict_manage_posts() {
53
  <?php
54
  }
55
 
56
- add_action('load-edit.php', 'wp_fa_admin_head');
57
- add_action('admin_init', 'wp_fa_admin_head');
58
 
59
- function wp_fa_admin_head() {
60
  add_filter('posts_where', 'wp_fa_posts_where');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
 
63
  function wp_fa_posts_where($where) {
@@ -70,8 +126,10 @@ function wp_fa_posts_where($where) {
70
  return $where;
71
  }
72
 
 
 
 
73
  add_action('admin_footer', 'wp_fa_admin_footer', 9999);
74
-
75
  function wp_fa_admin_footer() {
76
  ?>
77
  <script type="text/javascript" language="javascript">
1
  <?php
2
+
3
+ /* Originally written by Reza Moallemi , www.moallemi.ir */
4
+
5
+
6
+ /*
7
+ * Hook into default wordpress date column for posts date
8
+ */
9
  add_filter('post_date_column_time', 'wp_fa_date_columns');
 
10
  function wp_fa_date_columns($time) {
11
  $arrtime = split('/', $time);
12
  if(count($arrtime) == 1)
15
  $time = jdate('d M Y',$gmt);
16
  return $time;
17
  }
 
 
 
18
 
 
19
 
20
+ /*
21
+ * Hook into default wordpress filter in order to filter post by jalali date
22
+ */
23
+ add_action('restrict_manage_posts', 'wp_fa_restrict_manage_posts');
24
  function wp_fa_restrict_manage_posts() {
25
  global $post_type, $wpdb, $wp_locale;
26
 
59
  <?php
60
  }
61
 
62
+ add_action('load-edit.php', 'wp_fa_admin_init');
63
+ add_action('admin_init', 'wp_fa_admin_init');
64
 
65
+ function wp_fa_admin_init() {
66
  add_filter('posts_where', 'wp_fa_posts_where');
67
+
68
+ /*
69
+ * Hook into media date column to support jalali date for WP 3.1 and later only
70
+ */
71
+ add_filter('manage_media_columns', 'wp_fa_new_media_columns');
72
+ add_action('manage_media_custom_column', 'wp_fa_manage_media_columns', 10, 2);
73
+ add_filter('manage_upload_sortable_columns', 'wp_fa_media_date_register_sortable');
74
+ add_filter('request', 'wp_fa_date_fa_column_orderby');
75
+ }
76
+
77
+ function wp_fa_date_fa_column_orderby( $vars ) {
78
+ if (isset($vars['orderby']) && 'date_fa' == $vars['orderby']) {
79
+ $vars = array_merge( $vars, array(
80
+ 'orderby' => 'date'
81
+ ) );
82
+ }
83
+ return $vars;
84
+ }
85
+
86
+ function wp_fa_media_date_register_sortable( $columns ) {
87
+ $columns['date_fa'] = 'date_fa';
88
+ return $columns;
89
+ }
90
+
91
+ function wp_fa_new_media_columns($default_columns) {
92
+ unset($default_columns['date']);
93
+ $default_columns['date_fa'] = _x('Date', 'column name');
94
+ return $default_columns;
95
+ }
96
+
97
+ function wp_fa_manage_media_columns($column_name, $id) {
98
+ if($column_name == 'date_fa') {
99
+ global $post, $id;
100
+ if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
101
+ $t_time = $h_time = __( 'Unpublished' );
102
+ } else {
103
+ $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
104
+ $m_time = $post->post_date;
105
+ $time = get_post_time( 'G', true, $post, false );
106
+ if ( ( abs( $t_diff = time() - $time ) ) < 86400 ) {
107
+ if ( $t_diff < 0 )
108
+ $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
109
+ else
110
+ $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
111
+ } else {
112
+ $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
113
+ }
114
+ }
115
+ echo wp_fa_date_columns($h_time);
116
+ }
117
  }
118
 
119
  function wp_fa_posts_where($where) {
126
  return $where;
127
  }
128
 
129
+ /*
130
+ * Use this hack to hide the default wordpress month filter in edit.php (List off all posts)
131
+ */
132
  add_action('admin_footer', 'wp_fa_admin_footer', 9999);
 
133
  function wp_fa_admin_footer() {
134
  ?>
135
  <script type="text/javascript" language="javascript">
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mani_monaj, Gonahkar
3
  Donate link: http://www.wishlistr.com/mani_monaj/
4
  Tags: Persian, Farsi, Jalali, Date, Calendar, i18n, l10n, Iran, Iranian
5
  Requires at least: 2.1
6
- Tested up to: 3.1
7
- Stable tag: 4.3
8
 
9
  Turn you Wordpress into a full featured Persian (Iranian) Blogging Platform.
10
 
3
  Donate link: http://www.wishlistr.com/mani_monaj/
4
  Tags: Persian, Farsi, Jalali, Date, Calendar, i18n, l10n, Iran, Iranian
5
  Requires at least: 2.1
6
+ Tested up to: 3.5
7
+ Stable tag: 4.4
8
 
9
  Turn you Wordpress into a full featured Persian (Iranian) Blogging Platform.
10
 
wp-jalali.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
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.3
7
  Author: Vali Allah(Mani) Monajjemi
8
  Author URI: http://www.manionline.org/
9
  */
@@ -35,7 +35,7 @@ Special Thanks to :
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
- * Reza Mo'allemi (moallemi.ir) for Jalali date in tables.
39
  */
40
 
41
  define("MPS_JD_VER","4.1");
@@ -64,7 +64,7 @@ function mps_jd_menu(){
64
  */
65
  if(function_exists('add_options_page')) {
66
  //add_options_page("تنظیمات وردپرس فارسی", "وردپرس فارسی", 10, __FILE__,'mps_jd_optionpage');
67
- add_menu_page("تنظیمات وردپرس فارسی", "وردپرس فارسی", 10, __FILE__,'mps_jd_optionpage');
68
  }
69
 
70
  $mps_jd_optionsDB = get_option(MPS_JD_OPTIONS_NAME);
1
  <?php
2
  /*
3
  Plugin Name: wp-jalali
4
+ Plugin URI: http://wp-persian.com/plugins/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.4
7
  Author: Vali Allah(Mani) Monajjemi
8
  Author URI: http://www.manionline.org/
9
  */
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
+ * Reza Moallemi (moallemi.ir) for Jalali date in tables.
39
  */
40
 
41
  define("MPS_JD_VER","4.1");
64
  */
65
  if(function_exists('add_options_page')) {
66
  //add_options_page("تنظیمات وردپرس فارسی", "وردپرس فارسی", 10, __FILE__,'mps_jd_optionpage');
67
+ add_menu_page("تنظیمات وردپرس فارسی", "وردپرس فارسی", 10, 'wp-jalali','mps_jd_optionpage', plugins_url('wp-jalali/images/logo.png'));
68
  }
69
 
70
  $mps_jd_optionsDB = get_option(MPS_JD_OPTIONS_NAME);