@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
38 | 38 | |
39 | - if( is_admin() ) { |
|
39 | + if ( is_admin() ) { |
|
40 | 40 | $this->load_components( 'admin' ); |
41 | 41 | } |
42 | 42 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | static function getInstance() { |
57 | 57 | |
58 | - if( empty( self::$instance ) ) { |
|
58 | + if ( empty( self::$instance ) ) { |
|
59 | 59 | self::$instance = new GravityView_Edit_Entry; |
60 | 60 | } |
61 | 61 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | private function add_hooks() { |
82 | 82 | |
83 | 83 | // Add front-end access to Gravity Forms delete file action |
84 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
84 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
85 | 85 | |
86 | 86 | // Make sure this hook is run for non-admins |
87 | - add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
87 | + add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
88 | 88 | |
89 | 89 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
90 | 90 | |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | private function addon_specific_hooks() { |
101 | 101 | |
102 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
103 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
102 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
103 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
148 | 148 | |
149 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
149 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
150 | 150 | |
151 | 151 | $base = gv_entry_link( $entry, $post_id ); |
152 | 152 | |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * Allow passing params to dynamically populate entry with values |
159 | 159 | * @since 1.9.2 |
160 | 160 | */ |
161 | - if( !empty( $field_values ) ) { |
|
161 | + if ( ! empty( $field_values ) ) { |
|
162 | 162 | |
163 | - if( is_array( $field_values ) ) { |
|
163 | + if ( is_array( $field_values ) ) { |
|
164 | 164 | // If already an array, no parse_str() needed |
165 | 165 | $params = $field_values; |
166 | 166 | } else { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function modify_field_blacklist( $fields = array(), $context = NULL ) { |
183 | 183 | |
184 | - if( empty( $context ) || $context !== 'edit' ) { |
|
184 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
185 | 185 | return $fields; |
186 | 186 | } |
187 | 187 | |
@@ -242,24 +242,24 @@ discard block |
||
242 | 242 | // If they can edit any entries (as defined in Gravity Forms) |
243 | 243 | // Or if they can edit other people's entries |
244 | 244 | // Then we're good. |
245 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
245 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
246 | 246 | |
247 | - do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.'); |
|
247 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.' ); |
|
248 | 248 | |
249 | 249 | $user_can_edit = true; |
250 | 250 | |
251 | - } else if( !isset( $entry['created_by'] ) ) { |
|
251 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
252 | 252 | |
253 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.'); |
|
253 | + do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.' ); |
|
254 | 254 | |
255 | 255 | $user_can_edit = false; |
256 | 256 | |
257 | 257 | } else { |
258 | 258 | |
259 | 259 | // get user_edit setting |
260 | - if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
260 | + if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
261 | 261 | // if View ID not specified or is the current view |
262 | - $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
262 | + $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' ); |
|
263 | 263 | } else { |
264 | 264 | // in case is specified and not the current view |
265 | 265 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
@@ -268,21 +268,21 @@ discard block |
||
268 | 268 | $current_user = wp_get_current_user(); |
269 | 269 | |
270 | 270 | // User edit is disabled |
271 | - if( empty( $user_edit ) ) { |
|
271 | + if ( empty( $user_edit ) ) { |
|
272 | 272 | |
273 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
273 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
274 | 274 | |
275 | 275 | $user_can_edit = false; |
276 | 276 | } |
277 | 277 | |
278 | 278 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
279 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
279 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
280 | 280 | |
281 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
281 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
282 | 282 | |
283 | 283 | $user_can_edit = true; |
284 | 284 | |
285 | - } else if( ! is_user_logged_in() ) { |
|
285 | + } else if ( ! is_user_logged_in() ) { |
|
286 | 286 | |
287 | 287 | do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' ); |
288 | 288 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** @var WP_Admin_Bar $wp_admin_bar */ |
39 | 39 | global $wp_admin_bar; |
40 | 40 | |
41 | - if( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
41 | + if ( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | 'parent' => 'gravityview', |
111 | 111 | 'title' => __( 'Edit Entry', 'gravityview' ), |
112 | 112 | 'meta' => array( |
113 | - 'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry['id'], $entry ) ), |
|
113 | + 'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ) ), |
|
114 | 114 | ), |
115 | - 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ), |
|
115 | + 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ), |
|
116 | 116 | ) ); |
117 | 117 | |
118 | 118 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /** @var WP_Admin_Bar $wp_admin_bar */ |
129 | 129 | global $wp_admin_bar; |
130 | 130 | |
131 | - if( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
131 | + if ( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
132 | 132 | |
133 | 133 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
134 | 134 | $views = gravityview()->views->all(); |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | $form_id = $view->form ? $view->form->ID : null; |
153 | 153 | } else { |
154 | 154 | /** Deprecated. */ |
155 | - $view_id = $view['id']; |
|
156 | - $form_id = $view['form_id']; |
|
155 | + $view_id = $view[ 'id' ]; |
|
156 | + $form_id = $view[ 'form_id' ]; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $edit_view_title = __( 'Edit View', 'gravityview' ); |
160 | 160 | $edit_form_title = __( 'Edit Form', 'gravityview' ); |
161 | 161 | |
162 | - if( sizeof( $views ) > 1 ) { |
|
162 | + if ( sizeof( $views ) > 1 ) { |
|
163 | 163 | $edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view_id ); |
164 | 164 | $edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $form_id ); |
165 | 165 | } |
166 | 166 | |
167 | - if( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) { |
|
167 | + if ( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) { |
|
168 | 168 | |
169 | - $added_views[] = $view_id; |
|
169 | + $added_views[ ] = $view_id; |
|
170 | 170 | |
171 | 171 | $wp_admin_bar->add_menu( array( |
172 | 172 | 'id' => 'edit-view-' . $view_id, |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | ) ); |
177 | 177 | } |
178 | 178 | |
179 | - if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms ) ) { |
|
179 | + if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms ) ) { |
|
180 | 180 | |
181 | - $added_forms[] = $form_id; |
|
181 | + $added_forms[ ] = $form_id; |
|
182 | 182 | |
183 | 183 | $wp_admin_bar->add_menu( array( |
184 | 184 | 'id' => 'edit-form-' . $form_id, |
@@ -129,12 +129,12 @@ |
||
129 | 129 | |
130 | 130 | /** Let's find us some [gravityview] shortcodes perhaps. */ |
131 | 131 | foreach ( Shortcode::parse( $content ) as $shortcode ) { |
132 | - if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) { |
|
132 | + if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
136 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
137 | - $view = View::by_id( $shortcode->atts['id'] ); |
|
136 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
137 | + $view = View::by_id( $shortcode->atts[ 'id' ] ); |
|
138 | 138 | if ( ! $view ) { |
139 | 139 | continue; |
140 | 140 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | |
104 | 104 | /** Call all lazy callbacks. */ |
105 | 105 | foreach ( $this->callbacks as $callback ) { |
106 | - if ( $callback[0] != 'count' ) { |
|
106 | + if ( $callback[ 0 ] != 'count' ) { |
|
107 | 107 | continue; |
108 | 108 | } |
109 | 109 | |
110 | - $total += $callback[1]( $this->filters ); |
|
110 | + $total += $callback[ 1 ]( $this->filters ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $total - $this->offset; |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | |
162 | 162 | /** Call all lazy callbacks. */ |
163 | 163 | foreach ( $this->callbacks as $i => $callback ) { |
164 | - if ( $callback[0] != 'fetch' ) { |
|
164 | + if ( $callback[ 0 ] != 'fetch' ) { |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | |
168 | - $this->merge( $callback[1]( $this->filters, $this->sorts, $offset ) ); |
|
168 | + $this->merge( $callback[ 1 ]( $this->filters, $this->sorts, $offset ) ); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | $this->fetched = $this->count(); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | return; |
322 | 322 | } |
323 | 323 | |
324 | - $this->callbacks []= array( $type, $callback ); |
|
324 | + $this->callbacks [ ] = array( $type, $callback ); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @return void |
26 | 26 | */ |
27 | 27 | public function add( $value ) { |
28 | - $this->storage []= $value; |
|
28 | + $this->storage [ ] = $value; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function merge( \GV\Collection $collection ) { |
52 | - array_map( array( $this, 'add'), $collection->all() ); |
|
52 | + array_map( array( $this, 'add' ), $collection->all() ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | protected function log( $level, $message, $context ) { |
29 | 29 | |
30 | 30 | $backtrace = debug_backtrace(); |
31 | - $location = $this->interpolate( "{class}{type}{function}", $backtrace[2] ); |
|
31 | + $location = $this->interpolate( "{class}{type}{function}", $backtrace[ 2 ] ); |
|
32 | 32 | |
33 | 33 | $message = $this->interpolate( "[$level, $location] $message", $context ); |
34 | 34 | |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | do_action( |
53 | 53 | sprintf( 'gravityview_log_%s_test', $action ), |
54 | 54 | $this->interpolate( $message, $context ), |
55 | - empty( $context['data'] ) ? array() : $context['data'] |
|
55 | + empty( $context[ 'data' ] ) ? array() : $context[ 'data' ] |
|
56 | 56 | ); |
57 | 57 | } |
58 | 58 | |
59 | 59 | do_action( |
60 | 60 | sprintf( 'gravityview_log_%s', $action ), |
61 | 61 | $this->interpolate( $message, $context ), |
62 | - empty( $context['data'] ) ? array() : $context['data'] |
|
62 | + empty( $context[ 'data' ] ) ? array() : $context[ 'data' ] |
|
63 | 63 | ); |
64 | 64 | } |
65 | 65 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return void |
38 | 38 | */ |
39 | - public function emergency($message, array $context = array()) |
|
39 | + public function emergency( $message, array $context = array() ) |
|
40 | 40 | { |
41 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
41 | + $this->log( LogLevel::EMERGENCY, $message, $context ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function alert($message, array $context = array()) |
|
55 | + public function alert( $message, array $context = array() ) |
|
56 | 56 | { |
57 | - $this->log(LogLevel::ALERT, $message, $context); |
|
57 | + $this->log( LogLevel::ALERT, $message, $context ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return void |
69 | 69 | */ |
70 | - public function critical($message, array $context = array()) |
|
70 | + public function critical( $message, array $context = array() ) |
|
71 | 71 | { |
72 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
72 | + $this->log( LogLevel::CRITICAL, $message, $context ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return void |
83 | 83 | */ |
84 | - public function error($message, array $context = array()) |
|
84 | + public function error( $message, array $context = array() ) |
|
85 | 85 | { |
86 | - $this->log(LogLevel::ERROR, $message, $context); |
|
86 | + $this->log( LogLevel::ERROR, $message, $context ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return void |
99 | 99 | */ |
100 | - public function warning($message, array $context = array()) |
|
100 | + public function warning( $message, array $context = array() ) |
|
101 | 101 | { |
102 | - $this->log(LogLevel::WARNING, $message, $context); |
|
102 | + $this->log( LogLevel::WARNING, $message, $context ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return void |
112 | 112 | */ |
113 | - public function notice($message, array $context = array()) |
|
113 | + public function notice( $message, array $context = array() ) |
|
114 | 114 | { |
115 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
115 | + $this->log( LogLevel::NOTICE, $message, $context ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | - public function info($message, array $context = array()) |
|
128 | + public function info( $message, array $context = array() ) |
|
129 | 129 | { |
130 | - $this->log(LogLevel::INFO, $message, $context); |
|
130 | + $this->log( LogLevel::INFO, $message, $context ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - public function debug($message, array $context = array()) |
|
141 | + public function debug( $message, array $context = array() ) |
|
142 | 142 | { |
143 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
143 | + $this->log( LogLevel::DEBUG, $message, $context ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return void |
32 | 32 | */ |
33 | 33 | public function __set( $key, $value ) { |
34 | - $this->_context[$key] = $value; |
|
34 | + $this->_context[ $key ] = $value; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return mixed|null |
46 | 46 | */ |
47 | 47 | public function __get( $key ) { |
48 | - return isset( $this->_context[$key] ) ? $this->_context[$key] : null; |
|
48 | + return isset( $this->_context[ $key ] ) ? $this->_context[ $key ] : null; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 |
@@ -55,10 +55,10 @@ |
||
55 | 55 | $search_criteria[ $key ] = $field_filters; |
56 | 56 | } |
57 | 57 | |
58 | - if ( ! empty( $b[ $key ]['mode'] ) ) { |
|
59 | - $search_criteria[ $key ]['mode' ] = $b[ $key ]['mode']; |
|
60 | - } else if ( ! empty( $a[ $key ]['mode'] ) ) { |
|
61 | - $search_criteria[ $key ]['mode' ] = $a[ $key ]['mode']; |
|
58 | + if ( ! empty( $b[ $key ][ 'mode' ] ) ) { |
|
59 | + $search_criteria[ $key ][ 'mode' ] = $b[ $key ][ 'mode' ]; |
|
60 | + } else if ( ! empty( $a[ $key ][ 'mode' ] ) ) { |
|
61 | + $search_criteria[ $key ][ 'mode' ] = $a[ $key ][ 'mode' ]; |
|
62 | 62 | } |
63 | 63 | break; |
64 | 64 | case 'start_date': |