Version Description
- Fixed : Cannot modify header information...
Download this release
Release Info
Developer | hannanstd |
Plugin | گرویتی فرم فارسی |
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 +3 -3
- include/wp-session.php +200 -208
- 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.1.
|
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.
|
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 |
-
|
3 |
-
|
4 |
-
if ( ! class_exists( 'Recursive_ArrayAccess' ) ) {
|
5 |
class Recursive_ArrayAccess implements ArrayAccess {
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
}
|
51 |
-
}
|
52 |
-
if ( !
|
53 |
final class WP_Session extends Recursive_ArrayAccess implements Iterator, Countable {
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
}
|
157 |
}
|
158 |
function wp_session_cache_expire() {
|
159 |
-
|
160 |
-
|
161 |
}
|
162 |
function wp_session_commit() {
|
163 |
-
|
164 |
}
|
165 |
function wp_session_decode( $data ) {
|
166 |
-
|
167 |
-
|
168 |
-
return $wp_session->json_in( $data );
|
169 |
}
|
170 |
function wp_session_encode() {
|
171 |
-
|
172 |
-
|
173 |
-
return $wp_session->json_out();
|
174 |
}
|
175 |
function wp_session_regenerate_id( $delete_old_session = false ) {
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
return true;
|
181 |
}
|
182 |
function wp_session_start() {
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
return $wp_session->session_started();
|
187 |
}
|
188 |
add_action( 'plugins_loaded', 'wp_session_start' );
|
189 |
function wp_session_status() {
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
}
|
196 |
function wp_session_unset() {
|
197 |
-
|
198 |
-
|
199 |
}
|
200 |
function wp_session_write_close() {
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
}
|
205 |
add_action( 'shutdown', 'wp_session_write_close' );
|
206 |
function wp_session_cleanup() {
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
}
|
229 |
add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' );
|
230 |
function wp_session_register_garbage_collection() {
|
231 |
-
|
232 |
-
|
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.
|
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 =
|