گرویتی فرم فارسی - Version 1.5.0

Version Description

  • Added Live Preview Button
  • Update : Coupons addons translation
Download this release

Release Info

Developer hannanstd
Plugin Icon 128x128 گرویتی فرم فارسی
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4.6 to 1.5.0

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.4.6
7
  Requires at least: 3.5
8
  Author: HANNAN Ebrahimi Setoode
9
  Author URI: http://www.gravityforms.ir/
@@ -12,6 +12,9 @@ Domain Path: /languages/
12
  License: GPL 2
13
  */
14
  require_once("include/wp-session.php");
 
 
 
15
  class GravityFormsPersian {
16
  private $file;
17
  private $language;
@@ -600,7 +603,11 @@ class GravityFormsPersian {
600
  return;
601
  $current_page = trim(strtolower(RGForms::get("page")));
602
  $page_prefix = explode("_", $current_page);
603
- if (is_rtl() && ($page_prefix[0]=="gf" || RGForms::is_gravity_page() ||
 
 
 
 
604
  $_SERVER['REQUEST_URI'] == '/wp-admin/' || $_SERVER['REQUEST_URI'] == '/wp-admin' ||
605
  $_SERVER['REQUEST_URI'] == '/wp-admin/index.php' || $_SERVER['REQUEST_URI'] == '/wp-admin/index.php/'))
606
  {
@@ -765,7 +772,7 @@ class GravityFormsPersian {
765
  return plugins_url( '', __FILE__ );
766
  }
767
  public function version(){
768
- return '1.4.6';
769
  }
770
  public function Add_HANNANStd_Field_By_HANNANStd( $field_groups ) {
771
  foreach( $field_groups as &$group ){
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.5.0
7
  Requires at least: 3.5
8
  Author: HANNAN Ebrahimi Setoode
9
  Author URI: http://www.gravityforms.ir/
12
  License: GPL 2
13
  */
14
  require_once("include/wp-session.php");
15
+ require_once("include/Live_Preview.php");
16
+ if(class_exists("GIRLivePreview"))
17
+ new GIRLivePreview();
18
  class GravityFormsPersian {
19
  private $file;
20
  private $language;
603
  return;
604
  $current_page = trim(strtolower(RGForms::get("page")));
605
  $page_prefix = explode("_", $current_page);
606
+ if ( isset($_GET['page']) )
607
+ $is_gravityforms_page = (substr($_GET['page'],0,12) == 'gravityforms') ? 1 : 0;
608
+ else
609
+ $is_gravityforms_page = 0;
610
+ if (is_rtl() && ($page_prefix[0]=="gf" || RGForms::is_gravity_page() || $is_gravityforms_page == 1 ||
611
  $_SERVER['REQUEST_URI'] == '/wp-admin/' || $_SERVER['REQUEST_URI'] == '/wp-admin' ||
612
  $_SERVER['REQUEST_URI'] == '/wp-admin/index.php' || $_SERVER['REQUEST_URI'] == '/wp-admin/index.php/'))
613
  {
772
  return plugins_url( '', __FILE__ );
773
  }
774
  public function version(){
775
+ return '1.5.0';
776
  }
777
  public function Add_HANNANStd_Field_By_HANNANStd( $field_groups ) {
778
  foreach( $field_groups as &$group ){
include/Live_Preview.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class GIRLivePreview {
3
+ var $post_type = 'gf_live_preview';
4
+ function __construct( $args = array() ) {
5
+ if( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8', '>=' ) )
6
+ return;
7
+ $this->_args = wp_parse_args( $args, array(
8
+ 'id' => 0,
9
+ 'title' => true,
10
+ 'description' => true,
11
+ 'ajax' => false
12
+ ) );
13
+ add_action( 'init', array( $this, 'register_preview_post_type' ) );
14
+ add_action( 'wp', array( $this, 'maybe_load_preview_functionality' ) );
15
+ add_action( 'admin_footer', array( $this, 'display_preview_link' ) );
16
+ }
17
+ function register_preview_post_type() {
18
+ $args = array(
19
+ 'label' => __( 'پیشنمایش فرم' , 'Persian_Gravityforms_By_HANNANStd'),
20
+ 'description' => __( 'اضافه کردن پیشنمایش فرم در فرانت اند سایت' , 'Persian_Gravityforms_By_HANNANStd'),
21
+ 'public' => false,
22
+ 'publicly_queryable' => true,
23
+ 'has_archive' => true,
24
+ 'can_export' => false,
25
+ 'supports' => false
26
+ );
27
+ register_post_type( $this->post_type, $args );
28
+ $preview_post = get_posts( array( 'post_type' => $this->post_type ) );
29
+ if( empty( $preview_post ) ) {
30
+ $post_id = wp_insert_post( array(
31
+ 'post_type' => $this->post_type,
32
+ 'post_title' => __( 'پیشنمایش فرم' ),
33
+ 'post_status' => 'publish'
34
+ ) );
35
+ }
36
+ }
37
+ function maybe_load_preview_functionality() {
38
+ global $wp_query;
39
+ if( ! $this->is_live_preview() )
40
+ return;
41
+ $this->live_preview_hooks();
42
+ foreach( $wp_query->posts as &$post ) {
43
+ $post->post_content = $this->get_shortcode();
44
+ }
45
+ }
46
+ function live_preview_hooks() {
47
+ add_filter( 'template_include', array( $this, 'load_preview_template' ) );
48
+ add_filter( 'the_content', array( $this, 'modify_preview_post_content' ) );
49
+ }
50
+ function display_preview_link() {
51
+ if( ! $this->is_applicable_page() )
52
+ return;
53
+ $form_id = rgget( 'id' );
54
+ $url = get_bloginfo("wpurl") . '/?post_type=gf_live_preview&id=' . $form_id;
55
+ ?>
56
+ <script type="text/javascript">
57
+ (function($){
58
+ $( '<li class="gf_form_toolbar_preview"><a style="position:relative" id="gf-live-preview" href="<?php echo $url; ?>" target="_blank">' +
59
+ '<i class="fa fa-eye" style="position: absolute; text-shadow: 0px 0px 5px rgb(255, 255, 255); z-index: 99; line-height: 7px; left: 0px font-size: 9px; top: 6px; background-color: rgb(243, 243, 243);"></i>' +
60
+ '<i class="fa fa-file-o" style="margin-left: 5px; line-height: 12px; font-size: 18px; position: relative; top: 2px;"></i>' +
61
+ '<?php _e( 'Live Preview' ); ?>' +
62
+ '</a></li>' )
63
+ .insertAfter( 'li.gf_form_toolbar_preview' );
64
+ })(jQuery);
65
+ </script>
66
+ <?php
67
+ }
68
+ function is_applicable_page() {
69
+ return in_array( rgget( 'page' ), array( 'gf_edit_forms', 'gf_entries' ) ) && rgget( 'id' );
70
+ }
71
+ function load_preview_template( $template ) {
72
+ return get_page_template();
73
+ }
74
+ function modify_preview_post_content( $content ) {
75
+ return $this->get_shortcode();
76
+ }
77
+ function get_shortcode( $args = array() ) {
78
+ if( !is_user_logged_in() )
79
+ return '<p>' . __( 'برای مشاهده پیشنمایش فرم باید در سایت وارد شوید .' , 'Persian_Gravityforms_By_HANNANStd' ) . '</p>' . wp_login_form( array( 'echo' => false ) );
80
+ if( !GFCommon::current_user_can_any( 'gravityforms_preview_forms' ) )
81
+ return __( 'متاسفانه شما سطح دسترسی لازم برای مشاهده پیشنمایش فرم را ندارید .' , 'Persian_Gravityforms_By_HANNANStd' );
82
+ if( empty( $args ) )
83
+ $args = $this->get_shortcode_parameters_from_query_string();
84
+ extract( wp_parse_args( $args, $this->_args ) );
85
+ $title = $title === true ? 'true' : 'false';
86
+ $description = $description === true ? 'true' : 'false';
87
+ $ajax = $ajax === true ? 'true' : 'false';
88
+ return "[gravityform id='$id' title='$title' description='$description' ajax='$ajax']";
89
+ }
90
+ function get_shortcode_parameters_from_query_string() {
91
+ return array_filter( array(
92
+ 'id' => rgget( 'id' ),
93
+ 'title' => rgget( 'title' ),
94
+ 'description' => rgget( 'description' ),
95
+ 'ajax' => rgget( 'ajax' )
96
+ ) );
97
+ }
98
+ function is_live_preview() {
99
+ return is_post_type_archive( $this->post_type );
100
+ }
101
+ }
include/Post_Content_Merge_Tags.php CHANGED
@@ -11,7 +11,7 @@ class PersianGravityForms_Post_Content_Merge_Tags {
11
  if( ! class_exists( 'GFForms' ) )
12
  return;
13
  $this->_args = wp_parse_args( $args, array(
14
- 'auto_append_id' => true, // true, false or array of form IDs
15
  'encrypt_id' => false,
16
  ) );
17
  add_filter( 'the_content', array( $this, 'replace_merge_tags' ), 1 );
@@ -148,7 +148,7 @@ class PersianGravityForms_Post_Content_Merge_Tags {
148
  }
149
  }
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
  ?>
11
  if( ! class_exists( 'GFForms' ) )
12
  return;
13
  $this->_args = wp_parse_args( $args, array(
14
+ 'auto_append_id' => true,
15
  'encrypt_id' => false,
16
  ) );
17
  add_filter( 'the_content', array( $this, 'replace_merge_tags' ), 1 );
148
  }
149
  }
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
  ?>
languages/gravityformscoupons/fa_IR.mo CHANGED
Binary file
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: hannanstd
3
  Tags: gravityforms,gravity forms,persian gravity forms,persian gravityforms,gravityforms farsi,gravity forms farsi,rtl,fa_ir,iranian,iranian rials,iranian toman,iran state,gravityforms.ir,gravity forms payment,gravity forms gateway,gravity forms iran gateways
4
  Donate link: http://www.gravityforms.ir
5
  Requires at least: 3.5
6
- Tested up to: 4.1.1
7
- Stable tag: 1.4.6
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,11 @@ 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.4.6 =
87
  * Fixed : Conditional logic translation
88
  = 1.4.5 =
@@ -138,6 +143,11 @@ You can read complete documentations on the [GravityForms.ir](http://www.Gravity
138
  * First version
139
 
140
  == Upgrade Notice ==
 
 
 
 
 
141
  = 1.4.6 =
142
  * Fixed : Conditional logic translation
143
  = 1.4.5 =
3
  Tags: gravityforms,gravity forms,persian gravity forms,persian gravityforms,gravityforms farsi,gravity forms farsi,rtl,fa_ir,iranian,iranian rials,iranian toman,iran state,gravityforms.ir,gravity forms payment,gravity forms gateway,gravity forms iran gateways
4
  Donate link: http://www.gravityforms.ir
5
  Requires at least: 3.5
6
+ Tested up to: 4.2
7
+ Stable tag: 1.5.0
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.5.0 =
87
+ * Added Live Preview Button
88
+ * Update : Coupons addons translation
89
+ = 1.4.7 =
90
+ * Fixed : Some Minor bugs
91
  = 1.4.6 =
92
  * Fixed : Conditional logic translation
93
  = 1.4.5 =
143
  * First version
144
 
145
  == Upgrade Notice ==
146
+ = 1.5.0 =
147
+ * Added Live Preview Button
148
+ * Update : Coupons addons translation
149
+ = 1.4.7 =
150
+ * Fixed : Some Minor bugs
151
  = 1.4.6 =
152
  * Fixed : Conditional logic translation
153
  = 1.4.5 =