wp-jalali - Version 5.0.0-RC

Version Description

Download this release

Release Info

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

Code changes from version 4.5.3 to 5.0.0-RC

assets/banner-772x250.png ADDED
Binary file
assets/css/admin.css ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'ztjalali_icon';
3
+ src: url('../icon/ztjalali.eot?66463877');
4
+ src: url('../icon/ztjalali.eot?66463877#iefix') format('embedded-opentype'),
5
+ url('../icon/ztjalali.woff?66463877') format('woff'),
6
+ url('../icon/ztjalali.ttf?66463877') format('truetype'),
7
+ url('../icon/ztjalali.svg?66463877#ztjalali') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ /*
13
+ [class^="icon-"]:before, [class*=" icon-"]:before {
14
+ font-family: "zt-wppersian";
15
+ font-style: normal;
16
+ font-weight: normal;
17
+ speak: none;
18
+
19
+ display: inline-block;
20
+ text-decoration: inherit;
21
+ width: 1em;
22
+ margin-right: .2em;
23
+ text-align: center;
24
+ opacity: .8;
25
+
26
+ For safety - reset parent styles, that can break glyph codes
27
+ font-variant: normal;
28
+ text-transform: none;
29
+
30
+ fix buttons height, for twitter bootstrap
31
+ line-height: 1em;
32
+
33
+ Animation center compensation - margins should be symmetric
34
+ remove if not needed
35
+ margin-left: .2em;
36
+
37
+ you can be more comfortable with increased icons size
38
+ font-size: 120%;
39
+
40
+ Uncomment for 3D effect
41
+ text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3);
42
+ }
43
+
44
+ .icon-wppersianb:before { content: '\e800'; } '' */
45
+
46
+ .dashicons-ztjalali:before{
47
+ content: '\e800';
48
+ font-family: "ztjalali_icon";
49
+ font-style: normal;
50
+ font-weight: normal;
51
+ speak: none;
52
+ display: inline-block;
53
+ text-decoration: inherit;
54
+ width: 1em;
55
+ text-align: center;
56
+ opacity: .8;
57
+ }
58
+
59
+ .form-table td{
60
+ font-size: 11px !important;
61
+
62
+ }
63
+ #wpcontent #wp-toolbar .menupop a,#wpcontent #wp-toolbar .menupop a .ab-label {
64
+ font-family: tahoma !important;
65
+ }
66
+ #dashboard_right_now .versions .b, #post-status-display, #post-visibility-display, #adminmenu .wp-submenu li.current, #adminmenu .wp-submenu li.current a, #adminmenu .wp-submenu li.current a:hover, .media-item .percent, .plugins .name, #pass-strength-result.strong, #pass-strength-result.short, #ed_reply_toolbar #ed_reply_strong, .item-controls .item-order a, .feature-filter .feature-name{
67
+ font-weight: normal !important
68
+ }
69
+
70
+ #Jaa, #Jhh, #Jjj, #Jmn {
71
+ font-size: 12px;
72
+ padding: 1px;
73
+ }
74
+ #Jhh, #Jjj, #Jmn {
75
+ width: 2em;
76
+ }
77
+ #Jaa {
78
+ width: 3.4em;
79
+ }
80
+
81
+ .ztjalali_option_logo {
82
+ margin: 20px 0;
83
+ text-align: center;
84
+ }
85
+ .ztjalali-badge {
86
+ background: url("../img/wp-jalali-80x80.png") no-repeat scroll center 24px / 80px 80px #fff !important;
87
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
88
+ color: #78c8e6;
89
+ display: inline-block;
90
+ font-size: 14px;
91
+ font-weight: 600;
92
+ height: 40px;
93
+ margin: 5px 0 0;
94
+ padding-top: 120px;
95
+ text-align: center;
96
+ text-rendering: optimizelegibility;
97
+ width: 150px;
98
+ left: 0;
99
+ position: absolute;
100
+ top: 0;
101
+ }
102
+ .zt-badge {
103
+ background: url("../img/zakrot.com.png") no-repeat scroll center 24px / 80px 80px #fff !important;
104
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
105
+ color: #78c8e6;
106
+ display: inline-block;
107
+ font-size: 14px;
108
+ font-weight: 600;
109
+ height: 40px;
110
+ margin: 5px 0 0;
111
+ padding-top: 120px;
112
+ text-align: center;
113
+ text-rendering: optimizelegibility;
114
+ width: 150px;
115
+ left: 160px;
116
+ position: absolute;
117
+ top: 0;
118
+ }
119
+ .ztjalali-welcome-top{
120
+ margin: 1em 0 1em 350px !important;
121
+ }
122
+ /*#toplevel_page_ztjalali_admin_page .wp-menu-name {
123
+ position: fixed !important;
124
+ }*/
assets/css/admin_style.css ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'yekan';
3
+ src: url('../fonts/BYekan.eot?#') format('eot'), /* IE6–8 */
4
+ url('../fonts/BYekan.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
5
+ url('../fonts/BYekan.ttf') format('truetype'); /* Saf3—5, Chrome4+, FF3.5, Opera 10+ */
6
+ }
7
+
8
+ #adminmenu a.menu-top, #adminmenu .wp-submenu-head{
9
+ font-size: 13px !important;
10
+ font-family: yekan !important;
11
+ }
12
+ #adminmenu .wp-submenu a {
13
+ font-size: 13px;
14
+ font-family: yekan !important;
15
+
16
+ }
17
+ .wrap h2, .subtitle {
18
+ font-weight: normal;
19
+ font-family: yekan !important;
20
+ font-size: 21px !important;
21
+ }
22
+ .form-table th, .form-wrap label {
23
+ font-family: yekan !important;
24
+ font-size: 13px !important;
25
+ font-weight: normal
26
+ }
assets/css/theme_editing.css ADDED
@@ -0,0 +1 @@
 
1
+ .wrap #template textarea{direction: ltr;text-align: left;}
assets/css/wysiwyg.css ADDED
@@ -0,0 +1,2 @@
 
 
1
+ body{font-family:tahoma;font-size:12px;}
2
+ #tinymce{font-family: tahoma; font-size:12px;}
assets/fonts/BYekan.eot ADDED
Binary file
assets/fonts/BYekan.ttf ADDED
Binary file
assets/fonts/BYekan.woff ADDED
Binary file
assets/icon-128x128.png ADDED
Binary file
assets/icon-256x256.png ADDED
Binary file
assets/icon/ztjalali.eot ADDED
Binary file
assets/icon/ztjalali.svg ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2014 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="ztjalali" horiz-adv-x="1000" >
7
+ <font-face font-family="ztjalali" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="wp" unicode="&#xe800;" d="m501 741c-216 0-392-176-392-392 0-216 176-392 392-392 216 0 392 176 392 392 0 216-176 392-392 392z m292-334c-8-20-95-21-124 3-29 24-3 71 37 73 40 2 95-55 87-76z m-151-311c-132-82-306 5-311-2-4-7 92-68 198-102-10 0-19-1-28-1-104 0-198 45-263 116 25 1 212 7 253 43 30 17 75 91 70 174-6 113-68 237-140 229-83-9-131-147-120-231 5-39 37-56 61-60 72-11 131 25 136 23-15-80-205-82-205-82l-117-3c0 0 0 0 0 0-21 45-32 96-32 149 0 131 70 245 175 307l105-60 64 110c4 0 9 0 13 0 110 0 208-49 274-127-12 8-25 13-39 14-73 8-167-245-86-292 66-39 134 2 165 11 13-16-41-135-173-216z m-161 282c-3-11-62-25-115-10-53 16-21 79 25 80 46 1 92-60 90-70z" horiz-adv-x="1000" />
10
+ <glyph glyph-name="zakrot" unicode="&#xe801;" d="m502 741c-217 0-393-176-393-393 0-217 176-392 393-392 217 0 392 175 392 392 0 217-175 393-392 393z m-314-326c72-10 192-30 310-61 74-20 147-45 208-67-58-3-126-8-194-15-124-12-246-32-309-43-14 37-22 77-22 119 0 23 2 46 7 67z m84-291c46-9 103-21 159-36 57-16 113-33 158-49-28-8-57-12-87-12-90 0-172 37-230 97z m408-42c-41 15-135 49-230 74-35 9-70 18-102 25 52 7 112 15 171 21 104 10 209 16 277 19-24-57-65-105-116-139z m-162 340c-116 31-235 51-308 61 51 110 163 186 292 186 177 0 321-143 321-321 0-10-1-20-2-30-67 27-183 72-303 104z" horiz-adv-x="1000" />
11
+ </font>
12
+ </defs>
13
+ </svg>
assets/icon/ztjalali.ttf ADDED
Binary file
assets/icon/ztjalali.woff ADDED
Binary file
assets/img/wp-jalali-80x80.png ADDED
Binary file
assets/img/zakrot.com.png ADDED
Binary file
assets/js/admin-af.js ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ /**
3
+ * create vars
4
+ */
5
+ var jalaliMonthNames = ["", "حمل", "ثور", "جوزا", "سرطان", "اسد", "سنبله", "میزان", "عقرب", "قوس", "جدی", "دلو", "حوت"];
6
+ var timestampdiv = $('#timestampdiv');
7
+ /* =================================================================== */
8
+ /**
9
+ *define functions
10
+ */
11
+ function timestampDivModifier(year, month, day, hour, min) {
12
+ content = '<div class="timestamp-wrap jalaliDivBox">';
13
+ content += '<select id="Jmm" name="Jmm">';
14
+ for (var i = 1; i <= 12; i++) {
15
+ if (i == month)
16
+ sel = 'selected="selected"';
17
+ else
18
+ sel = '';
19
+ content += '<option ' + sel + ' value="' + i + '">' + jalaliMonthNames[i] + '</option>';
20
+ }
21
+ content += '</select>';
22
+
23
+ content += '<input type="text" name="Jjj" value="' + day + '" id="Jjj" size="2" maxlength="2" autocomplete="off" />,';
24
+ content += '<input type="text" name="Jaa" value="' + year + '" id="Jaa" size="4" maxlength="4" autocomplete="off" /> @';
25
+ content += '<input type="text" name="Jmn" value="' + min + '" id="Jmn" size="2" maxlength="2" autocomplete="off" /> : ';
26
+ content += '<input type="text" name="Jhh" value="' + hour + '" id="Jhh" size="2" maxlength="2" autocomplete="off" />';
27
+ content += '</div>';
28
+ return content;
29
+ }
30
+
31
+ function changeTimestampViewer(){
32
+ y = $('input[name=aa]').val();
33
+ m = $('select[name=mm]').val();
34
+ d = $('input[name=jj]').val();
35
+ h = $('input[name=hh]').val();
36
+ i = $('input[name=mn]').val();
37
+ //alert(y+','+m+','+d);
38
+ jd = JalaliDate.gregorianToJalali(y, m, d);
39
+ //alert(jd);
40
+ ret='';
41
+ $text = jalaliMonthNames[jd[1]]+' '+jd[2]+', '+jd[0]+' @'+h+':'+i;
42
+ for (var i = 0; i < $text.length ; i++){
43
+ if(!isNaN($text[i]) && $text[i]!=' '){
44
+ ret += String.fromCharCode($text.charCodeAt(i) + 1728);
45
+ }else{
46
+ ret += $text[i];
47
+ }
48
+ }
49
+ $('#timestamp b').text(ret);
50
+
51
+ }
52
+ /* =================================================================== */
53
+ $('#the-list').on('click', '.editinline', function() {
54
+ var tr = $(this).closest('td');
55
+ var year = tr.find('.aa').html();
56
+ if (year > 1700){
57
+ var month = tr.find('.mm').html();
58
+ var day = tr.find('.jj').html();
59
+ var hour = tr.find('.hh').html();
60
+ var min = tr.find('.mn').html();
61
+ var date = JalaliDate.gregorianToJalali(year, month, day);
62
+ // $('.jalaliDivBox').remove();
63
+ $('.inline-edit-date div').hide();
64
+ $('.inline-edit-date').prepend(timestampDivModifier(date[0], date[1], date[2], hour, min));
65
+ }
66
+ });
67
+
68
+ $('.inline-edit-date').on('keyup', '#Jhh', function(e) {
69
+ $('input[name=hh]').val($(this).val());
70
+ });
71
+
72
+ $('.inline-edit-date').on('keyup', '#Jmn', function(e) {
73
+ $('input[name=mn]').val($(this).val());
74
+ });
75
+
76
+ $('.inline-edit-date').on('keyup', '#Jaa , #Jjj', function(e) {
77
+ year = $('#Jaa').val();
78
+ month = $('#Jmm').val();
79
+ day = $('#Jjj').val();
80
+ date = JalaliDate.jalaliToGregorian(year, month, day);
81
+ $('input[name=aa]').val(date[0]);
82
+ $('select[name=mm]').val(date[1]);
83
+ $('input[name=jj]').val(date[2]);
84
+ });
85
+
86
+ $('.inline-edit-date').on('change', '#Jmm', function() {
87
+ year = $('#Jaa').val();
88
+ month = $('#Jmm').val();
89
+ day = $('#Jjj').val();
90
+ date = JalaliDate.jalaliToGregorian(year, month, day);
91
+ $('input[name=aa]').val(date[0]);
92
+ if(date[1]<10)date[1] = '0'+date[1];
93
+ $('select[name=mm]').val(date[1]);
94
+ $('input[name=jj]').val(date[2]);
95
+ });
96
+
97
+ /* =================================================================== */
98
+ /**
99
+ * in edit.php
100
+ */
101
+
102
+ $('a.edit-timestamp').on('click', function() {
103
+ var date = JalaliDate.gregorianToJalali($('#aa').val(), $('#mm').val(), $('#jj').val());
104
+ var divCnt = timestampDivModifier(date[0], date[1], date[2], $('#hh').val(), $('#mn').val());
105
+ $('#timestampdiv .timestamp-wrap').hide();
106
+ $('#timestampdiv').prepend(divCnt);
107
+ });
108
+
109
+
110
+ $('#timestampdiv .cancel-timestamp').on('click', function() {
111
+ $('.jalaliDivBox').remove();
112
+ });
113
+
114
+ $('.save-timestamp,#publish').on('click', function() {
115
+ if($('#Jhh').val()!== undefined){
116
+ $('input[name=hh]').val($('#Jhh').val());
117
+ $('input[name=mn]').val($('#Jmn').val());
118
+ year = $('#Jaa').val();
119
+ month = $('#Jmm').val();
120
+ day = $('#Jjj').val();
121
+ jDate = [year,month,day];
122
+ date = JalaliDate.jalaliToGregorian(year, month, day);
123
+ if(date[1]<10)date[1] = '0'+date[1];
124
+ $('input[name=aa]').val(date[0]);
125
+ $('select[name=mm]').val(date[1]);
126
+ $('input[name=jj]').val(date[2]);
127
+ }
128
+
129
+ setTimeout(function(){
130
+ if($('#timestampdiv .timestamp-wrap:eq(1)').hasClass('form-invalid')){
131
+ $('.jalaliDivBox').addClass('.form-invalid');
132
+ }else{
133
+ $('.jalaliDivBox').remove();
134
+ $('#timestampdiv').slideUp('fast');
135
+ $('a.edit-timestamp').slideDown('fast');
136
+ setTimeout(function(){changeTimestampViewer()},100);
137
+ }
138
+ },100);
139
+ });
140
+
141
+
142
+ /* =================================================================== */
143
+
144
+ });
assets/js/admin-ir.js ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ /**
3
+ * create vars
4
+ */
5
+ var jalaliMonthNames = ['', 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'];
6
+ var timestampdiv = $('#timestampdiv');
7
+ /* =================================================================== */
8
+ /**
9
+ *define functions
10
+ */
11
+ function timestampDivModifier(year, month, day, hour, min) {
12
+ content = '<div class="timestamp-wrap jalaliDivBox">';
13
+ content += '<select id="Jmm" name="Jmm">';
14
+ for (var i = 1; i <= 12; i++) {
15
+ if (i == month)
16
+ sel = 'selected="selected"';
17
+ else
18
+ sel = '';
19
+ content += '<option ' + sel + ' value="' + i + '">' + jalaliMonthNames[i] + '</option>';
20
+ }
21
+ content += '</select>';
22
+
23
+ content += '<input type="text" name="Jjj" value="' + day + '" id="Jjj" size="2" maxlength="2" autocomplete="off" />,';
24
+ content += '<input type="text" name="Jaa" value="' + year + '" id="Jaa" size="4" maxlength="4" autocomplete="off" /> @';
25
+ content += '<input type="text" name="Jmn" value="' + min + '" id="Jmn" size="2" maxlength="2" autocomplete="off" /> : ';
26
+ content += '<input type="text" name="Jhh" value="' + hour + '" id="Jhh" size="2" maxlength="2" autocomplete="off" />';
27
+ content += '</div>';
28
+ return content;
29
+ }
30
+
31
+ function changeTimestampViewer(){
32
+ y = $('input[name=aa]').val();
33
+ m = $('select[name=mm]').val();
34
+ d = $('input[name=jj]').val();
35
+ h = $('input[name=hh]').val();
36
+ i = $('input[name=mn]').val();
37
+ //alert(y+','+m+','+d);
38
+ jd = JalaliDate.gregorianToJalali(y, m, d);
39
+ //alert(jd);
40
+ ret='';
41
+ $text = jalaliMonthNames[jd[1]]+' '+jd[2]+', '+jd[0]+' @'+h+':'+i;
42
+ for (var i = 0; i < $text.length ; i++){
43
+ if(!isNaN($text[i]) && $text[i]!=' '){
44
+ ret += String.fromCharCode($text.charCodeAt(i) + 1728);
45
+ }else{
46
+ ret += $text[i];
47
+ }
48
+ }
49
+ $('#timestamp b').text(ret);
50
+
51
+ }
52
+ /* =================================================================== */
53
+ $('#the-list').on('click', '.editinline', function() {
54
+ var tr = $(this).closest('td');
55
+ var year = tr.find('.aa').html();
56
+ if (year > 1700){
57
+ var month = tr.find('.mm').html();
58
+ var day = tr.find('.jj').html();
59
+ var hour = tr.find('.hh').html();
60
+ var min = tr.find('.mn').html();
61
+ var date = JalaliDate.gregorianToJalali(year, month, day);
62
+ // $('.jalaliDivBox').remove();
63
+ $('.inline-edit-date div').hide();
64
+ $('.inline-edit-date').prepend(timestampDivModifier(date[0], date[1], date[2], hour, min));
65
+ }
66
+ });
67
+
68
+ $('.inline-edit-date').on('keyup', '#Jhh', function(e) {
69
+ $('input[name=hh]').val($(this).val());
70
+ });
71
+
72
+ $('.inline-edit-date').on('keyup', '#Jmn', function(e) {
73
+ $('input[name=mn]').val($(this).val());
74
+ });
75
+
76
+ $('.inline-edit-date').on('keyup', '#Jaa , #Jjj', function(e) {
77
+ year = $('#Jaa').val();
78
+ month = $('#Jmm').val();
79
+ day = $('#Jjj').val();
80
+ date = JalaliDate.jalaliToGregorian(year, month, day);
81
+ $('input[name=aa]').val(date[0]);
82
+ $('select[name=mm]').val(date[1]);
83
+ $('input[name=jj]').val(date[2]);
84
+ });
85
+
86
+ $('.inline-edit-date').on('change', '#Jmm', function() {
87
+ year = $('#Jaa').val();
88
+ month = $('#Jmm').val();
89
+ day = $('#Jjj').val();
90
+ date = JalaliDate.jalaliToGregorian(year, month, day);
91
+ $('input[name=aa]').val(date[0]);
92
+ if(date[1]<10)date[1] = '0'+date[1];
93
+ $('select[name=mm]').val(date[1]);
94
+ $('input[name=jj]').val(date[2]);
95
+ });
96
+
97
+ /* =================================================================== */
98
+ /**
99
+ * in edit.php
100
+ */
101
+
102
+ $('a.edit-timestamp').on('click', function() {
103
+ var date = JalaliDate.gregorianToJalali($('#aa').val(), $('#mm').val(), $('#jj').val());
104
+ var divCnt = timestampDivModifier(date[0], date[1], date[2], $('#hh').val(), $('#mn').val());
105
+ $('#timestampdiv .timestamp-wrap').hide();
106
+ $('#timestampdiv').prepend(divCnt);
107
+ });
108
+
109
+
110
+ $('#timestampdiv .cancel-timestamp').on('click', function() {
111
+ $('.jalaliDivBox').remove();
112
+ });
113
+
114
+ $('.save-timestamp,#publish').on('click', function() {
115
+ if($('#Jhh').val()!== undefined){
116
+ $('input[name=hh]').val($('#Jhh').val());
117
+ $('input[name=mn]').val($('#Jmn').val());
118
+ year = $('#Jaa').val();
119
+ month = $('#Jmm').val();
120
+ day = $('#Jjj').val();
121
+ jDate = [year,month,day];
122
+ date = JalaliDate.jalaliToGregorian(year, month, day);
123
+ if(date[1]<10)date[1] = '0'+date[1];
124
+ $('input[name=aa]').val(date[0]);
125
+ $('select[name=mm]').val(date[1]);
126
+ $('input[name=jj]').val(date[2]);
127
+ }
128
+
129
+ setTimeout(function(){
130
+ if($('#timestampdiv .timestamp-wrap:eq(1)').hasClass('form-invalid')){
131
+ $('.jalaliDivBox').addClass('.form-invalid');
132
+ }else{
133
+ $('.jalaliDivBox').remove();
134
+ $('#timestampdiv').slideUp('fast');
135
+ $('a.edit-timestamp').slideDown('fast');
136
+ setTimeout(function(){changeTimestampViewer()},100);
137
+ }
138
+ },100);
139
+ });
140
+
141
+
142
+ /* =================================================================== */
143
+
144
+ });
assets/js/date.js ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * JalaliJSCalendar - Jalali Extension for Date Object
3
+ * Copyright (c) 2008 Ali Farhadi (http://farhadi.ir/)
4
+ * Released under the terms of the GNU General Public License.
5
+ * See the GPL for details (http://www.gnu.org/licenses/gpl.html).
6
+ *
7
+ * Based on code from http://farsiweb.info
8
+ */
9
+
10
+ JalaliDate = {
11
+ g_days_in_month: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
12
+ j_days_in_month: [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29]
13
+ };
14
+
15
+ JalaliDate.jalaliToGregorian = function(j_y, j_m, j_d)
16
+ {
17
+ j_y = parseInt(j_y);
18
+ j_m = parseInt(j_m);
19
+ j_d = parseInt(j_d);
20
+ var jy = j_y-979;
21
+ var jm = j_m-1;
22
+ var jd = j_d-1;
23
+
24
+ var j_day_no = 365*jy + parseInt(jy / 33)*8 + parseInt((jy%33+3) / 4);
25
+ for (var i=0; i < jm; ++i) j_day_no += JalaliDate.j_days_in_month[i];
26
+
27
+ j_day_no += jd;
28
+
29
+ var g_day_no = j_day_no+79;
30
+
31
+ var gy = 1600 + 400 * parseInt(g_day_no / 146097); /* 146097 = 365*400 + 400/4 - 400/100 + 400/400 */
32
+ g_day_no = g_day_no % 146097;
33
+
34
+ var leap = true;
35
+ if (g_day_no >= 36525) /* 36525 = 365*100 + 100/4 */
36
+ {
37
+ g_day_no--;
38
+ gy += 100*parseInt(g_day_no/ 36524); /* 36524 = 365*100 + 100/4 - 100/100 */
39
+ g_day_no = g_day_no % 36524;
40
+
41
+ if (g_day_no >= 365)
42
+ g_day_no++;
43
+ else
44
+ leap = false;
45
+ }
46
+
47
+ gy += 4*parseInt(g_day_no/ 1461); /* 1461 = 365*4 + 4/4 */
48
+ g_day_no %= 1461;
49
+
50
+ if (g_day_no >= 366) {
51
+ leap = false;
52
+
53
+ g_day_no--;
54
+ gy += parseInt(g_day_no/ 365);
55
+ g_day_no = g_day_no % 365;
56
+ }
57
+
58
+ for (var i = 0; g_day_no >= JalaliDate.g_days_in_month[i] + (i == 1 && leap); i++)
59
+ g_day_no -= JalaliDate.g_days_in_month[i] + (i == 1 && leap);
60
+ var gm = i+1;
61
+ var gd = g_day_no+1;
62
+
63
+ return [gy, gm, gd];
64
+ }
65
+
66
+ JalaliDate.checkDate = function(j_y, j_m, j_d)
67
+ {
68
+ return !(j_y < 0 || j_y > 32767 || j_m < 1 || j_m > 12 || j_d < 1 || j_d >
69
+ (JalaliDate.j_days_in_month[j_m-1] + (j_m == 12 && !((j_y-979)%33%4))));
70
+ }
71
+
72
+ JalaliDate.gregorianToJalali = function(g_y, g_m, g_d)
73
+ {
74
+ g_y = parseInt(g_y);
75
+ g_m = parseInt(g_m);
76
+ g_d = parseInt(g_d);
77
+ var gy = g_y-1600;
78
+ var gm = g_m-1;
79
+ var gd = g_d-1;
80
+
81
+ var g_day_no = 365*gy+parseInt((gy+3) / 4)-parseInt((gy+99)/100)+parseInt((gy+399)/400);
82
+
83
+ for (var i=0; i < gm; ++i)
84
+ g_day_no += JalaliDate.g_days_in_month[i];
85
+ if (gm>1 && ((gy%4==0 && gy%100!=0) || (gy%400==0)))
86
+ /* leap and after Feb */
87
+ ++g_day_no;
88
+ g_day_no += gd;
89
+
90
+ var j_day_no = g_day_no-79;
91
+
92
+ var j_np = parseInt(j_day_no/ 12053);
93
+ j_day_no %= 12053;
94
+
95
+ var jy = 979+33*j_np+4*parseInt(j_day_no/1461);
96
+
97
+ j_day_no %= 1461;
98
+
99
+ if (j_day_no >= 366) {
100
+ jy += parseInt((j_day_no-1)/ 365);
101
+ j_day_no = (j_day_no-1)%365;
102
+ }
103
+
104
+ for (var i = 0; i < 11 && j_day_no >= JalaliDate.j_days_in_month[i]; ++i) {
105
+ j_day_no -= JalaliDate.j_days_in_month[i];
106
+ }
107
+ var jm = i+1;
108
+ var jd = j_day_no+1;
109
+
110
+
111
+ return [jy, jm, jd];
112
+ }
113
+
114
+ Date.prototype.setJalaliFullYear = function(y, m, d) {
115
+ var gd = this.getDate();
116
+ var gm = this.getMonth();
117
+ var gy = this.getFullYear();
118
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
119
+ if (y < 100) y += 1300;
120
+ j[0] = y;
121
+ if (m != undefined) {
122
+ if (m > 11) {
123
+ j[0] += Math.floor(m / 12);
124
+ m = m % 12;
125
+ }
126
+ j[1] = m + 1;
127
+ }
128
+ if (d != undefined) j[2] = d;
129
+ var g = JalaliDate.jalaliToGregorian(j[0], j[1], j[2]);
130
+ return this.setFullYear(g[0], g[1]-1, g[2]);
131
+ }
132
+
133
+ Date.prototype.setJalaliMonth = function(m, d) {
134
+ var gd = this.getDate();
135
+ var gm = this.getMonth();
136
+ var gy = this.getFullYear();
137
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
138
+ if (m > 11) {
139
+ j[0] += math.floor(m / 12);
140
+ m = m % 12;
141
+ }
142
+ j[1] = m+1;
143
+ if (d != undefined) j[2] = d;
144
+ var g = JalaliDate.jalaliToGregorian(j[0], j[1], j[2]);
145
+ return this.setFullYear(g[0], g[1]-1, g[2]);
146
+ }
147
+
148
+ Date.prototype.setJalaliDate = function(d) {
149
+ var gd = this.getDate();
150
+ var gm = this.getMonth();
151
+ var gy = this.getFullYear();
152
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
153
+ j[2] = d;
154
+ var g = JalaliDate.jalaliToGregorian(j[0], j[1], j[2]);
155
+ return this.setFullYear(g[0], g[1]-1, g[2]);
156
+ }
157
+
158
+ Date.prototype.getJalaliFullYear = function() {
159
+ var gd = this.getDate();
160
+ var gm = this.getMonth();
161
+ var gy = this.getFullYear();
162
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
163
+ return j[0];
164
+ }
165
+
166
+ Date.prototype.getJalaliMonth = function() {
167
+ var gd = this.getDate();
168
+ var gm = this.getMonth();
169
+ var gy = this.getFullYear();
170
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
171
+ return j[1]-1;
172
+ }
173
+
174
+ Date.prototype.getJalaliDate = function() {
175
+ var gd = this.getDate();
176
+ var gm = this.getMonth();
177
+ var gy = this.getFullYear();
178
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
179
+ return j[2];
180
+ }
181
+
182
+ Date.prototype.getJalaliDay = function() {
183
+ var day = this.getDay();
184
+ day = (day + 1) % 7;
185
+ return day;
186
+ }
187
+
188
+
189
+ /**
190
+ * Jalali UTC functions
191
+ */
192
+
193
+ Date.prototype.setJalaliUTCFullYear = function(y, m, d) {
194
+ var gd = this.getUTCDate();
195
+ var gm = this.getUTCMonth();
196
+ var gy = this.getUTCFullYear();
197
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
198
+ if (y < 100) y += 1300;
199
+ j[0] = y;
200
+ if (m != undefined) {
201
+ if (m > 11) {
202
+ j[0] += Math.floor(m / 12);
203
+ m = m % 12;
204
+ }
205
+ j[1] = m + 1;
206
+ }
207
+ if (d != undefined) j[2] = d;
208
+ var g = JalaliDate.jalaliToGregorian(j[0], j[1], j[2]);
209
+ return this.setUTCFullYear(g[0], g[1]-1, g[2]);
210
+ }
211
+
212
+ Date.prototype.setJalaliUTCMonth = function(m, d) {
213
+ var gd = this.getUTCDate();
214
+ var gm = this.getUTCMonth();
215
+ var gy = this.getUTCFullYear();
216
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
217
+ if (m > 11) {
218
+ j[0] += math.floor(m / 12);
219
+ m = m % 12;
220
+ }
221
+ j[1] = m+1;
222
+ if (d != undefined) j[2] = d;
223
+ var g = JalaliDate.jalaliToGregorian(j[0], j[1], j[2]);
224
+ return this.setUTCFullYear(g[0], g[1]-1, g[2]);
225
+ }
226
+
227
+ Date.prototype.setJalaliUTCDate = function(d) {
228
+ var gd = this.getUTCDate();
229
+ var gm = this.getUTCMonth();
230
+ var gy = this.getUTCFullYear();
231
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
232
+ j[2] = d;
233
+ var g = JalaliDate.jalaliToGregorian(j[0], j[1], j[2]);
234
+ return this.setUTCFullYear(g[0], g[1]-1, g[2]);
235
+ }
236
+
237
+ Date.prototype.getJalaliUTCFullYear = function() {
238
+ var gd = this.getUTCDate();
239
+ var gm = this.getUTCMonth();
240
+ var gy = this.getUTCFullYear();
241
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
242
+ return j[0];
243
+ }
244
+
245
+ Date.prototype.getJalaliUTCMonth = function() {
246
+ var gd = this.getUTCDate();
247
+ var gm = this.getUTCMonth();
248
+ var gy = this.getUTCFullYear();
249
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
250
+ return j[1]-1;
251
+ }
252
+
253
+ Date.prototype.getJalaliUTCDate = function() {
254
+ var gd = this.getUTCDate();
255
+ var gm = this.getUTCMonth();
256
+ var gy = this.getUTCFullYear();
257
+ var j = JalaliDate.gregorianToJalali(gy, gm+1, gd);
258
+ return j[2];
259
+ }
260
+
261
+ Date.prototype.getJalaliUTCDay = function() {
262
+ var day = this.getUTCDay();
263
+ day = (day + 1) % 7;
264
+ return day;
265
+ }
inc/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php
inc/wp-jalali-admin-option.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * admin options page
4
+ */
5
+ global $ztjalali_option;
6
+ ?>
7
+
8
+ <div class="wrap">
9
+ <h2><?php _e('wp persian option', 'ztjalali'); ?></h2>
10
+ <div class="ztjalali_option_logo">
11
+ <a href="http://wp-persian.com" target="_BLANK" title="وردپرس فارسی">
12
+ <img src="<?php echo plugins_url('/assets/img/wp-jalali-80x80.png', dirname(__FILE__)); ?>" />
13
+ </a>
14
+ </div>
15
+
16
+ <form method="post">
17
+ <?php wp_nonce_field('jalali_save_options'); ?>
18
+ <table class="form-table">
19
+ <tbody>
20
+ <tr>
21
+ <th scope="row"><?php _e('date option', 'ztjalali'); ?></th>
22
+ <td>
23
+ <fieldset>
24
+ <legend class="screen-reader-text"><span><?php _e('date option', 'ztjalali'); ?></span></legend>
25
+ <label for="change_date_to_jalali">
26
+ <input type="checkbox" id="change_date_to_jalali" name="change_date_to_jalali" value="1" <?php checked($ztjalali_option['change_date_to_jalali'], TRUE); ?> />
27
+ <?php _e('change_date_to_jalali Description', 'ztjalali'); ?>
28
+ </label>
29
+ <br />
30
+ <label for="change_jdate_number_to_persian">
31
+ <input type="checkbox" id="change_jdate_number_to_persian" name="change_jdate_number_to_persian" value="1" <?php checked($ztjalali_option['change_jdate_number_to_persian'], TRUE); ?> />
32
+ <?php _e('change_jdate_number_to_persian Description', 'ztjalali'); ?>
33
+ </label>
34
+ <br />
35
+ <label for="change_url_date_to_jalali">
36
+ <input type="checkbox" id="change_url_date_to_jalali" name="change_url_date_to_jalali" value="1" <?php checked($ztjalali_option['change_url_date_to_jalali'], TRUE); ?> />
37
+ <?php _e('change_url_date_to_jalali Description', 'ztjalali'); ?>
38
+ </label>
39
+ </fieldset>
40
+ </td>
41
+ </tr>
42
+
43
+ <tr>
44
+ <th scope="row"><label for="afghan_month_name"><?php _e('month_name', 'ztjalali'); ?></label></th>
45
+ <td>
46
+ <select id="afghan_month_name" name="afghan_month_name">
47
+ <option <?php selected($ztjalali_option['afghan_month_name'], FALSE); ?> value="0"><?php _e('iran', 'ztjalali'); ?></option>
48
+ <option <?php selected($ztjalali_option['afghan_month_name'], TRUE); ?> value="1"><?php _e('afghanistan', 'ztjalali'); ?></option>
49
+ </select>
50
+ </td>
51
+ </tr>
52
+
53
+ <tr>
54
+ <th scope="row"><?php _e('number option', 'ztjalali'); ?></th>
55
+ <td>
56
+ <fieldset>
57
+ <legend class="screen-reader-text"><span><?php _e('number option', 'ztjalali'); ?></span></legend>
58
+ <label for="change_title_number_to_persian">
59
+ <input type="checkbox" id="change_title_number_to_persian" name="change_title_number_to_persian" value="1" <?php checked($ztjalali_option['change_title_number_to_persian'], TRUE); ?> />
60
+ <?php _e('change_title_number_to_persian Description', 'ztjalali'); ?>
61
+ </label>
62
+ <br />
63
+ <label for="change_content_number_to_persian">
64
+ <input type="checkbox" id="change_content_number_to_persian" name="change_content_number_to_persian" value="1" <?php checked($ztjalali_option['change_content_number_to_persian'], TRUE); ?> />
65
+ <?php _e('change_content_number_to_persian Description', 'ztjalali'); ?>
66
+ </label>
67
+ <br />
68
+ <label for="change_excerpt_number_to_persian">
69
+ <input type="checkbox" id="change_excerpt_number_to_persian" name="change_excerpt_number_to_persian" value="1" <?php checked($ztjalali_option['change_excerpt_number_to_persian'], TRUE); ?> />
70
+ <?php _e('change_excerpt_number_to_persian Description', 'ztjalali'); ?>
71
+ </label>
72
+ <br />
73
+ <label for="change_comment_number_to_persian">
74
+ <input type="checkbox" id="change_comment_number_to_persian" name="change_comment_number_to_persian" value="1" <?php checked($ztjalali_option['change_comment_number_to_persian'], TRUE); ?> />
75
+ <?php _e('change_comment_number_to_persian Description', 'ztjalali'); ?>
76
+ </label>
77
+ <br />
78
+ <label for="change_commentcount_number_to_persian">
79
+ <input type="checkbox" id="change_commentcount_number_to_persian" name="change_commentcount_number_to_persian" value="1" <?php checked($ztjalali_option['change_commentcount_number_to_persian'], TRUE); ?> />
80
+ <?php _e('change_commentcount_number_to_persian Description', 'ztjalali'); ?>
81
+ </label>
82
+ <br />
83
+ <label for="change_category_number_to_persian">
84
+ <input type="checkbox" id="change_category_number_to_persian" name="change_category_number_to_persian" value="1" <?php checked($ztjalali_option['change_category_number_to_persian'], TRUE); ?> />
85
+ <?php _e('change_category_number_to_persian Description', 'ztjalali'); ?>
86
+ </label>
87
+ <br />
88
+ <label for="change_point_to_persian">
89
+ <input type="checkbox" id="change_point_to_persian" name="change_point_to_persian" value="1" <?php checked($ztjalali_option['change_point_to_persian'], TRUE); ?> />
90
+ <?php _e('change_point_to_persian Description', 'ztjalali'); ?>
91
+ </label>
92
+ </fieldset>
93
+ </td>
94
+ </tr>
95
+
96
+ <tr>
97
+ <th scope="row"><?php _e('text option', 'ztjalali'); ?></th>
98
+ <td>
99
+ <fieldset>
100
+ <legend class="screen-reader-text"><span><?php _e('text option', 'ztjalali'); ?></span></legend>
101
+ <label for="change_arabic_to_persian">
102
+ <input type="checkbox" id="change_arabic_to_persian" name="change_arabic_to_persian" value="1" <?php checked($ztjalali_option['change_arabic_to_persian'], TRUE); ?> />
103
+ <?php _e('change_arabic_to_persian Description', 'ztjalali'); ?>
104
+ </label>
105
+ <br />
106
+ <label for="change_archive_title">
107
+ <input type="checkbox" id="change_archive_title" name="change_archive_title" value="1" <?php checked($ztjalali_option['change_archive_title'], TRUE); ?> />
108
+ <?php _e('change_archive_title Description', 'ztjalali'); ?>
109
+ </label>
110
+ </fieldset>
111
+ </td>
112
+ </tr>
113
+
114
+ <tr>
115
+ <th scope="row"><?php _e('wp-jalali option', 'ztjalali'); ?></th>
116
+ <td>
117
+ <fieldset>
118
+ <legend class="screen-reader-text"><span><?php _e('wp-jalali option', 'ztjalali'); ?></span></legend>
119
+ <label for="ztjalali_admin_style">
120
+ <input type="checkbox" id="ztjalali_admin_style" name="ztjalali_admin_style" value="1" <?php checked($ztjalali_option['ztjalali_admin_style'], TRUE); ?> />
121
+ <?php _e('ztjalali_admin_style Description', 'ztjalali'); ?>
122
+ </label>
123
+
124
+ <label for="save_changes_in_db">
125
+ <input type="checkbox" id="save_changes_in_db" name="save_changes_in_db" value="1" <?php checked($ztjalali_option['save_changes_in_db'], TRUE); ?> />
126
+ <?php _e('save_changes_in_db Description', 'ztjalali'); ?>
127
+ </label>
128
+ </fieldset>
129
+ </td>
130
+ </tr>
131
+
132
+ <tr>
133
+ <th scope="row"><label for="persian_planet"><?php _e('persian_planet', 'ztjalali'); ?></label></th>
134
+ <td>
135
+ <select id="persian_planet" name="persian_planet">
136
+ <option <?php selected($ztjalali_option['persian_planet'], FALSE); ?> value="0"><?php _e('wp-persian news Blog', 'ztjalali'); ?></option>
137
+ <option <?php selected($ztjalali_option['persian_planet'], TRUE); ?> value="1"><?php _e('wp-persian planet', 'ztjalali'); ?></option>
138
+ </select>
139
+ </td>
140
+ </tr>
141
+
142
+ <tr>
143
+ <th scope="row"><?php _e('locale option', 'ztjalali'); ?></th>
144
+ <td>
145
+ <fieldset>
146
+ <legend class="screen-reader-text"><span><?php _e('locale option', 'ztjalali'); ?></span></legend>
147
+ <label for="force_locale">
148
+ <input type="checkbox" id="force_locale" name="force_locale" value="1" <?php checked($ztjalali_option['force_locale'], TRUE); ?> />
149
+ <?php _e('force locale Description', 'ztjalali'); ?>
150
+ </label>
151
+ <br />
152
+ <label for="force_timezone">
153
+ <input type="checkbox" id="force_timezone" name="force_timezone" value="1" <?php checked($ztjalali_option['force_timezone'], TRUE); ?> />
154
+ <?php _e('force timezone Description', 'ztjalali'); ?>
155
+ </label>
156
+ </fieldset>
157
+ </td>
158
+ </tr>
159
+ <?php
160
+ /* ===================================================== * /
161
+ * input text example
162
+ <tr>
163
+ <th scope="row"><label for="blogdescription">معرفی کوتاه</label></th>
164
+ <td><input type="text" class="regular-text" value="Just another WordPress site" id="blogdescription" name="blogdescription">
165
+ <p class="description">در چند واژه بیان کنید که &zwnj;این سایت درباره&zwnj;ی چیست</p></td>
166
+ </tr>
167
+ /* ===================================================== */
168
+ ?>
169
+ </tbody>
170
+ </table>
171
+ <p class="submit">
172
+ <input type="submit" value="<?php _e('save changes', 'ztjalali'); ?>" class="button button-primary" id="save_wper_options" name="save_wper_options">
173
+ </p>
174
+ </form>
175
+ </div>
inc/wp-jalali-admin.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * register admin menu
5
+ */
6
+ add_action('admin_menu', 'ztjalali_reg_admin_meun_fn');
7
+
8
+ function ztjalali_reg_admin_meun_fn() {
9
+ global $ztjalali_admin_page;
10
+ $ztjalali_admin_page = add_menu_page(
11
+ __('wp-jalali options', 'ztjalali'), // page title
12
+ __('wp-jalali', 'ztjalali'), // menu title
13
+ 'manage_options', // user access capability
14
+ 'ztjalali_admin_page', // menu slug
15
+ 'ztjalali_admin_page_fn', //menu content function
16
+ // plugins_url('/assets/img/wp-jalali-16x16.png', dirname(__FILE__)), // menu icon
17
+ 'dashicons-ztjalali', // menu icon
18
+ 82 // menu position
19
+ );
20
+ add_submenu_page(NULL, __('wp-jalali help page', 'ztjalali'), __('wp-jalali help', 'ztjalali'), 'manage_options', 'ztjalali_help_page', 'ztjalali_help_page_fn');
21
+ // add_submenu_page('ztjalali_admin_page',__('wp-jalali help page', 'ztjalali'), __('wp-jalali help', 'ztjalali'),'manage_options','ztjalali_help_page', 'ztjalali_help_page_fn');
22
+ add_action('load-' . $ztjalali_admin_page, 'ztjalali_admin_save_option_page_fn');
23
+ }
24
+
25
+ function ztjalali_admin_page_fn() {
26
+ include JALALI_DIR . 'inc' . DIRECTORY_SEPARATOR . 'wp-jalali-admin-option.php';
27
+ }
28
+
29
+ function ztjalali_help_page_fn() {
30
+ // wp_enqueue_style( 'wp-pointer' );
31
+ // wp_enqueue_script( 'wp-pointer' );
32
+ include JALALI_DIR . 'inc' . DIRECTORY_SEPARATOR . 'wp-jalali-help-page.php';
33
+ }
34
+
35
+ function ztjalali_admin_save_option_page_fn() {
36
+ global $ztjalali_admin_page;
37
+ $screen = get_current_screen();
38
+ if ($screen->id != $ztjalali_admin_page)
39
+ return;
40
+
41
+ if (isset($_POST['save_wper_options'])) {
42
+ global $ztjalali_option;
43
+ check_admin_referer('jalali_save_options');
44
+ $ztjalali_option = array(
45
+ 'force_locale' => !empty($_POST['force_locale']),
46
+ 'force_timezone' => !empty($_POST['force_timezone']),
47
+ 'change_date_to_jalali' => !empty($_POST['change_date_to_jalali']),
48
+ 'change_jdate_number_to_persian' => !empty($_POST['change_jdate_number_to_persian']),
49
+ 'change_url_date_to_jalali' => !empty($_POST['change_url_date_to_jalali']),
50
+ 'afghan_month_name' => !empty($_POST['afghan_month_name']),
51
+ 'change_title_number_to_persian' => !empty($_POST['change_title_number_to_persian']),
52
+ 'change_content_number_to_persian' => !empty($_POST['change_content_number_to_persian']),
53
+ 'change_excerpt_number_to_persian' => !empty($_POST['change_excerpt_number_to_persian']),
54
+ 'change_comment_number_to_persian' => !empty($_POST['change_comment_number_to_persian']),
55
+ 'change_commentcount_number_to_persian' => !empty($_POST['change_commentcount_number_to_persian']),
56
+ 'change_category_number_to_persian' => !empty($_POST['change_category_number_to_persian']),
57
+ 'change_point_to_persian' => !empty($_POST['change_point_to_persian']),
58
+ 'change_arabic_to_persian' => !empty($_POST['change_arabic_to_persian']),
59
+ 'change_archive_title' => !empty($_POST['change_archive_title']),
60
+ 'save_changes_in_db' => !empty($_POST['save_changes_in_db']),
61
+ 'ztjalali_admin_style' => !empty($_POST['ztjalali_admin_style']),
62
+ 'persian_planet' => !empty($_POST['persian_planet']),
63
+ );
64
+ update_option('ztjalali_options', json_encode($ztjalali_option))
65
+ OR add_option('ztjalali_options', json_encode($ztjalali_option));
66
+ }
67
+ }
68
+
69
+ /* =================================================================== */
70
+
71
+ /**
72
+ * install help
73
+ */
74
+ add_action('admin_init', 'ztjalali_install_redirect');
75
+
76
+ function ztjalali_install_redirect() {
77
+ if (get_option('ztjalali_do_activation_redirect', false)) {
78
+ delete_option('ztjalali_do_activation_redirect');
79
+ wp_redirect(menu_page_url('ztjalali_help_page', FALSE));
80
+ }
81
+ }
82
+
83
+ /* =================================================================== */
84
+
85
+ /**
86
+ * wp planet options
87
+ */
88
+ add_filter('dashboard_primary_link', 'ztjalali_dashboard_primary_link', 111, 1);
89
+ add_filter('dashboard_primary_feed', 'ztjalali_dashboard_primary_feed', 111, 1);
90
+ add_filter('dashboard_primary_title', 'ztjalali_dashboard_primary_title', 111, 1);
91
+
92
+ add_filter('dashboard_secondary_link', 'ztjalali_dashboard_secondary_link', 111, 1);
93
+ add_filter('dashboard_secondary_feed', 'ztjalali_dashboard_secondary_feed', 111, 1);
94
+ add_filter('dashboard_secondary_title', 'ztjalali_dashboard_secondary_title', 111, 1);
95
+
96
+ global $primary_replacement, $secondary_replacement;
97
+ $primary_replacement = array(
98
+ 1 => array(
99
+ 'link' => 'http://wordpress.org/development/',
100
+ 'feed' => 'http://wordpress.org/development/feed/',
101
+ 'title' => __('WordPress Development Blog', 'ztjalali')
102
+ ),
103
+ 2 => array(
104
+ 'link' => 'http://wp-persian.com/',
105
+ 'feed' => 'http://wp-persian.com/feed/',
106
+ 'title' => __('wp-persian news Blog', 'ztjalali')
107
+ )
108
+ );
109
+ $secondary_replacement = array(
110
+ 1 => array(
111
+ 'link' => 'http://planet.wordpress.org/',
112
+ 'feed' => 'http://planet.wordpress.org/feed/',
113
+ 'title' => __('Other WordPress News', 'ztjalali')
114
+ ),
115
+ 2 => array(
116
+ 'link' => 'http://planet.wp-persian.com/',
117
+ 'feed' => 'http://planet.wp-persian.com/feed/',
118
+ 'title' => __('wp-persian planet', 'ztjalali')
119
+ )
120
+ );
121
+
122
+ function ztjalali_dashboard_primary_link($value) {
123
+ global $primary_replacement, $ztjalali_option;
124
+ if ($ztjalali_option['persian_planet']) {
125
+ return $primary_replacement[2]['link'];
126
+ }
127
+ return $value;
128
+ }
129
+
130
+ function ztjalali_dashboard_primary_feed($value) {
131
+ global $primary_replacement, $ztjalali_option;
132
+ if ($ztjalali_option['persian_planet']) {
133
+ return $primary_replacement[2]['feed'];
134
+ }
135
+ return $value;
136
+ }
137
+
138
+ function ztjalali_dashboard_primary_title($value) {
139
+ global $primary_replacement, $ztjalali_option;
140
+ if ($ztjalali_option['persian_planet']) {
141
+ return $primary_replacement[2]['title'];
142
+ }
143
+ return $value;
144
+ }
145
+
146
+ function ztjalali_dashboard_secondary_link($value) {
147
+ global $secondary_replacement, $ztjalali_option;
148
+ if ($ztjalali_option['persian_planet']) {
149
+ return $secondary_replacement[2]['link'];
150
+ }
151
+ return $value;
152
+ }
153
+
154
+ function ztjalali_dashboard_secondary_feed($value) {
155
+ global $secondary_replacement, $ztjalali_option;
156
+ if ($ztjalali_option['persian_planet']) {
157
+ return $secondary_replacement[2]['feed'];
158
+ }
159
+ return $value;
160
+ }
161
+
162
+ function ztjalali_dashboard_secondary_title($value) {
163
+ global $secondary_replacement, $ztjalali_option;
164
+ if ($ztjalali_option['persian_planet']) {
165
+ return $secondary_replacement[2]['title'];
166
+ }
167
+ return $value;
168
+ }
169
+
170
+ /* =================================================================== */
171
+
inc/wp-jalali-filters.php ADDED
@@ -0,0 +1,516 @@