@@ -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 | |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
| 116 | 116 | |
| 117 | - if( $this->_custom_merge_tag ) { |
|
| 117 | + if ( $this->_custom_merge_tag ) { |
|
| 118 | 118 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
| 119 | 119 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
| 122 | + if ( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
| 123 | 123 | add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 ); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | function set_default_search_label( $label = '', $gf_field = null, $field = array() ) { |
| 143 | 143 | |
| 144 | - if( $this->name === $field['field'] && '' === $label ) { |
|
| 144 | + if ( $this->name === $field[ 'field' ] && '' === $label ) { |
|
| 145 | 145 | $label = esc_html( $this->default_search_label ); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
| 164 | 164 | */ |
| 165 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 165 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @see GFCommon::replace_variables_prepopulate() |
| 171 | 171 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
| 172 | 172 | */ |
| 173 | - if( false === $form ) { |
|
| 173 | + if ( false === $form ) { |
|
| 174 | 174 | return $text; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -203,19 +203,19 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 205 | 205 | |
| 206 | - foreach( $matches as $match ) { |
|
| 206 | + foreach ( $matches as $match ) { |
|
| 207 | 207 | |
| 208 | - $full_tag = $match[0]; |
|
| 208 | + $full_tag = $match[ 0 ]; |
|
| 209 | 209 | |
| 210 | 210 | // Strip the Merge Tags |
| 211 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
| 211 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
| 212 | 212 | |
| 213 | 213 | // Replace the value from the entry, if exists |
| 214 | - if( isset( $entry[ $tag ] ) ) { |
|
| 214 | + if ( isset( $entry[ $tag ] ) ) { |
|
| 215 | 215 | |
| 216 | 216 | $value = $entry[ $tag ]; |
| 217 | 217 | |
| 218 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
| 218 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
| 219 | 219 | $value = $this->get_content( $value ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | public function _filter_sortable_fields( $not_sortable ) { |
| 290 | 290 | |
| 291 | - if( ! $this->is_sortable ) { |
|
| 292 | - $not_sortable[] = $this->name; |
|
| 291 | + if ( ! $this->is_sortable ) { |
|
| 292 | + $not_sortable[ ] = $this->name; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | return $not_sortable; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | 'date_display' => array( |
| 319 | 319 | 'type' => 'text', |
| 320 | 320 | 'label' => __( 'Override Date Format', 'gravityview' ), |
| 321 | - '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>' ), |
|
| 321 | + '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>' ), |
|
| 322 | 322 | /** |
| 323 | 323 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
| 324 | 324 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | $options = $this->field_support_options(); |
| 345 | 345 | |
| 346 | - if( isset( $options[ $key ] ) ) { |
|
| 346 | + if ( isset( $options[ $key ] ) ) { |
|
| 347 | 347 | $field_options[ $key ] = $options[ $key ]; |
| 348 | 348 | } |
| 349 | 349 | |
@@ -407,11 +407,11 @@ discard block |
||
| 407 | 407 | $connected_form = rgpost( 'form_id' ); |
| 408 | 408 | |
| 409 | 409 | // Otherwise, get the Form ID from the Post page |
| 410 | - if( empty( $connected_form ) ) { |
|
| 410 | + if ( empty( $connected_form ) ) { |
|
| 411 | 411 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - if( empty( $connected_form ) ) { |
|
| 414 | + if ( empty( $connected_form ) ) { |
|
| 415 | 415 | do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) ); |
| 416 | 416 | return false; |
| 417 | 417 | } |
@@ -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,9 +85,9 @@ discard block |
||
| 85 | 85 | private function __construct() {} |
| 86 | 86 | |
| 87 | 87 | private function initialize() { |
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
| 89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
| 90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
| 90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
| 91 | 91 | |
| 92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
| 93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -234,15 +234,15 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | $this->context_view_id = $view_id; |
| 236 | 236 | |
| 237 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 237 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 238 | 238 | /** |
| 239 | 239 | * used on a has_multiple_views context |
| 240 | 240 | * @see GravityView_API::entry_link |
| 241 | 241 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
| 242 | 242 | */ |
| 243 | - $this->context_view_id = $_GET['gvid']; |
|
| 243 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 244 | 244 | |
| 245 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 246 | 246 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 247 | 247 | $this->context_view_id = array_pop( $array_keys ); |
| 248 | 248 | unset( $array_keys ); |
@@ -277,23 +277,23 @@ discard block |
||
| 277 | 277 | global $wp_rewrite; |
| 278 | 278 | |
| 279 | 279 | $is_front_page = ( $query->is_home || $query->is_page ); |
| 280 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
| 281 | - $front_page_id = get_option('page_on_front'); |
|
| 280 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
| 281 | + $front_page_id = get_option( 'page_on_front' ); |
|
| 282 | 282 | |
| 283 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 283 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 284 | 284 | |
| 285 | 285 | // Force to be an array, potentially a query string ( entry=16 ) |
| 286 | 286 | $_query = wp_parse_args( $query->query ); |
| 287 | 287 | |
| 288 | 288 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
| 289 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
| 290 | - unset( $_query['pagename'] ); |
|
| 289 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
| 290 | + unset( $_query[ 'pagename' ] ); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // this is where will break from core wordpress |
| 294 | 294 | $ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
| 295 | 295 | foreach ( $wp_rewrite->endpoints as $endpoint ) { |
| 296 | - $ignore[] = $endpoint[1]; |
|
| 296 | + $ignore[ ] = $endpoint[ 1 ]; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // Modify the query if: |
@@ -302,21 +302,21 @@ discard block |
||
| 302 | 302 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
| 303 | 303 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
| 304 | 304 | |
| 305 | - $qv =& $query->query_vars; |
|
| 305 | + $qv = & $query->query_vars; |
|
| 306 | 306 | |
| 307 | 307 | // Prevent redirect when on the single entry endpoint |
| 308 | - if( self::is_single_entry() ) { |
|
| 308 | + if ( self::is_single_entry() ) { |
|
| 309 | 309 | add_filter( 'redirect_canonical', '__return_false' ); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $query->is_page = true; |
| 313 | 313 | $query->is_home = false; |
| 314 | - $qv['page_id'] = $front_page_id; |
|
| 314 | + $qv[ 'page_id' ] = $front_page_id; |
|
| 315 | 315 | |
| 316 | 316 | // Correct <!--nextpage--> for page_on_front |
| 317 | - if ( ! empty( $qv['paged'] ) ) { |
|
| 318 | - $qv['page'] = $qv['paged']; |
|
| 319 | - unset( $qv['paged'] ); |
|
| 317 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
| 318 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
| 319 | + unset( $qv[ 'paged' ] ); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | global $post; |
| 335 | 335 | |
| 336 | 336 | // If in admin and NOT AJAX request, get outta here. |
| 337 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 337 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 338 | 338 | return; |
| 339 | 339 | } |
| 340 | 340 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 348 | 348 | |
| 349 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 349 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 350 | 350 | $this->setPostId( $post_id ); |
| 351 | 351 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 352 | 352 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
| 384 | 384 | |
| 385 | - if( 'post' === $search_method ) { |
|
| 385 | + if ( 'post' === $search_method ) { |
|
| 386 | 386 | $get = $_POST; |
| 387 | 387 | } else { |
| 388 | 388 | $get = $_GET; |
@@ -438,20 +438,20 @@ discard block |
||
| 438 | 438 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 439 | 439 | * @param array $entry Current entry |
| 440 | 440 | */ |
| 441 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 441 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 442 | 442 | |
| 443 | 443 | if ( ! $apply_outside_loop ) { |
| 444 | 444 | return $title; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | // User reported WooCommerce doesn't pass two args. |
| 448 | - if ( empty( $passed_post_id ) ) { |
|
| 448 | + if ( empty( $passed_post_id ) ) { |
|
| 449 | 449 | return $title; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | // Don't modify the title for anything other than the current view/post. |
| 453 | 453 | // This is true for embedded shortcodes and Views. |
| 454 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 454 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 455 | 455 | return $title; |
| 456 | 456 | } |
| 457 | 457 | |
@@ -461,19 +461,19 @@ discard block |
||
| 461 | 461 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
| 462 | 462 | } else { |
| 463 | 463 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 464 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 464 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 465 | 465 | $view_meta = $view_data; |
| 466 | 466 | break; |
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 471 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 472 | 472 | |
| 473 | - $title = $view_meta['atts']['single_title']; |
|
| 473 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 474 | 474 | |
| 475 | 475 | // We are allowing HTML in the fields, so no escaping the output |
| 476 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 476 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 477 | 477 | |
| 478 | 478 | $title = do_shortcode( $title ); |
| 479 | 479 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | public function render_view( $passed_args ) { |
| 575 | 575 | |
| 576 | 576 | // validate attributes |
| 577 | - if ( empty( $passed_args['id'] ) ) { |
|
| 577 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
| 578 | 578 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
| 579 | 579 | return null; |
| 580 | 580 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | return null; |
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - $view_id = $passed_args['id']; |
|
| 599 | + $view_id = $passed_args[ 'id' ]; |
|
| 600 | 600 | |
| 601 | 601 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
| 602 | 602 | |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | $passed_args = array_filter( $passed_args, 'strlen' ); |
| 610 | 610 | |
| 611 | 611 | //Override shortcode args over View template settings |
| 612 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
| 612 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
| 613 | 613 | |
| 614 | 614 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
| 615 | 615 | |
@@ -632,14 +632,14 @@ discard block |
||
| 632 | 632 | * @since 1.15 |
| 633 | 633 | * @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. |
| 634 | 634 | */ |
| 635 | - 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 ) ) { |
|
| 635 | + 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 ) ) { |
|
| 636 | 636 | |
| 637 | 637 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
| 638 | 638 | |
| 639 | 639 | return null; |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | - if( $this->isGravityviewPostType() ) { |
|
| 642 | + if ( $this->isGravityviewPostType() ) { |
|
| 643 | 643 | |
| 644 | 644 | /** |
| 645 | 645 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -651,9 +651,9 @@ discard block |
||
| 651 | 651 | */ |
| 652 | 652 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
| 653 | 653 | |
| 654 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
| 654 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
| 655 | 655 | |
| 656 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 656 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 657 | 657 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 658 | 658 | } |
| 659 | 659 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | |
| 669 | 669 | $gravityview_view = new GravityView_View( $view_data ); |
| 670 | 670 | |
| 671 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
| 671 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
| 672 | 672 | |
| 673 | 673 | $gravityview_view->setPostId( $post_id ); |
| 674 | 674 | |
@@ -678,20 +678,20 @@ discard block |
||
| 678 | 678 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
| 679 | 679 | |
| 680 | 680 | //fetch template and slug |
| 681 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
| 681 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
| 682 | 682 | |
| 683 | 683 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
| 684 | 684 | |
| 685 | 685 | /** |
| 686 | 686 | * Disable fetching initial entries for views that don't need it (DataTables) |
| 687 | 687 | */ |
| 688 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
| 688 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
| 689 | 689 | |
| 690 | 690 | /** |
| 691 | 691 | * Hide View data until search is performed |
| 692 | 692 | * @since 1.5.4 |
| 693 | 693 | */ |
| 694 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
| 694 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
| 695 | 695 | $gravityview_view->setHideUntilSearched( true ); |
| 696 | 696 | $get_entries = false; |
| 697 | 697 | } |
@@ -699,23 +699,23 @@ discard block |
||
| 699 | 699 | |
| 700 | 700 | if ( $get_entries ) { |
| 701 | 701 | |
| 702 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
| 702 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
| 703 | 703 | // add filter to enable column sorting |
| 704 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
| 704 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
| 707 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
| 708 | 708 | |
| 709 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
| 709 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
| 710 | 710 | |
| 711 | 711 | } else { |
| 712 | 712 | |
| 713 | 713 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
| 714 | 714 | |
| 715 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
| 715 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
| 718 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
| 719 | 719 | $gravityview_view->setContext( 'directory' ); |
| 720 | 720 | $sections = array( 'header', 'body', 'footer' ); |
| 721 | 721 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
| 730 | 730 | * @since 1.17 |
| 731 | 731 | */ |
| 732 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
| 732 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
| 733 | 733 | |
| 734 | 734 | $entry = $this->getEntry(); |
| 735 | 735 | |
@@ -756,20 +756,20 @@ discard block |
||
| 756 | 756 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
| 757 | 757 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
| 758 | 758 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
| 759 | - 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 ); |
|
| 759 | + 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 ); |
|
| 760 | 760 | return null; |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | //fetch template and slug |
| 764 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
| 764 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
| 765 | 765 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
| 766 | 766 | |
| 767 | 767 | //fetch entry detail |
| 768 | - $view_entries['count'] = 1; |
|
| 769 | - $view_entries['entries'][] = $entry; |
|
| 770 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
| 768 | + $view_entries[ 'count' ] = 1; |
|
| 769 | + $view_entries[ 'entries' ][ ] = $entry; |
|
| 770 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
| 771 | 771 | |
| 772 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
| 772 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
| 773 | 773 | |
| 774 | 774 | // set back link label |
| 775 | 775 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -779,11 +779,11 @@ discard block |
||
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | // add template style |
| 782 | - self::add_style( $view_data['template_id'] ); |
|
| 782 | + self::add_style( $view_data[ 'template_id' ] ); |
|
| 783 | 783 | |
| 784 | 784 | // Prepare to render view and set vars |
| 785 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
| 786 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
| 785 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
| 786 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
| 787 | 787 | |
| 788 | 788 | // If Edit |
| 789 | 789 | if ( 'edit' === gravityview_get_context() ) { |
@@ -796,11 +796,11 @@ discard block |
||
| 796 | 796 | |
| 797 | 797 | } else { |
| 798 | 798 | // finaly we'll render some html |
| 799 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
| 799 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
| 800 | 800 | |
| 801 | 801 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
| 802 | 802 | foreach ( $sections as $section ) { |
| 803 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
| 803 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
| 804 | 804 | $gravityview_view->render( $view_slug, $section, false ); |
| 805 | 805 | } |
| 806 | 806 | } |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | $datetime_format = 'Y-m-d H:i:s'; |
| 855 | 855 | $search_is_outside_view_bounds = false; |
| 856 | 856 | |
| 857 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 857 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 858 | 858 | |
| 859 | 859 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 860 | 860 | |
@@ -882,14 +882,14 @@ discard block |
||
| 882 | 882 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 883 | 883 | |
| 884 | 884 | // Then we override the search and re-set the start date |
| 885 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 885 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 890 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 891 | 891 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 892 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 892 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 893 | 893 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
| 894 | 894 | } |
| 895 | 895 | } |
@@ -907,9 +907,9 @@ discard block |
||
| 907 | 907 | */ |
| 908 | 908 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 909 | 909 | |
| 910 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 911 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 912 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 910 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 911 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 912 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 913 | 913 | |
| 914 | 914 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
| 915 | 915 | } |
@@ -933,12 +933,12 @@ discard block |
||
| 933 | 933 | */ |
| 934 | 934 | public static function is_entry_approved( $entry, $args = array() ) { |
| 935 | 935 | |
| 936 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 936 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 937 | 937 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 938 | 938 | return true; |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
| 941 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); |
|
| 942 | 942 | |
| 943 | 943 | if ( $is_approved ) { |
| 944 | 944 | return true; |
@@ -976,26 +976,26 @@ discard block |
||
| 976 | 976 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
| 977 | 977 | |
| 978 | 978 | // implicity search |
| 979 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 979 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 980 | 980 | |
| 981 | 981 | // Search operator options. Options: `is` or `contains` |
| 982 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 982 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 983 | 983 | |
| 984 | - $search_criteria['field_filters'][] = array( |
|
| 984 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 985 | 985 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
| 986 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 986 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 987 | 987 | 'operator' => $operator, |
| 988 | 988 | ); |
| 989 | 989 | } |
| 990 | 990 | |
| 991 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 991 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 992 | 992 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
| 993 | 993 | } |
| 994 | 994 | |
| 995 | 995 | // Handle setting date range |
| 996 | 996 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 997 | 997 | |
| 998 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 998 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 999 | 999 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
| 1000 | 1000 | } |
| 1001 | 1001 | |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 1007 | 1007 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 1008 | 1008 | */ |
| 1009 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1009 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1010 | 1010 | |
| 1011 | 1011 | return $search_criteria; |
| 1012 | 1012 | } |
@@ -1052,16 +1052,16 @@ discard block |
||
| 1052 | 1052 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
| 1053 | 1053 | |
| 1054 | 1054 | // Paging & offset |
| 1055 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 1055 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 1056 | 1056 | |
| 1057 | 1057 | if ( -1 === $page_size ) { |
| 1058 | 1058 | $page_size = PHP_INT_MAX; |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | - if ( isset( $args['offset'] ) ) { |
|
| 1062 | - $offset = intval( $args['offset'] ); |
|
| 1061 | + if ( isset( $args[ 'offset' ] ) ) { |
|
| 1062 | + $offset = intval( $args[ 'offset' ] ); |
|
| 1063 | 1063 | } else { |
| 1064 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 1064 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 1065 | 1065 | $offset = ( $curr_page - 1 ) * $page_size; |
| 1066 | 1066 | } |
| 1067 | 1067 | |
@@ -1079,7 +1079,7 @@ discard block |
||
| 1079 | 1079 | 'search_criteria' => $search_criteria, |
| 1080 | 1080 | 'sorting' => $sorting, |
| 1081 | 1081 | 'paging' => $paging, |
| 1082 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 1082 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 1083 | 1083 | ); |
| 1084 | 1084 | |
| 1085 | 1085 | /** |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 1105 | 1105 | * @param array $args View configuration args. |
| 1106 | 1106 | */ |
| 1107 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
| 1107 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
| 1108 | 1108 | |
| 1109 | 1109 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
| 1110 | 1110 | |
@@ -1144,8 +1144,8 @@ discard block |
||
| 1144 | 1144 | */ |
| 1145 | 1145 | public static function updateViewSorting( $args, $form_id ) { |
| 1146 | 1146 | $sorting = array(); |
| 1147 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
| 1148 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
| 1147 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
| 1148 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
| 1149 | 1149 | |
| 1150 | 1150 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1151 | 1151 | |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | |
| 1186 | 1186 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1187 | 1187 | |
| 1188 | - switch ( $sort_field['type'] ) { |
|
| 1188 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1189 | 1189 | |
| 1190 | 1190 | case 'address': |
| 1191 | 1191 | // Sorting by full address |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | */ |
| 1203 | 1203 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1204 | 1204 | |
| 1205 | - switch( strtolower( $address_part ) ){ |
|
| 1205 | + switch ( strtolower( $address_part ) ) { |
|
| 1206 | 1206 | case 'street': |
| 1207 | 1207 | $sort_field_id .= '.1'; |
| 1208 | 1208 | break; |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | */ |
| 1283 | 1283 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1284 | 1284 | |
| 1285 | - if ( empty( $single_entry ) ){ |
|
| 1285 | + if ( empty( $single_entry ) ) { |
|
| 1286 | 1286 | return false; |
| 1287 | 1287 | } else { |
| 1288 | 1288 | return $single_entry; |
@@ -1309,7 +1309,7 @@ discard block |
||
| 1309 | 1309 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1310 | 1310 | * @since 1.15 |
| 1311 | 1311 | */ |
| 1312 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1312 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1313 | 1313 | continue; |
| 1314 | 1314 | } |
| 1315 | 1315 | |
@@ -1318,19 +1318,19 @@ discard block |
||
| 1318 | 1318 | $css_dependencies = array(); |
| 1319 | 1319 | |
| 1320 | 1320 | // If the thickbox is enqueued, add dependencies |
| 1321 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
| 1321 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
| 1322 | 1322 | |
| 1323 | 1323 | /** |
| 1324 | 1324 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1325 | 1325 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1326 | 1326 | */ |
| 1327 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1327 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1328 | 1328 | |
| 1329 | 1329 | /** |
| 1330 | 1330 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1331 | 1331 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1332 | 1332 | */ |
| 1333 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1333 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | 1336 | /** |
@@ -1338,25 +1338,25 @@ discard block |
||
| 1338 | 1338 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1339 | 1339 | * @since 1.15 |
| 1340 | 1340 | */ |
| 1341 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1342 | - $css_dependencies[] = 'dashicons'; |
|
| 1341 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1342 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | 1345 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1346 | 1346 | |
| 1347 | 1347 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1348 | 1348 | |
| 1349 | - 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 ); |
|
| 1349 | + 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 ); |
|
| 1350 | 1350 | |
| 1351 | 1351 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1352 | 1352 | |
| 1353 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1353 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1354 | 1354 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | $this->enqueue_default_style( $css_dependencies ); |
| 1358 | 1358 | |
| 1359 | - self::add_style( $data['template_id'] ); |
|
| 1359 | + self::add_style( $data[ 'template_id' ] ); |
|
| 1360 | 1360 | } |
| 1361 | 1361 | |
| 1362 | 1362 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1418,7 +1418,7 @@ discard block |
||
| 1418 | 1418 | } elseif ( empty( $template_id ) ) { |
| 1419 | 1419 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
| 1420 | 1420 | } else { |
| 1421 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
| 1421 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | 1424 | } |
@@ -1443,11 +1443,11 @@ discard block |
||
| 1443 | 1443 | * Not a table-based template; don't add sort icons |
| 1444 | 1444 | * @since 1.12 |
| 1445 | 1445 | */ |
| 1446 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1446 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1447 | 1447 | return $label; |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1450 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1451 | 1451 | return $label; |
| 1452 | 1452 | } |
| 1453 | 1453 | |
@@ -1455,29 +1455,29 @@ discard block |
||
| 1455 | 1455 | |
| 1456 | 1456 | $class = 'gv-sort'; |
| 1457 | 1457 | |
| 1458 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1458 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1459 | 1459 | |
| 1460 | 1460 | $sort_args = array( |
| 1461 | - 'sort' => $field['id'], |
|
| 1461 | + 'sort' => $field[ 'id' ], |
|
| 1462 | 1462 | 'dir' => 'asc', |
| 1463 | 1463 | ); |
| 1464 | 1464 | |
| 1465 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1465 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1466 | 1466 | //toggle sorting direction. |
| 1467 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1468 | - $sort_args['dir'] = 'desc'; |
|
| 1467 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1468 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1469 | 1469 | $class .= ' gv-icon-sort-desc'; |
| 1470 | 1470 | } else { |
| 1471 | - $sort_args['dir'] = 'asc'; |
|
| 1471 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1472 | 1472 | $class .= ' gv-icon-sort-asc'; |
| 1473 | 1473 | } |
| 1474 | 1474 | } else { |
| 1475 | 1475 | $class .= ' gv-icon-caret-up-down'; |
| 1476 | 1476 | } |
| 1477 | 1477 | |
| 1478 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1478 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1479 | 1479 | |
| 1480 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1480 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1481 | 1481 | |
| 1482 | 1482 | } |
| 1483 | 1483 | |
@@ -1495,7 +1495,7 @@ discard block |
||
| 1495 | 1495 | |
| 1496 | 1496 | $field_type = $field_id; |
| 1497 | 1497 | |
| 1498 | - if( is_numeric( $field_id ) ) { |
|
| 1498 | + if ( is_numeric( $field_id ) ) { |
|
| 1499 | 1499 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1500 | 1500 | $field_type = $field->type; |
| 1501 | 1501 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
| 1518 | 1518 | return false; |
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1521 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1522 | 1522 | |
| 1523 | 1523 | } |
| 1524 | 1524 | |
@@ -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' ); |
|
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 29 | 29 | |
| 30 | - unset ( $field_options['search_filter'], $field_options['show_as_link'] ); |
|
| 30 | + unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] ); |
|
| 31 | 31 | |
| 32 | 32 | return $field_options; |
| 33 | 33 | } |