Version Description
- Fixed : Some Minor bugs
Download this release
Release Info
Developer | hannanstd |
Plugin | گرویتی فرم فارسی |
Version | 1.3.2 |
Comparing to | |
See all releases |
Code changes from version 1.3.1 to 1.3.2
- Persian_Gravityforms_By_HANNANStd.php +12 -63
- include/Jalali.php +4 -110
- include/Post_Content_Merge_Tags.php +2 -19
- include/wp-session.php +4 -2
- readme.txt +5 -1
Persian_Gravityforms_By_HANNANStd.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Persian Gravity Forms
|
4 |
Plugin URI: https://wordpress.org/plugins/persian-gravity-forms/
|
5 |
Description: Gravity Forms for Iranian
|
6 |
-
Version: 1.3.
|
7 |
Requires at least: 3.5
|
8 |
Author: HANNAN Ebrahimi Setoode
|
9 |
Author URI: http://www.gravityforms.ir/
|
@@ -16,7 +16,6 @@ class GravityFormsPersian {
|
|
16 |
private $file;
|
17 |
private $language;
|
18 |
private $is_persian;
|
19 |
-
|
20 |
public function __construct( $file ) {
|
21 |
$this->file = $file;
|
22 |
//actions
|
@@ -50,7 +49,6 @@ class GravityFormsPersian {
|
|
50 |
add_filter('gform_field_content', array( $this, 'Add_Melli_Cart_Field_JavaScript_Checker_By_HANNANStd'), 10, 5);
|
51 |
add_filter('gform_field_validation', array( $this, 'Input_Valid_Checker_By_HANNANStd'), 10, 4);
|
52 |
}
|
53 |
-
|
54 |
public function Activated_Plugin_By_HANNANStd() {
|
55 |
$path = str_replace( WP_PLUGIN_DIR . '/', '', $this->file );
|
56 |
if ( $plugins = get_option( 'active_plugins' ) ) {
|
@@ -68,7 +66,6 @@ class GravityFormsPersian {
|
|
68 |
}
|
69 |
}
|
70 |
}
|
71 |
-
|
72 |
public function init(){
|
73 |
require_once("include/Jalali.php");
|
74 |
require_once("include/Post_Content_Merge_Tags.php");
|
@@ -83,15 +80,12 @@ class GravityFormsPersian {
|
|
83 |
load_plugin_textdomain( 'Persian_Gravityforms_By_HANNANStd', false, $rel_path );
|
84 |
load_plugin_textdomain( 'gravityformsuserregistration', false, $rel_path );
|
85 |
}
|
86 |
-
|
87 |
protected static function get_base_path(){
|
88 |
$folder = basename(dirname(__FILE__));
|
89 |
return WP_PLUGIN_DIR . "/" . $folder;
|
90 |
}
|
91 |
-
|
92 |
public function Load_Textdomain_Mo_File_By_HANNANStd( $mo_file, $domain ) {
|
93 |
-
if ( strpos( $mo_file, 'fa_IR.mo' ) !== false ) {
|
94 |
-
|
95 |
$domains = array(
|
96 |
'gravityforms' => array(
|
97 |
'languages/gravityforms-fa_IR.mo' => 'gravityforms1.8/fa_IR.mo'
|
@@ -165,21 +159,19 @@ class GravityFormsPersian {
|
|
165 |
}
|
166 |
return $mo_file;
|
167 |
}
|
168 |
-
|
169 |
public function Add_Jalali_Active_Standard_Settings($position, $form_id){
|
170 |
if($position == 25){
|
171 |
?>
|
172 |
<li class="Jalali_setting field_setting">
|
173 |
<input type="checkbox" id="check_jalali" onclick="SetFieldProperty('check_jalali', jQuery(this).is(':checked') ? 1 : 0);"/>
|
174 |
<label class="inline gfield_value_label" for="field_admin_label">
|
175 |
-
<?php _e( '
|
176 |
<?php gform_tooltip("form_check_jalali") ?>
|
177 |
</label>
|
178 |
</li>
|
179 |
<?php
|
180 |
}
|
181 |
}
|
182 |
-
|
183 |
public function Editor_Script_By_HANNANStd(){
|
184 |
?>
|
185 |
<script type='text/javascript'>
|
@@ -197,10 +189,9 @@ class GravityFormsPersian {
|
|
197 |
</script>
|
198 |
<?php
|
199 |
}
|
200 |
-
|
201 |
public function Add_Encryption_tooltips_By_HANNANStd($tooltips){
|
202 |
$tooltips["form_check_jalali"] = "<h6>فعالسازی تاریخ شمسی</h6>در صورتی که از چند فیلد تاریخ استفاده میکنید ، فعالسازی تاریخ شمسی یکی از فیلدها کفایت میکند .<br/>تذکر : با توجه به آزمایشی بودن این قسمت ممکن است تداخل توابع سبب ناسازگاری با برخی قالب ها شود.";
|
203 |
-
$tooltips["form_field_mellicart"] = "<h6>نمایش لحظه ای شهر از روی کد ملی </h6>نمایش شهر و پیغام زیر فیلد کد ملی بعد از پر شدن فیلد . تذکر : در صورتی که این گزینه را فعال نمایید ،ممکن است فراخوانی شهر های ایران با توجه به
|
204 |
$tooltips["form_field_mellicart_sp"] = "<h6>جدا سازی ارقام</h6>در صورتی که این گزینه را فعال نمایید ، پس از پر شدن فیلد ، <strong>در صورتی که کد ملی وارد شده صحیح تشخصی داده شود</strong> ؛ کد ملی به صورت زیر در خواهد آمد :<br/>xxx-xxxxxx-x";
|
205 |
$tooltips["form_field_mellicart_header"] = "<h6>پیغام خطا</h6>در صورتی که کاربر فیلد کد ملی را به صورت صحیح وارد نکند ؛ پیغام خطا را مشاهده میکند که میتوانید این پیغام ها را مدیریت نمایید . در صورتی که مقادیر زیر را خالی بگذارید پیغام پیشفرض نمایش داده خواهد شد.";
|
206 |
$tooltips["form_field_mellicart_sp1"] = "<h6>پیغام پیشفرض</h6>با توجه به اینکه کد ملی فقط باید به صورت عدد باشد ، در صورتی که کاراکتری غیر از عدد وارد شده باشد پیغام خطا نمایش داده خواهد شد .<br/>پیغام پیشفرض : کد ملی فقط باید به صورت عدد وارد شود . ";
|
@@ -209,13 +200,12 @@ class GravityFormsPersian {
|
|
209 |
$tooltips["form_field_mellicart_sp4"] = "<h6>پیغام پیشفرض</h6>در صورتی که کد ملی وارد شده مطابق با الگوریتم کشور نباشد پیغام خطا نمایش داده خواهد شد .<br/>پیغام پیشفرض : کد ملی وارد شده مطابق با استانداردهای کشور نمی باشد .";
|
210 |
return $tooltips;
|
211 |
}
|
212 |
-
|
213 |
function Add_Jalali_Front_End_On_Off_Switch_By_HANNANStd( $form, $ajax ) {
|
214 |
foreach ( $form['fields'] as $field ) {
|
215 |
if ( ( $field['type'] == 'date' ) ) {
|
216 |
if(rgget("check_jalali", $field)){
|
217 |
-
|
218 |
-
|
219 |
if (!IS_ADMIN)
|
220 |
{
|
221 |
wp_deregister_script('gform_datepicker_init');
|
@@ -226,32 +216,26 @@ class GravityFormsPersian {
|
|
226 |
}
|
227 |
}
|
228 |
}
|
229 |
-
|
230 |
public function Set_Min_Year_By_HANNANStd($min_year){
|
231 |
$min_year = GF_gregorian_to_jalali($min_year,03,21);
|
232 |
return $min_year[0]+1;
|
233 |
}
|
234 |
-
|
235 |
public function Set_Max_Year_By_HANNANStd($max_year){
|
236 |
$max_year = GF_gregorian_to_jalali($max_year,03,21);
|
237 |
return $max_year[0]+20;
|
238 |
}
|
239 |
-
|
240 |
public function GravityForms_Footer_Left_By_HANNANStd($text) {
|
241 |
$text = sprintf(__("%sGravity Forms%s for WordPress is a full featured contact form plugin .", "Persian_Gravityforms_By_HANNANStd"), '<a href="http://gravityforms.ir" target="_blank">', "</a>");return $text;
|
242 |
}
|
243 |
-
|
244 |
public function Add_Private_Post_Status_By_HANNANStd($post_status_options) {
|
245 |
$post_status_options['private'] = __("خصوصی", "Persian_Gravityforms_By_HANNANStd");
|
246 |
return $post_status_options;
|
247 |
}
|
248 |
-
|
249 |
public function Update_Currency_By_HANNANStd($currencies) {
|
250 |
$currencies['IRR'] = array("name" => __("ریال ایران", "Persian_Gravityforms_By_HANNANStd"), "symbol_left" => '', "symbol_right" => " ریال ", "symbol_padding" => "", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 0);
|
251 |
$currencies['IRT'] = array("name" => __("تومان", "Persian_Gravityforms_By_HANNANStd"), "symbol_left" => '', "symbol_right" => " تومان ", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 0);
|
252 |
return $currencies;
|
253 |
}
|
254 |
-
|
255 |
public function Gform_IRAN_By_HANNANStd( $address_types ) {
|
256 |
$address_types['persian'] = array(
|
257 |
'label' => __( 'ایران', 'Persian_Gravityforms_By_HANNANStd' ),
|
@@ -294,7 +278,6 @@ class GravityFormsPersian {
|
|
294 |
);
|
295 |
return $address_types;
|
296 |
}
|
297 |
-
|
298 |
public function Add_Iran_States_Predefined_Choice_By_HANNANStd($choices){
|
299 |
$choices[__( 'استانهای ایران', 'Persian_Gravityforms_By_HANNANStd' )] = array(
|
300 |
__( 'آذربایجان شرقی', 'Persian_Gravityforms_By_HANNANStd' ),
|
@@ -330,7 +313,6 @@ class GravityFormsPersian {
|
|
330 |
__( 'یزد', 'Persian_Gravityforms_By_HANNANStd' )
|
331 |
); return $choices;
|
332 |
}
|
333 |
-
|
334 |
public function Add_Iran_Months_Predefined_Choice_By_HANNANStd($choices){
|
335 |
$choices[__( 'ماه های ایران', 'Persian_Gravityforms_By_HANNANStd' )] = array(__( 'فروردین', 'Persian_Gravityforms_By_HANNANStd' ),
|
336 |
__( 'اردیبهشت', 'Persian_Gravityforms_By_HANNANStd' ),
|
@@ -345,8 +327,7 @@ class GravityFormsPersian {
|
|
345 |
__( 'بهمن', 'Persian_Gravityforms_By_HANNANStd' ),
|
346 |
__( 'اسفند', 'Persian_Gravityforms_By_HANNANStd' )
|
347 |
); return $choices;
|
348 |
-
}
|
349 |
-
|
350 |
public function Add_Merge_Tags_To_List_By_HANNANStd($form){ ?>
|
351 |
<script type="text/javascript">
|
352 |
gform.addFilter("gform_merge_tags", "add_merge_tags");
|
@@ -366,7 +347,6 @@ class GravityFormsPersian {
|
|
366 |
<?php
|
367 |
return $form;
|
368 |
}
|
369 |
-
|
370 |
function First_Column_Actions_By_HANNANStd($form_id, $field_id, $value, $lead, $query_string) {
|
371 |
$url = get_bloginfo("wpurl") . "/wp-admin/admin.php?page=gf_entries&view=entries&id=" . $form_id;
|
372 |
$gateway = gform_get_meta($lead["id"], "payment_gateway");
|
@@ -395,7 +375,6 @@ class GravityFormsPersian {
|
|
395 |
else if ($lead["payment_status"])
|
396 |
echo '<a class="stat" href="'.$url.'&sort=0&dir=DESC&s=Processing&field_id=payment_status&operator=is" style="color:'.$color.';"> موفق </a>';
|
397 |
}
|
398 |
-
|
399 |
public function Update_Lead_No_Gateway_By_HANNANStd($lead, $form) {
|
400 |
$gateway = gform_get_meta($lead['id'], 'payment_gateway');
|
401 |
$method = $lead['payment_method'];
|
@@ -418,7 +397,6 @@ class GravityFormsPersian {
|
|
418 |
RGFormsModel::update_lead($lead);
|
419 |
return $lead;
|
420 |
}
|
421 |
-
|
422 |
public function GformReplaceMergeTags_By_HANNANStd($text, $form, $lead, $url_encode, $esc_html, $nl2br, $format){
|
423 |
$gateway = gform_get_meta($lead['id'], 'payment_gateway');
|
424 |
if ($lead['payment_status']=="Active" || $lead['payment_status']=="Paid")
|
@@ -442,7 +420,6 @@ class GravityFormsPersian {
|
|
442 |
$gateway ? $gateway : '',
|
443 |
isset($lead['transaction_id']) ? $lead['transaction_id'] : '',
|
444 |
isset($lead['payment_status']) ? $payment_status : '',
|
445 |
-
|
446 |
$gateway ? '
|
447 |
<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA" style="border:1px solid #e9e9e9!important;">
|
448 |
<tr bgcolor="#EAF2FA">
|
@@ -455,7 +432,6 @@ class GravityFormsPersian {
|
|
455 |
</td>
|
456 |
</tr>
|
457 |
</table>' : '',
|
458 |
-
|
459 |
isset($lead['transaction_id']) ? '
|
460 |
<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA" style="border:1px solid #e9e9e9!important;">
|
461 |
<tr bgcolor="#EAF2FA">
|
@@ -469,7 +445,6 @@ class GravityFormsPersian {
|
|
469 |
</td>
|
470 |
</tr>
|
471 |
</table>' : '',
|
472 |
-
|
473 |
isset($lead['payment_status']) ? '
|
474 |
<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA" style="border:1px solid #e9e9e9!important;">
|
475 |
<tr bgcolor="#EAF2FA">
|
@@ -483,7 +458,6 @@ class GravityFormsPersian {
|
|
483 |
</td>
|
484 |
</tr>
|
485 |
</table>' : '',
|
486 |
-
|
487 |
(isset($lead['transaction_id']) && $gateway && isset($lead['payment_status']) ) ? '
|
488 |
<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA" style="border:1px solid #e9e9e9!important;">
|
489 |
<tr>
|
@@ -525,18 +499,15 @@ class GravityFormsPersian {
|
|
525 |
'<div style="text-align: right !important; direction: rtl !important;">',
|
526 |
'</div>',
|
527 |
);
|
528 |
-
|
529 |
$text = str_replace($tags, $values, $text);
|
530 |
return $text;
|
531 |
}
|
532 |
-
|
533 |
public function Add_Styles_Print_By_HANNANStd($value, $form){
|
534 |
if( is_rtl() ) {
|
535 |
wp_register_style('print_entry', plugins_url ( '/assets/css/printer.css', __FILE__, true ) );
|
536 |
return array('print_entry');
|
537 |
}
|
538 |
}
|
539 |
-
|
540 |
public function GravityForms_Admin_CSS_By_HANNANStd() {
|
541 |
if(!class_exists('GFForms')){
|
542 |
return;
|
@@ -554,14 +525,12 @@ class GravityFormsPersian {
|
|
554 |
wp_enqueue_script('gform_datepicker_init', plugins_url ( '/assets/js/wp-admin-datepicker.js', __FILE__), array( 'jquery', 'jquery-ui-core' ), true );
|
555 |
}
|
556 |
}
|
557 |
-
|
558 |
public function Persian_GravityForms_Dashboard_By_HANNANStd() {
|
559 |
if ( !current_user_can('manage_options') )
|
560 |
return;
|
561 |
global $wp_meta_boxes;
|
562 |
wp_add_dashboard_widget('persiangf_wd_hannanstd', __( 'Persian Gravity Forms Dashboard', 'Persian_Gravityforms_By_HANNANStd' ) , array( $this, 'Persian_GravityForms_Widget_By_HANNANStd'));
|
563 |
}
|
564 |
-
|
565 |
public static function Persian_GravityForms_Widget_By_HANNANStd() {
|
566 |
global $_wp_admin_css_colors;
|
567 |
$current_color = get_user_option( 'admin_color' );
|
@@ -622,7 +591,6 @@ class GravityFormsPersian {
|
|
622 |
$rss->__destruct();
|
623 |
unset($rss);
|
624 |
}
|
625 |
-
|
626 |
public static function get_product_price($form, $entry){
|
627 |
$currency = GFCommon::get_currency();
|
628 |
$products = GFCommon::get_product_fields($form, $entry, true);
|
@@ -695,15 +663,12 @@ class GravityFormsPersian {
|
|
695 |
$today = strtotime ($today);
|
696 |
return array("tz" => $tz, "today" => $today);
|
697 |
}
|
698 |
-
|
699 |
public static function get_base_url(){
|
700 |
return plugins_url( '', __FILE__ );
|
701 |
}
|
702 |
-
|
703 |
public function version(){
|
704 |
-
return '1.3.
|
705 |
}
|
706 |
-
|
707 |
public function Add_Melli_Cart_Field_By_HANNANStd( $field_groups ) {
|
708 |
foreach( $field_groups as &$group ){
|
709 |
if( $group["name"] == "advanced_fields" ){
|
@@ -717,21 +682,18 @@ class GravityFormsPersian {
|
|
717 |
}
|
718 |
return $field_groups;
|
719 |
}
|
720 |
-
|
721 |
public function Add_Melli_Cart_Field_Title_By_HANNANStd($type) {
|
722 |
if ($type == 'mellicart') {
|
723 |
return 'کد ملی';
|
724 |
}
|
725 |
}
|
726 |
-
|
727 |
public function Add_Melli_Cart_Field_Label_By_HANNANStd(){
|
728 |
?>
|
729 |
case "mellicart" :
|
730 |
field.label = 'کد ملی';
|
731 |
break;
|
732 |
<?php
|
733 |
-
}
|
734 |
-
|
735 |
public function Add_Melli_Cart_Field_Input_By_HANNANStd($input, $field, $value, $lead_id, $form_id ){
|
736 |
if ( $field["type"] == "mellicart" ) {
|
737 |
$id = $field["id"];
|
@@ -763,7 +725,6 @@ class GravityFormsPersian {
|
|
763 |
}
|
764 |
return $input;
|
765 |
}
|
766 |
-
|
767 |
public function Add_Melli_Cart_Field_Setting_By_HANNANStd( $position, $form_id ){
|
768 |
if( $position == 50 ){
|
769 |
?>
|
@@ -820,14 +781,12 @@ class GravityFormsPersian {
|
|
820 |
<?php
|
821 |
}
|
822 |
}
|
823 |
-
|
824 |
public function Add_Melli_Cart_Field_Class_By_HANNANStd($classes, $field, $form){
|
825 |
if( $field["type"] == "mellicart" ){
|
826 |
$classes .= " gform_mellicart";
|
827 |
}
|
828 |
return $classes;
|
829 |
}
|
830 |
-
|
831 |
public function Add_Melli_Cart_PHP_Checker_By_HANNANStd($meli_code='',$setting){
|
832 |
if (!empty($meli_code)) {
|
833 |
if ($setting == 1) {
|
@@ -846,20 +805,15 @@ class GravityFormsPersian {
|
|
846 |
{
|
847 |
return 2;
|
848 |
}
|
849 |
-
|
850 |
if(!is_numeric($meli_code))
|
851 |
return 4;
|
852 |
$meli_code = (string) preg_replace('/[^0-9]/','',$meli_code);
|
853 |
-
|
854 |
if(strlen($meli_code)>10 or strlen($meli_code)<8)
|
855 |
return 3;
|
856 |
-
|
857 |
if(strlen($meli_code)==8)
|
858 |
$meli_code = "00".$meli_code;
|
859 |
-
|
860 |
if(strlen($meli_code)==9)
|
861 |
$meli_code = "0".$meli_code;
|
862 |
-
|
863 |
$list_code = str_split($meli_code);
|
864 |
$last = (int) $list_code[9];
|
865 |
unset($list_code[9]);
|
@@ -879,7 +833,6 @@ class GravityFormsPersian {
|
|
879 |
}
|
880 |
return;
|
881 |
}
|
882 |
-
|
883 |
public function Add_Melli_Cart_Field_JavaScript_Checker_By_HANNANStd($content, $field, $value, $lead_id, $form_id){
|
884 |
if ( $field["type"] == "mellicart" && (rgget("field_mellicart", $field) || rgget("field_mellicart_sp", $field) ) && !IS_ADMIN )
|
885 |
{
|
@@ -1031,15 +984,12 @@ class GravityFormsPersian {
|
|
1031 |
}
|
1032 |
return $content;
|
1033 |
}
|
1034 |
-
|
1035 |
public static function checkdate($month, $day, $year){
|
1036 |
if(empty($month) || !is_numeric($month) || empty($day) || !is_numeric($day) || empty($year) || !is_numeric($year) || strlen($year) != 4)
|
1037 |
return false;
|
1038 |
return checkdate($month, $day, $year);
|
1039 |
}
|
1040 |
-
|
1041 |
-
public function Input_Valid_Checker_By_HANNANStd($result, $value, $form, $field){
|
1042 |
-
|
1043 |
//shamsi date formtat validator
|
1044 |
if ( $field["type"] == "date" )
|
1045 |
{
|
@@ -1129,7 +1079,6 @@ class GravityFormsPersian {
|
|
1129 |
}
|
1130 |
}
|
1131 |
}
|
1132 |
-
|
1133 |
//melli cart validator
|
1134 |
if ( $field["type"] == "mellicart" )
|
1135 |
{
|
@@ -1174,10 +1123,10 @@ class GravityFormsPersian {
|
|
1174 |
$result["message"] = 'این کد ملی توسط فرد دیگری ثبت شده است .';
|
1175 |
}
|
1176 |
}
|
1177 |
-
|
1178 |
//else returne results
|
1179 |
return $result;
|
1180 |
}
|
1181 |
}
|
1182 |
global $Persian_Gravityforms_By_HANNANStd_plugin;
|
1183 |
-
$Persian_Gravityforms_By_HANNANStd_plugin = new GravityFormsPersian( __FILE__ );
|
|
3 |
Plugin Name: Persian Gravity Forms
|
4 |
Plugin URI: https://wordpress.org/plugins/persian-gravity-forms/
|
5 |
Description: Gravity Forms for Iranian
|
6 |
+
Version: 1.3.2
|
7 |
Requires at least: 3.5
|
8 |
Author: HANNAN Ebrahimi Setoode
|
9 |
Author URI: http://www.gravityforms.ir/
|
16 |
private $file;
|
17 |
private $language;
|
18 |
private $is_persian;
|
|
|
19 |
public function __construct( $file ) {
|
20 |
$this->file = $file;
|
21 |
//actions
|
49 |
add_filter('gform_field_content', array( $this, 'Add_Melli_Cart_Field_JavaScript_Checker_By_HANNANStd'), 10, 5);
|
50 |
add_filter('gform_field_validation', array( $this, 'Input_Valid_Checker_By_HANNANStd'), 10, 4);
|
51 |
}
|
|
|
52 |
public function Activated_Plugin_By_HANNANStd() {
|
53 |
$path = str_replace( WP_PLUGIN_DIR . '/', '', $this->file );
|
54 |
if ( $plugins = get_option( 'active_plugins' ) ) {
|
66 |
}
|
67 |
}
|
68 |
}
|
|
|
69 |
public function init(){
|
70 |
require_once("include/Jalali.php");
|
71 |
require_once("include/Post_Content_Merge_Tags.php");
|
80 |
load_plugin_textdomain( 'Persian_Gravityforms_By_HANNANStd', false, $rel_path );
|
81 |
load_plugin_textdomain( 'gravityformsuserregistration', false, $rel_path );
|
82 |
}
|
|
|
83 |
protected static function get_base_path(){
|
84 |
$folder = basename(dirname(__FILE__));
|
85 |
return WP_PLUGIN_DIR . "/" . $folder;
|
86 |
}
|
|
|
87 |
public function Load_Textdomain_Mo_File_By_HANNANStd( $mo_file, $domain ) {
|
88 |
+
if ( strpos( $mo_file, 'fa_IR.mo' ) !== false ) {
|
|
|
89 |
$domains = array(
|
90 |
'gravityforms' => array(
|
91 |
'languages/gravityforms-fa_IR.mo' => 'gravityforms1.8/fa_IR.mo'
|
159 |
}
|
160 |
return $mo_file;
|
161 |
}
|
|
|
162 |
public function Add_Jalali_Active_Standard_Settings($position, $form_id){
|
163 |
if($position == 25){
|
164 |
?>
|
165 |
<li class="Jalali_setting field_setting">
|
166 |
<input type="checkbox" id="check_jalali" onclick="SetFieldProperty('check_jalali', jQuery(this).is(':checked') ? 1 : 0);"/>
|
167 |
<label class="inline gfield_value_label" for="field_admin_label">
|
168 |
+
<?php _e( 'فعالسازی تاریخ شمسی', 'Persian_Gravityforms_By_HANNANStd' ); ?>
|
169 |
<?php gform_tooltip("form_check_jalali") ?>
|
170 |
</label>
|
171 |
</li>
|
172 |
<?php
|
173 |
}
|
174 |
}
|
|
|
175 |
public function Editor_Script_By_HANNANStd(){
|
176 |
?>
|
177 |
<script type='text/javascript'>
|
189 |
</script>
|
190 |
<?php
|
191 |
}
|
|
|
192 |
public function Add_Encryption_tooltips_By_HANNANStd($tooltips){
|
193 |
$tooltips["form_check_jalali"] = "<h6>فعالسازی تاریخ شمسی</h6>در صورتی که از چند فیلد تاریخ استفاده میکنید ، فعالسازی تاریخ شمسی یکی از فیلدها کفایت میکند .<br/>تذکر : با توجه به آزمایشی بودن این قسمت ممکن است تداخل توابع سبب ناسازگاری با برخی قالب ها شود.";
|
194 |
+
$tooltips["form_field_mellicart"] = "<h6>نمایش لحظه ای شهر از روی کد ملی </h6>نمایش شهر و پیغام زیر فیلد کد ملی بعد از پر شدن فیلد . تذکر : در صورتی که این گزینه را فعال نمایید ،ممکن است فراخوانی شهر های ایران با توجه به زیاد بودن آنها سبب سنگین شدن صفحه گردد.";
|
195 |
$tooltips["form_field_mellicart_sp"] = "<h6>جدا سازی ارقام</h6>در صورتی که این گزینه را فعال نمایید ، پس از پر شدن فیلد ، <strong>در صورتی که کد ملی وارد شده صحیح تشخصی داده شود</strong> ؛ کد ملی به صورت زیر در خواهد آمد :<br/>xxx-xxxxxx-x";
|
196 |
$tooltips["form_field_mellicart_header"] = "<h6>پیغام خطا</h6>در صورتی که کاربر فیلد کد ملی را به صورت صحیح وارد نکند ؛ پیغام خطا را مشاهده میکند که میتوانید این پیغام ها را مدیریت نمایید . در صورتی که مقادیر زیر را خالی بگذارید پیغام پیشفرض نمایش داده خواهد شد.";
|
197 |
$tooltips["form_field_mellicart_sp1"] = "<h6>پیغام پیشفرض</h6>با توجه به اینکه کد ملی فقط باید به صورت عدد باشد ، در صورتی که کاراکتری غیر از عدد وارد شده باشد پیغام خطا نمایش داده خواهد شد .<br/>پیغام پیشفرض : کد ملی فقط باید به صورت عدد وارد شود . ";
|
200 |
$tooltips["form_field_mellicart_sp4"] = "<h6>پیغام پیشفرض</h6>در صورتی که کد ملی وارد شده مطابق با الگوریتم کشور نباشد پیغام خطا نمایش داده خواهد شد .<br/>پیغام پیشفرض : کد ملی وارد شده مطابق با استانداردهای کشور نمی باشد .";
|
201 |
return $tooltips;
|
202 |
}
|
|
|
203 |
function Add_Jalali_Front_End_On_Off_Switch_By_HANNANStd( $form, $ajax ) {
|
204 |
foreach ( $form['fields'] as $field ) {
|
205 |
if ( ( $field['type'] == 'date' ) ) {
|
206 |
if(rgget("check_jalali", $field)){
|
207 |
+
add_filter('gform_date_min_year', array( $this, 'Set_Min_Year_By_HANNANStd' ) );
|
208 |
+
add_filter('gform_date_max_year', array( $this, 'Set_Max_Year_By_HANNANStd' ) );
|
209 |
if (!IS_ADMIN)
|
210 |
{
|
211 |
wp_deregister_script('gform_datepicker_init');
|
216 |
}
|
217 |
}
|
218 |
}
|
|
|
219 |
public function Set_Min_Year_By_HANNANStd($min_year){
|
220 |
$min_year = GF_gregorian_to_jalali($min_year,03,21);
|
221 |
return $min_year[0]+1;
|
222 |
}
|
|
|
223 |
public function Set_Max_Year_By_HANNANStd($max_year){
|
224 |
$max_year = GF_gregorian_to_jalali($max_year,03,21);
|
225 |
return $max_year[0]+20;
|
226 |
}
|
|
|
227 |
public function GravityForms_Footer_Left_By_HANNANStd($text) {
|
228 |
$text = sprintf(__("%sGravity Forms%s for WordPress is a full featured contact form plugin .", "Persian_Gravityforms_By_HANNANStd"), '<a href="http://gravityforms.ir" target="_blank">', "</a>");return $text;
|
229 |
}
|
|
|
230 |
public function Add_Private_Post_Status_By_HANNANStd($post_status_options) {
|
231 |
$post_status_options['private'] = __("خصوصی", "Persian_Gravityforms_By_HANNANStd");
|
232 |
return $post_status_options;
|
233 |
}
|
|
|
234 |
public function Update_Currency_By_HANNANStd($currencies) {
|
235 |
$currencies['IRR'] = array("name" => __("ریال ایران", "Persian_Gravityforms_By_HANNANStd"), "symbol_left" => '', "symbol_right" => " ریال ", "symbol_padding" => "", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 0);
|
236 |
$currencies['IRT'] = array("name" => __("تومان", "Persian_Gravityforms_By_HANNANStd"), "symbol_left" => '', "symbol_right" => " تومان ", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 0);
|
237 |
return $currencies;
|
238 |
}
|
|
|
239 |
public function Gform_IRAN_By_HANNANStd( $address_types ) {
|
240 |
$address_types['persian'] = array(
|
241 |
'label' => __( 'ایران', 'Persian_Gravityforms_By_HANNANStd' ),
|
278 |
);
|
279 |
return $address_types;
|
280 |
}
|
|
|
281 |
public function Add_Iran_States_Predefined_Choice_By_HANNANStd($choices){
|
282 |
$choices[__( 'استانهای ایران', 'Persian_Gravityforms_By_HANNANStd' )] = array(
|
283 |
__( 'آذربایجان شرقی', 'Persian_Gravityforms_By_HANNANStd' ),
|
313 |
__( 'یزد', 'Persian_Gravityforms_By_HANNANStd' )
|
314 |
); return $choices;
|
315 |
}
|
|
|
316 |
public function Add_Iran_Months_Predefined_Choice_By_HANNANStd($choices){
|
317 |
$choices[__( 'ماه های ایران', 'Persian_Gravityforms_By_HANNANStd' )] = array(__( 'فروردین', 'Persian_Gravityforms_By_HANNANStd' ),
|
318 |
__( 'اردیبهشت', 'Persian_Gravityforms_By_HANNANStd' ),
|
327 |
__( 'بهمن', 'Persian_Gravityforms_By_HANNANStd' ),
|
328 |
__( 'اسفند', 'Persian_Gravityforms_By_HANNANStd' )
|
329 |
); return $choices;
|
330 |
+
}
|
|
|
331 |
public function Add_Merge_Tags_To_List_By_HANNANStd($form){ ?>
|
332 |
<script type="text/javascript">
|
333 |
gform.addFilter("gform_merge_tags", "add_merge_tags");
|
347 |
<?php
|
348 |
return $form;
|
349 |
}
|
|
|
350 |
function First_Column_Actions_By_HANNANStd($form_id, $field_id, $value, $lead, $query_string) {
|
351 |
$url = get_bloginfo("wpurl") . "/wp-admin/admin.php?page=gf_entries&view=entries&id=" . $form_id;
|
352 |
$gateway = gform_get_meta($lead["id"], "payment_gateway");
|
375 |
else if ($lead["payment_status"])
|
376 |
echo '<a class="stat" href="'.$url.'&sort=0&dir=DESC&s=Processing&field_id=payment_status&operator=is" style="color:'.$color.';"> موفق </a>';
|
377 |
}
|
|
|
378 |
public function Update_Lead_No_Gateway_By_HANNANStd($lead, $form) {
|
379 |
$gateway = gform_get_meta($lead['id'], 'payment_gateway');
|
380 |
$method = $lead['payment_method'];
|
397 |
RGFormsModel::update_lead($lead);
|
398 |
return $lead;
|
399 |
}
|
|
|
400 |
public function GformReplaceMergeTags_By_HANNANStd($text, $form, $lead, $url_encode, $esc_html, $nl2br, $format){
|
401 |
$gateway = gform_get_meta($lead['id'], 'payment_gateway');
|
402 |
if ($lead['payment_status']=="Active" || $lead['payment_status']=="Paid")
|
420 |
$gateway ? $gateway : '',
|
421 |
isset($lead['transaction_id']) ? $lead['transaction_id'] : '',
|
422 |
isset($lead['payment_status']) ? $payment_status : '',
|
|
|
423 |
$gateway ? '
|
424 |
<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA" style="border:1px solid #e9e9e9!important;">
|
425 |
<tr bgcolor="#EAF2FA">
|
432 |
</td>
|
433 |
</tr>
|
434 |
</table>' : '',
|
|
|
435 |
isset($lead['transaction_id']) ? '
|
436 |
<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA" style="border:1px solid #e9e9e9!important;">
|
437 |
<tr bgcolor="#EAF2FA">
|
445 |
</td>
|
446 |
</tr>
|
447 |
</table>' : '',
|
|
|
448 |
isset($lead['payment_status']) ? '
|
449 |
<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA" style="border:1px solid #e9e9e9!important;">
|
450 |
<tr bgcolor="#EAF2FA">
|
458 |
</td>
|
459 |
</tr>
|
460 |
</table>' : '',
|
|
|
461 |
(isset($lead['transaction_id']) && $gateway && isset($lead['payment_status']) ) ? '
|
462 |
<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA" style="border:1px solid #e9e9e9!important;">
|
463 |
<tr>
|
499 |
'<div style="text-align: right !important; direction: rtl !important;">',
|
500 |
'</div>',
|
501 |
);
|
|
|
502 |
$text = str_replace($tags, $values, $text);
|
503 |
return $text;
|
504 |
}
|
|
|
505 |
public function Add_Styles_Print_By_HANNANStd($value, $form){
|
506 |
if( is_rtl() ) {
|
507 |
wp_register_style('print_entry', plugins_url ( '/assets/css/printer.css', __FILE__, true ) );
|
508 |
return array('print_entry');
|
509 |
}
|
510 |
}
|
|
|
511 |
public function GravityForms_Admin_CSS_By_HANNANStd() {
|
512 |
if(!class_exists('GFForms')){
|
513 |
return;
|
525 |
wp_enqueue_script('gform_datepicker_init', plugins_url ( '/assets/js/wp-admin-datepicker.js', __FILE__), array( 'jquery', 'jquery-ui-core' ), true );
|
526 |
}
|
527 |
}
|
|
|
528 |
public function Persian_GravityForms_Dashboard_By_HANNANStd() {
|
529 |
if ( !current_user_can('manage_options') )
|
530 |
return;
|
531 |
global $wp_meta_boxes;
|
532 |
wp_add_dashboard_widget('persiangf_wd_hannanstd', __( 'Persian Gravity Forms Dashboard', 'Persian_Gravityforms_By_HANNANStd' ) , array( $this, 'Persian_GravityForms_Widget_By_HANNANStd'));
|
533 |
}
|
|
|
534 |
public static function Persian_GravityForms_Widget_By_HANNANStd() {
|
535 |
global $_wp_admin_css_colors;
|
536 |
$current_color = get_user_option( 'admin_color' );
|
591 |
$rss->__destruct();
|
592 |
unset($rss);
|
593 |
}
|
|
|
594 |
public static function get_product_price($form, $entry){
|
595 |
$currency = GFCommon::get_currency();
|
596 |
$products = GFCommon::get_product_fields($form, $entry, true);
|
663 |
$today = strtotime ($today);
|
664 |
return array("tz" => $tz, "today" => $today);
|
665 |
}
|
|
|
666 |
public static function get_base_url(){
|
667 |
return plugins_url( '', __FILE__ );
|
668 |
}
|
|
|
669 |
public function version(){
|
670 |
+
return '1.3.2';
|
671 |
}
|
|
|
672 |
public function Add_Melli_Cart_Field_By_HANNANStd( $field_groups ) {
|
673 |
foreach( $field_groups as &$group ){
|
674 |
if( $group["name"] == "advanced_fields" ){
|
682 |
}
|
683 |
return $field_groups;
|
684 |
}
|
|
|
685 |
public function Add_Melli_Cart_Field_Title_By_HANNANStd($type) {
|
686 |
if ($type == 'mellicart') {
|
687 |
return 'کد ملی';
|
688 |
}
|
689 |
}
|
|
|
690 |
public function Add_Melli_Cart_Field_Label_By_HANNANStd(){
|
691 |
?>
|
692 |
case "mellicart" :
|
693 |
field.label = 'کد ملی';
|
694 |
break;
|
695 |
<?php
|
696 |
+
}
|
|
|
697 |
public function Add_Melli_Cart_Field_Input_By_HANNANStd($input, $field, $value, $lead_id, $form_id ){
|
698 |
if ( $field["type"] == "mellicart" ) {
|
699 |
$id = $field["id"];
|
725 |
}
|
726 |
return $input;
|
727 |
}
|
|
|
728 |
public function Add_Melli_Cart_Field_Setting_By_HANNANStd( $position, $form_id ){
|
729 |
if( $position == 50 ){
|
730 |
?>
|
781 |
<?php
|
782 |
}
|
783 |
}
|
|
|
784 |
public function Add_Melli_Cart_Field_Class_By_HANNANStd($classes, $field, $form){
|
785 |
if( $field["type"] == "mellicart" ){
|
786 |
$classes .= " gform_mellicart";
|
787 |
}
|
788 |
return $classes;
|
789 |
}
|
|
|
790 |
public function Add_Melli_Cart_PHP_Checker_By_HANNANStd($meli_code='',$setting){
|
791 |
if (!empty($meli_code)) {
|
792 |
if ($setting == 1) {
|
805 |
{
|
806 |
return 2;
|
807 |
}
|
|
|
808 |
if(!is_numeric($meli_code))
|
809 |
return 4;
|
810 |
$meli_code = (string) preg_replace('/[^0-9]/','',$meli_code);
|
|
|
811 |
if(strlen($meli_code)>10 or strlen($meli_code)<8)
|
812 |
return 3;
|
|
|
813 |
if(strlen($meli_code)==8)
|
814 |
$meli_code = "00".$meli_code;
|
|
|
815 |
if(strlen($meli_code)==9)
|
816 |
$meli_code = "0".$meli_code;
|
|
|
817 |
$list_code = str_split($meli_code);
|
818 |
$last = (int) $list_code[9];
|
819 |
unset($list_code[9]);
|
833 |
}
|
834 |
return;
|
835 |
}
|
|
|
836 |
public function Add_Melli_Cart_Field_JavaScript_Checker_By_HANNANStd($content, $field, $value, $lead_id, $form_id){
|
837 |
if ( $field["type"] == "mellicart" && (rgget("field_mellicart", $field) || rgget("field_mellicart_sp", $field) ) && !IS_ADMIN )
|
838 |
{
|
984 |
}
|
985 |
return $content;
|
986 |
}
|
|
|
987 |
public static function checkdate($month, $day, $year){
|
988 |
if(empty($month) || !is_numeric($month) || empty($day) || !is_numeric($day) || empty($year) || !is_numeric($year) || strlen($year) != 4)
|
989 |
return false;
|
990 |
return checkdate($month, $day, $year);
|
991 |
}
|
992 |
+
public function Input_Valid_Checker_By_HANNANStd($result, $value, $form, $field){
|
|
|
|
|
993 |
//shamsi date formtat validator
|
994 |
if ( $field["type"] == "date" )
|
995 |
{
|
1079 |
}
|
1080 |
}
|
1081 |
}
|
|
|
1082 |
//melli cart validator
|
1083 |
if ( $field["type"] == "mellicart" )
|
1084 |
{
|
1123 |
$result["message"] = 'این کد ملی توسط فرد دیگری ثبت شده است .';
|
1124 |
}
|
1125 |
}
|
|
|
1126 |
//else returne results
|
1127 |
return $result;
|
1128 |
}
|
1129 |
}
|
1130 |
global $Persian_Gravityforms_By_HANNANStd_plugin;
|
1131 |
+
$Persian_Gravityforms_By_HANNANStd_plugin = new GravityFormsPersian( __FILE__ );
|
1132 |
+
?>
|
include/Jalali.php
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
/** Software Hijri_Shamsi , Solar(Jalali) Date and Time
|
4 |
Copyright(C)2011, Reza Gholampanahi , http://jdf.scr.ir
|
5 |
version 2.55 :: 1391/08/24 = 1433/12/18 = 2012/11/15 */
|
6 |
-
|
7 |
/* F */
|
8 |
function GF_jdate($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$tr_num='fa'){
|
9 |
-
|
10 |
$T_sec=0;/* <= رفع خطاي زمان سرور ، با اعداد '+' و '-' بر حسب ثانيه */
|
11 |
-
|
12 |
if($time_zone!='local')date_default_timezone_set(($time_zone=='')?'Asia/Tehran':$time_zone);
|
13 |
$ts=$T_sec+(($timestamp=='' or $timestamp=='now')?time():GF_tr_num($timestamp));
|
14 |
$date=explode('_',date('H_i_j_n_O_P_s_w_Y',$ts));
|
@@ -24,161 +21,123 @@ function GF_jdate($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$tr_nu
|
|
24 |
continue;
|
25 |
}
|
26 |
switch($sub){
|
27 |
-
|
28 |
case'E':case'R':case'x':case'X':
|
29 |
$out.='http://jdf.scr.ir';
|
30 |
break;
|
31 |
-
|
32 |
case'B':case'e':case'g':
|
33 |
case'G':case'h':case'I':
|
34 |
case'T':case'u':case'Z':
|
35 |
$out.=date($sub,$ts);
|
36 |
break;
|
37 |
-
|
38 |
case'a':
|
39 |
$out.=($date[0]<12)?'ق.ظ':'ب.ظ';
|
40 |
break;
|
41 |
-
|
42 |
case'A':
|
43 |
$out.=($date[0]<12)?'قبل از ظهر':'بعد از ظهر';
|
44 |
break;
|
45 |
-
|
46 |
case'b':
|
47 |
$out.=(int)($j_m/3.1)+1;
|
48 |
break;
|
49 |
-
|
50 |
case'c':
|
51 |
$out.=$j_y.'/'.$j_m.'/'.$j_d.' ،'.$date[0].':'.$date[1].':'.$date[6].' '.$date[5];
|
52 |
break;
|
53 |
-
|
54 |
case'C':
|
55 |
$out.=(int)(($j_y+99)/100);
|
56 |
break;
|
57 |
-
|
58 |
case'd':
|
59 |
$out.=($j_d<10)?'0'.$j_d:$j_d;
|
60 |
break;
|
61 |
-
|
62 |
case'D':
|
63 |
$out.=GF_jdate_words(array('kh'=>$date[7]),' ');
|
64 |
break;
|
65 |
-
|
66 |
case'f':
|
67 |
$out.=GF_jdate_words(array('ff'=>$j_m),' ');
|
68 |
break;
|
69 |
-
|
70 |
case'F':
|
71 |
$out.=GF_jdate_words(array('mm'=>$j_m),' ');
|
72 |
break;
|
73 |
-
|
74 |
case'H':
|
75 |
$out.=$date[0];
|
76 |
break;
|
77 |
-
|
78 |
case'i':
|
79 |
$out.=$date[1];
|
80 |
break;
|
81 |
-
|
82 |
case'j':
|
83 |
$out.=$j_d;
|
84 |
break;
|
85 |
-
|
86 |
case'J':
|
87 |
$out.=GF_jdate_words(array('rr'=>$j_d),' ');
|
88 |
break;
|
89 |
-
|
90 |
case'k';
|
91 |
$out.=GF_tr_num(100-(int)($doy/($kab+365)*1000)/10,$tr_num);
|
92 |
break;
|
93 |
-
|
94 |
case'K':
|
95 |
$out.=GF_tr_num((int)($doy/($kab+365)*1000)/10,$tr_num);
|
96 |
break;
|
97 |
-
|
98 |
case'l':
|
99 |
$out.=GF_jdate_words(array('rh'=>$date[7]),' ');
|
100 |
break;
|
101 |
-
|
102 |
case'L':
|
103 |
$out.=$kab;
|
104 |
break;
|
105 |
-
|
106 |
case'm':
|
107 |
$out.=($j_m>9)?$j_m:'0'.$j_m;
|
108 |
break;
|
109 |
-
|
110 |
case'M':
|
111 |
$out.=GF_jdate_words(array('km'=>$j_m),' ');
|
112 |
break;
|
113 |
-
|
114 |
case'n':
|
115 |
$out.=$j_m;
|
116 |
break;
|
117 |
-
|
118 |
case'N':
|
119 |
$out.=$date[7]+1;
|
120 |
break;
|
121 |
-
|
122 |
case'o':
|
123 |
$jdw=($date[7]==6)?0:$date[7]+1;
|
124 |
$dny=364+$kab-$doy;
|
125 |
$out.=($jdw>($doy+3) and $doy<3)?$j_y-1:(((3-$dny)>$jdw and $dny<3)?$j_y+1:$j_y);
|
126 |
break;
|
127 |
-
|
128 |
case'O':
|
129 |
$out.=$date[4];
|
130 |
break;
|
131 |
-
|
132 |
case'p':
|
133 |
$out.=GF_jdate_words(array('mb'=>$j_m),' ');
|
134 |
break;
|
135 |
-
|
136 |
case'P':
|
137 |
$out.=$date[5];
|
138 |
break;
|
139 |
-
|
140 |
case'q':
|
141 |
$out.=GF_jdate_words(array('sh'=>$j_y),' ');
|
142 |
break;
|
143 |
-
|
144 |
case'Q':
|
145 |
$out.=$kab+364-$doy;
|
146 |
break;
|
147 |
-
|
148 |
case'r':
|
149 |
$key=GF_jdate_words(array('rh'=>$date[7],'mm'=>$j_m));
|
150 |
$out.=$date[0].':'.$date[1].':'.$date[6].' '.$date[4]
|
151 |
.' '.$key['rh'].'، '.$j_d.' '.$key['mm'].' '.$j_y;
|
152 |
break;
|
153 |
-
|
154 |
case's':
|
155 |
$out.=$date[6];
|
156 |
break;
|
157 |
-
|
158 |
case'S':
|
159 |
$out.='ام';
|
160 |
break;
|
161 |
-
|
162 |
case't':
|
163 |
$out.=($j_m!=12)?(31-(int)($j_m/6.5)):($kab+29);
|
164 |
break;
|
165 |
-
|
166 |
case'U':
|
167 |
$out.=$ts;
|
168 |
break;
|
169 |
-
|
170 |
case'v':
|
171 |
$out.=GF_jdate_words(array('ss'=>substr($j_y,2,2)),' ');
|
172 |
break;
|
173 |
-
|
174 |
case'V':
|
175 |
$out.=GF_jdate_words(array('ss'=>$j_y),' ');
|
176 |
break;
|
177 |
-
|
178 |
case'w':
|
179 |
$out.=($date[7]==6)?0:$date[7]+1;
|
180 |
break;
|
181 |
-
|
182 |
case'W':
|
183 |
$avs=(($date[7]==6)?0:$date[7]+1)-($doy%7);
|
184 |
if($avs<0)$avs+=7;
|
@@ -192,30 +151,23 @@ function GF_jdate($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$tr_nu
|
|
192 |
if($aks==7)$aks=0;
|
193 |
$out.=(($kab+363-$doy)<$aks and $aks<3)?'01':(($num<10)?'0'.$num:$num);
|
194 |
break;
|
195 |
-
|
196 |
case'y':
|
197 |
$out.=substr($j_y,2,2);
|
198 |
break;
|
199 |
-
|
200 |
case'Y':
|
201 |
$out.=$j_y;
|
202 |
break;
|
203 |
-
|
204 |
case'z':
|
205 |
$out.=$doy;
|
206 |
break;
|
207 |
-
|
208 |
default:$out.=$sub;
|
209 |
}
|
210 |
}
|
211 |
return($tr_num!='en')?GF_tr_num($out,'fa','.'):$out;
|
212 |
}
|
213 |
-
|
214 |
/* F */
|
215 |
function GF_jstrftime($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$tr_num='fa'){
|
216 |
-
|
217 |
$T_sec=0;/* <= رفع خطاي زمان سرور ، با اعداد '+' و '-' بر حسب ثانيه */
|
218 |
-
|
219 |
if($time_zone!='local')date_default_timezone_set(($time_zone=='')?'Asia/Tehran':$time_zone);
|
220 |
$ts=$T_sec+(($timestamp=='' or $timestamp=='now')?time():GF_tr_num($timestamp));
|
221 |
$date=explode('_',date('h_H_i_j_n_s_w_Y',$ts));
|
@@ -233,36 +185,28 @@ function GF_jstrftime($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$t
|
|
233 |
continue;
|
234 |
}
|
235 |
switch($sub){
|
236 |
-
|
237 |
/* Day */
|
238 |
case'a':
|
239 |
$out.=GF_jdate_words(array('kh'=>$date[6]),' ');
|
240 |
break;
|
241 |
-
|
242 |
case'A':
|
243 |
$out.=GF_jdate_words(array('rh'=>$date[6]),' ');
|
244 |
break;
|
245 |
-
|
246 |
case'd':
|
247 |
$out.=($j_d<10)?'0'.$j_d:$j_d;
|
248 |
break;
|
249 |
-
|
250 |
case'e':
|
251 |
$out.=($j_d<10)?' '.$j_d:$j_d;
|
252 |
break;
|
253 |
-
|
254 |
case'j':
|
255 |
$out.=str_pad($doy+1,3,0,STR_PAD_LEFT);
|
256 |
break;
|
257 |
-
|
258 |
case'u':
|
259 |
$out.=$date[6]+1;
|
260 |
break;
|
261 |
-
|
262 |
case'w':
|
263 |
$out.=($date[6]==6)?0:$date[6]+1;
|
264 |
break;
|
265 |
-
|
266 |
/* Week */
|
267 |
case'U':
|
268 |
$avs=(($date[6]<5)?$date[6]+2:$date[6]-5)-($doy%7);
|
@@ -271,7 +215,6 @@ function GF_jstrftime($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$t
|
|
271 |
if($avs>3 or $avs==1)$num--;
|
272 |
$out.=($num<10)?'0'.$num:$num;
|
273 |
break;
|
274 |
-
|
275 |
case'V':
|
276 |
$avs=(($date[6]==6)?0:$date[6]+1)-($doy%7);
|
277 |
if($avs<0)$avs+=7;
|
@@ -285,7 +228,6 @@ function GF_jstrftime($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$t
|
|
285 |
if($aks==7)$aks=0;
|
286 |
$out.=(($kab+363-$doy)<$aks and $aks<3)?'01':(($num<10)?'0'.$num:$num);
|
287 |
break;
|
288 |
-
|
289 |
case'W':
|
290 |
$avs=(($date[6]==6)?0:$date[6]+1)-($doy%7);
|
291 |
if($avs<0)$avs+=7;
|
@@ -293,141 +235,110 @@ function GF_jstrftime($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$t
|
|
293 |
if($avs>3)$num--;
|
294 |
$out.=($num<10)?'0'.$num:$num;
|
295 |
break;
|
296 |
-
|
297 |
/* Month */
|
298 |
case'b':
|
299 |
case'h':
|
300 |
$out.=GF_jdate_words(array('km'=>$j_m),' ');
|
301 |
break;
|
302 |
-
|
303 |
case'B':
|
304 |
$out.=GF_jdate_words(array('mm'=>$j_m),' ');
|
305 |
break;
|
306 |
-
|
307 |
case'm':
|
308 |
$out.=($j_m>9)?$j_m:'0'.$j_m;
|
309 |
break;
|
310 |
-
|
311 |
/* Year */
|
312 |
case'C':
|
313 |
$out.=substr($j_y,0,2);
|
314 |
break;
|
315 |
-
|
316 |
case'g':
|
317 |
$jdw=($date[6]==6)?0:$date[6]+1;
|
318 |
$dny=364+$kab-$doy;
|
319 |
$out.=substr(($jdw>($doy+3) and $doy<3)?$j_y-1:(((3-$dny)>$jdw and $dny<3)?$j_y+1:$j_y),2,2);
|
320 |
break;
|
321 |
-
|
322 |
case'G':
|
323 |
$jdw=($date[6]==6)?0:$date[6]+1;
|
324 |
$dny=364+$kab-$doy;
|
325 |
$out.=($jdw>($doy+3) and $doy<3)?$j_y-1:(((3-$dny)>$jdw and $dny<3)?$j_y+1:$j_y);
|
326 |
break;
|
327 |
-
|
328 |
case'y':
|
329 |
$out.=substr($j_y,2,2);
|
330 |
break;
|
331 |
-
|
332 |
case'Y':
|
333 |
$out.=$j_y;
|
334 |
break;
|
335 |
-
|
336 |
/* Time */
|
337 |
case'H':
|
338 |
$out.=$date[1];
|
339 |
break;
|
340 |
-
|
341 |
case'I':
|
342 |
$out.=$date[0];
|
343 |
break;
|
344 |
-
|
345 |
case'l':
|
346 |
$out.=($date[0]>9)?$date[0]:' '.(int)$date[0];
|
347 |
break;
|
348 |
-
|
349 |
case'M':
|
350 |
$out.=$date[2];
|
351 |
break;
|
352 |
-
|
353 |
case'p':
|
354 |
$out.=($date[1]<12)?'قبل از ظهر':'بعد از ظهر';
|
355 |
break;
|
356 |
-
|
357 |
case'P':
|
358 |
$out.=($date[1]<12)?'ق.ظ':'ب.ظ';
|
359 |
break;
|
360 |
-
|
361 |
case'r':
|
362 |
$out.=$date[0].':'.$date[2].':'.$date[5].' '.(($date[1]<12)?'قبل از ظهر':'بعد از ظهر');
|
363 |
break;
|
364 |
-
|
365 |
case'R':
|
366 |
$out.=$date[1].':'.$date[2];
|
367 |
break;
|
368 |
-
|
369 |
case'S':
|
370 |
$out.=$date[5];
|
371 |
break;
|
372 |
-
|
373 |
case'T':
|
374 |
$out.=$date[1].':'.$date[2].':'.$date[5];
|
375 |
break;
|
376 |
-
|
377 |
case'X':
|
378 |
$out.=$date[0].':'.$date[2].':'.$date[5];
|
379 |
break;
|
380 |
-
|
381 |
case'z':
|
382 |
$out.=date('O',$ts);
|
383 |
break;
|
384 |
-
|
385 |
case'Z':
|
386 |
$out.=date('T',$ts);
|
387 |
break;
|
388 |
-
|
389 |
/* Time and Date Stamps */
|
390 |
case'c':
|
391 |
$key=GF_jdate_words(array('rh'=>$date[6],'mm'=>$j_m));
|
392 |
$out.=$date[1].':'.$date[2].':'.$date[5].' '.date('P',$ts)
|
393 |
.' '.$key['rh'].'، '.$j_d.' '.$key['mm'].' '.$j_y;
|
394 |
break;
|
395 |
-
|
396 |
case'D':
|
397 |
$out.=substr($j_y,2,2).'/'.(($j_m>9)?$j_m:'0'.$j_m).'/'.(($j_d<10)?'0'.$j_d:$j_d);
|
398 |
break;
|
399 |
-
|
400 |
case'F':
|
401 |
$out.=$j_y.'-'.(($j_m>9)?$j_m:'0'.$j_m).'-'.(($j_d<10)?'0'.$j_d:$j_d);
|
402 |
break;
|
403 |
-
|
404 |
case's':
|
405 |
$out.=$ts;
|
406 |
break;
|
407 |
-
|
408 |
case'x':
|
409 |
$out.=substr($j_y,2,2).'/'.(($j_m>9)?$j_m:'0'.$j_m).'/'.(($j_d<10)?'0'.$j_d:$j_d);
|
410 |
break;
|
411 |
-
|
412 |
/* Miscellaneous */
|
413 |
case'n':
|
414 |
$out.="\n";
|
415 |
break;
|
416 |
-
|
417 |
case't':
|
418 |
$out.="\t";
|
419 |
break;
|
420 |
-
|
421 |
case'%':
|
422 |
$out.='%';
|
423 |
break;
|
424 |
-
|
425 |
default:$out.=$sub;
|
426 |
}
|
427 |
}
|
428 |
return($tr_num!='en')?GF_tr_num($out,'fa','.'):$out;
|
429 |
}
|
430 |
-
|
431 |
/* F */
|
432 |
function GF_jmktime($h='',$m='',$s='',$jm='',$jd='',$jy='',$is_dst=-1){
|
433 |
$h=GF_tr_num($h); $m=GF_tr_num($m); $s=GF_tr_num($s); $jm=GF_tr_num($jm); $jd=GF_tr_num($jd); $jy=GF_tr_num($jy);
|
@@ -438,7 +349,6 @@ function GF_jmktime($h='',$m='',$s='',$jm='',$jd='',$jy='',$is_dst=-1){
|
|
438 |
return mktime($h,$m,$s,$month,$day,$year,$is_dst);
|
439 |
}
|
440 |
}
|
441 |
-
|
442 |
/* F */
|
443 |
function GF_jgetdate($timestamp='',$none='',$tz='Asia/Tehran',$tn='en'){
|
444 |
$ts=($timestamp=='')?time():GF_tr_num($timestamp);
|
@@ -457,27 +367,23 @@ function GF_jgetdate($timestamp='',$none='',$tz='Asia/Tehran',$tn='en'){
|
|
457 |
0=>GF_tr_num($ts,$tn)
|
458 |
);
|
459 |
}
|
460 |
-
|
461 |
/* F */
|
462 |
function GF_jcheckdate($jm,$jd,$jy){
|
463 |
$jm=GF_tr_num($jm); $jd=GF_tr_num($jd); $jy=GF_tr_num($jy);
|
464 |
$l_d=($jm==12)?(($jy%33%4-1==(int)($jy%33*.05))?30:29):31-(int)($jm/6.5);
|
465 |
return($jm>0 and $jd>0 and $jy>0 and $jm<13 and $jd<=$l_d)?true:false;
|
466 |
}
|
467 |
-
|
468 |
/* F */
|
469 |
function GF_tr_num($str,$mod='en',$mf='٫'){
|
470 |
$num_a=array('0','1','2','3','4','5','6','7','8','9','.');
|
471 |
$key_a=array('۰','۱','۲','۳','۴','۵','۶','۷','۸','۹',$mf);
|
472 |
return($mod=='fa')?str_replace($num_a,$key_a,$str):str_replace($key_a,$num_a,$str);
|
473 |
}
|
474 |
-
|
475 |
/* F */
|
476 |
function GF_jdate_words($array,$mod=''){
|
477 |
foreach($array as $type=>$num){
|
478 |
$num=(int)GF_tr_num($num);
|
479 |
switch($type){
|
480 |
-
|
481 |
case'ss':
|
482 |
$sl=strlen($num);
|
483 |
$xy3=substr($num,2-$sl,1);
|
@@ -498,59 +404,48 @@ function GF_jdate_words($array,$mod=''){
|
|
498 |
,array('هزار و دویست','هزار و سیصد','هزار و چهارصد','هزار و نهصد','دوهزار')
|
499 |
,substr($num,0,2)).((substr($num,2,2)=='00')?'':' و '):'').$h3.$p34.$h34.$h4;
|
500 |
break;
|
501 |
-
|
502 |
case'mm':
|
503 |
$key=array
|
504 |
('فروردین','اردیبهشت','خرداد','تیر','مرداد','شهریور','مهر','آبان','آذر','دی','بهمن','اسفند');
|
505 |
$array[$type]=$key[$num-1];
|
506 |
break;
|
507 |
-
|
508 |
case'rr':
|
509 |
$key=array('یک','دو','سه','چهار','پنج','شش','هفت','هشت','نه','ده','یازده','دوازده','سیزده',
|
510 |
'چهارده','پانزده','شانزده','هفده','هجده','نوزده','بیست','بیست و یک','بیست و دو','بیست و سه',
|
511 |
'بیست و چهار','بیست و پنج','بیست و شش','بیست و هفت','بیست و هشت','بیست و نه','سی','سی و یک');
|
512 |
$array[$type]=$key[$num-1];
|
513 |
break;
|
514 |
-
|
515 |
case'rh':
|
516 |
$key=array('یکشنبه','دوشنبه','سه شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه');
|
517 |
$array[$type]=$key[$num];
|
518 |
break;
|
519 |
-
|
520 |
case'sh':
|
521 |
$key=array('مار','اسب','گوسفند','میمون','مرغ','سگ','خوک','موش','گاو','پلنگ','خرگوش','نهنگ');
|
522 |
$array[$type]=$key[$num%12];
|
523 |
break;
|
524 |
-
|
525 |
case'mb':
|
526 |
$key=array('حمل','ثور','جوزا','سرطان','اسد','سنبله','میزان','عقرب','قوس','جدی','دلو','حوت');
|
527 |
$array[$type]=$key[$num-1];
|
528 |
break;
|
529 |
-
|
530 |
case'ff':
|
531 |
$key=array('بهار','تابستان','پاییز','زمستان');
|
532 |
$array[$type]=$key[(int)($num/3.1)];
|
533 |
break;
|
534 |
-
|
535 |
case'km':
|
536 |
$key=array('فر','ار','خر','تی','مر','شه','مه','آب','آذ','دی','به','اس');
|
537 |
$array[$type]=$key[$num-1];
|
538 |
break;
|
539 |
-
|
540 |
case'kh':
|
541 |
$key=array('ی','د','س','چ','پ','ج','ش');
|
542 |
$array[$type]=$key[$num];
|
543 |
break;
|
544 |
-
|
545 |
default:$array[$type]=$num;
|
546 |
}
|
547 |
}
|
548 |
return($mod=='')?$array:implode($mod,$array);
|
549 |
}
|
550 |
-
|
551 |
/** Convertor from and to Gregorian and Jalali (Hijri_Shamsi,Solar) Functions
|
552 |
Copyright(C)2011, Reza Gholampanahi [ http://jdf.scr.ir/jdf ] version 2.50 */
|
553 |
-
|
554 |
/* F */
|
555 |
function GF_gregorian_to_jalali($g_y,$g_m,$g_d,$mod=''){
|
556 |
$g_y=GF_tr_num($g_y); $g_m=GF_tr_num($g_m); $g_d=GF_tr_num($g_d);/* <= :اين سطر ، جزء تابع اصلي نيست */
|
@@ -574,7 +469,6 @@ function GF_gregorian_to_jalali($g_y,$g_m,$g_d,$mod=''){
|
|
574 |
}
|
575 |
return($mod=='')?array($jy,$jm,$jd):$jy.$mod.$jm.$mod.$jd;
|
576 |
}
|
577 |
-
|
578 |
/* F */
|
579 |
function GF_jalali_to_gregorian($j_y,$j_m,$j_d,$mod=''){
|
580 |
$j_y=GF_tr_num($j_y); $j_m=GF_tr_num($j_m); $j_d=GF_tr_num($j_d);/* <= :اين سطر ، جزء تابع اصلي نيست */
|
@@ -595,5 +489,5 @@ function GF_jalali_to_gregorian($j_y,$j_m,$j_d,$mod=''){
|
|
595 |
}
|
596 |
return($mod=='')?array($gy,$gm,$gd):$gy.$mod.$gm.$mod.$gd;
|
597 |
}
|
598 |
-
|
599 |
-
|
1 |
+
<?php
|
2 |
+
/* In The Name Of Allah */
|
3 |
/** Software Hijri_Shamsi , Solar(Jalali) Date and Time
|
4 |
Copyright(C)2011, Reza Gholampanahi , http://jdf.scr.ir
|
5 |
version 2.55 :: 1391/08/24 = 1433/12/18 = 2012/11/15 */
|
|
|
6 |
/* F */
|
7 |
function GF_jdate($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$tr_num='fa'){
|
|
|
8 |
$T_sec=0;/* <= رفع خطاي زمان سرور ، با اعداد '+' و '-' بر حسب ثانيه */
|
|
|
9 |
if($time_zone!='local')date_default_timezone_set(($time_zone=='')?'Asia/Tehran':$time_zone);
|
10 |
$ts=$T_sec+(($timestamp=='' or $timestamp=='now')?time():GF_tr_num($timestamp));
|
11 |
$date=explode('_',date('H_i_j_n_O_P_s_w_Y',$ts));
|
21 |
continue;
|
22 |
}
|
23 |
switch($sub){
|
|
|
24 |
case'E':case'R':case'x':case'X':
|
25 |
$out.='http://jdf.scr.ir';
|
26 |
break;
|
|
|
27 |
case'B':case'e':case'g':
|
28 |
case'G':case'h':case'I':
|
29 |
case'T':case'u':case'Z':
|
30 |
$out.=date($sub,$ts);
|
31 |
break;
|
|
|
32 |
case'a':
|
33 |
$out.=($date[0]<12)?'ق.ظ':'ب.ظ';
|
34 |
break;
|
|
|
35 |
case'A':
|
36 |
$out.=($date[0]<12)?'قبل از ظهر':'بعد از ظهر';
|
37 |
break;
|
|
|
38 |
case'b':
|
39 |
$out.=(int)($j_m/3.1)+1;
|
40 |
break;
|
|
|
41 |
case'c':
|
42 |
$out.=$j_y.'/'.$j_m.'/'.$j_d.' ،'.$date[0].':'.$date[1].':'.$date[6].' '.$date[5];
|
43 |
break;
|
|
|
44 |
case'C':
|
45 |
$out.=(int)(($j_y+99)/100);
|
46 |
break;
|
|
|
47 |
case'd':
|
48 |
$out.=($j_d<10)?'0'.$j_d:$j_d;
|
49 |
break;
|
|
|
50 |
case'D':
|
51 |
$out.=GF_jdate_words(array('kh'=>$date[7]),' ');
|
52 |
break;
|
|
|
53 |
case'f':
|
54 |
$out.=GF_jdate_words(array('ff'=>$j_m),' ');
|
55 |
break;
|
|
|
56 |
case'F':
|
57 |
$out.=GF_jdate_words(array('mm'=>$j_m),' ');
|
58 |
break;
|
|
|
59 |
case'H':
|
60 |
$out.=$date[0];
|
61 |
break;
|
|
|
62 |
case'i':
|
63 |
$out.=$date[1];
|
64 |
break;
|
|
|
65 |
case'j':
|
66 |
$out.=$j_d;
|
67 |
break;
|
|
|
68 |
case'J':
|
69 |
$out.=GF_jdate_words(array('rr'=>$j_d),' ');
|
70 |
break;
|
|
|
71 |
case'k';
|
72 |
$out.=GF_tr_num(100-(int)($doy/($kab+365)*1000)/10,$tr_num);
|
73 |
break;
|
|
|
74 |
case'K':
|
75 |
$out.=GF_tr_num((int)($doy/($kab+365)*1000)/10,$tr_num);
|
76 |
break;
|
|
|
77 |
case'l':
|
78 |
$out.=GF_jdate_words(array('rh'=>$date[7]),' ');
|
79 |
break;
|
|
|
80 |
case'L':
|
81 |
$out.=$kab;
|
82 |
break;
|
|
|
83 |
case'm':
|
84 |
$out.=($j_m>9)?$j_m:'0'.$j_m;
|
85 |
break;
|
|
|
86 |
case'M':
|
87 |
$out.=GF_jdate_words(array('km'=>$j_m),' ');
|
88 |
break;
|
|
|
89 |
case'n':
|
90 |
$out.=$j_m;
|
91 |
break;
|
|
|
92 |
case'N':
|
93 |
$out.=$date[7]+1;
|
94 |
break;
|
|
|
95 |
case'o':
|
96 |
$jdw=($date[7]==6)?0:$date[7]+1;
|
97 |
$dny=364+$kab-$doy;
|
98 |
$out.=($jdw>($doy+3) and $doy<3)?$j_y-1:(((3-$dny)>$jdw and $dny<3)?$j_y+1:$j_y);
|
99 |
break;
|
|
|
100 |
case'O':
|
101 |
$out.=$date[4];
|
102 |
break;
|
|
|
103 |
case'p':
|
104 |
$out.=GF_jdate_words(array('mb'=>$j_m),' ');
|
105 |
break;
|
|
|
106 |
case'P':
|
107 |
$out.=$date[5];
|
108 |
break;
|
|
|
109 |
case'q':
|
110 |
$out.=GF_jdate_words(array('sh'=>$j_y),' ');
|
111 |
break;
|
|
|
112 |
case'Q':
|
113 |
$out.=$kab+364-$doy;
|
114 |
break;
|
|
|
115 |
case'r':
|
116 |
$key=GF_jdate_words(array('rh'=>$date[7],'mm'=>$j_m));
|
117 |
$out.=$date[0].':'.$date[1].':'.$date[6].' '.$date[4]
|
118 |
.' '.$key['rh'].'، '.$j_d.' '.$key['mm'].' '.$j_y;
|
119 |
break;
|
|
|
120 |
case's':
|
121 |
$out.=$date[6];
|
122 |
break;
|
|
|
123 |
case'S':
|
124 |
$out.='ام';
|
125 |
break;
|
|
|
126 |
case't':
|
127 |
$out.=($j_m!=12)?(31-(int)($j_m/6.5)):($kab+29);
|
128 |
break;
|
|
|
129 |
case'U':
|
130 |
$out.=$ts;
|
131 |
break;
|
|
|
132 |
case'v':
|
133 |
$out.=GF_jdate_words(array('ss'=>substr($j_y,2,2)),' ');
|
134 |
break;
|
|
|
135 |
case'V':
|
136 |
$out.=GF_jdate_words(array('ss'=>$j_y),' ');
|
137 |
break;
|
|
|
138 |
case'w':
|
139 |
$out.=($date[7]==6)?0:$date[7]+1;
|
140 |
break;
|
|
|
141 |
case'W':
|
142 |
$avs=(($date[7]==6)?0:$date[7]+1)-($doy%7);
|
143 |
if($avs<0)$avs+=7;
|
151 |
if($aks==7)$aks=0;
|
152 |
$out.=(($kab+363-$doy)<$aks and $aks<3)?'01':(($num<10)?'0'.$num:$num);
|
153 |
break;
|
|
|
154 |
case'y':
|
155 |
$out.=substr($j_y,2,2);
|
156 |
break;
|
|
|
157 |
case'Y':
|
158 |
$out.=$j_y;
|
159 |
break;
|
|
|
160 |
case'z':
|
161 |
$out.=$doy;
|
162 |
break;
|
|
|
163 |
default:$out.=$sub;
|
164 |
}
|
165 |
}
|
166 |
return($tr_num!='en')?GF_tr_num($out,'fa','.'):$out;
|
167 |
}
|
|
|
168 |
/* F */
|
169 |
function GF_jstrftime($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$tr_num='fa'){
|
|
|
170 |
$T_sec=0;/* <= رفع خطاي زمان سرور ، با اعداد '+' و '-' بر حسب ثانيه */
|
|
|
171 |
if($time_zone!='local')date_default_timezone_set(($time_zone=='')?'Asia/Tehran':$time_zone);
|
172 |
$ts=$T_sec+(($timestamp=='' or $timestamp=='now')?time():GF_tr_num($timestamp));
|
173 |
$date=explode('_',date('h_H_i_j_n_s_w_Y',$ts));
|
185 |
continue;
|
186 |
}
|
187 |
switch($sub){
|
|
|
188 |
/* Day */
|
189 |
case'a':
|
190 |
$out.=GF_jdate_words(array('kh'=>$date[6]),' ');
|
191 |
break;
|
|
|
192 |
case'A':
|
193 |
$out.=GF_jdate_words(array('rh'=>$date[6]),' ');
|
194 |
break;
|
|
|
195 |
case'd':
|
196 |
$out.=($j_d<10)?'0'.$j_d:$j_d;
|
197 |
break;
|
|
|
198 |
case'e':
|
199 |
$out.=($j_d<10)?' '.$j_d:$j_d;
|
200 |
break;
|
|
|
201 |
case'j':
|
202 |
$out.=str_pad($doy+1,3,0,STR_PAD_LEFT);
|
203 |
break;
|
|
|
204 |
case'u':
|
205 |
$out.=$date[6]+1;
|
206 |
break;
|
|
|
207 |
case'w':
|
208 |
$out.=($date[6]==6)?0:$date[6]+1;
|
209 |
break;
|
|
|
210 |
/* Week */
|
211 |
case'U':
|
212 |
$avs=(($date[6]<5)?$date[6]+2:$date[6]-5)-($doy%7);
|
215 |
if($avs>3 or $avs==1)$num--;
|
216 |
$out.=($num<10)?'0'.$num:$num;
|
217 |
break;
|
|
|
218 |
case'V':
|
219 |
$avs=(($date[6]==6)?0:$date[6]+1)-($doy%7);
|
220 |
if($avs<0)$avs+=7;
|
228 |
if($aks==7)$aks=0;
|
229 |
$out.=(($kab+363-$doy)<$aks and $aks<3)?'01':(($num<10)?'0'.$num:$num);
|
230 |
break;
|
|
|
231 |
case'W':
|
232 |
$avs=(($date[6]==6)?0:$date[6]+1)-($doy%7);
|
233 |
if($avs<0)$avs+=7;
|
235 |
if($avs>3)$num--;
|
236 |
$out.=($num<10)?'0'.$num:$num;
|
237 |
break;
|
|
|
238 |
/* Month */
|
239 |
case'b':
|
240 |
case'h':
|
241 |
$out.=GF_jdate_words(array('km'=>$j_m),' ');
|
242 |
break;
|
|
|
243 |
case'B':
|
244 |
$out.=GF_jdate_words(array('mm'=>$j_m),' ');
|
245 |
break;
|
|
|
246 |
case'm':
|
247 |
$out.=($j_m>9)?$j_m:'0'.$j_m;
|
248 |
break;
|
|
|
249 |
/* Year */
|
250 |
case'C':
|
251 |
$out.=substr($j_y,0,2);
|
252 |
break;
|
|
|
253 |
case'g':
|
254 |
$jdw=($date[6]==6)?0:$date[6]+1;
|
255 |
$dny=364+$kab-$doy;
|
256 |
$out.=substr(($jdw>($doy+3) and $doy<3)?$j_y-1:(((3-$dny)>$jdw and $dny<3)?$j_y+1:$j_y),2,2);
|
257 |
break;
|
|
|
258 |
case'G':
|
259 |
$jdw=($date[6]==6)?0:$date[6]+1;
|
260 |
$dny=364+$kab-$doy;
|
261 |
$out.=($jdw>($doy+3) and $doy<3)?$j_y-1:(((3-$dny)>$jdw and $dny<3)?$j_y+1:$j_y);
|
262 |
break;
|
|
|
263 |
case'y':
|
264 |
$out.=substr($j_y,2,2);
|
265 |
break;
|
|
|
266 |
case'Y':
|
267 |
$out.=$j_y;
|
268 |
break;
|
|
|
269 |
/* Time */
|
270 |
case'H':
|
271 |
$out.=$date[1];
|
272 |
break;
|
|
|
273 |
case'I':
|
274 |
$out.=$date[0];
|
275 |
break;
|
|
|
276 |
case'l':
|
277 |
$out.=($date[0]>9)?$date[0]:' '.(int)$date[0];
|
278 |
break;
|
|
|
279 |
case'M':
|
280 |
$out.=$date[2];
|
281 |
break;
|
|
|
282 |
case'p':
|
283 |
$out.=($date[1]<12)?'قبل از ظهر':'بعد از ظهر';
|
284 |
break;
|
|
|
285 |
case'P':
|
286 |
$out.=($date[1]<12)?'ق.ظ':'ب.ظ';
|
287 |
break;
|
|
|
288 |
case'r':
|
289 |
$out.=$date[0].':'.$date[2].':'.$date[5].' '.(($date[1]<12)?'قبل از ظهر':'بعد از ظهر');
|
290 |
break;
|
|
|
291 |
case'R':
|
292 |
$out.=$date[1].':'.$date[2];
|
293 |
break;
|
|
|
294 |
case'S':
|
295 |
$out.=$date[5];
|
296 |
break;
|
|
|
297 |
case'T':
|
298 |
$out.=$date[1].':'.$date[2].':'.$date[5];
|
299 |
break;
|
|
|
300 |
case'X':
|
301 |
$out.=$date[0].':'.$date[2].':'.$date[5];
|
302 |
break;
|
|
|
303 |
case'z':
|
304 |
$out.=date('O',$ts);
|
305 |
break;
|
|
|
306 |
case'Z':
|
307 |
$out.=date('T',$ts);
|
308 |
break;
|
|
|
309 |
/* Time and Date Stamps */
|
310 |
case'c':
|
311 |
$key=GF_jdate_words(array('rh'=>$date[6],'mm'=>$j_m));
|
312 |
$out.=$date[1].':'.$date[2].':'.$date[5].' '.date('P',$ts)
|
313 |
.' '.$key['rh'].'، '.$j_d.' '.$key['mm'].' '.$j_y;
|
314 |
break;
|
|
|
315 |
case'D':
|
316 |
$out.=substr($j_y,2,2).'/'.(($j_m>9)?$j_m:'0'.$j_m).'/'.(($j_d<10)?'0'.$j_d:$j_d);
|
317 |
break;
|
|
|
318 |
case'F':
|
319 |
$out.=$j_y.'-'.(($j_m>9)?$j_m:'0'.$j_m).'-'.(($j_d<10)?'0'.$j_d:$j_d);
|
320 |
break;
|
|
|
321 |
case's':
|
322 |
$out.=$ts;
|
323 |
break;
|
|
|
324 |
case'x':
|
325 |
$out.=substr($j_y,2,2).'/'.(($j_m>9)?$j_m:'0'.$j_m).'/'.(($j_d<10)?'0'.$j_d:$j_d);
|
326 |
break;
|
|
|
327 |
/* Miscellaneous */
|
328 |
case'n':
|
329 |
$out.="\n";
|
330 |
break;
|
|
|
331 |
case't':
|
332 |
$out.="\t";
|
333 |
break;
|
|
|
334 |
case'%':
|
335 |
$out.='%';
|
336 |
break;
|
|
|
337 |
default:$out.=$sub;
|
338 |
}
|
339 |
}
|
340 |
return($tr_num!='en')?GF_tr_num($out,'fa','.'):$out;
|
341 |
}
|
|
|
342 |
/* F */
|
343 |
function GF_jmktime($h='',$m='',$s='',$jm='',$jd='',$jy='',$is_dst=-1){
|
344 |
$h=GF_tr_num($h); $m=GF_tr_num($m); $s=GF_tr_num($s); $jm=GF_tr_num($jm); $jd=GF_tr_num($jd); $jy=GF_tr_num($jy);
|
349 |
return mktime($h,$m,$s,$month,$day,$year,$is_dst);
|
350 |
}
|
351 |
}
|
|
|
352 |
/* F */
|
353 |
function GF_jgetdate($timestamp='',$none='',$tz='Asia/Tehran',$tn='en'){
|
354 |
$ts=($timestamp=='')?time():GF_tr_num($timestamp);
|
367 |
0=>GF_tr_num($ts,$tn)
|
368 |
);
|
369 |
}
|
|
|
370 |
/* F */
|
371 |
function GF_jcheckdate($jm,$jd,$jy){
|
372 |
$jm=GF_tr_num($jm); $jd=GF_tr_num($jd); $jy=GF_tr_num($jy);
|
373 |
$l_d=($jm==12)?(($jy%33%4-1==(int)($jy%33*.05))?30:29):31-(int)($jm/6.5);
|
374 |
return($jm>0 and $jd>0 and $jy>0 and $jm<13 and $jd<=$l_d)?true:false;
|
375 |
}
|
|
|
376 |
/* F */
|
377 |
function GF_tr_num($str,$mod='en',$mf='٫'){
|
378 |
$num_a=array('0','1','2','3','4','5','6','7','8','9','.');
|
379 |
$key_a=array('۰','۱','۲','۳','۴','۵','۶','۷','۸','۹',$mf);
|
380 |
return($mod=='fa')?str_replace($num_a,$key_a,$str):str_replace($key_a,$num_a,$str);
|
381 |
}
|
|
|
382 |
/* F */
|
383 |
function GF_jdate_words($array,$mod=''){
|
384 |
foreach($array as $type=>$num){
|
385 |
$num=(int)GF_tr_num($num);
|
386 |
switch($type){
|
|
|
387 |
case'ss':
|
388 |
$sl=strlen($num);
|
389 |
$xy3=substr($num,2-$sl,1);
|
404 |
,array('هزار و دویست','هزار و سیصد','هزار و چهارصد','هزار و نهصد','دوهزار')
|
405 |
,substr($num,0,2)).((substr($num,2,2)=='00')?'':' و '):'').$h3.$p34.$h34.$h4;
|
406 |
break;
|
|
|
407 |
case'mm':
|
408 |
$key=array
|
409 |
('فروردین','اردیبهشت','خرداد','تیر','مرداد','شهریور','مهر','آبان','آذر','دی','بهمن','اسفند');
|
410 |
$array[$type]=$key[$num-1];
|
411 |
break;
|
|
|
412 |
case'rr':
|
413 |
$key=array('یک','دو','سه','چهار','پنج','شش','هفت','هشت','نه','ده','یازده','دوازده','سیزده',
|
414 |
'چهارده','پانزده','شانزده','هفده','هجده','نوزده','بیست','بیست و یک','بیست و دو','بیست و سه',
|
415 |
'بیست و چهار','بیست و پنج','بیست و شش','بیست و هفت','بیست و هشت','بیست و نه','سی','سی و یک');
|
416 |
$array[$type]=$key[$num-1];
|
417 |
break;
|
|
|
418 |
case'rh':
|
419 |
$key=array('یکشنبه','دوشنبه','سه شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه');
|
420 |
$array[$type]=$key[$num];
|
421 |
break;
|
|
|
422 |
case'sh':
|
423 |
$key=array('مار','اسب','گوسفند','میمون','مرغ','سگ','خوک','موش','گاو','پلنگ','خرگوش','نهنگ');
|
424 |
$array[$type]=$key[$num%12];
|
425 |
break;
|
|
|
426 |
case'mb':
|
427 |
$key=array('حمل','ثور','جوزا','سرطان','اسد','سنبله','میزان','عقرب','قوس','جدی','دلو','حوت');
|
428 |
$array[$type]=$key[$num-1];
|
429 |
break;
|
|
|
430 |
case'ff':
|
431 |
$key=array('بهار','تابستان','پاییز','زمستان');
|
432 |
$array[$type]=$key[(int)($num/3.1)];
|
433 |
break;
|
|
|
434 |
case'km':
|
435 |
$key=array('فر','ار','خر','تی','مر','شه','مه','آب','آذ','دی','به','اس');
|
436 |
$array[$type]=$key[$num-1];
|
437 |
break;
|
|
|
438 |
case'kh':
|
439 |
$key=array('ی','د','س','چ','پ','ج','ش');
|
440 |
$array[$type]=$key[$num];
|
441 |
break;
|
|
|
442 |
default:$array[$type]=$num;
|
443 |
}
|
444 |
}
|
445 |
return($mod=='')?$array:implode($mod,$array);
|
446 |
}
|
|
|
447 |
/** Convertor from and to Gregorian and Jalali (Hijri_Shamsi,Solar) Functions
|
448 |
Copyright(C)2011, Reza Gholampanahi [ http://jdf.scr.ir/jdf ] version 2.50 */
|
|
|
449 |
/* F */
|
450 |
function GF_gregorian_to_jalali($g_y,$g_m,$g_d,$mod=''){
|
451 |
$g_y=GF_tr_num($g_y); $g_m=GF_tr_num($g_m); $g_d=GF_tr_num($g_d);/* <= :اين سطر ، جزء تابع اصلي نيست */
|
469 |
}
|
470 |
return($mod=='')?array($jy,$jm,$jd):$jy.$mod.$jm.$mod.$jd;
|
471 |
}
|
|
|
472 |
/* F */
|
473 |
function GF_jalali_to_gregorian($j_y,$j_m,$j_d,$mod=''){
|
474 |
$j_y=GF_tr_num($j_y); $j_m=GF_tr_num($j_m); $j_d=GF_tr_num($j_d);/* <= :اين سطر ، جزء تابع اصلي نيست */
|
489 |
}
|
490 |
return($mod=='')?array($gy,$gm,$gd):$gy.$mod.$gm.$mod.$gd;
|
491 |
}
|
492 |
+
/* [ jdf.php ] version 2.55 ?> Download new version from [ http://jdf.scr.ir ] */
|
493 |
+
?>
|
include/Post_Content_Merge_Tags.php
CHANGED
@@ -1,20 +1,4 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* Persian Gravity Forms // Gravity Forms Post Content Merge Tags
|
4 |
-
*
|
5 |
-
* Adds support for using Gravity Form merge tags in your post content. This functionality requires that the entry ID is
|
6 |
-
* is passed to the post via the "id" parameter.
|
7 |
-
*
|
8 |
-
* Setup your confirmation page (requires GFv1.8) or confirmation URL "Redirect Query String" setting to
|
9 |
-
* include this parameter: 'id={entry_id}'. You can then use any entry-based merge tag in your post content.
|
10 |
-
*
|
11 |
-
* @version 1.2
|
12 |
-
* @author HANNAN Std <david@gravitywiz.com>
|
13 |
-
* @license GPL-2.0+
|
14 |
-
* @link http://gravityforms.ir
|
15 |
-
* @video http://gravityforms.ir
|
16 |
-
* @copyright 2014 Persian Gravity Forms
|
17 |
-
*/
|
18 |
class PersianGravityForms_Post_Content_Merge_Tags {
|
19 |
public static $_entry = null;
|
20 |
private static $instance = null;
|
@@ -88,7 +72,6 @@ class PersianGravityForms_Post_Content_Merge_Tags {
|
|
88 |
if( strpos( $text, '{encrypted_entry_id}' ) === false ) {
|
89 |
return $text;
|
90 |
}
|
91 |
-
// $entry is not always a "full" entry
|
92 |
$entry_id = rgar( $entry, 'id' );
|
93 |
if( $entry_id ) {
|
94 |
$entry_id = $this->prepare_id( $entry['id'], true );
|
@@ -111,7 +94,6 @@ class PersianGravityForms_Post_Content_Merge_Tags {
|
|
111 |
$redirect_url = add_query_arg( array( 'id' => $id ), $confirmation['redirect'] );
|
112 |
$confirmation['redirect'] = $redirect_url;
|
113 |
}
|
114 |
-
|
115 |
return $confirmation;
|
116 |
}
|
117 |
function prepare_id( $entry_id, $force_encrypt = false ) {
|
@@ -168,4 +150,5 @@ class PersianGravityForms_Post_Content_Merge_Tags {
|
|
168 |
function persiangravityforms_post_content_merge_tags( $args = array() ) {
|
169 |
return PersianGravityForms_Post_Content_Merge_Tags::get_instance( $args );
|
170 |
}
|
171 |
-
persiangravityforms_post_content_merge_tags();
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
class PersianGravityForms_Post_Content_Merge_Tags {
|
3 |
public static $_entry = null;
|
4 |
private static $instance = null;
|
72 |
if( strpos( $text, '{encrypted_entry_id}' ) === false ) {
|
73 |
return $text;
|
74 |
}
|
|
|
75 |
$entry_id = rgar( $entry, 'id' );
|
76 |
if( $entry_id ) {
|
77 |
$entry_id = $this->prepare_id( $entry['id'], true );
|
94 |
$redirect_url = add_query_arg( array( 'id' => $id ), $confirmation['redirect'] );
|
95 |
$confirmation['redirect'] = $redirect_url;
|
96 |
}
|
|
|
97 |
return $confirmation;
|
98 |
}
|
99 |
function prepare_id( $entry_id, $force_encrypt = false ) {
|
150 |
function persiangravityforms_post_content_merge_tags( $args = array() ) {
|
151 |
return PersianGravityForms_Post_Content_Merge_Tags::get_instance( $args );
|
152 |
}
|
153 |
+
persiangravityforms_post_content_merge_tags();
|
154 |
+
?>
|
include/wp-session.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
<?php
|
|
|
2 |
define( 'WP_SESSION_COOKIE', '_wp_session' );
|
3 |
if ( !class_exists( 'Recursive_ArrayAccess' ) ) {
|
4 |
class Recursive_ArrayAccess implements ArrayAccess {
|
@@ -226,4 +227,5 @@ wp_schedule_event( time(), 'hourly', 'wp_session_garbage_collection' );
|
|
226 |
}
|
227 |
}
|
228 |
add_action( 'wp', 'wp_session_register_garbage_collection' );
|
229 |
-
}
|
|
1 |
+
<?php
|
2 |
+
if( !defined( 'WP_SESSION_COOKIE' ) )
|
3 |
define( 'WP_SESSION_COOKIE', '_wp_session' );
|
4 |
if ( !class_exists( 'Recursive_ArrayAccess' ) ) {
|
5 |
class Recursive_ArrayAccess implements ArrayAccess {
|
227 |
}
|
228 |
}
|
229 |
add_action( 'wp', 'wp_session_register_garbage_collection' );
|
230 |
+
}
|
231 |
+
?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: gravityforms,gravity forms,persian gravity forms,persian gravityforms,grav
|
|
4 |
Donate link: http://www.gravityforms.ir
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 1.3.
|
8 |
License: GPL 2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
This WordPress plugin extends the Gravity Forms plugin and its addons with the Persian language .
|
@@ -83,6 +83,8 @@ You can read complete documentations on the [GravityForms.ir](http://www.Gravity
|
|
83 |
19. Iranian National Code field Advanced setting
|
84 |
|
85 |
== Changelog ==
|
|
|
|
|
86 |
= 1.3.1 =
|
87 |
* Fixed : Jquery Ui Jalali DatePicker
|
88 |
* Added Jalali Months to predefined choices
|
@@ -118,6 +120,8 @@ You can read complete documentations on the [GravityForms.ir](http://www.Gravity
|
|
118 |
* First version
|
119 |
|
120 |
== Upgrade Notice ==
|
|
|
|
|
121 |
= 1.3.1 =
|
122 |
* Fixed : Jquery Ui Jalali DatePicker
|
123 |
* Added Jalali Months to predefined choices
|
4 |
Donate link: http://www.gravityforms.ir
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 1.3.2
|
8 |
License: GPL 2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
This WordPress plugin extends the Gravity Forms plugin and its addons with the Persian language .
|
83 |
19. Iranian National Code field Advanced setting
|
84 |
|
85 |
== Changelog ==
|
86 |
+
= 1.3.2 =
|
87 |
+
* Fixed : Some Minor bugs
|
88 |
= 1.3.1 =
|
89 |
* Fixed : Jquery Ui Jalali DatePicker
|
90 |
* Added Jalali Months to predefined choices
|
120 |
* First version
|
121 |
|
122 |
== Upgrade Notice ==
|
123 |
+
= 1.3.2 =
|
124 |
+
* Fixed : Some Minor bugs
|
125 |
= 1.3.1 =
|
126 |
* Fixed : Jquery Ui Jalali DatePicker
|
127 |
* Added Jalali Months to predefined choices
|