@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | ?> |
| 9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 10 | 10 | |
| 11 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
| 11 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
| 12 | 12 | |
| 13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
| 14 | 14 | |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | function render_input( $override_input = null ) { |
| 23 | - if( isset( $override_input ) ) { |
|
| 23 | + if ( isset( $override_input ) ) { |
|
| 24 | 24 | echo $override_input; |
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | ?> |
| 28 | 28 | <select name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>"> |
| 29 | - <?php foreach( $this->field['options'] as $value => $label ) : ?> |
|
| 29 | + <?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
| 30 | 30 | <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $this->value, true ); ?>><?php echo esc_html( $label ); ?></option> |
| 31 | 31 | <?php endforeach; ?> |
| 32 | 32 | </select> |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $field_options = array(); |
| 29 | 29 | |
| 30 | - if( 'field' === $field_type ) { |
|
| 30 | + if ( 'field' === $field_type ) { |
|
| 31 | 31 | |
| 32 | 32 | // Default options - fields |
| 33 | 33 | $field_options = array( |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | 'custom_class' => array( |
| 46 | 46 | 'type' => 'text', |
| 47 | 47 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
| 48 | - 'desc' => __( 'This class will be added to the field container', 'gravityview'), |
|
| 48 | + 'desc' => __( 'This class will be added to the field container', 'gravityview' ), |
|
| 49 | 49 | 'value' => '', |
| 50 | 50 | 'merge_tags' => true, |
| 51 | 51 | 'tooltip' => 'gv_css_merge_tags', |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | // Match Table as well as DataTables |
| 68 | - if( preg_match( '/table/ism', $template_id ) && 'directory' === $context ) { |
|
| 69 | - $field_options['width'] = array( |
|
| 68 | + if ( preg_match( '/table/ism', $template_id ) && 'directory' === $context ) { |
|
| 69 | + $field_options[ 'width' ] = array( |
|
| 70 | 70 | 'type' => 'number', |
| 71 | - 'label' => __('Percent Width', 'gravityview'), |
|
| 72 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
| 71 | + 'label' => __( 'Percent Width', 'gravityview' ), |
|
| 72 | + 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview' ), |
|
| 73 | 73 | 'class' => 'code widefat', |
| 74 | 74 | 'value' => '', |
| 75 | 75 | ); |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | 'manage_options' => __( 'Administrator', 'gravityview' ), |
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | - if( is_multisite() ) { |
|
| 126 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
| 125 | + if ( is_multisite() ) { |
|
| 126 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' ); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
| 137 | 137 | * @param string $input_type Optional. (textarea, list, select, etc.) |
| 138 | 138 | */ |
| 139 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 139 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 140 | 140 | |
| 141 | 141 | return $select_cap_choices; |
| 142 | 142 | } |
@@ -163,24 +163,24 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public static function render_field_options( $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
| 165 | 165 | |
| 166 | - if( empty( $uniqid ) ) { |
|
| 166 | + if ( empty( $uniqid ) ) { |
|
| 167 | 167 | //generate a unique field id |
| 168 | - $uniqid = uniqid('', false); |
|
| 168 | + $uniqid = uniqid( '', false ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // get field/widget options |
| 172 | 172 | $options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type ); |
| 173 | 173 | |
| 174 | 174 | // two different post arrays, depending of the field type |
| 175 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
| 175 | + $name_prefix = $field_type . 's' . '[' . $area . '][' . $uniqid . ']'; |
|
| 176 | 176 | |
| 177 | 177 | // build output |
| 178 | 178 | $output = ''; |
| 179 | - $output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
| 180 | - $output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
| 179 | + $output .= '<input type="hidden" class="field-key" name="' . $name_prefix . '[id]" value="' . esc_attr( $field_id ) . '">'; |
|
| 180 | + $output .= '<input type="hidden" class="field-label" name="' . $name_prefix . '[label]" value="' . esc_attr( $field_label ) . '">'; |
|
| 181 | 181 | |
| 182 | 182 | // If there are no options, return what we got. |
| 183 | - if(empty($options)) { |
|
| 183 | + if ( empty( $options ) ) { |
|
| 184 | 184 | |
| 185 | 185 | // This is here for checking if the output is empty in render_label() |
| 186 | 186 | $output .= '<!-- No Options -->'; |
@@ -188,33 +188,33 @@ discard block |
||
| 188 | 188 | return $output; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">'; |
|
| 191 | + $output .= '<div class="gv-dialog-options" title="' . esc_attr( sprintf( __( 'Options: %s', 'gravityview' ), strip_tags( html_entity_decode( $field_label ) ) ) ) . '">'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @since 1.8 |
| 195 | 195 | */ |
| 196 | - if( !empty( $item['subtitle'] ) ) { |
|
| 197 | - $output .= '<div class="subtitle">' . $item['subtitle'] . '</div>'; |
|
| 196 | + if ( ! empty( $item[ 'subtitle' ] ) ) { |
|
| 197 | + $output .= '<div class="subtitle">' . $item[ 'subtitle' ] . '</div>'; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - foreach( $options as $key => $option ) { |
|
| 200 | + foreach ( $options as $key => $option ) { |
|
| 201 | 201 | |
| 202 | 202 | $value = isset( $current[ $key ] ) ? $current[ $key ] : NULL; |
| 203 | 203 | |
| 204 | - $field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value); |
|
| 204 | + $field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value ); |
|
| 205 | 205 | |
| 206 | 206 | // The setting is empty |
| 207 | - if( empty( $field_output ) ) { |
|
| 207 | + if ( empty( $field_output ) ) { |
|
| 208 | 208 | continue; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - switch( $option['type'] ) { |
|
| 211 | + switch ( $option[ 'type' ] ) { |
|
| 212 | 212 | // Hide hidden fields |
| 213 | 213 | case 'hidden': |
| 214 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>'; |
|
| 214 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
|
| 215 | 215 | break; |
| 216 | 216 | default: |
| 217 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>'; |
|
| 217 | + $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . '">' . $field_output . '</div>'; |
|
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
@@ -243,17 +243,17 @@ discard block |
||
| 243 | 243 | * @deprecated setting index 'default' was replaced by 'value' |
| 244 | 244 | * @see GravityView_FieldType::get_field_defaults |
| 245 | 245 | */ |
| 246 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
| 247 | - $option['value'] = $option['default']; |
|
| 248 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
| 246 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
| 247 | + $option[ 'value' ] = $option[ 'default' ]; |
|
| 248 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // prepare to render option field type |
| 252 | - if( isset( $option['type'] ) ) { |
|
| 252 | + if ( isset( $option[ 'type' ] ) ) { |
|
| 253 | 253 | |
| 254 | 254 | $type_class = self::load_type_class( $option ); |
| 255 | 255 | |
| 256 | - if( class_exists( $type_class ) ) { |
|
| 256 | + if ( class_exists( $type_class ) ) { |
|
| 257 | 257 | |
| 258 | 258 | $render_type = new $type_class( $name, $option, $curr_value ); |
| 259 | 259 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @param[in,out] string $output field class name |
| 270 | 270 | * @param[in] array $option option field data |
| 271 | 271 | */ |
| 272 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
| 272 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | } // isset option[type] |
@@ -296,33 +296,33 @@ discard block |
||
| 296 | 296 | $setting = GravityView_View_Data::get_default_arg( $key, true ); |
| 297 | 297 | |
| 298 | 298 | // If the key doesn't exist, there's something wrong. |
| 299 | - if( empty( $setting ) ) { return; } |
|
| 299 | + if ( empty( $setting ) ) { return; } |
|
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * @deprecated setting index 'name' was replaced by 'label' |
| 303 | 303 | * @see GravityView_FieldType::get_field_defaults |
| 304 | 304 | */ |
| 305 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
| 306 | - $setting['label'] = $setting['name']; |
|
| 307 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
| 305 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
| 306 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
| 307 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | $name = esc_attr( sprintf( $name, $key ) ); |
| 311 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
| 312 | - $setting['tooltip'] = 'gv_' . $key; |
|
| 311 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
| 312 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
| 313 | 313 | |
| 314 | 314 | // Use default if current setting isn't set. |
| 315 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
| 315 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
| 316 | 316 | |
| 317 | 317 | // default setting type = text |
| 318 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
| 318 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
| 319 | 319 | |
| 320 | 320 | // merge tags |
| 321 | - if( !isset( $setting['merge_tags'] ) ) { |
|
| 322 | - if( $setting['type'] === 'text' ) { |
|
| 323 | - $setting['merge_tags'] = true; |
|
| 321 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
| 322 | + if ( $setting[ 'type' ] === 'text' ) { |
|
| 323 | + $setting[ 'merge_tags' ] = true; |
|
| 324 | 324 | } else { |
| 325 | - $setting['merge_tags'] = false; |
|
| 325 | + $setting[ 'merge_tags' ] = false; |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | // render the setting |
| 332 | 332 | $type_class = self::load_type_class( $setting ); |
| 333 | - if( class_exists( $type_class ) ) { |
|
| 333 | + if ( class_exists( $type_class ) ) { |
|
| 334 | 334 | /** @var GravityView_FieldType $render_type */ |
| 335 | 335 | $render_type = new $type_class( $name, $setting, $curr_value ); |
| 336 | 336 | ob_start(); |
@@ -339,17 +339,17 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | // Check if setting is specific for a template |
| 342 | - if( !empty( $setting['show_in_template'] ) ) { |
|
| 343 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
| 344 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
| 342 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
| 343 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
| 344 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
| 345 | 345 | } |
| 346 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
| 346 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
| 347 | 347 | } else { |
| 348 | 348 | $show_if = ''; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | // output |
| 352 | - echo '<tr valign="top" '. $show_if .'>' . $output . '</tr>'; |
|
| 352 | + echo '<tr valign="top" ' . $show_if . '>' . $output . '</tr>'; |
|
| 353 | 353 | |
| 354 | 354 | } |
| 355 | 355 | |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | public static function load_type_class( $field = NULL ) { |
| 363 | 363 | |
| 364 | - if( empty( $field['type'] ) ) { |
|
| 364 | + if ( empty( $field[ 'type' ] ) ) { |
|
| 365 | 365 | return NULL; |
| 366 | 366 | } |
| 367 | 367 | |
@@ -370,19 +370,19 @@ discard block |
||
| 370 | 370 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
| 371 | 371 | * @param array $field field data |
| 372 | 372 | */ |
| 373 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
| 373 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
| 374 | 374 | |
| 375 | - if( !class_exists( $type_class ) ) { |
|
| 375 | + if ( ! class_exists( $type_class ) ) { |
|
| 376 | 376 | |
| 377 | 377 | /** |
| 378 | 378 | * @filter `gravityview/setting/class_file/{field_type}` |
| 379 | 379 | * @param string $field_type_include_path field class file path |
| 380 | 380 | * @param array $field field data |
| 381 | 381 | */ |
| 382 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
| 382 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
| 383 | 383 | |
| 384 | - if( $class_file ) { |
|
| 385 | - if( file_exists( $class_file ) ) { |
|
| 384 | + if ( $class_file ) { |
|
| 385 | + if ( file_exists( $class_file ) ) { |
|
| 386 | 386 | require_once( $class_file ); |
| 387 | 387 | } |
| 388 | 388 | } |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | public static function render_checkbox_option( $name = '', $id = '', $current = '' ) { |
| 407 | 407 | |
| 408 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
| 409 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
| 408 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
| 409 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
| 410 | 410 | |
| 411 | 411 | return $output; |
| 412 | 412 | } |
@@ -424,22 +424,22 @@ discard block |
||
| 424 | 424 | public static function render_text_option( $name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array() ) { |
| 425 | 425 | |
| 426 | 426 | // Show the merge tags if the field is a list view |
| 427 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 427 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 428 | 428 | |
| 429 | 429 | // Or is a single entry view |
| 430 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 430 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 431 | 431 | $show = ( $is_single || $is_list ); |
| 432 | 432 | |
| 433 | 433 | $class = ''; |
| 434 | 434 | // and $add_merge_tags is not false |
| 435 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 435 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 436 | 436 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
| 440 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
| 439 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
| 440 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
| 441 | 441 | |
| 442 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
| 442 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /** |
@@ -454,21 +454,21 @@ discard block |
||
| 454 | 454 | public static function render_textarea_option( $name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array() ) { |
| 455 | 455 | |
| 456 | 456 | // Show the merge tags if the field is a list view |
| 457 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 457 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 458 | 458 | |
| 459 | 459 | // Or is a single entry view |
| 460 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 460 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 461 | 461 | $show = ( $is_single || $is_list ); |
| 462 | 462 | |
| 463 | 463 | $class = ''; |
| 464 | 464 | // and $add_merge_tags is not false |
| 465 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 465 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 466 | 466 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
| 469 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
| 470 | 470 | |
| 471 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
| 471 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | /** |
@@ -482,9 +482,9 @@ discard block |
||
| 482 | 482 | */ |
| 483 | 483 | public static function render_select_option( $name = '', $id = '', $choices, $current = '' ) { |
| 484 | 484 | |
| 485 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
| 486 | - foreach( $choices as $value => $label ) { |
|
| 487 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
| 485 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
| 486 | + foreach ( $choices as $value => $label ) { |
|
| 487 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
| 488 | 488 | } |
| 489 | 489 | $output .= '</select>'; |
| 490 | 490 | |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | ) ); |
| 116 | 116 | |
| 117 | 117 | // This is just HTML we don't need. |
| 118 | - unset( $response['message'] ); |
|
| 118 | + unset( $response[ 'message' ] ); |
|
| 119 | 119 | |
| 120 | - switch ( intval( $response['license_limit'] ) ) { |
|
| 120 | + switch ( intval( $response[ 'license_limit' ] ) ) { |
|
| 121 | 121 | case 1: |
| 122 | 122 | $package = 'Sol'; |
| 123 | 123 | break; |
@@ -128,24 +128,24 @@ discard block |
||
| 128 | 128 | $package = 'Interstellar'; |
| 129 | 129 | break; |
| 130 | 130 | default: |
| 131 | - $package = sprintf( '%d-Site License', $response['license_limit'] ); |
|
| 131 | + $package = sprintf( '%d-Site License', $response[ 'license_limit' ] ); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $data = array( |
| 135 | 135 | 'email' => GravityView_Settings::getSetting( 'support-email' ), |
| 136 | - 'name' => $response['customer_name'], |
|
| 137 | - 'Valid License?' => ucwords( $response['license'] ), |
|
| 138 | - 'License Key' => $response['license_key'], |
|
| 136 | + 'name' => $response[ 'customer_name' ], |
|
| 137 | + 'Valid License?' => ucwords( $response[ 'license' ] ), |
|
| 138 | + 'License Key' => $response[ 'license_key' ], |
|
| 139 | 139 | 'License Level' => $package, |
| 140 | 140 | 'Site Admin Email' => get_bloginfo( 'admin_email' ), |
| 141 | 141 | 'Support Email' => GravityView_Settings::getSetting( 'support-email' ), |
| 142 | - 'License Limit' => $response['license_limit'], |
|
| 143 | - 'Site Count' => $response['site_count'], |
|
| 144 | - 'License Expires' => $response['expires'], |
|
| 145 | - 'Activations Left' => $response['activations_left'], |
|
| 146 | - 'Payment ID' => $response['payment_id'], |
|
| 147 | - 'Payment Name' => $response['customer_name'], |
|
| 148 | - 'Payment Email' => $response['customer_email'], |
|
| 142 | + 'License Limit' => $response[ 'license_limit' ], |
|
| 143 | + 'Site Count' => $response[ 'site_count' ], |
|
| 144 | + 'License Expires' => $response[ 'expires' ], |
|
| 145 | + 'Activations Left' => $response[ 'activations_left' ], |
|
| 146 | + 'Payment ID' => $response[ 'payment_id' ], |
|
| 147 | + 'Payment Name' => $response[ 'customer_name' ], |
|
| 148 | + 'Payment Email' => $response[ 'customer_email' ], |
|
| 149 | 149 | 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
| 150 | 150 | 'PHP Version' => phpversion(), |
| 151 | 151 | 'GravityView Version' => GravityView_Plugin::version, |
@@ -192,10 +192,10 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | $plugin_data = get_plugin_data( $active_plugin ); |
| 194 | 194 | |
| 195 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
| 195 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if( ! empty( $extensions ) ) { |
|
| 198 | + if ( ! empty( $extensions ) ) { |
|
| 199 | 199 | set_site_transient( self::related_plugins_key, $extensions, HOUR_IN_SECONDS ); |
| 200 | 200 | } else { |
| 201 | 201 | return 'There was an error fetching related plugins.'; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_edit_link' ), 10, 5 ); |
| 12 | 12 | |
| 13 | 13 | // Add script to enable edit link |
| 14 | - add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script') ); |
|
| 14 | + add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script' ) ); |
|
| 15 | 15 | |
| 16 | 16 | } |
| 17 | 17 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function add_edit_script() { |
| 27 | 27 | |
| 28 | 28 | // We're on a single entry page, or at least not the Entries page. |
| 29 | - if( !empty( $_GET['view'] ) && $_GET['view'] !== 'entries' ) { return; } |
|
| 29 | + if ( ! empty( $_GET[ 'view' ] ) && $_GET[ 'view' ] !== 'entries' ) { return; } |
|
| 30 | 30 | ?> |
| 31 | 31 | <script> |
| 32 | 32 | jQuery( document ).ready( function( $ ) { |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | 'page' => 'gf_entries', |
| 57 | 57 | 'view' => 'entry', |
| 58 | 58 | 'id' => (int)$form_id, |
| 59 | - 'lid' => (int)$lead["id"], |
|
| 59 | + 'lid' => (int)$lead[ "id" ], |
|
| 60 | 60 | 'screen_mode' => 'edit', |
| 61 | 61 | ); |
| 62 | 62 | ?> |
| 63 | 63 | |
| 64 | 64 | <span class="edit edit_entry"> |
| 65 | 65 | | |
| 66 | - <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page='.$query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
| 66 | + <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview' ); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page=' . $query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
| 67 | 67 | </span> |
| 68 | 68 | <?php |
| 69 | 69 | } |
@@ -6,17 +6,17 @@ |
||
| 6 | 6 | ?><script type="text/javascript"> |
| 7 | 7 | |
| 8 | 8 | function DeleteFile(leadId, fieldId, deleteButton){ |
| 9 | - if(confirm('<?php echo esc_js( __("Would you like to permanently delete this file? 'Cancel' to stop. 'OK' to delete", 'gravityview') ); ?>')){ |
|
| 9 | + if(confirm('<?php echo esc_js( __( "Would you like to permanently delete this file? 'Cancel' to stop. 'OK' to delete", 'gravityview' ) ); ?>')){ |
|
| 10 | 10 | var fileIndex = jQuery(deleteButton).parent().index(); |
| 11 | - var mysack = new sack("<?php echo admin_url("admin-ajax.php")?>"); |
|
| 11 | + var mysack = new sack("<?php echo admin_url( "admin-ajax.php" )?>"); |
|
| 12 | 12 | mysack.execute = 1; |
| 13 | 13 | mysack.method = 'POST'; |
| 14 | 14 | mysack.setVar( "action", "rg_delete_file" ); |
| 15 | - mysack.setVar( "rg_delete_file", "<?php echo wp_create_nonce("rg_delete_file") ?>" ); |
|
| 15 | + mysack.setVar( "rg_delete_file", "<?php echo wp_create_nonce( "rg_delete_file" ) ?>" ); |
|
| 16 | 16 | mysack.setVar( "lead_id", leadId ); |
| 17 | 17 | mysack.setVar( "field_id", fieldId ); |
| 18 | 18 | mysack.setVar( "file_index", fileIndex ); |
| 19 | - mysack.onError = function() { alert('<?php echo esc_js(__('Ajax error while deleting field.', 'gravityview')) ?>' )}; |
|
| 19 | + mysack.onError = function() { alert('<?php echo esc_js( __( 'Ajax error while deleting field.', 'gravityview' ) ) ?>' )}; |
|
| 20 | 20 | mysack.runAJAX(); |
| 21 | 21 | |
| 22 | 22 | return true; |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | extract( $gravityview_view->getCurrentField() ); |
| 8 | 8 | |
| 9 | 9 | // Only show the link to logged-in users. |
| 10 | -if( !GravityView_Edit_Entry::check_user_cap_edit_entry( $entry ) ) { |
|
| 10 | +if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $entry ) ) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -$link_text = empty( $field_settings['edit_link'] ) ? __('Edit Entry', 'gravityview') : $field_settings['edit_link']; |
|
| 14 | +$link_text = empty( $field_settings[ 'edit_link' ] ) ? __( 'Edit Entry', 'gravityview' ) : $field_settings[ 'edit_link' ]; |
|
| 15 | 15 | |
| 16 | -$link_atts = empty( $field_settings['new_window'] ) ? '' : 'target="_blank"'; |
|
| 16 | +$link_atts = empty( $field_settings[ 'new_window' ] ) ? '' : 'target="_blank"'; |
|
| 17 | 17 | |
| 18 | 18 | $output = apply_filters( 'gravityview_entry_link', GravityView_API::replace_variables( $link_text, $form, $entry ) ); |
| 19 | 19 | |
@@ -7,11 +7,11 @@ |
||
| 7 | 7 | extract( $gravityview_view->getCurrentField() ); |
| 8 | 8 | |
| 9 | 9 | // Only show the link to logged-in users with the rigth caps. |
| 10 | -if( !GravityView_Delete_Entry::check_user_cap_delete_entry( $entry, $field_settings ) ) { |
|
| 10 | +if ( ! GravityView_Delete_Entry::check_user_cap_delete_entry( $entry, $field_settings ) ) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -$link_text = empty( $field_settings['delete_link'] ) ? __('Delete Entry', 'gravityview') : $field_settings['delete_link']; |
|
| 14 | +$link_text = empty( $field_settings[ 'delete_link' ] ) ? __( 'Delete Entry', 'gravityview' ) : $field_settings[ 'delete_link' ]; |
|
| 15 | 15 | |
| 16 | 16 | $link_text = apply_filters( 'gravityview_entry_link', GravityView_API::replace_variables( $link_text, $form, $entry ) ); |
| 17 | 17 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @return void |
| 272 | 272 | */ |
| 273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 274 | 274 | |
| 275 | 275 | $output = ''; |
| 276 | 276 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | function save_postdata( $post_id ) { |
| 431 | 431 | |
| 432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 432 | + if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 433 | 433 | return; |
| 434 | 434 | } |
| 435 | 435 | |
@@ -673,11 +673,11 @@ discard block |
||
| 673 | 673 | /** |
| 674 | 674 | * @since 1.7.2 |
| 675 | 675 | */ |
| 676 | - 'other_entries' => array( |
|
| 677 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 678 | - 'type' => 'other_entries', |
|
| 679 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 680 | - ), |
|
| 676 | + 'other_entries' => array( |
|
| 677 | + 'label' => __('Other Entries', 'gravityview'), |
|
| 678 | + 'type' => 'other_entries', |
|
| 679 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 680 | + ), |
|
| 681 | 681 | |
| 682 | 682 | /** |
| 683 | 683 | * @since 1.14 |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | 'type' => 'notes', |
| 688 | 688 | 'desc' => __('Entry notes (if any).', 'gravityview'), |
| 689 | 689 | ), |
| 690 | - ); |
|
| 690 | + ); |
|
| 691 | 691 | |
| 692 | 692 | if( 'single' !== $zone) { |
| 693 | 693 | |
@@ -1022,15 +1022,15 @@ discard block |
||
| 1022 | 1022 | GFForms::register_scripts(); |
| 1023 | 1023 | |
| 1024 | 1024 | $scripts = array( |
| 1025 | - 'sack', |
|
| 1026 | - 'gform_gravityforms', |
|
| 1027 | - 'gform_forms', |
|
| 1028 | - 'gform_form_admin', |
|
| 1029 | - 'jquery-ui-autocomplete' |
|
| 1025 | + 'sack', |
|
| 1026 | + 'gform_gravityforms', |
|
| 1027 | + 'gform_forms', |
|
| 1028 | + 'gform_form_admin', |
|
| 1029 | + 'jquery-ui-autocomplete' |
|
| 1030 | 1030 | ); |
| 1031 | 1031 | |
| 1032 | 1032 | if ( wp_is_mobile() ) { |
| 1033 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1033 | + $scripts[] = 'jquery-touch-punch'; |
|
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | foreach ($scripts as $script) { |
@@ -28,30 +28,30 @@ discard block |
||
| 28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 29 | 29 | |
| 30 | 30 | // Tooltips |
| 31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 32 | 32 | |
| 33 | 33 | // adding styles and scripts |
| 34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 39 | - |
|
| 40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 39 | + |
|
| 40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 45 | 45 | |
| 46 | 46 | // @todo check if this hook is needed.. |
| 47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
| 48 | 48 | |
| 49 | 49 | // Add Connected Form column |
| 50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 51 | 51 | |
| 52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 53 | 53 | |
| 54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 55 | 55 | |
| 56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 67 | 67 | global $pagenow; |
| 68 | 68 | |
| 69 | - if ( !is_admin() ) { |
|
| 69 | + if ( ! is_admin() ) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | function add_view_dropdown() { |
| 88 | 88 | $current_screen = get_current_screen(); |
| 89 | 89 | |
| 90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $forms = gravityview_get_forms(); |
| 95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
| 96 | 96 | // If there are no forms to select, show no forms. |
| 97 | - if( !empty( $forms ) ) { ?> |
|
| 97 | + if ( ! empty( $forms ) ) { ?> |
|
| 98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 100 | - <?php foreach( $forms as $form ) { ?> |
|
| 101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 100 | + <?php foreach ( $forms as $form ) { ?> |
|
| 101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 102 | 102 | <?php } ?> |
| 103 | 103 | </select> |
| 104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -134,37 +134,37 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
| 136 | 136 | |
| 137 | - if( empty( $connected_views ) ) { |
|
| 137 | + if ( empty( $connected_views ) ) { |
|
| 138 | 138 | return $menu_items; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $sub_menu_items = array(); |
| 142 | 142 | foreach ( (array)$connected_views as $view ) { |
| 143 | 143 | |
| 144 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 144 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 148 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 149 | 149 | |
| 150 | - $sub_menu_items[] = array( |
|
| 150 | + $sub_menu_items[ ] = array( |
|
| 151 | 151 | 'label' => esc_attr( $label ), |
| 152 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 152 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 153 | 153 | ); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // If there were no items added, then let's create the parent menu |
| 157 | - if( $sub_menu_items ) { |
|
| 157 | + if ( $sub_menu_items ) { |
|
| 158 | 158 | |
| 159 | 159 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 160 | - $sub_menu_items[] = array( |
|
| 160 | + $sub_menu_items[ ] = array( |
|
| 161 | 161 | 'url' => '#', |
| 162 | 162 | 'label' => '', |
| 163 | 163 | 'menu_class' => 'hidden', |
| 164 | 164 | 'capabilities' => '', |
| 165 | 165 | ); |
| 166 | 166 | |
| 167 | - $menu_items['gravityview'] = array( |
|
| 167 | + $menu_items[ 'gravityview' ] = array( |
|
| 168 | 168 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 169 | 169 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 170 | 170 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | $add = array( 'captcha', 'page' ); |
| 195 | 195 | |
| 196 | 196 | // Don't allowing editing the following values: |
| 197 | - if( $context === 'edit' ) { |
|
| 198 | - $add[] = 'post_id'; |
|
| 197 | + if ( $context === 'edit' ) { |
|
| 198 | + $add[ ] = 'post_id'; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $return = array_merge( $array, $add ); |
@@ -218,32 +218,32 @@ discard block |
||
| 218 | 218 | foreach ( $default_args as $key => $arg ) { |
| 219 | 219 | |
| 220 | 220 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 221 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 221 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 222 | 222 | |
| 223 | 223 | // By default, use `tooltip` if defined. |
| 224 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 224 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 225 | 225 | |
| 226 | 226 | // Otherwise, use the description as a tooltip. |
| 227 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
| 228 | - $tooltip = $arg['desc']; |
|
| 227 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
| 228 | + $tooltip = $arg[ 'desc' ]; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // If there's no tooltip set, continue |
| 232 | - if( empty( $tooltip ) ) { |
|
| 232 | + if ( empty( $tooltip ) ) { |
|
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Add the tooltip |
| 237 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 238 | - 'title' => $arg['label'], |
|
| 237 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 238 | + 'title' => $arg[ 'label' ], |
|
| 239 | 239 | 'value' => $tooltip, |
| 240 | 240 | ); |
| 241 | 241 | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 245 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 246 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 244 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 245 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 246 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 256 | 256 | |
| 257 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 257 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 258 | 258 | |
| 259 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 259 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | return $tooltips; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @return void |
| 272 | 272 | */ |
| 273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 274 | 274 | |
| 275 | 275 | $output = ''; |
| 276 | 276 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 293 | 293 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 294 | 294 | |
| 295 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 295 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 296 | 296 | |
| 297 | 297 | break; |
| 298 | 298 | |
@@ -333,44 +333,44 @@ discard block |
||
| 333 | 333 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 334 | 334 | |
| 335 | 335 | // Either the form is empty or the form ID is 0, not yet set. |
| 336 | - if( empty( $form ) ) { |
|
| 336 | + if ( empty( $form ) ) { |
|
| 337 | 337 | return ''; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | // The $form is passed as the form ID |
| 341 | - if( !is_array( $form ) ) { |
|
| 341 | + if ( ! is_array( $form ) ) { |
|
| 342 | 342 | $form = gravityview_get_form( $form ); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - $form_id = $form['id']; |
|
| 345 | + $form_id = $form[ 'id' ]; |
|
| 346 | 346 | $links = array(); |
| 347 | 347 | |
| 348 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 348 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 349 | 349 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 350 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 351 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 350 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 351 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 352 | 352 | } else { |
| 353 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 353 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 356 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 357 | 357 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 358 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 358 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 361 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 362 | 362 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 363 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 363 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 366 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 367 | 367 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 368 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 368 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | $output = ''; |
| 372 | 372 | |
| 373 | - if( !empty( $include_form_link ) ) { |
|
| 373 | + if ( ! empty( $include_form_link ) ) { |
|
| 374 | 374 | $output .= $form_link; |
| 375 | 375 | } |
| 376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 384 | 384 | |
| 385 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 385 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 386 | 386 | |
| 387 | 387 | return $output; |
| 388 | 388 | } |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | // Get the date column and save it for later to add back in. |
| 397 | 397 | // This adds it after the Data Source column. |
| 398 | 398 | // This way, we don't need to do array_slice, array_merge, etc. |
| 399 | - $date = $columns['date']; |
|
| 400 | - unset( $columns['date'] ); |
|
| 399 | + $date = $columns[ 'date' ]; |
|
| 400 | + unset( $columns[ 'date' ] ); |
|
| 401 | 401 | |
| 402 | 402 | $data_source_required_caps = array( |
| 403 | 403 | 'gravityforms_edit_forms', |
@@ -408,14 +408,14 @@ discard block |
||
| 408 | 408 | 'gravityforms_preview_forms', |
| 409 | 409 | ); |
| 410 | 410 | |
| 411 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 412 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 411 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 412 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 415 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 416 | 416 | |
| 417 | 417 | // Add the date back in. |
| 418 | - $columns['date'] = $date; |
|
| 418 | + $columns[ 'date' ] = $date; |
|
| 419 | 419 | |
| 420 | 420 | return $columns; |
| 421 | 421 | } |
@@ -429,12 +429,12 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | function save_postdata( $post_id ) { |
| 431 | 431 | |
| 432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 432 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 433 | 433 | return; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | // validate post_type |
| 437 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 437 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 438 | 438 | return; |
| 439 | 439 | } |
| 440 | 440 | |
@@ -449,67 +449,67 @@ discard block |
||
| 449 | 449 | $statii = array(); |
| 450 | 450 | |
| 451 | 451 | // check if this is a start fresh View |
| 452 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 452 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 453 | 453 | |
| 454 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 454 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 455 | 455 | // save form id |
| 456 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 456 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 457 | 457 | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 460 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 461 | 461 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
| 462 | 462 | return; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // Was this a start fresh? |
| 466 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 467 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 466 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 467 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 468 | 468 | } else { |
| 469 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 469 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // Check if we have a template id |
| 473 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 473 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 474 | 474 | |
| 475 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 475 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 476 | 476 | |
| 477 | 477 | // now save template id |
| 478 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 478 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
| 482 | 482 | // save View Configuration metabox |
| 483 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 483 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 484 | 484 | |
| 485 | 485 | // template settings |
| 486 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 487 | - $_POST['template_settings'] = array(); |
|
| 486 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 487 | + $_POST[ 'template_settings' ] = array(); |
|
| 488 | 488 | } |
| 489 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 489 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 490 | 490 | |
| 491 | 491 | $fields = array(); |
| 492 | 492 | |
| 493 | 493 | // Directory&single Visible Fields |
| 494 | - if( !empty( $preset_fields ) ) { |
|
| 494 | + if ( ! empty( $preset_fields ) ) { |
|
| 495 | 495 | |
| 496 | 496 | $fields = $preset_fields; |
| 497 | 497 | |
| 498 | - } elseif( !empty( $_POST['fields'] ) ) { |
|
| 498 | + } elseif ( ! empty( $_POST[ 'fields' ] ) ) { |
|
| 499 | 499 | $fields = _gravityview_process_posted_fields(); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 502 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 503 | 503 | |
| 504 | 504 | // Directory Visible Widgets |
| 505 | - if( empty( $_POST['widgets'] ) ) { |
|
| 506 | - $_POST['widgets'] = array(); |
|
| 505 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 506 | + $_POST[ 'widgets' ] = array(); |
|
| 507 | 507 | } |
| 508 | - $statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] ); |
|
| 508 | + $statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] ); |
|
| 509 | 509 | |
| 510 | 510 | } // end save view configuration |
| 511 | 511 | |
| 512 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
| 512 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | /** |
@@ -541,20 +541,20 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | $output = ''; |
| 543 | 543 | |
| 544 | - if( !empty( $fields ) ) { |
|
| 544 | + if ( ! empty( $fields ) ) { |
|
| 545 | 545 | |
| 546 | - foreach( $fields as $id => $details ) { |
|
| 546 | + foreach ( $fields as $id => $details ) { |
|
| 547 | 547 | |
| 548 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
| 548 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
| 549 | 549 | continue; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | // Edit mode only allows editing the parent fields, not single inputs. |
| 553 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
| 553 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 554 | 554 | continue; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
| 557 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
| 558 | 558 | |
| 559 | 559 | } // End foreach |
| 560 | 560 | } |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | echo $output; |
| 563 | 563 | |
| 564 | 564 | // For the EDIT view we only want to allow the form fields. |
| 565 | - if( $context === 'edit' ) { |
|
| 565 | + if ( $context === 'edit' ) { |
|
| 566 | 566 | return; |
| 567 | 567 | } |
| 568 | 568 | |
@@ -586,16 +586,16 @@ discard block |
||
| 586 | 586 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
| 587 | 587 | array( |
| 588 | 588 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
| 589 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
| 589 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
| 590 | 590 | 'field_id' => 'all-fields', |
| 591 | 591 | 'label_type' => 'field', |
| 592 | 592 | 'input_type' => NULL, |
| 593 | 593 | 'field_options' => NULL, |
| 594 | 594 | 'settings_html' => NULL, |
| 595 | 595 | ) |
| 596 | - )); |
|
| 596 | + ) ); |
|
| 597 | 597 | |
| 598 | - if( !empty( $additional_fields )) { |
|
| 598 | + if ( ! empty( $additional_fields ) ) { |
|
| 599 | 599 | foreach ( (array)$additional_fields as $item ) { |
| 600 | 600 | |
| 601 | 601 | // Prevent items from not having index set |
@@ -606,16 +606,16 @@ discard block |
||
| 606 | 606 | 'input_type' => NULL, |
| 607 | 607 | 'field_options' => NULL, |
| 608 | 608 | 'settings_html' => NULL, |
| 609 | - )); |
|
| 609 | + ) ); |
|
| 610 | 610 | |
| 611 | 611 | // Backward compat. |
| 612 | - if( !empty( $item['field_options'] ) ) { |
|
| 612 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 613 | 613 | // Use settings_html from now on. |
| 614 | - $item['settings_html'] = $item['field_options']; |
|
| 614 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | // Render a label for each of them |
| 618 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
| 618 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
| 619 | 619 | |
| 620 | 620 | } |
| 621 | 621 | } |
@@ -628,72 +628,72 @@ discard block |
||
| 628 | 628 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 629 | 629 | * @return array |
| 630 | 630 | */ |
| 631 | - function get_entry_default_fields($form, $zone) { |
|
| 631 | + function get_entry_default_fields( $form, $zone ) { |
|
| 632 | 632 | |
| 633 | 633 | $entry_default_fields = array(); |
| 634 | 634 | |
| 635 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 635 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 636 | 636 | |
| 637 | 637 | $entry_default_fields = array( |
| 638 | 638 | 'id' => array( |
| 639 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 639 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 640 | 640 | 'type' => 'id', |
| 641 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 641 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 642 | 642 | ), |
| 643 | 643 | 'date_created' => array( |
| 644 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 645 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 644 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 645 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 646 | 646 | 'type' => 'date_created', |
| 647 | 647 | ), |
| 648 | 648 | 'source_url' => array( |
| 649 | - 'label' => __('Source URL', 'gravityview'), |
|
| 649 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 650 | 650 | 'type' => 'source_url', |
| 651 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 651 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 652 | 652 | ), |
| 653 | 653 | 'ip' => array( |
| 654 | - 'label' => __('User IP', 'gravityview'), |
|
| 654 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 655 | 655 | 'type' => 'ip', |
| 656 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 656 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 657 | 657 | ), |
| 658 | 658 | 'created_by' => array( |
| 659 | - 'label' => __('User', 'gravityview'), |
|
| 659 | + 'label' => __( 'User', 'gravityview' ), |
|
| 660 | 660 | 'type' => 'created_by', |
| 661 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 661 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 662 | 662 | ), |
| 663 | 663 | |
| 664 | 664 | /** |
| 665 | 665 | * @since 1.2 |
| 666 | 666 | */ |
| 667 | 667 | 'custom' => array( |
| 668 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 668 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 669 | 669 | 'type' => 'custom', |
| 670 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 670 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 671 | 671 | ), |
| 672 | 672 | |
| 673 | 673 | /** |
| 674 | 674 | * @since 1.7.2 |
| 675 | 675 | */ |
| 676 | 676 | 'other_entries' => array( |
| 677 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 677 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 678 | 678 | 'type' => 'other_entries', |
| 679 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 679 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 680 | 680 | ), |
| 681 | 681 | |
| 682 | 682 | /** |
| 683 | 683 | * @since 1.14 |
| 684 | 684 | */ |
| 685 | 685 | 'notes' => array( |
| 686 | - 'label' => __('Entry Notes', 'gravityview'), |
|
| 686 | + 'label' => __( 'Entry Notes', 'gravityview' ), |
|
| 687 | 687 | 'type' => 'notes', |
| 688 | - 'desc' => __('Entry notes (if any).', 'gravityview'), |
|
| 688 | + 'desc' => __( 'Entry notes (if any).', 'gravityview' ), |
|
| 689 | 689 | ), |
| 690 | 690 | ); |
| 691 | 691 | |
| 692 | - if( 'single' !== $zone) { |
|
| 692 | + if ( 'single' !== $zone ) { |
|
| 693 | 693 | |
| 694 | - $entry_default_fields['entry_link'] = array( |
|
| 695 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 696 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 694 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 695 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 696 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 697 | 697 | 'type' => 'entry_link', |
| 698 | 698 | ); |
| 699 | 699 | } |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | * @param string|array $form form_ID or form object |
| 708 | 708 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 709 | 709 | */ |
| 710 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 710 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | /** |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | */ |
| 719 | 719 | function get_available_fields( $form = '', $zone = NULL ) { |
| 720 | 720 | |
| 721 | - if( empty( $form ) ) { |
|
| 721 | + if ( empty( $form ) ) { |
|
| 722 | 722 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
| 723 | 723 | return array(); |
| 724 | 724 | } |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | $fields = gravityview_get_form_fields( $form, true ); |
| 728 | 728 | |
| 729 | 729 | // get meta fields ( only if form was already created ) |
| 730 | - if( !is_array( $form ) ) { |
|
| 730 | + if ( ! is_array( $form ) ) { |
|
| 731 | 731 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 732 | 732 | } else { |
| 733 | 733 | $meta_fields = array(); |
@@ -751,11 +751,11 @@ discard block |
||
| 751 | 751 | |
| 752 | 752 | $widgets = $this->get_registered_widgets(); |
| 753 | 753 | |
| 754 | - if( !empty( $widgets ) ) { |
|
| 754 | + if ( ! empty( $widgets ) ) { |
|
| 755 | 755 | |
| 756 | - foreach( $widgets as $id => $details ) { |
|
| 756 | + foreach ( $widgets as $id => $details ) { |
|
| 757 | 757 | |
| 758 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 758 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 759 | 759 | |
| 760 | 760 | } |
| 761 | 761 | } |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 790 | 790 | global $post; |
| 791 | 791 | |
| 792 | - if( $type === 'widget' ) { |
|
| 792 | + if ( $type === 'widget' ) { |
|
| 793 | 793 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 794 | 794 | } else { |
| 795 | 795 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -798,15 +798,15 @@ discard block |
||
| 798 | 798 | $available_items = array(); |
| 799 | 799 | |
| 800 | 800 | // if saved values, get available fields to label everyone |
| 801 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 801 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 802 | 802 | |
| 803 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 804 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 803 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 804 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 805 | 805 | } else { |
| 806 | 806 | $form = gravityview_get_form_id( $post->ID ); |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - if( 'field' === $type ) { |
|
| 809 | + if ( 'field' === $type ) { |
|
| 810 | 810 | $available_items = $this->get_available_fields( $form, $zone ); |
| 811 | 811 | } else { |
| 812 | 812 | $available_items = $this->get_registered_widgets(); |
@@ -814,39 +814,39 @@ discard block |
||
| 814 | 814 | |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | - foreach( $rows as $row ) : |
|
| 818 | - foreach( $row as $col => $areas ) : |
|
| 819 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 817 | + foreach ( $rows as $row ) : |
|
| 818 | + foreach ( $row as $col => $areas ) : |
|
| 819 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 820 | 820 | |
| 821 | 821 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 822 | 822 | |
| 823 | - <?php foreach( $areas as $area ) : ?> |
|
| 823 | + <?php foreach ( $areas as $area ) : ?> |
|
| 824 | 824 | |
| 825 | 825 | <div class="gv-droppable-area"> |
| 826 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 826 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 827 | 827 | |
| 828 | 828 | <?php // render saved fields |
| 829 | 829 | |
| 830 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 830 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 831 | 831 | |
| 832 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 832 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 833 | 833 | |
| 834 | 834 | $input_type = NULL; |
| 835 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 835 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 836 | 836 | |
| 837 | - if( !$original_item ) { |
|
| 837 | + if ( ! $original_item ) { |
|
| 838 | 838 | |
| 839 | - do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field )); |
|
| 839 | + do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) ); |
|
| 840 | 840 | |
| 841 | 841 | $original_item = $field; |
| 842 | 842 | } else { |
| 843 | 843 | |
| 844 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 844 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 845 | 845 | |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | // Field options dialog box |
| 849 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 849 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 850 | 850 | |
| 851 | 851 | $item = array( |
| 852 | 852 | 'input_type' => $input_type, |
@@ -855,16 +855,16 @@ discard block |
||
| 855 | 855 | ); |
| 856 | 856 | |
| 857 | 857 | // Merge the values with the current item to pass things like widget descriptions and original field names |
| 858 | - if( $original_item ) { |
|
| 858 | + if ( $original_item ) { |
|
| 859 | 859 | $item = wp_parse_args( $item, $original_item ); |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - switch( $type ) { |
|
| 862 | + switch ( $type ) { |
|
| 863 | 863 | case 'widget': |
| 864 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 864 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 865 | 865 | break; |
| 866 | 866 | default: |
| 867 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
| 867 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | |
@@ -874,11 +874,11 @@ discard block |
||
| 874 | 874 | |
| 875 | 875 | } // End if zone is not empty ?> |
| 876 | 876 | |
| 877 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
| 877 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
| 878 | 878 | </div> |
| 879 | 879 | <div class="gv-droppable-area-action"> |
| 880 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
| 881 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
| 880 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
| 881 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
| 882 | 882 | </div> |
| 883 | 883 | </div> |
| 884 | 884 | |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
| 901 | 901 | |
| 902 | 902 | $widgets = array(); |
| 903 | - if( !empty( $post_id ) ) { |
|
| 903 | + if ( ! empty( $post_id ) ) { |
|
| 904 | 904 | $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
| 905 | 905 | |
| 906 | 906 | } |
@@ -931,19 +931,19 @@ discard block |
||
| 931 | 931 | */ |
| 932 | 932 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 933 | 933 | |
| 934 | - if( empty( $template_id ) ) { |
|
| 934 | + if ( empty( $template_id ) ) { |
|
| 935 | 935 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
| 936 | 936 | return; |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 940 | 940 | |
| 941 | - if( empty( $template_areas ) ) { |
|
| 941 | + if ( empty( $template_areas ) ) { |
|
| 942 | 942 | |
| 943 | 943 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
| 944 | 944 | $output = '<div>'; |
| 945 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
| 946 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
| 945 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
| 946 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
| 947 | 947 | $output .= '</div>'; |
| 948 | 948 | } else { |
| 949 | 949 | |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | - if( $echo ) { |
|
| 961 | + if ( $echo ) { |
|
| 962 | 962 | echo $output; |
| 963 | 963 | } |
| 964 | 964 | |
@@ -978,25 +978,25 @@ discard block |
||
| 978 | 978 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 979 | 979 | |
| 980 | 980 | // Add the GV font (with the Astronaut) |
| 981 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 981 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 982 | 982 | |
| 983 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 983 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 984 | 984 | |
| 985 | 985 | // Don't process any scripts below here if it's not a GravityView page. |
| 986 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
| 986 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
| 987 | 987 | |
| 988 | 988 | // Only enqueue the following on single pages |
| 989 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
| 989 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
| 990 | 990 | |
| 991 | 991 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 992 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 992 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
| 993 | 993 | |
| 994 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 994 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 995 | 995 | |
| 996 | 996 | //enqueue scripts |
| 997 | 997 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
| 998 | 998 | |
| 999 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 999 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1000 | 1000 | 'cookiepath' => COOKIEPATH, |
| 1001 | 1001 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1002 | 1002 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
@@ -1009,9 +1009,9 @@ discard block |
||
| 1009 | 1009 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1010 | 1010 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1011 | 1011 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
| 1012 | - )); |
|
| 1012 | + ) ); |
|
| 1013 | 1013 | |
| 1014 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1014 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1015 | 1015 | |
| 1016 | 1016 | self::enqueue_gravity_forms_scripts(); |
| 1017 | 1017 | |
@@ -1030,10 +1030,10 @@ discard block |
||
| 1030 | 1030 | ); |
| 1031 | 1031 | |
| 1032 | 1032 | if ( wp_is_mobile() ) { |
| 1033 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1033 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | - foreach ($scripts as $script) { |
|
| 1036 | + foreach ( $scripts as $script ) { |
|
| 1037 | 1037 | wp_enqueue_script( $script ); |
| 1038 | 1038 | } |
| 1039 | 1039 | } |
@@ -1042,11 +1042,11 @@ discard block |
||
| 1042 | 1042 | |
| 1043 | 1043 | $filter = current_filter(); |
| 1044 | 1044 | |
| 1045 | - if( preg_match('/script/ism', $filter ) ) { |
|
| 1045 | + if ( preg_match( '/script/ism', $filter ) ) { |
|
| 1046 | 1046 | $allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
| 1047 | 1047 | 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
| 1048 | 1048 | $registered = array_merge( $registered, $allow_scripts ); |
| 1049 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
| 1049 | + } elseif ( preg_match( '/style/ism', $filter ) ) { |
|
| 1050 | 1050 | $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
| 1051 | 1051 | $registered = array_merge( $registered, $allow_styles ); |
| 1052 | 1052 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * @see RGFormsModel::update_lead_property() Trigger when any entry property changes |
| 81 | 81 | */ |
| 82 | - foreach( $this->lead_db_columns as $column ) { |
|
| 82 | + foreach ( $this->lead_db_columns as $column ) { |
|
| 83 | 83 | add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 ); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
| 115 | + do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry[ 'form_id' ] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
| 116 | 116 | |
| 117 | - $this->blacklist_add( $entry['form_id'] ); |
|
| 117 | + $this->blacklist_add( $entry[ 'form_id' ] ); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function entry_updated( $form, $lead_id ) { |
| 129 | 129 | |
| 130 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
| 130 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
| 131 | 131 | |
| 132 | - $this->blacklist_add( $form['id'] ); |
|
| 132 | + $this->blacklist_add( $form[ 'id' ] ); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function entry_created( $entry, $form ) { |
| 146 | 146 | |
| 147 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' ); |
|
| 147 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was created' ); |
|
| 148 | 148 | |
| 149 | - $this->blacklist_add( $form['id'] ); |
|
| 149 | + $this->blacklist_add( $form[ 'id' ] ); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | // Normally just one form, but supports multiple forms |
| 166 | 166 | // |
| 167 | 167 | // Array of IDs 12, 5, 14 would result in `f-12f-5f-14` |
| 168 | - $forms = 'f:' . implode( '&f:', (array) $form_ids ); |
|
| 168 | + $forms = 'f:' . implode( '&f:', (array)$form_ids ); |
|
| 169 | 169 | |
| 170 | 170 | // Prefix for transient keys |
| 171 | 171 | // Now the prefix would be: `gv-cache-f-12f-5f-14` |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | $blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() ); |
| 244 | 244 | |
| 245 | - $updated_list = array_diff( $blacklist, (array) $form_ids ); |
|
| 245 | + $updated_list = array_diff( $blacklist, (array)$form_ids ); |
|
| 246 | 246 | |
| 247 | 247 | do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array( |
| 248 | 248 | '$form_ids' => $form_ids, |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | return false; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - foreach ( (array) $form_ids as $form_id ) { |
|
| 278 | + foreach ( (array)$form_ids as $form_id ) { |
|
| 279 | 279 | |
| 280 | 280 | if ( in_array( $form_id, $blacklist ) ) { |
| 281 | 281 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache |
| 348 | 348 | * @param int $time_in_seconds Default: `DAY_IN_SECONDS` |
| 349 | 349 | */ |
| 350 | - $cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
| 350 | + $cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
| 351 | 351 | |
| 352 | 352 | do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' ); |
| 353 | 353 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | return; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - foreach ( (array) $form_ids as $form_id ) { |
|
| 386 | + foreach ( (array)$form_ids as $form_id ) { |
|
| 387 | 387 | |
| 388 | 388 | $key = $this->get_cache_key_prefix( $form_id ); |
| 389 | 389 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | |
| 498 | 498 | if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
| 499 | 499 | |
| 500 | - if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) { |
|
| 500 | + if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) { |
|
| 501 | 501 | |
| 502 | 502 | do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' ); |
| 503 | 503 | |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | */ |
| 527 | 527 | $use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
| 528 | 528 | |
| 529 | - return (boolean) $use_cache; |
|
| 529 | + return (boolean)$use_cache; |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | } |