@@ -69,7 +69,7 @@ |
||
| 69 | 69 | * |
| 70 | 70 | * @since 1.16 |
| 71 | 71 | * |
| 72 | - * @param int|string $value Number value for the field |
|
| 72 | + * @param string $value Number value for the field |
|
| 73 | 73 | * |
| 74 | 74 | * @return string Based on $value; `1`: "One-Time Payment"; `2`: "Subscription" |
| 75 | 75 | */ |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function get_content( $output, $entry, $field_settings, $field ) { |
| 60 | 60 | |
| 61 | 61 | /** Overridden by a template. */ |
| 62 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
| 62 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
| 63 | 63 | |
| 64 | 64 | return $this->get_string_from_value( $output ); |
| 65 | 65 | } |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | switch ( intval( $value ) ) { |
| 79 | 79 | case self::ONE_TIME_PAYMENT: |
| 80 | 80 | default: |
| 81 | - $return = __('One-Time Payment', 'gravityview'); |
|
| 81 | + $return = __( 'One-Time Payment', 'gravityview' ); |
|
| 82 | 82 | break; |
| 83 | 83 | |
| 84 | 84 | case self::SUBSCRIPTION: |
| 85 | - $return = __('Subscription', 'gravityview'); |
|
| 85 | + $return = __( 'Subscription', 'gravityview' ); |
|
| 86 | 86 | break; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | * @param bool $url_encode Whether to URL-encode output |
| 136 | 136 | * @param bool $esc_html Whether to apply `esc_html()` to output |
| 137 | 137 | * |
| 138 | - * @return mixed |
|
| 138 | + * @return string |
|
| 139 | 139 | */ |
| 140 | 140 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 141 | 141 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
| 111 | 111 | |
| 112 | - if( $this->_custom_merge_tag ) { |
|
| 112 | + if ( $this->_custom_merge_tag ) { |
|
| 113 | 113 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
| 114 | 114 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
| 115 | 115 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
| 133 | 133 | */ |
| 134 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 134 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @see GFCommon::replace_variables_prepopulate() |
| 140 | 140 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
| 141 | 141 | */ |
| 142 | - if( false === $form ) { |
|
| 142 | + if ( false === $form ) { |
|
| 143 | 143 | return $text; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -172,19 +172,19 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 174 | 174 | |
| 175 | - foreach( $matches as $match ) { |
|
| 175 | + foreach ( $matches as $match ) { |
|
| 176 | 176 | |
| 177 | - $full_tag = $match[0]; |
|
| 177 | + $full_tag = $match[ 0 ]; |
|
| 178 | 178 | |
| 179 | 179 | // Strip the Merge Tags |
| 180 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
| 180 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
| 181 | 181 | |
| 182 | 182 | // Replace the value from the entry, if exists |
| 183 | - if( isset( $entry[ $tag ] ) ) { |
|
| 183 | + if ( isset( $entry[ $tag ] ) ) { |
|
| 184 | 184 | |
| 185 | 185 | $value = $entry[ $tag ]; |
| 186 | 186 | |
| 187 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
| 187 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
| 188 | 188 | $value = $this->get_content( $value ); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function _filter_sortable_fields( $not_sortable ) { |
| 259 | 259 | |
| 260 | - if( ! $this->is_sortable ) { |
|
| 261 | - $not_sortable[] = $this->name; |
|
| 260 | + if ( ! $this->is_sortable ) { |
|
| 261 | + $not_sortable[ ] = $this->name; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | return $not_sortable; |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | 'date_display' => array( |
| 288 | 288 | 'type' => 'text', |
| 289 | 289 | 'label' => __( 'Override Date Format', 'gravityview' ), |
| 290 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
| 290 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
| 291 | 291 | /** |
| 292 | 292 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
| 293 | 293 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | $options = $this->field_support_options(); |
| 314 | 314 | |
| 315 | - if( isset( $options[ $key ] ) ) { |
|
| 315 | + if ( isset( $options[ $key ] ) ) { |
|
| 316 | 316 | $field_options[ $key ] = $options[ $key ]; |
| 317 | 317 | } |
| 318 | 318 | |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | $connected_form = rgpost( 'form_id' ); |
| 377 | 377 | |
| 378 | 378 | // Otherwise, get the Form ID from the Post page |
| 379 | - if( empty( $connected_form ) ) { |
|
| 379 | + if ( empty( $connected_form ) ) { |
|
| 380 | 380 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if( empty( $connected_form ) ) { |
|
| 383 | + if ( empty( $connected_form ) ) { |
|
| 384 | 384 | do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) ); |
| 385 | 385 | return false; |
| 386 | 386 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | $delete = $this->get_delete_setting(); |
| 36 | 36 | |
| 37 | - if( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
| 37 | + if ( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
| 38 | 38 | $this->fire_everything(); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
| 99 | 99 | |
| 100 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 101 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 100 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 101 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 102 | 102 | |
| 103 | 103 | $sql = $wpdb->prepare( " |
| 104 | 104 | DELETE FROM $notes_table |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | $this->context_view_id = $_GET['gvid']; |
| 243 | 243 | |
| 244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 244 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 246 | 246 | $this->context_view_id = array_pop( $array_keys ); |
| 247 | 247 | unset( $array_keys ); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | global $post; |
| 270 | 270 | |
| 271 | 271 | // If in admin and NOT AJAX request, get outta here. |
| 272 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 272 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // User reported WooCommerce doesn't pass two args. |
| 375 | - if ( empty( $passed_post_id ) ) { |
|
| 375 | + if ( empty( $passed_post_id ) ) { |
|
| 376 | 376 | return $title; |
| 377 | 377 | } |
| 378 | 378 | |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | */ |
| 1109 | 1109 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1110 | 1110 | |
| 1111 | - switch( strtolower( $address_part ) ){ |
|
| 1111 | + switch( strtolower( $address_part ) ) { |
|
| 1112 | 1112 | case 'street': |
| 1113 | 1113 | $sort_field_id .= '.1'; |
| 1114 | 1114 | break; |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | */ |
| 1189 | 1189 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1190 | 1190 | |
| 1191 | - if ( empty( $single_entry ) ){ |
|
| 1191 | + if ( empty( $single_entry ) ) { |
|
| 1192 | 1192 | return false; |
| 1193 | 1193 | } else { |
| 1194 | 1194 | return $single_entry; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * Sets the single entry ID and also the entry |
| 153 | - * @param bool|int|string $single_entry |
|
| 153 | + * @param boolean|string $single_entry |
|
| 154 | 154 | */ |
| 155 | 155 | public function setSingleEntry( $single_entry ) { |
| 156 | 156 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * Set the current entry |
| 170 | - * @param array|int $entry Entry array or entry slug or ID |
|
| 170 | + * @param boolean|string $entry Entry array or entry slug or ID |
|
| 171 | 171 | */ |
| 172 | 172 | public function setEntry( $entry ) { |
| 173 | 173 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * |
| 226 | 226 | * |
| 227 | 227 | * |
| 228 | - * @param null $view_id |
|
| 228 | + * @param string $view_id |
|
| 229 | 229 | */ |
| 230 | 230 | public function set_context_view_id( $view_id = null ) { |
| 231 | 231 | |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | * |
| 958 | 958 | * @uses gravityview_get_entries() |
| 959 | 959 | * @access public |
| 960 | - * @param array $args\n |
|
| 960 | + * @param array $args |
|
| 961 | 961 | * - $id - View id |
| 962 | 962 | * - $page_size - Page |
| 963 | 963 | * - $sort_field - form field id to sort |
@@ -1413,7 +1413,7 @@ discard block |
||
| 1413 | 1413 | /** |
| 1414 | 1414 | * Checks if field (column) is sortable |
| 1415 | 1415 | * |
| 1416 | - * @param string $field Field settings |
|
| 1416 | + * @param string $field_id Field settings |
|
| 1417 | 1417 | * @param array $form Gravity Forms form array |
| 1418 | 1418 | * |
| 1419 | 1419 | * @since 1.7 |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | private function __construct() {} |
| 86 | 86 | |
| 87 | 87 | private function initialize() { |
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
| 89 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
| 89 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
| 90 | 90 | |
| 91 | 91 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
| 92 | 92 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -233,15 +233,15 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $this->context_view_id = $view_id; |
| 235 | 235 | |
| 236 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 236 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 237 | 237 | /** |
| 238 | 238 | * used on a has_multiple_views context |
| 239 | 239 | * @see GravityView_API::entry_link |
| 240 | 240 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
| 241 | 241 | */ |
| 242 | - $this->context_view_id = $_GET['gvid']; |
|
| 242 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 243 | 243 | |
| 244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 244 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 246 | 246 | $this->context_view_id = array_pop( $array_keys ); |
| 247 | 247 | unset( $array_keys ); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | global $post; |
| 270 | 270 | |
| 271 | 271 | // If in admin and NOT AJAX request, get outta here. |
| 272 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 272 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 283 | 283 | |
| 284 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 284 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 285 | 285 | $this->setPostId( $post_id ); |
| 286 | 286 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 287 | 287 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
| 319 | 319 | |
| 320 | - if( 'post' === $search_method ) { |
|
| 320 | + if ( 'post' === $search_method ) { |
|
| 321 | 321 | $get = $_POST; |
| 322 | 322 | } else { |
| 323 | 323 | $get = $_GET; |
@@ -373,20 +373,20 @@ discard block |
||
| 373 | 373 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 374 | 374 | * @param array $entry Current entry |
| 375 | 375 | */ |
| 376 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 376 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 377 | 377 | |
| 378 | 378 | if ( ! $apply_outside_loop ) { |
| 379 | 379 | return $title; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | // User reported WooCommerce doesn't pass two args. |
| 383 | - if ( empty( $passed_post_id ) ) { |
|
| 383 | + if ( empty( $passed_post_id ) ) { |
|
| 384 | 384 | return $title; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | // Don't modify the title for anything other than the current view/post. |
| 388 | 388 | // This is true for embedded shortcodes and Views. |
| 389 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 389 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 390 | 390 | return $title; |
| 391 | 391 | } |
| 392 | 392 | |
@@ -396,19 +396,19 @@ discard block |
||
| 396 | 396 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
| 397 | 397 | } else { |
| 398 | 398 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 399 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 399 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 400 | 400 | $view_meta = $view_data; |
| 401 | 401 | break; |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 406 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 407 | 407 | |
| 408 | - $title = $view_meta['atts']['single_title']; |
|
| 408 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 409 | 409 | |
| 410 | 410 | // We are allowing HTML in the fields, so no escaping the output |
| 411 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 411 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 412 | 412 | |
| 413 | 413 | $title = do_shortcode( $title ); |
| 414 | 414 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | public function render_view( $passed_args ) { |
| 510 | 510 | |
| 511 | 511 | // validate attributes |
| 512 | - if ( empty( $passed_args['id'] ) ) { |
|
| 512 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
| 513 | 513 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
| 514 | 514 | return null; |
| 515 | 515 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | return null; |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - $view_id = $passed_args['id']; |
|
| 534 | + $view_id = $passed_args[ 'id' ]; |
|
| 535 | 535 | |
| 536 | 536 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
| 537 | 537 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $passed_args = array_filter( $passed_args, 'strlen' ); |
| 545 | 545 | |
| 546 | 546 | //Override shortcode args over View template settings |
| 547 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
| 547 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
| 548 | 548 | |
| 549 | 549 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
| 550 | 550 | |
@@ -567,14 +567,14 @@ discard block |
||
| 567 | 567 | * @since 1.15 |
| 568 | 568 | * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
| 569 | 569 | */ |
| 570 | - if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 570 | + if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 571 | 571 | |
| 572 | 572 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
| 573 | 573 | |
| 574 | 574 | return null; |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | - if( $this->isGravityviewPostType() ) { |
|
| 577 | + if ( $this->isGravityviewPostType() ) { |
|
| 578 | 578 | |
| 579 | 579 | /** |
| 580 | 580 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -586,9 +586,9 @@ discard block |
||
| 586 | 586 | */ |
| 587 | 587 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
| 588 | 588 | |
| 589 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
| 589 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
| 590 | 590 | |
| 591 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 591 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 592 | 592 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 593 | 593 | } |
| 594 | 594 | } |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | |
| 604 | 604 | $gravityview_view = new GravityView_View( $view_data ); |
| 605 | 605 | |
| 606 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
| 606 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
| 607 | 607 | |
| 608 | 608 | $gravityview_view->setPostId( $post_id ); |
| 609 | 609 | |
@@ -613,20 +613,20 @@ discard block |
||
| 613 | 613 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
| 614 | 614 | |
| 615 | 615 | //fetch template and slug |
| 616 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
| 616 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
| 617 | 617 | |
| 618 | 618 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
| 619 | 619 | |
| 620 | 620 | /** |
| 621 | 621 | * Disable fetching initial entries for views that don't need it (DataTables) |
| 622 | 622 | */ |
| 623 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
| 623 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
| 624 | 624 | |
| 625 | 625 | /** |
| 626 | 626 | * Hide View data until search is performed |
| 627 | 627 | * @since 1.5.4 |
| 628 | 628 | */ |
| 629 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
| 629 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
| 630 | 630 | $gravityview_view->setHideUntilSearched( true ); |
| 631 | 631 | $get_entries = false; |
| 632 | 632 | } |
@@ -634,23 +634,23 @@ discard block |
||
| 634 | 634 | |
| 635 | 635 | if ( $get_entries ) { |
| 636 | 636 | |
| 637 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
| 637 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
| 638 | 638 | // add filter to enable column sorting |
| 639 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
| 639 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
| 642 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
| 643 | 643 | |
| 644 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
| 644 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
| 645 | 645 | |
| 646 | 646 | } else { |
| 647 | 647 | |
| 648 | 648 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
| 649 | 649 | |
| 650 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
| 650 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
| 653 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
| 654 | 654 | $gravityview_view->setContext( 'directory' ); |
| 655 | 655 | $sections = array( 'header', 'body', 'footer' ); |
| 656 | 656 | |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
| 665 | 665 | * @since 1.17 |
| 666 | 666 | */ |
| 667 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
| 667 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
| 668 | 668 | |
| 669 | 669 | $entry = $this->getEntry(); |
| 670 | 670 | |
@@ -691,20 +691,20 @@ discard block |
||
| 691 | 691 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
| 692 | 692 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
| 693 | 693 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
| 694 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
| 694 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
| 695 | 695 | return null; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | //fetch template and slug |
| 699 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
| 699 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
| 700 | 700 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
| 701 | 701 | |
| 702 | 702 | //fetch entry detail |
| 703 | - $view_entries['count'] = 1; |
|
| 704 | - $view_entries['entries'][] = $entry; |
|
| 705 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
| 703 | + $view_entries[ 'count' ] = 1; |
|
| 704 | + $view_entries[ 'entries' ][ ] = $entry; |
|
| 705 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
| 706 | 706 | |
| 707 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
| 707 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
| 708 | 708 | |
| 709 | 709 | // set back link label |
| 710 | 710 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -714,11 +714,11 @@ discard block |
||
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | // add template style |
| 717 | - self::add_style( $view_data['template_id'] ); |
|
| 717 | + self::add_style( $view_data[ 'template_id' ] ); |
|
| 718 | 718 | |
| 719 | 719 | // Prepare to render view and set vars |
| 720 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
| 721 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
| 720 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
| 721 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
| 722 | 722 | |
| 723 | 723 | // If Edit |
| 724 | 724 | if ( 'edit' === gravityview_get_context() ) { |
@@ -731,11 +731,11 @@ discard block |
||
| 731 | 731 | |
| 732 | 732 | } else { |
| 733 | 733 | // finaly we'll render some html |
| 734 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
| 734 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
| 735 | 735 | |
| 736 | 736 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
| 737 | 737 | foreach ( $sections as $section ) { |
| 738 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
| 738 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
| 739 | 739 | $gravityview_view->render( $view_slug, $section, false ); |
| 740 | 740 | } |
| 741 | 741 | } |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | $datetime_format = 'Y-m-d H:i:s'; |
| 790 | 790 | $search_is_outside_view_bounds = false; |
| 791 | 791 | |
| 792 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 792 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 793 | 793 | |
| 794 | 794 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 795 | 795 | |
@@ -817,14 +817,14 @@ discard block |
||
| 817 | 817 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 818 | 818 | |
| 819 | 819 | // Then we override the search and re-set the start date |
| 820 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 820 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 825 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 826 | 826 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 827 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 827 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 828 | 828 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
| 829 | 829 | } |
| 830 | 830 | } |
@@ -842,9 +842,9 @@ discard block |
||
| 842 | 842 | */ |
| 843 | 843 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 844 | 844 | |
| 845 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 846 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 847 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 845 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 846 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 847 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 848 | 848 | |
| 849 | 849 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
| 850 | 850 | } |
@@ -868,12 +868,12 @@ discard block |
||
| 868 | 868 | */ |
| 869 | 869 | public static function is_entry_approved( $entry, $args = array() ) { |
| 870 | 870 | |
| 871 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 871 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 872 | 872 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 873 | 873 | return true; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
| 876 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); |
|
| 877 | 877 | |
| 878 | 878 | if ( $is_approved ) { |
| 879 | 879 | return true; |
@@ -911,26 +911,26 @@ discard block |
||
| 911 | 911 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
| 912 | 912 | |
| 913 | 913 | // implicity search |
| 914 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 914 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 915 | 915 | |
| 916 | 916 | // Search operator options. Options: `is` or `contains` |
| 917 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 917 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 918 | 918 | |
| 919 | - $search_criteria['field_filters'][] = array( |
|
| 919 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 920 | 920 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
| 921 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 921 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 922 | 922 | 'operator' => $operator, |
| 923 | 923 | ); |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 926 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 927 | 927 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | // Handle setting date range |
| 931 | 931 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 932 | 932 | |
| 933 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 933 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 934 | 934 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
| 935 | 935 | } |
| 936 | 936 | |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 942 | 942 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 943 | 943 | */ |
| 944 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 944 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 945 | 945 | |
| 946 | 946 | return $search_criteria; |
| 947 | 947 | } |
@@ -987,16 +987,16 @@ discard block |
||
| 987 | 987 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
| 988 | 988 | |
| 989 | 989 | // Paging & offset |
| 990 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 990 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 991 | 991 | |
| 992 | 992 | if ( -1 === $page_size ) { |
| 993 | 993 | $page_size = PHP_INT_MAX; |
| 994 | 994 | } |
| 995 | 995 | |
| 996 | - if ( isset( $args['offset'] ) ) { |
|
| 997 | - $offset = intval( $args['offset'] ); |
|
| 996 | + if ( isset( $args[ 'offset' ] ) ) { |
|
| 997 | + $offset = intval( $args[ 'offset' ] ); |
|
| 998 | 998 | } else { |
| 999 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 999 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 1000 | 1000 | $offset = ( $curr_page - 1 ) * $page_size; |
| 1001 | 1001 | } |
| 1002 | 1002 | |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | 'search_criteria' => $search_criteria, |
| 1015 | 1015 | 'sorting' => $sorting, |
| 1016 | 1016 | 'paging' => $paging, |
| 1017 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 1017 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 1018 | 1018 | ); |
| 1019 | 1019 | |
| 1020 | 1020 | /** |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 1040 | 1040 | * @param array $args View configuration args. |
| 1041 | 1041 | */ |
| 1042 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
| 1042 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
| 1043 | 1043 | |
| 1044 | 1044 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
| 1045 | 1045 | |
@@ -1079,8 +1079,8 @@ discard block |
||
| 1079 | 1079 | */ |
| 1080 | 1080 | public static function updateViewSorting( $args, $form_id ) { |
| 1081 | 1081 | $sorting = array(); |
| 1082 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
| 1083 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
| 1082 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
| 1083 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
| 1084 | 1084 | |
| 1085 | 1085 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1086 | 1086 | |
@@ -1120,7 +1120,7 @@ discard block |
||
| 1120 | 1120 | |
| 1121 | 1121 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1122 | 1122 | |
| 1123 | - switch ( $sort_field['type'] ) { |
|
| 1123 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1124 | 1124 | |
| 1125 | 1125 | case 'address': |
| 1126 | 1126 | // Sorting by full address |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | */ |
| 1138 | 1138 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1139 | 1139 | |
| 1140 | - switch( strtolower( $address_part ) ){ |
|
| 1140 | + switch ( strtolower( $address_part ) ) { |
|
| 1141 | 1141 | case 'street': |
| 1142 | 1142 | $sort_field_id .= '.1'; |
| 1143 | 1143 | break; |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | */ |
| 1218 | 1218 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1219 | 1219 | |
| 1220 | - if ( empty( $single_entry ) ){ |
|
| 1220 | + if ( empty( $single_entry ) ) { |
|
| 1221 | 1221 | return false; |
| 1222 | 1222 | } else { |
| 1223 | 1223 | return $single_entry; |
@@ -1244,7 +1244,7 @@ discard block |
||
| 1244 | 1244 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1245 | 1245 | * @since 1.15 |
| 1246 | 1246 | */ |
| 1247 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1247 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1248 | 1248 | continue; |
| 1249 | 1249 | } |
| 1250 | 1250 | |
@@ -1253,19 +1253,19 @@ discard block |
||
| 1253 | 1253 | $css_dependencies = array(); |
| 1254 | 1254 | |
| 1255 | 1255 | // If the thickbox is enqueued, add dependencies |
| 1256 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
| 1256 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
| 1257 | 1257 | |
| 1258 | 1258 | /** |
| 1259 | 1259 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1260 | 1260 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1261 | 1261 | */ |
| 1262 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1262 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1263 | 1263 | |
| 1264 | 1264 | /** |
| 1265 | 1265 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1266 | 1266 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1267 | 1267 | */ |
| 1268 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1268 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1269 | 1269 | } |
| 1270 | 1270 | |
| 1271 | 1271 | /** |
@@ -1273,25 +1273,25 @@ discard block |
||
| 1273 | 1273 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1274 | 1274 | * @since 1.15 |
| 1275 | 1275 | */ |
| 1276 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1277 | - $css_dependencies[] = 'dashicons'; |
|
| 1276 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1277 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1281 | 1281 | |
| 1282 | 1282 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1283 | 1283 | |
| 1284 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
| 1284 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
| 1285 | 1285 | |
| 1286 | 1286 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1287 | 1287 | |
| 1288 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1288 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1289 | 1289 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1290 | 1290 | } |
| 1291 | 1291 | |
| 1292 | 1292 | $this->enqueue_default_style( $css_dependencies ); |
| 1293 | 1293 | |
| 1294 | - self::add_style( $data['template_id'] ); |
|
| 1294 | + self::add_style( $data[ 'template_id' ] ); |
|
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | } elseif ( empty( $template_id ) ) { |
| 1354 | 1354 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
| 1355 | 1355 | } else { |
| 1356 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
| 1356 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | 1359 | } |
@@ -1378,11 +1378,11 @@ discard block |
||
| 1378 | 1378 | * Not a table-based template; don't add sort icons |
| 1379 | 1379 | * @since 1.12 |
| 1380 | 1380 | */ |
| 1381 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1381 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1382 | 1382 | return $label; |
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1385 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1386 | 1386 | return $label; |
| 1387 | 1387 | } |
| 1388 | 1388 | |
@@ -1390,29 +1390,29 @@ discard block |
||
| 1390 | 1390 | |
| 1391 | 1391 | $class = 'gv-sort'; |
| 1392 | 1392 | |
| 1393 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1393 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1394 | 1394 | |
| 1395 | 1395 | $sort_args = array( |
| 1396 | - 'sort' => $field['id'], |
|
| 1396 | + 'sort' => $field[ 'id' ], |
|
| 1397 | 1397 | 'dir' => 'asc', |
| 1398 | 1398 | ); |
| 1399 | 1399 | |
| 1400 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1400 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1401 | 1401 | //toggle sorting direction. |
| 1402 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1403 | - $sort_args['dir'] = 'desc'; |
|
| 1402 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1403 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1404 | 1404 | $class .= ' gv-icon-sort-desc'; |
| 1405 | 1405 | } else { |
| 1406 | - $sort_args['dir'] = 'asc'; |
|
| 1406 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1407 | 1407 | $class .= ' gv-icon-sort-asc'; |
| 1408 | 1408 | } |
| 1409 | 1409 | } else { |
| 1410 | 1410 | $class .= ' gv-icon-caret-up-down'; |
| 1411 | 1411 | } |
| 1412 | 1412 | |
| 1413 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1413 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1414 | 1414 | |
| 1415 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1415 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1416 | 1416 | |
| 1417 | 1417 | } |
| 1418 | 1418 | |
@@ -1430,7 +1430,7 @@ discard block |
||
| 1430 | 1430 | |
| 1431 | 1431 | $field_type = $field_id; |
| 1432 | 1432 | |
| 1433 | - if( is_numeric( $field_id ) ) { |
|
| 1433 | + if ( is_numeric( $field_id ) ) { |
|
| 1434 | 1434 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1435 | 1435 | $field_type = $field->type; |
| 1436 | 1436 | } |
@@ -1453,7 +1453,7 @@ discard block |
||
| 1453 | 1453 | return false; |
| 1454 | 1454 | } |
| 1455 | 1455 | |
| 1456 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1456 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1457 | 1457 | |
| 1458 | 1458 | } |
| 1459 | 1459 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | parent::add_hooks(); |
| 58 | 58 | |
| 59 | - if( gravityview_is_admin_page() ) { |
|
| 59 | + if ( gravityview_is_admin_page() ) { |
|
| 60 | 60 | |
| 61 | 61 | // Make Yoast metabox go down to the bottom please. |
| 62 | 62 | add_filter( 'wpseo_metabox_prio', array( $this, '__return_low' ) ); |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | global $pagenow; |
| 84 | 84 | |
| 85 | 85 | // New View page |
| 86 | - if( $pagenow === 'post-new.php' ) { |
|
| 87 | - $options['hideeditbox-gravityview'] = true; |
|
| 86 | + if ( $pagenow === 'post-new.php' ) { |
|
| 87 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $options; |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $gv_page = gravityview_is_admin_page( '', '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 | } |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | function init() { |
| 22 | 22 | |
| 23 | 23 | $icon = is_admin() ? '<i class="icon gv-icon-astronaut-head"></i> ' : NULL; |
| 24 | - $this->title( $icon . __('GravityView', 'gravityview') ); |
|
| 24 | + $this->title( $icon . __( 'GravityView', 'gravityview' ) ); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | function get_warnings() { |
| 28 | 28 | |
| 29 | - if( is_null( $this->warnings ) ) { |
|
| 29 | + if ( is_null( $this->warnings ) ) { |
|
| 30 | 30 | $this->warnings = GravityView_Logging::get_errors(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | function get_notices() { |
| 37 | 37 | |
| 38 | - if( is_null( $this->notices ) ) { |
|
| 38 | + if ( is_null( $this->notices ) ) { |
|
| 39 | 39 | $this->notices = GravityView_Logging::get_notices(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -84,27 +84,27 @@ discard block |
||
| 84 | 84 | </style> |
| 85 | 85 | <div id='debug-bar-gravityview'>"; |
| 86 | 86 | |
| 87 | - $output .= '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="alignright" alt="" width="100" height="132" />'; |
|
| 87 | + $output .= '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="alignright" alt="" width="100" height="132" />'; |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | $warnings = $this->get_warnings(); |
| 91 | 91 | $notices = $this->get_notices(); |
| 92 | 92 | |
| 93 | - if(count($warnings)) { |
|
| 94 | - $output .= '<h3><span>'.__('Warnings', 'gravityview').'</span></h3>'; |
|
| 93 | + if ( count( $warnings ) ) { |
|
| 94 | + $output .= '<h3><span>' . __( 'Warnings', 'gravityview' ) . '</span></h3>'; |
|
| 95 | 95 | $output .= '<ol>'; |
| 96 | - foreach ( $warnings as $key => $notice) { |
|
| 97 | - if(empty($notice['message'])) { continue; } |
|
| 98 | - $output .= '<li><a href="#'.sanitize_html_class( 'gv-warning-' . $key ).'">'.strip_tags($notice['message']).'</a></li>'; |
|
| 96 | + foreach ( $warnings as $key => $notice ) { |
|
| 97 | + if ( empty( $notice[ 'message' ] ) ) { continue; } |
|
| 98 | + $output .= '<li><a href="#' . sanitize_html_class( 'gv-warning-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>'; |
|
| 99 | 99 | } |
| 100 | 100 | $output .= '</ol><hr />'; |
| 101 | 101 | } |
| 102 | - if(count($notices)) { |
|
| 103 | - $output .= '<h3><span>'.__('Logs', 'gravityview').'</span></h3>'; |
|
| 102 | + if ( count( $notices ) ) { |
|
| 103 | + $output .= '<h3><span>' . __( 'Logs', 'gravityview' ) . '</span></h3>'; |
|
| 104 | 104 | $output .= '<ol>'; |
| 105 | - foreach ( $notices as $key => $notice) { |
|
| 106 | - if(empty($notice['message'])) { continue; } |
|
| 107 | - $output .= '<li><a href="#'.sanitize_html_class( 'gv-notice-' . $key ).'">'.strip_tags($notice['message']).'</a></li>'; |
|
| 105 | + foreach ( $notices as $key => $notice ) { |
|
| 106 | + if ( empty( $notice[ 'message' ] ) ) { continue; } |
|
| 107 | + $output .= '<li><a href="#' . sanitize_html_class( 'gv-notice-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>'; |
|
| 108 | 108 | } |
| 109 | 109 | $output .= '</ol><hr />'; |
| 110 | 110 | } |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | if ( count( $warnings ) ) { |
| 113 | 113 | $output .= '<h3>Warnings</h3>'; |
| 114 | 114 | $output .= '<ol class="debug-bar-php-list">'; |
| 115 | - foreach ( $warnings as $key => $notice) { $output .= $this->render_item( $notice, 'gv-warning-' . $key ); } |
|
| 115 | + foreach ( $warnings as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-warning-' . $key ); } |
|
| 116 | 116 | $output .= '</ol>'; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if ( count( $notices ) ) { |
| 120 | 120 | $output .= '<h3>Notices</h3>'; |
| 121 | 121 | $output .= '<ol class="debug-bar-php-list">'; |
| 122 | - foreach ( $notices as $key => $notice) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); } |
|
| 122 | + foreach ( $notices as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); } |
|
| 123 | 123 | $output .= '</ol>'; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -133,17 +133,17 @@ discard block |
||
| 133 | 133 | * @param string|array $item Unescaped |
| 134 | 134 | * @return string Escaped HTML |
| 135 | 135 | */ |
| 136 | - function esc_html_recursive($item) { |
|
| 137 | - if(is_object($item)) { |
|
| 138 | - foreach($item as $key => $value) { |
|
| 139 | - $item->{$key} = $this->esc_html_recursive($value); |
|
| 136 | + function esc_html_recursive( $item ) { |
|
| 137 | + if ( is_object( $item ) ) { |
|
| 138 | + foreach ( $item as $key => $value ) { |
|
| 139 | + $item->{$key} = $this->esc_html_recursive( $value ); |
|
| 140 | 140 | } |
| 141 | - } else if(is_array($item)) { |
|
| 142 | - foreach($item as $key => $value) { |
|
| 143 | - $item[$key] = $this->esc_html_recursive($value); |
|
| 141 | + } else if ( is_array( $item ) ) { |
|
| 142 | + foreach ( $item as $key => $value ) { |
|
| 143 | + $item[ $key ] = $this->esc_html_recursive( $value ); |
|
| 144 | 144 | } |
| 145 | 145 | } else { |
| 146 | - $item = esc_html($item); |
|
| 146 | + $item = esc_html( $item ); |
|
| 147 | 147 | } |
| 148 | 148 | return $item; |
| 149 | 149 | } |
@@ -159,26 +159,26 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | $output = ''; |
| 161 | 161 | |
| 162 | - if(!empty($notice['message'])) { |
|
| 163 | - $output .= '<a id="'.sanitize_html_class( $anchor ).'"></a>'; |
|
| 162 | + if ( ! empty( $notice[ 'message' ] ) ) { |
|
| 163 | + $output .= '<a id="' . sanitize_html_class( $anchor ) . '"></a>'; |
|
| 164 | 164 | $output .= "<li class='debug-bar-php-notice'>"; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $output .= '<div class="clear"></div>'; |
| 168 | 168 | |
| 169 | 169 | // Title |
| 170 | - $output .= '<div class="gravityview-debug-bar-title">'.esc_attr( $notice['message'] ).'</div>'; |
|
| 170 | + $output .= '<div class="gravityview-debug-bar-title">' . esc_attr( $notice[ 'message' ] ) . '</div>'; |
|
| 171 | 171 | |
| 172 | 172 | // Debugging Output |
| 173 | - if( empty( $notice['data'] ) ) { |
|
| 174 | - if( !is_null( $notice['data'] ) ) { |
|
| 175 | - $output .= '<em>'._x('Empty', 'Debugging output data is empty.', 'gravityview' ).'</em>'; |
|
| 173 | + if ( empty( $notice[ 'data' ] ) ) { |
|
| 174 | + if ( ! is_null( $notice[ 'data' ] ) ) { |
|
| 175 | + $output .= '<em>' . _x( 'Empty', 'Debugging output data is empty.', 'gravityview' ) . '</em>'; |
|
| 176 | 176 | } |
| 177 | 177 | } else { |
| 178 | - $output .= sprintf( '<pre>%s</pre>', print_r($this->esc_html_recursive( $notice['data'] ), true) ); |
|
| 178 | + $output .= sprintf( '<pre>%s</pre>', print_r( $this->esc_html_recursive( $notice[ 'data' ] ), true ) ); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if(!empty($notice['message'])) { |
|
| 181 | + if ( ! empty( $notice[ 'message' ] ) ) { |
|
| 182 | 182 | $output .= '</li>'; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -5,4 +5,4 @@ |
||
| 5 | 5 | * @deprecated 1.7.5 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 8 | +include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
@@ -11,29 +11,29 @@ discard block |
||
| 11 | 11 | $field_info_items = array(); |
| 12 | 12 | |
| 13 | 13 | // Fields with IDs, not like Source URL or Entry ID |
| 14 | - if( is_numeric( $this->id ) ) { |
|
| 14 | + if ( is_numeric( $this->id ) ) { |
|
| 15 | 15 | |
| 16 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
| 16 | + $field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] ); |
|
| 17 | 17 | |
| 18 | - $field_info_items[] = array( |
|
| 19 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ) |
|
| 18 | + $field_info_items[ ] = array( |
|
| 19 | + 'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ) |
|
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | - $field_info_items[] = array( |
|
| 23 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
| 22 | + $field_info_items[ ] = array( |
|
| 23 | + 'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ), |
|
| 24 | 24 | ); |
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if( !empty( $this->item['desc'] ) ) { |
|
| 29 | - $field_info_items[] = array( |
|
| 30 | - 'value' => $this->item['desc'] |
|
| 28 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
| 29 | + $field_info_items[ ] = array( |
|
| 30 | + 'value' => $this->item[ 'desc' ] |
|
| 31 | 31 | ); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
| 35 | - $field_info_items[] = array( |
|
| 36 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
| 34 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
| 35 | + $field_info_items[ ] = array( |
|
| 36 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
| 37 | 37 | 'class' => 'gv-sublabel' |
| 38 | 38 | ); |
| 39 | 39 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | $field_info = ''; |
| 53 | 53 | $field_info_items = array(); |
| 54 | 54 | |
| 55 | - if( !empty( $this->item['description'] ) ) { |
|
| 55 | + if ( ! empty( $this->item[ 'description' ] ) ) { |
|
| 56 | 56 | |
| 57 | - $field_info_items[] = array( |
|
| 58 | - 'value' => $this->item['description'] |
|
| 57 | + $field_info_items[ ] = array( |
|
| 58 | + 'value' => $this->item[ 'description' ] |
|
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | 61 | } |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | function __construct( $title = '', $field_id, $item = array(), $settings = array() ) { |
| 81 | 81 | |
| 82 | 82 | // Backward compat |
| 83 | - if( !empty( $item['type'] ) ) { |
|
| 84 | - $item['input_type'] = $item['type']; |
|
| 85 | - unset( $item['type'] ); |
|
| 83 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
| 84 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
| 85 | + unset( $item[ 'type' ] ); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // Prevent items from not having index set |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | 'adminLabel' => NULL, |
| 97 | 97 | 'adminOnly' => NULL, |
| 98 | 98 | 'subtitle' => NULL, |
| 99 | - )); |
|
| 99 | + ) ); |
|
| 100 | 100 | |
| 101 | 101 | $this->title = $title; |
| 102 | 102 | $this->item = $item; |
| 103 | 103 | $this->id = $field_id; |
| 104 | 104 | $this->settings = $settings; |
| 105 | - $this->label_type = $item['label_type']; |
|
| 105 | + $this->label_type = $item[ 'label_type' ]; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | $field_info_items = apply_filters( 'gravityview_admin_label_item_info', $field_info_items, $this ); |
| 143 | 143 | |
| 144 | - if( $html ) { |
|
| 144 | + if ( $html ) { |
|
| 145 | 145 | |
| 146 | 146 | foreach ( $field_info_items as $item ) { |
| 147 | - $class = isset($item['class']) ? sanitize_html_class( $item['class'] ).' description' : 'description'; |
|
| 147 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 148 | 148 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 149 | - $output .= '<span class="'.$class.'">'; |
|
| 150 | - $output .= esc_html( $item['value'] ); |
|
| 149 | + $output .= '<span class="' . $class . '">'; |
|
| 150 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 151 | 151 | $output .= '</span>'; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | $values = wp_list_pluck( $field_info_items, 'value' ); |
| 157 | 157 | |
| 158 | - $output = esc_html( implode(', ', $values) ); |
|
| 158 | + $output = esc_html( implode( ', ', $values ) ); |
|
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
@@ -170,53 +170,53 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | function getOutput() { |
| 172 | 172 | |
| 173 | - $settings_title = sprintf(__('Configure %s Settings', 'gravityview'), ucfirst($this->label_type)); |
|
| 174 | - $delete_title = sprintf(__('Remove %s', 'gravityview'), ucfirst($this->label_type)); |
|
| 175 | - $single_link_title = __('This field links to the Single Entry', 'gravityview'); |
|
| 173 | + $settings_title = sprintf( __( 'Configure %s Settings', 'gravityview' ), ucfirst( $this->label_type ) ); |
|
| 174 | + $delete_title = sprintf( __( 'Remove %s', 'gravityview' ), ucfirst( $this->label_type ) ); |
|
| 175 | + $single_link_title = __( 'This field links to the Single Entry', 'gravityview' ); |
|
| 176 | 176 | |
| 177 | 177 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 178 | 178 | // TODO: Un-hack this |
| 179 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->') > 0 ) ? 'hide-if-js' : ''; |
|
| 179 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 180 | 180 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
| 181 | 181 | |
| 182 | 182 | // Should we show the icon that the field is being used as a link to single entry? |
| 183 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
| 184 | - $show_as_link = '<span class="dashicons dashicons-admin-links '.$hide_show_as_link_class.'" title="'.esc_attr( $single_link_title ).'"></span>'; |
|
| 183 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
| 184 | + $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
|
| 185 | 185 | |
| 186 | 186 | // When a field label is empty, use the Field ID |
| 187 | - $label = empty( $this->title ) ? sprintf( _x('Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview'), $this->id ) : $this->title; |
|
| 187 | + $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
|
| 188 | 188 | |
| 189 | 189 | // If there's a custom label, and show label is checked, use that as the field heading |
| 190 | - if( !empty( $this->settings['custom_label'] ) && !empty( $this->settings['show_label'] ) ) { |
|
| 191 | - $label = $this->settings['custom_label']; |
|
| 192 | - } else if( !empty( $this->item['customLabel'] ) ) { |
|
| 193 | - $label = $this->item['customLabel']; |
|
| 190 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 191 | + $label = $this->settings[ 'custom_label' ]; |
|
| 192 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 193 | + $label = $this->item[ 'customLabel' ]; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - $output = '<h5 class="selectable gfield field-id-'.esc_attr($this->id).'">'; |
|
| 196 | + $output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
|
| 197 | 197 | |
| 198 | 198 | $label = esc_attr( $label ); |
| 199 | 199 | |
| 200 | - if( !empty( $this->item['parent'] ) ) { |
|
| 201 | - $label .= ' <small>('.esc_attr( $this->item['parent']['label'] ) .')</small>'; |
|
| 200 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 201 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // Name of field / widget |
| 205 | - $output .= '<span class="gv-field-label" data-original-title="'.esc_attr( $label ).'" title="'. $this->get_item_info( false ) .'">'. $label . '</span>'; |
|
| 205 | + $output .= '<span class="gv-field-label" data-original-title="' . esc_attr( $label ) . '" title="' . $this->get_item_info( false ) . '">' . $label . '</span>'; |
|
| 206 | 206 | |
| 207 | 207 | |
| 208 | - $output .= '<span class="gv-field-controls">'.$settings_link.$show_as_link.'<a href="#remove" class="dashicons-dismiss dashicons" title="'.esc_attr( $delete_title ) .'"></a></span>'; |
|
| 208 | + $output .= '<span class="gv-field-controls">' . $settings_link . $show_as_link . '<a href="#remove" class="dashicons-dismiss dashicons" title="' . esc_attr( $delete_title ) . '"></a></span>'; |
|
| 209 | 209 | |
| 210 | 210 | // Displays only in the field/widget picker. |
| 211 | - if( $field_info = $this->get_item_info() ) { |
|
| 212 | - $output .= '<span class="gv-field-info">'.$field_info.'</span>'; |
|
| 211 | + if ( $field_info = $this->get_item_info() ) { |
|
| 212 | + $output .= '<span class="gv-field-info">' . $field_info . '</span>'; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $output .= '</h5>'; |
| 216 | 216 | |
| 217 | - $container_class = !empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 217 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 218 | 218 | |
| 219 | - $output = '<div data-fieldid="'.esc_attr($this->id).'" data-inputtype="'.esc_attr( $this->item['input_type'] ).'" class="gv-fields'.$container_class.'">'.$output.$this->item['settings_html'].'</div>'; |
|
| 219 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
| 220 | 220 | |
| 221 | 221 | return $output; |
| 222 | 222 | } |