@@ -11,10 +11,10 @@ |
||
| 11 | 11 | ?> |
| 12 | 12 | |
| 13 | 13 | <div class="gv-search-box"> |
| 14 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
| 15 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
| 15 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 16 | 16 | <?php } ?> |
| 17 | 17 | <p> |
| 18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"> |
|
| 19 | 19 | </p> |
| 20 | 20 | </div> |
| 21 | 21 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $base_url = GravityView_Widget_Search::get_search_form_action(); |
| 14 | 14 | |
| 15 | 15 | // Make sure that there are choices to display |
| 16 | -if ( empty( $search_field['choices'] ) ) { |
|
| 16 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
| 17 | 17 | do_action( 'gravityview_log_debug', 'search-field-link.php - No choices for field' ); |
| 18 | 18 | return; |
| 19 | 19 | } |
@@ -39,24 +39,24 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | <?php |
| 41 | 41 | |
| 42 | - $search_value = rgget( $search_field['name'] ); |
|
| 42 | + $search_value = rgget( $search_field[ 'name' ] ); |
|
| 43 | 43 | |
| 44 | - foreach ( $search_field['choices'] as $k => $choice ) { |
|
| 44 | + foreach ( $search_field[ 'choices' ] as $k => $choice ) { |
|
| 45 | 45 | |
| 46 | 46 | if ( 0 != $k ) { |
| 47 | 47 | echo esc_html( $links_sep ); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
| 50 | + $active = ( '' !== $search_value && in_array( $search_value, array( $choice[ 'text' ], $choice[ 'value' ] ) ) ) ? ' class="active"' : false; |
|
| 51 | 51 | |
| 52 | 52 | if ( $active ) { |
| 53 | - $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
| 53 | + $link = remove_query_arg( array( 'pagenum', $search_field[ 'name' ] ), $base_url ); |
|
| 54 | 54 | } else { |
| 55 | - $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
| 55 | + $link = add_query_arg( array( $search_field[ 'name' ] => urlencode( $choice[ 'value' ] ) ), remove_query_arg( array( 'pagenum' ), $base_url ) ); |
|
| 56 | 56 | } |
| 57 | 57 | ?> |
| 58 | 58 | |
| 59 | - <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a> |
|
| 59 | + <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice[ 'text' ] ); ?></a> |
|
| 60 | 60 | |
| 61 | 61 | <?php } ?> |
| 62 | 62 | </p> |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | var $name = 'radio'; |
| 11 | 11 | |
| 12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 13 | 13 | |
| 14 | 14 | var $_gf_field_class_name = 'GF_Field_Radio'; |
| 15 | 15 | |
@@ -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,19 +150,19 @@ 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' ); |
|
| 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 | 160 | |
| 161 | 161 | // Load WordPress Widgets |
| 162 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 162 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 163 | 163 | |
| 164 | 164 | // Load GravityView Widgets |
| 165 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
| 165 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
| 166 | 166 | |
| 167 | 167 | // Add oEmbed |
| 168 | 168 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
| 176 | 176 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
| 177 | 177 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
| 178 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
| 178 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
| 179 | 179 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
| 180 | 180 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
| 181 | 181 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @return bool |
| 191 | 191 | */ |
| 192 | 192 | public static function is_network_activated() { |
| 193 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 193 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @since 1.7.5.1 |
| 256 | 256 | */ |
| 257 | 257 | public static function include_widget_class() { |
| 258 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 258 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | } |
| 277 | 277 | if ( ! $loaded ) { |
| 278 | 278 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
| 279 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
| 279 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
| 280 | 280 | load_textdomain( 'gravityview', $mofile ); |
| 281 | 281 | } |
| 282 | 282 | |
@@ -302,12 +302,12 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function frontend_actions() { |
| 304 | 304 | |
| 305 | - if( self::is_admin() ) { return; } |
|
| 305 | + if ( self::is_admin() ) { return; } |
|
| 306 | 306 | |
| 307 | 307 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
| 308 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
| 309 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
| 310 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
| 308 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
| 309 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
| 310 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
| 311 | 311 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
| 312 | 312 | |
| 313 | 313 | |
@@ -332,8 +332,8 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | public static function get_default_widget_areas() { |
| 334 | 334 | $default_areas = array( |
| 335 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
| 336 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
| 335 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 336 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 337 | 337 | ); |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | * @param mixed $data Additional data to display |
| 352 | 352 | * @return void |
| 353 | 353 | */ |
| 354 | - public static function log_debug( $message, $data = null ){ |
|
| 354 | + public static function log_debug( $message, $data = null ) { |
|
| 355 | 355 | /** |
| 356 | 356 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 357 | 357 | * @param string $message Message to display |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | * @param string $message log message |
| 366 | 366 | * @return void |
| 367 | 367 | */ |
| 368 | - public static function log_error( $message, $data = null ){ |
|
| 368 | + public static function log_error( $message, $data = null ) { |
|
| 369 | 369 | /** |
| 370 | 370 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 371 | 371 | * @param string $message Error message to display |
@@ -376,4 +376,4 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | } // end class GravityView_Plugin |
| 378 | 378 | |
| 379 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
| 379 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
|
@@ -4,10 +4,10 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | function __construct() { |
| 6 | 6 | |
| 7 | - if( ! is_admin() ) { return; } |
|
| 7 | + if ( ! is_admin() ) { return; } |
|
| 8 | 8 | |
| 9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
| 10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
| 10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
| 26 | 26 | |
| 27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
| 28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
| 28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
| 29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -50,18 +50,18 @@ discard block |
||
| 50 | 50 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 51 | 51 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 52 | 52 | |
| 53 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
| 53 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
| 54 | 54 | |
| 55 | 55 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
| 56 | 56 | |
| 57 | 57 | //Hooks for no-conflict functionality |
| 58 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); |
|
| 59 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); |
|
| 58 | + add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 ); |
|
| 59 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 ); |
|
| 60 | 60 | |
| 61 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); |
|
| 62 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); |
|
| 63 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); |
|
| 64 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); |
|
| 61 | + add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 ); |
|
| 62 | + add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 ); |
|
| 63 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 ); |
|
| 64 | + add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 ); |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
@@ -74,20 +74,20 @@ discard block |
||
| 74 | 74 | public function backend_actions() { |
| 75 | 75 | |
| 76 | 76 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 77 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
| 78 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
| 79 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' ); |
|
| 80 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
| 81 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
| 82 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
| 83 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
| 77 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
| 78 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
| 79 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-label.php' ); |
|
| 80 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
| 81 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
| 82 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
| 83 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
| 87 | 87 | * |
| 88 | 88 | * Nice place to insert extensions' backend stuff |
| 89 | 89 | */ |
| 90 | - do_action('gravityview_include_backend_actions'); |
|
| 90 | + do_action( 'gravityview_include_backend_actions' ); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $actions = array(); |
| 105 | 105 | |
| 106 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 107 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 106 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 107 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 111 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 110 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 111 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | return array_merge( $actions, $links ); |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | function post_updated_messages( $messages, $bulk_counts = NULL ) { |
| 132 | 132 | global $post; |
| 133 | 133 | |
| 134 | - $post_id = isset($_GET['post']) ? intval($_GET['post']) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); |
|
| 134 | + $post_id = isset( $_GET[ 'post' ] ) ? intval( $_GET[ 'post' ] ) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); |
|
| 135 | 135 | |
| 136 | 136 | // By default, there will only be one item being modified. |
| 137 | 137 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
| 138 | 138 | // of modified items that will override this array. |
| 139 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 139 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 140 | 140 | |
| 141 | 141 | |
| 142 | 142 | // If we're starting fresh, a new form was created. |
@@ -145,60 +145,60 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $new_form_text = ''; |
| 147 | 147 | |
| 148 | - if( !empty( $start_fresh ) ) { |
|
| 148 | + if ( ! empty( $start_fresh ) ) { |
|
| 149 | 149 | |
| 150 | 150 | // Get the form that was created |
| 151 | 151 | $connected_form = gravityview_get_form_id( $post_id ); |
| 152 | 152 | |
| 153 | - if( !empty( $connected_form ) ) { |
|
| 153 | + if ( ! empty( $connected_form ) ) { |
|
| 154 | 154 | $form = gravityview_get_form( $connected_form ); |
| 155 | - $form_name = esc_attr( $form['title'] ); |
|
| 155 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
| 156 | 156 | $image = self::get_floaty(); |
| 157 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
| 158 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
| 157 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
| 158 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
| 159 | 159 | |
| 160 | 160 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
| 161 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
| 161 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
| 162 | 162 | $new_form_text = wpautop( $new_form_text ); |
| 163 | 163 | |
| 164 | 164 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $messages['gravityview'] = array( |
|
| 168 | + $messages[ 'gravityview' ] = array( |
|
| 169 | 169 | 0 => '', // Unused. Messages start at index 1. |
| 170 | 170 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 171 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 171 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 172 | 172 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 173 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 173 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 174 | 174 | 3 => __( 'View deleted.', 'gravityview' ), |
| 175 | 175 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 176 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 176 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 177 | 177 | /* translators: %s: date and time of the revision */ |
| 178 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
| 178 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
| 179 | 179 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 180 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 180 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 181 | 181 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 182 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 182 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 183 | 183 | 8 => __( 'View submitted.', 'gravityview' ), |
| 184 | 184 | 9 => sprintf( |
| 185 | 185 | /* translators: Date and time the View is scheduled to be published */ |
| 186 | 186 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
| 187 | 187 | // translators: Publish box date format, see http://php.net/date |
| 188 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 188 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 189 | 189 | ) . $new_form_text, |
| 190 | 190 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 191 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 191 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * These apply to `bulk_post_updated_messages` |
| 195 | 195 | * @file wp-admin/edit.php |
| 196 | 196 | */ |
| 197 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
| 198 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
| 199 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
| 200 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
| 201 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
| 197 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
| 198 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
| 199 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
| 200 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
| 201 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
| 202 | 202 | ); |
| 203 | 203 | |
| 204 | 204 | return $messages; |
@@ -211,13 +211,13 @@ discard block |
||
| 211 | 211 | function no_conflict_scripts() { |
| 212 | 212 | global $wp_scripts; |
| 213 | 213 | |
| 214 | - if( ! gravityview_is_admin_page() ) { |
|
| 214 | + if ( ! gravityview_is_admin_page() ) { |
|
| 215 | 215 | return; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
| 218 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
| 219 | 219 | |
| 220 | - if( empty( $no_conflict_mode ) ) { |
|
| 220 | + if ( empty( $no_conflict_mode ) ) { |
|
| 221 | 221 | return; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -267,24 +267,24 @@ discard block |
||
| 267 | 267 | function no_conflict_styles() { |
| 268 | 268 | global $wp_styles; |
| 269 | 269 | |
| 270 | - if( ! gravityview_is_admin_page() ) { |
|
| 270 | + if ( ! gravityview_is_admin_page() ) { |
|
| 271 | 271 | return; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // Dequeue other jQuery styles even if no-conflict is off. |
| 275 | 275 | // Terrible-looking tabs help no one. |
| 276 | - if( !empty( $wp_styles->registered ) ) { |
|
| 277 | - foreach ($wp_styles->registered as $key => $style) { |
|
| 278 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
| 276 | + if ( ! empty( $wp_styles->registered ) ) { |
|
| 277 | + foreach ( $wp_styles->registered as $key => $style ) { |
|
| 278 | + if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
| 279 | 279 | wp_dequeue_style( $key ); |
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
| 284 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
| 285 | 285 | |
| 286 | 286 | // If no conflict is off, jQuery will suffice. |
| 287 | - if( empty( $no_conflict_mode ) ) { |
|
| 287 | + if ( empty( $no_conflict_mode ) ) { |
|
| 288 | 288 | return; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | /** |
| 312 | 312 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
| 313 | 313 | */ |
| 314 | - do_action('gravityview_remove_conflicts_after'); |
|
| 314 | + do_action( 'gravityview_remove_conflicts_after' ); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -333,9 +333,9 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | //reset queue |
| 335 | 335 | $queue = array(); |
| 336 | - foreach( $wp_objects->queue as $object ) { |
|
| 337 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
| 338 | - $queue[] = $object; |
|
| 336 | + foreach ( $wp_objects->queue as $object ) { |
|
| 337 | + if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
| 338 | + $queue[ ] = $object; |
|
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | $wp_objects->queue = $queue; |
@@ -344,8 +344,8 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | //unregistering scripts |
| 346 | 346 | $registered = array(); |
| 347 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
| 348 | - if( in_array( $handle, $required_objects ) ){ |
|
| 347 | + foreach ( $wp_objects->registered as $handle => $script_registration ) { |
|
| 348 | + if ( in_array( $handle, $required_objects ) ) { |
|
| 349 | 349 | $registered[ $handle ] = $script_registration; |
| 350 | 350 | } |
| 351 | 351 | } |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * @param [type] $registered [description] |
| 359 | 359 | * @param [type] $scripts [description] |
| 360 | 360 | */ |
| 361 | - private function add_script_dependencies($registered, $scripts) { |
|
| 361 | + private function add_script_dependencies( $registered, $scripts ) { |
|
| 362 | 362 | |
| 363 | 363 | //gets all dependent scripts linked to the $scripts array passed |
| 364 | 364 | do { |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
| 368 | 368 | foreach ( $deps as $dep ) { |
| 369 | 369 | if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
| 370 | - $dependents[] = $dep; |
|
| 370 | + $dependents[ ] = $dep; |
|
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | } |
@@ -431,29 +431,29 @@ discard block |
||
| 431 | 431 | static function is_admin_page( $hook = '', $page = NULL ) { |
| 432 | 432 | global $current_screen, $plugin_page, $pagenow, $post; |
| 433 | 433 | |
| 434 | - if( ! is_admin() ) { return false; } |
|
| 434 | + if ( ! is_admin() ) { return false; } |
|
| 435 | 435 | |
| 436 | 436 | $is_page = false; |
| 437 | 437 | |
| 438 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
| 438 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
| 439 | 439 | |
| 440 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
| 440 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
| 441 | 441 | |
| 442 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
| 442 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
| 443 | 443 | |
| 444 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
| 445 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
| 446 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
| 444 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
| 445 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
| 446 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
| 447 | 447 | } else { |
| 448 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
| 448 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
| 451 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
| 452 | 452 | |
| 453 | 453 | // $_GET `post_type` variable |
| 454 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
| 454 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
| 455 | 455 | $is_page = 'single'; |
| 456 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
| 456 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
| 457 | 457 | $is_page = 'settings'; |
| 458 | 458 | } else { |
| 459 | 459 | $is_page = 'views'; |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
| 469 | 469 | |
| 470 | 470 | // If the current page is the same as the compared page |
| 471 | - if( !empty( $page ) ) { |
|
| 471 | + if ( ! empty( $page ) ) { |
|
| 472 | 472 | return $is_page === $page; |
| 473 | 473 | } |
| 474 | 474 | |
@@ -489,6 +489,6 @@ discard block |
||
| 489 | 489 | * |
| 490 | 490 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
| 491 | 491 | */ |
| 492 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
| 492 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
| 493 | 493 | return GravityView_Admin::is_admin_page( $hook, $page ); |
| 494 | 494 | } |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | /** gf_entries page - entries table screen */ |
| 35 | 35 | |
| 36 | 36 | // capture bulk actions |
| 37 | - add_action( 'init', array( $this, 'process_bulk_action') ); |
|
| 37 | + add_action( 'init', array( $this, 'process_bulk_action' ) ); |
|
| 38 | 38 | // add hidden field with approve status |
| 39 | 39 | add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
| 40 | 40 | // process ajax approve entry requests |
| 41 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
| 41 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
| 42 | 42 | |
| 43 | 43 | // in case entry is edited (on admin or frontend) |
| 44 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
| 44 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
| 45 | 45 | |
| 46 | 46 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
| 47 | 47 | |
| 48 | 48 | // adding styles and scripts |
| 49 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
| 49 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
| 50 | 50 | // bypass Gravity Forms no-conflict mode |
| 51 | 51 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
| 52 | 52 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | function tooltips( $tooltips ) { |
| 63 | 63 | |
| 64 | - $tooltips['form_gravityview_fields'] = array( |
|
| 65 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
| 66 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
| 64 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
| 65 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
| 66 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | 69 | return $tooltips; |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
| 181 | - if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) { |
|
| 181 | + if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
| 182 | 182 | |
| 183 | 183 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
| 184 | 184 | |
| 185 | 185 | // The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form. |
| 186 | - $bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2']; |
|
| 186 | + $bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ]; |
|
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * The extra '-' is to make sure that there are at *least* two items in array. |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | // All entries are set to be updated, not just the visible ones |
| 202 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
| 202 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
| 203 | 203 | |
| 204 | 204 | // Convert the current entry search into GF-formatted search criteria |
| 205 | 205 | $search = array( |
| 206 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
| 207 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
| 208 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
| 206 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
| 207 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
| 208 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
| 209 | 209 | ); |
| 210 | 210 | |
| 211 | 211 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | } else { |
| 217 | 217 | |
| 218 | - $entries = $_POST['lead']; |
|
| 218 | + $entries = $_POST[ 'lead' ]; |
|
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | private static function update_bulk( $entries, $approved, $form_id ) { |
| 258 | 258 | |
| 259 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
| 259 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
| 260 | 260 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
| 261 | 261 | return false; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 264 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 265 | 265 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 266 | 266 | return false; |
| 267 | 267 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | // calculate approved field id |
| 272 | 272 | $approved_column_id = self::get_approved_column( $form_id ); |
| 273 | 273 | |
| 274 | - foreach( $entries as $entry_id ) { |
|
| 274 | + foreach ( $entries as $entry_id ) { |
|
| 275 | 275 | self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -290,14 +290,14 @@ discard block |
||
| 290 | 290 | * @param int $approvedcolumn (default: 0) |
| 291 | 291 | * @return boolean True: It worked; False: it failed |
| 292 | 292 | */ |
| 293 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
| 293 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
| 294 | 294 | |
| 295 | - if( !class_exists( 'GFAPI' ) ) { |
|
| 295 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
| 296 | 296 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
| 297 | 297 | return false; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if( empty( $approvedcolumn ) ) { |
|
| 300 | + if ( empty( $approvedcolumn ) ) { |
|
| 301 | 301 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 302 | 302 | } |
| 303 | 303 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | self::update_approved_meta( $entry_id, $approved ); |
| 317 | 317 | |
| 318 | 318 | // add note to entry |
| 319 | - if( $result === true ) { |
|
| 319 | + if ( $result === true ) { |
|
| 320 | 320 | |
| 321 | 321 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
| 322 | 322 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | $add_note = apply_filters( 'gravityview/approve_entries/add-note', true ); |
| 329 | 329 | |
| 330 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 330 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 331 | 331 | $current_user = wp_get_current_user(); |
| 332 | 332 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
| 333 | 333 | } |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | do_action( 'gravityview_clear_form_cache', $form_id ); |
| 341 | 341 | |
| 342 | - } else if( is_wp_error( $result ) ) { |
|
| 342 | + } else if ( is_wp_error( $result ) ) { |
|
| 343 | 343 | |
| 344 | 344 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
| 345 | 345 | |
@@ -361,12 +361,12 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | public static function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
| 363 | 363 | |
| 364 | - $approvedcolumn = self::get_approved_column( $form['id'] ); |
|
| 364 | + $approvedcolumn = self::get_approved_column( $form[ 'id' ] ); |
|
| 365 | 365 | |
| 366 | 366 | /** |
| 367 | 367 | * If the form doesn't contain the approve field, don't assume anything. |
| 368 | 368 | */ |
| 369 | - if( empty( $approvedcolumn ) ) { |
|
| 369 | + if ( empty( $approvedcolumn ) ) { |
|
| 370 | 370 | return; |
| 371 | 371 | } |
| 372 | 372 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | private static function update_approved_meta( $entry_id, $is_approved ) { |
| 389 | 389 | |
| 390 | 390 | // update entry meta |
| 391 | - if( function_exists('gform_update_meta') ) { |
|
| 391 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
| 392 | 392 | |
| 393 | 393 | gform_update_meta( $entry_id, 'is_approved', $is_approved ); |
| 394 | 394 | |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); |
| 402 | 402 | |
| 403 | - if( empty( $is_approved ) ) { |
|
| 403 | + if ( empty( $is_approved ) ) { |
|
| 404 | 404 | |
| 405 | 405 | /** |
| 406 | 406 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | } else { |
| 424 | 424 | |
| 425 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 425 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 426 | 426 | |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -434,21 +434,21 @@ discard block |
||
| 434 | 434 | */ |
| 435 | 435 | public function ajax_update_approved() { |
| 436 | 436 | |
| 437 | - if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { |
|
| 437 | + if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) { |
|
| 438 | 438 | |
| 439 | 439 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
| 440 | 440 | |
| 441 | 441 | $result = false; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
| 444 | + else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) { |
|
| 445 | 445 | |
| 446 | 446 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
| 447 | 447 | |
| 448 | 448 | $result = false; |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
| 451 | + else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) { |
|
| 452 | 452 | |
| 453 | 453 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 454 | 454 | |
@@ -457,11 +457,11 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | else { |
| 459 | 459 | |
| 460 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
|
| 460 | + $result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] ); |
|
| 461 | 461 | |
| 462 | - if( is_wp_error( $result ) ) { |
|
| 462 | + if ( is_wp_error( $result ) ) { |
|
| 463 | 463 | /** @var WP_Error $result */ |
| 464 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); |
|
| 464 | + do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() ); |
|
| 465 | 465 | $result = false; |
| 466 | 466 | } |
| 467 | 467 | |
@@ -481,29 +481,29 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | static public function get_approved_column( $form ) { |
| 483 | 483 | |
| 484 | - if( empty( $form ) ) { |
|
| 484 | + if ( empty( $form ) ) { |
|
| 485 | 485 | return null; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - if( !is_array( $form ) ) { |
|
| 488 | + if ( ! is_array( $form ) ) { |
|
| 489 | 489 | $form = GVCommon::get_form( $form ); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - foreach( $form['fields'] as $key => $field ) { |
|
| 492 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
| 493 | 493 | |
| 494 | - $field = (array) $field; |
|
| 494 | + $field = (array)$field; |
|
| 495 | 495 | |
| 496 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
| 497 | - if( !empty($field['inputs'][0]['id']) ) { |
|
| 498 | - return $field['inputs'][0]['id']; |
|
| 496 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
| 497 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
| 498 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
| 503 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
| 504 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
| 505 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
| 506 | - return $input['id']; |
|
| 503 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
| 504 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
| 505 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
| 506 | + return $input[ 'id' ]; |
|
| 507 | 507 | } |
| 508 | 508 | } |
| 509 | 509 | } |
@@ -514,18 +514,18 @@ discard block |
||
| 514 | 514 | |
| 515 | 515 | |
| 516 | 516 | |
| 517 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 517 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 518 | 518 | |
| 519 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
| 519 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
| 520 | 520 | return; |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - if( empty( $entry['id'] ) ) { |
|
| 523 | + if ( empty( $entry[ 'id' ] ) ) { |
|
| 524 | 524 | return; |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - if( gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
| 528 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
| 527 | + if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
| 528 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; |
|
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | |
| 535 | 535 | function add_scripts_and_styles( $hook ) { |
| 536 | 536 | |
| 537 | - if( !class_exists( 'RGForms' ) ) { |
|
| 537 | + if ( ! class_exists( 'RGForms' ) ) { |
|
| 538 | 538 | |
| 539 | 539 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
| 540 | 540 | |
@@ -543,39 +543,39 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | // enqueue styles & scripts gf_entries |
| 545 | 545 | // But only if we're on the main Entries page, not on reports pages |
| 546 | - if( RGForms::get_page() === 'entry_list' ) { |
|
| 546 | + if ( RGForms::get_page() === 'entry_list' ) { |
|
| 547 | 547 | |
| 548 | - $form_id = RGForms::get('id'); |
|
| 548 | + $form_id = RGForms::get( 'id' ); |
|
| 549 | 549 | |
| 550 | 550 | // If there are no forms identified, use the first form. That's how GF does it. |
| 551 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
| 551 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
| 552 | 552 | $forms = gravityview_get_forms(); |
| 553 | - if( !empty( $forms ) ) { |
|
| 554 | - $form_id = $forms[0]['id']; |
|
| 553 | + if ( ! empty( $forms ) ) { |
|
| 554 | + $form_id = $forms[ 0 ][ 'id' ]; |
|
| 555 | 555 | } |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 559 | 559 | |
| 560 | - wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 560 | + wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 561 | 561 | wp_enqueue_style( 'gravityview_entries_list' ); |
| 562 | 562 | |
| 563 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 563 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 564 | 564 | |
| 565 | - wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 565 | + wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 566 | 566 | wp_enqueue_script( 'gravityview_gf_entries_scripts' ); |
| 567 | 567 | |
| 568 | 568 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
| 569 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), |
|
| 569 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ), |
|
| 570 | 570 | 'form_id' => $form_id, |
| 571 | 571 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
| 572 | 572 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
| 573 | 573 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
| 574 | 574 | 'bulk_message' => $this->bulk_update_message, |
| 575 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
| 576 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
| 577 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
| 578 | - 'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ), |
|
| 575 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), |
|
| 576 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), |
|
| 577 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
| 578 | + 'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ), |
|
| 579 | 579 | ) ); |
| 580 | 580 | |
| 581 | 581 | } |
@@ -618,8 +618,8 @@ discard block |
||
| 618 | 618 | // Sanitize the values, just to be sure. |
| 619 | 619 | foreach ( $bulk_actions as $key => $group ) { |
| 620 | 620 | foreach ( $group as $i => $action ) { |
| 621 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
| 622 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
| 621 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
| 622 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | |
@@ -644,13 +644,13 @@ discard block |
||
| 644 | 644 | * @since 1.7.2 |
| 645 | 645 | * @param boolean $hide_if_no_connections |
| 646 | 646 | */ |
| 647 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 647 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 648 | 648 | |
| 649 | - if( $hide_if_no_connections ) { |
|
| 649 | + if ( $hide_if_no_connections ) { |
|
| 650 | 650 | |
| 651 | 651 | $connected_views = gravityview_get_connected_views( $form_id ); |
| 652 | 652 | |
| 653 | - if( empty( $connected_views ) ) { |
|
| 653 | + if ( empty( $connected_views ) ) { |
|
| 654 | 654 | $show_approve_column = false; |
| 655 | 655 | } |
| 656 | 656 | } |
@@ -660,18 +660,18 @@ discard block |
||
| 660 | 660 | * @param boolean $show_approve_column Whether the column will be shown |
| 661 | 661 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
| 662 | 662 | */ |
| 663 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 663 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 664 | 664 | |
| 665 | 665 | return $show_approve_column; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | function register_gform_noconflict_script( $scripts ) { |
| 669 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
| 669 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
| 670 | 670 | return $scripts; |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | function register_gform_noconflict_style( $styles ) { |
| 674 | - $styles[] = 'gravityview_entries_list'; |
|
| 674 | + $styles[ ] = 'gravityview_entries_list'; |
|
| 675 | 675 | return $styles; |
| 676 | 676 | } |
| 677 | 677 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public static function get_instance() { |
| 87 | 87 | |
| 88 | - if( empty( self::$instance ) ) { |
|
| 88 | + if ( empty( self::$instance ) ) { |
|
| 89 | 89 | self::$instance = new self; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
| 120 | 120 | |
| 121 | - if( $with_values ) { |
|
| 121 | + if ( $with_values ) { |
|
| 122 | 122 | $operators_with_values = array(); |
| 123 | - foreach( $operators as $key ) { |
|
| 123 | + foreach ( $operators as $key ) { |
|
| 124 | 124 | $operators_with_values[ $key ] = ''; |
| 125 | 125 | } |
| 126 | 126 | return $operators_with_values; |
@@ -137,14 +137,14 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | function set_operation( $operation = '' ) { |
| 139 | 139 | |
| 140 | - if( empty( $operation ) ) { |
|
| 140 | + if ( empty( $operation ) ) { |
|
| 141 | 141 | return false; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $operators = $this->get_operators( false ); |
| 145 | 145 | |
| 146 | - if( !in_array( $operation, $operators ) ) { |
|
| 147 | - do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation ); |
|
| 146 | + if ( ! in_array( $operation, $operators ) ) { |
|
| 147 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation ); |
|
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | private function setup_operation_and_comparison() { |
| 166 | 166 | |
| 167 | - foreach( $this->atts as $key => $value ) { |
|
| 167 | + foreach ( $this->atts as $key => $value ) { |
|
| 168 | 168 | |
| 169 | 169 | $valid = $this->set_operation( $key ); |
| 170 | 170 | |
| 171 | - if( $valid ) { |
|
| 171 | + if ( $valid ) { |
|
| 172 | 172 | $this->comparison = $value; |
| 173 | 173 | return true; |
| 174 | 174 | } |
@@ -198,16 +198,16 @@ discard block |
||
| 198 | 198 | $this->parse_atts(); |
| 199 | 199 | |
| 200 | 200 | // We need an "if" |
| 201 | - if( false === $this->if ) { |
|
| 202 | - do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts ); |
|
| 201 | + if ( false === $this->if ) { |
|
| 202 | + do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts ); |
|
| 203 | 203 | return null; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | $setup = $this->setup_operation_and_comparison(); |
| 207 | 207 | |
| 208 | 208 | // We need an operation and comparison value |
| 209 | - if( ! $setup ) { |
|
| 210 | - do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts ); |
|
| 209 | + if ( ! $setup ) { |
|
| 210 | + do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts ); |
|
| 211 | 211 | return null; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | private function get_output() { |
| 242 | 242 | |
| 243 | - if( $this->is_match ) { |
|
| 243 | + if ( $this->is_match ) { |
|
| 244 | 244 | $output = $this->content; |
| 245 | 245 | } else { |
| 246 | 246 | $output = $this->else_content; |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | * @param string $output HTML/text output |
| 255 | 255 | * @param GVLogic_Shortcode $this This class |
| 256 | 256 | */ |
| 257 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
| 257 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
| 258 | 258 | |
| 259 | - do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output ); |
|
| 259 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output ); |
|
| 260 | 260 | |
| 261 | 261 | return $output; |
| 262 | 262 | } |
@@ -272,11 +272,11 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | $content = explode( '[else]', $this->passed_content ); |
| 274 | 274 | |
| 275 | - $this->content = $content[0]; |
|
| 275 | + $this->content = $content[ 0 ]; |
|
| 276 | 276 | |
| 277 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
| 277 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
| 278 | 278 | |
| 279 | - $this->else_content = isset( $content[1] ) ? $content[1] : $else_attr; |
|
| 279 | + $this->else_content = isset( $content[ 1 ] ) ? $content[ 1 ] : $else_attr; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
@@ -299,10 +299,10 @@ discard block |
||
| 299 | 299 | $this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts; |
| 300 | 300 | |
| 301 | 301 | // Strip whitespace if it's not default false |
| 302 | - $this->if = is_string( $this->atts['if'] ) ? trim( $this->atts['if'] ) : false; |
|
| 302 | + $this->if = is_string( $this->atts[ 'if' ] ) ? trim( $this->atts[ 'if' ] ) : false; |
|
| 303 | 303 | |
| 304 | 304 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
| 305 | - unset( $this->atts['if'] ); |
|
| 305 | + unset( $this->atts[ 'if' ] ); |
|
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | |
@@ -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,9 +227,9 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if ( $form ) { |
| 230 | - foreach ( $form['fields'] as $field ) { |
|
| 231 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
| 232 | - $fields[ $field['id'] ] = array( |
|
| 230 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 231 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
| 232 | + $fields[ $field[ 'id' ] ] = array( |
|
| 233 | 233 | 'label' => rgar( $field, 'label' ), |
| 234 | 234 | 'parent' => null, |
| 235 | 235 | 'type' => rgar( $field, 'type' ), |
@@ -238,16 +238,16 @@ discard block |
||
| 238 | 238 | ); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
| 242 | - foreach ( $field['inputs'] as $input ) { |
|
| 241 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
| 242 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
| 243 | 243 | /** |
| 244 | 244 | * @hack |
| 245 | 245 | * In case of email/email confirmation, the input for email has the same id as the parent field |
| 246 | 246 | */ |
| 247 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 247 | + if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) { |
|
| 248 | 248 | continue; |
| 249 | 249 | } |
| 250 | - $fields[ (string)$input['id'] ] = array( |
|
| 250 | + $fields[ (string)$input[ 'id' ] ] = array( |
|
| 251 | 251 | 'label' => rgar( $input, 'label' ), |
| 252 | 252 | 'customLabel' => rgar( $input, 'customLabel' ), |
| 253 | 253 | 'parent' => $field, |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** @since 1.14 */ |
| 262 | - if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) { |
|
| 262 | + if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) { |
|
| 263 | 263 | |
| 264 | - foreach ( (array)$field['choices'] as $key => $input ) { |
|
| 264 | + foreach ( (array)$field[ 'choices' ] as $key => $input ) { |
|
| 265 | 265 | |
| 266 | - $input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key} |
|
| 266 | + $input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key} |
|
| 267 | 267 | |
| 268 | 268 | $fields[ $input_id ] = array( |
| 269 | 269 | 'label' => rgar( $input, 'text' ), |
@@ -279,25 +279,25 @@ discard block |
||
| 279 | 279 | /** |
| 280 | 280 | * @since 1.8 |
| 281 | 281 | */ |
| 282 | - if( 'quiz' === $field['type'] ) { |
|
| 282 | + if ( 'quiz' === $field[ 'type' ] ) { |
|
| 283 | 283 | $has_quiz_fields = true; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |
| 287 | 287 | * @since 1.8 |
| 288 | 288 | */ |
| 289 | - if( 'poll' === $field['type'] ) { |
|
| 289 | + if ( 'poll' === $field[ 'type' ] ) { |
|
| 290 | 290 | $has_poll_fields = true; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
| 293 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
| 294 | 294 | $has_product_fields = true; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * @hack Version 1.9 |
| 299 | 299 | */ |
| 300 | - $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field; |
|
| 300 | + $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field; |
|
| 301 | 301 | |
| 302 | 302 | if ( GFCommon::is_post_field( $field_for_is_post_field ) ) { |
| 303 | 303 | $has_post_fields = true; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @since 1.7 |
| 310 | 310 | */ |
| 311 | 311 | if ( $has_post_fields ) { |
| 312 | - $fields['post_id'] = array( |
|
| 312 | + $fields[ 'post_id' ] = array( |
|
| 313 | 313 | 'label' => __( 'Post ID', 'gravityview' ), |
| 314 | 314 | 'type' => 'post_id', |
| 315 | 315 | ); |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
| 321 | 321 | |
| 322 | 322 | foreach ( $payment_fields as $payment_field ) { |
| 323 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
| 323 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
| 324 | 324 | continue; |
| 325 | 325 | } |
| 326 | - $fields["{$payment_field->name}"] = array( |
|
| 326 | + $fields[ "{$payment_field->name}" ] = array( |
|
| 327 | 327 | 'label' => $payment_field->label, |
| 328 | 328 | 'desc' => $payment_field->description, |
| 329 | 329 | 'type' => $payment_field->name, |
@@ -334,25 +334,25 @@ discard block |
||
| 334 | 334 | /** |
| 335 | 335 | * @since 1.8 |
| 336 | 336 | */ |
| 337 | - if( $has_quiz_fields ) { |
|
| 337 | + if ( $has_quiz_fields ) { |
|
| 338 | 338 | |
| 339 | - $fields['gquiz_score'] = array( |
|
| 339 | + $fields[ 'gquiz_score' ] = array( |
|
| 340 | 340 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
| 341 | 341 | 'type' => 'quiz_score', |
| 342 | 342 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
| 343 | 343 | ); |
| 344 | - $fields['gquiz_percent'] = array( |
|
| 344 | + $fields[ 'gquiz_percent' ] = array( |
|
| 345 | 345 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
| 346 | 346 | 'type' => 'quiz_percent', |
| 347 | 347 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
| 348 | 348 | ); |
| 349 | - $fields['gquiz_grade'] = array( |
|
| 349 | + $fields[ 'gquiz_grade' ] = array( |
|
| 350 | 350 | /* 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. */ |
| 351 | 351 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
| 352 | 352 | 'type' => 'quiz_grade', |
| 353 | 353 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
| 354 | 354 | ); |
| 355 | - $fields['gquiz_is_pass'] = array( |
|
| 355 | + $fields[ 'gquiz_is_pass' ] = array( |
|
| 356 | 356 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
| 357 | 357 | 'type' => 'quiz_is_pass', |
| 358 | 358 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | $fields = array(); |
| 376 | 376 | |
| 377 | - foreach ( $extra_fields as $key => $field ){ |
|
| 378 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
| 379 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
| 377 | + foreach ( $extra_fields as $key => $field ) { |
|
| 378 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
| 379 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
@@ -416,32 +416,32 @@ discard block |
||
| 416 | 416 | 'search_criteria' => null, |
| 417 | 417 | 'sorting' => null, |
| 418 | 418 | 'paging' => null, |
| 419 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
| 419 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
| 420 | 420 | ); |
| 421 | 421 | |
| 422 | 422 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
| 423 | 423 | |
| 424 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
| 425 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
| 424 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 425 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
| 426 | 426 | |
| 427 | 427 | if ( ! is_array( $filter ) ) { |
| 428 | 428 | continue; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | // By default, we want searches to be wildcard for each field. |
| 432 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 432 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 433 | 433 | |
| 434 | 434 | /** |
| 435 | 435 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
| 436 | 436 | * @param string $operator Existing search operator |
| 437 | 437 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 438 | 438 | */ |
| 439 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 439 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // don't send just the [mode] without any field filter. |
| 443 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
| 444 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
| 443 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 444 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | } |
@@ -452,21 +452,21 @@ discard block |
||
| 452 | 452 | * Prepare date formats to be in Gravity Forms DB format; |
| 453 | 453 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
| 454 | 454 | */ |
| 455 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
| 455 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
| 456 | 456 | |
| 457 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
| 457 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
| 458 | 458 | |
| 459 | 459 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
| 460 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
| 460 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 461 | 461 | |
| 462 | 462 | if ( $date ) { |
| 463 | 463 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
| 464 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 464 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 465 | 465 | } else { |
| 466 | 466 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
| 467 | - unset( $criteria['search_criteria'][ $key ] ); |
|
| 467 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 468 | 468 | |
| 469 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
| 469 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | } |
@@ -474,12 +474,12 @@ discard block |
||
| 474 | 474 | |
| 475 | 475 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
| 476 | 476 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
| 477 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 477 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 478 | 478 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 479 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
|
| 480 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
| 479 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? $_GET[ 'view_id' ] : null; |
|
| 480 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
| 481 | 481 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
| 482 | - $criteria['context_view_id'] = null; |
|
| 482 | + $criteria[ 'context_view_id' ] = null; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | /** |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | * @param array $form_ids Forms to search |
| 489 | 489 | * @param int $view_id ID of the view being used to search |
| 490 | 490 | */ |
| 491 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
| 491 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
| 492 | 492 | |
| 493 | 493 | return (array)$criteria; |
| 494 | 494 | |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | /** Reduce # of database calls */ |
| 520 | 520 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
| 521 | 521 | |
| 522 | - if ( ! empty( $criteria['cache'] ) ) { |
|
| 522 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
| 523 | 523 | |
| 524 | 524 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
| 525 | 525 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | // Still update the total count when using cached results |
| 529 | 529 | if ( ! is_null( $total ) ) { |
| 530 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
| 530 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | $return = $entries; |
@@ -547,9 +547,9 @@ discard block |
||
| 547 | 547 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
| 548 | 548 | |
| 549 | 549 | // No entries returned from gravityview_before_get_entries |
| 550 | - if( is_null( $entries ) ) { |
|
| 550 | + if ( is_null( $entries ) ) { |
|
| 551 | 551 | |
| 552 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
| 552 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
| 553 | 553 | |
| 554 | 554 | if ( is_wp_error( $entries ) ) { |
| 555 | 555 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
| 561 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
| 562 | 562 | |
| 563 | 563 | // Cache results |
| 564 | 564 | $Cache->set( $entries, 'entries' ); |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | */ |
| 646 | 646 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
| 647 | 647 | |
| 648 | - if( $check_entry_display ) { |
|
| 648 | + if ( $check_entry_display ) { |
|
| 649 | 649 | // Is the entry allowed |
| 650 | 650 | $entry = self::check_entry_display( $entry ); |
| 651 | 651 | } |
@@ -678,12 +678,12 @@ discard block |
||
| 678 | 678 | |
| 679 | 679 | $value = false; |
| 680 | 680 | |
| 681 | - if( 'context' === $val1 ) { |
|
| 681 | + if ( 'context' === $val1 ) { |
|
| 682 | 682 | |
| 683 | 683 | $matching_contexts = array( $val2 ); |
| 684 | 684 | |
| 685 | 685 | // We allow for non-standard contexts. |
| 686 | - switch( $val2 ) { |
|
| 686 | + switch ( $val2 ) { |
|
| 687 | 687 | // Check for either single or edit |
| 688 | 688 | case 'singular': |
| 689 | 689 | $matching_contexts = array( 'single', 'edit' ); |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | return false; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - if ( empty( $entry['form_id'] ) ) { |
|
| 746 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
| 747 | 747 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
| 748 | 748 | return false; |
| 749 | 749 | } |
@@ -751,26 +751,26 @@ discard block |
||
| 751 | 751 | $criteria = self::calculate_get_entries_criteria(); |
| 752 | 752 | |
| 753 | 753 | // Make sure the current View is connected to the same form as the Entry |
| 754 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
| 755 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
| 754 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
| 755 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
| 756 | 756 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
| 757 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
| 758 | - 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'] ); |
|
| 757 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
| 758 | + 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' ] ); |
|
| 759 | 759 | return false; |
| 760 | 760 | } |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
| 763 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
| 764 | 764 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
| 765 | 765 | return $entry; |
| 766 | 766 | } |
| 767 | 767 | |
| 768 | - $search_criteria = $criteria['search_criteria']; |
|
| 768 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
| 769 | 769 | unset( $criteria ); |
| 770 | 770 | |
| 771 | 771 | // check entry status |
| 772 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
| 773 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
| 772 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
| 773 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
| 774 | 774 | return false; |
| 775 | 775 | } |
| 776 | 776 | |
@@ -778,37 +778,37 @@ discard block |
||
| 778 | 778 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
| 779 | 779 | |
| 780 | 780 | // field_filters |
| 781 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
| 781 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
| 782 | 782 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
| 783 | 783 | return $entry; |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | - $filters = $search_criteria['field_filters']; |
|
| 786 | + $filters = $search_criteria[ 'field_filters' ]; |
|
| 787 | 787 | unset( $search_criteria ); |
| 788 | 788 | |
| 789 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
| 790 | - unset( $filters['mode'] ); |
|
| 789 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
| 790 | + unset( $filters[ 'mode' ] ); |
|
| 791 | 791 | |
| 792 | - $form = self::get_form( $entry['form_id'] ); |
|
| 792 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 793 | 793 | |
| 794 | 794 | foreach ( $filters as $filter ) { |
| 795 | 795 | |
| 796 | - if ( ! isset( $filter['key'] ) ) { |
|
| 796 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
| 797 | 797 | continue; |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | - $k = $filter['key']; |
|
| 800 | + $k = $filter[ 'key' ]; |
|
| 801 | 801 | |
| 802 | 802 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
| 803 | 803 | $field_value = $entry[ $k ]; |
| 804 | 804 | $field = null; |
| 805 | 805 | } else { |
| 806 | 806 | $field = self::get_field( $form, $k ); |
| 807 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 807 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
| 811 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
| 810 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
| 811 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
| 812 | 812 | |
| 813 | 813 | // verify if we are already free to go! |
| 814 | 814 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -866,18 +866,18 @@ discard block |
||
| 866 | 866 | * Gravity Forms code to adjust date to locally-configured Time Zone |
| 867 | 867 | * @see GFCommon::format_date() for original code |
| 868 | 868 | */ |
| 869 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 869 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 870 | 870 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
| 871 | 871 | |
| 872 | - $format = rgar( $atts, 'format' ); |
|
| 873 | - $is_human = ! empty( $atts['human'] ); |
|
| 874 | - $is_diff = ! empty( $atts['diff'] ); |
|
| 875 | - $is_raw = ! empty( $atts['raw'] ); |
|
| 876 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
| 877 | - $include_time = ! empty( $atts['time'] ); |
|
| 872 | + $format = rgar( $atts, 'format' ); |
|
| 873 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
| 874 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
| 875 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
| 876 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
| 877 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
| 878 | 878 | |
| 879 | 879 | // If we're using time diff, we want to have a different default format |
| 880 | - if( empty( $format ) ) { |
|
| 880 | + if ( empty( $format ) ) { |
|
| 881 | 881 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
| 882 | 882 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
| 883 | 883 | } |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | // If raw was specified, don't modify the stored value |
| 886 | 886 | if ( $is_raw ) { |
| 887 | 887 | $formatted_date = $date_string; |
| 888 | - } elseif( $is_timestamp ) { |
|
| 888 | + } elseif ( $is_timestamp ) { |
|
| 889 | 889 | $formatted_date = $date_local_timestamp; |
| 890 | 890 | } elseif ( $is_diff ) { |
| 891 | 891 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | $field = self::get_field( $form, $field_id ); |
| 916 | - return isset( $field['label'] ) ? $field['label'] : ''; |
|
| 916 | + return isset( $field[ 'label' ] ) ? $field[ 'label' ] : ''; |
|
| 917 | 917 | |
| 918 | 918 | } |
| 919 | 919 | |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist |
| 932 | 932 | */ |
| 933 | 933 | public static function get_field( $form, $field_id ) { |
| 934 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 934 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 935 | 935 | return GFFormsModel::get_field( $form, $field_id ); |
| 936 | 936 | } else { |
| 937 | 937 | return null; |
@@ -978,19 +978,19 @@ discard block |
||
| 978 | 978 | $shortcodes = array(); |
| 979 | 979 | |
| 980 | 980 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 981 | - if ( empty( $matches ) ){ |
|
| 981 | + if ( empty( $matches ) ) { |
|
| 982 | 982 | return false; |
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | foreach ( $matches as $shortcode ) { |
| 986 | - if ( $tag === $shortcode[2] ) { |
|
| 986 | + if ( $tag === $shortcode[ 2 ] ) { |
|
| 987 | 987 | |
| 988 | 988 | // Changed this to $shortcode instead of true so we get the parsed atts. |
| 989 | - $shortcodes[] = $shortcode; |
|
| 989 | + $shortcodes[ ] = $shortcode; |
|
| 990 | 990 | |
| 991 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
| 992 | - foreach( $results as $result ) { |
|
| 993 | - $shortcodes[] = $result; |
|
| 991 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
| 992 | + foreach ( $results as $result ) { |
|
| 993 | + $shortcodes[ ] = $result; |
|
| 994 | 994 | } |
| 995 | 995 | } |
| 996 | 996 | } |
@@ -1141,7 +1141,7 @@ discard block |
||
| 1141 | 1141 | * @return string html |
| 1142 | 1142 | */ |
| 1143 | 1143 | public static function get_sortable_fields( $formid, $current = '' ) { |
| 1144 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
| 1144 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
| 1145 | 1145 | |
| 1146 | 1146 | if ( empty( $formid ) ) { |
| 1147 | 1147 | return $output; |
@@ -1154,11 +1154,11 @@ discard block |
||
| 1154 | 1154 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
| 1155 | 1155 | |
| 1156 | 1156 | foreach ( $fields as $id => $field ) { |
| 1157 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1157 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1158 | 1158 | continue; |
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
| 1161 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
| 1162 | 1162 | } |
| 1163 | 1163 | } |
| 1164 | 1164 | |
@@ -1193,9 +1193,9 @@ discard block |
||
| 1193 | 1193 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1194 | 1194 | |
| 1195 | 1195 | // TODO: Convert to using array_filter |
| 1196 | - foreach( $fields as $id => $field ) { |
|
| 1196 | + foreach ( $fields as $id => $field ) { |
|
| 1197 | 1197 | |
| 1198 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1198 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1199 | 1199 | unset( $fields[ $id ] ); |
| 1200 | 1200 | } |
| 1201 | 1201 | } |
@@ -1236,14 +1236,14 @@ discard block |
||
| 1236 | 1236 | * @param int|array $field field key or field array |
| 1237 | 1237 | * @return boolean |
| 1238 | 1238 | */ |
| 1239 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1239 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1240 | 1240 | |
| 1241 | 1241 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
| 1242 | 1242 | $form = self::get_form( $form ); |
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | 1245 | // If entry meta, it's a string. Otherwise, numeric |
| 1246 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1246 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1247 | 1247 | $type = $field; |
| 1248 | 1248 | } else { |
| 1249 | 1249 | $type = self::get_field_type( $form, $field ); |
@@ -1257,9 +1257,9 @@ discard block |
||
| 1257 | 1257 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
| 1258 | 1258 | |
| 1259 | 1259 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
| 1260 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1261 | - if( true === $gv_field->is_numeric ) { |
|
| 1262 | - $numeric_types[] = $gv_field->is_numeric; |
|
| 1260 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1261 | + if ( true === $gv_field->is_numeric ) { |
|
| 1262 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
| 1263 | 1263 | } |
| 1264 | 1264 | } |
| 1265 | 1265 | |
@@ -1409,11 +1409,11 @@ discard block |
||
| 1409 | 1409 | $final_atts = array_filter( $final_atts ); |
| 1410 | 1410 | |
| 1411 | 1411 | // If the href wasn't passed as an attribute, use the value passed to the function |
| 1412 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
| 1413 | - $final_atts['href'] = $href; |
|
| 1412 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
| 1413 | + $final_atts[ 'href' ] = $href; |
|
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | - $final_atts['href'] = esc_url_raw( $href ); |
|
| 1416 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
| 1417 | 1417 | |
| 1418 | 1418 | // Sort the attributes alphabetically, to help testing |
| 1419 | 1419 | ksort( $final_atts ); |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
| 1425 | 1425 | } |
| 1426 | 1426 | |
| 1427 | - if( '' !== $output ) { |
|
| 1427 | + if ( '' !== $output ) { |
|
| 1428 | 1428 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
| 1429 | 1429 | } |
| 1430 | 1430 | |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
| 1449 | 1449 | $merged = $array1; |
| 1450 | 1450 | |
| 1451 | - foreach ( $array2 as $key => &$value ) { |
|
| 1451 | + foreach ( $array2 as $key => &$value ) { |
|
| 1452 | 1452 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
| 1453 | 1453 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
| 1454 | 1454 | } else { |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
| 1484 | 1484 | * @param array $settings Settings array, with `number` key defining the # of users to display |
| 1485 | 1485 | */ |
| 1486 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1486 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1487 | 1487 | |
| 1488 | 1488 | return get_users( $get_users_settings ); |
| 1489 | 1489 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | * @return string |
| 1499 | 1499 | */ |
| 1500 | 1500 | public static function generate_notice( $notice, $class = '' ) { |
| 1501 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1501 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'type' => 'radio', |
| 64 | 64 | 'full_width' => true, |
| 65 | 65 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
| 66 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
| 66 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
| 67 | 67 | 'value' => 'any', |
| 68 | 68 | 'class' => 'hide-if-js', |
| 69 | 69 | 'options' => array( |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 149 | 149 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 150 | 150 | |
| 151 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 151 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * Add admin script to the whitelist |
| 201 | 201 | */ |
| 202 | 202 | public function register_no_conflict( $required ) { |
| 203 | - $required[] = 'gravityview_searchwidget_admin'; |
|
| 203 | + $required[ ] = 'gravityview_searchwidget_admin'; |
|
| 204 | 204 | return $required; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -213,24 +213,24 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public static function get_searchable_fields() { |
| 215 | 215 | |
| 216 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 216 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 217 | 217 | exit( '0' ); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $form = ''; |
| 221 | 221 | |
| 222 | 222 | // Fetch the form for the current View |
| 223 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 223 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 224 | 224 | |
| 225 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 225 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 226 | 226 | |
| 227 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 227 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 228 | 228 | |
| 229 | - $form = (int) $_POST['formid']; |
|
| 229 | + $form = (int)$_POST[ 'formid' ]; |
|
| 230 | 230 | |
| 231 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 231 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 232 | 232 | |
| 233 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 233 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 234 | 234 | |
| 235 | 235 | } |
| 236 | 236 | |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | ) |
| 279 | 279 | ); |
| 280 | 280 | |
| 281 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 282 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
| 281 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 282 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | if ( ! empty( $fields ) ) { |
@@ -288,13 +288,13 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | foreach ( $fields as $id => $field ) { |
| 290 | 290 | |
| 291 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 291 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 292 | 292 | continue; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 295 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 296 | 296 | |
| 297 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 297 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | public static function get_search_input_types( $id = '', $field_type = null ) { |
| 317 | 317 | |
| 318 | 318 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 319 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 319 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 320 | 320 | $input_type = 'boolean'; // on/off checkbox |
| 321 | 321 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 322 | 322 | $input_type = 'multi'; //multiselect |
@@ -358,19 +358,19 @@ discard block |
||
| 358 | 358 | $post_id = 0; |
| 359 | 359 | |
| 360 | 360 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 361 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 362 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 361 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 362 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 363 | 363 | } |
| 364 | 364 | // We're in the WordPress Widget context, and the base View ID should be used |
| 365 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 366 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 365 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 366 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 370 | 370 | |
| 371 | 371 | // Add hidden fields to the search form |
| 372 | 372 | foreach ( $args as $key => $value ) { |
| 373 | - $search_fields[] = array( |
|
| 373 | + $search_fields[ ] = array( |
|
| 374 | 374 | 'name' => $key, |
| 375 | 375 | 'input' => 'hidden', |
| 376 | 376 | 'value' => $value, |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | public function filter_entries( $search_criteria ) { |
| 393 | 393 | |
| 394 | - if( 'post' === $this->search_method ) { |
|
| 394 | + if ( 'post' === $this->search_method ) { |
|
| 395 | 395 | $get = $_POST; |
| 396 | 396 | } else { |
| 397 | 397 | $get = $_GET; |
@@ -408,15 +408,15 @@ discard block |
||
| 408 | 408 | $get = gv_map_deep( $get, 'urldecode' ); |
| 409 | 409 | |
| 410 | 410 | // add free search |
| 411 | - if ( ! empty( $get['gv_search'] ) ) { |
|
| 411 | + if ( ! empty( $get[ 'gv_search' ] ) ) { |
|
| 412 | 412 | |
| 413 | 413 | // Search for a piece |
| 414 | - $words = explode( ' ', $get['gv_search'] ); |
|
| 414 | + $words = explode( ' ', $get[ 'gv_search' ] ); |
|
| 415 | 415 | |
| 416 | 416 | $words = array_filter( $words ); |
| 417 | 417 | |
| 418 | 418 | foreach ( $words as $word ) { |
| 419 | - $search_criteria['field_filters'][] = array( |
|
| 419 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 420 | 420 | 'key' => null, // The field ID to search |
| 421 | 421 | 'value' => $word, // The value to search |
| 422 | 422 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -425,8 +425,8 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | //start date & end date |
| 428 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
| 429 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
| 428 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
| 429 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
| 430 | 430 | |
| 431 | 431 | /** |
| 432 | 432 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -441,16 +441,16 @@ discard block |
||
| 441 | 441 | /** |
| 442 | 442 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
| 443 | 443 | */ |
| 444 | - if( !empty( $curr_start ) ) { |
|
| 445 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 444 | + if ( ! empty( $curr_start ) ) { |
|
| 445 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 446 | 446 | } |
| 447 | - if( !empty( $curr_end ) ) { |
|
| 448 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 447 | + if ( ! empty( $curr_end ) ) { |
|
| 448 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | // search for a specific entry ID |
| 452 | 452 | if ( ! empty( $get[ 'gv_id' ] ) ) { |
| 453 | - $search_criteria['field_filters'][] = array( |
|
| 453 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 454 | 454 | 'key' => 'id', |
| 455 | 455 | 'value' => absint( $get[ 'gv_id' ] ), |
| 456 | 456 | 'operator' => '=', |
@@ -459,36 +459,36 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | // search for a specific Created_by ID |
| 461 | 461 | if ( ! empty( $get[ 'gv_by' ] ) ) { |
| 462 | - $search_criteria['field_filters'][] = array( |
|
| 462 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 463 | 463 | 'key' => 'created_by', |
| 464 | - 'value' => absint( $get['gv_by'] ), |
|
| 464 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
| 465 | 465 | 'operator' => '=', |
| 466 | 466 | ); |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | |
| 470 | 470 | // Get search mode passed in URL |
| 471 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 471 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 472 | 472 | |
| 473 | 473 | // get the other search filters |
| 474 | 474 | foreach ( $get as $key => $value ) { |
| 475 | 475 | |
| 476 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
| 476 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
| 477 | 477 | continue; |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | // could return simple filter or multiple filters |
| 481 | 481 | $filter = $this->prepare_field_filter( $key, $value ); |
| 482 | 482 | |
| 483 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 484 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 483 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 484 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 485 | 485 | |
| 486 | 486 | // if date range type, set search mode to ALL |
| 487 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 487 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 488 | 488 | $mode = 'all'; |
| 489 | 489 | } |
| 490 | - } elseif( !empty( $filter ) ) { |
|
| 491 | - $search_criteria['field_filters'][] = $filter; |
|
| 490 | + } elseif ( ! empty( $filter ) ) { |
|
| 491 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | * @since 1.5.1 |
| 498 | 498 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 499 | 499 | */ |
| 500 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 500 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 501 | 501 | |
| 502 | 502 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
| 503 | 503 | |
@@ -535,11 +535,11 @@ discard block |
||
| 535 | 535 | 'value' => $value, |
| 536 | 536 | ); |
| 537 | 537 | |
| 538 | - switch ( $form_field['type'] ) { |
|
| 538 | + switch ( $form_field[ 'type' ] ) { |
|
| 539 | 539 | |
| 540 | 540 | case 'select': |
| 541 | 541 | case 'radio': |
| 542 | - $filter['operator'] = 'is'; |
|
| 542 | + $filter[ 'operator' ] = 'is'; |
|
| 543 | 543 | break; |
| 544 | 544 | |
| 545 | 545 | case 'post_category': |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | foreach ( $value as $val ) { |
| 555 | 555 | $cat = get_term( $val, 'category' ); |
| 556 | - $filter[] = array( |
|
| 556 | + $filter[ ] = array( |
|
| 557 | 557 | 'key' => $field_id, |
| 558 | 558 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 559 | 559 | 'operator' => 'is', |
@@ -572,18 +572,18 @@ discard block |
||
| 572 | 572 | $filter = array(); |
| 573 | 573 | |
| 574 | 574 | foreach ( $value as $val ) { |
| 575 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
| 575 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | break; |
| 579 | 579 | |
| 580 | 580 | case 'checkbox': |
| 581 | 581 | // convert checkbox on/off into the correct search filter |
| 582 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
| 583 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
| 584 | - if ( $input['id'] == $field_id ) { |
|
| 585 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
| 586 | - $filter['operator'] = 'is'; |
|
| 582 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
| 583 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
| 584 | + if ( $input[ 'id' ] == $field_id ) { |
|
| 585 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
| 586 | + $filter[ 'operator' ] = 'is'; |
|
| 587 | 587 | break; |
| 588 | 588 | } |
| 589 | 589 | } |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | $filter = array(); |
| 594 | 594 | |
| 595 | 595 | foreach ( $value as $val ) { |
| 596 | - $filter[] = array( |
|
| 596 | + $filter[ ] = array( |
|
| 597 | 597 | 'key' => $field_id, |
| 598 | 598 | 'value' => $val, |
| 599 | 599 | 'operator' => 'is', |
@@ -614,9 +614,9 @@ discard block |
||
| 614 | 614 | foreach ( $words as $word ) { |
| 615 | 615 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 616 | 616 | // Keep the same key for each filter |
| 617 | - $filter['value'] = $word; |
|
| 617 | + $filter[ 'value' ] = $word; |
|
| 618 | 618 | // Add a search for the value |
| 619 | - $filters[] = $filter; |
|
| 619 | + $filters[ ] = $filter; |
|
| 620 | 620 | } |
| 621 | 621 | } |
| 622 | 622 | |
@@ -643,19 +643,19 @@ discard block |
||
| 643 | 643 | * @since 1.16.3 |
| 644 | 644 | * Safeguard until GF implements '<=' operator |
| 645 | 645 | */ |
| 646 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 646 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 647 | 647 | $operator = '<'; |
| 648 | 648 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | - $filter[] = array( |
|
| 651 | + $filter[ ] = array( |
|
| 652 | 652 | 'key' => $field_id, |
| 653 | 653 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
| 654 | 654 | 'operator' => $operator, |
| 655 | 655 | ); |
| 656 | 656 | } |
| 657 | 657 | } else { |
| 658 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 658 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | break; |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | 'ymd_dot' => 'Y.m.d', |
| 687 | 687 | ); |
| 688 | 688 | |
| 689 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 689 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 690 | 690 | $format = $datepicker[ $field->dateFormat ]; |
| 691 | 691 | } |
| 692 | 692 | |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | public function add_template_path( $file_paths ) { |
| 718 | 718 | |
| 719 | 719 | // Index 100 is the default GravityView template path. |
| 720 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 720 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 721 | 721 | |
| 722 | 722 | return $file_paths; |
| 723 | 723 | } |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | // get configured search fields |
| 742 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 742 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 743 | 743 | |
| 744 | 744 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 745 | 745 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -753,24 +753,24 @@ discard block |
||
| 753 | 753 | |
| 754 | 754 | $updated_field = $field; |
| 755 | 755 | |
| 756 | - if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { |
|
| 756 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) { |
|
| 757 | 757 | $has_date = true; |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 761 | 761 | |
| 762 | - switch ( $field['field'] ) { |
|
| 762 | + switch ( $field[ 'field' ] ) { |
|
| 763 | 763 | |
| 764 | 764 | case 'search_all': |
| 765 | - $updated_field['key'] = 'search_all'; |
|
| 766 | - $updated_field['input'] = 'search_all'; |
|
| 767 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 765 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 766 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 767 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 768 | 768 | break; |
| 769 | 769 | |
| 770 | 770 | case 'entry_date': |
| 771 | - $updated_field['key'] = 'entry_date'; |
|
| 772 | - $updated_field['input'] = 'entry_date'; |
|
| 773 | - $updated_field['value'] = array( |
|
| 771 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 772 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 773 | + $updated_field[ 'value' ] = array( |
|
| 774 | 774 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 775 | 775 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 776 | 776 | ); |
@@ -778,16 +778,16 @@ discard block |
||
| 778 | 778 | break; |
| 779 | 779 | |
| 780 | 780 | case 'entry_id': |
| 781 | - $updated_field['key'] = 'entry_id'; |
|
| 782 | - $updated_field['input'] = 'entry_id'; |
|
| 783 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 781 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 782 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 783 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 784 | 784 | break; |
| 785 | 785 | |
| 786 | 786 | case 'created_by': |
| 787 | - $updated_field['key'] = 'created_by'; |
|
| 788 | - $updated_field['name'] = 'gv_by'; |
|
| 789 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 790 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 787 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 788 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 789 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 790 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 791 | 791 | break; |
| 792 | 792 | } |
| 793 | 793 | |
@@ -805,16 +805,16 @@ discard block |
||
| 805 | 805 | */ |
| 806 | 806 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
| 807 | 807 | |
| 808 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 808 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 809 | 809 | |
| 810 | 810 | /** @since 1.14 */ |
| 811 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 811 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 812 | 812 | |
| 813 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 813 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 814 | 814 | |
| 815 | 815 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 816 | 816 | |
| 817 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 817 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 818 | 818 | |
| 819 | 819 | if ( $has_date ) { |
| 820 | 820 | // enqueue datepicker stuff only if needed! |
@@ -834,10 +834,10 @@ discard block |
||
| 834 | 834 | public static function get_search_class( $custom_class = '' ) { |
| 835 | 835 | $gravityview_view = GravityView_View::getInstance(); |
| 836 | 836 | |
| 837 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 837 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 838 | 838 | |
| 839 | - if ( ! empty( $custom_class ) ) { |
|
| 840 | - $search_class .= ' '.$custom_class; |
|
| 839 | + if ( ! empty( $custom_class ) ) { |
|
| 840 | + $search_class .= ' ' . $custom_class; |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | /** |
@@ -880,11 +880,11 @@ discard block |
||
| 880 | 880 | |
| 881 | 881 | $label = rgget( 'label', $field ); |
| 882 | 882 | |
| 883 | - if( '' === $label ) { |
|
| 883 | + if ( '' === $label ) { |
|
| 884 | 884 | |
| 885 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 885 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 886 | 886 | |
| 887 | - switch( $field['field'] ) { |
|
| 887 | + switch ( $field[ 'field' ] ) { |
|
| 888 | 888 | case 'search_all': |
| 889 | 889 | $label = __( 'Search Entries:', 'gravityview' ); |
| 890 | 890 | break; |
@@ -902,10 +902,10 @@ discard block |
||
| 902 | 902 | break; |
| 903 | 903 | default: |
| 904 | 904 | // If this is a field input, not a field |
| 905 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 905 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 906 | 906 | |
| 907 | 907 | // Get the label for the field in question, which returns an array |
| 908 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 908 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 909 | 909 | |
| 910 | 910 | // Get the item with the `label` key |
| 911 | 911 | $values = wp_list_pluck( $items, 'label' ); |
@@ -942,32 +942,32 @@ discard block |
||
| 942 | 942 | $form = $gravityview_view->getForm(); |
| 943 | 943 | |
| 944 | 944 | // for advanced field ids (eg, first name / last name ) |
| 945 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 945 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 946 | 946 | |
| 947 | 947 | // get searched value from $_GET/$_POST (string or array) |
| 948 | 948 | $value = $this->rgget_or_rgpost( $name ); |
| 949 | 949 | |
| 950 | 950 | // get form field details |
| 951 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 951 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 952 | 952 | |
| 953 | 953 | $filter = array( |
| 954 | - 'key' => $field['field'], |
|
| 954 | + 'key' => $field[ 'field' ], |
|
| 955 | 955 | 'name' => $name, |
| 956 | 956 | 'label' => self::get_field_label( $field, $form_field ), |
| 957 | - 'input' => $field['input'], |
|
| 957 | + 'input' => $field[ 'input' ], |
|
| 958 | 958 | 'value' => $value, |
| 959 | - 'type' => $form_field['type'], |
|
| 959 | + 'type' => $form_field[ 'type' ], |
|
| 960 | 960 | ); |
| 961 | 961 | |
| 962 | 962 | // collect choices |
| 963 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 964 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 965 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 966 | - $filter['choices'] = $form_field['choices']; |
|
| 963 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 964 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 965 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 966 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 967 | 967 | } |
| 968 | 968 | |
| 969 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 970 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 969 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 970 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | return $filter; |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | |
| 992 | 992 | $choices = array(); |
| 993 | 993 | foreach ( $users as $user ) { |
| 994 | - $choices[] = array( |
|
| 994 | + $choices[ ] = array( |
|
| 995 | 995 | 'value' => $user->ID, |
| 996 | 996 | 'text' => $user->display_name, |
| 997 | 997 | ); |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | */ |
| 1046 | 1046 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1047 | 1047 | |
| 1048 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1048 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1049 | 1049 | |
| 1050 | 1050 | return $js_dependencies; |
| 1051 | 1051 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | 'isRTL' => is_rtl(), |
| 1090 | 1090 | ), $view_data ); |
| 1091 | 1091 | |
| 1092 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1092 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1093 | 1093 | |
| 1094 | 1094 | return $localizations; |
| 1095 | 1095 | |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1113 | 1113 | |
| 1114 | 1114 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1115 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1115 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1116 | 1116 | |
| 1117 | 1117 | /** |
| 1118 | 1118 | * @filter `gravityview_search_datepicker_class` |