@@ -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 | |
@@ -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 | */ |
@@ -184,8 +184,8 @@ |
||
| 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 | } |
@@ -432,23 +432,17 @@ |
||
| 432 | 432 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
| 433 | 433 | |
| 434 | 434 | $result = false; |
| 435 | - } |
|
| 436 | - |
|
| 437 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
| 435 | + } else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
| 438 | 436 | |
| 439 | 437 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
| 440 | 438 | |
| 441 | 439 | $result = false; |
| 442 | - } |
|
| 443 | - |
|
| 444 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
| 440 | + } else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
| 445 | 441 | |
| 446 | 442 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 447 | 443 | |
| 448 | 444 | $result = false; |
| 449 | - } |
|
| 450 | - |
|
| 451 | - else { |
|
| 445 | + } else { |
|
| 452 | 446 | |
| 453 | 447 | $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
| 454 | 448 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
| 172 | 172 | * @access public |
| 173 | - * @return void|boolean |
|
| 173 | + * @return null|false |
|
| 174 | 174 | */ |
| 175 | 175 | public function process_bulk_action() { |
| 176 | 176 | if ( ! class_exists( 'RGForms' ) ) { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @param array|boolean $entries If array, array of entry IDs that are to be updated. If true: update all entries. |
| 253 | 253 | * @param int $approved Approved status. If `0`: unapproved, if not empty, `Approved` |
| 254 | 254 | * @param int $form_id The Gravity Forms Form ID |
| 255 | - * @return boolean|void |
|
| 255 | + * @return false|null |
|
| 256 | 256 | */ |
| 257 | 257 | private static function update_bulk( $entries, $approved, $form_id ) { |
| 258 | 258 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | * @access public |
| 471 | 471 | * @static |
| 472 | 472 | * @param mixed $form GF Form or Form ID |
| 473 | - * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
| 473 | + * @return integer Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
|
| 474 | 474 | */ |
| 475 | 475 | static public function get_approved_column( $form ) { |
| 476 | 476 | |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | |
| 364 | 364 | $approvedcolumn = self::get_approved_column( $form['id'] ); |
| 365 | 365 | |
| 366 | - /** |
|
| 367 | - * If the form doesn't contain the approve field, don't assume anything. |
|
| 368 | - */ |
|
| 369 | - if( empty( $approvedcolumn ) ) { |
|
| 370 | - return; |
|
| 371 | - } |
|
| 366 | + /** |
|
| 367 | + * If the form doesn't contain the approve field, don't assume anything. |
|
| 368 | + */ |
|
| 369 | + if( empty( $approvedcolumn ) ) { |
|
| 370 | + return; |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | 373 | $entry = GFAPI::get_entry( $entry_id ); |
| 374 | 374 | |
@@ -481,17 +481,17 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | static public function get_approved_column( $form ) { |
| 483 | 483 | |
| 484 | - if( empty( $form ) ) { |
|
| 485 | - return null; |
|
| 486 | - } |
|
| 484 | + if( empty( $form ) ) { |
|
| 485 | + return null; |
|
| 486 | + } |
|
| 487 | 487 | |
| 488 | - if( !is_array( $form ) ) { |
|
| 489 | - $form = GVCommon::get_form( $form ); |
|
| 490 | - } |
|
| 488 | + if( !is_array( $form ) ) { |
|
| 489 | + $form = GVCommon::get_form( $form ); |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | 492 | foreach( $form['fields'] as $key => $field ) { |
| 493 | 493 | |
| 494 | - $field = (array) $field; |
|
| 494 | + $field = (array) $field; |
|
| 495 | 495 | |
| 496 | 496 | if( !empty( $field['gravityview_approved'] ) ) { |
| 497 | 497 | if( !empty($field['inputs'][0]['id']) ) { |
@@ -499,14 +499,14 @@ discard block |
||
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | |
| 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']; |
|
| 507 | - } |
|
| 508 | - } |
|
| 509 | - } |
|
| 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']; |
|
| 507 | + } |
|
| 508 | + } |
|
| 509 | + } |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | return null; |
@@ -34,23 +34,23 @@ 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 | // when using the User opt-in field, check on entry submission |
| 44 | 44 | add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 ); |
| 45 | 45 | |
| 46 | 46 | // in case entry is edited (on admin or frontend) |
| 47 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
| 47 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
| 51 | 51 | |
| 52 | 52 | // adding styles and scripts |
| 53 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
| 53 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
| 54 | 54 | // bypass Gravity Forms no-conflict mode |
| 55 | 55 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
| 56 | 56 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function tooltips( $tooltips ) { |
| 67 | 67 | |
| 68 | - $tooltips['form_gravityview_fields'] = array( |
|
| 69 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
| 70 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
| 68 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
| 69 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
| 70 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | return $tooltips; |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
| 185 | - if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) { |
|
| 185 | + if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
| 186 | 186 | |
| 187 | 187 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
| 188 | 188 | |
| 189 | 189 | // 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. |
| 190 | - $bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2']; |
|
| 190 | + $bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ]; |
|
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | 193 | * The extra '-' is to make sure that there are at *least* two items in array. |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // All entries are set to be updated, not just the visible ones |
| 206 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
| 206 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
| 207 | 207 | |
| 208 | 208 | // Convert the current entry search into GF-formatted search criteria |
| 209 | 209 | $search = array( |
| 210 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
| 211 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
| 212 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
| 210 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
| 211 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
| 212 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
| 213 | 213 | ); |
| 214 | 214 | |
| 215 | 215 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | } else { |
| 221 | 221 | |
| 222 | - $entries = $_POST['lead']; |
|
| 222 | + $entries = $_POST[ 'lead' ]; |
|
| 223 | 223 | |
| 224 | 224 | } |
| 225 | 225 | |
@@ -260,12 +260,12 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | private static function update_bulk( $entries, $approved, $form_id ) { |
| 262 | 262 | |
| 263 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
| 263 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
| 264 | 264 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
| 265 | 265 | return false; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 268 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 269 | 269 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 270 | 270 | return false; |
| 271 | 271 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | // calculate approved field id |
| 276 | 276 | $approved_column_id = self::get_approved_column( $form_id ); |
| 277 | 277 | |
| 278 | - foreach( $entries as $entry_id ) { |
|
| 278 | + foreach ( $entries as $entry_id ) { |
|
| 279 | 279 | self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
| 280 | 280 | } |
| 281 | 281 | } |
@@ -294,14 +294,14 @@ discard block |
||
| 294 | 294 | * @param int $approvedcolumn (default: 0) |
| 295 | 295 | * @return boolean True: It worked; False: it failed |
| 296 | 296 | */ |
| 297 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
| 297 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
| 298 | 298 | |
| 299 | - if( !class_exists( 'GFAPI' ) ) { |
|
| 299 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
| 300 | 300 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
| 301 | 301 | return false; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if( empty( $approvedcolumn ) ) { |
|
| 304 | + if ( empty( $approvedcolumn ) ) { |
|
| 305 | 305 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 306 | 306 | } |
| 307 | 307 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | self::update_approved_meta( $entry_id, $approved ); |
| 321 | 321 | |
| 322 | 322 | // add note to entry |
| 323 | - if( $result === true ) { |
|
| 323 | + if ( $result === true ) { |
|
| 324 | 324 | |
| 325 | 325 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
| 326 | 326 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | $add_note = apply_filters( 'gravityview/approve_entries/add-note', true ); |
| 333 | 333 | |
| 334 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 334 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 335 | 335 | $current_user = wp_get_current_user(); |
| 336 | 336 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
| 337 | 337 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | do_action( 'gravityview_clear_form_cache', $form_id ); |
| 345 | 345 | |
| 346 | - } else if( is_wp_error( $result ) ) { |
|
| 346 | + } else if ( is_wp_error( $result ) ) { |
|
| 347 | 347 | |
| 348 | 348 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
| 349 | 349 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | * @param $form array Gravity Forms form object |
| 365 | 365 | */ |
| 366 | 366 | public function after_submission( $entry, $form ) { |
| 367 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
| 367 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | |
@@ -380,12 +380,12 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
| 382 | 382 | |
| 383 | - $approvedcolumn = self::get_approved_column( $form['id'] ); |
|
| 383 | + $approvedcolumn = self::get_approved_column( $form[ 'id' ] ); |
|
| 384 | 384 | |
| 385 | 385 | /** |
| 386 | 386 | * If the form doesn't contain the approve field, don't assume anything. |
| 387 | 387 | */ |
| 388 | - if( empty( $approvedcolumn ) ) { |
|
| 388 | + if ( empty( $approvedcolumn ) ) { |
|
| 389 | 389 | return; |
| 390 | 390 | } |
| 391 | 391 | |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $is_approved = empty( $is_approved ) ? 0 : 'Approved'; |
| 414 | 414 | |
| 415 | 415 | // update entry meta |
| 416 | - if( function_exists('gform_update_meta') ) { |
|
| 416 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
| 417 | 417 | |
| 418 | 418 | gform_update_meta( $entry_id, 'is_approved', $is_approved ); |
| 419 | 419 | |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | */ |
| 426 | 426 | do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); |
| 427 | 427 | |
| 428 | - if( empty( $is_approved ) ) { |
|
| 428 | + if ( empty( $is_approved ) ) { |
|
| 429 | 429 | |
| 430 | 430 | /** |
| 431 | 431 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | } else { |
| 449 | 449 | |
| 450 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 450 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 451 | 451 | |
| 452 | 452 | } |
| 453 | 453 | } |
@@ -459,21 +459,21 @@ discard block |
||
| 459 | 459 | */ |
| 460 | 460 | public function ajax_update_approved() { |
| 461 | 461 | |
| 462 | - if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { |
|
| 462 | + if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) { |
|
| 463 | 463 | |
| 464 | 464 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
| 465 | 465 | |
| 466 | 466 | $result = false; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
| 469 | + else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) { |
|
| 470 | 470 | |
| 471 | 471 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
| 472 | 472 | |
| 473 | 473 | $result = false; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
| 476 | + else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) { |
|
| 477 | 477 | |
| 478 | 478 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 479 | 479 | |
@@ -482,11 +482,11 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | else { |
| 484 | 484 | |
| 485 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
|
| 485 | + $result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] ); |
|
| 486 | 486 | |
| 487 | - if( is_wp_error( $result ) ) { |
|
| 487 | + if ( is_wp_error( $result ) ) { |
|
| 488 | 488 | /** @var WP_Error $result */ |
| 489 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); |
|
| 489 | + do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() ); |
|
| 490 | 490 | $result = false; |
| 491 | 491 | } |
| 492 | 492 | |
@@ -506,29 +506,29 @@ discard block |
||
| 506 | 506 | */ |
| 507 | 507 | static public function get_approved_column( $form ) { |
| 508 | 508 | |
| 509 | - if( empty( $form ) ) { |
|
| 509 | + if ( empty( $form ) ) { |
|
| 510 | 510 | return null; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - if( !is_array( $form ) ) { |
|
| 513 | + if ( ! is_array( $form ) ) { |
|
| 514 | 514 | $form = GVCommon::get_form( $form ); |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - foreach( $form['fields'] as $key => $field ) { |
|
| 517 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
| 518 | 518 | |
| 519 | - $field = (array) $field; |
|
| 519 | + $field = (array)$field; |
|
| 520 | 520 | |
| 521 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
| 522 | - if( !empty($field['inputs'][0]['id']) ) { |
|
| 523 | - return $field['inputs'][0]['id']; |
|
| 521 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
| 522 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
| 523 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
| 528 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
| 529 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
| 530 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
| 531 | - return $input['id']; |
|
| 528 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
| 529 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
| 530 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
| 531 | + return $input[ 'id' ]; |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -539,18 +539,18 @@ discard block |
||
| 539 | 539 | |
| 540 | 540 | |
| 541 | 541 | |
| 542 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 542 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 543 | 543 | |
| 544 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
| 544 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
| 545 | 545 | return; |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - if( empty( $entry['id'] ) ) { |
|
| 548 | + if ( empty( $entry[ 'id' ] ) ) { |
|
| 549 | 549 | return; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - if( gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
| 553 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
| 552 | + if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
| 553 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; |
|
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | |
| 560 | 560 | function add_scripts_and_styles( $hook ) { |
| 561 | 561 | |
| 562 | - if( !class_exists( 'RGForms' ) ) { |
|
| 562 | + if ( ! class_exists( 'RGForms' ) ) { |
|
| 563 | 563 | |
| 564 | 564 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
| 565 | 565 | |
@@ -568,39 +568,39 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | // enqueue styles & scripts gf_entries |
| 570 | 570 | // But only if we're on the main Entries page, not on reports pages |
| 571 | - if( RGForms::get_page() === 'entry_list' ) { |
|
| 571 | + if ( RGForms::get_page() === 'entry_list' ) { |
|
| 572 | 572 | |
| 573 | - $form_id = RGForms::get('id'); |
|
| 573 | + $form_id = RGForms::get( 'id' ); |
|
| 574 | 574 | |
| 575 | 575 | // If there are no forms identified, use the first form. That's how GF does it. |
| 576 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
| 576 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
| 577 | 577 | $forms = gravityview_get_forms(); |
| 578 | - if( !empty( $forms ) ) { |
|
| 579 | - $form_id = $forms[0]['id']; |
|
| 578 | + if ( ! empty( $forms ) ) { |
|
| 579 | + $form_id = $forms[ 0 ][ 'id' ]; |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 584 | 584 | |
| 585 | - wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 585 | + wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 586 | 586 | wp_enqueue_style( 'gravityview_entries_list' ); |
| 587 | 587 | |
| 588 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 588 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 589 | 589 | |
| 590 | - wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 590 | + wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 591 | 591 | wp_enqueue_script( 'gravityview_gf_entries_scripts' ); |
| 592 | 592 | |
| 593 | 593 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
| 594 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), |
|
| 594 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ), |
|
| 595 | 595 | 'form_id' => $form_id, |
| 596 | 596 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
| 597 | 597 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
| 598 | 598 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
| 599 | 599 | 'bulk_message' => $this->bulk_update_message, |
| 600 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
| 601 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
| 602 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
| 603 | - 'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ), |
|
| 600 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), |
|
| 601 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), |
|
| 602 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
| 603 | + 'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ), |
|
| 604 | 604 | ) ); |
| 605 | 605 | |
| 606 | 606 | } |
@@ -643,8 +643,8 @@ discard block |
||
| 643 | 643 | // Sanitize the values, just to be sure. |
| 644 | 644 | foreach ( $bulk_actions as $key => $group ) { |
| 645 | 645 | foreach ( $group as $i => $action ) { |
| 646 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
| 647 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
| 646 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
| 647 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | |
@@ -669,13 +669,13 @@ discard block |
||
| 669 | 669 | * @since 1.7.2 |
| 670 | 670 | * @param boolean $hide_if_no_connections |
| 671 | 671 | */ |
| 672 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 672 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 673 | 673 | |
| 674 | - if( $hide_if_no_connections ) { |
|
| 674 | + if ( $hide_if_no_connections ) { |
|
| 675 | 675 | |
| 676 | 676 | $connected_views = gravityview_get_connected_views( $form_id ); |
| 677 | 677 | |
| 678 | - if( empty( $connected_views ) ) { |
|
| 678 | + if ( empty( $connected_views ) ) { |
|
| 679 | 679 | $show_approve_column = false; |
| 680 | 680 | } |
| 681 | 681 | } |
@@ -685,18 +685,18 @@ discard block |
||
| 685 | 685 | * @param boolean $show_approve_column Whether the column will be shown |
| 686 | 686 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
| 687 | 687 | */ |
| 688 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 688 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 689 | 689 | |
| 690 | 690 | return $show_approve_column; |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | function register_gform_noconflict_script( $scripts ) { |
| 694 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
| 694 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
| 695 | 695 | return $scripts; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | function register_gform_noconflict_style( $styles ) { |
| 699 | - $styles[] = 'gravityview_entries_list'; |
|
| 699 | + $styles[ ] = 'gravityview_entries_list'; |
|
| 700 | 700 | return $styles; |
| 701 | 701 | } |
| 702 | 702 | |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
| 215 | 215 | foreach ( $field['inputs'] as $input ) { |
| 216 | - /** |
|
| 217 | - * @hack |
|
| 218 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 219 | - */ |
|
| 220 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 221 | - continue; |
|
| 222 | - } |
|
| 216 | + /** |
|
| 217 | + * @hack |
|
| 218 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
| 219 | + */ |
|
| 220 | + if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 221 | + continue; |
|
| 222 | + } |
|
| 223 | 223 | $fields[ (string)$input['id'] ] = array( |
| 224 | 224 | 'label' => rgar( $input, 'label' ), |
| 225 | 225 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 467 | 467 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
| 468 | 468 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
| 469 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 469 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
| 470 | 470 | $criteria['context_view_id'] = null; |
| 471 | 471 | } |
| 472 | 472 | |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | ), |
| 1083 | 1083 | ); |
| 1084 | 1084 | |
| 1085 | - $fields = $date_created + $fields; |
|
| 1085 | + $fields = $date_created + $fields; |
|
| 1086 | 1086 | |
| 1087 | 1087 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1088 | 1088 | |
@@ -1094,13 +1094,13 @@ discard block |
||
| 1094 | 1094 | } |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | - /** |
|
| 1098 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1099 | - * @since 1.12 |
|
| 1100 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1101 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1102 | - */ |
|
| 1103 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1097 | + /** |
|
| 1098 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
| 1099 | + * @since 1.12 |
|
| 1100 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
| 1101 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
| 1102 | + */ |
|
| 1103 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
| 1104 | 1104 | |
| 1105 | 1105 | return $fields; |
| 1106 | 1106 | } |
@@ -1365,17 +1365,17 @@ discard block |
||
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | 1367 | |
| 1368 | - /** |
|
| 1369 | - * Display updated/error notice |
|
| 1370 | - * |
|
| 1371 | - * @param string $notice text/HTML of notice |
|
| 1372 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1373 | - * |
|
| 1374 | - * @return string |
|
| 1375 | - */ |
|
| 1376 | - public static function generate_notice( $notice, $class = '' ) { |
|
| 1377 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1378 | - } |
|
| 1368 | + /** |
|
| 1369 | + * Display updated/error notice |
|
| 1370 | + * |
|
| 1371 | + * @param string $notice text/HTML of notice |
|
| 1372 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
| 1373 | + * |
|
| 1374 | + * @return string |
|
| 1375 | + */ |
|
| 1376 | + public static function generate_notice( $notice, $class = '' ) { |
|
| 1377 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1378 | + } |
|
| 1379 | 1379 | |
| 1380 | 1380 | |
| 1381 | 1381 | |
@@ -167,7 +167,6 @@ discard block |
||
| 167 | 167 | * Returns the list of available forms |
| 168 | 168 | * |
| 169 | 169 | * @access public |
| 170 | - * @param mixed $form_id |
|
| 171 | 170 | * @return array Empty array if GFAPI isn't available or no forms. Otherwise, associative array with id, title keys |
| 172 | 171 | */ |
| 173 | 172 | public static function get_forms() { |
@@ -188,7 +187,7 @@ discard block |
||
| 188 | 187 | * Return array of fields' id and label, for a given Form ID |
| 189 | 188 | * |
| 190 | 189 | * @access public |
| 191 | - * @param string|array $form_id (default: '') or $form object |
|
| 190 | + * @param string|array $form (default: '') or $form object |
|
| 192 | 191 | * @return array |
| 193 | 192 | */ |
| 194 | 193 | public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) { |
@@ -290,7 +290,7 @@ discard block |
||
| 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 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | $fields = array(); |
| 375 | 375 | |
| 376 | - foreach ( $extra_fields as $key => $field ){ |
|
| 376 | + foreach ( $extra_fields as $key => $field ) { |
|
| 377 | 377 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
| 378 | 378 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
| 379 | 379 | } |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist |
| 914 | 914 | */ |
| 915 | 915 | public static function get_field( $form, $field_id ) { |
| 916 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 916 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 917 | 917 | return GFFormsModel::get_field( $form, $field_id ); |
| 918 | 918 | } else { |
| 919 | 919 | return null; |
@@ -960,7 +960,7 @@ discard block |
||
| 960 | 960 | $shortcodes = array(); |
| 961 | 961 | |
| 962 | 962 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 963 | - if ( empty( $matches ) ){ |
|
| 963 | + if ( empty( $matches ) ) { |
|
| 964 | 964 | return false; |
| 965 | 965 | } |
| 966 | 966 | |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
| 1424 | 1424 | $merged = $array1; |
| 1425 | 1425 | |
| 1426 | - foreach ( $array2 as $key => &$value ) { |
|
| 1426 | + foreach ( $array2 as $key => &$value ) { |
|
| 1427 | 1427 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
| 1428 | 1428 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
| 1429 | 1429 | } else { |
@@ -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 | |