@@ -69,7 +69,7 @@ |
||
69 | 69 | * @uses api_request() |
70 | 70 | * |
71 | 71 | * @param array $_transient_data Update array build by WordPress. |
72 | - * @return array Modified update array with custom plugin data. |
|
72 | + * @return stdClass Modified update array with custom plugin data. |
|
73 | 73 | */ |
74 | 74 | public function check_update( $_transient_data ) { |
75 | 75 |
@@ -15,23 +15,23 @@ discard block |
||
15 | 15 | * @version 1.6.3 |
16 | 16 | */ |
17 | 17 | class FrmEDD_SL_Plugin_Updater { |
18 | - private $api_url = ''; |
|
19 | - private $api_data = array(); |
|
20 | - private $name = ''; |
|
21 | - private $slug = ''; |
|
22 | - private $version = ''; |
|
23 | - |
|
24 | - /** |
|
25 | - * Class constructor. |
|
26 | - * |
|
27 | - * @uses plugin_basename() |
|
28 | - * @uses hook() |
|
29 | - * |
|
30 | - * @param string $_api_url The URL pointing to the custom API endpoint. |
|
31 | - * @param string $_plugin_file Path to the plugin file. |
|
32 | - * @param array $_api_data Optional data to send with API calls. |
|
33 | - */ |
|
34 | - public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
18 | + private $api_url = ''; |
|
19 | + private $api_data = array(); |
|
20 | + private $name = ''; |
|
21 | + private $slug = ''; |
|
22 | + private $version = ''; |
|
23 | + |
|
24 | + /** |
|
25 | + * Class constructor. |
|
26 | + * |
|
27 | + * @uses plugin_basename() |
|
28 | + * @uses hook() |
|
29 | + * |
|
30 | + * @param string $_api_url The URL pointing to the custom API endpoint. |
|
31 | + * @param string $_plugin_file Path to the plugin file. |
|
32 | + * @param array $_api_data Optional data to send with API calls. |
|
33 | + */ |
|
34 | + public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
35 | 35 | global $frm_edd_plugin_data; |
36 | 36 | |
37 | 37 | $this->api_url = trailingslashit( $_api_url ); |
@@ -44,159 +44,159 @@ discard block |
||
44 | 44 | |
45 | 45 | // Set up hooks. |
46 | 46 | $this->init(); |
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * Set up WordPress filters to hook into WP's update process. |
|
51 | - * |
|
52 | - * @uses add_filter() |
|
53 | - * |
|
54 | - * @return void |
|
55 | - */ |
|
56 | - public function init() { |
|
57 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
58 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * Set up WordPress filters to hook into WP's update process. |
|
51 | + * |
|
52 | + * @uses add_filter() |
|
53 | + * |
|
54 | + * @return void |
|
55 | + */ |
|
56 | + public function init() { |
|
57 | + add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
58 | + add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
59 | 59 | add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Check for Updates at the defined API endpoint and modify the update array. |
|
64 | - * |
|
65 | - * This function dives into the update API just when WordPress creates its update array, |
|
66 | - * then adds a custom API call and injects the custom plugin data retrieved from the API. |
|
67 | - * It is reassembled from parts of the native WordPress plugin update code. |
|
68 | - * See wp-includes/update.php line 121 for the original wp_update_plugins() function. |
|
69 | - * |
|
70 | - * @uses api_request() |
|
71 | - * |
|
72 | - * @param array $_transient_data Update array build by WordPress. |
|
73 | - * @return array Modified update array with custom plugin data. |
|
74 | - */ |
|
75 | - public function check_update( $_transient_data ) { |
|
76 | - |
|
77 | - global $pagenow; |
|
78 | - |
|
79 | - if ( ! is_object( $_transient_data ) ) { |
|
80 | - $_transient_data = new stdClass; |
|
81 | - } |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Check for Updates at the defined API endpoint and modify the update array. |
|
64 | + * |
|
65 | + * This function dives into the update API just when WordPress creates its update array, |
|
66 | + * then adds a custom API call and injects the custom plugin data retrieved from the API. |
|
67 | + * It is reassembled from parts of the native WordPress plugin update code. |
|
68 | + * See wp-includes/update.php line 121 for the original wp_update_plugins() function. |
|
69 | + * |
|
70 | + * @uses api_request() |
|
71 | + * |
|
72 | + * @param array $_transient_data Update array build by WordPress. |
|
73 | + * @return array Modified update array with custom plugin data. |
|
74 | + */ |
|
75 | + public function check_update( $_transient_data ) { |
|
76 | + |
|
77 | + global $pagenow; |
|
78 | + |
|
79 | + if ( ! is_object( $_transient_data ) ) { |
|
80 | + $_transient_data = new stdClass; |
|
81 | + } |
|
82 | 82 | |
83 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
83 | + if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
84 | 84 | |
85 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
85 | + $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
86 | 86 | |
87 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
87 | + if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
88 | 88 | |
89 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
89 | + if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
90 | 90 | |
91 | 91 | if ( empty( $version_info->plugin ) ) { |
92 | 92 | $version_info->plugin = $this->name; |
93 | 93 | } |
94 | 94 | |
95 | - $_transient_data->response[ $this->name ] = $version_info; |
|
96 | - |
|
97 | - } |
|
98 | - |
|
99 | - $_transient_data->last_checked = time(); |
|
100 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
101 | - |
|
102 | - } |
|
103 | - } |
|
104 | - |
|
105 | - return $_transient_data; |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * Updates information on the "View version x.x details" page with custom data. |
|
110 | - * |
|
111 | - * @uses api_request() |
|
112 | - * |
|
113 | - * @param mixed $_data |
|
114 | - * @param string $_action |
|
115 | - * @param object $_args |
|
116 | - * @return object $_data |
|
117 | - */ |
|
118 | - public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
119 | - |
|
120 | - if ( $_action != 'plugin_information' ) { |
|
95 | + $_transient_data->response[ $this->name ] = $version_info; |
|
121 | 96 | |
122 | - return $_data; |
|
97 | + } |
|
123 | 98 | |
124 | - } |
|
99 | + $_transient_data->last_checked = time(); |
|
100 | + $_transient_data->checked[ $this->name ] = $this->version; |
|
125 | 101 | |
126 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
102 | + } |
|
103 | + } |
|
127 | 104 | |
128 | - return $_data; |
|
105 | + return $_transient_data; |
|
106 | + } |
|
129 | 107 | |
130 | - } |
|
108 | + /** |
|
109 | + * Updates information on the "View version x.x details" page with custom data. |
|
110 | + * |
|
111 | + * @uses api_request() |
|
112 | + * |
|
113 | + * @param mixed $_data |
|
114 | + * @param string $_action |
|
115 | + * @param object $_args |
|
116 | + * @return object $_data |
|
117 | + */ |
|
118 | + public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
131 | 119 | |
132 | - $to_send = array( |
|
133 | - 'slug' => $this->slug, |
|
134 | - 'is_ssl' => is_ssl(), |
|
135 | - 'fields' => array( |
|
136 | - 'banners' => false, // These will be supported soon hopefully |
|
137 | - 'reviews' => false, |
|
138 | - ), |
|
139 | - ); |
|
120 | + if ( $_action != 'plugin_information' ) { |
|
140 | 121 | |
141 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
122 | + return $_data; |
|
142 | 123 | |
143 | - if ( false !== $api_response ) { |
|
144 | - $_data = $api_response; |
|
145 | - } |
|
124 | + } |
|
146 | 125 | |
147 | - return $_data; |
|
148 | - } |
|
126 | + if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
149 | 127 | |
128 | + return $_data; |
|
150 | 129 | |
151 | - /** |
|
152 | - * Disable SSL verification in order to prevent download update failures |
|
153 | - * |
|
154 | - * @param array $args |
|
155 | - * @param string $url |
|
156 | - * @return object $array |
|
157 | - */ |
|
158 | - public function http_request_args( $args, $url ) { |
|
159 | - // If it is an https request and we are performing a package download, disable ssl verification |
|
160 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
161 | - $args['sslverify'] = false; |
|
162 | - } |
|
163 | - return $args; |
|
164 | - } |
|
130 | + } |
|
165 | 131 | |
166 | - /** |
|
167 | - * Calls the API and, if successfull, returns the object delivered by the API. |
|
168 | - * |
|
169 | - * @uses get_bloginfo() |
|
170 | - * @uses wp_remote_post() |
|
171 | - * @uses is_wp_error() |
|
172 | - * |
|
173 | - * @param string $_action The requested action. |
|
174 | - * @param array $_data Parameters for the API action. |
|
175 | - * @return false|object |
|
176 | - */ |
|
177 | - private function api_request( $_action, $_data ) { |
|
132 | + $to_send = array( |
|
133 | + 'slug' => $this->slug, |
|
134 | + 'is_ssl' => is_ssl(), |
|
135 | + 'fields' => array( |
|
136 | + 'banners' => false, // These will be supported soon hopefully |
|
137 | + 'reviews' => false, |
|
138 | + ), |
|
139 | + ); |
|
178 | 140 | |
179 | - global $wp_version; |
|
141 | + $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
180 | 142 | |
181 | - $data = array_merge( $this->api_data, $_data ); |
|
143 | + if ( false !== $api_response ) { |
|
144 | + $_data = $api_response; |
|
145 | + } |
|
182 | 146 | |
183 | - if ( $data['slug'] != $this->slug ) { |
|
184 | - return; |
|
147 | + return $_data; |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * Disable SSL verification in order to prevent download update failures |
|
153 | + * |
|
154 | + * @param array $args |
|
155 | + * @param string $url |
|
156 | + * @return object $array |
|
157 | + */ |
|
158 | + public function http_request_args( $args, $url ) { |
|
159 | + // If it is an https request and we are performing a package download, disable ssl verification |
|
160 | + if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
161 | + $args['sslverify'] = false; |
|
162 | + } |
|
163 | + return $args; |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Calls the API and, if successfull, returns the object delivered by the API. |
|
168 | + * |
|
169 | + * @uses get_bloginfo() |
|
170 | + * @uses wp_remote_post() |
|
171 | + * @uses is_wp_error() |
|
172 | + * |
|
173 | + * @param string $_action The requested action. |
|
174 | + * @param array $_data Parameters for the API action. |
|
175 | + * @return false|object |
|
176 | + */ |
|
177 | + private function api_request( $_action, $_data ) { |
|
178 | + |
|
179 | + global $wp_version; |
|
180 | + |
|
181 | + $data = array_merge( $this->api_data, $_data ); |
|
182 | + |
|
183 | + if ( $data['slug'] != $this->slug ) { |
|
184 | + return; |
|
185 | 185 | } |
186 | 186 | |
187 | - if ( $this->api_url == home_url() ) { |
|
188 | - return false; // Don't allow a plugin to ping itself |
|
189 | - } |
|
187 | + if ( $this->api_url == home_url() ) { |
|
188 | + return false; // Don't allow a plugin to ping itself |
|
189 | + } |
|
190 | 190 | |
191 | - $api_params = array( |
|
192 | - 'edd_action' => 'get_version', |
|
193 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
194 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
195 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
196 | - 'slug' => $data['slug'], |
|
197 | - 'author' => $data['author'], |
|
198 | - 'url' => home_url(), |
|
199 | - ); |
|
191 | + $api_params = array( |
|
192 | + 'edd_action' => 'get_version', |
|
193 | + 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
194 | + 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
195 | + 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
196 | + 'slug' => $data['slug'], |
|
197 | + 'author' => $data['author'], |
|
198 | + 'url' => home_url(), |
|
199 | + ); |
|
200 | 200 | |
201 | 201 | $cache_key = 'edd_plugin_' . md5( sanitize_key( $api_params['license'] . $this->version ) . '_' . $api_params['edd_action'] ); |
202 | 202 | $cached_response = get_transient( $cache_key ); |
@@ -205,24 +205,24 @@ discard block |
||
205 | 205 | return $cached_response; |
206 | 206 | } |
207 | 207 | |
208 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
208 | + $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
209 | 209 | |
210 | - if ( ! is_wp_error( $request ) ) { |
|
211 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
212 | - } |
|
210 | + if ( ! is_wp_error( $request ) ) { |
|
211 | + $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
212 | + } |
|
213 | 213 | |
214 | - if ( $request && isset( $request->sections ) ) { |
|
215 | - $request->sections = maybe_unserialize( $request->sections ); |
|
214 | + if ( $request && isset( $request->sections ) ) { |
|
215 | + $request->sections = maybe_unserialize( $request->sections ); |
|
216 | 216 | set_transient( $cache_key, $request, DAY_IN_SECONDS ); |
217 | - } else { |
|
218 | - $request = false; |
|
217 | + } else { |
|
218 | + $request = false; |
|
219 | 219 | set_transient( $cache_key, 0, DAY_IN_SECONDS ); |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | - return $request; |
|
223 | - } |
|
222 | + return $request; |
|
223 | + } |
|
224 | 224 | |
225 | - public function show_changelog() { |
|
225 | + public function show_changelog() { |
|
226 | 226 | |
227 | 227 | global $frm_edd_plugin_data; |
228 | 228 | |
@@ -278,5 +278,5 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | exit; |
281 | - } |
|
281 | + } |
|
282 | 282 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->slug = basename( $_plugin_file, '.php' ); |
41 | 41 | $this->version = $_api_data['version']; |
42 | 42 | |
43 | - $frm_edd_plugin_data[ $this->slug ] = $this->api_data; |
|
43 | + $frm_edd_plugin_data[$this->slug] = $this->api_data; |
|
44 | 44 | |
45 | 45 | // Set up hooks. |
46 | 46 | $this->init(); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $_transient_data = new stdClass; |
81 | 81 | } |
82 | 82 | |
83 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
83 | + if ( empty( $_transient_data->response ) || empty( $_transient_data->response[$this->name] ) ) { |
|
84 | 84 | |
85 | 85 | $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
86 | 86 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | $version_info->plugin = $this->name; |
93 | 93 | } |
94 | 94 | |
95 | - $_transient_data->response[ $this->name ] = $version_info; |
|
95 | + $_transient_data->response[$this->name] = $version_info; |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
99 | 99 | $_transient_data->last_checked = time(); |
100 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
100 | + $_transient_data->checked[$this->name] = $this->version; |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | wp_die( __( 'You do not have permission to install plugin updates', 'formidable' ), __( 'Error', 'formidable' ), array( 'response' => 403 ) ); |
243 | 243 | } |
244 | 244 | |
245 | - $data = $frm_edd_plugin_data[ $_REQUEST['slug'] ]; |
|
245 | + $data = $frm_edd_plugin_data[$_REQUEST['slug']]; |
|
246 | 246 | $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' ); |
247 | 247 | $version_info = get_transient( $cache_key ); |
248 | 248 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | } |
275 | 275 | |
276 | - if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { |
|
276 | + if ( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { |
|
277 | 277 | echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>'; |
278 | 278 | } |
279 | 279 |
@@ -17,6 +17,6 @@ |
||
17 | 17 | </ul> |
18 | 18 | |
19 | 19 | <?php if ( $form && $title == 'show' ) { ?> |
20 | - <input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)') : $form->name ) ?>" readonly="readonly" disabled="disabled" /> |
|
20 | + <input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)' ) : $form->name ) ?>" readonly="readonly" disabled="disabled" /> |
|
21 | 21 | <?php } ?> |
22 | 22 | </div> |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | class FrmAppController { |
4 | 4 | |
5 | 5 | public static function menu() { |
6 | - FrmAppHelper::maybe_add_permissions(); |
|
7 | - if ( ! current_user_can( 'frm_view_forms' ) ) { |
|
8 | - return; |
|
9 | - } |
|
6 | + FrmAppHelper::maybe_add_permissions(); |
|
7 | + if ( ! current_user_can( 'frm_view_forms' ) ) { |
|
8 | + return; |
|
9 | + } |
|
10 | 10 | |
11 | - $frm_settings = FrmAppHelper::get_settings(); |
|
12 | - add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() ); |
|
13 | - } |
|
11 | + $frm_settings = FrmAppHelper::get_settings(); |
|
12 | + add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() ); |
|
13 | + } |
|
14 | 14 | |
15 | 15 | private static function get_menu_position() { |
16 | 16 | $count = count( get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) ); |
@@ -19,39 +19,39 @@ discard block |
||
19 | 19 | return $pos; |
20 | 20 | } |
21 | 21 | |
22 | - public static function load_wp_admin_style() { |
|
23 | - FrmAppHelper::load_font_style(); |
|
24 | - } |
|
22 | + public static function load_wp_admin_style() { |
|
23 | + FrmAppHelper::load_font_style(); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) { |
27 | - global $pagenow, $frm_vars; |
|
27 | + global $pagenow, $frm_vars; |
|
28 | 28 | |
29 | 29 | $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' ); |
30 | - if ( empty( $show_nav ) ) { |
|
31 | - return; |
|
32 | - } |
|
30 | + if ( empty( $show_nav ) ) { |
|
31 | + return; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | $current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' ); |
35 | 35 | if ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) { |
36 | 36 | $current_page = 'frm_display'; |
37 | 37 | } |
38 | 38 | |
39 | - if ( $form ) { |
|
39 | + if ( $form ) { |
|
40 | 40 | FrmForm::maybe_get_form( $form ); |
41 | 41 | |
42 | - if ( is_object( $form ) ) { |
|
43 | - $id = $form->id; |
|
44 | - } |
|
45 | - } |
|
42 | + if ( is_object( $form ) ) { |
|
43 | + $id = $form->id; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | - if ( ! isset( $id ) ) { |
|
48 | - $form = $id = false; |
|
49 | - } |
|
47 | + if ( ! isset( $id ) ) { |
|
48 | + $form = $id = false; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | $nav_items = self::get_form_nav_items( $id ); |
52 | 52 | |
53 | - include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' ); |
|
54 | - } |
|
53 | + include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' ); |
|
54 | + } |
|
55 | 55 | |
56 | 56 | private static function get_form_nav_items( $id ) { |
57 | 57 | $nav_items = array( |
@@ -82,26 +82,26 @@ discard block |
||
82 | 82 | return $nav_items; |
83 | 83 | } |
84 | 84 | |
85 | - // Adds a settings link to the plugins page |
|
86 | - public static function settings_link( $links ) { |
|
85 | + // Adds a settings link to the plugins page |
|
86 | + public static function settings_link( $links ) { |
|
87 | 87 | $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>'; |
88 | - array_unshift( $links, $settings ); |
|
88 | + array_unshift( $links, $settings ); |
|
89 | 89 | |
90 | - return $links; |
|
91 | - } |
|
90 | + return $links; |
|
91 | + } |
|
92 | 92 | |
93 | - public static function pro_get_started_headline() { |
|
94 | - // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
95 | - if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
96 | - return; |
|
97 | - } |
|
93 | + public static function pro_get_started_headline() { |
|
94 | + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
95 | + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
96 | + return; |
|
97 | + } |
|
98 | 98 | |
99 | 99 | if ( get_site_option( 'frmpro-authorized' ) && ! file_exists( FrmAppHelper::plugin_path() . '/pro/formidable-pro.php' ) ) { |
100 | - FrmAppHelper::load_admin_wide_js(); |
|
100 | + FrmAppHelper::load_admin_wide_js(); |
|
101 | 101 | |
102 | - // user is authorized, but running free version |
|
103 | - $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/'; |
|
104 | - ?> |
|
102 | + // user is authorized, but running free version |
|
103 | + $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/'; |
|
104 | + ?> |
|
105 | 105 | <div class="error" class="frm_previous_install"> |
106 | 106 | <?php |
107 | 107 | echo wp_kses_post( apply_filters( 'frm_pro_update_msg', |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | ) ); ?> |
114 | 114 | </div> |
115 | 115 | <?php |
116 | - } |
|
117 | - } |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * If there are CURL problems on this server, wp_remote_post won't work for installing |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - public static function admin_js() { |
|
159 | + public static function admin_js() { |
|
160 | 160 | $version = FrmAppHelper::plugin_version(); |
161 | 161 | FrmAppHelper::load_admin_wide_js( false ); |
162 | 162 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | 'bootstrap_tooltip', 'bootstrap-multiselect', |
168 | 168 | ), $version, true ); |
169 | 169 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
170 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
170 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
171 | 171 | |
172 | 172 | // load multselect js |
173 | 173 | wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true ); |
@@ -178,78 +178,78 @@ discard block |
||
178 | 178 | global $pagenow; |
179 | 179 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
180 | 180 | |
181 | - wp_enqueue_script( 'admin-widgets' ); |
|
182 | - wp_enqueue_style( 'widgets' ); |
|
183 | - wp_enqueue_script( 'formidable' ); |
|
184 | - wp_enqueue_script( 'formidable_admin' ); |
|
181 | + wp_enqueue_script( 'admin-widgets' ); |
|
182 | + wp_enqueue_style( 'widgets' ); |
|
183 | + wp_enqueue_script( 'formidable' ); |
|
184 | + wp_enqueue_script( 'formidable_admin' ); |
|
185 | 185 | FrmAppHelper::localize_script( 'admin' ); |
186 | 186 | |
187 | - wp_enqueue_style( 'formidable-admin' ); |
|
188 | - add_thickbox(); |
|
187 | + wp_enqueue_style( 'formidable-admin' ); |
|
188 | + add_thickbox(); |
|
189 | 189 | |
190 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
190 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
191 | 191 | |
192 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
193 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
194 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
192 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
193 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
194 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
195 | 195 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
196 | 196 | $post = get_post( absint( $_REQUEST['post'] ) ); |
197 | - if ( ! $post ) { |
|
198 | - return; |
|
199 | - } |
|
200 | - $post_type = $post->post_type; |
|
201 | - } else { |
|
202 | - return; |
|
203 | - } |
|
204 | - |
|
205 | - if ( $post_type == 'frm_display' ) { |
|
206 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
207 | - wp_enqueue_script( 'formidable_admin' ); |
|
208 | - wp_enqueue_style( 'formidable-admin' ); |
|
197 | + if ( ! $post ) { |
|
198 | + return; |
|
199 | + } |
|
200 | + $post_type = $post->post_type; |
|
201 | + } else { |
|
202 | + return; |
|
203 | + } |
|
204 | + |
|
205 | + if ( $post_type == 'frm_display' ) { |
|
206 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
207 | + wp_enqueue_script( 'formidable_admin' ); |
|
208 | + wp_enqueue_style( 'formidable-admin' ); |
|
209 | 209 | FrmAppHelper::localize_script( 'admin' ); |
210 | - } |
|
211 | - } else if ( $pagenow == 'widgets.php' ) { |
|
212 | - FrmAppHelper::load_admin_wide_js(); |
|
213 | - } |
|
214 | - } |
|
215 | - |
|
216 | - public static function wp_admin_body_class( $classes ) { |
|
217 | - global $wp_version; |
|
218 | - //we need this class everywhere in the admin for the menu |
|
219 | - if ( version_compare( $wp_version, '3.7.2', '>' ) ) { |
|
220 | - $classes .= ' frm_38_trigger'; |
|
221 | - } |
|
222 | - |
|
223 | - return $classes; |
|
224 | - } |
|
225 | - |
|
226 | - public static function load_lang() { |
|
227 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * Filter shortcodes in text widgets |
|
232 | - */ |
|
233 | - public static function widget_text_filter( $content ) { |
|
234 | - $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
235 | - return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
236 | - } |
|
237 | - |
|
238 | - public static function widget_text_filter_callback( $matches ) { |
|
239 | - _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' ); |
|
240 | - return FrmAppHelper::widget_text_filter_callback( $matches ); |
|
241 | - } |
|
242 | - |
|
243 | - public static function front_head() { |
|
244 | - if ( is_multisite() ) { |
|
245 | - $old_db_version = get_option( 'frm_db_version' ); |
|
246 | - $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false; |
|
247 | - if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) || |
|
248 | - ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) { |
|
249 | - self::install( $old_db_version ); |
|
250 | - } |
|
251 | - } |
|
252 | - } |
|
210 | + } |
|
211 | + } else if ( $pagenow == 'widgets.php' ) { |
|
212 | + FrmAppHelper::load_admin_wide_js(); |
|
213 | + } |
|
214 | + } |
|
215 | + |
|
216 | + public static function wp_admin_body_class( $classes ) { |
|
217 | + global $wp_version; |
|
218 | + //we need this class everywhere in the admin for the menu |
|
219 | + if ( version_compare( $wp_version, '3.7.2', '>' ) ) { |
|
220 | + $classes .= ' frm_38_trigger'; |
|
221 | + } |
|
222 | + |
|
223 | + return $classes; |
|
224 | + } |
|
225 | + |
|
226 | + public static function load_lang() { |
|
227 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * Filter shortcodes in text widgets |
|
232 | + */ |
|
233 | + public static function widget_text_filter( $content ) { |
|
234 | + $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
235 | + return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
236 | + } |
|
237 | + |
|
238 | + public static function widget_text_filter_callback( $matches ) { |
|
239 | + _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' ); |
|
240 | + return FrmAppHelper::widget_text_filter_callback( $matches ); |
|
241 | + } |
|
242 | + |
|
243 | + public static function front_head() { |
|
244 | + if ( is_multisite() ) { |
|
245 | + $old_db_version = get_option( 'frm_db_version' ); |
|
246 | + $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false; |
|
247 | + if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) || |
|
248 | + ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) { |
|
249 | + self::install( $old_db_version ); |
|
250 | + } |
|
251 | + } |
|
252 | + } |
|
253 | 253 | |
254 | 254 | public static function localize_script( $location ) { |
255 | 255 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmAppHelper::localize_script' ); |
@@ -309,72 +309,72 @@ discard block |
||
309 | 309 | wp_die(); |
310 | 310 | } |
311 | 311 | |
312 | - public static function activation_install() { |
|
313 | - FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
314 | - FrmFormActionsController::actions_init(); |
|
315 | - self::install(); |
|
316 | - } |
|
312 | + public static function activation_install() { |
|
313 | + FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
314 | + FrmFormActionsController::actions_init(); |
|
315 | + self::install(); |
|
316 | + } |
|
317 | 317 | |
318 | - public static function install( $old_db_version = false ) { |
|
319 | - $frmdb = new FrmDb(); |
|
320 | - $frmdb->upgrade( $old_db_version ); |
|
321 | - } |
|
318 | + public static function install( $old_db_version = false ) { |
|
319 | + $frmdb = new FrmDb(); |
|
320 | + $frmdb->upgrade( $old_db_version ); |
|
321 | + } |
|
322 | 322 | |
323 | - public static function uninstall() { |
|
324 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
323 | + public static function uninstall() { |
|
324 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
325 | 325 | |
326 | - if ( current_user_can( 'administrator' ) ) { |
|
327 | - $frmdb = new FrmDb(); |
|
328 | - $frmdb->uninstall(); |
|
326 | + if ( current_user_can( 'administrator' ) ) { |
|
327 | + $frmdb = new FrmDb(); |
|
328 | + $frmdb->uninstall(); |
|
329 | 329 | |
330 | 330 | //disable the plugin and redirect after uninstall so the tables don't get added right back |
331 | 331 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
332 | 332 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
333 | - } else { |
|
334 | - $frm_settings = FrmAppHelper::get_settings(); |
|
335 | - wp_die( $frm_settings->admin_permission ); |
|
336 | - } |
|
337 | - wp_die(); |
|
338 | - } |
|
339 | - |
|
340 | - public static function drop_tables( $tables ) { |
|
341 | - global $wpdb; |
|
342 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
343 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
344 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
345 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
346 | - return $tables; |
|
347 | - } |
|
348 | - |
|
349 | - // Routes for wordpress pages -- we're just replacing content here folks. |
|
350 | - public static function page_route( $content ) { |
|
351 | - global $post; |
|
352 | - |
|
353 | - $frm_settings = FrmAppHelper::get_settings(); |
|
354 | - if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
355 | - $content = FrmFormsController::page_preview(); |
|
356 | - } |
|
357 | - |
|
358 | - return $content; |
|
359 | - } |
|
360 | - |
|
361 | - public static function deauthorize() { |
|
362 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
363 | - |
|
364 | - delete_option( 'frmpro-credentials' ); |
|
365 | - delete_option( 'frmpro-authorized' ); |
|
366 | - delete_site_option( 'frmpro-credentials' ); |
|
367 | - delete_site_option( 'frmpro-authorized' ); |
|
368 | - wp_die(); |
|
369 | - } |
|
370 | - |
|
371 | - public static function get_form_shortcode( $atts ) { |
|
372 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
373 | - return FrmFormsController::get_form_shortcode( $atts ); |
|
374 | - } |
|
375 | - |
|
376 | - public static function get_postbox_class() { |
|
377 | - _deprecated_function( __FUNCTION__, '2.0' ); |
|
378 | - return 'postbox-container'; |
|
379 | - } |
|
333 | + } else { |
|
334 | + $frm_settings = FrmAppHelper::get_settings(); |
|
335 | + wp_die( $frm_settings->admin_permission ); |
|
336 | + } |
|
337 | + wp_die(); |
|
338 | + } |
|
339 | + |
|
340 | + public static function drop_tables( $tables ) { |
|
341 | + global $wpdb; |
|
342 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
343 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
344 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
345 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
346 | + return $tables; |
|
347 | + } |
|
348 | + |
|
349 | + // Routes for wordpress pages -- we're just replacing content here folks. |
|
350 | + public static function page_route( $content ) { |
|
351 | + global $post; |
|
352 | + |
|
353 | + $frm_settings = FrmAppHelper::get_settings(); |
|
354 | + if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
355 | + $content = FrmFormsController::page_preview(); |
|
356 | + } |
|
357 | + |
|
358 | + return $content; |
|
359 | + } |
|
360 | + |
|
361 | + public static function deauthorize() { |
|
362 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
363 | + |
|
364 | + delete_option( 'frmpro-credentials' ); |
|
365 | + delete_option( 'frmpro-authorized' ); |
|
366 | + delete_site_option( 'frmpro-credentials' ); |
|
367 | + delete_site_option( 'frmpro-authorized' ); |
|
368 | + wp_die(); |
|
369 | + } |
|
370 | + |
|
371 | + public static function get_form_shortcode( $atts ) { |
|
372 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
373 | + return FrmFormsController::get_form_shortcode( $atts ); |
|
374 | + } |
|
375 | + |
|
376 | + public static function get_postbox_class() { |
|
377 | + _deprecated_function( __FUNCTION__, '2.0' ); |
|
378 | + return 'postbox-container'; |
|
379 | + } |
|
380 | 380 | } |
@@ -42,51 +42,51 @@ discard block |
||
42 | 42 | |
43 | 43 | if ( $f->type == 'data' ) { |
44 | 44 | //get all fields from linked form |
45 | - if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) { |
|
46 | - $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
47 | - if ( ! in_array( $linked_form, $linked_forms ) ) { |
|
48 | - $linked_forms[] = $linked_form; |
|
45 | + if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) { |
|
46 | + $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
47 | + if ( ! in_array( $linked_form, $linked_forms ) ) { |
|
48 | + $linked_forms[] = $linked_form; |
|
49 | 49 | $linked_fields = FrmField::getAll( array( 'fi.type not' => FrmField::no_save_fields(), 'fi.form_id' => $linked_form ) ); |
50 | - $ldfe = ''; |
|
50 | + $ldfe = ''; |
|
51 | 51 | if ( $linked_fields ) { |
52 | 52 | foreach ( $linked_fields as $linked_field ) { |
53 | - FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) ); |
|
54 | - |
|
55 | - $ldfe = $linked_field->id; |
|
56 | - unset($linked_field); |
|
57 | - } |
|
58 | - } |
|
59 | - } |
|
60 | - } |
|
61 | - $dfe = $f->id; |
|
62 | - } |
|
63 | - unset($f); |
|
64 | - } |
|
65 | - } ?> |
|
53 | + FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) ); |
|
54 | + |
|
55 | + $ldfe = $linked_field->id; |
|
56 | + unset($linked_field); |
|
57 | + } |
|
58 | + } |
|
59 | + } |
|
60 | + } |
|
61 | + $dfe = $f->id; |
|
62 | + } |
|
63 | + unset($f); |
|
64 | + } |
|
65 | + } ?> |
|
66 | 66 | </ul> |
67 | 67 | |
68 | 68 | <?php _e( 'Helpers', 'formidable' ) ?>: |
69 | 69 | <ul class="frm_code_list"> |
70 | 70 | <?php |
71 | - $col = 'one'; |
|
71 | + $col = 'one'; |
|
72 | 72 | foreach ( $entry_shortcodes as $skey => $sname ) { |
73 | 73 | if ( empty( $skey ) ) { |
74 | - $col = 'one'; |
|
75 | - echo '<li class="clear frm_block"></li>'; |
|
76 | - continue; |
|
77 | - } |
|
78 | - ?> |
|
74 | + $col = 'one'; |
|
75 | + echo '<li class="clear frm_block"></li>'; |
|
76 | + continue; |
|
77 | + } |
|
78 | + ?> |
|
79 | 79 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
80 | 80 | <a href="javascript:void(0)" class="frmbutton button <?php |
81 | 81 | echo ( in_array( $skey, array( 'siteurl', 'sitename', 'entry_count' ) ) ) ? 'show_before_content show_after_content' : ''; |
82 | - echo ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : ''; |
|
83 | - ?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ) ?></a> |
|
82 | + echo ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : ''; |
|
83 | + ?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ) ?></a> |
|
84 | 84 | </li> |
85 | 85 | <?php |
86 | - $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
87 | - unset($skey, $sname); |
|
88 | - } |
|
89 | - ?> |
|
86 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
87 | + unset($skey, $sname); |
|
88 | + } |
|
89 | + ?> |
|
90 | 90 | </ul> |
91 | 91 | </div> |
92 | 92 | |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | <ul class="alignleft"><li><?php _e( 'Fields from your form', 'formidable' ) ?>:</li></ul> |
100 | 100 | <ul class="frm_code_list frm_full_width"> |
101 | 101 | <?php if ( ! empty( $fields ) ) { |
102 | - foreach ( $fields as $f ) { |
|
102 | + foreach ( $fields as $f ) { |
|
103 | 103 | if ( FrmField::is_no_save_field( $f->type ) || ( $f->type == 'data' && ( ! isset( $f->field_options['data_type'] ) || $f->field_options['data_type'] == 'data' || $f->field_options['data_type'] == '' ) ) ) { |
104 | - continue; |
|
105 | - } |
|
106 | - ?> |
|
104 | + continue; |
|
105 | + } |
|
106 | + ?> |
|
107 | 107 | <li> |
108 | 108 | <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a> |
109 | 109 | <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate($f->field_key, 10) ?>]</a> |
@@ -111,30 +111,30 @@ discard block |
||
111 | 111 | </li> |
112 | 112 | <?php |
113 | 113 | |
114 | - if ( $f->type == 'user_id' ) { |
|
115 | - $uid = $f; |
|
116 | - } else if ( $f->type == 'file' ) { |
|
117 | - $file = $f; |
|
118 | - } |
|
119 | - unset($f); |
|
120 | - } |
|
121 | - } ?> |
|
114 | + if ( $f->type == 'user_id' ) { |
|
115 | + $uid = $f; |
|
116 | + } else if ( $f->type == 'file' ) { |
|
117 | + $file = $f; |
|
118 | + } |
|
119 | + unset($f); |
|
120 | + } |
|
121 | + } ?> |
|
122 | 122 | </ul> |
123 | 123 | |
124 | 124 | <p class="howto"><?php _e( 'Click a button below to insert sample logic into your view', 'formidable' ) ?></p> |
125 | 125 | <ul class="frm_code_list"> |
126 | 126 | <?php |
127 | - $col = 'one'; |
|
127 | + $col = 'one'; |
|
128 | 128 | foreach ( $cond_shortcodes as $skey => $sname ) { |
129 | - ?> |
|
129 | + ?> |
|
130 | 130 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
131 | 131 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if 125 <?php echo esc_attr($skey) ?>][/if 125"><?php echo esc_html( $sname ) ?></a> |
132 | 132 | </li> |
133 | 133 | <?php |
134 | - $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
135 | - unset($skey, $sname); |
|
136 | - } |
|
137 | - ?> |
|
134 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
135 | + unset($skey, $sname); |
|
136 | + } |
|
137 | + ?> |
|
138 | 138 | </ul> |
139 | 139 | </div> |
140 | 140 | <?php } ?> |
@@ -142,17 +142,17 @@ discard block |
||
142 | 142 | <div id="frm-adv-info-tab" class="tabs-panel"> |
143 | 143 | <ul class="frm_code_list"> |
144 | 144 | <?php |
145 | - $col = 'one'; |
|
145 | + $col = 'one'; |
|
146 | 146 | foreach ( $adv_shortcodes as $skey => $sname ) { |
147 | - ?> |
|
147 | + ?> |
|
148 | 148 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
149 | 149 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="'. esc_attr( $sname['title'] ) .'"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
150 | 150 | </li> |
151 | 151 | <?php |
152 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
153 | - unset($skey, $sname); |
|
154 | - } |
|
155 | - ?> |
|
152 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
153 | + unset($skey, $sname); |
|
154 | + } |
|
155 | + ?> |
|
156 | 156 | <?php if ( isset($file) ) { ?> |
157 | 157 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
158 | 158 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a> |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | <div class="clear"></div> |
170 | 170 | <?php |
171 | 171 | |
172 | - if ( isset($uid) && ! empty($user_fields) ) { |
|
173 | - $col = 'one'; ?> |
|
172 | + if ( isset($uid) && ! empty($user_fields) ) { |
|
173 | + $col = 'one'; ?> |
|
174 | 174 | <p class="howto"><?php _e( 'Insert user information', 'formidable' ) ?></p> |
175 | 175 | <ul class="frm_code_list"> |
176 | 176 | <?php foreach ( $user_fields as $uk => $uf ) { ?> |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $uid->id . ' show="' . $uk . '"' ) ?>"><?php echo esc_html( $uf ) ?></a> |
179 | 179 | </li> |
180 | 180 | <?php |
181 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
182 | - unset($uf, $uk); |
|
183 | - } |
|
184 | - unset($uid); ?> |
|
181 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
182 | + unset($uf, $uk); |
|
183 | + } |
|
184 | + unset($uid); ?> |
|
185 | 185 | </ul> |
186 | 186 | <?php } |
187 | 187 | |
188 | - if ( isset($repeat_field) ) { ?> |
|
188 | + if ( isset($repeat_field) ) { ?> |
|
189 | 189 | <div class="clear"></div> |
190 | 190 | <p class="howto"><?php _e( 'Repeating field options', 'formidable' ) ?></p> |
191 | 191 | <ul class="frm_code_list"> |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | </li> |
195 | 195 | </ul> |
196 | 196 | <?php |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - if ( isset($dfe) ) { ?> |
|
199 | + if ( isset($dfe) ) { ?> |
|
200 | 200 | |
201 | 201 | <div class="clear"></div> |
202 | 202 | <p class="howto"><?php _e( 'Dynamic field options', 'formidable' ) ?></p> |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | </div> |
216 | 216 | |
217 | 217 | <?php |
218 | - if ( $settings_tab ) { |
|
219 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php'); |
|
220 | - } |
|
221 | - ?> |
|
218 | + if ( $settings_tab ) { |
|
219 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php'); |
|
220 | + } |
|
221 | + ?> |
|
222 | 222 | </div> |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | if ( $f->type == 'data' ) { |
44 | 44 | //get all fields from linked form |
45 | - if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) { |
|
46 | - $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
45 | + if ( isset( $f->field_options['form_select'] ) && is_numeric( $f->field_options['form_select'] ) ) { |
|
46 | + $linked_form = FrmDb::get_var( $wpdb->prefix . 'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
47 | 47 | if ( ! in_array( $linked_form, $linked_forms ) ) { |
48 | 48 | $linked_forms[] = $linked_form; |
49 | 49 | $linked_fields = FrmField::getAll( array( 'fi.type not' => FrmField::no_save_fields(), 'fi.form_id' => $linked_form ) ); |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) ); |
54 | 54 | |
55 | 55 | $ldfe = $linked_field->id; |
56 | - unset($linked_field); |
|
56 | + unset( $linked_field ); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | 61 | $dfe = $f->id; |
62 | 62 | } |
63 | - unset($f); |
|
63 | + unset( $f ); |
|
64 | 64 | } |
65 | 65 | } ?> |
66 | 66 | </ul> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | </li> |
85 | 85 | <?php |
86 | 86 | $col = ( $col == 'one' ) ? 'two' : 'one'; |
87 | - unset($skey, $sname); |
|
87 | + unset( $skey, $sname ); |
|
88 | 88 | } |
89 | 89 | ?> |
90 | 90 | </ul> |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | ?> |
107 | 107 | <li> |
108 | 108 | <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a> |
109 | - <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate($f->field_key, 10) ?>]</a> |
|
110 | - <a href="javascript:void(0)" class="frm_insert_code" data-code="<?php echo esc_attr($f->id) ?>"><?php echo FrmAppHelper::truncate($f->name, 60) ?></a> |
|
109 | + <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate( $f->field_key, 10 ) ?>]</a> |
|
110 | + <a href="javascript:void(0)" class="frm_insert_code" data-code="<?php echo esc_attr( $f->id ) ?>"><?php echo FrmAppHelper::truncate( $f->name, 60 ) ?></a> |
|
111 | 111 | </li> |
112 | 112 | <?php |
113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } else if ( $f->type == 'file' ) { |
117 | 117 | $file = $f; |
118 | 118 | } |
119 | - unset($f); |
|
119 | + unset( $f ); |
|
120 | 120 | } |
121 | 121 | } ?> |
122 | 122 | </ul> |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | foreach ( $cond_shortcodes as $skey => $sname ) { |
129 | 129 | ?> |
130 | 130 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
131 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if x <?php echo esc_attr($skey) ?>][/if x"><?php echo esc_html( $sname ) ?></a> |
|
131 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if x <?php echo esc_attr( $skey ) ?>][/if x"><?php echo esc_html( $sname ) ?></a> |
|
132 | 132 | </li> |
133 | 133 | <?php |
134 | 134 | $col = ( $col == 'one' ) ? 'two' : 'one'; |
135 | - unset($skey, $sname); |
|
135 | + unset( $skey, $sname ); |
|
136 | 136 | } |
137 | 137 | ?> |
138 | 138 | </ul> |
@@ -146,22 +146,22 @@ discard block |
||
146 | 146 | foreach ( $adv_shortcodes as $skey => $sname ) { |
147 | 147 | ?> |
148 | 148 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
149 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="'. esc_attr( $sname['title'] ) .'"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
|
149 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
|
150 | 150 | </li> |
151 | 151 | <?php |
152 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
153 | - unset($skey, $sname); |
|
152 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
153 | + unset( $skey, $sname ); |
|
154 | 154 | } |
155 | 155 | ?> |
156 | - <?php if ( isset($file) ) { ?> |
|
156 | + <?php if ( isset( $file ) ) { ?> |
|
157 | 157 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
158 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a> |
|
158 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a> |
|
159 | 159 | </li> |
160 | - <li class="frm_col_<?php echo $col = (($col == 'one') ? 'two' : 'one') ?>"> |
|
161 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> show=id"><?php _e( 'Image ID', 'formidable' ) ?></a> |
|
160 | + <li class="frm_col_<?php echo $col = ( ( $col == 'one' ) ? 'two' : 'one' ) ?>"> |
|
161 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> show=id"><?php _e( 'Image ID', 'formidable' ) ?></a> |
|
162 | 162 | </li> |
163 | - <li class="frm_col_<?php echo $col = (($col == 'one') ? 'two' : 'one') ?>"> |
|
164 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> show=label"><?php _e( 'Image Name', 'formidable' ) ?></a> |
|
163 | + <li class="frm_col_<?php echo $col = ( ( $col == 'one' ) ? 'two' : 'one' ) ?>"> |
|
164 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> show=label"><?php _e( 'Image Name', 'formidable' ) ?></a> |
|
165 | 165 | </li> |
166 | 166 | <?php } ?> |
167 | 167 | </ul> |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | <div class="clear"></div> |
170 | 170 | <?php |
171 | 171 | |
172 | - if ( isset($uid) && ! empty($user_fields) ) { |
|
172 | + if ( isset( $uid ) && ! empty( $user_fields ) ) { |
|
173 | 173 | $col = 'one'; ?> |
174 | 174 | <p class="howto"><?php _e( 'Insert user information', 'formidable' ) ?></p> |
175 | 175 | <ul class="frm_code_list"> |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $uid->id . ' show="' . $uk . '"' ) ?>"><?php echo esc_html( $uf ) ?></a> |
179 | 179 | </li> |
180 | 180 | <?php |
181 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
182 | - unset($uf, $uk); |
|
181 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
182 | + unset( $uf, $uk ); |
|
183 | 183 | } |
184 | - unset($uid); ?> |
|
184 | + unset( $uid ); ?> |
|
185 | 185 | </ul> |
186 | 186 | <?php } |
187 | 187 | |
188 | - if ( isset($repeat_field) ) { ?> |
|
188 | + if ( isset( $repeat_field ) ) { ?> |
|
189 | 189 | <div class="clear"></div> |
190 | 190 | <p class="howto"><?php _e( 'Repeating field options', 'formidable' ) ?></p> |
191 | 191 | <ul class="frm_code_list"> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | <?php |
197 | 197 | } |
198 | 198 | |
199 | - if ( isset($dfe) ) { ?> |
|
199 | + if ( isset( $dfe ) ) { ?> |
|
200 | 200 | |
201 | 201 | <div class="clear"></div> |
202 | 202 | <p class="howto"><?php _e( 'Dynamic field options', 'formidable' ) ?></p> |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | <li class="frm_col_one"> |
205 | 205 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $dfe . ' show="created-at"' ) ?>"><?php _e( 'Creation Date', 'formidable' ) ?></a> |
206 | 206 | </li> |
207 | - <?php if ( isset($ldfe) ) { ?> |
|
207 | + <?php if ( isset( $ldfe ) ) { ?> |
|
208 | 208 | <li class="frm_col_two"> |
209 | 209 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $dfe . ' show="' . $ldfe . '"' ) ?>"><?php _e( 'Field From Entry', 'formidable' ) ?></a> |
210 | 210 | </li> |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | <?php |
218 | 218 | if ( $settings_tab ) { |
219 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php'); |
|
219 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php' ); |
|
220 | 220 | } |
221 | 221 | ?> |
222 | 222 | </div> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class FrmCSVExportHelper{ |
|
3 | +class FrmCSVExportHelper { |
|
4 | 4 | protected static $separator = ', '; |
5 | 5 | protected static $column_separator = ','; |
6 | 6 | protected static $line_break = 'return'; |
@@ -235,50 +235,50 @@ discard block |
||
235 | 235 | return $line; |
236 | 236 | } |
237 | 237 | |
238 | - $convmap = false; |
|
238 | + $convmap = false; |
|
239 | 239 | |
240 | 240 | switch ( self::$to_encoding ) { |
241 | - case 'macintosh': |
|
241 | + case 'macintosh': |
|
242 | 242 | // this map was derived from the differences between the MacRoman and UTF-8 Charsets |
243 | 243 | // Reference: |
244 | 244 | // - http://www.alanwood.net/demos/macroman.html |
245 | - $convmap = array( |
|
246 | - 256, 304, 0, 0xffff, |
|
247 | - 306, 337, 0, 0xffff, |
|
248 | - 340, 375, 0, 0xffff, |
|
249 | - 377, 401, 0, 0xffff, |
|
250 | - 403, 709, 0, 0xffff, |
|
251 | - 712, 727, 0, 0xffff, |
|
252 | - 734, 936, 0, 0xffff, |
|
253 | - 938, 959, 0, 0xffff, |
|
254 | - 961, 8210, 0, 0xffff, |
|
255 | - 8213, 8215, 0, 0xffff, |
|
256 | - 8219, 8219, 0, 0xffff, |
|
257 | - 8227, 8229, 0, 0xffff, |
|
258 | - 8231, 8239, 0, 0xffff, |
|
259 | - 8241, 8248, 0, 0xffff, |
|
260 | - 8251, 8259, 0, 0xffff, |
|
261 | - 8261, 8363, 0, 0xffff, |
|
262 | - 8365, 8481, 0, 0xffff, |
|
263 | - 8483, 8705, 0, 0xffff, |
|
264 | - 8707, 8709, 0, 0xffff, |
|
265 | - 8711, 8718, 0, 0xffff, |
|
266 | - 8720, 8720, 0, 0xffff, |
|
267 | - 8722, 8729, 0, 0xffff, |
|
268 | - 8731, 8733, 0, 0xffff, |
|
269 | - 8735, 8746, 0, 0xffff, |
|
270 | - 8748, 8775, 0, 0xffff, |
|
271 | - 8777, 8799, 0, 0xffff, |
|
272 | - 8801, 8803, 0, 0xffff, |
|
273 | - 8806, 9673, 0, 0xffff, |
|
274 | - 9675, 63742, 0, 0xffff, |
|
275 | - 63744, 64256, 0, 0xffff, |
|
276 | - ); |
|
277 | - break; |
|
278 | - case 'ISO-8859-1': |
|
279 | - $convmap = array( 256, 10000, 0, 0xffff ); |
|
280 | - break; |
|
281 | - } |
|
245 | + $convmap = array( |
|
246 | + 256, 304, 0, 0xffff, |
|
247 | + 306, 337, 0, 0xffff, |
|
248 | + 340, 375, 0, 0xffff, |
|
249 | + 377, 401, 0, 0xffff, |
|
250 | + 403, 709, 0, 0xffff, |
|
251 | + 712, 727, 0, 0xffff, |
|
252 | + 734, 936, 0, 0xffff, |
|
253 | + 938, 959, 0, 0xffff, |
|
254 | + 961, 8210, 0, 0xffff, |
|
255 | + 8213, 8215, 0, 0xffff, |
|
256 | + 8219, 8219, 0, 0xffff, |
|
257 | + 8227, 8229, 0, 0xffff, |
|
258 | + 8231, 8239, 0, 0xffff, |
|
259 | + 8241, 8248, 0, 0xffff, |
|
260 | + 8251, 8259, 0, 0xffff, |
|
261 | + 8261, 8363, 0, 0xffff, |
|
262 | + 8365, 8481, 0, 0xffff, |
|
263 | + 8483, 8705, 0, 0xffff, |
|
264 | + 8707, 8709, 0, 0xffff, |
|
265 | + 8711, 8718, 0, 0xffff, |
|
266 | + 8720, 8720, 0, 0xffff, |
|
267 | + 8722, 8729, 0, 0xffff, |
|
268 | + 8731, 8733, 0, 0xffff, |
|
269 | + 8735, 8746, 0, 0xffff, |
|
270 | + 8748, 8775, 0, 0xffff, |
|
271 | + 8777, 8799, 0, 0xffff, |
|
272 | + 8801, 8803, 0, 0xffff, |
|
273 | + 8806, 9673, 0, 0xffff, |
|
274 | + 9675, 63742, 0, 0xffff, |
|
275 | + 63744, 64256, 0, 0xffff, |
|
276 | + ); |
|
277 | + break; |
|
278 | + case 'ISO-8859-1': |
|
279 | + $convmap = array( 256, 10000, 0, 0xffff ); |
|
280 | + break; |
|
281 | + } |
|
282 | 282 | |
283 | 283 | if ( is_array( $convmap ) ) { |
284 | 284 | $line = mb_encode_numericentity( $line, $convmap, self::$charset ); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | return self::escape_csv( $line ); |
292 | - } |
|
292 | + } |
|
293 | 293 | |
294 | 294 | /** |
295 | 295 | * Escape a " in a csv with another " |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class FrmCSVExportHelper{ |
|
3 | +class FrmCSVExportHelper { |
|
4 | 4 | protected static $separator = ', '; |
5 | 5 | protected static $column_separator = ','; |
6 | 6 | protected static $line_break = 'return'; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | header( 'Content-Description: File Transfer' ); |
64 | 64 | header( 'Content-Disposition: attachment; filename="' . esc_attr( $filename ) . '"' ); |
65 | 65 | header( 'Content-Type: text/csv; charset=' . self::$charset, true ); |
66 | - header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date('Y' ) ) ) . ' GMT' ); |
|
66 | + header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date( 'Y' ) ) ) . ' GMT' ); |
|
67 | 67 | header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); |
68 | 68 | header( 'Cache-Control: no-cache, must-revalidate' ); |
69 | 69 | header( 'Pragma: no-cache' ); |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | private static function csv_headings( &$headings ) { |
88 | 88 | foreach ( self::$fields as $col ) { |
89 | 89 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) { |
90 | - $headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
90 | + $headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
91 | 91 | } |
92 | 92 | |
93 | - $headings[ $col->id ] = strip_tags( $col->name ); |
|
93 | + $headings[$col->id] = strip_tags( $col->name ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | if ( self::$comment_count ) { |
97 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
98 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
99 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
100 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
97 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
98 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
99 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
100 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
101 | 101 | } |
102 | - unset($i); |
|
102 | + unset( $i ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $headings['created_at'] = __( 'Timestamp', 'formidable' ); |
@@ -146,45 +146,45 @@ discard block |
||
146 | 146 | continue; |
147 | 147 | } |
148 | 148 | |
149 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
150 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
151 | - } else if ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
149 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
150 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
151 | + } else if ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
152 | 152 | // if the data is here, it should be an array but if this field has collected data |
153 | 153 | // both while inside and outside of the repeating section, it's possible this is a string |
154 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
154 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | //add the repeated values |
158 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
158 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
159 | 159 | } |
160 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
160 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | // add the embedded form id |
164 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
165 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
164 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
165 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
166 | 166 | } |
167 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
167 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | private static function add_field_values_to_csv( &$row ) { |
171 | 171 | foreach ( self::$fields as $col ) { |
172 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
172 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
173 | 173 | |
174 | 174 | $field_value = maybe_unserialize( $field_value ); |
175 | - $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator, ) ); |
|
175 | + $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator,) ); |
|
176 | 176 | |
177 | 177 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] ) { |
178 | 178 | $sep_value = FrmEntriesHelper::display_value( $field_value, $col, array( |
179 | 179 | 'type' => $col->type, 'post_id' => self::$entry->post_id, 'show_icon' => false, |
180 | 180 | 'entry_id' => self::$entry->id, 'sep' => self::$separator, |
181 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
181 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
182 | 182 | ) ); |
183 | - $row[ $col->id . '_label' ] = $sep_value; |
|
183 | + $row[$col->id . '_label'] = $sep_value; |
|
184 | 184 | unset( $sep_value ); |
185 | 185 | } |
186 | 186 | |
187 | - $row[ $col->id ] = $field_value; |
|
187 | + $row[$col->id] = $field_value; |
|
188 | 188 | |
189 | 189 | unset( $col, $field_value ); |
190 | 190 | } |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | $col_count = count( $rows ); |
206 | 206 | $this_col = 0; |
207 | 207 | foreach ( $rows as $k => $row ) { |
208 | - $this_col++; |
|
208 | + $this_col ++; |
|
209 | 209 | |
210 | - if ( ! isset( self::$headings[ $k ] ) ) { |
|
210 | + if ( ! isset( self::$headings[$k] ) ) { |
|
211 | 211 | // this column has been removed from the csv, so skip it |
212 | 212 | continue; |
213 | 213 | } |
@@ -87,9 +87,9 @@ |
||
87 | 87 | } else if ( $form->is_template ) { |
88 | 88 | echo ' ' . __( '(template)', 'formidable' ); |
89 | 89 | } |
90 | - ?></option> |
|
90 | + ?></option> |
|
91 | 91 | <?php |
92 | - } ?> |
|
92 | + } ?> |
|
93 | 93 | </select> |
94 | 94 | <p class="howto"><?php _e( 'Hold down the CTRL/Command button to select multiple forms', 'formidable' ); ?></p> |
95 | 95 | </td> |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | <div class="frmicon icon32"><br/></div> |
3 | 3 | <h2><?php _e( 'Import/Export', 'formidable' ); ?></h2> |
4 | 4 | |
5 | - <?php include(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php'); ?> |
|
5 | + <?php include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
|
6 | 6 | <div id="poststuff" class="metabox-holder"> |
7 | 7 | <div id="post-body"> |
8 | 8 | <div id="post-body-content"> |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | <div class="postbox "> |
11 | 11 | <h3 class="hndle"><span><?php _e( 'Import', 'formidable' ) ?></span></h3> |
12 | 12 | <div class="inside"> |
13 | - <p class="howto"><?php echo apply_filters('frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' )) ?></p> |
|
13 | + <p class="howto"><?php echo apply_filters( 'frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' ) ) ?></p> |
|
14 | 14 | <br/> |
15 | 15 | <form enctype="multipart/form-data" method="post"> |
16 | 16 | <input type="hidden" name="frm_action" value="import_xml" /> |
17 | - <?php wp_nonce_field('import-xml-nonce', 'import-xml'); ?> |
|
18 | - <p><label><?php echo apply_filters('frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' )) ?> (<?php printf(__( 'Maximum size: %s', 'formidable' ), ini_get('upload_max_filesize')) ?>)</label> |
|
17 | + <?php wp_nonce_field( 'import-xml-nonce', 'import-xml' ); ?> |
|
18 | + <p><label><?php echo apply_filters( 'frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' ) ) ?> (<?php printf( __( 'Maximum size: %s', 'formidable' ), ini_get( 'upload_max_filesize' ) ) ?>)</label> |
|
19 | 19 | <input type="file" name="frm_import_file" size="25" /> |
20 | 20 | </p> |
21 | 21 | |
22 | - <?php do_action('frm_csv_opts', $forms) ?> |
|
22 | + <?php do_action( 'frm_csv_opts', $forms ) ?> |
|
23 | 23 | |
24 | 24 | <p class="submit"> |
25 | 25 | <input type="submit" value="<?php esc_attr_e( 'Upload file and import', 'formidable' ) ?>" class="button-primary" /> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <div class="inside with_frm_style"> |
35 | 35 | <form method="post" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" id="frm_export_xml"> |
36 | 36 | <input type="hidden" name="action" value="frm_export_xml" /> |
37 | - <?php wp_nonce_field('export-xml-nonce', 'export-xml'); ?> |
|
37 | + <?php wp_nonce_field( 'export-xml-nonce', 'export-xml' ); ?> |
|
38 | 38 | |
39 | 39 | <table class="form-table"> |
40 | 40 | <tr class="form-field"> |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | <td> |
43 | 43 | <select name="format"> |
44 | 44 | <?php foreach ( $export_format as $t => $type ) { ?> |
45 | - <option value="<?php echo esc_attr( $t ) ?>" data-support="<?php echo esc_attr( $type['support'] ) ?>" <?php echo isset( $type['count'] ) ? 'data-count="'. esc_attr( $type['count'] ) .'"' : ''; ?>><?php echo isset( $type['name'] ) ? $type['name'] : $t ?></option> |
|
45 | + <option value="<?php echo esc_attr( $t ) ?>" data-support="<?php echo esc_attr( $type['support'] ) ?>" <?php echo isset( $type['count'] ) ? 'data-count="' . esc_attr( $type['count'] ) . '"' : ''; ?>><?php echo isset( $type['name'] ) ? $type['name'] : $t ?></option> |
|
46 | 46 | <?php } ?> |
47 | 47 | </select> |
48 | 48 |
@@ -2,110 +2,110 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmXMLController { |
4 | 4 | |
5 | - public static function menu() { |
|
6 | - add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
7 | - } |
|
5 | + public static function menu() { |
|
6 | + add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
7 | + } |
|
8 | 8 | |
9 | - public static function add_default_templates() { |
|
9 | + public static function add_default_templates() { |
|
10 | 10 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
11 | - // XML import is not enabled on your server |
|
12 | - return; |
|
13 | - } |
|
11 | + // XML import is not enabled on your server |
|
12 | + return; |
|
13 | + } |
|
14 | 14 | |
15 | - $set_err = libxml_use_internal_errors(true); |
|
16 | - $loader = libxml_disable_entity_loader( true ); |
|
15 | + $set_err = libxml_use_internal_errors(true); |
|
16 | + $loader = libxml_disable_entity_loader( true ); |
|
17 | 17 | |
18 | 18 | $files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) ); |
19 | 19 | |
20 | - foreach ( (array) $files as $file ) { |
|
21 | - FrmXMLHelper::import_xml($file); |
|
22 | - unset($file); |
|
23 | - } |
|
24 | - /* |
|
20 | + foreach ( (array) $files as $file ) { |
|
21 | + FrmXMLHelper::import_xml($file); |
|
22 | + unset($file); |
|
23 | + } |
|
24 | + /* |
|
25 | 25 | if(is_wp_error($result)) |
26 | 26 | $errors[] = $result->get_error_message(); |
27 | 27 | else if($result) |
28 | 28 | $message = $result; |
29 | 29 | */ |
30 | 30 | |
31 | - unset( $files ); |
|
31 | + unset( $files ); |
|
32 | 32 | |
33 | - libxml_use_internal_errors( $set_err ); |
|
34 | - libxml_disable_entity_loader( $loader ); |
|
35 | - } |
|
33 | + libxml_use_internal_errors( $set_err ); |
|
34 | + libxml_disable_entity_loader( $loader ); |
|
35 | + } |
|
36 | 36 | |
37 | - public static function route() { |
|
38 | - $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
37 | + public static function route() { |
|
38 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
39 | 39 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
40 | 40 | if ( $action == 'import_xml' ) { |
41 | - return self::import_xml(); |
|
41 | + return self::import_xml(); |
|
42 | 42 | } else if ( $action == 'export_xml' ) { |
43 | - return self::export_xml(); |
|
44 | - } else { |
|
45 | - if ( apply_filters( 'frm_xml_route', true, $action ) ) { |
|
46 | - return self::form(); |
|
47 | - } |
|
48 | - } |
|
49 | - } |
|
50 | - |
|
51 | - public static function form( $errors = array(), $message = '' ) { |
|
43 | + return self::export_xml(); |
|
44 | + } else { |
|
45 | + if ( apply_filters( 'frm_xml_route', true, $action ) ) { |
|
46 | + return self::form(); |
|
47 | + } |
|
48 | + } |
|
49 | + } |
|
50 | + |
|
51 | + public static function form( $errors = array(), $message = '' ) { |
|
52 | 52 | $where = array( |
53 | 53 | 'parent_form_id' => array( null, 0 ), |
54 | 54 | 'status' => array( null, '', 'published' ) |
55 | 55 | ); |
56 | 56 | $forms = FrmForm::getAll( $where, 'name' ); |
57 | 57 | |
58 | - $export_types = apply_filters( 'frm_xml_export_types', |
|
59 | - array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) ) |
|
60 | - ); |
|
58 | + $export_types = apply_filters( 'frm_xml_export_types', |
|
59 | + array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) ) |
|
60 | + ); |
|
61 | 61 | |
62 | - $export_format = apply_filters( 'frm_export_formats', array( |
|
63 | - 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
|
62 | + $export_format = apply_filters( 'frm_export_formats', array( |
|
63 | + 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
|
64 | 64 | 'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ), |
65 | - ) ); |
|
65 | + ) ); |
|
66 | 66 | |
67 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
68 | - } |
|
67 | + include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
68 | + } |
|
69 | 69 | |
70 | - public static function import_xml() { |
|
71 | - $errors = array(); |
|
72 | - $message = ''; |
|
70 | + public static function import_xml() { |
|
71 | + $errors = array(); |
|
72 | + $message = ''; |
|
73 | 73 | |
74 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
75 | - if ( $permission_error !== false ) { |
|
76 | - $errors[] = $permission_error; |
|
77 | - self::form($errors); |
|
78 | - return; |
|
79 | - } |
|
74 | + $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
75 | + if ( $permission_error !== false ) { |
|
76 | + $errors[] = $permission_error; |
|
77 | + self::form($errors); |
|
78 | + return; |
|
79 | + } |
|
80 | 80 | |
81 | - if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
82 | - $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
|
83 | - self::form($errors); |
|
84 | - return; |
|
85 | - } |
|
81 | + if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
82 | + $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
|
83 | + self::form($errors); |
|
84 | + return; |
|
85 | + } |
|
86 | 86 | |
87 | - $file = $_FILES['frm_import_file']['tmp_name']; |
|
87 | + $file = $_FILES['frm_import_file']['tmp_name']; |
|
88 | 88 | |
89 | - if ( ! is_uploaded_file( $file ) ) { |
|
90 | - unset($file); |
|
91 | - $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
|
92 | - self::form($errors); |
|
93 | - return; |
|
94 | - } |
|
89 | + if ( ! is_uploaded_file( $file ) ) { |
|
90 | + unset($file); |
|
91 | + $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
|
92 | + self::form($errors); |
|
93 | + return; |
|
94 | + } |
|
95 | 95 | |
96 | - //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
|
96 | + //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
|
97 | 97 | |
98 | - $export_format = apply_filters('frm_export_formats', array( |
|
98 | + $export_format = apply_filters('frm_export_formats', array( |
|
99 | 99 | 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
100 | 100 | ) ); |
101 | 101 | |
102 | - $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
103 | - if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
104 | - // allow other file types to be imported |
|
105 | - do_action('frm_before_import_'. $file_type ); |
|
106 | - return; |
|
107 | - } |
|
108 | - unset($file_type); |
|
102 | + $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
103 | + if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
104 | + // allow other file types to be imported |
|
105 | + do_action('frm_before_import_'. $file_type ); |
|
106 | + return; |
|
107 | + } |
|
108 | + unset($file_type); |
|
109 | 109 | |
110 | 110 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
111 | 111 | $errors[] = __( 'XML import is not enabled on your server.', 'formidable' ); |
@@ -124,148 +124,148 @@ discard block |
||
124 | 124 | libxml_use_internal_errors( $set_err ); |
125 | 125 | libxml_disable_entity_loader( $loader ); |
126 | 126 | |
127 | - self::form($errors, $message); |
|
128 | - } |
|
127 | + self::form($errors, $message); |
|
128 | + } |
|
129 | 129 | |
130 | - public static function export_xml() { |
|
131 | - $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
|
132 | - if ( ! empty($error) ) { |
|
133 | - wp_die( $error ); |
|
134 | - } |
|
130 | + public static function export_xml() { |
|
131 | + $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
|
132 | + if ( ! empty($error) ) { |
|
133 | + wp_die( $error ); |
|
134 | + } |
|
135 | 135 | |
136 | 136 | $ids = FrmAppHelper::get_post_param( 'frm_export_forms', array() ); |
137 | 137 | $type = FrmAppHelper::get_post_param( 'type', array() ); |
138 | 138 | $format = FrmAppHelper::get_post_param( 'format', 'xml', 'sanitize_title' ); |
139 | 139 | |
140 | - if ( ! headers_sent() && ! $type ) { |
|
141 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) ); |
|
142 | - die(); |
|
143 | - } |
|
140 | + if ( ! headers_sent() && ! $type ) { |
|
141 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) ); |
|
142 | + die(); |
|
143 | + } |
|
144 | 144 | |
145 | - if ( $format == 'xml' ) { |
|
146 | - self::generate_xml($type, compact('ids')); |
|
145 | + if ( $format == 'xml' ) { |
|
146 | + self::generate_xml($type, compact('ids')); |
|
147 | 147 | } if ( $format == 'csv' ) { |
148 | 148 | self::generate_csv( compact('ids') ); |
149 | - } else { |
|
150 | - do_action('frm_export_format_'. $format, compact('ids')); |
|
151 | - } |
|
149 | + } else { |
|
150 | + do_action('frm_export_format_'. $format, compact('ids')); |
|
151 | + } |
|
152 | 152 | |
153 | - wp_die(); |
|
154 | - } |
|
153 | + wp_die(); |
|
154 | + } |
|
155 | 155 | |
156 | 156 | public static function generate_xml( $type, $args = array() ) { |
157 | - global $wpdb; |
|
158 | - |
|
159 | - $type = (array) $type; |
|
160 | - if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
161 | - // make sure the form is included if there are entries |
|
162 | - $type[] = 'forms'; |
|
163 | - } |
|
164 | - |
|
165 | - if ( in_array( 'forms', $type) ) { |
|
166 | - // include actions with forms |
|
167 | - $type[] = 'actions'; |
|
168 | - } |
|
169 | - |
|
170 | - $tables = array( |
|
171 | - 'items' => $wpdb->prefix .'frm_items', |
|
172 | - 'forms' => $wpdb->prefix .'frm_forms', |
|
173 | - 'posts' => $wpdb->posts, |
|
174 | - 'styles' => $wpdb->posts, |
|
175 | - 'actions' => $wpdb->posts, |
|
176 | - ); |
|
157 | + global $wpdb; |
|
158 | + |
|
159 | + $type = (array) $type; |
|
160 | + if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
161 | + // make sure the form is included if there are entries |
|
162 | + $type[] = 'forms'; |
|
163 | + } |
|
164 | + |
|
165 | + if ( in_array( 'forms', $type) ) { |
|
166 | + // include actions with forms |
|
167 | + $type[] = 'actions'; |
|
168 | + } |
|
169 | + |
|
170 | + $tables = array( |
|
171 | + 'items' => $wpdb->prefix .'frm_items', |
|
172 | + 'forms' => $wpdb->prefix .'frm_forms', |
|
173 | + 'posts' => $wpdb->posts, |
|
174 | + 'styles' => $wpdb->posts, |
|
175 | + 'actions' => $wpdb->posts, |
|
176 | + ); |
|
177 | 177 | |
178 | 178 | $defaults = array( 'ids' => false ); |
179 | - $args = wp_parse_args( $args, $defaults ); |
|
179 | + $args = wp_parse_args( $args, $defaults ); |
|
180 | 180 | |
181 | - $sitename = sanitize_key( get_bloginfo( 'name' ) ); |
|
181 | + $sitename = sanitize_key( get_bloginfo( 'name' ) ); |
|
182 | 182 | |
183 | - if ( ! empty( $sitename ) ) { |
|
183 | + if ( ! empty( $sitename ) ) { |
|
184 | 184 | $sitename .= '.'; |
185 | 185 | } |
186 | - $filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml'; |
|
186 | + $filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml'; |
|
187 | 187 | |
188 | - header( 'Content-Description: File Transfer' ); |
|
189 | - header( 'Content-Disposition: attachment; filename=' . $filename ); |
|
190 | - header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
|
188 | + header( 'Content-Description: File Transfer' ); |
|
189 | + header( 'Content-Disposition: attachment; filename=' . $filename ); |
|
190 | + header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
|
191 | 191 | |
192 | - //make sure ids are numeric |
|
193 | - if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) { |
|
194 | - $args['ids'] = array_filter( $args['ids'], 'is_numeric' ); |
|
195 | - } |
|
192 | + //make sure ids are numeric |
|
193 | + if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) { |
|
194 | + $args['ids'] = array_filter( $args['ids'], 'is_numeric' ); |
|
195 | + } |
|
196 | 196 | |
197 | - $records = array(); |
|
197 | + $records = array(); |
|
198 | 198 | |
199 | 199 | foreach ( $type as $tb_type ) { |
200 | - $where = array(); |
|
200 | + $where = array(); |
|
201 | 201 | $join = ''; |
202 | - $table = $tables[ $tb_type ]; |
|
202 | + $table = $tables[ $tb_type ]; |
|
203 | 203 | |
204 | - $select = $table .'.id'; |
|
205 | - $query_vars = array(); |
|
204 | + $select = $table .'.id'; |
|
205 | + $query_vars = array(); |
|
206 | 206 | |
207 | - switch ( $tb_type ) { |
|
208 | - case 'forms': |
|
209 | - //add forms |
|
210 | - if ( $args['ids'] ) { |
|
207 | + switch ( $tb_type ) { |
|
208 | + case 'forms': |
|
209 | + //add forms |
|
210 | + if ( $args['ids'] ) { |
|
211 | 211 | $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] ); |
212 | - } else { |
|
212 | + } else { |
|
213 | 213 | $where[ $table . '.status !' ] = 'draft'; |
214 | - } |
|
215 | - break; |
|
216 | - case 'actions': |
|
217 | - $select = $table .'.ID'; |
|
214 | + } |
|
215 | + break; |
|
216 | + case 'actions': |
|
217 | + $select = $table .'.ID'; |
|
218 | 218 | $where['post_type'] = FrmFormActionsController::$action_post_type; |
219 | - if ( ! empty($args['ids']) ) { |
|
219 | + if ( ! empty($args['ids']) ) { |
|
220 | 220 | $where['menu_order'] = $args['ids']; |
221 | - } |
|
222 | - break; |
|
223 | - case 'items': |
|
224 | - //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
|
225 | - if ( $args['ids'] ) { |
|
221 | + } |
|
222 | + break; |
|
223 | + case 'items': |
|
224 | + //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
|
225 | + if ( $args['ids'] ) { |
|
226 | 226 | $where[ $table . '.form_id' ] = $args['ids']; |
227 | - } |
|
228 | - break; |
|
229 | - case 'styles': |
|
230 | - // Loop through all exported forms and get their selected style IDs |
|
231 | - $form_ids = $args['ids']; |
|
232 | - $style_ids = array(); |
|
233 | - foreach ( $form_ids as $form_id ) { |
|
234 | - $form_data = FrmForm::getOne( $form_id ); |
|
235 | - // For forms that have not been updated while running 2.0, check if custom_style is set |
|
236 | - if ( isset( $form_data->options['custom_style'] ) ) { |
|
237 | - $style_ids[] = $form_data->options['custom_style']; |
|
238 | - } |
|
239 | - unset( $form_id, $form_data ); |
|
240 | - } |
|
241 | - $select = $table .'.ID'; |
|
242 | - $where['post_type'] = 'frm_styles'; |
|
243 | - |
|
244 | - // Only export selected styles |
|
245 | - if ( ! empty( $style_ids ) ) { |
|
246 | - $where['ID'] = $style_ids; |
|
247 | - } |
|
248 | - break; |
|
249 | - default: |
|
250 | - $select = $table .'.ID'; |
|
251 | - $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
|
252 | - $where['pm.meta_key'] = 'frm_form_id'; |
|
253 | - |
|
254 | - if ( empty($args['ids']) ) { |
|
255 | - $where['pm.meta_value >'] = 1; |
|
256 | - } else { |
|
257 | - $where['pm.meta_value'] = $args['ids']; |
|
258 | - } |
|
259 | - break; |
|
260 | - } |
|
227 | + } |
|
228 | + break; |
|
229 | + case 'styles': |
|
230 | + // Loop through all exported forms and get their selected style IDs |
|
231 | + $form_ids = $args['ids']; |
|
232 | + $style_ids = array(); |
|
233 | + foreach ( $form_ids as $form_id ) { |
|
234 | + $form_data = FrmForm::getOne( $form_id ); |
|
235 | + // For forms that have not been updated while running 2.0, check if custom_style is set |
|
236 | + if ( isset( $form_data->options['custom_style'] ) ) { |
|
237 | + $style_ids[] = $form_data->options['custom_style']; |
|
238 | + } |
|
239 | + unset( $form_id, $form_data ); |
|
240 | + } |
|
241 | + $select = $table .'.ID'; |
|
242 | + $where['post_type'] = 'frm_styles'; |
|
243 | + |
|
244 | + // Only export selected styles |
|
245 | + if ( ! empty( $style_ids ) ) { |
|
246 | + $where['ID'] = $style_ids; |
|
247 | + } |
|
248 | + break; |
|
249 | + default: |
|
250 | + $select = $table .'.ID'; |
|
251 | + $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
|
252 | + $where['pm.meta_key'] = 'frm_form_id'; |
|
253 | + |
|
254 | + if ( empty($args['ids']) ) { |
|
255 | + $where['pm.meta_value >'] = 1; |
|
256 | + } else { |
|
257 | + $where['pm.meta_value'] = $args['ids']; |
|
258 | + } |
|
259 | + break; |
|
260 | + } |
|
261 | 261 | |
262 | 262 | $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
263 | - unset($tb_type); |
|
264 | - } |
|
263 | + unset($tb_type); |
|
264 | + } |
|
265 | 265 | |
266 | 266 | echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n"; |
267 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
268 | - } |
|
267 | + include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
268 | + } |
|
269 | 269 | |
270 | 270 | |
271 | 271 | public static function generate_csv( $atts ) { |
@@ -336,14 +336,14 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
339 | - * Get the fields that should be included in the CSV export |
|
340 | - * |
|
341 | - * @since 2.0.19 |
|
342 | - * |
|
343 | - * @param int $form_id |
|
344 | - * @param object $form |
|
345 | - * @return array $csv_fields |
|
346 | - */ |
|
339 | + * Get the fields that should be included in the CSV export |
|
340 | + * |
|
341 | + * @since 2.0.19 |
|
342 | + * |
|
343 | + * @param int $form_id |
|
344 | + * @param object $form |
|
345 | + * @return array $csv_fields |
|
346 | + */ |
|
347 | 347 | private static function get_fields_for_csv_export( $form_id, $form ) { |
348 | 348 | $csv_field_ids = apply_filters( 'frm_csv_field_ids', '', $form_id, array( 'form' => $form ) ); |
349 | 349 | |
@@ -371,16 +371,16 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | public static function allow_mime( $mimes ) { |
374 | - if ( ! isset( $mimes['csv'] ) ) { |
|
375 | - // allow csv files |
|
376 | - $mimes['csv'] = 'text/csv'; |
|
377 | - } |
|
378 | - |
|
379 | - if ( ! isset( $mimes['xml'] ) ) { |
|
380 | - // allow xml |
|
381 | - $mimes['xml'] = 'text/xml'; |
|
382 | - } |
|
383 | - |
|
384 | - return $mimes; |
|
385 | - } |
|
374 | + if ( ! isset( $mimes['csv'] ) ) { |
|
375 | + // allow csv files |
|
376 | + $mimes['csv'] = 'text/csv'; |
|
377 | + } |
|
378 | + |
|
379 | + if ( ! isset( $mimes['xml'] ) ) { |
|
380 | + // allow xml |
|
381 | + $mimes['xml'] = 'text/xml'; |
|
382 | + } |
|
383 | + |
|
384 | + return $mimes; |
|
385 | + } |
|
386 | 386 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | class FrmXMLController { |
4 | 4 | |
5 | 5 | public static function menu() { |
6 | - add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
6 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' ); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | public static function add_default_templates() { |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | return; |
13 | 13 | } |
14 | 14 | |
15 | - $set_err = libxml_use_internal_errors(true); |
|
15 | + $set_err = libxml_use_internal_errors( true ); |
|
16 | 16 | $loader = libxml_disable_entity_loader( true ); |
17 | 17 | |
18 | 18 | $files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) ); |
19 | 19 | |
20 | 20 | foreach ( (array) $files as $file ) { |
21 | - FrmXMLHelper::import_xml($file); |
|
22 | - unset($file); |
|
21 | + FrmXMLHelper::import_xml( $file ); |
|
22 | + unset( $file ); |
|
23 | 23 | } |
24 | 24 | /* |
25 | 25 | if(is_wp_error($result)) |
@@ -64,48 +64,48 @@ discard block |
||
64 | 64 | 'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ), |
65 | 65 | ) ); |
66 | 66 | |
67 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
67 | + include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public static function import_xml() { |
71 | 71 | $errors = array(); |
72 | 72 | $message = ''; |
73 | 73 | |
74 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
74 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' ); |
|
75 | 75 | if ( $permission_error !== false ) { |
76 | 76 | $errors[] = $permission_error; |
77 | - self::form($errors); |
|
77 | + self::form( $errors ); |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
81 | + if ( ! isset( $_FILES ) || ! isset( $_FILES['frm_import_file'] ) || empty( $_FILES['frm_import_file']['name'] ) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
82 | 82 | $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
83 | - self::form($errors); |
|
83 | + self::form( $errors ); |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
87 | 87 | $file = $_FILES['frm_import_file']['tmp_name']; |
88 | 88 | |
89 | 89 | if ( ! is_uploaded_file( $file ) ) { |
90 | - unset($file); |
|
90 | + unset( $file ); |
|
91 | 91 | $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
92 | - self::form($errors); |
|
92 | + self::form( $errors ); |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | 96 | //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
97 | 97 | |
98 | - $export_format = apply_filters('frm_export_formats', array( |
|
98 | + $export_format = apply_filters( 'frm_export_formats', array( |
|
99 | 99 | 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
100 | 100 | ) ); |
101 | 101 | |
102 | - $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
103 | - if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
102 | + $file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) ); |
|
103 | + if ( $file_type != 'xml' && isset( $export_format[$file_type] ) ) { |
|
104 | 104 | // allow other file types to be imported |
105 | - do_action('frm_before_import_'. $file_type ); |
|
105 | + do_action( 'frm_before_import_' . $file_type ); |
|
106 | 106 | return; |
107 | 107 | } |
108 | - unset($file_type); |
|
108 | + unset( $file_type ); |
|
109 | 109 | |
110 | 110 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
111 | 111 | $errors[] = __( 'XML import is not enabled on your server.', 'formidable' ); |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | libxml_use_internal_errors( $set_err ); |
125 | 125 | libxml_disable_entity_loader( $loader ); |
126 | 126 | |
127 | - self::form($errors, $message); |
|
127 | + self::form( $errors, $message ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | public static function export_xml() { |
131 | 131 | $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
132 | - if ( ! empty($error) ) { |
|
132 | + if ( ! empty( $error ) ) { |
|
133 | 133 | wp_die( $error ); |
134 | 134 | } |
135 | 135 | |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | if ( $format == 'xml' ) { |
146 | - self::generate_xml($type, compact('ids')); |
|
146 | + self::generate_xml( $type, compact( 'ids' ) ); |
|
147 | 147 | } if ( $format == 'csv' ) { |
148 | - self::generate_csv( compact('ids') ); |
|
148 | + self::generate_csv( compact( 'ids' ) ); |
|
149 | 149 | } else { |
150 | - do_action('frm_export_format_'. $format, compact('ids')); |
|
150 | + do_action( 'frm_export_format_' . $format, compact( 'ids' ) ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | wp_die(); |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | global $wpdb; |
158 | 158 | |
159 | 159 | $type = (array) $type; |
160 | - if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
160 | + if ( in_array( 'items', $type ) && ! in_array( 'forms', $type ) ) { |
|
161 | 161 | // make sure the form is included if there are entries |
162 | 162 | $type[] = 'forms'; |
163 | 163 | } |
164 | 164 | |
165 | - if ( in_array( 'forms', $type) ) { |
|
165 | + if ( in_array( 'forms', $type ) ) { |
|
166 | 166 | // include actions with forms |
167 | 167 | $type[] = 'actions'; |
168 | 168 | } |
169 | 169 | |
170 | 170 | $tables = array( |
171 | - 'items' => $wpdb->prefix .'frm_items', |
|
172 | - 'forms' => $wpdb->prefix .'frm_forms', |
|
171 | + 'items' => $wpdb->prefix . 'frm_items', |
|
172 | + 'forms' => $wpdb->prefix . 'frm_forms', |
|
173 | 173 | 'posts' => $wpdb->posts, |
174 | 174 | 'styles' => $wpdb->posts, |
175 | 175 | 'actions' => $wpdb->posts, |
@@ -199,31 +199,31 @@ discard block |
||
199 | 199 | foreach ( $type as $tb_type ) { |
200 | 200 | $where = array(); |
201 | 201 | $join = ''; |
202 | - $table = $tables[ $tb_type ]; |
|
202 | + $table = $tables[$tb_type]; |
|
203 | 203 | |
204 | - $select = $table .'.id'; |
|
204 | + $select = $table . '.id'; |
|
205 | 205 | $query_vars = array(); |
206 | 206 | |
207 | 207 | switch ( $tb_type ) { |
208 | 208 | case 'forms': |
209 | 209 | //add forms |
210 | 210 | if ( $args['ids'] ) { |
211 | - $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] ); |
|
211 | + $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] ); |
|
212 | 212 | } else { |
213 | - $where[ $table . '.status !' ] = 'draft'; |
|
213 | + $where[$table . '.status !'] = 'draft'; |
|
214 | 214 | } |
215 | 215 | break; |
216 | 216 | case 'actions': |
217 | - $select = $table .'.ID'; |
|
217 | + $select = $table . '.ID'; |
|
218 | 218 | $where['post_type'] = FrmFormActionsController::$action_post_type; |
219 | - if ( ! empty($args['ids']) ) { |
|
219 | + if ( ! empty( $args['ids'] ) ) { |
|
220 | 220 | $where['menu_order'] = $args['ids']; |
221 | 221 | } |
222 | 222 | break; |
223 | 223 | case 'items': |
224 | 224 | //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
225 | 225 | if ( $args['ids'] ) { |
226 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
226 | + $where[$table . '.form_id'] = $args['ids']; |
|
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'styles': |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | unset( $form_id, $form_data ); |
240 | 240 | } |
241 | - $select = $table .'.ID'; |
|
241 | + $select = $table . '.ID'; |
|
242 | 242 | $where['post_type'] = 'frm_styles'; |
243 | 243 | |
244 | 244 | // Only export selected styles |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | } |
248 | 248 | break; |
249 | 249 | default: |
250 | - $select = $table .'.ID'; |
|
250 | + $select = $table . '.ID'; |
|
251 | 251 | $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
252 | 252 | $where['pm.meta_key'] = 'frm_form_id'; |
253 | 253 | |
254 | - if ( empty($args['ids']) ) { |
|
254 | + if ( empty( $args['ids'] ) ) { |
|
255 | 255 | $where['pm.meta_value >'] = 1; |
256 | 256 | } else { |
257 | 257 | $where['pm.meta_value'] = $args['ids']; |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | break; |
260 | 260 | } |
261 | 261 | |
262 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
263 | - unset($tb_type); |
|
262 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
263 | + unset( $tb_type ); |
|
264 | 264 | } |
265 | 265 | |
266 | - echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n"; |
|
267 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
266 | + echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n"; |
|
267 | + include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' ); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | $fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' ); |
290 | 290 | } |
291 | 291 | |
292 | - if ( ! ini_get('safe_mode') ) { |
|
293 | - set_time_limit(0); //Remove time limit to execute this function |
|
294 | - $mem_limit = str_replace('M', '', ini_get('memory_limit')); |
|
292 | + if ( ! ini_get( 'safe_mode' ) ) { |
|
293 | + set_time_limit( 0 ); //Remove time limit to execute this function |
|
294 | + $mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) ); |
|
295 | 295 | if ( (int) $mem_limit < 256 ) { |
296 | - ini_set('memory_limit', '256M'); |
|
296 | + ini_set( 'memory_limit', '256M' ); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | */ |
324 | 324 | $query = apply_filters( 'frm_csv_where', $query, compact( 'form_id', 'search', 'fid', 'item_id' ) ); |
325 | 325 | |
326 | - $entry_ids = FrmDb::get_col( $wpdb->prefix .'frm_items it', $query ); |
|
326 | + $entry_ids = FrmDb::get_col( $wpdb->prefix . 'frm_items it', $query ); |
|
327 | 327 | unset( $query ); |
328 | 328 | |
329 | 329 | if ( empty( $entry_ids ) ) { |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | if ( ! is_array( $csv_field_ids ) ) { |
354 | 354 | $csv_field_ids = explode( ',', $csv_field_ids ); |
355 | 355 | } |
356 | - if ( ! empty( $csv_field_ids ) ) { |
|
356 | + if ( ! empty( $csv_field_ids ) ) { |
|
357 | 357 | $where['fi.id'] = $csv_field_ids; |
358 | 358 | } |
359 | 359 | $csv_fields = FrmField::getAll( $where, 'field_order' ); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $no_export_fields = FrmField::no_save_fields(); |
363 | 363 | foreach ( $csv_fields as $k => $f ) { |
364 | 364 | if ( in_array( $f->type, $no_export_fields ) ) { |
365 | - unset( $csv_fields[ $k ] ); |
|
365 | + unset( $csv_fields[$k] ); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | } |
@@ -353,7 +353,7 @@ |
||
353 | 353 | if ( ! is_array( $csv_field_ids ) ) { |
354 | 354 | $csv_field_ids = explode( ',', $csv_field_ids ); |
355 | 355 | } |
356 | - if ( ! empty( $csv_field_ids ) ) { |
|
356 | + if ( ! empty( $csv_field_ids ) ) { |
|
357 | 357 | $where['fi.id'] = $csv_field_ids; |
358 | 358 | } |
359 | 359 | $csv_fields = FrmField::getAll( $where, 'field_order' ); |
@@ -45,7 +45,7 @@ |
||
45 | 45 | /** |
46 | 46 | * Get the singleton instance of this class |
47 | 47 | * |
48 | - * @return object |
|
48 | + * @return FrmPointers |
|
49 | 49 | */ |
50 | 50 | public static function get_instance() { |
51 | 51 | if ( ! ( self::$instance instanceof self ) ) { |
@@ -184,7 +184,7 @@ |
||
184 | 184 | private function do_page_pointer( $page ) { |
185 | 185 | $selector = 'h2'; |
186 | 186 | |
187 | - $pointer = call_user_func( array( $this, $this->admin_pages[ $page ] ) ); |
|
187 | + $pointer = call_user_func( array( $this, $this->admin_pages[$page] ) ); |
|
188 | 188 | |
189 | 189 | $opt_arr = array( |
190 | 190 | 'content' => $pointer['content'], |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $selector = 'li.toplevel_page_formidable'; |
166 | 166 | |
167 | 167 | $content = '<h3>' . __( 'Congratulations!', 'formidable' ) . '</h3>' |
168 | - .'<p>' . $this->opening_line() . ' ' . sprintf( __( 'Click “Start Tour” to view a quick introduction of this plugin’s core functionality.' ), 'formidable' ) . '</p>'; |
|
168 | + .'<p>' . $this->opening_line() . ' ' . sprintf( __( 'Click “Start Tour” to view a quick introduction of this plugin’s core functionality.' ), 'formidable' ) . '</p>'; |
|
169 | 169 | $opt_arr = array( |
170 | 170 | 'content' => $content, |
171 | 171 | 'position' => array( 'edge' => 'top', 'align' => 'center' ), |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | |
244 | 244 | return array( |
245 | 245 | 'content' => '<h3>' . __( 'Forms', 'formidable' ) . '</h3>' |
246 | - . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
247 | - . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
248 | - . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
249 | - . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
250 | - . '<p>' |
|
251 | - . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
246 | + . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
247 | + . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
248 | + . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
249 | + . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
250 | + . '<p>' |
|
251 | + . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
252 | 252 | . '<input type="hidden" name="group[4505]" value="4" />' |
253 | - . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
254 | - . '</p>' |
|
255 | - . '</form>', |
|
253 | + . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
254 | + . '</p>' |
|
255 | + . '</form>', |
|
256 | 256 | 'next_page' => 'entries', |
257 | 257 | ); |
258 | 258 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | private function entries_pointer() { |
266 | 266 | return array( |
267 | 267 | 'content' => '<h3>' . __( 'Entries', 'formidable' ) . '</h3>' |
268 | - . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
268 | + . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
269 | 269 | 'prev_page' => '', |
270 | 270 | 'next_page' => 'styles', |
271 | 271 | 'selector' => '.wp-list-table', |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | private function styles_pointer() { |
282 | 282 | return array( |
283 | 283 | 'content' => '<h3>' . __( 'Styles', 'formidable' ) . '</h3>' |
284 | - . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
284 | + . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
285 | 285 | 'prev_page' => 'entries', |
286 | 286 | 'next_page' => 'import', |
287 | 287 | 'selector' => '.general-style', |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | private function import_pointer() { |
298 | 298 | return array( |
299 | 299 | 'content' => '<h3>' . __( 'Import/Export', 'formidable' ) . '</h3>' |
300 | - . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
300 | + . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
301 | 301 | 'prev_page' => 'styles', |
302 | 302 | 'next_page' => 'settings', |
303 | 303 | 'selector' => '.inside.with_frm_style', |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | . __( 'Turn stylesheets and scripts off, set which user roles have access to change and create forms, setup your reCaptcha, and set default messages for new forms and fields.', 'formidable' ) |
318 | 318 | . '<p><strong>' . __( 'Plugin Licenses', 'formidable' ) . '</strong><br/>' |
319 | 319 | . sprintf( __( 'Once you’ve purchased %1$s or any addons, you’ll have to enter a license key to get access to all of their powerful features. A Plugin Licenses tab will appear here for you to enter your license key.', 'formidable' ), 'Formidable Pro' ) |
320 | - . '</p>', |
|
320 | + . '</p>', |
|
321 | 321 | 'prev_page' => 'import', |
322 | 322 | 'next_page' => 'addons', |
323 | 323 | ); |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | private function addons_pointer() { |
332 | 332 | return array( |
333 | 333 | 'content' => '<h3>' . __( 'Addons', 'formidable' ) . '</h3>' |
334 | - . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) |
|
334 | + . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) |
|
335 | 335 | . '</p>' |
336 | - . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
337 | - . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>', |
|
336 | + . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
337 | + . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>', |
|
338 | 338 | 'prev_page' => 'settings', |
339 | 339 | ); |
340 | 340 | } |
@@ -1,8 +1,8 @@ |
||
1 | -<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ($a == 'general_settings') ? 'frm_block' : 'frm_hidden'; ?>"> |
|
1 | +<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ( $a == 'general_settings' ) ? 'frm_block' : 'frm_hidden'; ?>"> |
|
2 | 2 | <?php if ( ! is_multisite() || is_super_admin() ) { ?> |
3 | 3 | <div class="postbox"> |
4 | 4 | <div class="inside"> |
5 | - <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> »</p> |
|
5 | + <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> »</p> |
|
6 | 6 | <p><?php _e( 'Ready to take your forms to the next level?<br/>Formidable Forms will help you create views, manage data, and get reports.', 'formidable' ) ?></p> |
7 | 7 | |
8 | 8 | <p>Already signed up? <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/knowledgebase/install-formidable-forms/' ) ) ?>" target="_blank"><?php _e( 'Click here', 'formidable' ) ?></a> to get installation instructions and download the pro version.</p> |