Version Description
Download this release
Release Info
Developer | Gonahkar |
Plugin | wp-jalali |
Version | 4.3 |
Comparing to | |
See all releases |
Code changes from version 4.2.4 to 4.3
- inc/deprecated.php +1 -1
- inc/editjalali-core.php +1 -1
- inc/farsinum-core.php +14 -0
- inc/jalali-core.php +33 -14
- inc/tables-date.php +84 -0
- inc/widgets-core.php +13 -13
- readme.txt +6 -4
- screenshot-1.png +0 -0
- wp-jalali.php +80 -53
inc/deprecated.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
if (!function_exists('fetch_rss')) require_once (ABSPATH . WPINC . '/
|
3 |
if (!function_exists('error')) {
|
4 |
function error ($errormsg, $lvl=E_USER_WARNING) {
|
5 |
// append PHP's error message if track_errors enabled
|
1 |
<?php
|
2 |
+
if (!function_exists('fetch_rss')) require_once (ABSPATH . WPINC . '/class-simplepie.php');
|
3 |
if (!function_exists('error')) {
|
4 |
function error ($errormsg, $lvl=E_USER_WARNING) {
|
5 |
// append PHP's error message if track_errors enabled
|
inc/editjalali-core.php
CHANGED
@@ -42,7 +42,7 @@ function jalali_touch_time( $edit = 1, $for_post = 1 ) {
|
|
42 |
jQuery('#jj').attr('value',gd);
|
43 |
jQuery('#aa').attr('value',gy);
|
44 |
if(gm<10) gm = "0"+gm;
|
45 |
-
jQuery('select
|
46 |
}
|
47 |
|
48 |
function inject_jalali_div() { // use for injecting jalali input boxes and month list under the default georgian date place
|
42 |
jQuery('#jj').attr('value',gd);
|
43 |
jQuery('#aa').attr('value',gy);
|
44 |
if(gm<10) gm = "0"+gm;
|
45 |
+
jQuery('div.timestamp-wrap > select#mm > option[value='+gm+']').attr('selected','selected');
|
46 |
}
|
47 |
|
48 |
function inject_jalali_div() { // use for injecting jalali input boxes and month list under the default georgian date place
|
inc/farsinum-core.php
CHANGED
@@ -23,4 +23,18 @@ function convertToFarsi($matches) {
|
|
23 |
function farsi_num($num,$fake = null,$fake2=null) {
|
24 |
return preg_replace_callback('/(?:&#\d{2,4};)|(\d+[\.\d]*)|(?:[a-z](?:[\x00-\x3B\x3D-\x7F]|<\s*[^>]+>)*)|<\s*[^>]+>/i', 'convertToFarsi', $num);
|
25 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
?>
|
23 |
function farsi_num($num,$fake = null,$fake2=null) {
|
24 |
return preg_replace_callback('/(?:&#\d{2,4};)|(\d+[\.\d]*)|(?:[a-z](?:[\x00-\x3B\x3D-\x7F]|<\s*[^>]+>)*)|<\s*[^>]+>/i', 'convertToFarsi', $num);
|
25 |
}
|
26 |
+
|
27 |
+
function english_num($num) {
|
28 |
+
$mps_jd_optionsDB = get_option(MPS_JD_OPTIONS_NAME);
|
29 |
+
$mps_jd_decimal = $mps_jd_optionsDB['mps_jd_decimal'];
|
30 |
+
if($mps_jd_decimal == true)
|
31 |
+
//$farsi_array = array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", "<sub><small>/</small></sub>");
|
32 |
+
$farsi_array = array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", "٫");
|
33 |
+
else
|
34 |
+
$farsi_array = array("۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹", ".");
|
35 |
+
|
36 |
+
$english_array = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".");
|
37 |
+
|
38 |
+
return str_replace($farsi_array, $english_array, $num);
|
39 |
+
}
|
40 |
?>
|
inc/jalali-core.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
3 |
/* Jalali Core Functions */
|
4 |
|
5 |
define("_JDF_USE_PERSIANNUM","0");
|
@@ -24,18 +27,6 @@ define('_JDF_Wed_SHORT','چ');
|
|
24 |
define('_JDF_Thu_SHORT','پ');
|
25 |
define('_JDF_Fri_SHORT','ج');
|
26 |
define('_JDF_Suffix','م');
|
27 |
-
define('_JDF_Far','فروردین');
|
28 |
-
define('_JDF_Ord','اردیبهشت');
|
29 |
-
define('_JDF_Kho','خرداد');
|
30 |
-
define('_JDF_Tir','تیر');
|
31 |
-
define('_JDF_Mor','مرداد');
|
32 |
-
define('_JDF_Sha','شهریور');
|
33 |
-
define('_JDF_Meh','مهر');
|
34 |
-
define('_JDF_Aba','آبان');
|
35 |
-
define('_JDF_Aza','آذر');
|
36 |
-
define('_JDF_Dey','دی');
|
37 |
-
define('_JDF_Bah','بهمن');
|
38 |
-
define('_JDF_Esf','اسفند');
|
39 |
define('_JDF_Num0','۰');
|
40 |
define('_JDF_Num1','۱');
|
41 |
define('_JDF_Num2','۲');
|
@@ -46,10 +37,38 @@ define('_JDF_Num6','۶');
|
|
46 |
define('_JDF_Num7','۷');
|
47 |
define('_JDF_Num8','۸');
|
48 |
define('_JDF_Num9','۹');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
$g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
|
51 |
$j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
|
52 |
-
$j_month_name = array("", "فروردین", "اردیبهشت", "خرداد", "تیر","مرداد", "شهریور", "مهر", "آبان", "آذر","دی", "بهمن", "اسفند");
|
53 |
$j_day_name = array("یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه");
|
54 |
$jday_abbrev = array("ی","د","س","چ","پ","ج","ش");
|
55 |
|
1 |
<?php
|
2 |
+
/* get options for month names (IR|AF) */
|
3 |
+
$mps_jd_optionsDB = get_option(MPS_JD_OPTIONS_NAME);
|
4 |
+
$country = $mps_jd_optionsDB['mps_jd_country'];
|
5 |
+
|
6 |
/* Jalali Core Functions */
|
7 |
|
8 |
define("_JDF_USE_PERSIANNUM","0");
|
27 |
define('_JDF_Thu_SHORT','پ');
|
28 |
define('_JDF_Fri_SHORT','ج');
|
29 |
define('_JDF_Suffix','م');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
define('_JDF_Num0','۰');
|
31 |
define('_JDF_Num1','۱');
|
32 |
define('_JDF_Num2','۲');
|
37 |
define('_JDF_Num7','۷');
|
38 |
define('_JDF_Num8','۸');
|
39 |
define('_JDF_Num9','۹');
|
40 |
+
if($country == 'AF') {
|
41 |
+
define('_JDF_Far','حمل');
|
42 |
+
define('_JDF_Ord','ثور');
|
43 |
+
define('_JDF_Kho','جوزا');
|
44 |
+
define('_JDF_Tir','سرطان');
|
45 |
+
define('_JDF_Mor','اسد');
|
46 |
+
define('_JDF_Sha','سنبله');
|
47 |
+
define('_JDF_Meh','میزان');
|
48 |
+
define('_JDF_Aba','عقرب');
|
49 |
+
define('_JDF_Aza','قوس');
|
50 |
+
define('_JDF_Dey','جدی');
|
51 |
+
define('_JDF_Bah','دلو');
|
52 |
+
define('_JDF_Esf','حوت');
|
53 |
+
$j_month_name = array("", "حمل", "ثور", "جوزا", "سرطان","اسد", "سنبله", "میزان", "عقرب", "قوس","جدی", "دلو", "حوت");
|
54 |
+
} else {
|
55 |
+
define('_JDF_Far','فروردین');
|
56 |
+
define('_JDF_Ord','اردیبهشت');
|
57 |
+
define('_JDF_Kho','خرداد');
|
58 |
+
define('_JDF_Tir','تیر');
|
59 |
+
define('_JDF_Mor','مرداد');
|
60 |
+
define('_JDF_Sha','شهریور');
|
61 |
+
define('_JDF_Meh','مهر');
|
62 |
+
define('_JDF_Aba','آبان');
|
63 |
+
define('_JDF_Aza','آذر');
|
64 |
+
define('_JDF_Dey','دی');
|
65 |
+
define('_JDF_Bah','بهمن');
|
66 |
+
define('_JDF_Esf','اسفند');
|
67 |
+
$j_month_name = array("", "فروردین", "اردیبهشت", "خرداد", "تیر","مرداد", "شهریور", "مهر", "آبان", "آذر","دی", "بهمن", "اسفند");
|
68 |
+
}
|
69 |
|
70 |
$g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
|
71 |
$j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
|
|
|
72 |
$j_day_name = array("یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه");
|
73 |
$jday_abbrev = array("ی","د","س","چ","پ","ج","ش");
|
74 |
|
inc/tables-date.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
7 |
+
return farsi_num($time);
|
8 |
+
$gmt = mktime(0,0,0,$arrtime[1],$arrtime[2],$arrtime[0]);
|
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 |
+
|
21 |
+
$months = $wpdb->get_results( $wpdb->prepare( "
|
22 |
+
SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month, DAY( post_date ) as day
|
23 |
+
FROM $wpdb->posts
|
24 |
+
WHERE post_type = %s AND post_status <> 'auto-draft'
|
25 |
+
ORDER BY post_date DESC
|
26 |
+
", $post_type ) );
|
27 |
+
$month_count = count( $months );
|
28 |
+
if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
|
29 |
+
return;
|
30 |
+
$m = isset( $_GET['mfa'] ) ? (int) $_GET['mfa'] : 0;
|
31 |
+
?>
|
32 |
+
<select name='mfa'>
|
33 |
+
<option<?php selected( $m, 0 ); ?> value='0'><?php _e( 'Show all dates' ); ?></option>
|
34 |
+
<?php
|
35 |
+
foreach ( $months as $arc_row ) {
|
36 |
+
if ( 0 == $arc_row->year )
|
37 |
+
continue;
|
38 |
+
$month = zeroise( $arc_row->month, 2 );
|
39 |
+
$year = $arc_row->year;
|
40 |
+
$gmt = mktime(0 ,0 , 0, $month, $arc_row->day, $year);
|
41 |
+
$dateshow = jdate('M Y',$gmt);
|
42 |
+
$date = english_num(jdate('Ym',$gmt));
|
43 |
+
if($predate != $date)
|
44 |
+
printf( "<option %s value='?m=%s'>%s</option>\n",
|
45 |
+
selected( $m, $year . $month, false ),
|
46 |
+
esc_attr( $date ),
|
47 |
+
$dateshow
|
48 |
+
);
|
49 |
+
$predate = $date;
|
50 |
+
}
|
51 |
+
?>
|
52 |
+
</select>
|
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) {
|
64 |
+
global $wpdb, $wp_query;
|
65 |
+
if( isset($_GET['mfa']) and $_GET['mfa'] != '0' )
|
66 |
+
{
|
67 |
+
$wp_query->query_vars['m'] = substr($_GET['mfa'], strpos($_GET['mfa'], '=') + 1);
|
68 |
+
$where = mps_jalali_query($where);
|
69 |
+
}
|
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">
|
78 |
+
jQuery(document).ready(function() {
|
79 |
+
jQuery('select[name="m"]').hide()
|
80 |
+
});
|
81 |
+
</script>
|
82 |
+
<?php
|
83 |
+
}
|
84 |
+
?>
|
inc/widgets-core.php
CHANGED
@@ -3,7 +3,7 @@ function widget_mps_calendar_init() {
|
|
3 |
if ( !function_exists('mps_calendar') )
|
4 |
return;
|
5 |
|
6 |
-
if ( !function_exists('
|
7 |
return;
|
8 |
|
9 |
function mps_calendar_widget($args) {
|
@@ -32,15 +32,15 @@ function widget_mps_calendar_init() {
|
|
32 |
<?php
|
33 |
}
|
34 |
|
35 |
-
|
36 |
-
|
37 |
}
|
38 |
|
39 |
function widget_jarchive_init() {
|
40 |
if ( !function_exists('wp_get_jarchives') )
|
41 |
return;
|
42 |
|
43 |
-
if ( !function_exists('
|
44 |
return;
|
45 |
|
46 |
function jarchive_widget($args) {
|
@@ -89,21 +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="yearly" id="yearly"
|
93 |
-
<input name="jarchive_type" type="radio" value="monthly" id="monthly"
|
94 |
-
<input name="jarchive_type" type="radio" value="daily" id="daily"
|
95 |
-
<input name="jarchive_type" type="radio" value="postbypost" id="postbypost"
|
96 |
-
<input name="jarchive_show_post_count" type="checkbox" value="1" id="show_post_count"
|
97 |
-
<input name="jarchives_dropdown" type="checkbox" value="1" id="dropdown"
|
98 |
<input type="hidden" id="jarchive_submit" name="jarchive_submit" value="1" />
|
99 |
</div>
|
100 |
<?php
|
101 |
}
|
102 |
|
103 |
-
|
104 |
if(get_bloginfo('version') < 2.5)
|
105 |
-
|
106 |
else
|
107 |
-
|
108 |
}
|
109 |
?>
|
3 |
if ( !function_exists('mps_calendar') )
|
4 |
return;
|
5 |
|
6 |
+
if ( !function_exists('wp_register_sidebar_widget') )
|
7 |
return;
|
8 |
|
9 |
function mps_calendar_widget($args) {
|
32 |
<?php
|
33 |
}
|
34 |
|
35 |
+
wp_register_sidebar_widget(1000, 'Jalali Calendar','mps_calendar_widget');
|
36 |
+
wp_register_widget_control(1000, 'Jalali Calendar', 'widget_mps_calendar_control', 250, 100);
|
37 |
}
|
38 |
|
39 |
function widget_jarchive_init() {
|
40 |
if ( !function_exists('wp_get_jarchives') )
|
41 |
return;
|
42 |
|
43 |
+
if ( !function_exists('wp_register_sidebar_widget') )
|
44 |
return;
|
45 |
|
46 |
function jarchive_widget($args) {
|
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" <?php echo $options['type']=='yearly' ? 'checked="checked"':'' ?> /> <label for="yearly">سالیانه</label><br />
|
93 |
+
<input name="jarchive_type" type="radio" value="monthly" id="monthly" <?php echo $options['type']=='monthly' ? 'checked="checked"':'' ?> /> <label for="monthly">ماهیانه</label><br />
|
94 |
+
<input name="jarchive_type" type="radio" value="daily" id="daily" <?php echo $options['type']=='daily' ? 'checked="checked"':'' ?> /> <label for="daily">روزانه</label><br />
|
95 |
+
<input name="jarchive_type" type="radio" value="postbypost" id="postbypost" <?php echo $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" <?php echo $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" <?php echo $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 |
+
wp_register_sidebar_widget(1001, 'Jalali Archive','jarchive_widget');
|
104 |
if(get_bloginfo('version') < 2.5)
|
105 |
+
wp_register_widget_control(1001, 'Jalali Archive', 'widget_jarchive_control', 300, 150);
|
106 |
else
|
107 |
+
wp_register_widget_control(1001,'Jalali Archive', 'widget_jarchive_control');
|
108 |
}
|
109 |
?>
|
readme.txt
CHANGED
@@ -3,14 +3,14 @@ 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.
|
7 |
-
Stable tag: 4.
|
8 |
|
9 |
Turn you Wordpress into a full featured Persian (Iranian) Blogging Platform.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
This plug-in is a "Full Jalali (خورشیدی - شمسی) Date and Persian (Farsi) (فارسی)" Support Package for wordpress. This plug-in with listed features is a great tool for Iranian users of Wordpress.
|
14 |
|
15 |
* Full posts' and comments' dates' conversion.
|
16 |
* Jalali (Monthly and Daily) Archive template tag.
|
@@ -23,6 +23,8 @@ This plug-in is a "Full Jalali (خورشیدی - شمسی) Date and Persian (Far
|
|
23 |
* Auto Persian numbers conversion.
|
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 |
|
@@ -41,7 +43,7 @@ You can read complete documentations on the [plug-in documentation page](http://
|
|
41 |
|
42 |
= What is Wordpress Persian Project (پروژه وردپرس فارسی) =
|
43 |
|
44 |
-
Just take a look at [this page](http://
|
45 |
|
46 |
== Screenshots ==
|
47 |
|
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 |
|
11 |
== Description ==
|
12 |
|
13 |
+
This plug-in is a "Full Jalali (خورشیدی - شمسی) Date and Persian (Farsi) (فارسی)" Support Package for wordpress by [WP-Persian.com](http://wp-persian.com/). This plug-in with listed features is a great tool for Iranian users of Wordpress.
|
14 |
|
15 |
* Full posts' and comments' dates' conversion.
|
16 |
* Jalali (Monthly and Daily) Archive template tag.
|
23 |
* Auto Persian numbers conversion.
|
24 |
* Fully customizable through specific Wordpress admin page.
|
25 |
* Jalali timestamp edit in new post and new page sections
|
26 |
+
* Jalali dates in edit tables
|
27 |
+
* Iran and Afghanistan month names.
|
28 |
|
29 |
This plug-in is now part of [Persian Wordpress Project](http://wp-persian.com/ "پروژه وردپرس فارسی")
|
30 |
|
43 |
|
44 |
= What is Wordpress Persian Project (پروژه وردپرس فارسی) =
|
45 |
|
46 |
+
Just take a look at [this page](http://wp-persian.com/en/about/).
|
47 |
|
48 |
== Screenshots ==
|
49 |
|
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.
|
7 |
Author: Vali Allah(Mani) Monajjemi
|
8 |
Author URI: http://www.manionline.org/
|
9 |
*/
|
@@ -35,13 +35,13 @@ 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 |
-
|
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',
|
45 |
|
46 |
require_once(MPS_JD_DIR.'/inc/jalali-core.php');
|
47 |
require_once(MPS_JD_DIR.'/inc/deprecated.php');
|
@@ -50,6 +50,7 @@ require_once(MPS_JD_DIR.'/inc/farsinum-core.php');
|
|
50 |
require_once(MPS_JD_DIR.'/inc/dashboard-core.php');
|
51 |
require_once(MPS_JD_DIR.'/inc/widgets-core.php');
|
52 |
require_once(MPS_JD_DIR.'/inc/editjalali-core.php');
|
|
|
53 |
//require_once(MPS_JD_DIR.'/inc/tinymce-button.php');
|
54 |
|
55 |
/* Menu Init */
|
@@ -83,6 +84,7 @@ function mps_jd_menu(){
|
|
83 |
$mps_jd_optionsDB['mps_jd_autoyk'] = $mps_jd_autoyk = true;
|
84 |
$mps_jd_optionsDB['mps_jd_editjalali'] = $mps_jd_editjalali = true;
|
85 |
$mps_jd_optionsDB['mps_jd_dashboard'] = $mps_jd_dashboard = 0;
|
|
|
86 |
update_option(MPS_JD_OPTIONS_NAME,$mps_jd_optionsDB);
|
87 |
}
|
88 |
}
|
@@ -123,6 +125,7 @@ function mps_jd_optionpage(){
|
|
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'];
|
125 |
$mps_jd_optionsDB['mps_jd_editjalali'] = $mps_jd_editjalali = $_POST['mps_jd_editjalali'];
|
|
|
126 |
$old_options = get_option(MPS_JD_OPTIONS_NAME);
|
127 |
if ($old_options['mps_jd_dashboard'] != $_POST['mps_jd_dashboard']) {
|
128 |
// Dashboard wigdets updating ... Needs to reset some terms
|
@@ -154,6 +157,7 @@ function mps_jd_optionpage(){
|
|
154 |
$mps_jd_jperma = $mps_jd_optionsDB['mps_jd_jperma'];
|
155 |
$mps_jd_autoyk = $mps_jd_optionsDB['mps_jd_autoyk'];
|
156 |
$mps_jd_editjalali = $mps_jd_optionsDB['mps_jd_editjalali'];
|
|
|
157 |
$mps_jd_dashboard = $mps_jd_optionsDB['mps_jd_dashboard'];
|
158 |
|
159 |
if((isset($mps_ERR)) && (!empty($mps_ERR))) {
|
@@ -217,15 +221,13 @@ function mps_jd_optionpage(){
|
|
217 |
<h2>اخبار وردپرس فارسی</h2>
|
218 |
<table class="form-table">
|
219 |
<tr valign="top">
|
220 |
-
<th scope="row"
|
221 |
<td>
|
222 |
<select name="mps_jd_dashboard" id="mps_jd_dashboard">
|
223 |
-
<option value="0" <?php echo $mps_jd_dashboard==0? 'selected="selected"':'' ?>>بر اساس تنظیمات
|
224 |
<option value="1" <?php echo $mps_jd_dashboard==1? 'selected="selected"':'' ?>>نمایش اخبار اصلی وردپرس به زبان انگلیسی</option>
|
225 |
<option value="2" <?php echo $mps_jd_dashboard==2?'selected="selected"':'' ?>>نمایش اخبار وردپرس فارسی</option>
|
226 |
</select>
|
227 |
-
<br />
|
228 |
-
در این نسخه از وردپرس، اخبار وردپرس فارسی در صفحه <a href="<?php echo get_option('siteurl'); ?>/wp-admin/">پیش خوان</a> (Dashboard) نمایش داده می شوند.
|
229 |
</td>
|
230 |
</tr>
|
231 |
</table>
|
@@ -238,13 +240,13 @@ function mps_jd_optionpage(){
|
|
238 |
<th scope="row">تبدیل خودکار تاریخ نوشتهها و نظرات به تاریخ خورشیدی(شمسی)</th>
|
239 |
<td>
|
240 |
<select name="mps_jd_autodate" id="mps_jd_autodate">
|
241 |
-
<option value="1" <?php echo $mps_jd_autodate==true? 'selected="selected"':'' ?>>فعال (پیشنهاد
|
242 |
<option value="0" <?php echo $mps_jd_autodate==false?'selected="selected"':'' ?>>غیر فعال</option>
|
243 |
</select>
|
244 |
</td>
|
245 |
</tr>
|
246 |
<tr valign="top">
|
247 |
-
<th scope="row"
|
248 |
<td>
|
249 |
<table border="0" cellpadding="2" cellspacing="2">
|
250 |
<tr>
|
@@ -292,14 +294,14 @@ function mps_jd_optionpage(){
|
|
292 |
</td>
|
293 |
</tr>
|
294 |
<tr valign="top">
|
295 |
-
<th scope="row">تبدیل خودکار تاریخ در
|
296 |
<td>
|
297 |
<select name="mps_jd_jperma" id="mps_jd_jperma">
|
298 |
<option value="1" <?php echo $mps_jd_jperma==true? 'selected="selected"':'' ?>>بله</option>
|
299 |
<option value="0" <?php echo $mps_jd_jperma==false?'selected="selected"':'' ?>>خیر</option>
|
300 |
</select>
|
301 |
<br />
|
302 |
-
تبدیل خودکار تاریخ در
|
303 |
</td>
|
304 |
</tr>
|
305 |
<tr valign="top">
|
@@ -324,6 +326,17 @@ function mps_jd_optionpage(){
|
|
324 |
در نگارشهای بالاتر از وردپرس ۲/۵ می توانید نحوه ویرایش تاریخ نوشتهها و برگهها را تنظیم کنید.
|
325 |
</td>
|
326 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
</table>
|
328 |
<br />
|
329 |
<h2>تنظیمات ساعت و تاریخ</h2>
|
@@ -344,24 +357,24 @@ function mps_jd_optionpage(){
|
|
344 |
</tr>
|
345 |
<tr>
|
346 |
<th scope="row"> </th>
|
347 |
-
<td>ساختارهای زیر مانند <a href="http://php.net/date">تابع <code>date()</code> PHP</a>
|
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(
|
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(
|
358 |
</tr>
|
359 |
<tr>
|
360 |
<th scope="row">روز شروع هفته در تقویم</th>
|
361 |
<td><select name="start_of_week" id="start_of_week">
|
362 |
<?php
|
363 |
for ($day_index = 0; $day_index <= 6; $day_index++) :
|
364 |
-
if ($day_index ==
|
365 |
else $selected = '';
|
366 |
echo "\n\t<option value='$day_index' $selected>$j_day_name[$day_index]</option>";
|
367 |
endfor;
|
@@ -382,7 +395,7 @@ endfor;
|
|
382 |
</div>
|
383 |
<div id="wp-bookmarklet" class="wrap" style="direction:rtl; text-align:right">
|
384 |
<h3>پروژه وردپرس فارسی</h3>
|
385 |
-
<p>این افزونه، بخشی از <a href="http://wp-persian.com/">پروژه وردپرس فارسی</a>
|
386 |
</div>
|
387 |
</div>
|
388 |
|
@@ -418,7 +431,7 @@ function comment_jdate($d='') {
|
|
418 |
$m = $comment->comment_date;
|
419 |
$timestamp = mps_maketimestamp($m);
|
420 |
if ('' == $d) {
|
421 |
-
echo jdate(
|
422 |
} else {
|
423 |
echo jdate($d, $timestamp);
|
424 |
}
|
@@ -430,7 +443,7 @@ function comment_jtime($d='') {
|
|
430 |
$m = $comment->comment_date;
|
431 |
$timestamp = mps_maketimestamp($m);
|
432 |
if ($d == '') {
|
433 |
-
echo jdate(
|
434 |
} else {
|
435 |
echo jdate($d, $timestamp);
|
436 |
}
|
@@ -439,7 +452,7 @@ function comment_jtime($d='') {
|
|
439 |
function mps_the_jdate($input,$d='',$before='', $after='') {
|
440 |
global $id, $post, $day, $previousday, $newday;
|
441 |
$result = '';
|
442 |
-
if ($d == "") $d =
|
443 |
//if ($day != $previousday) {
|
444 |
if (strlen($input) > 0) { //Because $previousday is overwritten before reaching here , nice trick ;)
|
445 |
$m = $post->post_date;
|
@@ -455,7 +468,7 @@ function mps_the_jdate($input,$d='',$before='', $after='') {
|
|
455 |
function mps_the_jtime($input,$d='') {
|
456 |
global $id, $post;
|
457 |
if (!empty($input)){
|
458 |
-
if ($d == "") $d =
|
459 |
$m = $post->post_date;
|
460 |
$timestamp = mps_maketimestamp($m);
|
461 |
$the_time = jdate($d, $timestamp);
|
@@ -470,7 +483,7 @@ function mps_comment_jdate($input, $d = '') {
|
|
470 |
$m = $comment->comment_date;
|
471 |
$timestamp = mps_maketimestamp($m);
|
472 |
if ( '' == $d )
|
473 |
-
$result = jdate(
|
474 |
else
|
475 |
$result = jdate($d, $timestamp);
|
476 |
return $result;
|
@@ -482,7 +495,7 @@ function mps_comment_jtime($input, $d = '') {
|
|
482 |
$m = $comment->comment_date;
|
483 |
$timestamp = mps_maketimestamp($m);
|
484 |
if ( '' == $d )
|
485 |
-
$result = jdate(
|
486 |
else
|
487 |
$result = jdate($d, $timestamp);
|
488 |
return $result;
|
@@ -670,8 +683,8 @@ function mps_get_jarchives($type='', $limit='', $format='html', $before = '', $a
|
|
670 |
$archive_week_separator = '–';
|
671 |
|
672 |
// archive link url
|
673 |
-
$archive_link_m =
|
674 |
-
$archive_link_p =
|
675 |
|
676 |
// over-ride general date format ? 0 = no: use the date format set in Options, 1 = yes: over-ride
|
677 |
$archive_date_format_over_ride = 0;
|
@@ -684,13 +697,13 @@ function mps_get_jarchives($type='', $limit='', $format='html', $before = '', $a
|
|
684 |
$archive_week_end_date_format = 'Y/m/d';
|
685 |
|
686 |
if (!$archive_date_format_over_ride) {
|
687 |
-
$archive_day_date_format =
|
688 |
-
$archive_week_start_date_format =
|
689 |
-
$archive_week_end_date_format =
|
690 |
}
|
691 |
|
692 |
-
$add_hours = intval(
|
693 |
-
$add_minutes = intval(60 * (
|
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");
|
@@ -832,9 +845,9 @@ function get_jcalendar() {
|
|
832 |
if (!$gotsome) return;
|
833 |
}
|
834 |
|
835 |
-
$week_begins = intval(
|
836 |
-
$add_hours = intval(
|
837 |
-
$add_minutes = intval(60 * (
|
838 |
|
839 |
$input_is_gregorian = false;
|
840 |
|
@@ -851,9 +864,9 @@ function get_jcalendar() {
|
|
851 |
}
|
852 |
} else {
|
853 |
$input_is_gregorian = true;
|
854 |
-
$thisyear = gmdate('Y', current_time('timestamp') +
|
855 |
-
$thismonth = gmdate('m', current_time('timestamp') +
|
856 |
-
$thisday = gmdate('d', current_time('timestamp') +
|
857 |
}
|
858 |
|
859 |
if ($input_is_gregorian) {
|
@@ -1019,7 +1032,7 @@ function get_jcalendar() {
|
|
1019 |
if (isset($newrow) && $newrow)
|
1020 |
echo "\n\t</tr>\n\t<tr>\n\t\t";
|
1021 |
$newrow = false;
|
1022 |
-
if ($thisday == gmdate('j', (time() + (
|
1023 |
echo '<td id="today">';
|
1024 |
else
|
1025 |
echo '<td>';
|
@@ -1092,7 +1105,7 @@ function get_jpermalink($old_perma, $post) {
|
|
1092 |
elseif (($post->post_status == 'object') || ($post->post_type == 'attachment'))
|
1093 |
return get_subpost_link($post->ID);
|
1094 |
|
1095 |
-
$permalink =
|
1096 |
|
1097 |
if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {
|
1098 |
$unixtime = strtotime($post->post_date);
|
@@ -1148,18 +1161,33 @@ function mps_comments_number($input){
|
|
1148 |
|
1149 |
function mps_fixmonthnames() {
|
1150 |
global $month;
|
1151 |
-
$
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1163 |
|
1164 |
}
|
1165 |
|
@@ -1373,9 +1401,9 @@ if (!version_compare($_wp_version, '2.4', '<')) { //Wordpress 2.5+ Only
|
|
1373 |
|
1374 |
/* Login Form */
|
1375 |
|
1376 |
-
add_filter('login_headerurl', 'login_url');
|
1377 |
-
add_filter('login_headertitle', 'login_text');
|
1378 |
-
add_action('login_head', 'login_img');
|
1379 |
|
1380 |
/* Theme Widgets */
|
1381 |
|
@@ -1383,5 +1411,4 @@ add_action('widgets_init', 'widget_jarchive_init');
|
|
1383 |
add_action('widgets_init', 'widget_mps_calendar_init');
|
1384 |
|
1385 |
// add_action('wp_print_scripts', 'mps_loadjs');
|
1386 |
-
|
1387 |
?>
|
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 |
* 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");
|
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_option('siteurl').'/wp-content/plugins/wp-jalali');
|
45 |
|
46 |
require_once(MPS_JD_DIR.'/inc/jalali-core.php');
|
47 |
require_once(MPS_JD_DIR.'/inc/deprecated.php');
|
50 |
require_once(MPS_JD_DIR.'/inc/dashboard-core.php');
|
51 |
require_once(MPS_JD_DIR.'/inc/widgets-core.php');
|
52 |
require_once(MPS_JD_DIR.'/inc/editjalali-core.php');
|
53 |
+
require_once(MPS_JD_DIR.'/inc/tables-date.php');
|
54 |
//require_once(MPS_JD_DIR.'/inc/tinymce-button.php');
|
55 |
|
56 |
/* Menu Init */
|
84 |
$mps_jd_optionsDB['mps_jd_autoyk'] = $mps_jd_autoyk = true;
|
85 |
$mps_jd_optionsDB['mps_jd_editjalali'] = $mps_jd_editjalali = true;
|
86 |
$mps_jd_optionsDB['mps_jd_dashboard'] = $mps_jd_dashboard = 0;
|
87 |
+
$mps_jd_optionsDB['mps_jd_country'] = $mps_jd_country = 'IR';
|
88 |
update_option(MPS_JD_OPTIONS_NAME,$mps_jd_optionsDB);
|
89 |
}
|
90 |
}
|
125 |
$mps_jd_optionsDB['mps_jd_jperma'] = $mps_jd_jperma = $_POST['mps_jd_jperma'];
|
126 |
$mps_jd_optionsDB['mps_jd_autoyk'] = $mps_jd_autoyk = $_POST['mps_jd_autoyk'];
|
127 |
$mps_jd_optionsDB['mps_jd_editjalali'] = $mps_jd_editjalali = $_POST['mps_jd_editjalali'];
|
128 |
+
$mps_jd_optionsDB['mps_jd_country'] = $mps_jd_country = $_POST['mps_jd_country'];
|
129 |
$old_options = get_option(MPS_JD_OPTIONS_NAME);
|
130 |
if ($old_options['mps_jd_dashboard'] != $_POST['mps_jd_dashboard']) {
|
131 |
// Dashboard wigdets updating ... Needs to reset some terms
|
157 |
$mps_jd_jperma = $mps_jd_optionsDB['mps_jd_jperma'];
|
158 |
$mps_jd_autoyk = $mps_jd_optionsDB['mps_jd_autoyk'];
|
159 |
$mps_jd_editjalali = $mps_jd_optionsDB['mps_jd_editjalali'];
|
160 |
+
$mps_jd_country = $mps_jd_optionsDB['mps_jd_country'];
|
161 |
$mps_jd_dashboard = $mps_jd_optionsDB['mps_jd_dashboard'];
|
162 |
|
163 |
if((isset($mps_ERR)) && (!empty($mps_ERR))) {
|
221 |
<h2>اخبار وردپرس فارسی</h2>
|
222 |
<table class="form-table">
|
223 |
<tr valign="top">
|
224 |
+
<th scope="row">چگونگی نمایش اخبار در پیشخوان</th>
|
225 |
<td>
|
226 |
<select name="mps_jd_dashboard" id="mps_jd_dashboard">
|
227 |
+
<option value="0" <?php echo $mps_jd_dashboard==0? 'selected="selected"':'' ?>>بر اساس تنظیمات زبان</option>
|
228 |
<option value="1" <?php echo $mps_jd_dashboard==1? 'selected="selected"':'' ?>>نمایش اخبار اصلی وردپرس به زبان انگلیسی</option>
|
229 |
<option value="2" <?php echo $mps_jd_dashboard==2?'selected="selected"':'' ?>>نمایش اخبار وردپرس فارسی</option>
|
230 |
</select>
|
|
|
|
|
231 |
</td>
|
232 |
</tr>
|
233 |
</table>
|
240 |
<th scope="row">تبدیل خودکار تاریخ نوشتهها و نظرات به تاریخ خورشیدی(شمسی)</th>
|
241 |
<td>
|
242 |
<select name="mps_jd_autodate" id="mps_jd_autodate">
|
243 |
+
<option value="1" <?php echo $mps_jd_autodate==true? 'selected="selected"':'' ?>>فعال (پیشنهاد میشود)</option>
|
244 |
<option value="0" <?php echo $mps_jd_autodate==false?'selected="selected"':'' ?>>غیر فعال</option>
|
245 |
</select>
|
246 |
</td>
|
247 |
</tr>
|
248 |
<tr valign="top">
|
249 |
+
<th scope="row">تبدیل اعداد به فارسی</th>
|
250 |
<td>
|
251 |
<table border="0" cellpadding="2" cellspacing="2">
|
252 |
<tr>
|
294 |
</td>
|
295 |
</tr>
|
296 |
<tr valign="top">
|
297 |
+
<th scope="row">تبدیل خودکار تاریخ در نشانی (URI) نوشتهها</th>
|
298 |
<td>
|
299 |
<select name="mps_jd_jperma" id="mps_jd_jperma">
|
300 |
<option value="1" <?php echo $mps_jd_jperma==true? 'selected="selected"':'' ?>>بله</option>
|
301 |
<option value="0" <?php echo $mps_jd_jperma==false?'selected="selected"':'' ?>>خیر</option>
|
302 |
</select>
|
303 |
<br />
|
304 |
+
تبدیل خودکار تاریخ در نشانی نوشتهها، مثلا از yourblog.ir/2008/04/02/post به yourblog.ir/1387/01/13/post
|
305 |
</td>
|
306 |
</tr>
|
307 |
<tr valign="top">
|
326 |
در نگارشهای بالاتر از وردپرس ۲/۵ می توانید نحوه ویرایش تاریخ نوشتهها و برگهها را تنظیم کنید.
|
327 |
</td>
|
328 |
</tr>
|
329 |
+
<tr>
|
330 |
+
<th>نام ماهها مطابق با کشور</th>
|
331 |
+
<td>
|
332 |
+
<select name="mps_jd_country" id="mps_jd_country">
|
333 |
+
<option value="IR" <?php echo $mps_jd_country == 'IR' ? 'selected="selected"':'' ?>>ایران</option>
|
334 |
+
<option value="AF" <?php echo $mps_jd_country == 'AF' ?'selected="selected"':'' ?>>افغانستان</option>
|
335 |
+
</select>
|
336 |
+
<br />
|
337 |
+
نام ماههای ایران: فروردین٬ اردیبهشت و... / نام ماههای افغانستان: حمل٬ ثور و...
|
338 |
+
</td>
|
339 |
+
</tr>
|
340 |
</table>
|
341 |
<br />
|
342 |
<h2>تنظیمات ساعت و تاریخ</h2>
|
357 |
</tr>
|
358 |
<tr>
|
359 |
<th scope="row"> </th>
|
360 |
+
<td>ساختارهای زیر مانند <a href="http://php.net/date">تابع <code>date()</code> PHP</a> است. برای نمایش تغییرات این صفحه را به روز کنید.</td>
|
361 |
</tr>
|
362 |
<tr>
|
363 |
<th scope="row">ساختار تاریخ پیشفرض</th>
|
364 |
<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 />
|
365 |
+
خروجی : <strong><?php echo jdate(get_option('date_format'), $gmt + (get_option('gmt_offset') * 3600)); ?></strong></td>
|
366 |
</tr>
|
367 |
<tr>
|
368 |
<th scope="row">ساختار زمان پیشفرض</th>
|
369 |
<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 />
|
370 |
+
خروجی : <strong><?php echo jdate(get_option('time_format'), $gmt + (get_option('gmt_offset') * 3600)) ; ?></strong></td>
|
371 |
</tr>
|
372 |
<tr>
|
373 |
<th scope="row">روز شروع هفته در تقویم</th>
|
374 |
<td><select name="start_of_week" id="start_of_week">
|
375 |
<?php
|
376 |
for ($day_index = 0; $day_index <= 6; $day_index++) :
|
377 |
+
if ($day_index == get_option('start_of_week')) $selected = " selected='selected'";
|
378 |
else $selected = '';
|
379 |
echo "\n\t<option value='$day_index' $selected>$j_day_name[$day_index]</option>";
|
380 |
endfor;
|
395 |
</div>
|
396 |
<div id="wp-bookmarklet" class="wrap" style="direction:rtl; text-align:right">
|
397 |
<h3>پروژه وردپرس فارسی</h3>
|
398 |
+
<p>این افزونه، بخشی از <a href="http://wp-persian.com/">پروژه وردپرس فارسی</a> است. برای اطلاعات بیشتر در مورد این افزونه میتوانید <a href="http://wp-persian.com/wp-jalali/">صفحه مخصوص این افزونه</a> را مشاهده کنید.</p>
|
399 |
</div>
|
400 |
</div>
|
401 |
|
431 |
$m = $comment->comment_date;
|
432 |
$timestamp = mps_maketimestamp($m);
|
433 |
if ('' == $d) {
|
434 |
+
echo jdate(get_option('date_format'), $timestamp);
|
435 |
} else {
|
436 |
echo jdate($d, $timestamp);
|
437 |
}
|
443 |
$m = $comment->comment_date;
|
444 |
$timestamp = mps_maketimestamp($m);
|
445 |
if ($d == '') {
|
446 |
+
echo jdate(get_option('time_format'), $timestamp);
|
447 |
} else {
|
448 |
echo jdate($d, $timestamp);
|
449 |
}
|
452 |
function mps_the_jdate($input,$d='',$before='', $after='') {
|
453 |
global $id, $post, $day, $previousday, $newday;
|
454 |
$result = '';
|
455 |
+
if ($d == "") $d = get_option('time_format');
|
456 |
//if ($day != $previousday) {
|
457 |
if (strlen($input) > 0) { //Because $previousday is overwritten before reaching here , nice trick ;)
|
458 |
$m = $post->post_date;
|
468 |
function mps_the_jtime($input,$d='') {
|
469 |
global $id, $post;
|
470 |
if (!empty($input)){
|
471 |
+
if ($d == "") $d = get_option('time_format');
|
472 |
$m = $post->post_date;
|
473 |
$timestamp = mps_maketimestamp($m);
|
474 |
$the_time = jdate($d, $timestamp);
|
483 |
$m = $comment->comment_date;
|
484 |
$timestamp = mps_maketimestamp($m);
|
485 |
if ( '' == $d )
|
486 |
+
$result = jdate(get_option('date_format'), $timestamp);
|
487 |
else
|
488 |
$result = jdate($d, $timestamp);
|
489 |
return $result;
|
495 |
$m = $comment->comment_date;
|
496 |
$timestamp = mps_maketimestamp($m);
|
497 |
if ( '' == $d )
|
498 |
+
$result = jdate(get_option('time_format'), $timestamp);
|
499 |
else
|
500 |
$result = jdate($d, $timestamp);
|
501 |
return $result;
|
683 |
$archive_week_separator = '–';
|
684 |
|
685 |
// archive link url
|
686 |
+
$archive_link_m = get_option('siteurl') . '/?m='; # monthly archive;
|
687 |
+
$archive_link_p = get_option('siteurl') . '/?p='; # post-by-post archive;
|
688 |
|
689 |
// over-ride general date format ? 0 = no: use the date format set in Options, 1 = yes: over-ride
|
690 |
$archive_date_format_over_ride = 0;
|
697 |
$archive_week_end_date_format = 'Y/m/d';
|
698 |
|
699 |
if (!$archive_date_format_over_ride) {
|
700 |
+
$archive_day_date_format = get_option('date_format');
|
701 |
+
$archive_week_start_date_format = get_option('date_format');
|
702 |
+
$archive_week_end_date_format = get_option('date_format');
|
703 |
}
|
704 |
|
705 |
+
$add_hours = intval(get_option('gmt_offset'));
|
706 |
+
$add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours));
|
707 |
|
708 |
if ("yearly" == $type) {
|
709 |
$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");
|
845 |
if (!$gotsome) return;
|
846 |
}
|
847 |
|
848 |
+
$week_begins = intval(get_option('start_of_week'));
|
849 |
+
$add_hours = intval(get_option('gmt_offset'));
|
850 |
+
$add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours));
|
851 |
|
852 |
$input_is_gregorian = false;
|
853 |
|
864 |
}
|
865 |
} else {
|
866 |
$input_is_gregorian = true;
|
867 |
+
$thisyear = gmdate('Y', current_time('timestamp') + get_option('gmt_offset') * 3600);
|
868 |
+
$thismonth = gmdate('m', current_time('timestamp') + get_option('gmt_offset') * 3600);
|
869 |
+
$thisday = gmdate('d', current_time('timestamp') + get_option('gmt_offset') * 3600);
|
870 |
}
|
871 |
|
872 |
if ($input_is_gregorian) {
|
1032 |
if (isset($newrow) && $newrow)
|
1033 |
echo "\n\t</tr>\n\t<tr>\n\t\t";
|
1034 |
$newrow = false;
|
1035 |
+
if ($thisday == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)))
|
1036 |
echo '<td id="today">';
|
1037 |
else
|
1038 |
echo '<td>';
|
1105 |
elseif (($post->post_status == 'object') || ($post->post_type == 'attachment'))
|
1106 |
return get_subpost_link($post->ID);
|
1107 |
|
1108 |
+
$permalink = get_option('permalink_structure');
|
1109 |
|
1110 |
if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {
|
1111 |
$unixtime = strtotime($post->post_date);
|
1161 |
|
1162 |
function mps_fixmonthnames() {
|
1163 |
global $month;
|
1164 |
+
if($mps_jd_optionsDB['mps_jd_country'] == 'AF') {
|
1165 |
+
$month['01'] = "حمل";
|
1166 |
+
$month['02'] = "ثور";
|
1167 |
+
$month['03'] = "جوزا";
|
1168 |
+
$month['04'] = "سرطان";
|
1169 |
+
$month['05'] = "اسد";
|
1170 |
+
$month['06'] = "سنبله";
|
1171 |
+
$month['07'] = "میزان";
|
1172 |
+
$month['08'] = "عقرب";
|
1173 |
+
$month['09'] = "قوس";
|
1174 |
+
$month['10'] = "جدی";
|
1175 |
+
$month['11'] = "دلو";
|
1176 |
+
$month['12'] = "حوت";
|
1177 |
+
} else {
|
1178 |
+
$month['01'] = "فروردین";
|
1179 |
+
$month['02'] = "اردیبهشت";
|
1180 |
+
$month['03'] = "خرداد";
|
1181 |
+
$month['04'] = "تیر";
|
1182 |
+
$month['05'] = "مرداد";
|
1183 |
+
$month['06'] = "شهریور";
|
1184 |
+
$month['07'] = "مهر";
|
1185 |
+
$month['08'] = "آبان";
|
1186 |
+
$month['09'] = "آذر";
|
1187 |
+
$month['10'] = "دی";
|
1188 |
+
$month['11'] = "بهمن";
|
1189 |
+
$month['12'] = "اسفند";
|
1190 |
+
}
|
1191 |
|
1192 |
}
|
1193 |
|
1401 |
|
1402 |
/* Login Form */
|
1403 |
|
1404 |
+
add_filter('login_headerurl', 'login_url',999);
|
1405 |
+
add_filter('login_headertitle', 'login_text',999);
|
1406 |
+
add_action('login_head', 'login_img',999);
|
1407 |
|
1408 |
/* Theme Widgets */
|
1409 |
|
1411 |
add_action('widgets_init', 'widget_mps_calendar_init');
|
1412 |
|
1413 |
// add_action('wp_print_scripts', 'mps_loadjs');
|
|
|
1414 |
?>
|