@@ -66,20 +66,20 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | /** Load common & connector functions */ |
| 68 | 68 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
| 69 | -require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
| 70 | -require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
| 69 | +require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
| 70 | +require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
| 71 | 71 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
| 72 | 72 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
| 73 | 73 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
| 74 | 74 | |
| 75 | 75 | /** Register Post Types and Rewrite Rules */ |
| 76 | -require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
| 76 | +require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
| 77 | 77 | |
| 78 | 78 | /** Add Cache Class */ |
| 79 | -require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
| 79 | +require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
| 80 | 80 | |
| 81 | 81 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
| 82 | -if( is_admin() ) { |
|
| 82 | +if ( is_admin() ) { |
|
| 83 | 83 | register_activation_hook( __FILE__, array( 'GravityView_Plugin', 'activate' ) ); |
| 84 | 84 | register_deactivation_hook( __FILE__, array( 'GravityView_Plugin', 'deactivate' ) ); |
| 85 | 85 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public static function getInstance() { |
| 102 | 102 | |
| 103 | - if( empty( self::$instance ) ) { |
|
| 103 | + if ( empty( self::$instance ) ) { |
|
| 104 | 104 | self::$instance = new self; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | private function __construct() { |
| 111 | 111 | |
| 112 | 112 | |
| 113 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
| 113 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function include_files() { |
| 141 | 141 | |
| 142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
| 142 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
| 143 | 143 | |
| 144 | 144 | // Load fields |
| 145 | 145 | include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-fields.php' ); |
@@ -150,20 +150,20 @@ discard block |
||
| 150 | 150 | include_once( $gv_field_filename ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
| 154 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
| 153 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
| 154 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
| 155 | 155 | |
| 156 | 156 | // Load Extensions |
| 157 | 157 | // @todo: Convert to a scan of the directory or a method where this all lives |
| 158 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
| 159 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
| 160 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
| 158 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
| 159 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
| 160 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
| 161 | 161 | |
| 162 | 162 | // Load WordPress Widgets |
| 163 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 163 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 164 | 164 | |
| 165 | 165 | // Load GravityView Widgets |
| 166 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
| 166 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
| 167 | 167 | |
| 168 | 168 | // Add oEmbed |
| 169 | 169 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
| 177 | 177 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
| 178 | 178 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
| 179 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
| 179 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
| 180 | 180 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
| 181 | 181 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
| 182 | 182 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @return bool |
| 192 | 192 | */ |
| 193 | 193 | public static function is_network_activated() { |
| 194 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 194 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @since 1.7.5.1 |
| 257 | 257 | */ |
| 258 | 258 | public static function include_widget_class() { |
| 259 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 259 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | if ( ! $loaded ) { |
| 280 | 280 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
| 281 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
| 281 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
| 282 | 282 | load_textdomain( 'gravityview', $mofile ); |
| 283 | 283 | } |
| 284 | 284 | |
@@ -309,12 +309,12 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public function frontend_actions( $force = false ) { |
| 311 | 311 | |
| 312 | - if( self::is_admin() && ! $force ) { return; } |
|
| 312 | + if ( self::is_admin() && ! $force ) { return; } |
|
| 313 | 313 | |
| 314 | 314 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
| 315 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
| 316 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
| 317 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
| 315 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
| 316 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
| 317 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
| 318 | 318 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
| 319 | 319 | |
| 320 | 320 | |
@@ -339,8 +339,8 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | public static function get_default_widget_areas() { |
| 341 | 341 | $default_areas = array( |
| 342 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
| 343 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
| 342 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 343 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 344 | 344 | ); |
| 345 | 345 | |
| 346 | 346 | /** |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * @param mixed $data Additional data to display |
| 359 | 359 | * @return void |
| 360 | 360 | */ |
| 361 | - public static function log_debug( $message, $data = null ){ |
|
| 361 | + public static function log_debug( $message, $data = null ) { |
|
| 362 | 362 | /** |
| 363 | 363 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 364 | 364 | * @param string $message Message to display |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * @param string $message log message |
| 373 | 373 | * @return void |
| 374 | 374 | */ |
| 375 | - public static function log_error( $message, $data = null ){ |
|
| 375 | + public static function log_error( $message, $data = null ) { |
|
| 376 | 376 | /** |
| 377 | 377 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 378 | 378 | * @param string $message Error message to display |
@@ -383,4 +383,4 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | } // end class GravityView_Plugin |
| 385 | 385 | |
| 386 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
| 386 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
|
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
| 126 | 126 | |
| 127 | - $form = self::get_form( $entry['form_id'] ); |
|
| 127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 128 | 128 | |
| 129 | 129 | return $form; |
| 130 | 130 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $results = GFAPI::get_entries( 0, $search_criteria, null, $paging ); |
| 177 | 177 | |
| 178 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
| 178 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
| 179 | 179 | |
| 180 | 180 | return $result; |
| 181 | 181 | } |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | if ( class_exists( 'GFAPI' ) ) { |
| 194 | 194 | $gf_forms = GFAPI::get_forms(); |
| 195 | 195 | foreach ( $gf_forms as $form ) { |
| 196 | - $forms[] = array( |
|
| 197 | - 'id' => $form['id'], |
|
| 198 | - 'title' => $form['title'], |
|
| 196 | + $forms[ ] = array( |
|
| 197 | + 'id' => $form[ 'id' ], |
|
| 198 | + 'title' => $form[ 'title' ], |
|
| 199 | 199 | ); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if ( $form ) { |
| 230 | - foreach ( $form['fields'] as $field ) { |
|
| 230 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 231 | 231 | |
| 232 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
| 233 | - $fields[ $field['id'] ] = array( |
|
| 232 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
| 233 | + $fields[ $field[ 'id' ] ] = array( |
|
| 234 | 234 | 'label' => rgar( $field, 'label' ), |
| 235 | 235 | 'parent' => null, |
| 236 | 236 | 'type' => rgar( $field, 'type' ), |
@@ -239,16 +239,16 @@ discard block |
||
| 239 | 239 | ); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
| 243 | - foreach ( $field['inputs'] as $input ) { |
|
| 242 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
| 243 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
| 244 | 244 | /** |
| 245 | 245 | * @hack |
| 246 | 246 | * In case of email/email confirmation, the input for email has the same id as the parent field |
| 247 | 247 | */ |
| 248 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 248 | + if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) { |
|
| 249 | 249 | continue; |
| 250 | 250 | } |
| 251 | - $fields[ (string)$input['id'] ] = array( |
|
| 251 | + $fields[ (string)$input[ 'id' ] ] = array( |
|
| 252 | 252 | 'label' => rgar( $input, 'label' ), |
| 253 | 253 | 'customLabel' => rgar( $input, 'customLabel' ), |
| 254 | 254 | 'parent' => $field, |
@@ -260,14 +260,14 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
| 263 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
| 263 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
| 264 | 264 | $has_product_fields = true; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * @hack Version 1.9 |
| 269 | 269 | */ |
| 270 | - $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field; |
|
| 270 | + $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field; |
|
| 271 | 271 | |
| 272 | 272 | if ( GFCommon::is_post_field( $field_for_is_post_field ) ) { |
| 273 | 273 | $has_post_fields = true; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @since 1.7 |
| 280 | 280 | */ |
| 281 | 281 | if ( $has_post_fields ) { |
| 282 | - $fields['post_id'] = array( |
|
| 282 | + $fields[ 'post_id' ] = array( |
|
| 283 | 283 | 'label' => __( 'Post ID', 'gravityview' ), |
| 284 | 284 | 'type' => 'post_id', |
| 285 | 285 | ); |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
| 291 | 291 | |
| 292 | 292 | foreach ( $payment_fields as $payment_field ) { |
| 293 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
| 293 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
| 294 | 294 | continue; |
| 295 | 295 | } |
| 296 | - $fields["{$payment_field->name}"] = array( |
|
| 296 | + $fields[ "{$payment_field->name}" ] = array( |
|
| 297 | 297 | 'label' => $payment_field->label, |
| 298 | 298 | 'desc' => $payment_field->description, |
| 299 | 299 | 'type' => $payment_field->name, |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | $fields = array(); |
| 327 | 327 | |
| 328 | - foreach ( $extra_fields as $key => $field ){ |
|
| 329 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
| 330 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
| 328 | + foreach ( $extra_fields as $key => $field ) { |
|
| 329 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
| 330 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
@@ -367,32 +367,32 @@ discard block |
||
| 367 | 367 | 'search_criteria' => null, |
| 368 | 368 | 'sorting' => null, |
| 369 | 369 | 'paging' => null, |
| 370 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
| 370 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
| 371 | 371 | ); |
| 372 | 372 | |
| 373 | 373 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
| 374 | 374 | |
| 375 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
| 376 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
| 375 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 376 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
| 377 | 377 | |
| 378 | 378 | if ( ! is_array( $filter ) ) { |
| 379 | 379 | continue; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | // By default, we want searches to be wildcard for each field. |
| 383 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 383 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 384 | 384 | |
| 385 | 385 | /** |
| 386 | 386 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
| 387 | 387 | * @param string $operator Existing search operator |
| 388 | 388 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 389 | 389 | */ |
| 390 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 390 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // don't send just the [mode] without any field filter. |
| 394 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
| 395 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
| 394 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 395 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | } |
@@ -403,21 +403,21 @@ discard block |
||
| 403 | 403 | * Prepare date formats to be in Gravity Forms DB format; |
| 404 | 404 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
| 405 | 405 | */ |
| 406 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
| 406 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
| 407 | 407 | |
| 408 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
| 408 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
| 409 | 409 | |
| 410 | 410 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
| 411 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
| 411 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 412 | 412 | |
| 413 | 413 | if ( $date ) { |
| 414 | 414 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
| 415 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 415 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 416 | 416 | } else { |
| 417 | 417 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
| 418 | - unset( $criteria['search_criteria'][ $key ] ); |
|
| 418 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 419 | 419 | |
| 420 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
| 420 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | } |
@@ -425,12 +425,12 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
| 427 | 427 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
| 428 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 428 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 429 | 429 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 430 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
| 431 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
| 430 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
| 431 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
| 432 | 432 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
| 433 | - $criteria['context_view_id'] = null; |
|
| 433 | + $criteria[ 'context_view_id' ] = null; |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * @param array $form_ids Forms to search |
| 440 | 440 | * @param int $view_id ID of the view being used to search |
| 441 | 441 | */ |
| 442 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
| 442 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
| 443 | 443 | |
| 444 | 444 | return (array)$criteria; |
| 445 | 445 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | /** Reduce # of database calls */ |
| 471 | 471 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
| 472 | 472 | |
| 473 | - if ( ! empty( $criteria['cache'] ) ) { |
|
| 473 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
| 474 | 474 | |
| 475 | 475 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
| 476 | 476 | |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | // Still update the total count when using cached results |
| 480 | 480 | if ( ! is_null( $total ) ) { |
| 481 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
| 481 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | $return = $entries; |
@@ -498,9 +498,9 @@ discard block |
||
| 498 | 498 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
| 499 | 499 | |
| 500 | 500 | // No entries returned from gravityview_before_get_entries |
| 501 | - if( is_null( $entries ) ) { |
|
| 501 | + if ( is_null( $entries ) ) { |
|
| 502 | 502 | |
| 503 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
| 503 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
| 504 | 504 | |
| 505 | 505 | if ( is_wp_error( $entries ) ) { |
| 506 | 506 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
| 512 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
| 513 | 513 | |
| 514 | 514 | // Cache results |
| 515 | 515 | $Cache->set( $entries, 'entries' ); |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | */ |
| 597 | 597 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
| 598 | 598 | |
| 599 | - if( $check_entry_display ) { |
|
| 599 | + if ( $check_entry_display ) { |
|
| 600 | 600 | // Is the entry allowed |
| 601 | 601 | $entry = self::check_entry_display( $entry ); |
| 602 | 602 | } |
@@ -629,12 +629,12 @@ discard block |
||
| 629 | 629 | |
| 630 | 630 | $value = false; |
| 631 | 631 | |
| 632 | - if( 'context' === $val1 ) { |
|
| 632 | + if ( 'context' === $val1 ) { |
|
| 633 | 633 | |
| 634 | 634 | $matching_contexts = array( $val2 ); |
| 635 | 635 | |
| 636 | 636 | // We allow for non-standard contexts. |
| 637 | - switch( $val2 ) { |
|
| 637 | + switch ( $val2 ) { |
|
| 638 | 638 | // Check for either single or edit |
| 639 | 639 | case 'singular': |
| 640 | 640 | $matching_contexts = array( 'single', 'edit' ); |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | return false; |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - if ( empty( $entry['form_id'] ) ) { |
|
| 697 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
| 698 | 698 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
| 699 | 699 | return false; |
| 700 | 700 | } |
@@ -702,26 +702,26 @@ discard block |
||
| 702 | 702 | $criteria = self::calculate_get_entries_criteria(); |
| 703 | 703 | |
| 704 | 704 | // Make sure the current View is connected to the same form as the Entry |
| 705 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
| 706 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
| 705 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
| 706 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
| 707 | 707 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
| 708 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
| 709 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
| 708 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
| 709 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
| 710 | 710 | return false; |
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
| 714 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
| 715 | 715 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
| 716 | 716 | return $entry; |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | - $search_criteria = $criteria['search_criteria']; |
|
| 719 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
| 720 | 720 | unset( $criteria ); |
| 721 | 721 | |
| 722 | 722 | // check entry status |
| 723 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
| 724 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
| 723 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
| 724 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
| 725 | 725 | return false; |
| 726 | 726 | } |
| 727 | 727 | |
@@ -729,37 +729,37 @@ discard block |
||
| 729 | 729 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
| 730 | 730 | |
| 731 | 731 | // field_filters |
| 732 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
| 732 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
| 733 | 733 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
| 734 | 734 | return $entry; |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | - $filters = $search_criteria['field_filters']; |
|
| 737 | + $filters = $search_criteria[ 'field_filters' ]; |
|
| 738 | 738 | unset( $search_criteria ); |
| 739 | 739 | |
| 740 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
| 741 | - unset( $filters['mode'] ); |
|
| 740 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
| 741 | + unset( $filters[ 'mode' ] ); |
|
| 742 | 742 | |
| 743 | - $form = self::get_form( $entry['form_id'] ); |
|
| 743 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 744 | 744 | |
| 745 | 745 | foreach ( $filters as $filter ) { |
| 746 | 746 | |
| 747 | - if ( ! isset( $filter['key'] ) ) { |
|
| 747 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
| 748 | 748 | continue; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | - $k = $filter['key']; |
|
| 751 | + $k = $filter[ 'key' ]; |
|
| 752 | 752 | |
| 753 | 753 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
| 754 | 754 | $field_value = $entry[ $k ]; |
| 755 | 755 | $field = null; |
| 756 | 756 | } else { |
| 757 | 757 | $field = self::get_field( $form, $k ); |
| 758 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 758 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
| 762 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
| 761 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
| 762 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
| 763 | 763 | |
| 764 | 764 | // verify if we are already free to go! |
| 765 | 765 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -817,18 +817,18 @@ discard block |
||
| 817 | 817 | * Gravity Forms code to adjust date to locally-configured Time Zone |
| 818 | 818 | * @see GFCommon::format_date() for original code |
| 819 | 819 | */ |
| 820 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 820 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 821 | 821 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
| 822 | 822 | |
| 823 | - $format = rgar( $atts, 'format' ); |
|
| 824 | - $is_human = ! empty( $atts['human'] ); |
|
| 825 | - $is_diff = ! empty( $atts['diff'] ); |
|
| 826 | - $is_raw = ! empty( $atts['raw'] ); |
|
| 827 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
| 828 | - $include_time = ! empty( $atts['time'] ); |
|
| 823 | + $format = rgar( $atts, 'format' ); |
|
| 824 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
| 825 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
| 826 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
| 827 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
| 828 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
| 829 | 829 | |
| 830 | 830 | // If we're using time diff, we want to have a different default format |
| 831 | - if( empty( $format ) ) { |
|
| 831 | + if ( empty( $format ) ) { |
|
| 832 | 832 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
| 833 | 833 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
| 834 | 834 | } |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | // If raw was specified, don't modify the stored value |
| 837 | 837 | if ( $is_raw ) { |
| 838 | 838 | $formatted_date = $date_string; |
| 839 | - } elseif( $is_timestamp ) { |
|
| 839 | + } elseif ( $is_timestamp ) { |
|
| 840 | 840 | $formatted_date = $date_local_timestamp; |
| 841 | 841 | } elseif ( $is_diff ) { |
| 842 | 842 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | |
| 871 | 871 | $label = rgar( $field, 'label' ); |
| 872 | 872 | |
| 873 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 873 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 874 | 874 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
| 875 | 875 | } |
| 876 | 876 | |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
| 892 | 892 | */ |
| 893 | 893 | public static function get_field( $form, $field_id ) { |
| 894 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 894 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 895 | 895 | return GFFormsModel::get_field( $form, $field_id ); |
| 896 | 896 | } else { |
| 897 | 897 | return null; |
@@ -938,19 +938,19 @@ discard block |
||
| 938 | 938 | $shortcodes = array(); |
| 939 | 939 | |
| 940 | 940 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 941 | - if ( empty( $matches ) ){ |
|
| 941 | + if ( empty( $matches ) ) { |
|
| 942 | 942 | return false; |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | foreach ( $matches as $shortcode ) { |
| 946 | - if ( $tag === $shortcode[2] ) { |
|
| 946 | + if ( $tag === $shortcode[ 2 ] ) { |
|
| 947 | 947 | |
| 948 | 948 | // Changed this to $shortcode instead of true so we get the parsed atts. |
| 949 | - $shortcodes[] = $shortcode; |
|
| 949 | + $shortcodes[ ] = $shortcode; |
|
| 950 | 950 | |
| 951 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
| 952 | - foreach( $results as $result ) { |
|
| 953 | - $shortcodes[] = $result; |
|
| 951 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
| 952 | + foreach ( $results as $result ) { |
|
| 953 | + $shortcodes[ ] = $result; |
|
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | } |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | * @return string html |
| 1112 | 1112 | */ |
| 1113 | 1113 | public static function get_sortable_fields( $formid, $current = '' ) { |
| 1114 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
| 1114 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
| 1115 | 1115 | |
| 1116 | 1116 | if ( empty( $formid ) ) { |
| 1117 | 1117 | return $output; |
@@ -1124,11 +1124,11 @@ discard block |
||
| 1124 | 1124 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
| 1125 | 1125 | |
| 1126 | 1126 | foreach ( $fields as $id => $field ) { |
| 1127 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1127 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1128 | 1128 | continue; |
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
| 1131 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
| 1132 | 1132 | } |
| 1133 | 1133 | } |
| 1134 | 1134 | |
@@ -1163,9 +1163,9 @@ discard block |
||
| 1163 | 1163 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1164 | 1164 | |
| 1165 | 1165 | // TODO: Convert to using array_filter |
| 1166 | - foreach( $fields as $id => $field ) { |
|
| 1166 | + foreach ( $fields as $id => $field ) { |
|
| 1167 | 1167 | |
| 1168 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1168 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1169 | 1169 | unset( $fields[ $id ] ); |
| 1170 | 1170 | } |
| 1171 | 1171 | } |
@@ -1206,14 +1206,14 @@ discard block |
||
| 1206 | 1206 | * @param int|array $field field key or field array |
| 1207 | 1207 | * @return boolean |
| 1208 | 1208 | */ |
| 1209 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1209 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1210 | 1210 | |
| 1211 | 1211 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
| 1212 | 1212 | $form = self::get_form( $form ); |
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | // If entry meta, it's a string. Otherwise, numeric |
| 1216 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1216 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1217 | 1217 | $type = $field; |
| 1218 | 1218 | } else { |
| 1219 | 1219 | $type = self::get_field_type( $form, $field ); |
@@ -1227,9 +1227,9 @@ discard block |
||
| 1227 | 1227 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
| 1228 | 1228 | |
| 1229 | 1229 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
| 1230 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1231 | - if( true === $gv_field->is_numeric ) { |
|
| 1232 | - $numeric_types[] = $gv_field->is_numeric; |
|
| 1230 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1231 | + if ( true === $gv_field->is_numeric ) { |
|
| 1232 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
| 1233 | 1233 | } |
| 1234 | 1234 | } |
| 1235 | 1235 | |
@@ -1379,11 +1379,11 @@ discard block |
||
| 1379 | 1379 | $final_atts = array_filter( $final_atts ); |
| 1380 | 1380 | |
| 1381 | 1381 | // If the href wasn't passed as an attribute, use the value passed to the function |
| 1382 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
| 1383 | - $final_atts['href'] = $href; |
|
| 1382 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
| 1383 | + $final_atts[ 'href' ] = $href; |
|
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | - $final_atts['href'] = esc_url_raw( $href ); |
|
| 1386 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
| 1387 | 1387 | |
| 1388 | 1388 | // Sort the attributes alphabetically, to help testing |
| 1389 | 1389 | ksort( $final_atts ); |
@@ -1394,7 +1394,7 @@ discard block |
||
| 1394 | 1394 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | - if( '' !== $output ) { |
|
| 1397 | + if ( '' !== $output ) { |
|
| 1398 | 1398 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
| 1399 | 1399 | } |
| 1400 | 1400 | |
@@ -1418,7 +1418,7 @@ discard block |
||
| 1418 | 1418 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
| 1419 | 1419 | $merged = $array1; |
| 1420 | 1420 | |
| 1421 | - foreach ( $array2 as $key => &$value ) { |
|
| 1421 | + foreach ( $array2 as $key => &$value ) { |
|
| 1422 | 1422 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
| 1423 | 1423 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
| 1424 | 1424 | } else { |
@@ -1453,7 +1453,7 @@ discard block |
||
| 1453 | 1453 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
| 1454 | 1454 | * @param array $settings Settings array, with `number` key defining the # of users to display |
| 1455 | 1455 | */ |
| 1456 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1456 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1457 | 1457 | |
| 1458 | 1458 | return get_users( $get_users_settings ); |
| 1459 | 1459 | } |
@@ -1468,7 +1468,7 @@ discard block |
||
| 1468 | 1468 | * @return string |
| 1469 | 1469 | */ |
| 1470 | 1470 | public static function generate_notice( $notice, $class = '' ) { |
| 1471 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1471 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
| 1472 | 1472 | } |
| 1473 | 1473 | |
| 1474 | 1474 | /** |
@@ -48,25 +48,25 @@ |
||
| 48 | 48 | |
| 49 | 49 | $quiz_fields = GFAPI::get_fields_by_type( $form, 'quiz' ); |
| 50 | 50 | |
| 51 | - if( ! empty( $quiz_fields ) ) { |
|
| 51 | + if ( ! empty( $quiz_fields ) ) { |
|
| 52 | 52 | |
| 53 | - $fields['gquiz_score'] = array( |
|
| 53 | + $fields[ 'gquiz_score' ] = array( |
|
| 54 | 54 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
| 55 | 55 | 'type' => 'quiz_score', |
| 56 | 56 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
| 57 | 57 | ); |
| 58 | - $fields['gquiz_percent'] = array( |
|
| 58 | + $fields[ 'gquiz_percent' ] = array( |
|
| 59 | 59 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
| 60 | 60 | 'type' => 'quiz_percent', |
| 61 | 61 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
| 62 | 62 | ); |
| 63 | - $fields['gquiz_grade'] = array( |
|
| 63 | + $fields[ 'gquiz_grade' ] = array( |
|
| 64 | 64 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
| 65 | 65 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
| 66 | 66 | 'type' => 'quiz_grade', |
| 67 | 67 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
| 68 | 68 | ); |
| 69 | - $fields['gquiz_is_pass'] = array( |
|
| 69 | + $fields[ 'gquiz_is_pass' ] = array( |
|
| 70 | 70 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
| 71 | 71 | 'type' => 'quiz_is_pass', |
| 72 | 72 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | // Add the list columns |
| 63 | 63 | foreach ( $list_fields as $list_field ) { |
| 64 | 64 | |
| 65 | - if( empty( $list_field->enableColumns ) ) { |
|
| 65 | + if ( empty( $list_field->enableColumns ) ) { |
|
| 66 | 66 | continue; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // If there are columns, add them under the parent field |
| 86 | - if( ! empty( $list_columns ) ) { |
|
| 86 | + if ( ! empty( $list_columns ) ) { |
|
| 87 | 87 | $index = array_search( $list_field->id, array_keys( $fields ) ); |
| 88 | 88 | array_splice( $fields, ( $index + 1 ), 0, $list_columns ); |
| 89 | 89 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | $list_rows = maybe_unserialize( $field_value ); |
| 114 | 114 | |
| 115 | - if( ! is_array( $list_rows ) ) { |
|
| 115 | + if ( ! is_array( $list_rows ) ) { |
|
| 116 | 116 | do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value ); |
| 117 | 117 | return null; |
| 118 | 118 | } |
@@ -125,15 +125,15 @@ discard block |
||
| 125 | 125 | foreach ( $list_row as $column_key => $column_value ) { |
| 126 | 126 | |
| 127 | 127 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
| 128 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
| 129 | - $column_values[] = $column_value; |
|
| 128 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
| 129 | + $column_values[ ] = $column_value; |
|
| 130 | 130 | } |
| 131 | 131 | $current_column++; |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // Return the array of values |
| 136 | - if( 'raw' === $format ) { |
|
| 136 | + if ( 'raw' === $format ) { |
|
| 137 | 137 | return $column_values; |
| 138 | 138 | } |
| 139 | 139 | // Return the Gravity Forms Field output |
@@ -156,22 +156,22 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function _filter_field_label( $label, $field, $form, $entry ) { |
| 158 | 158 | |
| 159 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
| 159 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
| 160 | 160 | |
| 161 | 161 | // Not a list field |
| 162 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
| 162 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
| 163 | 163 | return $label; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Custom label is defined, so use it |
| 167 | - if( ! empty( $field['custom_label'] ) ) { |
|
| 167 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
| 168 | 168 | return $label; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $column_id = gravityview_get_input_id_from_id( $field['id'] ); |
|
| 171 | + $column_id = gravityview_get_input_id_from_id( $field[ 'id' ] ); |
|
| 172 | 172 | |
| 173 | 173 | // Parent field, not column field |
| 174 | - if( false === $column_id ) { |
|
| 174 | + if ( false === $column_id ) { |
|
| 175 | 175 | return $label; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
| 193 | 193 | |
| 194 | 194 | // Doesn't have columns enabled |
| 195 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
| 195 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
| 196 | 196 | return $backup_label; |
| 197 | 197 | } |
| 198 | 198 | |