@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | abstract class GravityView_Extension extends \GV\Extension { |
16 | 16 | public function __construct() { |
17 | - if( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) { |
|
17 | + if ( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) { |
|
18 | 18 | gravityview()->log->warning( '\GravityView_Extension is deprecated. Inherit from \GV\Extension instead', array( 'data' => $this ) ); |
19 | 19 | } |
20 | 20 | parent::__construct(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | 'total' => wp_count_posts( 'gravityview' )->publish, |
64 | 64 | ); |
65 | 65 | foreach ( $items as $item ) { |
66 | - $data['views'][] = $this->prepare_view_for_response( $item, $request ); |
|
66 | + $data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return new \WP_REST_Response( $data, 200 ); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | $url = $request->get_url_params(); |
84 | 84 | |
85 | - $view_id = intval( $url['id'] ); |
|
85 | + $view_id = intval( $url[ 'id' ] ); |
|
86 | 86 | |
87 | 87 | $item = get_post( $view_id ); |
88 | 88 | |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | public function get_sub_items( $request ) { |
167 | 167 | |
168 | 168 | $url = $request->get_url_params(); |
169 | - $view_id = intval( $url['id'] ); |
|
169 | + $view_id = intval( $url[ 'id' ] ); |
|
170 | 170 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
171 | 171 | |
172 | - if( $post_id = $request->get_param('post_id') ) { |
|
172 | + if ( $post_id = $request->get_param( 'post_id' ) ) { |
|
173 | 173 | global $post; |
174 | 174 | |
175 | 175 | $post = get_post( $post_id ); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | $data = array( 'entries' => $entries->all(), 'total' => $entries->total() ); |
262 | 262 | |
263 | - foreach ( $data['entries'] as &$entry ) { |
|
263 | + foreach ( $data[ 'entries' ] as &$entry ) { |
|
264 | 264 | $entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' ); |
265 | 265 | } |
266 | 266 | |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function get_sub_item( $request ) { |
281 | 281 | $url = $request->get_url_params(); |
282 | - $view_id = intval( $url['id'] ); |
|
283 | - $entry_id = intval( $url['s_id'] ); |
|
282 | + $view_id = intval( $url[ 'id' ] ); |
|
283 | + $entry_id = intval( $url[ 's_id' ] ); |
|
284 | 284 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
285 | 285 | |
286 | 286 | $view = \GV\View::by_id( $view_id ); |
@@ -315,32 +315,32 @@ discard block |
||
315 | 315 | // Add all the WP_Post data |
316 | 316 | $view_post = $view_post->to_array(); |
317 | 317 | |
318 | - unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] ); |
|
318 | + unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] ); |
|
319 | 319 | |
320 | 320 | $return = wp_parse_args( $item, $view_post ); |
321 | 321 | |
322 | - $return['title'] = $return['post_title']; |
|
322 | + $return[ 'title' ] = $return[ 'post_title' ]; |
|
323 | 323 | |
324 | - $return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array(); |
|
325 | - unset( $return['atts'], $return['view_id'] ); |
|
324 | + $return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array(); |
|
325 | + unset( $return[ 'atts' ], $return[ 'view_id' ] ); |
|
326 | 326 | |
327 | - $return['search_criteria'] = array( |
|
327 | + $return[ 'search_criteria' ] = array( |
|
328 | 328 | 'page_size' => rgars( $return, 'settings/page_size' ), |
329 | 329 | 'sort_field' => rgars( $return, 'settings/sort_field' ), |
330 | 330 | 'sort_direction' => rgars( $return, 'settings/sort_direction' ), |
331 | 331 | 'offset' => rgars( $return, 'settings/offset' ), |
332 | 332 | ); |
333 | 333 | |
334 | - unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] ); |
|
334 | + unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] ); |
|
335 | 335 | |
336 | 336 | // Redact for non-logged ins |
337 | 337 | if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) { |
338 | - unset( $return['settings'] ); |
|
339 | - unset( $return['search_criteria'] ); |
|
338 | + unset( $return[ 'settings' ] ); |
|
339 | + unset( $return[ 'search_criteria' ] ); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) { |
343 | - unset( $return['form'] ); |
|
343 | + unset( $return[ 'form' ] ); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | return $return; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $view_id = func_get_arg( 1 ); // $view_id override |
357 | 357 | } else { |
358 | 358 | $url = $request->get_url_params(); |
359 | - $view_id = intval( $url['id'] ); |
|
359 | + $view_id = intval( $url[ 'id' ] ); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | if ( ! $view = \GV\View::by_id( $view_id ) ) { |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | $url = $request->get_url_params(); |
403 | - $view_id = intval( $url['id'] ); |
|
404 | - $entry_id = intval( $url['s_id'] ); |
|
403 | + $view_id = intval( $url[ 'id' ] ); |
|
404 | + $entry_id = intval( $url[ 's_id' ] ); |
|
405 | 405 | |
406 | 406 | $view = \GV\View::by_id( $view_id ); |
407 | 407 | |
@@ -409,11 +409,11 @@ discard block |
||
409 | 409 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
410 | 410 | } |
411 | 411 | |
412 | - if ( $entry['form_id'] != $view->form->ID ) { |
|
412 | + if ( $entry[ 'form_id' ] != $view->form->ID ) { |
|
413 | 413 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
414 | 414 | } |
415 | 415 | |
416 | - if ( $entry['status'] != 'active' ) { |
|
416 | + if ( $entry[ 'status' ] != 'active' ) { |
|
417 | 417 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
418 | 418 | } |
419 | 419 | |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
422 | 422 | } |
423 | 423 | |
424 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
424 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
425 | 425 | |
426 | 426 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
427 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
427 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
428 | 428 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
429 | 429 | } |
430 | 430 | } |
@@ -20,16 +20,16 @@ |
||
20 | 20 | */ |
21 | 21 | function gravityview_register_gravityview_widgets() { |
22 | 22 | |
23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
24 | 24 | |
25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
28 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
29 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' ); |
|
25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
28 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
29 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
30 | 30 | |
31 | - if( class_exists('GFPolls') ) { |
|
32 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
31 | + if ( class_exists( 'GFPolls' ) ) { |
|
32 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $default_size = 25; |
46 | 46 | |
47 | 47 | if ( $context instanceof \GV\Template_Context ) { |
48 | - $default_size = (int) $context->view->settings->get( 'page_size' ); |
|
48 | + $default_size = (int)$context->view->settings->get( 'page_size' ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $sizes = array( 10, 25, $default_size, 50, 100 ); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $page_sizes = array(); |
58 | 58 | foreach ( $sizes as $size ) { |
59 | - $page_sizes [] = array( |
|
59 | + $page_sizes [ ] = array( |
|
60 | 60 | 'value' => $size, |
61 | 61 | 'text' => $size |
62 | 62 | ); |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function render_frontend( $widget_args, $content = '', $context = null ) { |
83 | 83 | |
84 | - if( ! $this->pre_render_frontend() ) { |
|
84 | + if ( ! $this->pre_render_frontend() ) { |
|
85 | 85 | return; |
86 | 86 | } |
87 | 87 | |
88 | - $page_size = (int) \GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) ); |
|
88 | + $page_size = (int)\GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) ); |
|
89 | 89 | |
90 | 90 | $settings = shortcode_atts( array( |
91 | 91 | 'label' => __( 'Page Size', 'gravityview' ), |
@@ -104,20 +104,20 @@ discard block |
||
104 | 104 | <div class="gv-widget-page-size"> |
105 | 105 | <form method="get" action="<?php echo esc_url( add_query_arg( array() ) ); ?>" onchange="this.submit();"> |
106 | 106 | <div> |
107 | - <?php if( ! empty( $settings['label'] ) ) { ?> |
|
108 | - <label for="gv-page_size"><?php echo esc_html( $settings['label'] ); ?></label> |
|
107 | + <?php if ( ! empty( $settings[ 'label' ] ) ) { ?> |
|
108 | + <label for="gv-page_size"><?php echo esc_html( $settings[ 'label' ] ); ?></label> |
|
109 | 109 | <?php } ?> |
110 | 110 | <select name="page_size" id="gv-page_size"> |
111 | - <option value=""><?php echo esc_html( $settings['default_choice_text'] ); ?></option> |
|
111 | + <option value=""><?php echo esc_html( $settings[ 'default_choice_text' ] ); ?></option> |
|
112 | 112 | <?php |
113 | - foreach ( $settings['choices'] as $choice ) { ?> |
|
114 | - <option value='<?php echo esc_attr( $choice['value'] ); ?>'<?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
113 | + foreach ( $settings[ 'choices' ] as $choice ) { ?> |
|
114 | + <option value='<?php echo esc_attr( $choice[ 'value' ] ); ?>'<?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
115 | 115 | <?php } ?> |
116 | 116 | </select> |
117 | 117 | <input type="submit" value="Submit" style="visibility: hidden; position: absolute;" /><?php |
118 | - if( ! empty( $_GET ) ) { |
|
118 | + if ( ! empty( $_GET ) ) { |
|
119 | 119 | $get = $_GET; |
120 | - unset( $get['page_size'] ); |
|
120 | + unset( $get[ 'page_size' ] ); |
|
121 | 121 | foreach ( $get as $key => $value ) { |
122 | 122 | printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) ); |
123 | 123 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | // Already overridden |
153 | - if ( (int) $page_size === (int) $view->settings->get( 'page_size' ) ) { |
|
153 | + if ( (int)$page_size === (int)$view->settings->get( 'page_size' ) ) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | 'view' => $view, |
159 | 159 | ) ); |
160 | 160 | |
161 | - if ( ! in_array( (int) $page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) { |
|
161 | + if ( ! in_array( (int)$page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) { |
|
162 | 162 | gravityview()->log->warning( 'The passed page size is not allowed: {page_size}. Not modifying result.', array( 'page_size' => $page_size ) ); |
163 | 163 | return; |
164 | 164 | } |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | ) ); |
109 | 109 | |
110 | 110 | // This is just HTML we don't need. |
111 | - unset( $response['message'] ); |
|
111 | + unset( $response[ 'message' ] ); |
|
112 | 112 | |
113 | - switch ( intval( $response['price_id'] ) ) { |
|
113 | + switch ( intval( $response[ 'price_id' ] ) ) { |
|
114 | 114 | default: |
115 | 115 | case 1: |
116 | 116 | $package = 'Core'; |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | |
129 | 129 | $data = array( |
130 | 130 | 'email' => gravityview()->plugin->settings->get( 'support-email' ), |
131 | - 'name' => $response['customer_name'], |
|
132 | - 'Valid License?' => ucwords( $response['license'] ), |
|
133 | - 'License Key' => $response['license_key'], |
|
131 | + 'name' => $response[ 'customer_name' ], |
|
132 | + 'Valid License?' => ucwords( $response[ 'license' ] ), |
|
133 | + 'License Key' => $response[ 'license_key' ], |
|
134 | 134 | 'License Level' => $package, |
135 | 135 | 'Site Admin Email' => get_bloginfo( 'admin_email' ), |
136 | 136 | 'Support Email' => gravityview()->plugin->settings->get( 'support-email' ), |
137 | - 'License Limit' => $response['license_limit'], |
|
138 | - 'Site Count' => $response['site_count'], |
|
139 | - 'License Expires' => $response['expires'], |
|
140 | - 'Activations Left' => $response['activations_left'], |
|
141 | - 'Payment ID' => $response['payment_id'], |
|
142 | - 'Payment Name' => $response['customer_name'], |
|
143 | - 'Payment Email' => $response['customer_email'], |
|
137 | + 'License Limit' => $response[ 'license_limit' ], |
|
138 | + 'Site Count' => $response[ 'site_count' ], |
|
139 | + 'License Expires' => $response[ 'expires' ], |
|
140 | + 'Activations Left' => $response[ 'activations_left' ], |
|
141 | + 'Payment ID' => $response[ 'payment_id' ], |
|
142 | + 'Payment Name' => $response[ 'customer_name' ], |
|
143 | + 'Payment Email' => $response[ 'customer_email' ], |
|
144 | 144 | 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
145 | 145 | 'PHP Version' => phpversion(), |
146 | 146 | 'GravityView Version' => \GV\Plugin::$version, |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | // If there's an overriding CSS file in the current template folder, use it. |
33 | 33 | $template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file; |
34 | 34 | |
35 | - if( file_exists( $template_css_path ) ) { |
|
35 | + if ( file_exists( $template_css_path ) ) { |
|
36 | 36 | $path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file; |
37 | 37 | gravityview()->log->debug( 'Stylesheet override ({css_file})', array( 'css_file' => esc_attr( $css_file ) ) ); |
38 | 38 | } else { |
39 | 39 | // Default: use GravityView CSS file |
40 | 40 | |
41 | 41 | // If no path is provided, assume default plugin templates CSS folder |
42 | - if( '' === $dir_path ) { |
|
42 | + if ( '' === $dir_path ) { |
|
43 | 43 | $dir_path = GRAVITYVIEW_DIR . 'templates/css/'; |
44 | 44 | } |
45 | 45 | |
46 | 46 | // plugins_url() expects a path to a file, not directory. We append a file to be stripped. |
47 | - $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
47 | + $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $path; |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | |
83 | 83 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
84 | 84 | |
85 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
85 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
86 | 86 | |
87 | - if( empty( $permalink_args ) ) { |
|
87 | + if ( empty( $permalink_args ) ) { |
|
88 | 88 | return array(); |
89 | 89 | } |
90 | 90 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
110 | 110 | |
111 | 111 | $output = ''; |
112 | - if( is_array( $current ) ) { |
|
113 | - if( in_array( $value, $current ) ) { |
|
112 | + if ( is_array( $current ) ) { |
|
113 | + if ( in_array( $value, $current ) ) { |
|
114 | 114 | $output = __checked_selected_helper( true, true, false, $type ); |
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | $output = __checked_selected_helper( $value, $current, false, $type ); |
118 | 118 | } |
119 | 119 | |
120 | - if( $echo ) { |
|
120 | + if ( $echo ) { |
|
121 | 121 | echo $output; |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
128 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | function gravityview_strip_whitespace( $string ) { |
173 | 173 | $string = normalize_whitespace( $string ); |
174 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
174 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @return string Included file contents |
186 | 186 | */ |
187 | 187 | function gravityview_ob_include( $file_path, $object = NULL ) { |
188 | - if( ! file_exists( $file_path ) ) { |
|
188 | + if ( ! file_exists( $file_path ) ) { |
|
189 | 189 | gravityview()->log->error( 'File path does not exist. {path}', array( 'path' => $file_path ) ); |
190 | 190 | return ''; |
191 | 191 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | $width = $height * 0.7586206897; |
211 | 211 | |
212 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
212 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
213 | 213 | $style = 'margin:10px 10px 10px 0;'; |
214 | 214 | $css_class = is_string( $css_class ) ? $css_class : 'alignright'; |
215 | 215 | } else { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $css_class = is_string( $css_class ) ? $css_class : 'alignleft'; |
218 | 218 | } |
219 | 219 | |
220 | - return '<img src="'. esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) .'" class="'. gravityview_sanitize_html_class( $css_class ).'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
220 | + return '<img src="' . esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) . '" class="' . gravityview_sanitize_html_class( $css_class ) . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | function gravityview_number_format( $number, $decimals = '' ) { |
241 | 241 | global $wp_locale; |
242 | 242 | |
243 | - if( '' === $decimals ) { |
|
243 | + if ( '' === $decimals ) { |
|
244 | 244 | |
245 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
245 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Calculate the position of the decimal point in the number |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $parts = parse_url( $value ); |
272 | 272 | |
273 | 273 | // No domain? Strange...show the original text. |
274 | - if( empty( $parts['host'] ) ) { |
|
274 | + if ( empty( $parts[ 'host' ] ) ) { |
|
275 | 275 | return $value; |
276 | 276 | } |
277 | 277 | |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
285 | 285 | * If true: `http://example.com => example.com` |
286 | 286 | */ |
287 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
287 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
288 | 288 | |
289 | - if( isset( $parts['scheme'] ) ) { |
|
290 | - $return .= $parts['scheme']; |
|
289 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
290 | + $return .= $parts[ 'scheme' ]; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | } |
294 | 294 | |
295 | 295 | // The domain, which may contain a subdomain |
296 | - $domain = $parts['host']; |
|
296 | + $domain = $parts[ 'host' ]; |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
302 | 302 | * If true: `www.example.com => example.com` |
303 | 303 | */ |
304 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
304 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
305 | 305 | |
306 | - if( $strip_www ) { |
|
307 | - $domain = str_replace('www.', '', $domain ); |
|
306 | + if ( $strip_www ) { |
|
307 | + $domain = str_replace( 'www.', '', $domain ); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | * If true: `http://demo.example.com => example.com` \n |
315 | 315 | * If false: `http://demo.example.com => demo.example.com` |
316 | 316 | */ |
317 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
317 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
318 | 318 | |
319 | - if( $strip_subdomains ) { |
|
319 | + if ( $strip_subdomains ) { |
|
320 | 320 | |
321 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
321 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
322 | 322 | |
323 | 323 | } |
324 | 324 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
333 | 333 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
334 | 334 | */ |
335 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
335 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
336 | 336 | |
337 | - if( empty( $root_only ) ) { |
|
337 | + if ( empty( $root_only ) ) { |
|
338 | 338 | |
339 | - if( isset( $parts['path'] ) ) { |
|
340 | - $return .= $parts['path']; |
|
339 | + if ( isset( $parts[ 'path' ] ) ) { |
|
340 | + $return .= $parts[ 'path' ]; |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
348 | 348 | * If true: `http://example.com/?query=example => example.com` |
349 | 349 | */ |
350 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
350 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
351 | 351 | |
352 | - if( empty( $strip_query_string ) ) { |
|
352 | + if ( empty( $strip_query_string ) ) { |
|
353 | 353 | |
354 | - if( isset( $parts['query'] ) ) { |
|
355 | - $return .= '?'.$parts['query']; |
|
354 | + if ( isset( $parts[ 'query' ] ) ) { |
|
355 | + $return .= '?' . $parts[ 'query' ]; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | } |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | */ |
370 | 370 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
371 | 371 | |
372 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
373 | - return $matches['domain']; |
|
372 | + if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
373 | + return $matches[ 'domain' ]; |
|
374 | 374 | } else { |
375 | 375 | return $string_maybe_has_subdomain; |
376 | 376 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
441 | 441 | $value = true; |
442 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
442 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
443 | 443 | $value = false; |
444 | 444 | } |
445 | 445 | } |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | */ |
469 | 469 | function gv_maybe_json_decode( $value, $assoc = false, $depth = 512, $options = 0 ) { |
470 | 470 | |
471 | - if( ! is_string( $value ) ) { |
|
471 | + if ( ! is_string( $value ) ) { |
|
472 | 472 | return $value; |
473 | 473 | } |
474 | 474 | |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | } |
480 | 480 | |
481 | 481 | // There was a JSON error (PHP 5.3+) |
482 | - if( function_exists('json_last_error') && JSON_ERROR_NONE !== json_last_error() ) { |
|
482 | + if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) { |
|
483 | 483 | return $value; |
484 | 484 | } |
485 | 485 | |
486 | 486 | // It wasn't JSON (PHP < 5.3 fallback) |
487 | - if( is_null( $decoded ) ) { |
|
487 | + if ( is_null( $decoded ) ) { |
|
488 | 488 | return $value; |
489 | 489 | } |
490 | 490 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | // Use the original function, if exists. |
509 | 509 | // Requires WP 4.4+ |
510 | - if( function_exists( 'map_deep') ) { |
|
510 | + if ( function_exists( 'map_deep' ) ) { |
|
511 | 511 | return map_deep( $value, $callback ); |
512 | 512 | } |
513 | 513 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | $exploded = explode( '.', "{$field_id}" ); |
574 | 574 | |
575 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
575 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -613,13 +613,13 @@ discard block |
||
613 | 613 | */ |
614 | 614 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
615 | 615 | |
616 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
616 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
617 | 617 | |
618 | 618 | $choices = array(); |
619 | 619 | |
620 | 620 | if ( is_array( $terms ) ) { |
621 | 621 | foreach ( $terms as $term_id => $term_name ) { |
622 | - $choices[] = array( |
|
622 | + $choices[ ] = array( |
|
623 | 623 | 'text' => $term_name, |
624 | 624 | 'value' => $term_id |
625 | 625 | ); |
@@ -643,21 +643,21 @@ discard block |
||
643 | 643 | function _gravityview_process_posted_fields() { |
644 | 644 | $fields = array(); |
645 | 645 | |
646 | - if( !empty( $_POST['gv_fields'] ) ) { |
|
647 | - if ( ! is_array( $_POST['gv_fields'] ) ) { |
|
646 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
647 | + if ( ! is_array( $_POST[ 'gv_fields' ] ) ) { |
|
648 | 648 | |
649 | 649 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
650 | 650 | $fields_holder = array(); |
651 | - GVCommon::gv_parse_str( stripslashes( $_POST['gv_fields'] ), $fields_holder ); |
|
651 | + GVCommon::gv_parse_str( stripslashes( $_POST[ 'gv_fields' ] ), $fields_holder ); |
|
652 | 652 | |
653 | - if ( isset( $fields_holder['fields'] ) ) { |
|
654 | - $fields = $fields_holder['fields']; |
|
653 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
654 | + $fields = $fields_holder[ 'fields' ]; |
|
655 | 655 | } else { |
656 | 656 | gravityview()->log->error( 'No `fields` key was found after parsing $fields string', array( 'data' => $fields_holder ) ); |
657 | 657 | } |
658 | 658 | |
659 | 659 | } else { |
660 | - $fields = $_POST['gv_fields']; |
|
660 | + $fields = $_POST[ 'gv_fields' ]; |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 |
@@ -78,7 +78,7 @@ |
||
78 | 78 | $gv_page = gravityview()->request->is_admin( '', 'single' ); |
79 | 79 | |
80 | 80 | // New View or Edit View page |
81 | - if( $gv_page && $pagenow === 'post-new.php' ) { |
|
81 | + if ( $gv_page && $pagenow === 'post-new.php' ) { |
|
82 | 82 | remove_meta_box( 'woothemes-settings', 'gravityview', 'normal' ); |
83 | 83 | } |
84 | 84 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | parent::add_hooks(); |
69 | 69 | |
70 | - if( gravityview()->request->is_admin( '', null ) ) { |
|
70 | + if ( gravityview()->request->is_admin( '', null ) ) { |
|
71 | 71 | |
72 | 72 | // Make Yoast metabox go down to the bottom please. |
73 | 73 | add_filter( 'wpseo_metabox_prio', array( $this, 'return_low' ) ); |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function disable_content_analysis( $options ) { |
94 | 94 | |
95 | - $options['keyword_analysis_active'] = false; |
|
96 | - $options['content_analysis_active'] = false; |
|
95 | + $options[ 'keyword_analysis_active' ] = false; |
|
96 | + $options[ 'content_analysis_active' ] = false; |
|
97 | 97 | |
98 | 98 | return $options; |
99 | 99 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | global $pagenow; |
113 | 113 | |
114 | 114 | // New View page |
115 | - if( $pagenow === 'post-new.php' ) { |
|
116 | - $options['hideeditbox-gravityview'] = true; |
|
115 | + if ( $pagenow === 'post-new.php' ) { |
|
116 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | return $options; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function __construct() { |
19 | 19 | |
20 | - if( !GravityView_Compatibility::is_valid() ) { return; } |
|
20 | + if ( ! GravityView_Compatibility::is_valid() ) { return; } |
|
21 | 21 | |
22 | 22 | self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
23 | 23 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function initialize() { |
37 | 37 | |
38 | - add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' )); |
|
38 | + add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' ) ); |
|
39 | 39 | |
40 | - add_action( 'add_meta_boxes_gravityview' , array( $this, 'update_priority' ) ); |
|
40 | + add_action( 'add_meta_boxes_gravityview', array( $this, 'update_priority' ) ); |
|
41 | 41 | |
42 | 42 | // information box |
43 | 43 | add_action( 'post_submitbox_misc_actions', array( $this, 'render_shortcode_hint' ) ); |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | function update_priority() { |
52 | 52 | global $wp_meta_boxes; |
53 | 53 | |
54 | - if( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
55 | - foreach( array( 'high', 'core', 'low' ) as $position ) { |
|
56 | - if( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
57 | - foreach( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
58 | - if( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
59 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
60 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
54 | + if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) { |
|
55 | + foreach ( array( 'high', 'core', 'low' ) as $position ) { |
|
56 | + if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) { |
|
57 | + foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) { |
|
58 | + if ( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
59 | + $wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box; |
|
60 | + unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] ); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | global $post; |
70 | 70 | |
71 | 71 | // On Comment Edit, for example, $post isn't set. |
72 | - if( empty( $post ) || !is_object( $post ) || !isset( $post->ID ) ) { |
|
72 | + if ( empty( $post ) || ! is_object( $post ) || ! isset( $post->ID ) ) { |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | */ |
153 | 153 | $metaboxes = apply_filters( 'gravityview/metaboxes/default', $metaboxes ); |
154 | 154 | |
155 | - foreach( $metaboxes as $m ) { |
|
155 | + foreach ( $metaboxes as $m ) { |
|
156 | 156 | |
157 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
157 | + $tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] ); |
|
158 | 158 | |
159 | 159 | GravityView_Metabox_Tabs::add( $tab ); |
160 | 160 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | |
181 | 181 | $links = GravityView_Admin_Views::get_connected_form_links( $current_form, false ); |
182 | 182 | |
183 | - if( !empty( $links ) ) { |
|
184 | - $links = '<span class="alignright gv-form-links">'. $links .'</span>'; |
|
183 | + if ( ! empty( $links ) ) { |
|
184 | + $links = '<span class="alignright gv-form-links">' . $links . '</span>'; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return __( 'Data Source', 'gravityview' ) . $links; |
@@ -220,28 +220,28 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public static function render_merge_tags_scripts( $curr_form ) { |
222 | 222 | |
223 | - if( empty( $curr_form )) { |
|
223 | + if ( empty( $curr_form ) ) { |
|
224 | 224 | return NULL; |
225 | 225 | } |
226 | 226 | |
227 | 227 | $form = gravityview_get_form( $curr_form ); |
228 | 228 | |
229 | - $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
|
229 | + $get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : NULL; |
|
230 | 230 | |
231 | - if( isset( $form['id'] ) ) { |
|
232 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
231 | + if ( isset( $form[ 'id' ] ) ) { |
|
232 | + $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';'; |
|
233 | 233 | |
234 | 234 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
235 | - $_GET['id'] = $form['id']; |
|
235 | + $_GET[ 'id' ] = $form[ 'id' ]; |
|
236 | 236 | |
237 | 237 | } else { |
238 | 238 | $form_script = 'var form = new Form();'; |
239 | 239 | } |
240 | 240 | |
241 | - $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
|
241 | + $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>'; |
|
242 | 242 | |
243 | 243 | // Restore previous $_GET setting |
244 | - $_GET['id'] = $get_id_backup; |
|
244 | + $_GET[ 'id' ] = $get_id_backup; |
|
245 | 245 | |
246 | 246 | return $output; |
247 | 247 | } |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | global $post; |
300 | 300 | |
301 | 301 | // Only show this on GravityView post types. |
302 | - if( false === gravityview()->request->is_admin( '', null ) ) { |
|
302 | + if ( false === gravityview()->request->is_admin( '', null ) ) { |
|
303 | 303 | return; |
304 | 304 | } |
305 | 305 | |
306 | 306 | // If the View hasn't been configured yet, don't show embed shortcode |
307 | - if( ! gravityview_get_directory_fields( $post->ID ) && ! gravityview_get_directory_widgets( $post->ID ) ) { |
|
307 | + if ( ! gravityview_get_directory_fields( $post->ID ) && ! gravityview_get_directory_widgets( $post->ID ) ) { |
|
308 | 308 | return; |
309 | 309 | } |
310 | 310 |