@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | static function getInstance() { |
44 | 44 | |
45 | - if( empty( self::$instance ) ) { |
|
45 | + if ( empty( self::$instance ) ) { |
|
46 | 46 | self::$instance = new self; |
47 | 47 | |
48 | 48 | self::$instance->initialize(); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // Catch either |
100 | 100 | $match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})"; |
101 | 101 | |
102 | - return '#'.$match_regex.'#i'; |
|
102 | + return '#' . $match_regex . '#i'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | |
119 | 119 | $post_id = url_to_postid( $url ); |
120 | 120 | |
121 | - if( empty( $post_id ) ) { |
|
121 | + if ( empty( $post_id ) ) { |
|
122 | 122 | |
123 | 123 | $args = array( |
124 | 124 | 'post_status' => 'publish', |
125 | 125 | 'name' => $slug, |
126 | - 'post_type' => array('any', 'gravityview'), |
|
126 | + 'post_type' => array( 'any', 'gravityview' ), |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | $posts = get_posts( $args ); |
130 | 130 | |
131 | - if( !empty( $posts ) ) { |
|
132 | - $post_id = $posts[0]->ID; |
|
131 | + if ( ! empty( $posts ) ) { |
|
132 | + $post_id = $posts[ 0 ]->ID; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | public function render_handler( $matches, $attr, $url, $rawattr ) { |
163 | 163 | |
164 | 164 | // If not using permalinks, re-assign values for matching groups |
165 | - if( !empty( $matches['entry_slug2'] ) ) { |
|
166 | - $matches['is_cpt'] = $matches['is_cpt2']; |
|
167 | - $matches['slug'] = $matches['slug2']; |
|
168 | - $matches['entry_slug'] = $matches['entry_slug2']; |
|
169 | - unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] ); |
|
165 | + if ( ! empty( $matches[ 'entry_slug2' ] ) ) { |
|
166 | + $matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ]; |
|
167 | + $matches[ 'slug' ] = $matches[ 'slug2' ]; |
|
168 | + $matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ]; |
|
169 | + unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] ); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | // No Entry was found |
173 | - if( empty( $matches['entry_slug'] ) ) { |
|
173 | + if ( empty( $matches[ 'entry_slug' ] ) ) { |
|
174 | 174 | |
175 | - do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
175 | + do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
176 | 176 | |
177 | 177 | return ''; |
178 | 178 | } |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | // Setup the data used |
183 | 183 | $this->set_vars( $matches, $attr, $url, $rawattr ); |
184 | 184 | |
185 | - if( is_admin() && !$this->is_full_oembed_preview ) { |
|
185 | + if ( is_admin() && ! $this->is_full_oembed_preview ) { |
|
186 | 186 | $return = $this->render_admin( $matches, $attr, $url, $rawattr ); |
187 | 187 | } else { |
188 | 188 | |
189 | - if( $this->is_full_oembed_preview ) { |
|
189 | + if ( $this->is_full_oembed_preview ) { |
|
190 | 190 | $return .= $this->generate_preview_notice(); |
191 | 191 | } |
192 | 192 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | private function generate_preview_notice() { |
206 | 206 | $floaty = GravityView_Admin::get_floaty(); |
207 | 207 | $title = esc_html__( 'This will look better when it is embedded.', 'gravityview' ); |
208 | - $message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview'); |
|
209 | - return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>'; |
|
208 | + $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' ); |
|
209 | + return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>'; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -219,20 +219,20 @@ discard block |
||
219 | 219 | */ |
220 | 220 | private function set_vars( $matches, $attr, $url, $rawattr ) { |
221 | 221 | |
222 | - $this->entry_id = $matches['entry_slug']; |
|
222 | + $this->entry_id = $matches[ 'entry_slug' ]; |
|
223 | 223 | |
224 | - $post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] ); |
|
224 | + $post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] ); |
|
225 | 225 | |
226 | 226 | // The URL didn't have the View Custom Post Type structure. |
227 | - if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) { |
|
227 | + if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) { |
|
228 | 228 | |
229 | - do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
229 | + do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
230 | 230 | |
231 | 231 | if ( false /** Do not use for now. See issue #848 */ && function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) { |
232 | 232 | $views = \GV\View_Collection::from_post( $post ); |
233 | 233 | $views = $views->all(); |
234 | 234 | if ( ! empty( $views ) ) |
235 | - $this->view_id = $views[0]->ID; |
|
235 | + $this->view_id = $views[ 0 ]->ID; |
|
236 | 236 | } else { |
237 | 237 | /** Deprecated. */ |
238 | 238 | $this->view_id = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id ); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | // The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that. |
248 | - $this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) ); |
|
248 | + $this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -263,15 +263,15 @@ discard block |
||
263 | 263 | // Floaty the astronaut |
264 | 264 | $image = GravityView_Admin::get_floaty(); |
265 | 265 | |
266 | - $embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id ); |
|
266 | + $embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id ); |
|
267 | 267 | |
268 | - $embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id ); |
|
268 | + $embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id ); |
|
269 | 269 | |
270 | 270 | return ' |
271 | 271 | <div class="loading-placeholder" style="background-color:#e6f0f5;"> |
272 | - <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3> |
|
272 | + <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3> |
|
273 | 273 | <p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;"> |
274 | - '.$embed_text.' |
|
274 | + '.$embed_text . ' |
|
275 | 275 | </p> |
276 | 276 | <br style="clear: both;"> |
277 | 277 | </div>'; |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | private function render_frontend( $matches, $attr, $url, $rawattr ) { |
327 | 327 | |
328 | 328 | // If it's already been parsed, don't re-output it. |
329 | - if( !empty( $this->output[ $this->entry_id ] ) ) { |
|
329 | + if ( ! empty( $this->output[ $this->entry_id ] ) ) { |
|
330 | 330 | return $this->output[ $this->entry_id ]; |
331 | 331 | } |
332 | 332 | |
333 | 333 | $entry_output = $this->generate_entry_output(); |
334 | 334 | |
335 | 335 | // Wrap a container div around the output to allow for custom styling |
336 | - $output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output ); |
|
336 | + $output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output ); |
|
337 | 337 | |
338 | 338 | /** |
339 | 339 | * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @var string $url The original URL that was matched by the regex. \n |
347 | 347 | * @var array $rawattr The original unmodified attributes. |
348 | 348 | */ |
349 | - $output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
349 | + $output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
350 | 350 | |
351 | 351 | unset( $entry_output ); |
352 | 352 |
@@ -231,8 +231,9 @@ |
||
231 | 231 | if ( false /** Do not use for now. See issue #848 */ && function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) { |
232 | 232 | $views = \GV\View_Collection::from_post( $post ); |
233 | 233 | $views = $views->all(); |
234 | - if ( ! empty( $views ) ) |
|
235 | - $this->view_id = $views[0]->ID; |
|
234 | + if ( ! empty( $views ) ) { |
|
235 | + $this->view_id = $views[0]->ID; |
|
236 | + } |
|
236 | 237 | } else { |
237 | 238 | /** Deprecated. */ |
238 | 239 | $this->view_id = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id ); |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | */ |
18 | 18 | private function __construct( $passed_post = NULL ) { |
19 | 19 | |
20 | - if( !empty( $passed_post ) ) { |
|
20 | + if ( ! empty( $passed_post ) ) { |
|
21 | 21 | |
22 | 22 | $id_or_id_array = $this->maybe_get_view_id( $passed_post ); |
23 | 23 | |
24 | - if( !empty( $id_or_id_array ) ) { |
|
24 | + if ( ! empty( $id_or_id_array ) ) { |
|
25 | 25 | $this->add_view( $id_or_id_array ); |
26 | 26 | } |
27 | 27 | } |
@@ -58,40 +58,40 @@ discard block |
||
58 | 58 | public function maybe_get_view_id( $passed_post ) { |
59 | 59 | $ids = array(); |
60 | 60 | |
61 | - if( ! empty( $passed_post ) ) { |
|
61 | + if ( ! empty( $passed_post ) ) { |
|
62 | 62 | |
63 | - if( is_numeric( $passed_post ) ) { |
|
63 | + if ( is_numeric( $passed_post ) ) { |
|
64 | 64 | $passed_post = get_post( $passed_post ); |
65 | 65 | } |
66 | 66 | |
67 | 67 | // Convert WP_Posts into WP_Posts[] array |
68 | - if( $passed_post instanceof WP_Post ) { |
|
68 | + if ( $passed_post instanceof WP_Post ) { |
|
69 | 69 | $passed_post = array( $passed_post ); |
70 | 70 | } |
71 | 71 | |
72 | - if( is_array( $passed_post ) ) { |
|
72 | + if ( is_array( $passed_post ) ) { |
|
73 | 73 | |
74 | - foreach ( $passed_post as &$post) { |
|
74 | + foreach ( $passed_post as &$post ) { |
|
75 | 75 | if ( false /** Do not use for now. See issue #848 */ && function_exists( 'gravityview' ) && $post instanceof WP_Post ) { |
76 | 76 | $views = \GV\View_Collection::from_post( $post ); |
77 | 77 | foreach ( $views->all() as $view ) { |
78 | - $ids []= $view->ID; |
|
78 | + $ids [ ] = $view->ID; |
|
79 | 79 | } |
80 | 80 | } else { |
81 | 81 | /** Deprecated, see \GV\View_Collection::from_post */ |
82 | - if( ( get_post_type( $post ) === 'gravityview' ) ) { |
|
83 | - $ids[] = $post->ID; |
|
84 | - } else{ |
|
82 | + if ( ( get_post_type( $post ) === 'gravityview' ) ) { |
|
83 | + $ids[ ] = $post->ID; |
|
84 | + } else { |
|
85 | 85 | // Parse the Post Content |
86 | 86 | $id = $this->parse_post_content( $post->post_content ); |
87 | - if( $id ) { |
|
88 | - $ids = array_merge( $ids, (array) $id ); |
|
87 | + if ( $id ) { |
|
88 | + $ids = array_merge( $ids, (array)$id ); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // Parse the Post Meta |
92 | 92 | $id = $this->parse_post_meta( $post->ID ); |
93 | - if( $id ) { |
|
94 | - $ids = array_merge( $ids, (array) $id ); |
|
93 | + if ( $id ) { |
|
94 | + $ids = array_merge( $ids, (array)$id ); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
@@ -105,31 +105,31 @@ discard block |
||
105 | 105 | if ( false /** Do not use for now. See issue #848 */ && function_exists( 'gravityview' ) ) { |
106 | 106 | $shortcodes = \GV\Shortcode::parse( $passed_post ); |
107 | 107 | foreach ( $shortcodes as $shortcode ) { |
108 | - if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) ) |
|
109 | - $ids []= $shortcode->atts['id']; |
|
108 | + if ( $shortcode->name == 'gravityview' && ! empty( $shortcode->atts[ 'id' ] ) ) |
|
109 | + $ids [ ] = $shortcode->atts[ 'id' ]; |
|
110 | 110 | } |
111 | 111 | } else { |
112 | 112 | /** Deprecated, use \GV\Shortcode::parse. */ |
113 | 113 | $id = $this->parse_post_content( $passed_post ); |
114 | - if( $id ) { |
|
115 | - $ids = array_merge( $ids, (array) $id ); |
|
114 | + if ( $id ) { |
|
115 | + $ids = array_merge( $ids, (array)$id ); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | 119 | } else { |
120 | 120 | $id = $this->get_id_from_atts( $passed_post ); |
121 | - $ids[] = intval( $id ); |
|
121 | + $ids[ ] = intval( $id ); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - if( empty($ids) ) { |
|
126 | + if ( empty( $ids ) ) { |
|
127 | 127 | return NULL; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // If it's just one ID, return that. |
131 | 131 | // Otherwise, return array of IDs |
132 | - return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids; |
|
132 | + return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public static function getInstance( $passed_post = NULL ) { |
139 | 139 | |
140 | - if( empty( self::$instance ) ) { |
|
140 | + if ( empty( self::$instance ) ) { |
|
141 | 141 | self::$instance = new GravityView_View_Data( $passed_post ); |
142 | 142 | } |
143 | 143 | |
@@ -150,19 +150,19 @@ discard block |
||
150 | 150 | |
151 | 151 | function get_view( $view_id, $atts = NULL ) { |
152 | 152 | |
153 | - if( ! is_numeric( $view_id) ) { |
|
154 | - do_action('gravityview_log_error', sprintf('GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id) ); |
|
153 | + if ( ! is_numeric( $view_id ) ) { |
|
154 | + do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id ) ); |
|
155 | 155 | return false; |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Backup: the view hasn't been fetched yet. Doing it now. |
159 | 159 | if ( ! isset( $this->views[ $view_id ] ) ) { |
160 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] View #%s not set yet.', $view_id) ); |
|
160 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] View #%s not set yet.', $view_id ) ); |
|
161 | 161 | return $this->add_view( $view_id, $atts ); |
162 | 162 | } |
163 | 163 | |
164 | 164 | if ( empty( $this->views[ $view_id ] ) ) { |
165 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id) ); |
|
165 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id ) ); |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | function add_view( $view_id, $atts = NULL ) { |
194 | 194 | |
195 | 195 | // Handle array of IDs |
196 | - if( is_array( $view_id ) ) { |
|
197 | - foreach( $view_id as $id ) { |
|
196 | + if ( is_array( $view_id ) ) { |
|
197 | + foreach ( $view_id as $id ) { |
|
198 | 198 | |
199 | 199 | $this->add_view( $id, $atts ); |
200 | 200 | } |
@@ -203,21 +203,21 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | // The view has been set already; returning stored view. |
206 | - if ( !empty( $this->views[ $view_id ] ) ) { |
|
207 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id) ); |
|
206 | + if ( ! empty( $this->views[ $view_id ] ) ) { |
|
207 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id ) ); |
|
208 | 208 | return $this->views[ $view_id ]; |
209 | 209 | } |
210 | 210 | |
211 | - if( ! $this->view_exists( $view_id ) ) { |
|
212 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id) ); |
|
211 | + if ( ! $this->view_exists( $view_id ) ) { |
|
212 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id ) ); |
|
213 | 213 | return false; |
214 | 214 | } |
215 | 215 | |
216 | 216 | $form_id = gravityview_get_form_id( $view_id ); |
217 | 217 | |
218 | - if( empty( $form_id ) ) { |
|
218 | + if ( empty( $form_id ) ) { |
|
219 | 219 | |
220 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id) ); |
|
220 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id ) ); |
|
221 | 221 | |
222 | 222 | return false; |
223 | 223 | } |
@@ -225,21 +225,21 @@ discard block |
||
225 | 225 | // Get the settings for the View ID |
226 | 226 | $view_settings = gravityview_get_template_settings( $view_id ); |
227 | 227 | |
228 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id), $view_settings ); |
|
228 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id ), $view_settings ); |
|
229 | 229 | |
230 | 230 | // Merge the view settings with the defaults |
231 | 231 | $view_defaults = wp_parse_args( $view_settings, self::get_default_args() ); |
232 | 232 | |
233 | - do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults ); |
|
233 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults ); |
|
234 | 234 | |
235 | - if( ! empty( $atts ) && is_array( $atts ) ) { |
|
235 | + if ( ! empty( $atts ) && is_array( $atts ) ) { |
|
236 | 236 | |
237 | - do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging with the $view_defaults', $atts ); |
|
237 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging with the $view_defaults', $atts ); |
|
238 | 238 | |
239 | 239 | // Get the settings from the shortcode and merge them with defaults. |
240 | 240 | $atts = shortcode_atts( $view_defaults, $atts ); |
241 | 241 | |
242 | - do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging with the $view_defaults', $atts ); |
|
242 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging with the $view_defaults', $atts ); |
|
243 | 243 | |
244 | 244 | } else { |
245 | 245 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | - unset( $atts['id'], $view_defaults, $view_settings ); |
|
251 | + unset( $atts[ 'id' ], $view_defaults, $view_settings ); |
|
252 | 252 | |
253 | 253 | $data = array( |
254 | 254 | 'id' => $view_id, |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | 'form' => gravityview_get_form( $form_id ), |
262 | 262 | ); |
263 | 263 | |
264 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] View #%s being added.', $view_id), $data ); |
|
264 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] View #%s being added.', $view_id ), $data ); |
|
265 | 265 | |
266 | 266 | $this->views[ $view_id ] = $data; |
267 | 267 | |
@@ -296,15 +296,15 @@ discard block |
||
296 | 296 | */ |
297 | 297 | private function filter_fields( $dir_fields ) { |
298 | 298 | |
299 | - if( empty( $dir_fields ) || !is_array( $dir_fields ) ) { |
|
299 | + if ( empty( $dir_fields ) || ! is_array( $dir_fields ) ) { |
|
300 | 300 | return $dir_fields; |
301 | 301 | } |
302 | 302 | |
303 | - foreach( $dir_fields as $area => $fields ) { |
|
303 | + foreach ( $dir_fields as $area => $fields ) { |
|
304 | 304 | |
305 | - foreach( (array)$fields as $uniqid => $properties ) { |
|
305 | + foreach ( (array)$fields as $uniqid => $properties ) { |
|
306 | 306 | |
307 | - if( $this->hide_field_check_conditions( $properties ) ) { |
|
307 | + if ( $this->hide_field_check_conditions( $properties ) ) { |
|
308 | 308 | unset( $dir_fields[ $area ][ $uniqid ] ); |
309 | 309 | } |
310 | 310 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | private function hide_field_check_conditions( $properties ) { |
327 | 327 | |
328 | 328 | // logged-in visibility |
329 | - if( ! empty( $properties['only_loggedin'] ) && ! GVCommon::has_cap( $properties['only_loggedin_cap'] ) ) { |
|
329 | + if ( ! empty( $properties[ 'only_loggedin' ] ) && ! GVCommon::has_cap( $properties[ 'only_loggedin_cap' ] ) ) { |
|
330 | 330 | return true; |
331 | 331 | } |
332 | 332 | |
@@ -343,14 +343,14 @@ discard block |
||
343 | 343 | // Get the settings from the shortcode and merge them with defaults. |
344 | 344 | $atts = wp_parse_args( $atts, self::get_default_args() ); |
345 | 345 | |
346 | - $view_id = ! empty( $atts['view_id'] ) ? (int)$atts['view_id'] : NULL; |
|
346 | + $view_id = ! empty( $atts[ 'view_id' ] ) ? (int)$atts[ 'view_id' ] : NULL; |
|
347 | 347 | |
348 | - if( empty( $view_id ) && !empty( $atts['id'] ) ) { |
|
349 | - $view_id = (int)$atts['id']; |
|
348 | + if ( empty( $view_id ) && ! empty( $atts[ 'id' ] ) ) { |
|
349 | + $view_id = (int)$atts[ 'id' ]; |
|
350 | 350 | } |
351 | 351 | |
352 | - if( empty( $view_id ) ) { |
|
353 | - do_action('gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts ); |
|
352 | + if ( empty( $view_id ) ) { |
|
353 | + do_action( 'gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts ); |
|
354 | 354 | return; |
355 | 355 | } |
356 | 356 | |
@@ -372,46 +372,46 @@ discard block |
||
372 | 372 | * @hack This is so that the shortcode is registered for the oEmbed preview in the Admin |
373 | 373 | * @since 1.6 |
374 | 374 | */ |
375 | - if( ! shortcode_exists('gravityview') && class_exists( 'GravityView_Shortcode' ) ) { |
|
375 | + if ( ! shortcode_exists( 'gravityview' ) && class_exists( 'GravityView_Shortcode' ) ) { |
|
376 | 376 | new GravityView_Shortcode; |
377 | 377 | } |
378 | 378 | |
379 | 379 | $shortcodes = gravityview_has_shortcode_r( $content, 'gravityview' ); |
380 | 380 | |
381 | - if( empty( $shortcodes ) ) { |
|
381 | + if ( empty( $shortcodes ) ) { |
|
382 | 382 | return NULL; |
383 | 383 | } |
384 | 384 | |
385 | - do_action('gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes ); |
|
385 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes ); |
|
386 | 386 | |
387 | 387 | $ids = array(); |
388 | 388 | |
389 | - foreach ($shortcodes as $key => $shortcode) { |
|
389 | + foreach ( $shortcodes as $key => $shortcode ) { |
|
390 | 390 | |
391 | - $shortcode[3] = htmlspecialchars_decode( $shortcode[3], ENT_QUOTES ); |
|
391 | + $shortcode[ 3 ] = htmlspecialchars_decode( $shortcode[ 3 ], ENT_QUOTES ); |
|
392 | 392 | |
393 | - $args = shortcode_parse_atts( $shortcode[3] ); |
|
393 | + $args = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
394 | 394 | |
395 | - if( empty( $args['id'] ) ) { |
|
396 | - do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode ); |
|
395 | + if ( empty( $args[ 'id' ] ) ) { |
|
396 | + do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode ); |
|
397 | 397 | continue; |
398 | 398 | } |
399 | 399 | |
400 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args['id']), $args ); |
|
400 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args[ 'id' ] ), $args ); |
|
401 | 401 | |
402 | 402 | // Store the View to the object for later fetching. |
403 | - $this->add_view( $args['id'], $args ); |
|
403 | + $this->add_view( $args[ 'id' ], $args ); |
|
404 | 404 | |
405 | - $ids[] = $args['id']; |
|
405 | + $ids[ ] = $args[ 'id' ]; |
|
406 | 406 | } |
407 | 407 | |
408 | - if( empty($ids) ) { |
|
408 | + if ( empty( $ids ) ) { |
|
409 | 409 | return NULL; |
410 | 410 | } |
411 | 411 | |
412 | 412 | // If it's just one ID, return that. |
413 | 413 | // Otherwise, return array of IDs |
414 | - return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids; |
|
414 | + return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
415 | 415 | |
416 | 416 | } |
417 | 417 | |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | */ |
433 | 433 | $meta_keys = (array)apply_filters( 'gravityview/data/parse/meta_keys', array(), $post_id ); |
434 | 434 | |
435 | - if( empty( $meta_keys ) ) { |
|
435 | + if ( empty( $meta_keys ) ) { |
|
436 | 436 | return NULL; |
437 | 437 | } |
438 | 438 | |
@@ -440,16 +440,16 @@ discard block |
||
440 | 440 | |
441 | 441 | $meta_content = ''; |
442 | 442 | |
443 | - foreach( $meta_keys as $key ) { |
|
444 | - $meta = get_post_meta( $post_id, $key , true ); |
|
445 | - if( ! is_string( $meta ) ) { |
|
443 | + foreach ( $meta_keys as $key ) { |
|
444 | + $meta = get_post_meta( $post_id, $key, true ); |
|
445 | + if ( ! is_string( $meta ) ) { |
|
446 | 446 | continue; |
447 | 447 | } |
448 | 448 | $meta_content .= $meta . ' '; |
449 | 449 | } |
450 | 450 | |
451 | - if( empty( $meta_content ) ) { |
|
452 | - do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys ); |
|
451 | + if ( empty( $meta_content ) ) { |
|
452 | + do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys ); |
|
453 | 453 | return NULL; |
454 | 454 | } |
455 | 455 | |
@@ -476,16 +476,16 @@ discard block |
||
476 | 476 | $message = NULL; |
477 | 477 | |
478 | 478 | // Not invalid if not set! |
479 | - if( empty( $post_id ) || empty( $view_id ) ) { |
|
479 | + if ( empty( $post_id ) || empty( $view_id ) ) { |
|
480 | 480 | |
481 | - if( $empty_is_valid ) { |
|
481 | + if ( $empty_is_valid ) { |
|
482 | 482 | return true; |
483 | 483 | } |
484 | 484 | |
485 | 485 | $message = esc_html__( 'The ID is required.', 'gravityview' ); |
486 | 486 | } |
487 | 487 | |
488 | - if( ! $message ) { |
|
488 | + if ( ! $message ) { |
|
489 | 489 | $status = get_post_status( $post_id ); |
490 | 490 | |
491 | 491 | // Nothing exists with that post ID. |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
500 | - if( ! $message ) { |
|
500 | + if ( ! $message ) { |
|
501 | 501 | |
502 | 502 | // Nothing exists with that post ID. |
503 | 503 | if ( empty( $status ) || in_array( $status, array( 'revision', 'attachment' ) ) ) { |
@@ -506,8 +506,8 @@ discard block |
||
506 | 506 | |
507 | 507 | } |
508 | 508 | |
509 | - if( ! $message ) { |
|
510 | - if ( false /** Do not use for now. See issue #848 */ && function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) { |
|
509 | + if ( ! $message ) { |
|
510 | + if ( false /** Do not use for now. See issue #848 */ && function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) { |
|
511 | 511 | $views = GV\View_Collection::from_post( $post ); |
512 | 512 | $view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() ); |
513 | 513 | } else { |
@@ -516,21 +516,21 @@ discard block |
||
516 | 516 | } |
517 | 517 | |
518 | 518 | // The post or page specified does not contain the shortcode. |
519 | - if ( false === in_array( $view_id, (array) $view_ids_in_post ) ) { |
|
519 | + if ( false === in_array( $view_id, (array)$view_ids_in_post ) ) { |
|
520 | 520 | $message = sprintf( esc_html__( 'The Post ID entered is not valid. You may have entered a post or page that does not contain the selected View. Make sure the post contains the following shortcode: %s', 'gravityview' ), '<br /><code>[gravityview id="' . intval( $view_id ) . '"]</code>' ); |
521 | 521 | } |
522 | 522 | } |
523 | 523 | |
524 | - if( ! $message ) { |
|
524 | + if ( ! $message ) { |
|
525 | 525 | |
526 | 526 | // It's a View |
527 | - if( 'gravityview' === get_post_type( $post_id ) ) { |
|
528 | - $message = esc_html__( 'The ID is already a View.', 'gravityview' );; |
|
527 | + if ( 'gravityview' === get_post_type( $post_id ) ) { |
|
528 | + $message = esc_html__( 'The ID is already a View.', 'gravityview' ); ; |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | } |
532 | 532 | |
533 | - if( $message ) { |
|
533 | + if ( $message ) { |
|
534 | 534 | return new WP_Error( 'invalid_embed_id', $message ); |
535 | 535 | } |
536 | 536 | |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | $args = self::get_default_args( $with_details ); |
549 | 549 | |
550 | - if( !isset( $args[ $key ] ) ) { return NULL; } |
|
550 | + if ( ! isset( $args[ $key ] ) ) { return NULL; } |
|
551 | 551 | |
552 | 552 | return $args[ $key ]; |
553 | 553 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | */ |
577 | 577 | $default_settings = apply_filters( 'gravityview_default_args', array( |
578 | 578 | 'id' => array( |
579 | - 'label' => __('View ID', 'gravityview'), |
|
579 | + 'label' => __( 'View ID', 'gravityview' ), |
|
580 | 580 | 'type' => 'number', |
581 | 581 | 'group' => 'default', |
582 | 582 | 'value' => NULL, |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | 'show_in_shortcode' => false, |
585 | 585 | ), |
586 | 586 | 'page_size' => array( |
587 | - 'label' => __('Number of entries per page', 'gravityview'), |
|
587 | + 'label' => __( 'Number of entries per page', 'gravityview' ), |
|
588 | 588 | 'type' => 'number', |
589 | 589 | 'class' => 'small-text', |
590 | 590 | 'group' => 'default', |
@@ -608,8 +608,8 @@ discard block |
||
608 | 608 | ), |
609 | 609 | 'admin_show_all_statuses' => array( |
610 | 610 | 'label' => __( 'Show all entries to administrators', 'gravityview' ), |
611 | - 'desc' => __('Administrators will be able to see entries with any approval status.', 'gravityview'), |
|
612 | - 'tooltip' => __('Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview'), |
|
611 | + 'desc' => __( 'Administrators will be able to see entries with any approval status.', 'gravityview' ), |
|
612 | + 'tooltip' => __( 'Logged-out visitors and non-administrators will only see approved entries, while administrators will see entries with all statuses. This makes it easier for administrators to moderate entries from a View.', 'gravityview' ), |
|
613 | 613 | 'requires' => 'show_only_approved', |
614 | 614 | 'type' => 'checkbox', |
615 | 615 | 'group' => 'default', |
@@ -634,40 +634,40 @@ discard block |
||
634 | 634 | 'user_edit' => array( |
635 | 635 | 'label' => __( 'Allow User Edit', 'gravityview' ), |
636 | 636 | 'group' => 'default', |
637 | - 'desc' => __('Allow logged-in users to edit entries they created.', 'gravityview'), |
|
637 | + 'desc' => __( 'Allow logged-in users to edit entries they created.', 'gravityview' ), |
|
638 | 638 | 'value' => 0, |
639 | - 'tooltip' => __('Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview'), |
|
639 | + 'tooltip' => __( 'Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview' ), |
|
640 | 640 | 'type' => 'checkbox', |
641 | 641 | 'show_in_shortcode' => true, |
642 | 642 | ), |
643 | 643 | 'user_delete' => array( |
644 | 644 | 'label' => __( 'Allow User Delete', 'gravityview' ), |
645 | 645 | 'group' => 'default', |
646 | - 'desc' => __('Allow logged-in users to delete entries they created.', 'gravityview'), |
|
646 | + 'desc' => __( 'Allow logged-in users to delete entries they created.', 'gravityview' ), |
|
647 | 647 | 'value' => 0, |
648 | - 'tooltip' => __('Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview'), |
|
648 | + 'tooltip' => __( 'Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview' ), |
|
649 | 649 | 'type' => 'checkbox', |
650 | 650 | 'show_in_shortcode' => true, |
651 | 651 | ), |
652 | 652 | 'sort_field' => array( |
653 | - 'label' => __('Sort by field', 'gravityview'), |
|
653 | + 'label' => __( 'Sort by field', 'gravityview' ), |
|
654 | 654 | 'type' => 'select', |
655 | 655 | 'value' => '', |
656 | 656 | 'group' => 'sort', |
657 | 657 | 'options' => array( |
658 | - '' => __( 'Default', 'gravityview'), |
|
659 | - 'date_created' => __( 'Date Created', 'gravityview'), |
|
658 | + '' => __( 'Default', 'gravityview' ), |
|
659 | + 'date_created' => __( 'Date Created', 'gravityview' ), |
|
660 | 660 | ), |
661 | 661 | 'show_in_shortcode' => true, |
662 | 662 | ), |
663 | 663 | 'sort_direction' => array( |
664 | - 'label' => __('Sort direction', 'gravityview'), |
|
664 | + 'label' => __( 'Sort direction', 'gravityview' ), |
|
665 | 665 | 'type' => 'select', |
666 | 666 | 'value' => 'ASC', |
667 | 667 | 'group' => 'sort', |
668 | 668 | 'options' => array( |
669 | - 'ASC' => __('ASC', 'gravityview'), |
|
670 | - 'DESC' => __('DESC', 'gravityview'), |
|
669 | + 'ASC' => __( 'ASC', 'gravityview' ), |
|
670 | + 'DESC' => __( 'DESC', 'gravityview' ), |
|
671 | 671 | //'RAND' => __('Random', 'gravityview'), |
672 | 672 | ), |
673 | 673 | 'show_in_shortcode' => true, |
@@ -683,69 +683,69 @@ discard block |
||
683 | 683 | 'show_in_template' => array( 'default_table' ), |
684 | 684 | ), |
685 | 685 | 'start_date' => array( |
686 | - 'label' => __('Filter by Start Date', 'gravityview'), |
|
686 | + 'label' => __( 'Filter by Start Date', 'gravityview' ), |
|
687 | 687 | 'class' => 'gv-datepicker', |
688 | - 'desc' => __('Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ), |
|
688 | + 'desc' => __( 'Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ), |
|
689 | 689 | 'type' => 'text', |
690 | 690 | 'value' => '', |
691 | 691 | 'group' => 'filter', |
692 | 692 | 'show_in_shortcode' => true, |
693 | 693 | ), |
694 | 694 | 'end_date' => array( |
695 | - 'label' => __('Filter by End Date', 'gravityview'), |
|
695 | + 'label' => __( 'Filter by End Date', 'gravityview' ), |
|
696 | 696 | 'class' => 'gv-datepicker', |
697 | - 'desc' => __('Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ), |
|
697 | + 'desc' => __( 'Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ), |
|
698 | 698 | 'type' => 'text', |
699 | 699 | 'value' => '', |
700 | 700 | 'group' => 'filter', |
701 | 701 | 'show_in_shortcode' => true, |
702 | 702 | ), |
703 | 703 | 'class' => array( |
704 | - 'label' => __('CSS Class', 'gravityview'), |
|
705 | - 'desc' => __('CSS class to add to the wrapping HTML container.', 'gravityview'), |
|
704 | + 'label' => __( 'CSS Class', 'gravityview' ), |
|
705 | + 'desc' => __( 'CSS class to add to the wrapping HTML container.', 'gravityview' ), |
|
706 | 706 | 'group' => 'default', |
707 | 707 | 'type' => 'text', |
708 | 708 | 'value' => '', |
709 | 709 | 'show_in_shortcode' => false, |
710 | 710 | ), |
711 | 711 | 'search_value' => array( |
712 | - 'label' => __('Search Value', 'gravityview'), |
|
713 | - 'desc' => __('Define a default search value for the View', 'gravityview'), |
|
712 | + 'label' => __( 'Search Value', 'gravityview' ), |
|
713 | + 'desc' => __( 'Define a default search value for the View', 'gravityview' ), |
|
714 | 714 | 'type' => 'text', |
715 | 715 | 'value' => '', |
716 | 716 | 'group' => 'filter', |
717 | 717 | 'show_in_shortcode' => false, |
718 | 718 | ), |
719 | 719 | 'search_field' => array( |
720 | - 'label' => __('Search Field', 'gravityview'), |
|
721 | - 'desc' => __('If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview'), |
|
720 | + 'label' => __( 'Search Field', 'gravityview' ), |
|
721 | + 'desc' => __( 'If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview' ), |
|
722 | 722 | 'type' => 'number', |
723 | 723 | 'value' => '', |
724 | 724 | 'group' => 'filter', |
725 | 725 | 'show_in_shortcode' => false, |
726 | 726 | ), |
727 | 727 | 'single_title' => array( |
728 | - 'label' => __('Single Entry Title', 'gravityview'), |
|
728 | + 'label' => __( 'Single Entry Title', 'gravityview' ), |
|
729 | 729 | 'type' => 'text', |
730 | - 'desc' => __('When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview'), |
|
730 | + 'desc' => __( 'When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview' ), |
|
731 | 731 | 'group' => 'default', |
732 | 732 | 'value' => '', |
733 | 733 | 'show_in_shortcode' => false, |
734 | 734 | 'full_width' => true, |
735 | 735 | ), |
736 | 736 | 'back_link_label' => array( |
737 | - 'label' => __('Back Link Label', 'gravityview'), |
|
737 | + 'label' => __( 'Back Link Label', 'gravityview' ), |
|
738 | 738 | 'group' => 'default', |
739 | - 'desc' => __('The text of the link that returns to the multiple entries view.', 'gravityview'), |
|
739 | + 'desc' => __( 'The text of the link that returns to the multiple entries view.', 'gravityview' ), |
|
740 | 740 | 'type' => 'text', |
741 | 741 | 'value' => '', |
742 | 742 | 'show_in_shortcode' => false, |
743 | 743 | 'full_width' => true, |
744 | 744 | ), |
745 | 745 | 'embed_only' => array( |
746 | - 'label' => __('Prevent Direct Access', 'gravityview'), |
|
746 | + 'label' => __( 'Prevent Direct Access', 'gravityview' ), |
|
747 | 747 | 'group' => 'default', |
748 | - 'desc' => __('Only allow access to this View when embedded using the shortcode.', 'gravityview'), |
|
748 | + 'desc' => __( 'Only allow access to this View when embedded using the shortcode.', 'gravityview' ), |
|
749 | 749 | 'type' => 'checkbox', |
750 | 750 | 'value' => '', |
751 | 751 | 'show_in_shortcode' => false, |
@@ -756,15 +756,15 @@ discard block |
||
756 | 756 | 'value' => '', |
757 | 757 | 'show_in_shortcode' => false, |
758 | 758 | ), |
759 | - )); |
|
759 | + ) ); |
|
760 | 760 | |
761 | 761 | // By default, we only want the key => value pairing, not the whole array. |
762 | - if( empty( $with_details ) ) { |
|
762 | + if ( empty( $with_details ) ) { |
|
763 | 763 | |
764 | 764 | $defaults = array(); |
765 | 765 | |
766 | - foreach( $default_settings as $key => $value ) { |
|
767 | - $defaults[ $key ] = $value['value']; |
|
766 | + foreach ( $default_settings as $key => $value ) { |
|
767 | + $defaults[ $key ] = $value[ 'value' ]; |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | return $defaults; |
@@ -773,12 +773,12 @@ discard block |
||
773 | 773 | // But sometimes, we want all the details. |
774 | 774 | else { |
775 | 775 | |
776 | - foreach ($default_settings as $key => $value) { |
|
776 | + foreach ( $default_settings as $key => $value ) { |
|
777 | 777 | |
778 | 778 | // If the $group argument is set for the method, |
779 | 779 | // ignore any settings that aren't in that group. |
780 | - if( !empty( $group ) && is_string( $group ) ) { |
|
781 | - if( empty( $value['group'] ) || $value['group'] !== $group ) { |
|
780 | + if ( ! empty( $group ) && is_string( $group ) ) { |
|
781 | + if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) { |
|
782 | 782 | unset( $default_settings[ $key ] ); |
783 | 783 | } |
784 | 784 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | /** Deprecated, see \GV\View_Collection::from_post */ |
82 | 82 | if( ( get_post_type( $post ) === 'gravityview' ) ) { |
83 | 83 | $ids[] = $post->ID; |
84 | - } else{ |
|
84 | + } else { |
|
85 | 85 | // Parse the Post Content |
86 | 86 | $id = $this->parse_post_content( $post->post_content ); |
87 | 87 | if( $id ) { |
@@ -105,8 +105,9 @@ discard block |
||
105 | 105 | if ( false /** Do not use for now. See issue #848 */ && function_exists( 'gravityview' ) ) { |
106 | 106 | $shortcodes = \GV\Shortcode::parse( $passed_post ); |
107 | 107 | foreach ( $shortcodes as $shortcode ) { |
108 | - if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) ) |
|
109 | - $ids []= $shortcode->atts['id']; |
|
108 | + if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) ) { |
|
109 | + $ids []= $shortcode->atts['id']; |
|
110 | + } |
|
110 | 111 | } |
111 | 112 | } else { |
112 | 113 | /** Deprecated, use \GV\Shortcode::parse. */ |
@@ -507,7 +508,7 @@ discard block |
||
507 | 508 | } |
508 | 509 | |
509 | 510 | if( ! $message ) { |
510 | - if ( false /** Do not use for now. See issue #848 */ && function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) { |
|
511 | + if ( false /** Do not use for now. See issue #848 */ && function_exists( 'gravityview' ) && $post = get_post( $post_id ) ) { |
|
511 | 512 | $views = GV\View_Collection::from_post( $post ); |
512 | 513 | $view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() ); |
513 | 514 | } else { |