|
@@ -4,10 +4,10 @@ discard block |
|
|
block discarded – undo |
|
4
|
4
|
|
|
5
|
5
|
function __construct() { |
|
6
|
6
|
|
|
7
|
|
- if( ! is_admin() ) { return; } |
|
|
7
|
+ if ( ! is_admin() ) { return; } |
|
8
|
8
|
|
|
9
|
9
|
// If Gravity Forms isn't active or compatibile, stop loading |
|
10
|
|
- if( false === GravityView_Compatibility::is_valid() ) { |
|
|
10
|
+ if ( false === GravityView_Compatibility::is_valid() ) { |
|
11
|
11
|
return; |
|
12
|
12
|
} |
|
13
|
13
|
|
|
@@ -25,7 +25,7 @@ discard block |
|
|
block discarded – undo |
|
25
|
25
|
require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
|
26
|
26
|
|
|
27
|
27
|
// Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
|
28
|
|
- if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
|
28
|
+ if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
29
|
29
|
require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
|
30
|
30
|
} |
|
31
|
31
|
|
|
@@ -53,7 +53,7 @@ discard block |
|
|
block discarded – undo |
|
53
|
53
|
add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
|
54
|
54
|
add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
|
55
|
55
|
|
|
56
|
|
- add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
|
56
|
+ add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
57
|
57
|
|
|
58
|
58
|
add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
|
59
|
59
|
|
|
@@ -68,9 +68,9 @@ discard block |
|
|
block discarded – undo |
|
68
|
68
|
*/ |
|
69
|
69
|
public static function no_views_text() { |
|
70
|
70
|
|
|
71
|
|
- if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
|
71
|
+ if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
72
|
72
|
return __( 'No Views found in Trash', 'gravityview' ); |
|
73
|
|
- } elseif( ! empty( $_GET['s'] ) ) { |
|
|
73
|
+ } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
74
|
74
|
return __( 'No Views found.', 'gravityview' ); |
|
75
|
75
|
} |
|
76
|
76
|
|
|
@@ -95,22 +95,22 @@ discard block |
|
|
block discarded – undo |
|
95
|
95
|
public function backend_actions() { |
|
96
|
96
|
|
|
97
|
97
|
/** @define "GRAVITYVIEW_DIR" "../" */ |
|
98
|
|
- include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
99
|
|
- include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
100
|
|
- include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
101
|
|
- include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
102
|
|
- include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
103
|
|
- include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
104
|
|
- include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
105
|
|
- include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
106
|
|
- include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
|
98
|
+ include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
|
99
|
+ include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
|
100
|
+ include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
|
101
|
+ include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
|
102
|
+ include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
|
103
|
+ include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
|
104
|
+ include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
|
105
|
+ include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
|
106
|
+ include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
107
|
107
|
|
|
108
|
108
|
/** |
|
109
|
109
|
* @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
|
110
|
110
|
* |
|
111
|
111
|
* Nice place to insert extensions' backend stuff |
|
112
|
112
|
*/ |
|
113
|
|
- do_action('gravityview_include_backend_actions'); |
|
|
113
|
+ do_action( 'gravityview_include_backend_actions' ); |
|
114
|
114
|
} |
|
115
|
115
|
|
|
116
|
116
|
/** |
|
@@ -126,12 +126,12 @@ discard block |
|
|
block discarded – undo |
|
126
|
126
|
|
|
127
|
127
|
$actions = array(); |
|
128
|
128
|
|
|
129
|
|
- if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
130
|
|
- $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
|
129
|
+ if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
|
130
|
+ $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
131
|
131
|
} |
|
132
|
132
|
|
|
133
|
|
- if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
134
|
|
- $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
|
133
|
+ if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
|
134
|
+ $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
135
|
135
|
} |
|
136
|
136
|
|
|
137
|
137
|
return array_merge( $actions, $links ); |
|
@@ -159,7 +159,7 @@ discard block |
|
|
block discarded – undo |
|
159
|
159
|
// By default, there will only be one item being modified. |
|
160
|
160
|
// When in the `bulk_post_updated_messages` filter, there will be passed a number |
|
161
|
161
|
// of modified items that will override this array. |
|
162
|
|
- $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
|
162
|
+ $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
163
|
163
|
|
|
164
|
164
|
// If we're starting fresh, a new form was created. |
|
165
|
165
|
// We should let the user know this is the case. |
|
@@ -167,60 +167,60 @@ discard block |
|
|
block discarded – undo |
|
167
|
167
|
|
|
168
|
168
|
$new_form_text = ''; |
|
169
|
169
|
|
|
170
|
|
- if( !empty( $start_fresh ) ) { |
|
|
170
|
+ if ( ! empty( $start_fresh ) ) { |
|
171
|
171
|
|
|
172
|
172
|
// Get the form that was created |
|
173
|
173
|
$connected_form = gravityview_get_form_id( $post_id ); |
|
174
|
174
|
|
|
175
|
|
- if( !empty( $connected_form ) ) { |
|
|
175
|
+ if ( ! empty( $connected_form ) ) { |
|
176
|
176
|
$form = gravityview_get_form( $connected_form ); |
|
177
|
|
- $form_name = esc_attr( $form['title'] ); |
|
|
177
|
+ $form_name = esc_attr( $form[ 'title' ] ); |
|
178
|
178
|
$image = self::get_floaty(); |
|
179
|
|
- $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
180
|
|
- $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
|
179
|
+ $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
|
180
|
+ $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
181
|
181
|
|
|
182
|
182
|
You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
|
183
|
|
- ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
|
183
|
+ ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
184
|
184
|
$new_form_text = wpautop( $new_form_text ); |
|
185
|
185
|
|
|
186
|
186
|
delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
187
|
187
|
} |
|
188
|
188
|
} |
|
189
|
189
|
|
|
190
|
|
- $messages['gravityview'] = array( |
|
|
190
|
+ $messages[ 'gravityview' ] = array( |
|
191
|
191
|
0 => '', // Unused. Messages start at index 1. |
|
192
|
192
|
/* translators: %s and %s are HTML tags linking to the View on the website */ |
|
193
|
|
- 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
|
193
|
+ 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
194
|
194
|
/* translators: %s and %s are HTML tags linking to the View on the website */ |
|
195
|
|
- 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
|
195
|
+ 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
196
|
196
|
3 => __( 'View deleted.', 'gravityview' ), |
|
197
|
197
|
/* translators: %s and %s are HTML tags linking to the View on the website */ |
|
198
|
|
- 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
|
198
|
+ 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
199
|
199
|
/* translators: %s: date and time of the revision */ |
|
200
|
|
- 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
|
200
|
+ 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
201
|
201
|
/* translators: %s and %s are HTML tags linking to the View on the website */ |
|
202
|
|
- 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
|
202
|
+ 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
203
|
203
|
/* translators: %s and %s are HTML tags linking to the View on the website */ |
|
204
|
|
- 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
|
204
|
+ 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
205
|
205
|
8 => __( 'View submitted.', 'gravityview' ), |
|
206
|
206
|
9 => sprintf( |
|
207
|
207
|
/* translators: Date and time the View is scheduled to be published */ |
|
208
|
208
|
__( 'View scheduled for: %1$s.', 'gravityview' ), |
|
209
|
209
|
// translators: Publish box date format, see http://php.net/date |
|
210
|
|
- date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
|
210
|
+ date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
211
|
211
|
) . $new_form_text, |
|
212
|
212
|
/* translators: %s and %s are HTML tags linking to the View on the website */ |
|
213
|
|
- 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
|
213
|
+ 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
214
|
214
|
|
|
215
|
215
|
/** |
|
216
|
216
|
* These apply to `bulk_post_updated_messages` |
|
217
|
217
|
* @file wp-admin/edit.php |
|
218
|
218
|
*/ |
|
219
|
|
- 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
220
|
|
- 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
221
|
|
- 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
222
|
|
- 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
223
|
|
- 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
|
219
|
+ 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
|
220
|
+ 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
|
221
|
+ 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
|
222
|
+ 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
|
223
|
+ 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
224
|
224
|
); |
|
225
|
225
|
|
|
226
|
226
|
return $messages; |
|
@@ -280,29 +280,29 @@ discard block |
|
|
block discarded – undo |
|
280
|
280
|
static function is_admin_page( $hook = '', $page = NULL ) { |
|
281
|
281
|
global $current_screen, $plugin_page, $pagenow, $post; |
|
282
|
282
|
|
|
283
|
|
- if( ! is_admin() ) { return false; } |
|
|
283
|
+ if ( ! is_admin() ) { return false; } |
|
284
|
284
|
|
|
285
|
285
|
$is_page = false; |
|
286
|
286
|
|
|
287
|
|
- $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
|
287
|
+ $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
288
|
288
|
|
|
289
|
|
- $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
|
289
|
+ $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
290
|
290
|
|
|
291
|
|
- $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
|
291
|
+ $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
292
|
292
|
|
|
293
|
|
- if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
294
|
|
- $gv_post = get_post( intval( $_GET['post'] ) ); |
|
295
|
|
- $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
|
293
|
+ if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
|
294
|
+ $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
|
295
|
+ $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
296
|
296
|
} else { |
|
297
|
|
- $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
|
297
|
+ $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
298
|
298
|
} |
|
299
|
299
|
|
|
300
|
|
- if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
|
300
|
+ if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
301
|
301
|
|
|
302
|
302
|
// $_GET `post_type` variable |
|
303
|
|
- if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
|
303
|
+ if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
304
|
304
|
$is_page = 'single'; |
|
305
|
|
- } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
|
305
|
+ } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
306
|
306
|
$is_page = 'settings'; |
|
307
|
307
|
} else { |
|
308
|
308
|
$is_page = 'views'; |
|
@@ -317,7 +317,7 @@ discard block |
|
|
block discarded – undo |
|
317
|
317
|
$is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
|
318
|
318
|
|
|
319
|
319
|
// If the current page is the same as the compared page |
|
320
|
|
- if( !empty( $page ) ) { |
|
|
320
|
+ if ( ! empty( $page ) ) { |
|
321
|
321
|
return $is_page === $page; |
|
322
|
322
|
} |
|
323
|
323
|
|
|
@@ -338,6 +338,6 @@ discard block |
|
|
block discarded – undo |
|
338
|
338
|
* |
|
339
|
339
|
* @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
|
340
|
340
|
*/ |
|
341
|
|
-function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
|
341
|
+function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
342
|
342
|
return GravityView_Admin::is_admin_page( $hook, $page ); |
|
343
|
343
|
} |