|
@@ -75,7 +75,7 @@ discard block |
|
|
block discarded – undo |
|
75
|
75
|
|
|
76
|
76
|
$atts = shortcode_atts( self::$defaults, $atts ); |
|
77
|
77
|
|
|
78
|
|
- $atts['action'] = 'edit'; |
|
|
78
|
+ $atts[ 'action' ] = 'edit'; |
|
79
|
79
|
|
|
80
|
80
|
return $this->shortcode( $atts, $content, $context ); |
|
81
|
81
|
} |
|
@@ -91,7 +91,7 @@ discard block |
|
|
block discarded – undo |
|
91
|
91
|
|
|
92
|
92
|
$atts = shortcode_atts( self::$defaults, $atts ); |
|
93
|
93
|
|
|
94
|
|
- $atts['action'] = 'delete'; |
|
|
94
|
+ $atts[ 'action' ] = 'delete'; |
|
95
|
95
|
|
|
96
|
96
|
return $this->shortcode( $atts, $content, $context ); |
|
97
|
97
|
} |
|
@@ -131,7 +131,7 @@ discard block |
|
|
block discarded – undo |
|
131
|
131
|
|
|
132
|
132
|
$this->settings = shortcode_atts( self::$defaults, $atts, $context ); |
|
133
|
133
|
|
|
134
|
|
- $this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] ); |
|
|
134
|
+ $this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] ); |
|
135
|
135
|
|
|
136
|
136
|
if ( empty( $this->view_id ) ) { |
|
137
|
137
|
gravityview()->log->error( 'A View ID was not defined and we are not inside a View' ); |
|
@@ -139,12 +139,12 @@ discard block |
|
|
block discarded – undo |
|
139
|
139
|
return null; |
|
140
|
140
|
} |
|
141
|
141
|
|
|
142
|
|
- $this->entry = $this->get_entry( $this->settings['entry_id'] ); |
|
|
142
|
+ $this->entry = $this->get_entry( $this->settings[ 'entry_id' ] ); |
|
143
|
143
|
|
|
144
|
144
|
gravityview()->log->debug( '{context} atts:', array( 'context' => $context, 'data' => $atts ) ); |
|
145
|
145
|
|
|
146
|
146
|
if ( ! $this->has_cap() ) { |
|
147
|
|
- gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings['action'] ), 'entry_id' => $this->entry['id'] ) ); |
|
|
147
|
+ gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings[ 'action' ] ), 'entry_id' => $this->entry[ 'id' ] ) ); |
|
148
|
148
|
|
|
149
|
149
|
return null; |
|
150
|
150
|
} |
|
@@ -158,7 +158,7 @@ discard block |
|
|
block discarded – undo |
|
158
|
158
|
} |
|
159
|
159
|
|
|
160
|
160
|
// Get just the URL, not the tag |
|
161
|
|
- if ( 'url' === $this->settings['return'] ) { |
|
|
161
|
+ if ( 'url' === $this->settings[ 'return' ] ) { |
|
162
|
162
|
return $url; |
|
163
|
163
|
} |
|
164
|
164
|
|
|
@@ -179,13 +179,13 @@ discard block |
|
|
block discarded – undo |
|
179
|
179
|
*/ |
|
180
|
180
|
private function get_link_atts() { |
|
181
|
181
|
|
|
182
|
|
- wp_parse_str( $this->settings['link_atts'], $link_atts ); |
|
|
182
|
+ wp_parse_str( $this->settings[ 'link_atts' ], $link_atts ); |
|
183
|
183
|
|
|
184
|
|
- if ( 'delete' === $this->settings['action'] ) { |
|
185
|
|
- $link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
|
184
|
+ if ( 'delete' === $this->settings[ 'action' ] ) { |
|
|
185
|
+ $link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
186
|
186
|
} |
|
187
|
187
|
|
|
188
|
|
- return (array) $link_atts; |
|
|
188
|
+ return (array)$link_atts; |
|
189
|
189
|
} |
|
190
|
190
|
|
|
191
|
191
|
/** |
|
@@ -205,7 +205,7 @@ discard block |
|
|
block discarded – undo |
|
205
|
205
|
return $content; |
|
206
|
206
|
} |
|
207
|
207
|
|
|
208
|
|
- switch ( $this->settings['action'] ) { |
|
|
208
|
+ switch ( $this->settings[ 'action' ] ) { |
|
209
|
209
|
case 'edit': |
|
210
|
210
|
$anchor_text = __( 'Edit Entry', 'gravityview' ); |
|
211
|
211
|
break; |
|
@@ -233,9 +233,9 @@ discard block |
|
|
block discarded – undo |
|
233
|
233
|
private function get_url() { |
|
234
|
234
|
|
|
235
|
235
|
// if post_id is not defined, default to view_id |
|
236
|
|
- $post_id = empty( $this->settings['post_id'] ) ? null : absint( $this->settings['post_id'] ); |
|
|
236
|
+ $post_id = empty( $this->settings[ 'post_id' ] ) ? null : absint( $this->settings[ 'post_id' ] ); |
|
237
|
237
|
|
|
238
|
|
- switch ( $this->settings['action'] ) { |
|
|
238
|
+ switch ( $this->settings[ 'action' ] ) { |
|
239
|
239
|
case 'edit': |
|
240
|
240
|
$url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id ); |
|
241
|
241
|
break; |
|
@@ -260,7 +260,7 @@ discard block |
|
|
block discarded – undo |
|
260
|
260
|
*/ |
|
261
|
261
|
private function has_cap() { |
|
262
|
262
|
|
|
263
|
|
- switch ( $this->settings['action'] ) { |
|
|
263
|
+ switch ( $this->settings[ 'action' ] ) { |
|
264
|
264
|
case 'edit': |
|
265
|
265
|
$has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id ); |
|
266
|
266
|
break; |
|
@@ -325,9 +325,9 @@ discard block |
|
|
block discarded – undo |
|
325
|
325
|
*/ |
|
326
|
326
|
private function maybe_add_field_values_query_args( $url ) { |
|
327
|
327
|
|
|
328
|
|
- if ( $url && ! empty( $this->settings['field_values'] ) ) { |
|
|
328
|
+ if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) { |
|
329
|
329
|
|
|
330
|
|
- wp_parse_str( $this->settings['field_values'], $field_values ); |
|
|
330
|
+ wp_parse_str( $this->settings[ 'field_values' ], $field_values ); |
|
331
|
331
|
|
|
332
|
332
|
$url = add_query_arg( $field_values, $url ); |
|
333
|
333
|
} |