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

Version Description

  • Fixed : Cannot modify header information...
Download this release

Release Info

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

Code changes from version 1.1.3 to 1.1.4

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.1.3
7
  Requires at least: 3.5
8
  Author: HANNAN Ebrahimi Setoode
9
  Author URI: http://www.gravityforms.ir/
@@ -11,6 +11,7 @@ Text Domain: Persian_Gravityforms_By_HANNANStd
11
  Domain Path: /languages/
12
  License: GPL 2
13
  */
 
14
  class GravityFormsPersian {
15
  private $file;
16
  private $language;
@@ -63,7 +64,6 @@ class GravityFormsPersian {
63
  }
64
  }
65
  public function init(){
66
- require_once("include/wp-session.php");
67
  require_once("include/Jalali.php");
68
  require_once("include/Post_Content_Merge_Tags.php");
69
  $rel_path = dirname( plugin_basename( $this->file ) ) . '/languages/';
@@ -599,7 +599,7 @@ public static function get_base_url(){
599
  return plugins_url( '', __FILE__ );
600
  }
601
  public function version(){
602
- return '1.1.3';
603
  }
604
  public function Add_Melli_Cart_Field_By_HANNANStd( $field_groups ) {
605
  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.1.4
7
  Requires at least: 3.5
8
  Author: HANNAN Ebrahimi Setoode
9
  Author URI: http://www.gravityforms.ir/
11
  Domain Path: /languages/
12
  License: GPL 2
13
  */
14
+ require_once("include/wp-session.php");
15
  class GravityFormsPersian {
16
  private $file;
17
  private $language;
64
  }
65
  }
66
  public function init(){
 
67
  require_once("include/Jalali.php");
68
  require_once("include/Post_Content_Merge_Tags.php");
69
  $rel_path = dirname( plugin_basename( $this->file ) ) . '/languages/';
599
  return plugins_url( '', __FILE__ );
600
  }
601
  public function version(){
602
+ return '1.1.4';
603
  }
604
  public function Add_Melli_Cart_Field_By_HANNANStd( $field_groups ) {
605
  foreach( $field_groups as &$group ){
include/wp-session.php CHANGED
@@ -1,237 +1,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 {
6
- protected $container = array();
7
- protected $dirty = false;
8
- protected function __construct( $data = array() ) {
9
- foreach ( $data as $key => $value ) {
10
- $this[ $key ] = $value;
11
- }
12
- }
13
- public function __clone() {
14
- foreach ( $this->container as $key => $value ) {
15
- if ( $value instanceof self ) {
16
- $this[ $key ] = clone $value;
17
- }
18
- }
19
- }
20
- public function toArray() {
21
- $data = $this->container;
22
- foreach ( $data as $key => $value ) {
23
- if ( $value instanceof self ) {
24
- $data[ $key ] = $value->toArray();
25
- }
26
- }
27
- return $data;
28
- }
29
- public function offsetExists( $offset ) {
30
- return isset( $this->container[ $offset ]) ;
31
- }
32
- public function offsetGet( $offset ) {
33
- return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;
34
- }
35
- public function offsetSet( $offset, $data ) {
36
- if ( is_array( $data ) ) {
37
- $data = new self( $data );
38
- }
39
- if ( $offset === null ) {
40
- $this->container[] = $data;
41
- } else {
42
- $this->container[ $offset ] = $data;
43
- }
44
- $this->dirty = true;
45
- }
46
- public function offsetUnset( $offset ) {
47
- unset( $this->container[ $offset ] );
48
- $this->dirty = true;
49
- }
50
- }
51
- }
52
- if ( ! class_exists( 'WP_Session' ) ) {
53
  final class WP_Session extends Recursive_ArrayAccess implements Iterator, Countable {
54
- protected $session_id;
55
- protected $expires;
56
- protected $exp_variant;
57
- private static $instance = false;
58
- public static function get_instance() {
59
- if ( ! self::$instance ) {
60
- self::$instance = new self();
61
- }
62
- return self::$instance;
63
- }
64
- protected function __construct() {
65
- if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) {
66
- $cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] );
67
- $cookie_crumbs = explode( '||', $cookie );
68
- $this->session_id = $cookie_crumbs[0];
69
- $this->expires = $cookie_crumbs[1];
70
- $this->exp_variant = $cookie_crumbs[2];
71
- if ( time() > $this->exp_variant ) {
72
- $this->set_expiration();
73
- delete_option( "_wp_session_expires_{$this->session_id}" );
74
- add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
75
- }
76
- } else {
77
- $this->session_id = $this->generate_id();
78
- $this->set_expiration();
79
- }
80
-
81
- $this->read_data();
82
- $this->set_cookie();
83
- }
84
- protected function set_expiration() {
85
- $this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 );
86
- $this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
87
- }
88
- protected function set_cookie() {
89
- setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN );
90
- }
91
- protected function generate_id() {
92
- require_once( ABSPATH . 'wp-includes/class-phpass.php');
93
- $hasher = new PasswordHash( 8, false );
94
- return md5( $hasher->get_random_bytes( 32 ) );
95
- }
96
- protected function read_data() {
97
- $this->container = get_option( "_wp_session_{$this->session_id}", array() );
98
- return $this->container;
99
- }
100
- public function write_data() {
101
- $option_key = "_wp_session_{$this->session_id}";
102
- if ( $this->dirty ) {
103
- if ( false === get_option( $option_key ) ) {
104
- add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
105
- add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
106
- } else {
107
- delete_option( "_wp_session_{$this->session_id}" );
108
- add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
109
- }
110
- }
111
- }
112
- public function json_out() {
113
- return json_encode( $this->container );
114
- }
115
- public function json_in( $data ) {
116
- $array = json_decode( $data );
117
- if ( is_array( $array ) ) {
118
- $this->container = $array;
119
- return true;
120
- }
121
- return false;
122
- }
123
- public function regenerate_id( $delete_old = false ) {
124
- if ( $delete_old ) {
125
- delete_option( "_wp_session_{$this->session_id}" );
126
- }
127
- $this->session_id = $this->generate_id();
128
- $this->set_cookie();
129
- }
130
- public function session_started() {
131
- return !!self::$instance;
132
- }
133
- public function cache_expiration() {
134
- return $this->expires;
135
- }
136
- public function reset() {
137
- $this->container = array();
138
- }
139
- public function current() {
140
- return current( $this->container );
141
- }
142
- public function key() {
143
- return key( $this->container );
144
- }
145
- public function next() {
146
- next( $this->container );
147
- }
148
- public function rewind() {
149
- reset( $this->container );
150
- }
151
- public function valid() {
152
- return $this->offsetExists( $this->key() );
153
- }
154
- public function count() {
155
- return count( $this->container );
156
- }
157
  }
158
  function wp_session_cache_expire() {
159
- $wp_session = WP_Session::get_instance();
160
- return $wp_session->cache_expiration();
161
  }
162
  function wp_session_commit() {
163
- wp_session_write_close();
164
  }
165
  function wp_session_decode( $data ) {
166
- $wp_session = WP_Session::get_instance();
167
-
168
- return $wp_session->json_in( $data );
169
  }
170
  function wp_session_encode() {
171
- $wp_session = WP_Session::get_instance();
172
-
173
- return $wp_session->json_out();
174
  }
175
  function wp_session_regenerate_id( $delete_old_session = false ) {
176
- $wp_session = WP_Session::get_instance();
177
-
178
- $wp_session->regenerate_id( $delete_old_session );
179
-
180
- return true;
181
  }
182
  function wp_session_start() {
183
- $wp_session = WP_Session::get_instance();
184
- do_action( 'wp_session_start' );
185
-
186
- return $wp_session->session_started();
187
  }
188
  add_action( 'plugins_loaded', 'wp_session_start' );
189
  function wp_session_status() {
190
- $wp_session = WP_Session::get_instance();
191
- if ( $wp_session->session_started() ) {
192
- return PHP_SESSION_ACTIVE;
193
- }
194
- return PHP_SESSION_NONE;
195
  }
196
  function wp_session_unset() {
197
- $wp_session = WP_Session::get_instance();
198
- $wp_session->reset();
199
  }
200
  function wp_session_write_close() {
201
- $wp_session = WP_Session::get_instance();
202
- $wp_session->write_data();
203
- do_action( 'wp_session_commit' );
204
  }
205
  add_action( 'shutdown', 'wp_session_write_close' );
206
  function wp_session_cleanup() {
207
- global $wpdb;
208
- if ( defined( 'WP_SETUP_CONFIG' ) ) {
209
- return;
210
- }
211
- if ( ! defined( 'WP_INSTALLING' ) ) {
212
- $expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'" );
213
- $now = time();
214
- $expired_sessions = array();
215
- foreach( $expiration_keys as $expiration ) {
216
- if ( $now > intval( $expiration->option_value ) ) {
217
- $session_id = substr( $expiration->option_name, 20 );
218
- $expired_sessions[] = $expiration->option_name;
219
- $expired_sessions[] = "_wp_session_$session_id";
220
- }
221
- }
222
- if ( ! empty( $expired_sessions ) ) {
223
- $option_names = implode( "','", $expired_sessions );
224
- $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" );
225
- }
226
- }
227
- do_action( 'wp_session_cleanup' );
228
  }
229
  add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' );
230
  function wp_session_register_garbage_collection() {
231
- if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) {
232
- wp_schedule_event( time(), 'hourly', 'wp_session_garbage_collection' );
233
- }
234
  }
235
- add_action( 'wp', 'wp_session_register_garbage_collection' );
236
  }
237
- ?>
 
1
+ <?php if( ! defined( 'WP_SESSION_COOKIE' ) )
2
+ define( 'WP_SESSION_COOKIE', '_wp_session' );
3
+ if ( !class_exists( 'Recursive_ArrayAccess' ) ) {
 
4
  class Recursive_ArrayAccess implements ArrayAccess {
5
+ protected $container = array();
6
+ protected $dirty = false;
7
+ protected function __construct( $data = array() ) {
8
+ foreach ( $data as $key => $value ) {
9
+ $this[ $key ] = $value;
10
+ }
11
+ }
12
+ public function __clone() {
13
+ foreach ( $this->container as $key => $value ) {
14
+ if ( $value instanceof self ) {
15
+ $this[ $key ] = clone $value;
16
+ }
17
+ }
18
+ }
19
+ public function toArray() {
20
+ $data = $this->container;
21
+ foreach ( $data as $key => $value ) {
22
+ if ( $value instanceof self ) {
23
+ $data[ $key ] = $value->toArray();
24
+ }
25
+ }
26
+ return $data;
27
+ }
28
+ public function offsetExists( $offset ) {
29
+ return isset( $this->container[ $offset ]) ;
30
+ }
31
+ public function offsetGet( $offset ) {
32
+ return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;
33
+ }
34
+ public function offsetSet( $offset, $data ) {
35
+ if ( is_array( $data ) ) {
36
+ $data = new self( $data );
37
+ }
38
+ if ( $offset === null ) {
39
+ $this->container[] = $data;
40
+ } else {
41
+ $this->container[ $offset ] = $data;
42
+ }
43
+ $this->dirty = true;
44
+ }
45
+ public function offsetUnset( $offset ) {
46
+ unset( $this->container[ $offset ] );
47
+ $this->dirty = true;
48
+ }
49
+ }
50
+ }
51
+ if ( !class_exists( 'WP_Session' ) ) {
52
  final class WP_Session extends Recursive_ArrayAccess implements Iterator, Countable {
53
+ protected $session_id;
54
+ protected $expires;
55
+ protected $exp_variant;
56
+ private static $instance = false;
57
+ public static function get_instance() {
58
+ if ( !self::$instance ) {
59
+ self::$instance = new self();
60
+ }
61
+ return self::$instance;
62
+ }
63
+ protected function __construct() {
64
+ if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) {
65
+ $cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] );
66
+ $cookie_crumbs = explode( '||', $cookie );
67
+ $this->session_id = $cookie_crumbs[0];
68
+ $this->expires = $cookie_crumbs[1];
69
+ $this->exp_variant = $cookie_crumbs[2];
70
+ if ( time() > $this->exp_variant ) {
71
+ $this->set_expiration();
72
+ delete_option( "_wp_session_expires_{$this->session_id}" );
73
+ add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
74
+ }
75
+ } else {
76
+ $this->session_id = $this->generate_id();
77
+ $this->set_expiration();
78
+ }
79
+ $this->read_data();
80
+ $this->set_cookie();
81
+ }
82
+ protected function set_expiration() {
83
+ $this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 );
84
+ $this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
85
+ }
86
+ protected function set_cookie(){
87
+ setcookie(WP_SESSION_COOKIE,$this->session_id.'||'.$this->expires.'||'.$this->exp_variant,$this->expires,COOKIEPATH,COOKIE_DOMAIN );
88
+ }
89
+ protected function generate_id() {
90
+ require_once( ABSPATH . 'wp-includes/class-phpass.php');
91
+ $hasher = new PasswordHash( 8, false );
92
+ return md5( $hasher->get_random_bytes( 32 ) );
93
+ }
94
+ protected function read_data() {
95
+ $this->container = get_option( "_wp_session_{$this->session_id}", array() );
96
+ return $this->container;
97
+ }
98
+ public function write_data() {
99
+ $option_key = "_wp_session_{$this->session_id}";
100
+ if ( $this->dirty ) {
101
+ if ( false === get_option( $option_key ) ) {
102
+ add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
103
+ add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
104
+ } else {
105
+ delete_option( "_wp_session_{$this->session_id}" );
106
+ add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
107
+ }
108
+ }
109
+ }
110
+ public function json_out() {
111
+ return json_encode( $this->container );
112
+ }
113
+ public function json_in( $data ) {
114
+ $array = json_decode( $data );
115
+ if ( is_array( $array ) ) {
116
+ $this->container = $array;
117
+ return true;
118
+ }
119
+ return false;
120
+ }
121
+ public function regenerate_id( $delete_old = false ) {
122
+ if ( $delete_old ) {
123
+ delete_option( "_wp_session_{$this->session_id}" );
124
+ }
125
+ $this->session_id = $this->generate_id();
126
+ $this->set_cookie();
127
+ }
128
+ public function session_started() {
129
+ return !!self::$instance;
130
+ }
131
+ public function cache_expiration() {
132
+ return $this->expires;
133
+ }
134
+ public function reset() {
135
+ $this->container = array();
136
+ }
137
+ public function current() {
138
+ return current( $this->container );
139
+ }
140
+ public function key() {
141
+ return key( $this->container );
142
+ }
143
+ public function next() {
144
+ next( $this->container );
145
+ }
146
+ public function rewind() {
147
+ reset( $this->container );
148
+ }
149
+ public function valid() {
150
+ return $this->offsetExists( $this->key() );
151
+ }
152
+ public function count() {
153
+ return count( $this->container );
154
+ }
 
155
  }
156
  function wp_session_cache_expire() {
157
+ $wp_session = WP_Session::get_instance();
158
+ return $wp_session->cache_expiration();
159
  }
160
  function wp_session_commit() {
161
+ wp_session_write_close();
162
  }
163
  function wp_session_decode( $data ) {
164
+ $wp_session = WP_Session::get_instance();
165
+ return $wp_session->json_in( $data );
 
166
  }
167
  function wp_session_encode() {
168
+ $wp_session = WP_Session::get_instance();
169
+ return $wp_session->json_out();
 
170
  }
171
  function wp_session_regenerate_id( $delete_old_session = false ) {
172
+ $wp_session = WP_Session::get_instance();
173
+ $wp_session->regenerate_id( $delete_old_session );
174
+ return true;
 
 
175
  }
176
  function wp_session_start() {
177
+ $wp_session = WP_Session::get_instance();
178
+ do_action( 'wp_session_start' );
179
+ return $wp_session->session_started();
 
180
  }
181
  add_action( 'plugins_loaded', 'wp_session_start' );
182
  function wp_session_status() {
183
+ $wp_session = WP_Session::get_instance();
184
+ if ( $wp_session->session_started() ) {
185
+ return PHP_SESSION_ACTIVE;
186
+ }
187
+ return PHP_SESSION_NONE;
188
  }
189
  function wp_session_unset() {
190
+ $wp_session = WP_Session::get_instance();
191
+ $wp_session->reset();
192
  }
193
  function wp_session_write_close() {
194
+ $wp_session = WP_Session::get_instance();
195
+ $wp_session->write_data();
196
+ do_action( 'wp_session_commit' );
197
  }
198
  add_action( 'shutdown', 'wp_session_write_close' );
199
  function wp_session_cleanup() {
200
+ global $wpdb;
201
+ if ( defined( 'WP_SETUP_CONFIG' ) ) {
202
+ return;
203
+ }
204
+ if ( ! defined( 'WP_INSTALLING' ) ) {
205
+ $expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'" );
206
+ $now = time();
207
+ $expired_sessions = array();
208
+ foreach( $expiration_keys as $expiration ) {
209
+ if ( $now > intval( $expiration->option_value ) ) {
210
+ $session_id = substr( $expiration->option_name, 20 );
211
+ $expired_sessions[] = $expiration->option_name;
212
+ $expired_sessions[] = "_wp_session_$session_id";
213
+ }
214
+ }
215
+ if ( ! empty( $expired_sessions ) ) {
216
+ $option_names = implode( "','", $expired_sessions );
217
+ $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" );
218
+ }
219
+ }
220
+ do_action( 'wp_session_cleanup' );
221
  }
222
  add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' );
223
  function wp_session_register_garbage_collection() {
224
+ if ( !wp_next_scheduled( 'wp_session_garbage_collection' ) ) {
225
+ wp_schedule_event( time(), 'hourly', 'wp_session_garbage_collection' );
 
226
  }
 
227
  }
228
+ add_action( 'wp', 'wp_session_register_garbage_collection' );
229
+ }
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.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.1.3 =
87
  * Fixed : Some Minor bugs
88
  = 1.1.2 =
@@ -104,6 +106,8 @@ You can read complete documentations on the [GravityForms.ir](http://www.Gravity
104
  * First version
105
 
106
  == Upgrade Notice ==
 
 
107
  = 1.1.3 =
108
  * Fixed : Some Minor bugs
109
  = 1.1.2 =
4
  Donate link: http://www.gravityforms.ir
5
  Requires at least: 3.5
6
  Tested up to: 4.1
7
+ Stable tag: 1.1.4
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.1.4 =
87
+ * Fixed : Cannot modify header information...
88
  = 1.1.3 =
89
  * Fixed : Some Minor bugs
90
  = 1.1.2 =
106
  * First version
107
 
108
  == Upgrade Notice ==
109
+ = 1.1.4 =
110
+ * Fixed : Cannot modify header information...
111
  = 1.1.3 =
112
  * Fixed : Some Minor bugs
113
  = 1.1.2 =