@@ -51,6 +51,9 @@ |
||
| 51 | 51 | // hold widget View options |
| 52 | 52 | private $widget_options; |
| 53 | 53 | |
| 54 | + /** |
|
| 55 | + * @param string $widget_id |
|
| 56 | + */ |
|
| 54 | 57 | function __construct( $widget_label , $widget_id , $defaults = array(), $settings = array() ) { |
| 55 | 58 | |
| 56 | 59 | |
@@ -116,12 +116,12 @@ |
||
| 116 | 116 | return $settings; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * @return string |
|
| 121 | - */ |
|
| 122 | - public function get_widget_id() { |
|
| 123 | - return $this->widget_id; |
|
| 124 | - } |
|
| 119 | + /** |
|
| 120 | + * @return string |
|
| 121 | + */ |
|
| 122 | + public function get_widget_id() { |
|
| 123 | + return $this->widget_id; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * Get the widget settings |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | // hold widget View options |
| 52 | 52 | private $widget_options; |
| 53 | 53 | |
| 54 | - function __construct( $widget_label , $widget_id , $defaults = array(), $settings = array() ) { |
|
| 54 | + function __construct( $widget_label, $widget_id, $defaults = array(), $settings = array() ) { |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * The shortcode name is set to the lowercase name of the widget class, unless overridden by the class specifying a different value for $shortcode_name |
| 59 | 59 | * @var string |
| 60 | 60 | */ |
| 61 | - $this->shortcode_name = !isset( $this->shortcode_name ) ? strtolower( get_class($this) ) : $this->shortcode_name; |
|
| 61 | + $this->shortcode_name = ! isset( $this->shortcode_name ) ? strtolower( get_class( $this ) ) : $this->shortcode_name; |
|
| 62 | 62 | |
| 63 | 63 | $this->widget_label = $widget_label; |
| 64 | 64 | $this->widget_id = $widget_id; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->settings = wp_parse_args( $settings, $this->settings ); |
| 70 | 70 | |
| 71 | 71 | // register widgets to be listed in the View Configuration |
| 72 | - add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget') ); |
|
| 72 | + add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget' ) ); |
|
| 73 | 73 | |
| 74 | 74 | // widget options |
| 75 | 75 | add_filter( 'gravityview_template_widget_options', array( $this, 'assign_widget_options' ), 10, 3 ); |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | add_action( "gravityview_render_widget_{$widget_id}", array( $this, 'render_frontend' ), 10, 1 ); |
| 79 | 79 | |
| 80 | 80 | // register shortcodes |
| 81 | - add_action( 'wp', array( $this, 'add_shortcode') ); |
|
| 81 | + add_action( 'wp', array( $this, 'add_shortcode' ) ); |
|
| 82 | 82 | |
| 83 | 83 | // Use shortcodes in text widgets. |
| 84 | - add_filter('widget_text', array( $this, 'maybe_do_shortcode' ) ); |
|
| 84 | + add_filter( 'widget_text', array( $this, 'maybe_do_shortcode' ) ); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | * @param boolean $enable_custom_class False by default. Return true if you want to enable. |
| 100 | 100 | * @param GravityView_Widget $this Current instance of GravityView_Widget |
| 101 | 101 | */ |
| 102 | - $enable_custom_class = apply_filters('gravityview/widget/enable_custom_class', false, $this ); |
|
| 102 | + $enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this ); |
|
| 103 | 103 | |
| 104 | - if( $enable_custom_class ) { |
|
| 104 | + if ( $enable_custom_class ) { |
|
| 105 | 105 | |
| 106 | - $settings['custom_class'] = array( |
|
| 106 | + $settings[ 'custom_class' ] = array( |
|
| 107 | 107 | 'type' => 'text', |
| 108 | 108 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
| 109 | - 'desc' => __( 'This class will be added to the widget container', 'gravityview'), |
|
| 109 | + 'desc' => __( 'This class will be added to the widget container', 'gravityview' ), |
|
| 110 | 110 | 'value' => '', |
| 111 | 111 | 'merge_tags' => true, |
| 112 | 112 | ); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @return array|null Settings array; NULL if not set |
| 129 | 129 | */ |
| 130 | 130 | public function get_settings() { |
| 131 | - return !empty( $this->settings ) ? $this->settings : NULL; |
|
| 131 | + return ! empty( $this->settings ) ? $this->settings : NULL; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | public function get_setting( $key ) { |
| 140 | 140 | $setting = NULL; |
| 141 | 141 | |
| 142 | - if( isset( $this->settings ) && is_array( $this->settings ) ) { |
|
| 142 | + if ( isset( $this->settings ) && is_array( $this->settings ) ) { |
|
| 143 | 143 | $setting = isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : NULL; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | function maybe_do_shortcode( $text, $widget = NULL ) { |
| 156 | 156 | |
| 157 | - if( !empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) { |
|
| 157 | + if ( ! empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) { |
|
| 158 | 158 | return do_shortcode( $text ); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -176,28 +176,28 @@ discard block |
||
| 176 | 176 | function add_shortcode( $run_on_singular = true ) { |
| 177 | 177 | global $post; |
| 178 | 178 | |
| 179 | - if( GravityView_Plugin::is_admin() ) { return; } |
|
| 179 | + if ( GravityView_Plugin::is_admin() ) { return; } |
|
| 180 | 180 | |
| 181 | - if( empty( $this->shortcode_name ) ) { return; } |
|
| 181 | + if ( empty( $this->shortcode_name ) ) { return; } |
|
| 182 | 182 | |
| 183 | 183 | // If the widget shouldn't output on single entries, don't show it |
| 184 | - if( empty( $this->show_on_single ) && class_exists('GravityView_frontend') && GravityView_frontend::is_single_entry() ) { |
|
| 185 | - do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class($this)) ); |
|
| 184 | + if ( empty( $this->show_on_single ) && class_exists( 'GravityView_frontend' ) && GravityView_frontend::is_single_entry() ) { |
|
| 185 | + do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class( $this ) ) ); |
|
| 186 | 186 | |
| 187 | 187 | add_shortcode( $this->shortcode_name, '__return_null' ); |
| 188 | 188 | return; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
| 192 | - if( !has_gravityview_shortcode( $post ) ) { |
|
| 192 | + if ( ! has_gravityview_shortcode( $post ) ) { |
|
| 193 | 193 | |
| 194 | - do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class($this)) ); |
|
| 194 | + do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class( $this ) ) ); |
|
| 195 | 195 | |
| 196 | 196 | add_shortcode( $this->shortcode_name, '__return_null' ); |
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') ); |
|
| 200 | + add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) ); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | function register_widget( $widgets ) { |
| 209 | 209 | $widgets[ $this->widget_id ] = array( |
| 210 | - 'label' => $this->widget_label , |
|
| 210 | + 'label' => $this->widget_label, |
|
| 211 | 211 | 'description' => $this->widget_description, |
| 212 | 212 | 'subtitle' => $this->widget_subtitle, |
| 213 | 213 | ); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public function assign_widget_options( $options = array(), $template = '', $widget = '' ) { |
| 226 | 226 | |
| 227 | - if( $this->widget_id === $widget ) { |
|
| 227 | + if ( $this->widget_id === $widget ) { |
|
| 228 | 228 | $options = array_merge( $options, $this->settings ); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @return void |
| 239 | 239 | */ |
| 240 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 240 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 241 | 241 | // to be defined by child class |
| 242 | - if( !$this->pre_render_frontend() ) { |
|
| 242 | + if ( ! $this->pre_render_frontend() ) { |
|
| 243 | 243 | return; |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -251,8 +251,8 @@ discard block |
||
| 251 | 251 | public function pre_render_frontend() { |
| 252 | 252 | $gravityview_view = GravityView_View::getInstance(); |
| 253 | 253 | |
| 254 | - if( empty( $gravityview_view ) ) { |
|
| 255 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class($this)) ); |
|
| 254 | + if ( empty( $gravityview_view ) ) { |
|
| 255 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class( $this ) ) ); |
|
| 256 | 256 | return false; |
| 257 | 257 | } |
| 258 | 258 | |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | $hide_until_search = apply_filters( 'gravityview/widget/hide_until_searched', $gravityview_view->hide_until_searched, $this ); |
| 265 | 265 | |
| 266 | - if( $hide_until_search ) { |
|
| 267 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class($this)) ); |
|
| 266 | + if ( $hide_until_search ) { |
|
| 267 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class( $this ) ) ); |
|
| 268 | 268 | return false; |
| 269 | 269 | } |
| 270 | 270 | |
@@ -993,7 +993,7 @@ |
||
| 993 | 993 | /** |
| 994 | 994 | * Modify the array passed to wp_localize_script() |
| 995 | 995 | * |
| 996 | - * @param array $js_localization The data padded to the Javascript file |
|
| 996 | + * @param array $localizations The data padded to the Javascript file |
|
| 997 | 997 | * @param array $view_data View data array with View settings |
| 998 | 998 | * |
| 999 | 999 | * @return array |
@@ -622,7 +622,7 @@ |
||
| 622 | 622 | 'ymd_dot' => 'Y.m.d', |
| 623 | 623 | ); |
| 624 | 624 | |
| 625 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 625 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 626 | 626 | $format = $datepicker[ $field->dateFormat ]; |
| 627 | 627 | } |
| 628 | 628 | |
@@ -386,14 +386,14 @@ |
||
| 386 | 386 | $curr_start = esc_attr( rgget( 'gv_start' ) ); |
| 387 | 387 | $curr_end = esc_attr( rgget( 'gv_end' ) ); |
| 388 | 388 | |
| 389 | - /** |
|
| 390 | - * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
|
| 391 | - * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php) |
|
| 392 | - * @since 1.12 |
|
| 393 | - * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true |
|
| 394 | - * @param[in] string $context Where the filter is being called from. `search` in this case. |
|
| 395 | - */ |
|
| 396 | - $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); |
|
| 389 | + /** |
|
| 390 | + * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
|
| 391 | + * date_created is stored in UTC format. Convert search date into UTC (also used on templates/fields/date_created.php) |
|
| 392 | + * @since 1.12 |
|
| 393 | + * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true |
|
| 394 | + * @param[in] string $context Where the filter is being called from. `search` in this case. |
|
| 395 | + */ |
|
| 396 | + $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); |
|
| 397 | 397 | |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | 'type' => 'radio', |
| 57 | 57 | 'full_width' => true, |
| 58 | 58 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
| 59 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
| 59 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
| 60 | 60 | 'value' => 'any', |
| 61 | 61 | 'class' => 'hide-if-js', |
| 62 | 62 | 'options' => array( |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 112 | 112 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 113 | 113 | |
| 114 | - 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 ); |
|
| 114 | + 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 ); |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * Add admin script to the whitelist |
| 164 | 164 | */ |
| 165 | 165 | public function register_no_conflict( $required ) { |
| 166 | - $required[] = 'gravityview_searchwidget_admin'; |
|
| 166 | + $required[ ] = 'gravityview_searchwidget_admin'; |
|
| 167 | 167 | return $required; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -176,24 +176,24 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public static function get_searchable_fields() { |
| 178 | 178 | |
| 179 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 179 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 180 | 180 | exit( '0' ); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $form = ''; |
| 184 | 184 | |
| 185 | 185 | // Fetch the form for the current View |
| 186 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 186 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 187 | 187 | |
| 188 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 188 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 189 | 189 | |
| 190 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 190 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 191 | 191 | |
| 192 | - $form = (int) $_POST['formid']; |
|
| 192 | + $form = (int)$_POST[ 'formid' ]; |
|
| 193 | 193 | |
| 194 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 194 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 195 | 195 | |
| 196 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 196 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 197 | 197 | |
| 198 | 198 | } |
| 199 | 199 | |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | ) |
| 242 | 242 | ); |
| 243 | 243 | |
| 244 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 245 | - $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'] ); |
|
| 244 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 245 | + $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' ] ); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | if ( ! empty( $fields ) ) { |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | foreach ( $fields as $id => $field ) { |
| 253 | 253 | |
| 254 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 254 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 255 | 255 | continue; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 258 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 259 | 259 | |
| 260 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 260 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | public static function get_search_input_types( $id = '', $field_type = null ) { |
| 280 | 280 | |
| 281 | 281 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 282 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 282 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 283 | 283 | $input_type = 'boolean'; // on/off checkbox |
| 284 | 284 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 285 | 285 | $input_type = 'multi'; //multiselect |
@@ -321,19 +321,19 @@ discard block |
||
| 321 | 321 | $post_id = 0; |
| 322 | 322 | |
| 323 | 323 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 324 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 325 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 324 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 325 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 326 | 326 | } |
| 327 | 327 | // We're in the WordPress Widget context, and the base View ID should be used |
| 328 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 329 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 328 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 329 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 333 | 333 | |
| 334 | 334 | // Add hidden fields to the search form |
| 335 | 335 | foreach ( $args as $key => $value ) { |
| 336 | - $search_fields[] = array( |
|
| 336 | + $search_fields[ ] = array( |
|
| 337 | 337 | 'name' => $key, |
| 338 | 338 | 'input' => 'hidden', |
| 339 | 339 | 'value' => $value, |
@@ -365,15 +365,15 @@ discard block |
||
| 365 | 365 | $get = array_map( 'urldecode', $get ); |
| 366 | 366 | |
| 367 | 367 | // add free search |
| 368 | - if ( ! empty( $get['gv_search'] ) ) { |
|
| 368 | + if ( ! empty( $get[ 'gv_search' ] ) ) { |
|
| 369 | 369 | |
| 370 | 370 | // Search for a piece |
| 371 | - $words = explode( ' ', $get['gv_search'] ); |
|
| 371 | + $words = explode( ' ', $get[ 'gv_search' ] ); |
|
| 372 | 372 | |
| 373 | 373 | $words = array_filter( $words ); |
| 374 | 374 | |
| 375 | 375 | foreach ( $words as $word ) { |
| 376 | - $search_criteria['field_filters'][] = array( |
|
| 376 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 377 | 377 | 'key' => null, // The field ID to search |
| 378 | 378 | 'value' => $word, // The value to search |
| 379 | 379 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -398,16 +398,16 @@ discard block |
||
| 398 | 398 | /** |
| 399 | 399 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
| 400 | 400 | */ |
| 401 | - if( !empty( $curr_start ) ) { |
|
| 402 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 401 | + if ( ! empty( $curr_start ) ) { |
|
| 402 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 403 | 403 | } |
| 404 | - if( !empty( $curr_end ) ) { |
|
| 405 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 404 | + if ( ! empty( $curr_end ) ) { |
|
| 405 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | // search for a specific entry ID |
| 409 | 409 | if ( ! empty( $get[ 'gv_id' ] ) ) { |
| 410 | - $search_criteria['field_filters'][] = array( |
|
| 410 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 411 | 411 | 'key' => 'id', |
| 412 | 412 | 'value' => absint( $get[ 'gv_id' ] ), |
| 413 | 413 | 'operator' => '=', |
@@ -416,9 +416,9 @@ discard block |
||
| 416 | 416 | |
| 417 | 417 | // search for a specific Created_by ID |
| 418 | 418 | if ( ! empty( $get[ 'gv_by' ] ) ) { |
| 419 | - $search_criteria['field_filters'][] = array( |
|
| 419 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 420 | 420 | 'key' => 'created_by', |
| 421 | - 'value' => absint( $get['gv_by'] ), |
|
| 421 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
| 422 | 422 | 'operator' => '=', |
| 423 | 423 | ); |
| 424 | 424 | } |
@@ -430,22 +430,22 @@ discard block |
||
| 430 | 430 | // get the other search filters |
| 431 | 431 | foreach ( $get as $key => $value ) { |
| 432 | 432 | |
| 433 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
| 433 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
| 434 | 434 | continue; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | // could return simple filter or multiple filters |
| 438 | 438 | $filter = $this->prepare_field_filter( $key, $value ); |
| 439 | 439 | |
| 440 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 441 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 440 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 441 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 442 | 442 | |
| 443 | 443 | // if date range type, set search mode to ALL |
| 444 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>', '<' ) ) ) { |
|
| 444 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>', '<' ) ) ) { |
|
| 445 | 445 | $mode = 'all'; |
| 446 | 446 | } |
| 447 | - } elseif( !empty( $filter ) ) { |
|
| 448 | - $search_criteria['field_filters'][] = $filter; |
|
| 447 | + } elseif ( ! empty( $filter ) ) { |
|
| 448 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * @since 1.5.1 |
| 455 | 455 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 456 | 456 | */ |
| 457 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 457 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 458 | 458 | |
| 459 | 459 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
| 460 | 460 | |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | 'value' => _wp_specialchars( $value ), // Gravity Forms encodes ampersands but not quotes |
| 491 | 491 | ); |
| 492 | 492 | |
| 493 | - switch ( $form_field['type'] ) { |
|
| 493 | + switch ( $form_field[ 'type' ] ) { |
|
| 494 | 494 | |
| 495 | 495 | case 'select': |
| 496 | 496 | case 'radio': |
| 497 | - $filter['operator'] = 'is'; |
|
| 497 | + $filter[ 'operator' ] = 'is'; |
|
| 498 | 498 | break; |
| 499 | 499 | |
| 500 | 500 | case 'post_category': |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | |
| 509 | 509 | foreach ( $value as $val ) { |
| 510 | 510 | $cat = get_term( $val, 'category' ); |
| 511 | - $filter[] = array( |
|
| 511 | + $filter[ ] = array( |
|
| 512 | 512 | 'key' => $field_id, |
| 513 | 513 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 514 | 514 | 'operator' => 'is', |
@@ -527,18 +527,18 @@ discard block |
||
| 527 | 527 | $filter = array(); |
| 528 | 528 | |
| 529 | 529 | foreach ( $value as $val ) { |
| 530 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
| 530 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | break; |
| 534 | 534 | |
| 535 | 535 | case 'checkbox': |
| 536 | 536 | // convert checkbox on/off into the correct search filter |
| 537 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
| 538 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
| 539 | - if ( $input['id'] == $field_id ) { |
|
| 540 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
| 541 | - $filter['operator'] = 'is'; |
|
| 537 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
| 538 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
| 539 | + if ( $input[ 'id' ] == $field_id ) { |
|
| 540 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
| 541 | + $filter[ 'operator' ] = 'is'; |
|
| 542 | 542 | break; |
| 543 | 543 | } |
| 544 | 544 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | $filter = array(); |
| 549 | 549 | |
| 550 | 550 | foreach ( $value as $val ) { |
| 551 | - $filter[] = array( |
|
| 551 | + $filter[ ] = array( |
|
| 552 | 552 | 'key' => $field_id, |
| 553 | 553 | 'value' => $val, |
| 554 | 554 | 'operator' => 'is', |
@@ -569,9 +569,9 @@ discard block |
||
| 569 | 569 | foreach ( $words as $word ) { |
| 570 | 570 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 571 | 571 | // Keep the same key for each filter |
| 572 | - $filter['value'] = $word; |
|
| 572 | + $filter[ 'value' ] = $word; |
|
| 573 | 573 | // Add a search for the value |
| 574 | - $filters[] = $filter; |
|
| 574 | + $filters[ ] = $filter; |
|
| 575 | 575 | } |
| 576 | 576 | } |
| 577 | 577 | |
@@ -593,14 +593,14 @@ discard block |
||
| 593 | 593 | } |
| 594 | 594 | $operator = 'start' === $k ? '>' : '<'; |
| 595 | 595 | |
| 596 | - $filter[] = array( |
|
| 596 | + $filter[ ] = array( |
|
| 597 | 597 | 'key' => $field_id, |
| 598 | 598 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
| 599 | 599 | 'operator' => $operator, |
| 600 | 600 | ); |
| 601 | 601 | } |
| 602 | 602 | } else { |
| 603 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 603 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | break; |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | 'ymd_dot' => 'Y.m.d', |
| 632 | 632 | ); |
| 633 | 633 | |
| 634 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 634 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 635 | 635 | $format = $datepicker[ $field->dateFormat ]; |
| 636 | 636 | } |
| 637 | 637 | |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | public function add_template_path( $file_paths ) { |
| 663 | 663 | |
| 664 | 664 | // Index 100 is the default GravityView template path. |
| 665 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 665 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 666 | 666 | |
| 667 | 667 | return $file_paths; |
| 668 | 668 | } |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | // get configured search fields |
| 687 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 687 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 688 | 688 | |
| 689 | 689 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 690 | 690 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -698,24 +698,24 @@ discard block |
||
| 698 | 698 | |
| 699 | 699 | $updated_field = $field; |
| 700 | 700 | |
| 701 | - if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { |
|
| 701 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) { |
|
| 702 | 702 | $has_date = true; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 706 | 706 | |
| 707 | - switch ( $field['field'] ) { |
|
| 707 | + switch ( $field[ 'field' ] ) { |
|
| 708 | 708 | |
| 709 | 709 | case 'search_all': |
| 710 | - $updated_field['key'] = 'search_all'; |
|
| 711 | - $updated_field['input'] = 'search_all'; |
|
| 712 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_search' ) ) ); |
|
| 710 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 711 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 712 | + $updated_field[ 'value' ] = esc_attr( stripslashes_deep( rgget( 'gv_search' ) ) ); |
|
| 713 | 713 | break; |
| 714 | 714 | |
| 715 | 715 | case 'entry_date': |
| 716 | - $updated_field['key'] = 'entry_date'; |
|
| 717 | - $updated_field['input'] = 'entry_date'; |
|
| 718 | - $updated_field['value'] = array( |
|
| 716 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 717 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 718 | + $updated_field[ 'value' ] = array( |
|
| 719 | 719 | 'start' => esc_attr( stripslashes_deep( rgget( 'gv_start' ) ) ), |
| 720 | 720 | 'end' => esc_attr( stripslashes_deep( rgget( 'gv_end' ) ) ), |
| 721 | 721 | ); |
@@ -723,16 +723,16 @@ discard block |
||
| 723 | 723 | break; |
| 724 | 724 | |
| 725 | 725 | case 'entry_id': |
| 726 | - $updated_field['key'] = 'entry_id'; |
|
| 727 | - $updated_field['input'] = 'entry_id'; |
|
| 728 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_id' ) ) ); |
|
| 726 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 727 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 728 | + $updated_field[ 'value' ] = esc_attr( stripslashes_deep( rgget( 'gv_id' ) ) ); |
|
| 729 | 729 | break; |
| 730 | 730 | |
| 731 | 731 | case 'created_by': |
| 732 | - $updated_field['key'] = 'created_by'; |
|
| 733 | - $updated_field['name'] = 'gv_by'; |
|
| 734 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_by' ) ) ); |
|
| 735 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 732 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 733 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 734 | + $updated_field[ 'value' ] = esc_attr( stripslashes_deep( rgget( 'gv_by' ) ) ); |
|
| 735 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 736 | 736 | break; |
| 737 | 737 | } |
| 738 | 738 | |
@@ -750,16 +750,16 @@ discard block |
||
| 750 | 750 | */ |
| 751 | 751 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
| 752 | 752 | |
| 753 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 753 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 754 | 754 | |
| 755 | 755 | /** @since 1.14 */ |
| 756 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 756 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 757 | 757 | |
| 758 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 758 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 759 | 759 | |
| 760 | 760 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 761 | 761 | |
| 762 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 762 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 763 | 763 | |
| 764 | 764 | if ( $has_date ) { |
| 765 | 765 | // enqueue datepicker stuff only if needed! |
@@ -779,10 +779,10 @@ discard block |
||
| 779 | 779 | public static function get_search_class( $custom_class = '' ) { |
| 780 | 780 | $gravityview_view = GravityView_View::getInstance(); |
| 781 | 781 | |
| 782 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 782 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 783 | 783 | |
| 784 | - if ( ! empty( $custom_class ) ) { |
|
| 785 | - $search_class .= ' '.$custom_class; |
|
| 784 | + if ( ! empty( $custom_class ) ) { |
|
| 785 | + $search_class .= ' ' . $custom_class; |
|
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | /** |
@@ -825,11 +825,11 @@ discard block |
||
| 825 | 825 | |
| 826 | 826 | $label = rgget( 'label', $field ); |
| 827 | 827 | |
| 828 | - if( '' === $label ) { |
|
| 828 | + if ( '' === $label ) { |
|
| 829 | 829 | |
| 830 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 830 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 831 | 831 | |
| 832 | - switch( $field['field'] ) { |
|
| 832 | + switch ( $field[ 'field' ] ) { |
|
| 833 | 833 | case 'search_all': |
| 834 | 834 | $label = __( 'Search Entries:', 'gravityview' ); |
| 835 | 835 | break; |
@@ -847,10 +847,10 @@ discard block |
||
| 847 | 847 | break; |
| 848 | 848 | default: |
| 849 | 849 | // If this is a field input, not a field |
| 850 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 850 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 851 | 851 | |
| 852 | 852 | // Get the label for the field in question, which returns an array |
| 853 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 853 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 854 | 854 | |
| 855 | 855 | // Get the item with the `label` key |
| 856 | 856 | $values = wp_list_pluck( $items, 'label' ); |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | $form = $gravityview_view->getForm(); |
| 888 | 888 | |
| 889 | 889 | // for advanced field ids (eg, first name / last name ) |
| 890 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 890 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 891 | 891 | |
| 892 | 892 | // get searched value from $_GET (string or array) |
| 893 | 893 | $value = rgget( $name ); |
@@ -897,26 +897,26 @@ discard block |
||
| 897 | 897 | $value = is_array( $value ) ? array_map( 'urldecode', $value ) : urldecode( $value ); |
| 898 | 898 | |
| 899 | 899 | // get form field details |
| 900 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 900 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 901 | 901 | |
| 902 | 902 | $filter = array( |
| 903 | - 'key' => $field['field'], |
|
| 903 | + 'key' => $field[ 'field' ], |
|
| 904 | 904 | 'name' => $name, |
| 905 | 905 | 'label' => self::get_field_label( $field, $form_field ), |
| 906 | - 'input' => $field['input'], |
|
| 906 | + 'input' => $field[ 'input' ], |
|
| 907 | 907 | 'value' => _wp_specialchars( $value ), |
| 908 | - 'type' => $form_field['type'], |
|
| 908 | + 'type' => $form_field[ 'type' ], |
|
| 909 | 909 | ); |
| 910 | 910 | |
| 911 | 911 | // collect choices |
| 912 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 913 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 914 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 915 | - $filter['choices'] = $form_field['choices']; |
|
| 912 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 913 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 914 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 915 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 916 | 916 | } |
| 917 | 917 | |
| 918 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 919 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 918 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 919 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | return $filter; |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | |
| 941 | 941 | $choices = array(); |
| 942 | 942 | foreach ( $users as $user ) { |
| 943 | - $choices[] = array( |
|
| 943 | + $choices[ ] = array( |
|
| 944 | 944 | 'value' => $user->ID, |
| 945 | 945 | 'text' => $user->display_name, |
| 946 | 946 | ); |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | */ |
| 975 | 975 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 976 | 976 | |
| 977 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 977 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 978 | 978 | |
| 979 | 979 | return $js_dependencies; |
| 980 | 980 | } |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | 'isRTL' => is_rtl(), |
| 1019 | 1019 | ), $view_data ); |
| 1020 | 1020 | |
| 1021 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1021 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1022 | 1022 | |
| 1023 | 1023 | return $localizations; |
| 1024 | 1024 | |
@@ -1041,7 +1041,7 @@ discard block |
||
| 1041 | 1041 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1042 | 1042 | |
| 1043 | 1043 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1044 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1044 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1045 | 1045 | |
| 1046 | 1046 | /** |
| 1047 | 1047 | * @filter `gravityview_search_datepicker_class` |
@@ -176,6 +176,7 @@ |
||
| 176 | 176 | * Get the entries that will be shown in the current widget |
| 177 | 177 | * |
| 178 | 178 | * @param array $instance Settings for the current widget |
| 179 | + * @param string $form_id |
|
| 179 | 180 | * |
| 180 | 181 | * @return array $entries Multidimensional array of Gravity Forms entries |
| 181 | 182 | */ |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @file class-gravityview-recent-entries-widget.php |
|
| 4 | - */ |
|
| 3 | + * @file class-gravityview-recent-entries-widget.php |
|
| 4 | + */ |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * Class GravityView_Recent_Entries_Widget |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | // Get the settings for the View ID |
| 185 | 185 | $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
| 186 | 186 | |
| 187 | - // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
|
| 188 | - $criteria['context_view_id'] = $instance['view_id']; |
|
| 187 | + // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
|
| 188 | + $criteria['context_view_id'] = $instance['view_id']; |
|
| 189 | 189 | |
| 190 | 190 | $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
| 191 | 191 | $view_settings['id'] = $instance['view_id']; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | function __construct( ) { |
| 14 | 14 | |
| 15 | - $name = __('GravityView Recent Entries', 'gravityview'); |
|
| 15 | + $name = __( 'GravityView Recent Entries', 'gravityview' ); |
|
| 16 | 16 | |
| 17 | 17 | $widget_options = array( |
| 18 | 18 | 'description' => __( 'Display the most recent entries for a View', 'gravityview' ), |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | private function initialize() { |
| 27 | 27 | |
| 28 | - add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') ); |
|
| 28 | + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
| 29 | 29 | |
| 30 | 30 | add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) ); |
| 31 | 31 | |
@@ -38,21 +38,21 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | function ajax_get_view_merge_tag_data() { |
| 40 | 40 | |
| 41 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) { |
|
| 41 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) { |
|
| 42 | 42 | exit( false ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $form_id = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 45 | + $form_id = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 46 | 46 | |
| 47 | 47 | $form = RGFormsModel::get_form_meta( $form_id ); |
| 48 | 48 | |
| 49 | 49 | $output = array( |
| 50 | 50 | 'form' => array( |
| 51 | - 'id' => $form['id'], |
|
| 52 | - 'title' => $form['title'], |
|
| 53 | - 'fields' => $form['fields'], |
|
| 51 | + 'id' => $form[ 'id' ], |
|
| 52 | + 'title' => $form[ 'title' ], |
|
| 53 | + 'fields' => $form[ 'fields' ], |
|
| 54 | 54 | ), |
| 55 | - 'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ), |
|
| 55 | + 'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ), |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | echo json_encode( $output ); |
@@ -68,19 +68,19 @@ discard block |
||
| 68 | 68 | function admin_enqueue_scripts() { |
| 69 | 69 | global $pagenow; |
| 70 | 70 | |
| 71 | - if( $pagenow === 'widgets.php' ) { |
|
| 71 | + if ( $pagenow === 'widgets.php' ) { |
|
| 72 | 72 | |
| 73 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 73 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 74 | 74 | |
| 75 | 75 | GravityView_Admin_Views::enqueue_gravity_forms_scripts(); |
| 76 | 76 | |
| 77 | - wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
| 77 | + wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
| 78 | 78 | |
| 79 | 79 | wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
| 80 | 80 | 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
| 81 | - )); |
|
| 81 | + ) ); |
|
| 82 | 82 | |
| 83 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version ); |
|
| 83 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version ); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | } |
@@ -95,19 +95,19 @@ discard block |
||
| 95 | 95 | function widget( $args, $instance ) { |
| 96 | 96 | |
| 97 | 97 | // Don't have the Customizer render too soon. |
| 98 | - if( empty( $instance['view_id'] ) ) { |
|
| 98 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
| 99 | 99 | return; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries'; |
|
| 103 | - $instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : ''; |
|
| 102 | + $args[ 'id' ] = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries'; |
|
| 103 | + $instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : ''; |
|
| 104 | 104 | |
| 105 | - $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] ); |
|
| 105 | + $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] ); |
|
| 106 | 106 | |
| 107 | - echo $args['before_widget']; |
|
| 107 | + echo $args[ 'before_widget' ]; |
|
| 108 | 108 | |
| 109 | - if ( !empty( $title ) ) { |
|
| 110 | - echo $args['before_title'] . $title . $args['after_title']; |
|
| 109 | + if ( ! empty( $title ) ) { |
|
| 110 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
| 129 | 129 | |
| 130 | - echo $args['after_widget']; |
|
| 130 | + echo $args[ 'after_widget' ]; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | private function get_output( $instance ) { |
| 143 | 143 | |
| 144 | - $form_id = gravityview_get_form_id( $instance['view_id'] ); |
|
| 144 | + $form_id = gravityview_get_form_id( $instance[ 'view_id' ] ); |
|
| 145 | 145 | |
| 146 | 146 | $form = gravityview_get_form( $form_id ); |
| 147 | 147 | |
@@ -151,13 +151,13 @@ discard block |
||
| 151 | 151 | * @since 1.6.1 |
| 152 | 152 | * @var int $entry_link_post_id The ID to use as the parent post for the entry |
| 153 | 153 | */ |
| 154 | - $entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id']; |
|
| 154 | + $entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ]; |
|
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | 157 | * Generate list output |
| 158 | 158 | * @since 1.7.2 |
| 159 | 159 | */ |
| 160 | - $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' ); |
|
| 160 | + $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget' ); |
|
| 161 | 161 | |
| 162 | 162 | $output = $List->get_output(); |
| 163 | 163 | |
@@ -182,30 +182,30 @@ discard block |
||
| 182 | 182 | private function get_entries( $instance, $form_id ) { |
| 183 | 183 | |
| 184 | 184 | // Get the settings for the View ID |
| 185 | - $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
|
| 185 | + $view_settings = gravityview_get_template_settings( $instance[ 'view_id' ] ); |
|
| 186 | 186 | |
| 187 | 187 | // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
| 188 | - $criteria['context_view_id'] = $instance['view_id']; |
|
| 188 | + $criteria[ 'context_view_id' ] = $instance[ 'view_id' ]; |
|
| 189 | 189 | |
| 190 | - $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
| 191 | - $view_settings['id'] = $instance['view_id']; |
|
| 192 | - $view_settings['page_size'] = $instance['limit']; |
|
| 190 | + $instance[ 'limit' ] = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10; |
|
| 191 | + $view_settings[ 'id' ] = $instance[ 'view_id' ]; |
|
| 192 | + $view_settings[ 'page_size' ] = $instance[ 'limit' ]; |
|
| 193 | 193 | |
| 194 | 194 | // Prepare paging criteria |
| 195 | - $criteria['paging'] = array( |
|
| 195 | + $criteria[ 'paging' ] = array( |
|
| 196 | 196 | 'offset' => 0, |
| 197 | - 'page_size' => $instance['limit'] |
|
| 197 | + 'page_size' => $instance[ 'limit' ] |
|
| 198 | 198 | ); |
| 199 | 199 | |
| 200 | 200 | // Prepare Search Criteria |
| 201 | - $criteria['search_criteria'] = array( 'field_filters' => array() ); |
|
| 202 | - $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']); |
|
| 203 | - $criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
| 201 | + $criteria[ 'search_criteria' ] = array( 'field_filters' => array() ); |
|
| 202 | + $criteria[ 'search_criteria' ] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria[ 'search_criteria' ] ); |
|
| 203 | + $criteria[ 'search_criteria' ][ 'status' ] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
| 204 | 204 | |
| 205 | 205 | /** |
| 206 | 206 | * Modify the search parameters before the entries are fetched |
| 207 | 207 | */ |
| 208 | - $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
| 208 | + $criteria = apply_filters( 'gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
| 209 | 209 | |
| 210 | 210 | $results = GVCommon::get_entries( $form_id, $criteria ); |
| 211 | 211 | |
@@ -226,23 +226,23 @@ discard block |
||
| 226 | 226 | $instance = $new_instance; |
| 227 | 227 | |
| 228 | 228 | // Force positive number |
| 229 | - $instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] ); |
|
| 229 | + $instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] ); |
|
| 230 | 230 | |
| 231 | - $instance['view_id'] = intval( $instance['view_id'] ); |
|
| 231 | + $instance[ 'view_id' ] = intval( $instance[ 'view_id' ] ); |
|
| 232 | 232 | |
| 233 | - $instance['link_format'] = trim( rtrim( $instance['link_format'] ) ); |
|
| 233 | + $instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) ); |
|
| 234 | 234 | |
| 235 | - $instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format']; |
|
| 235 | + $instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ]; |
|
| 236 | 236 | |
| 237 | - $instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] ); |
|
| 237 | + $instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] ); |
|
| 238 | 238 | |
| 239 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] ); |
|
| 239 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
| 240 | 240 | |
| 241 | 241 | //check if post_id is a valid post with embedded View |
| 242 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
| 242 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
| 243 | 243 | |
| 244 | 244 | // Share that the widget isn't brand new |
| 245 | - $instance['updated'] = 1; |
|
| 245 | + $instance[ 'updated' ] = 1; |
|
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | 248 | * Modify the updated instance. This will allow for validating any added instance settings externally. |
@@ -264,22 +264,22 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | // Set up some default widget settings. |
| 266 | 266 | $defaults = array( |
| 267 | - 'title' => __('Recent Entries', 'gravityview'), |
|
| 267 | + 'title' => __( 'Recent Entries', 'gravityview' ), |
|
| 268 | 268 | 'view_id' => NULL, |
| 269 | 269 | 'post_id' => NULL, |
| 270 | 270 | 'limit' => 10, |
| 271 | - 'link_format' => __('Entry #{entry_id}', 'gravityview'), |
|
| 271 | + 'link_format' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
| 272 | 272 | 'after_link' => '' |
| 273 | 273 | ); |
| 274 | 274 | |
| 275 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 275 | + $instance = wp_parse_args( (array)$instance, $defaults ); |
|
| 276 | 276 | |
| 277 | 277 | ?> |
| 278 | 278 | |
| 279 | 279 | <!-- Title --> |
| 280 | 280 | <p> |
| 281 | 281 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label> |
| 282 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
|
| 282 | + <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" /> |
|
| 283 | 283 | </p> |
| 284 | 284 | |
| 285 | 285 | <!-- Download --> |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | $views = get_posts( $args ); |
| 293 | 293 | |
| 294 | 294 | // If there are no views set up yet, we get outta here. |
| 295 | - if( empty( $views ) ) { |
|
| 296 | - echo '<div id="select_gravityview_view"><div class="wrap">'. GravityView_Post_Types::no_views_text() .'</div></div>'; |
|
| 295 | + if ( empty( $views ) ) { |
|
| 296 | + echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Post_Types::no_views_text() . '</div></div>'; |
|
| 297 | 297 | return; |
| 298 | 298 | } |
| 299 | 299 | |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | * Display errors generated for invalid embed IDs |
| 305 | 305 | * @see GravityView_View_Data::is_valid_embed_id |
| 306 | 306 | */ |
| 307 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
| 307 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
| 308 | 308 | ?> |
| 309 | 309 | <div class="error inline hide-on-view-change"> |
| 310 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
| 310 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
| 311 | 311 | </div> |
| 312 | 312 | <?php |
| 313 | 313 | unset ( $error ); |
@@ -315,14 +315,14 @@ discard block |
||
| 315 | 315 | ?> |
| 316 | 316 | |
| 317 | 317 | <p> |
| 318 | - <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
| 318 | + <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label> |
|
| 319 | 319 | <select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"> |
| 320 | 320 | <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
| 321 | 321 | <?php |
| 322 | 322 | |
| 323 | - foreach( $views as $view ) { |
|
| 324 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
| 325 | - echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
| 323 | + foreach ( $views as $view ) { |
|
| 324 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
| 325 | + echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | ?> |
@@ -334,10 +334,10 @@ discard block |
||
| 334 | 334 | * Display errors generated for invalid embed IDs |
| 335 | 335 | * @see GravityView_View_Data::is_valid_embed_id |
| 336 | 336 | */ |
| 337 | - if( !empty( $instance['error_post_id'] ) ) { |
|
| 337 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
| 338 | 338 | ?> |
| 339 | 339 | <div class="error inline"> |
| 340 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
| 340 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
| 341 | 341 | </div> |
| 342 | 342 | <?php |
| 343 | 343 | unset ( $error ); |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | ?> |
| 346 | 346 | |
| 347 | 347 | <p> |
| 348 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
| 349 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" /> |
|
| 348 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
| 349 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" /> |
|
| 350 | 350 | <span class="howto"><?php |
| 351 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
| 352 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
| 351 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
| 352 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
| 353 | 353 | ?></span> |
| 354 | 354 | </p> |
| 355 | 355 | |
@@ -357,21 +357,21 @@ discard block |
||
| 357 | 357 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
| 358 | 358 | <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
| 359 | 359 | </label> |
| 360 | - <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" /> |
|
| 360 | + <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" /> |
|
| 361 | 361 | </p> |
| 362 | 362 | |
| 363 | 363 | <p> |
| 364 | 364 | <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
| 365 | 365 | <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
| 366 | 366 | </label> |
| 367 | - <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
| 367 | + <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
| 368 | 368 | </p> |
| 369 | 369 | |
| 370 | 370 | <p> |
| 371 | 371 | <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
| 372 | 372 | <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
| 373 | 373 | </label> |
| 374 | - <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea> |
|
| 374 | + <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea> |
|
| 375 | 375 | </p> |
| 376 | 376 | |
| 377 | 377 | <?php |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | * @param GravityView_Recent_Entries_Widget $this WP_Widget object |
| 382 | 382 | * @param array $instance Current widget instance |
| 383 | 383 | */ |
| 384 | - do_action( 'gravityview_recent_entries_widget_form' , $this, $instance ); |
|
| 384 | + do_action( 'gravityview_recent_entries_widget_form', $this, $instance ); |
|
| 385 | 385 | |
| 386 | 386 | ?> |
| 387 | 387 | |
@@ -312,11 +312,11 @@ discard block |
||
| 312 | 312 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
| 313 | 313 | |
| 314 | 314 | |
| 315 | - /** |
|
| 316 | - * When an entry is created, check if we need to update the custom slug meta |
|
| 317 | - * todo: move this to its own class.. |
|
| 318 | - */ |
|
| 319 | - add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 315 | + /** |
|
| 316 | + * When an entry is created, check if we need to update the custom slug meta |
|
| 317 | + * todo: move this to its own class.. |
|
| 318 | + */ |
|
| 319 | + add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 320 | 320 | |
| 321 | 321 | /** |
| 322 | 322 | * @action `gravityview_include_frontend_actions` Triggered after all GravityView frontend files are loaded |
@@ -347,34 +347,34 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | /** DEBUG */ |
| 349 | 349 | |
| 350 | - /** |
|
| 351 | - * Logs messages using Gravity Forms logging add-on |
|
| 352 | - * @param string $message log message |
|
| 353 | - * @param mixed $data Additional data to display |
|
| 354 | - * @return void |
|
| 355 | - */ |
|
| 356 | - public static function log_debug( $message, $data = null ){ |
|
| 357 | - /** |
|
| 358 | - * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 359 | - * @param string $message Message to display |
|
| 360 | - * @param mixed $data Supporting data to print alongside it |
|
| 361 | - */ |
|
| 362 | - do_action( 'gravityview_log_debug', $message, $data ); |
|
| 363 | - } |
|
| 364 | - |
|
| 365 | - /** |
|
| 366 | - * Logs messages using Gravity Forms logging add-on |
|
| 367 | - * @param string $message log message |
|
| 368 | - * @return void |
|
| 369 | - */ |
|
| 370 | - public static function log_error( $message, $data = null ){ |
|
| 371 | - /** |
|
| 372 | - * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 373 | - * @param string $message Error message to display |
|
| 374 | - * @param mixed $data Supporting data to print alongside it |
|
| 375 | - */ |
|
| 376 | - do_action( 'gravityview_log_error', $message, $data ); |
|
| 377 | - } |
|
| 350 | + /** |
|
| 351 | + * Logs messages using Gravity Forms logging add-on |
|
| 352 | + * @param string $message log message |
|
| 353 | + * @param mixed $data Additional data to display |
|
| 354 | + * @return void |
|
| 355 | + */ |
|
| 356 | + public static function log_debug( $message, $data = null ){ |
|
| 357 | + /** |
|
| 358 | + * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 359 | + * @param string $message Message to display |
|
| 360 | + * @param mixed $data Supporting data to print alongside it |
|
| 361 | + */ |
|
| 362 | + do_action( 'gravityview_log_debug', $message, $data ); |
|
| 363 | + } |
|
| 364 | + |
|
| 365 | + /** |
|
| 366 | + * Logs messages using Gravity Forms logging add-on |
|
| 367 | + * @param string $message log message |
|
| 368 | + * @return void |
|
| 369 | + */ |
|
| 370 | + public static function log_error( $message, $data = null ){ |
|
| 371 | + /** |
|
| 372 | + * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 373 | + * @param string $message Error message to display |
|
| 374 | + * @param mixed $data Supporting data to print alongside it |
|
| 375 | + */ |
|
| 376 | + do_action( 'gravityview_log_error', $message, $data ); |
|
| 377 | + } |
|
| 378 | 378 | |
| 379 | 379 | } // end class GravityView_Plugin |
| 380 | 380 | |
@@ -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 |
@@ -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 ); |
|
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 18 | + $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 19 | 19 | |
| 20 | 20 | ?> |
| 21 | 21 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" /> |
@@ -10,12 +10,12 @@ |
||
| 10 | 10 | |
| 11 | 11 | function render_input( $override_input = null ) { |
| 12 | 12 | |
| 13 | - if( isset( $override_input ) ) { |
|
| 13 | + if ( isset( $override_input ) ) { |
|
| 14 | 14 | echo $override_input; |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 18 | + $class = ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat'; |
|
| 19 | 19 | |
| 20 | 20 | ?> |
| 21 | 21 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" /> |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
| 33 | - } |
|
| 34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
| 33 | + } |
|
| 34 | + $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 35 | 35 | |
| 36 | 36 | ?> |
| 37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | ?> |
| 9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 10 | 10 | |
| 11 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
| 11 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
| 12 | 12 | echo $this->get_tooltip() . $this->get_field_desc(); |
| 13 | 13 | ?><div> |
| 14 | 14 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | function render_input( $override_input = null ) { |
| 21 | 21 | |
| 22 | - if( isset( $override_input ) ) { |
|
| 22 | + if ( isset( $override_input ) ) { |
|
| 23 | 23 | echo $override_input; |
| 24 | 24 | return; |
| 25 | 25 | } |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
| 32 | 32 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 33 | 33 | } |
| 34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 34 | + $class .= ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat'; |
|
| 35 | 35 | |
| 36 | 36 | ?> |
| 37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -28,14 +28,14 @@ |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | - $class = ' merge-tag-support mt-position-right '; |
|
| 33 | - |
|
| 34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
| 35 | - $class .= ' mt-hide_all_fields'; |
|
| 36 | - } |
|
| 37 | - } |
|
| 38 | - $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
| 31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | + $class = ' merge-tag-support mt-position-right '; |
|
| 33 | + |
|
| 34 | + if( empty( $this->field['show_all_fields'] ) ) { |
|
| 35 | + $class .= ' mt-hide_all_fields'; |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
| 39 | 39 | |
| 40 | 40 | ?> |
| 41 | 41 | <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | ?> |
| 10 | 10 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 11 | 11 | |
| 12 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
| 12 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
| 13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
| 14 | 14 | ?><div> |
| 15 | 15 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | function render_input( $override_input = null ) { |
| 22 | - if( isset( $override_input ) ) { |
|
| 22 | + if ( isset( $override_input ) ) { |
|
| 23 | 23 | echo $override_input; |
| 24 | 24 | return; |
| 25 | 25 | } |
@@ -28,17 +28,17 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
| 32 | 32 | $class = ' merge-tag-support mt-position-right '; |
| 33 | 33 | |
| 34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
| 34 | + if ( empty( $this->field[ 'show_all_fields' ] ) ) { |
|
| 35 | 35 | $class .= ' mt-hide_all_fields'; |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | - $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
| 38 | + $class .= ! empty( $this->field[ 'class' ] ) ? 'widefat ' . $this->field[ 'class' ] : 'widefat'; |
|
| 39 | 39 | |
| 40 | 40 | ?> |
| 41 | - <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
| 41 | + <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
| 42 | 42 | <?php |
| 43 | 43 | } |
| 44 | 44 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | if( !GravityView_Compatibility::is_valid() ) { return; } |
| 16 | 16 | |
| 17 | - self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
|
| 17 | + self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
|
| 18 | 18 | |
| 19 | 19 | include_once self::$metaboxes_dir . 'class-gravityview-metabox-tab.php'; |
| 20 | 20 | |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
| 229 | 229 | |
| 230 | 230 | if( isset( $form['id'] ) ) { |
| 231 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 231 | + $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 232 | 232 | |
| 233 | - // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
|
| 234 | - $_GET['id'] = $form['id']; |
|
| 233 | + // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
|
| 234 | + $_GET['id'] = $form['id']; |
|
| 235 | 235 | |
| 236 | 236 | } else { |
| 237 | - $form_script = 'var form = new Form();'; |
|
| 237 | + $form_script = 'var form = new Form();'; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function __construct() { |
| 19 | 19 | |
| 20 | - if( !GravityView_Compatibility::is_valid() ) { return; } |
|
| 20 | + if ( ! GravityView_Compatibility::is_valid() ) { return; } |
|
| 21 | 21 | |
| 22 | 22 | self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
| 23 | 23 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function initialize() { |
| 37 | 37 | |
| 38 | - add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' )); |
|
| 38 | + add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' ) ); |
|
| 39 | 39 | |
| 40 | - add_action( 'add_meta_boxes_gravityview' , array( $this, 'update_priority' ) ); |
|
| 40 | + add_action( 'add_meta_boxes_gravityview', array( $this, 'update_priority' ) ); |
|
| 41 | 41 | |
| 42 | 42 | // information box |
| 43 | 43 | add_action( 'post_submitbox_misc_actions', array( $this, 'render_shortcode_hint' ) ); |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | function update_priority() { |
| 52 | 52 | global $wp_meta_boxes; |
| 53 | 53 | |
| 54 | - if( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
| 55 | - foreach( array( 'high', 'core', 'low' ) as $position ) { |
|
| 56 | - if( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
| 57 | - foreach( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
| 58 | - if( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
| 59 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
| 60 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
| 54 | + if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) { |
|
| 55 | + foreach ( array( 'high', 'core', 'low' ) as $position ) { |
|
| 56 | + if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) { |
|
| 57 | + foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) { |
|
| 58 | + if ( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
| 59 | + $wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box; |
|
| 60 | + unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] ); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | global $post; |
| 70 | 70 | |
| 71 | 71 | // On Comment Edit, for example, $post isn't set. |
| 72 | - if( empty( $post ) || !is_object( $post ) || !isset( $post->ID ) ) { |
|
| 72 | + if ( empty( $post ) || ! is_object( $post ) || ! isset( $post->ID ) ) { |
|
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | $metaboxes = apply_filters( 'gravityview/metaboxes/default', $metaboxes ); |
| 154 | 154 | |
| 155 | - foreach( $metaboxes as $m ) { |
|
| 155 | + foreach ( $metaboxes as $m ) { |
|
| 156 | 156 | |
| 157 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
| 157 | + $tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] ); |
|
| 158 | 158 | |
| 159 | 159 | GravityView_Metabox_Tabs::add( $tab ); |
| 160 | 160 | |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | $links = GravityView_Admin_Views::get_connected_form_links( $current_form, false ); |
| 182 | 182 | |
| 183 | - if( !empty( $links ) ) { |
|
| 184 | - $links = '<span class="alignright gv-form-links">'. $links .'</span>'; |
|
| 183 | + if ( ! empty( $links ) ) { |
|
| 184 | + $links = '<span class="alignright gv-form-links">' . $links . '</span>'; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | return __( 'Data Source', 'gravityview' ) . $links; |
@@ -220,28 +220,28 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public static function render_merge_tags_scripts( $curr_form ) { |
| 222 | 222 | |
| 223 | - if( empty( $curr_form )) { |
|
| 223 | + if ( empty( $curr_form ) ) { |
|
| 224 | 224 | return NULL; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $form = gravityview_get_form( $curr_form ); |
| 228 | 228 | |
| 229 | - $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
|
| 229 | + $get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : NULL; |
|
| 230 | 230 | |
| 231 | - if( isset( $form['id'] ) ) { |
|
| 232 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 231 | + if ( isset( $form[ 'id' ] ) ) { |
|
| 232 | + $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';'; |
|
| 233 | 233 | |
| 234 | 234 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
| 235 | - $_GET['id'] = $form['id']; |
|
| 235 | + $_GET[ 'id' ] = $form[ 'id' ]; |
|
| 236 | 236 | |
| 237 | 237 | } else { |
| 238 | 238 | $form_script = 'var form = new Form();'; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
|
| 241 | + $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>'; |
|
| 242 | 242 | |
| 243 | 243 | // Restore previous $_GET setting |
| 244 | - $_GET['id'] = $get_id_backup; |
|
| 244 | + $_GET[ 'id' ] = $get_id_backup; |
|
| 245 | 245 | |
| 246 | 246 | return $output; |
| 247 | 247 | } |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | global $post; |
| 298 | 298 | |
| 299 | 299 | // Only show this on GravityView post types. |
| 300 | - if( false === gravityview_is_admin_page() ) { return; } |
|
| 300 | + if ( false === gravityview_is_admin_page() ) { return; } |
|
| 301 | 301 | |
| 302 | 302 | // If the View hasn't been configured yet, don't show embed shortcode |
| 303 | - if( !gravityview_get_directory_fields( $post->ID ) ) { return; } |
|
| 303 | + if ( ! gravityview_get_directory_fields( $post->ID ) ) { return; } |
|
| 304 | 304 | |
| 305 | 305 | include self::$metaboxes_dir . 'views/shortcode-hint.php'; |
| 306 | 306 | } |
@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Display the tab panels for the Settings metabox |
|
| 4 | - * |
|
| 5 | - * @package GravityView |
|
| 6 | - * @subpackage Gravityview/admin/metaboxes/views |
|
| 7 | - * @since 1.8 |
|
| 8 | - * |
|
| 9 | - * @global array $metaboxes |
|
| 10 | - * @global WP_Post $post |
|
| 11 | - */ |
|
| 3 | + * Display the tab panels for the Settings metabox |
|
| 4 | + * |
|
| 5 | + * @package GravityView |
|
| 6 | + * @subpackage Gravityview/admin/metaboxes/views |
|
| 7 | + * @since 1.8 |
|
| 8 | + * |
|
| 9 | + * @global array $metaboxes |
|
| 10 | + * @global WP_Post $post |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | ?> |
| 14 | 14 | |
@@ -19,9 +19,9 @@ |
||
| 19 | 19 | * Loop through the array of registered metaboxes |
| 20 | 20 | * @var GravityView_Metabox_Tab $metabox |
| 21 | 21 | */ |
| 22 | - foreach( $metaboxes as $metabox ) { |
|
| 22 | + foreach ( $metaboxes as $metabox ) { |
|
| 23 | 23 | |
| 24 | - echo '<div id="'.esc_attr( $metabox->id ).'">'; |
|
| 24 | + echo '<div id="' . esc_attr( $metabox->id ) . '">'; |
|
| 25 | 25 | |
| 26 | 26 | $metabox->render( $post ); |
| 27 | 27 | |