@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | namespace GravityView\TrustedLogin; |
14 | 14 | |
15 | 15 | // Exit if accessed directly |
16 | -if ( ! defined('ABSPATH') ) { |
|
16 | +if ( ! defined( 'ABSPATH' ) ) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $user_ids = get_users( $args ); |
131 | 131 | |
132 | - return empty( $user_ids ) ? false : (int) $user_ids[0]; |
|
132 | + return empty( $user_ids ) ? false : (int)$user_ids[ 0 ]; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function is_active( $passed_user = null ) { |
143 | 143 | |
144 | - $current_user = is_a( $passed_user, '\WP_User') ? $passed_user : wp_get_current_user(); |
|
144 | + $current_user = is_a( $passed_user, '\WP_User' ) ? $passed_user : wp_get_current_user(); |
|
145 | 145 | |
146 | 146 | if ( ! $current_user || ! $current_user->exists() ) { |
147 | 147 | return false; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | |
156 | - if( time() > (int) $expiration ) { |
|
156 | + if ( time() > (int)$expiration ) { |
|
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | $i = 1; |
248 | 248 | $new_username = $username; |
249 | - while( username_exists( $new_username ) ) { |
|
249 | + while ( username_exists( $new_username ) ) { |
|
250 | 250 | $new_username = sprintf( '%s %d', $username, $i + 1 ); |
251 | 251 | } |
252 | 252 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | $user = get_users( $args ); |
381 | 381 | |
382 | - return empty( $user ) ? null : $user[0]; |
|
382 | + return empty( $user ) ? null : $user[ 0 ]; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | public function get_first() { |
437 | 437 | $support_users = $this->get_all(); |
438 | 438 | |
439 | - if( $support_users ) { |
|
440 | - return $support_users[0]; |
|
439 | + if ( $support_users ) { |
|
440 | + return $support_users[ 0 ]; |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | return null; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | 'number' => 1, |
520 | 520 | ) ); |
521 | 521 | |
522 | - $reassign_id = empty( $admins ) ? null : $admins[0]->ID; |
|
522 | + $reassign_id = empty( $admins ) ? null : $admins[ 0 ]->ID; |
|
523 | 523 | |
524 | 524 | $this->logging->log( 'Reassign user ID: ' . var_export( $reassign_id, true ), __METHOD__, 'info' ); |
525 | 525 |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | |
84 | 84 | $user_identifier = $passed_user_identifier; |
85 | 85 | |
86 | - if ( $this->in_lockdown() ){ |
|
86 | + if ( $this->in_lockdown() ) { |
|
87 | 87 | |
88 | 88 | $this->logging->log( 'Site is in lockdown mode, aborting login.', __METHOD__, 'error' ); |
89 | 89 | |
90 | - return new WP_Error( 'in_lockdown', __( 'TrustedLogin temporarily disabled.' , 'gravityview') ); |
|
90 | + return new WP_Error( 'in_lockdown', __( 'TrustedLogin temporarily disabled.', 'gravityview' ) ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // When passed in the endpoint URL, the unique ID will be the raw value, not the hash. |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $approved = $this->check_approved_identifier( $secret_id ); |
112 | 112 | |
113 | 113 | // Don't lock-down the site, since there could have been errors related to remote validation |
114 | - if ( is_wp_error( $approved ) ){ |
|
114 | + if ( is_wp_error( $approved ) ) { |
|
115 | 115 | |
116 | 116 | $this->logging->log( |
117 | 117 | sprintf( |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | 'notice' |
153 | 153 | ); |
154 | 154 | |
155 | - return new WP_Error( 'brute_force_detected', 'Login aborted due to potential brute force detection.'); |
|
155 | + return new WP_Error( 'brute_force_detected', 'Login aborted due to potential brute force detection.' ); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return true; |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | */ |
166 | 166 | private function maybe_add_used_accesskey( $user_identifier = '' ) { |
167 | 167 | |
168 | - $used_accesskeys = (array) get_site_transient( $this->used_accesskey_transient ); |
|
168 | + $used_accesskeys = (array)get_site_transient( $this->used_accesskey_transient ); |
|
169 | 169 | |
170 | 170 | // This is a new access key |
171 | 171 | if ( ! in_array( $user_identifier, $used_accesskeys, true ) ) { |
172 | 172 | |
173 | - $used_accesskeys[] = $user_identifier; |
|
173 | + $used_accesskeys[ ] = $user_identifier; |
|
174 | 174 | |
175 | 175 | $transient_set = set_site_transient( $this->used_accesskey_transient, $used_accesskeys, self::ACCESSKEY_LIMIT_EXPIRY ); |
176 | 176 | |
@@ -190,19 +190,19 @@ discard block |
||
190 | 190 | */ |
191 | 191 | private function get_ip() { |
192 | 192 | |
193 | - if ( ! isset( $_SERVER['REMOTE_ADDR'] ) ) { |
|
193 | + if ( ! isset( $_SERVER[ 'REMOTE_ADDR' ] ) ) { |
|
194 | 194 | return null; |
195 | 195 | } |
196 | 196 | |
197 | - $ip = wp_unslash( $_SERVER['REMOTE_ADDR'] ); |
|
197 | + $ip = wp_unslash( $_SERVER[ 'REMOTE_ADDR' ] ); |
|
198 | 198 | |
199 | 199 | $ip = trim( $ip ); |
200 | 200 | |
201 | - if ( ! defined('TL_DOING_TESTS') ) { |
|
201 | + if ( ! defined( 'TL_DOING_TESTS' ) ) { |
|
202 | 202 | $ip = filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE ); |
203 | 203 | } |
204 | 204 | |
205 | - return (string) $ip; |
|
205 | + return (string)$ip; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | $body = array( |
228 | 228 | 'timestamp' => time(), |
229 | - 'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 255 ) : '', |
|
229 | + 'user_agent' => isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? substr( $_SERVER[ 'HTTP_USER_AGENT' ], 0, 255 ) : '', |
|
230 | 230 | 'user_ip' => $this->get_ip(), |
231 | 231 | 'site_url' => get_site_url(), |
232 | 232 | ); |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | */ |
266 | 266 | $body = array( |
267 | 267 | 'timestamp' => time(), |
268 | - 'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 255 ) : '', |
|
268 | + 'user_agent' => isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? substr( $_SERVER[ 'HTTP_USER_AGENT' ], 0, 255 ) : '', |
|
269 | 269 | 'user_ip' => $this->get_ip(), |
270 | 270 | 'site_url' => get_site_url(), |
271 | 271 | ); |
272 | 272 | |
273 | 273 | $remote = new Remote( $this->config, $this->logging ); |
274 | - $api_response = $remote->send( self::BRUTE_FORCE_ENDPOINT , $body, 'POST' ); |
|
274 | + $api_response = $remote->send( self::BRUTE_FORCE_ENDPOINT, $body, 'POST' ); |
|
275 | 275 | |
276 | 276 | if ( is_wp_error( $api_response ) ) { |
277 | 277 | return $api_response; |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | $notified = $this->report_lockdown(); |
304 | 304 | |
305 | - if ( is_wp_error( $notified ) ){ |
|
305 | + if ( is_wp_error( $notified ) ) { |
|
306 | 306 | $this->logging->log( sprintf( 'Could not notify TrustedLogin (%s)', $notified->get_error_message() ), __METHOD__, 'error' ); |
307 | 307 | } |
308 | 308 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @return int|false Int: in lockdown. The value returned is the timestamp when lockdown ends. False: not in lockdown, or overridden by a constant. |
357 | 357 | */ |
358 | - public function in_lockdown(){ |
|
358 | + public function in_lockdown() { |
|
359 | 359 | |
360 | 360 | if ( $this->in_local_development() ) { |
361 | 361 | return false; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $gv_bulk_action = false; |
56 | 56 | |
57 | - if( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
57 | + if ( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
58 | 58 | $bulk_action = ( '-1' !== \GV\Utils::_POST( 'action' ) ) ? \GV\Utils::_POST( 'action' ) : \GV\Utils::_POST( 'action2' ); |
59 | 59 | } else { |
60 | 60 | // GF 1.9.x - Bulk action 2 is the bottom bulk action select form. |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos(). |
65 | - if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', self::$bulk_action_prefixes ) .')/ism', $bulk_action ) ) { |
|
65 | + if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', self::$bulk_action_prefixes ) . ')/ism', $bulk_action ) ) { |
|
66 | 66 | $gv_bulk_action = $bulk_action; |
67 | 67 | } |
68 | 68 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | // gforms_entry_list is the nonce that confirms we're on the right page |
88 | 88 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
89 | - if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST['gforms_update_note'] ) ) { |
|
89 | + if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
90 | 90 | |
91 | 91 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
92 | 92 | |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | // All entries are set to be updated, not just the visible ones |
107 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
107 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
108 | 108 | |
109 | 109 | // Convert the current entry search into GF-formatted search criteria |
110 | 110 | $search = array( |
111 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
112 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
113 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
111 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
112 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
113 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
114 | 114 | ); |
115 | 115 | |
116 | 116 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } else { |
122 | 122 | |
123 | 123 | // Changed from 'lead' to 'entry' in 2.0 |
124 | - $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry']; |
|
124 | + $entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ]; |
|
125 | 125 | |
126 | 126 | } |
127 | 127 | |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
134 | 134 | |
135 | 135 | switch ( $approved_status ) { |
136 | - case self::$bulk_action_prefixes['approve']: |
|
136 | + case self::$bulk_action_prefixes[ 'approve' ]: |
|
137 | 137 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id ); |
138 | 138 | self::$bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
139 | 139 | break; |
140 | - case self::$bulk_action_prefixes['unapprove']: |
|
140 | + case self::$bulk_action_prefixes[ 'unapprove' ]: |
|
141 | 141 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id ); |
142 | 142 | self::$bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count ); |
143 | 143 | break; |
144 | - case self::$bulk_action_prefixes['disapprove']: |
|
144 | + case self::$bulk_action_prefixes[ 'disapprove' ]: |
|
145 | 145 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id ); |
146 | 146 | self::$bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
147 | 147 | break; |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | $bulk_actions = array( |
165 | 165 | 'GravityView' => array( |
166 | 166 | array( |
167 | - 'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'), |
|
168 | - 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['approve'], $form_id ), |
|
167 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ), |
|
168 | + 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'approve' ], $form_id ), |
|
169 | 169 | ), |
170 | 170 | array( |
171 | - 'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'), |
|
172 | - 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['disapprove'], $form_id ), |
|
171 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ), |
|
172 | + 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'disapprove' ], $form_id ), |
|
173 | 173 | ), |
174 | 174 | array( |
175 | - 'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'), |
|
176 | - 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes['unapprove'], $form_id ), |
|
175 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ), |
|
176 | + 'value' => sprintf( '%s-%d', self::$bulk_action_prefixes[ 'unapprove' ], $form_id ), |
|
177 | 177 | ), |
178 | 178 | ), |
179 | 179 | ); |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | // Sanitize the values, just to be sure. |
191 | 191 | foreach ( $bulk_actions as $key => $group ) { |
192 | 192 | |
193 | - if( empty( $group ) ) { |
|
193 | + if ( empty( $group ) ) { |
|
194 | 194 | continue; |
195 | 195 | } |
196 | 196 | |
197 | 197 | foreach ( $group as $i => $action ) { |
198 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
199 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
198 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
199 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 |
@@ -4,10 +4,10 @@ discard block |
||
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()->plugin->is_compatible() ) { |
|
10 | + if ( false === gravityview()->plugin->is_compatible() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
49 | 49 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
50 | 50 | |
51 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
51 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
52 | 52 | |
53 | 53 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
54 | 54 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public static function no_views_text() { |
66 | 66 | |
67 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
67 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
68 | 68 | return esc_html__( 'No Views found in Trash', 'gravityview' ); |
69 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
69 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
70 | 70 | return esc_html__( 'No Views found.', 'gravityview' ); |
71 | 71 | } |
72 | 72 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
111 | 111 | } |
112 | 112 | |
113 | - if( $error ) { |
|
113 | + if ( $error ) { |
|
114 | 114 | ?> |
115 | 115 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
116 | 116 | <?php echo gravityview_get_floaty(); ?> |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | public function backend_actions() { |
131 | 131 | |
132 | 132 | /** @define "GRAVITYVIEW_DIR" "../" */ |
133 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
134 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
135 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
136 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
137 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
139 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
140 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-installer.php' ); |
|
141 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
143 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-bulk-actions.php' ); |
|
133 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
134 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
135 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
136 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
137 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
139 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
140 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-installer.php' ); |
|
141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
142 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
143 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-bulk-actions.php' ); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
147 | 147 | * |
148 | 148 | * Nice place to insert extensions' backend stuff |
149 | 149 | */ |
150 | - do_action('gravityview_include_backend_actions'); |
|
150 | + do_action( 'gravityview_include_backend_actions' ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | |
163 | 163 | $actions = array(); |
164 | 164 | |
165 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
166 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
165 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
166 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
167 | 167 | } |
168 | 168 | |
169 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
170 | - $actions[] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
169 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
170 | + $actions[ ] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | return array_merge( $actions, $links ); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | // By default, there will only be one item being modified. |
196 | 196 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
197 | 197 | // of modified items that will override this array. |
198 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
198 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
199 | 199 | |
200 | 200 | // If we're starting fresh, a new form was created. |
201 | 201 | // We should let the user know this is the case. |
@@ -203,60 +203,60 @@ discard block |
||
203 | 203 | |
204 | 204 | $new_form_text = ''; |
205 | 205 | |
206 | - if( !empty( $start_fresh ) ) { |
|
206 | + if ( ! empty( $start_fresh ) ) { |
|
207 | 207 | |
208 | 208 | // Get the form that was created |
209 | 209 | $connected_form = gravityview_get_form_id( $post_id ); |
210 | 210 | |
211 | - if( !empty( $connected_form ) ) { |
|
211 | + if ( ! empty( $connected_form ) ) { |
|
212 | 212 | $form = gravityview_get_form( $connected_form ); |
213 | - $form_name = esc_attr( $form['title'] ); |
|
213 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
214 | 214 | $image = self::get_floaty(); |
215 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
216 | - $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 |
|
215 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
216 | + $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 |
|
217 | 217 | |
218 | 218 | 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. |
219 | - ', '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>'); |
|
219 | + ', '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>' ); |
|
220 | 220 | $new_form_text = wpautop( $new_form_text ); |
221 | 221 | |
222 | 222 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | - $messages['gravityview'] = array( |
|
226 | + $messages[ 'gravityview' ] = array( |
|
227 | 227 | 0 => '', // Unused. Messages start at index 1. |
228 | 228 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
229 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
229 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
230 | 230 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
231 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
231 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
232 | 232 | 3 => __( 'View deleted.', 'gravityview' ), |
233 | 233 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
234 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
234 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
235 | 235 | /* translators: %s: date and time of the revision */ |
236 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
236 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
237 | 237 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
238 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
238 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
239 | 239 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
240 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
240 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
241 | 241 | 8 => __( 'View submitted.', 'gravityview' ), |
242 | 242 | 9 => sprintf( |
243 | 243 | /* translators: Date and time the View is scheduled to be published */ |
244 | 244 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
245 | 245 | // translators: Publish box date format, see http://php.net/date |
246 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
246 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
247 | 247 | ) . $new_form_text, |
248 | 248 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
249 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
249 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * These apply to `bulk_post_updated_messages` |
253 | 253 | * @file wp-admin/edit.php |
254 | 254 | */ |
255 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
256 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
257 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
258 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
259 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
255 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
256 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
257 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
258 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
259 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
260 | 260 | ); |
261 | 261 | |
262 | 262 | return $messages; |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | /** |
251 | 251 | * update_approved function. |
252 | 252 | * |
253 | - * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
253 | + * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
254 | 254 | * @see GravityView_Entry_Approval::update_approved |
255 | - * |
|
255 | + * |
|
256 | 256 | * @param int $entry_id (default: 0) |
257 | 257 | * @param int $approved (default: 0) |
258 | 258 | * @param int $form_id (default: 0) |
259 | 259 | * @param int $approvedcolumn (default: 0) |
260 | - * |
|
260 | + * |
|
261 | 261 | * @return boolean True: It worked; False: it failed |
262 | 262 | */ |
263 | 263 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | /** |
268 | 268 | * Calculate the approve field.input id |
269 | 269 | * |
270 | - * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
271 | - * @see GravityView_Entry_Approval::get_approved_column |
|
272 | - * |
|
270 | + * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
271 | + * @see GravityView_Entry_Approval::get_approved_column |
|
272 | + * |
|
273 | 273 | * @param mixed $form GF Form or Form ID |
274 | 274 | * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
275 | 275 | */ |
@@ -394,37 +394,37 @@ discard block |
||
394 | 394 | 'bulk_actions' => GravityView_Bulk_Actions::get_bulk_actions( $form_id ), |
395 | 395 | 'bulk_message' => $this->bulk_update_message, |
396 | 396 | 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
397 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
397 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
398 | 398 | 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
399 | 399 | 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
400 | 400 | 'column_link' => esc_url( $this->get_sort_link() ), |
401 | - 'status_popover_template' => GravityView_Entry_Approval::get_popover_template(), |
|
401 | + 'status_popover_template' => GravityView_Entry_Approval::get_popover_template(), |
|
402 | 402 | 'status_popover_placement' => GravityView_Entry_Approval::get_popover_placement(), |
403 | 403 | ) ); |
404 | 404 | |
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
408 | - * Generate a link to sort by approval status |
|
409 | - * |
|
410 | - * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
411 | - * numeric, but it does group the approved entries together. |
|
412 | - * |
|
413 | - * @since 2.0.14 Remove need for approval field for sorting by approval status |
|
414 | - * |
|
408 | + * Generate a link to sort by approval status |
|
409 | + * |
|
410 | + * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
411 | + * numeric, but it does group the approved entries together. |
|
412 | + * |
|
413 | + * @since 2.0.14 Remove need for approval field for sorting by approval status |
|
414 | + * |
|
415 | 415 | * @param int $form_id [NO LONGER USED] |
416 | 416 | * |
417 | 417 | * @return string Sorting link |
418 | 418 | */ |
419 | 419 | private function get_sort_link( $form_id = 0 ) { |
420 | 420 | |
421 | - $args = array( |
|
422 | - 'orderby' => 'is_approved', |
|
423 | - 'order' => ( 'desc' === \GV\Utils::_GET( 'order' ) ) ? 'asc' : 'desc', |
|
424 | - ); |
|
421 | + $args = array( |
|
422 | + 'orderby' => 'is_approved', |
|
423 | + 'order' => ( 'desc' === \GV\Utils::_GET( 'order' ) ) ? 'asc' : 'desc', |
|
424 | + ); |
|
425 | 425 | |
426 | 426 | return add_query_arg( $args ); |
427 | - } |
|
427 | + } |
|
428 | 428 | |
429 | 429 | /** |
430 | 430 | * Should the Approve/Reject Entry column be shown in the GF Entries page? |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) ); |
50 | 50 | |
51 | 51 | // adding styles and scripts |
52 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
52 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
53 | 53 | // bypass Gravity Forms no-conflict mode |
54 | 54 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
55 | 55 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them. |
79 | 79 | * @param array $form GF Form object of current form |
80 | 80 | */ |
81 | - if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
81 | + if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
82 | 82 | return $filter_links; |
83 | 83 | } |
84 | 84 | |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | $approved_count = $disapproved_count = $unapproved_count = 0; |
107 | 107 | |
108 | 108 | // Only count if necessary |
109 | - if( $include_counts ) { |
|
110 | - $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
111 | - $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
112 | - $unapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) ); |
|
109 | + if ( $include_counts ) { |
|
110 | + $approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
111 | + $disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
112 | + $unapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) ); |
|
113 | 113 | } |
114 | 114 | |
115 | - $filter_links[] = array( |
|
115 | + $filter_links[ ] = array( |
|
116 | 116 | 'id' => 'gv_approved', |
117 | 117 | 'field_filters' => $field_filters_approved, |
118 | 118 | 'count' => $approved_count, |
119 | 119 | 'label' => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ), |
120 | 120 | ); |
121 | 121 | |
122 | - $filter_links[] = array( |
|
122 | + $filter_links[ ] = array( |
|
123 | 123 | 'id' => 'gv_disapproved', |
124 | 124 | 'field_filters' => $field_filters_disapproved, |
125 | 125 | 'count' => $disapproved_count, |
126 | 126 | 'label' => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::DISAPPROVED ), |
127 | 127 | ); |
128 | 128 | |
129 | - $filter_links[] = array( |
|
129 | + $filter_links[ ] = array( |
|
130 | 130 | 'id' => 'gv_unapproved', |
131 | 131 | 'field_filters' => $field_filters_unapproved, |
132 | 132 | 'count' => $unapproved_count, |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function tooltips( $tooltips ) { |
147 | 147 | |
148 | - $tooltips['form_gravityview_fields'] = array( |
|
149 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
150 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
148 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
149 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
150 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
151 | 151 | ); |
152 | 152 | |
153 | 153 | return $tooltips; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return boolean True: It worked; False: it failed |
262 | 262 | */ |
263 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
263 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
264 | 264 | return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn ); |
265 | 265 | } |
266 | 266 | |
@@ -290,20 +290,20 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @return void |
292 | 292 | */ |
293 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
293 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
294 | 294 | |
295 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
295 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
296 | 296 | return; |
297 | 297 | } |
298 | 298 | |
299 | - if( empty( $entry['id'] ) ) { |
|
299 | + if ( empty( $entry[ 'id' ] ) ) { |
|
300 | 300 | return; |
301 | 301 | } |
302 | 302 | |
303 | 303 | $status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' ); |
304 | 304 | |
305 | - if( $status_value ) { |
|
306 | - echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />'; |
|
305 | + if ( $status_value ) { |
|
306 | + echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />'; |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | */ |
317 | 317 | private function get_form_id() { |
318 | 318 | |
319 | - $form_id = GFForms::get('id'); |
|
319 | + $form_id = GFForms::get( 'id' ); |
|
320 | 320 | |
321 | 321 | // If there are no forms identified, use the first form. That's how GF does it. |
322 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
322 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
323 | 323 | $form_id = $this->get_first_form_id(); |
324 | 324 | } |
325 | 325 | |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | |
340 | 340 | $forms = RGFormsModel::get_forms( null, 'title' ); |
341 | 341 | |
342 | - if( ! isset( $forms[0] ) ) { |
|
342 | + if ( ! isset( $forms[ 0 ] ) ) { |
|
343 | 343 | gravityview()->log->error( 'No forms were found' ); |
344 | 344 | return 0; |
345 | 345 | } |
346 | 346 | |
347 | - $first_form = $forms[0]; |
|
347 | + $first_form = $forms[ 0 ]; |
|
348 | 348 | |
349 | - $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id']; |
|
349 | + $form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ]; |
|
350 | 350 | |
351 | 351 | return intval( $form_id ); |
352 | 352 | } |
@@ -354,37 +354,37 @@ discard block |
||
354 | 354 | |
355 | 355 | function add_scripts_and_styles( $hook ) { |
356 | 356 | |
357 | - if( ! class_exists( 'GFForms' ) ) { |
|
357 | + if ( ! class_exists( 'GFForms' ) ) { |
|
358 | 358 | gravityview()->log->error( 'GFForms does not exist.' ); |
359 | 359 | return; |
360 | 360 | } |
361 | 361 | |
362 | 362 | // enqueue styles & scripts gf_entries |
363 | 363 | // But only if we're on the main Entries page, not on reports pages |
364 | - if( GFForms::get_page() !== 'entry_list' ) { |
|
364 | + if ( GFForms::get_page() !== 'entry_list' ) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | |
368 | 368 | $form_id = $this->get_form_id(); |
369 | 369 | |
370 | 370 | // Things are broken; no forms were found |
371 | - if( empty( $form_id ) ) { |
|
371 | + if ( empty( $form_id ) ) { |
|
372 | 372 | return; |
373 | 373 | } |
374 | 374 | |
375 | - wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
375 | + wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
376 | 376 | |
377 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
377 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
378 | 378 | |
379 | - wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
379 | + wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
380 | 380 | |
381 | 381 | wp_enqueue_script( 'gravityview_entries_list-popper', plugins_url( 'assets/lib/tippy/popper.min.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
382 | 382 | wp_enqueue_script( 'gravityview_entries_list-tippy', plugins_url( 'assets/lib/tippy/tippy.min.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
383 | 383 | wp_enqueue_style( 'gravityview_entries_list-tippy', plugins_url( 'assets/lib/tippy/tippy.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
384 | 384 | |
385 | 385 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
386 | - 'nonce' => wp_create_nonce( 'gravityview_entry_approval'), |
|
387 | - 'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'), |
|
386 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
387 | + 'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval' ), |
|
388 | 388 | 'form_id' => $form_id, |
389 | 389 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
390 | 390 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
@@ -393,10 +393,10 @@ discard block |
||
393 | 393 | 'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED, |
394 | 394 | 'bulk_actions' => GravityView_Bulk_Actions::get_bulk_actions( $form_id ), |
395 | 395 | 'bulk_message' => $this->bulk_update_message, |
396 | - 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
|
397 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
398 | - 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
|
399 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
396 | + 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ), |
|
397 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ), |
|
398 | + 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ), |
|
399 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
400 | 400 | 'column_link' => esc_url( $this->get_sort_link() ), |
401 | 401 | 'status_popover_template' => GravityView_Entry_Approval::get_popover_template(), |
402 | 402 | 'status_popover_placement' => GravityView_Entry_Approval::get_popover_placement(), |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | * @since 1.7.2 |
445 | 445 | * @param boolean $hide_if_no_connections |
446 | 446 | */ |
447 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
447 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
448 | 448 | |
449 | - if( $hide_if_no_connections ) { |
|
449 | + if ( $hide_if_no_connections ) { |
|
450 | 450 | |
451 | 451 | $connected_views = gravityview_get_connected_views( $form_id ); |
452 | 452 | |
453 | - if( empty( $connected_views ) ) { |
|
453 | + if ( empty( $connected_views ) ) { |
|
454 | 454 | $show_approve_column = false; |
455 | 455 | } |
456 | 456 | } |
@@ -460,21 +460,21 @@ discard block |
||
460 | 460 | * @param boolean $show_approve_column Whether the column will be shown |
461 | 461 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
462 | 462 | */ |
463 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
463 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
464 | 464 | |
465 | 465 | return $show_approve_column; |
466 | 466 | } |
467 | 467 | |
468 | 468 | function register_gform_noconflict_script( $scripts ) { |
469 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
470 | - $scripts[] = 'gravityview_entries_list-popper'; |
|
471 | - $scripts[] = 'gravityview_entries_list-tippy'; |
|
469 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
470 | + $scripts[ ] = 'gravityview_entries_list-popper'; |
|
471 | + $scripts[ ] = 'gravityview_entries_list-tippy'; |
|
472 | 472 | return $scripts; |
473 | 473 | } |
474 | 474 | |
475 | 475 | function register_gform_noconflict_style( $styles ) { |
476 | - $styles[] = 'gravityview_entries_list'; |
|
477 | - $styles[] = 'gravityview_entries_list-tippy'; |
|
476 | + $styles[ ] = 'gravityview_entries_list'; |
|
477 | + $styles[ ] = 'gravityview_entries_list-tippy'; |
|
478 | 478 | return $styles; |
479 | 479 | } |
480 | 480 |