@@ -171,11 +171,13 @@ |
||
| 171 | 171 | $public_display['nickname'] = $profileuser->nickname; |
| 172 | 172 | $public_display['username'] = $profileuser->user_login; |
| 173 | 173 | |
| 174 | - if ( !empty($profileuser->first_name) ) |
|
| 175 | - $public_display['firstname'] = $profileuser->first_name; |
|
| 174 | + if ( !empty($profileuser->first_name) ) { |
|
| 175 | + $public_display['firstname'] = $profileuser->first_name; |
|
| 176 | + } |
|
| 176 | 177 | |
| 177 | - if ( !empty($profileuser->last_name) ) |
|
| 178 | - $public_display['lastname'] = $profileuser->last_name; |
|
| 178 | + if ( !empty($profileuser->last_name) ) { |
|
| 179 | + $public_display['lastname'] = $profileuser->last_name; |
|
| 180 | + } |
|
| 179 | 181 | |
| 180 | 182 | if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
| 181 | 183 | $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @since 1.11 |
| 44 | 44 | * @param boolean $boolean Whether to trigger update on user registration (default: true) |
| 45 | 45 | */ |
| 46 | - if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
| 47 | - add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 ); |
|
| 46 | + if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
| 47 | + add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 ); |
|
| 48 | 48 | |
| 49 | 49 | // last resort in case the current user display name don't match any of the defaults |
| 50 | 50 | add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 ); |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function update_user( $form = array(), $entry_id = 0 ) { |
| 64 | 64 | |
| 65 | - if( !class_exists( 'GFAPI' ) || !class_exists( 'GFUser' ) || empty( $entry_id ) ) { |
|
| 65 | + if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GFUser' ) || empty( $entry_id ) ) { |
|
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // support for GF User Registration 3.x |
| 70 | - $gf_user_3 = class_exists('GF_User_Registration') ? true : false; |
|
| 70 | + $gf_user_3 = class_exists( 'GF_User_Registration' ) ? true : false; |
|
| 71 | 71 | |
| 72 | - if( $gf_user_3 ) { |
|
| 72 | + if ( $gf_user_3 ) { |
|
| 73 | 73 | $gf_user_registration = GF_User_Registration::get_instance(); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * @since 1.14 |
| 88 | 88 | */ |
| 89 | - if( $gf_user_3 ) { |
|
| 89 | + if ( $gf_user_3 ) { |
|
| 90 | 90 | $config = $gf_user_registration->get_single_submission_feed( $entry, $form ); |
| 91 | 91 | } else { |
| 92 | 92 | $config = GFUser::get_active_config( $form, $entry ); |
@@ -102,15 +102,15 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry ); |
| 104 | 104 | |
| 105 | - if( $preserve_role ) { |
|
| 106 | - $config['meta']['role'] = 'gfur_preserve_role'; |
|
| 105 | + if ( $preserve_role ) { |
|
| 106 | + $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role'; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * Make sure the current display name is not changed with the update user method. |
| 111 | 111 | * @since 1.15 |
| 112 | 112 | */ |
| 113 | - $config['meta']['displayname'] = $this->match_current_display_name( $entry['created_by'] ); |
|
| 113 | + $config[ 'meta' ][ 'displayname' ] = $this->match_current_display_name( $entry[ 'created_by' ] ); |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $is_create_feed = ( $config && rgars( $config, $feed_pos ) === 'create' ); |
| 128 | 128 | |
| 129 | 129 | // Only update if it's a create feed |
| 130 | - if( ! $is_create_feed ) { |
|
| 130 | + if ( ! $is_create_feed ) { |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | add_filter( 'send_email_change_email', '__return_false', 3 ); |
| 137 | 137 | |
| 138 | 138 | // Trigger the User Registration update user method |
| 139 | - if( $gf_user_3 ) { |
|
| 139 | + if ( $gf_user_3 ) { |
|
| 140 | 140 | $gf_user_registration->update_user( $entry, $form, $config ); |
| 141 | 141 | } else { |
| 142 | 142 | GFUser::update_user( $entry, $form, $config ); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | // In case we can't find the current display name format, or it is the 'nickname' format (which Gravity Forms doesn't support) |
| 168 | 168 | // trigger last resort method at the 'gform_user_updated' hook |
| 169 | - if( false === $format || 'nickname' === $format ) { |
|
| 169 | + if ( false === $format || 'nickname' === $format ) { |
|
| 170 | 170 | $this->_user_before_update = $user; |
| 171 | 171 | $format = 'nickname'; |
| 172 | 172 | } |
@@ -186,18 +186,18 @@ discard block |
||
| 186 | 186 | public function generate_display_names( $profileuser ) { |
| 187 | 187 | |
| 188 | 188 | $public_display = array(); |
| 189 | - $public_display['nickname'] = $profileuser->nickname; |
|
| 190 | - $public_display['username'] = $profileuser->user_login; |
|
| 189 | + $public_display[ 'nickname' ] = $profileuser->nickname; |
|
| 190 | + $public_display[ 'username' ] = $profileuser->user_login; |
|
| 191 | 191 | |
| 192 | - if ( !empty($profileuser->first_name) ) |
|
| 193 | - $public_display['firstname'] = $profileuser->first_name; |
|
| 192 | + if ( ! empty( $profileuser->first_name ) ) |
|
| 193 | + $public_display[ 'firstname' ] = $profileuser->first_name; |
|
| 194 | 194 | |
| 195 | - if ( !empty($profileuser->last_name) ) |
|
| 196 | - $public_display['lastname'] = $profileuser->last_name; |
|
| 195 | + if ( ! empty( $profileuser->last_name ) ) |
|
| 196 | + $public_display[ 'lastname' ] = $profileuser->last_name; |
|
| 197 | 197 | |
| 198 | - if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
|
| 199 | - $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
| 200 | - $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
| 198 | + if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) { |
|
| 199 | + $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
| 200 | + $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $public_display = array_map( 'trim', $public_display ); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true ); |
| 229 | 229 | |
| 230 | - $is_update_feed = ( $config && rgars( $config, 'meta/feed_type') === 'update' ); |
|
| 230 | + $is_update_feed = ( $config && rgars( $config, 'meta/feed_type' ) === 'update' ); |
|
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * Don't restore display name: |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * - or we don't need as we found the correct format before updating user. |
| 237 | 237 | * @since 1.14.4 |
| 238 | 238 | */ |
| 239 | - if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
| 239 | + if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
| 240 | 240 | return; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -262,10 +262,10 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | $updated = wp_update_user( $restored_user ); |
| 264 | 264 | |
| 265 | - if( is_wp_error( $updated ) ) { |
|
| 266 | - do_action('gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated ); |
|
| 265 | + if ( is_wp_error( $updated ) ) { |
|
| 266 | + do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated ); |
|
| 267 | 267 | } else { |
| 268 | - do_action('gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) ); |
|
| 268 | + do_action( 'gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) ); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | $this->_user_before_update = null; |
@@ -4,7 +4,9 @@ |
||
| 4 | 4 | //set_site_transient( 'update_plugins', null ); |
| 5 | 5 | |
| 6 | 6 | // Exit if accessed directly |
| 7 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 7 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 8 | + exit; |
|
| 9 | +} |
|
| 8 | 10 | |
| 9 | 11 | /** |
| 10 | 12 | * Allows plugins to use their own update API. |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | * @since 1.0 |
| 35 | 35 | */ |
| 36 | 36 | public function __construct() { |
| 37 | - add_action( 'admin_menu', array( $this, 'admin_menus'), 200 ); |
|
| 37 | + add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 ); |
|
| 38 | 38 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
| 39 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 40 | - add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 ); |
|
| 39 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 40 | + add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | // Add help page to GravityView menu |
| 54 | 54 | add_submenu_page( |
| 55 | 55 | 'edit.php?post_type=gravityview', |
| 56 | - __('GravityView: Getting Started', 'gravityview'), |
|
| 57 | - __('Getting Started', 'gravityview'), |
|
| 56 | + __( 'GravityView: Getting Started', 'gravityview' ), |
|
| 57 | + __( 'Getting Started', 'gravityview' ), |
|
| 58 | 58 | $this->minimum_capability, |
| 59 | 59 | 'gv-getting-started', |
| 60 | 60 | array( $this, 'getting_started_screen' ) |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @return boolean $is_page True: yep; false: nope |
| 89 | 89 | */ |
| 90 | - public function is_dashboard_page($is_page = false, $hook = NULL) { |
|
| 90 | + public function is_dashboard_page( $is_page = false, $hook = NULL ) { |
|
| 91 | 91 | global $plugin_page; |
| 92 | 92 | |
| 93 | - if($is_page) { return $is_page; } |
|
| 93 | + if ( $is_page ) { return $is_page; } |
|
| 94 | 94 | |
| 95 | 95 | return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) ); |
| 96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' ); |
| 109 | 109 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' ); |
| 110 | 110 | |
| 111 | - if( !$this->is_dashboard_page() ) { return; } |
|
| 111 | + if ( ! $this->is_dashboard_page() ) { return; } |
|
| 112 | 112 | |
| 113 | 113 | ?> |
| 114 | 114 | <style type="text/css" media="screen"> |
@@ -141,20 +141,20 @@ discard block |
||
| 141 | 141 | // Don't fetch -beta, etc. |
| 142 | 142 | list( $display_version ) = explode( '-', GravityView_Plugin::version ); |
| 143 | 143 | |
| 144 | - $selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
| 144 | + $selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
| 145 | 145 | ?> |
| 146 | 146 | |
| 147 | 147 | <h1><img class="alignleft" src="<?php echo plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ); ?>" width="100" height="132" /><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1> |
| 148 | 148 | <div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div> |
| 149 | 149 | |
| 150 | 150 | <h2 class="nav-tab-wrapper clear"> |
| 151 | - <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
| 151 | + <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
| 152 | 152 | <?php _e( "Getting Started", 'gravityview' ); ?> |
| 153 | 153 | </a> |
| 154 | - <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
| 154 | + <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
| 155 | 155 | <?php _e( "List of Changes", 'gravityview' ); ?> |
| 156 | 156 | </a> |
| 157 | - <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
| 157 | + <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
| 158 | 158 | <?php _e( 'Credits', 'gravityview' ); ?> |
| 159 | 159 | </a> |
| 160 | 160 | </h2> |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | <h2>Create a View</h2> |
| 191 | 191 | |
| 192 | 192 | <ol class="ol-decimal"> |
| 193 | - <li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views > New View</a></li> |
|
| 193 | + <li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views > New View</a></li> |
|
| 194 | 194 | <li>If you want to <strong>create a new form</strong>, click the "Start Fresh" button</li> |
| 195 | 195 | <li>If you want to <strong>use an existing form’s entries</strong>, select from the dropdown.</li> |
| 196 | 196 | <li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>. |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | </ul> |
| 526 | 526 | |
| 527 | 527 | <h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4> |
| 528 | - <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
| 528 | + <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
| 529 | 529 | </div> |
| 530 | 530 | </div> |
| 531 | 531 | |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | global $plugin_page; |
| 566 | 566 | |
| 567 | 567 | // Bail if we're just editing the plugin |
| 568 | - if( $plugin_page === 'plugin-editor.php' ) { return; } |
|
| 568 | + if ( $plugin_page === 'plugin-editor.php' ) { return; } |
|
| 569 | 569 | |
| 570 | 570 | // Bail if no activation redirect |
| 571 | 571 | if ( ! get_transient( '_gv_activation_redirect' ) ) { return; } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | $upgrade = get_option( 'gv_version_upgraded_from' ); |
| 577 | 577 | |
| 578 | 578 | // Don't do anything if they've already seen the new version info |
| 579 | - if( $upgrade === GravityView_Plugin::version ) { |
|
| 579 | + if ( $upgrade === GravityView_Plugin::version ) { |
|
| 580 | 580 | return; |
| 581 | 581 | } |
| 582 | 582 | |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | update_option( 'gv_version_upgraded_from', GravityView_Plugin::version ); |
| 585 | 585 | |
| 586 | 586 | // Bail if activating from network, or bulk |
| 587 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } |
|
| 587 | + if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; } |
|
| 588 | 588 | |
| 589 | 589 | // First time install |
| 590 | - if( ! $upgrade ) { |
|
| 590 | + if ( ! $upgrade ) { |
|
| 591 | 591 | wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit; |
| 592 | 592 | } |
| 593 | 593 | // Update |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | $delete = $this->get_delete_setting(); |
| 36 | 36 | |
| 37 | - if( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
| 37 | + if ( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
| 38 | 38 | $this->fire_everything(); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
| 99 | 99 | |
| 100 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 101 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 100 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 101 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 102 | 102 | |
| 103 | 103 | $sql = $wpdb->prepare( " |
| 104 | 104 | DELETE FROM $notes_table |
@@ -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 ); |
|
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | * @param mixed $field_id Field ID or Field array |
| 290 | 290 | * @return string field type |
| 291 | 291 | */ |
| 292 | -function gravityview_get_field_type( $form = null , $field_id = '' ) { |
|
| 293 | - return GVCommon::get_field_type( $form, $field_id ); |
|
| 292 | +function gravityview_get_field_type( $form = null, $field_id = '' ) { |
|
| 293 | + return GVCommon::get_field_type( $form, $field_id ); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | * @return string HTML of the output. Empty string if $view_id is empty. |
| 304 | 304 | */ |
| 305 | 305 | function get_gravityview( $view_id = '', $atts = array() ) { |
| 306 | - if( !empty( $view_id ) ) { |
|
| 307 | - $atts['id'] = $view_id; |
|
| 306 | + if ( ! empty( $view_id ) ) { |
|
| 307 | + $atts[ 'id' ] = $view_id; |
|
| 308 | 308 | $args = wp_parse_args( $atts, GravityView_View_Data::get_default_args() ); |
| 309 | 309 | $GravityView_frontend = GravityView_frontend::getInstance(); |
| 310 | 310 | $GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) ); |
@@ -347,15 +347,15 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) { |
| 349 | 349 | |
| 350 | - if( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 350 | + if ( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 351 | 351 | |
| 352 | 352 | /** @var GF_Field_Radio|GF_Field_Checkbox $form_field */ |
| 353 | - foreach( $form_fields as $form_field ) { |
|
| 353 | + foreach ( $form_fields as $form_field ) { |
|
| 354 | 354 | $field_id = $form_field->id; |
| 355 | - foreach( $view_fields as $zone ) { |
|
| 356 | - foreach( $zone as $field ) { |
|
| 355 | + foreach ( $view_fields as $zone ) { |
|
| 356 | + foreach ( $zone as $field ) { |
|
| 357 | 357 | // If it's an input, not the parent and the parent ID matches a checkbox or radio |
| 358 | - if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) { |
|
| 358 | + if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) { |
|
| 359 | 359 | return true; |
| 360 | 360 | } |
| 361 | 361 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * Don't exit if we're running test suite. |
| 37 | 37 | * @since 1.15 |
| 38 | 38 | */ |
| 39 | - if( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
| 39 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) { |
|
| 40 | 40 | return $mixed; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | 52 | function check_ajax_nonce() { |
| 53 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxviews' ) ) { |
|
| 53 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxviews' ) ) { |
|
| 54 | 54 | $this->_exit( false ); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | //check nonce |
| 68 | 68 | $this->check_ajax_nonce(); |
| 69 | 69 | |
| 70 | - $context = isset($_POST['context']) ? esc_attr( $_POST['context'] ) : 'directory'; |
|
| 70 | + $context = isset( $_POST[ 'context' ] ) ? esc_attr( $_POST[ 'context' ] ) : 'directory'; |
|
| 71 | 71 | |
| 72 | 72 | // If Form was changed, JS sends form ID, if start fresh, JS sends template_id |
| 73 | - if( !empty( $_POST['form_id'] ) ) { |
|
| 74 | - do_action( 'gravityview_render_available_fields', (int) $_POST['form_id'], $context ); |
|
| 73 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
| 74 | + do_action( 'gravityview_render_available_fields', (int)$_POST[ 'form_id' ], $context ); |
|
| 75 | 75 | $this->_exit(); |
| 76 | - } elseif( !empty( $_POST['template_id'] ) ) { |
|
| 77 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 76 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 77 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 78 | 78 | do_action( 'gravityview_render_available_fields', $form, $context ); |
| 79 | 79 | $this->_exit(); |
| 80 | 80 | } |
@@ -94,17 +94,17 @@ discard block |
||
| 94 | 94 | function get_active_areas() { |
| 95 | 95 | $this->check_ajax_nonce(); |
| 96 | 96 | |
| 97 | - if( empty( $_POST['template_id'] ) ) { |
|
| 97 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
| 98 | 98 | $this->_exit( false ); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | ob_start(); |
| 102 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'directory', '', true ); |
|
| 103 | - $response['directory'] = ob_get_clean(); |
|
| 102 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'directory', '', true ); |
|
| 103 | + $response[ 'directory' ] = ob_get_clean(); |
|
| 104 | 104 | |
| 105 | 105 | ob_start(); |
| 106 | - do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'single', '', true ); |
|
| 107 | - $response['single'] = ob_get_clean(); |
|
| 106 | + do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'single', '', true ); |
|
| 107 | + $response[ 'single' ] = ob_get_clean(); |
|
| 108 | 108 | |
| 109 | 109 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
| 110 | 110 | |
@@ -119,20 +119,20 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $this->check_ajax_nonce(); |
| 121 | 121 | |
| 122 | - if( empty( $_POST['template_id'] ) ) { |
|
| 122 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
| 123 | 123 | $this->_exit( false ); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // get the fields xml config file for this specific preset |
| 127 | - $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST['template_id'] ); |
|
| 127 | + $preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST[ 'template_id' ] ); |
|
| 128 | 128 | // import fields |
| 129 | - if( !empty( $preset_fields_path ) ) { |
|
| 129 | + if ( ! empty( $preset_fields_path ) ) { |
|
| 130 | 130 | $presets = $this->import_fields( $preset_fields_path ); |
| 131 | 131 | } else { |
| 132 | 132 | $presets = array( 'widgets' => array(), 'fields' => array() ); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $template_id = esc_attr( $_POST['template_id'] ); |
|
| 135 | + $template_id = esc_attr( $_POST[ 'template_id' ] ); |
|
| 136 | 136 | |
| 137 | 137 | // template areas |
| 138 | 138 | $template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' ); |
@@ -142,20 +142,20 @@ discard block |
||
| 142 | 142 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
| 143 | 143 | |
| 144 | 144 | ob_start(); |
| 145 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets['widgets'] ); |
|
| 146 | - $response['header'] = ob_get_clean(); |
|
| 145 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets[ 'widgets' ] ); |
|
| 146 | + $response[ 'header' ] = ob_get_clean(); |
|
| 147 | 147 | |
| 148 | 148 | ob_start(); |
| 149 | - do_action('gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets['widgets'] ); |
|
| 150 | - $response['footer'] = ob_get_clean(); |
|
| 149 | + do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets[ 'widgets' ] ); |
|
| 150 | + $response[ 'footer' ] = ob_get_clean(); |
|
| 151 | 151 | |
| 152 | 152 | ob_start(); |
| 153 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets['fields'] ); |
|
| 154 | - $response['directory'] = ob_get_clean(); |
|
| 153 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets[ 'fields' ] ); |
|
| 154 | + $response[ 'directory' ] = ob_get_clean(); |
|
| 155 | 155 | |
| 156 | 156 | ob_start(); |
| 157 | - do_action('gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets['fields'] ); |
|
| 158 | - $response['single'] = ob_get_clean(); |
|
| 157 | + do_action( 'gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets[ 'fields' ] ); |
|
| 158 | + $response[ 'single' ] = ob_get_clean(); |
|
| 159 | 159 | |
| 160 | 160 | $response = array_map( 'gravityview_strip_whitespace', $response ); |
| 161 | 161 | |
@@ -173,26 +173,26 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $this->check_ajax_nonce(); |
| 175 | 175 | |
| 176 | - if( empty( $_POST['template_id'] ) ) { |
|
| 176 | + if ( empty( $_POST[ 'template_id' ] ) ) { |
|
| 177 | 177 | do_action( 'gravityview_log_error', '[create_preset_form] Cannot create preset form; the template_id is empty.' ); |
| 178 | 178 | $this->_exit( false ); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // get the xml for this specific template_id |
| 182 | - $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST['template_id'] ); |
|
| 182 | + $preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST[ 'template_id' ] ); |
|
| 183 | 183 | |
| 184 | 184 | // import form |
| 185 | 185 | $form = $this->import_form( $preset_form_xml_path ); |
| 186 | 186 | |
| 187 | 187 | // get the form ID |
| 188 | - if( false === $form ) { |
|
| 188 | + if ( false === $form ) { |
|
| 189 | 189 | // send error to user |
| 190 | - do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int) $_POST['template_id'] ); |
|
| 190 | + do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int)$_POST[ 'template_id' ] ); |
|
| 191 | 191 | |
| 192 | 192 | $this->_exit( false ); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $this->_exit( '<option value="'.esc_attr( $form['id'] ).'" selected="selected">'.esc_html( $form['title'] ).'</option>' ); |
|
| 195 | + $this->_exit( '<option value="' . esc_attr( $form[ 'id' ] ) . '" selected="selected">' . esc_html( $form[ 'title' ] ) . '</option>' ); |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | do_action( 'gravityview_log_debug', '[import_form] Import Preset Form. (File)', $xml_or_json_path ); |
| 208 | 208 | |
| 209 | - if( empty( $xml_or_json_path ) || !class_exists('GFExport') || !file_exists( $xml_or_json_path ) ) { |
|
| 209 | + if ( empty( $xml_or_json_path ) || ! class_exists( 'GFExport' ) || ! file_exists( $xml_or_json_path ) ) { |
|
| 210 | 210 | do_action( 'gravityview_log_error', '[import_form] Class GFExport or file not found. file: ', $xml_or_json_path ); |
| 211 | 211 | return false; |
| 212 | 212 | } |
@@ -218,13 +218,13 @@ discard block |
||
| 218 | 218 | do_action( 'gravityview_log_debug', '[import_form] Importing form (Result)', $count ); |
| 219 | 219 | do_action( 'gravityview_log_debug', '[import_form] Importing form (Form) ', $forms ); |
| 220 | 220 | |
| 221 | - if( $count != 1 || empty( $forms[0]['id'] ) ) { |
|
| 221 | + if ( $count != 1 || empty( $forms[ 0 ][ 'id' ] ) ) { |
|
| 222 | 222 | do_action( 'gravityview_log_error', '[import_form] Form Import Failed!' ); |
| 223 | 223 | return false; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | // import success - return form id |
| 227 | - return $forms[0]; |
|
| 227 | + return $forms[ 0 ]; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | function get_field_options() { |
| 239 | 239 | $this->check_ajax_nonce(); |
| 240 | 240 | |
| 241 | - if( empty( $_POST['template'] ) || empty( $_POST['area'] ) || empty( $_POST['field_id'] ) || empty( $_POST['field_type'] ) ) { |
|
| 241 | + if ( empty( $_POST[ 'template' ] ) || empty( $_POST[ 'area' ] ) || empty( $_POST[ 'field_id' ] ) || empty( $_POST[ 'field_type' ] ) ) { |
|
| 242 | 242 | do_action( 'gravityview_log_error', '[get_field_options] Required fields were not set in the $_POST request. ' ); |
| 243 | 243 | $this->_exit( false ); |
| 244 | 244 | } |
@@ -250,10 +250,10 @@ discard block |
||
| 250 | 250 | $_post = array_map( 'esc_attr', $_post ); |
| 251 | 251 | |
| 252 | 252 | // The GF type of field: `product`, `name`, `creditcard`, `id`, `text` |
| 253 | - $input_type = isset($_post['input_type']) ? esc_attr( $_post['input_type'] ) : NULL; |
|
| 254 | - $context = isset($_post['context']) ? esc_attr( $_post['context'] ) : NULL; |
|
| 253 | + $input_type = isset( $_post[ 'input_type' ] ) ? esc_attr( $_post[ 'input_type' ] ) : NULL; |
|
| 254 | + $context = isset( $_post[ 'context' ] ) ? esc_attr( $_post[ 'context' ] ) : NULL; |
|
| 255 | 255 | |
| 256 | - $response = GravityView_Render_Settings::render_field_options( $_post['field_type'], $_post['template'], $_post['field_id'], $_post['field_label'], $_post['area'], $input_type, '', '', $context ); |
|
| 256 | + $response = GravityView_Render_Settings::render_field_options( $_post[ 'field_type' ], $_post[ 'template' ], $_post[ 'field_id' ], $_post[ 'field_label' ], $_post[ 'area' ], $input_type, '', '', $context ); |
|
| 257 | 257 | |
| 258 | 258 | $response = gravityview_strip_whitespace( $response ); |
| 259 | 259 | |
@@ -274,15 +274,15 @@ discard block |
||
| 274 | 274 | $form = ''; |
| 275 | 275 | |
| 276 | 276 | // if form id is set, use it, else, get form from preset |
| 277 | - if( !empty( $_POST['form_id'] ) ) { |
|
| 277 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
| 278 | 278 | |
| 279 | - $form = (int) $_POST['form_id']; |
|
| 279 | + $form = (int)$_POST[ 'form_id' ]; |
|
| 280 | 280 | |
| 281 | 281 | } |
| 282 | 282 | // get form from preset |
| 283 | - elseif( !empty( $_POST['template_id'] ) ) { |
|
| 283 | + elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 284 | 284 | |
| 285 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 285 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 286 | 286 | |
| 287 | 287 | } |
| 288 | 288 | |
@@ -298,27 +298,27 @@ discard block |
||
| 298 | 298 | * @param string $template_id Preset template |
| 299 | 299 | * |
| 300 | 300 | */ |
| 301 | - static function pre_get_form_fields( $template_id = '') { |
|
| 301 | + static function pre_get_form_fields( $template_id = '' ) { |
|
| 302 | 302 | |
| 303 | - if( empty( $template_id ) ) { |
|
| 303 | + if ( empty( $template_id ) ) { |
|
| 304 | 304 | do_action( 'gravityview_log_error', __METHOD__ . ' - Template ID not set.' ); |
| 305 | 305 | return false; |
| 306 | 306 | } else { |
| 307 | 307 | $form_file = apply_filters( 'gravityview_template_formxml', '', $template_id ); |
| 308 | - if( !file_exists( $form_file ) ) { |
|
| 309 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset ['. $template_id .']. File not found. file: ' . $form_file ); |
|
| 308 | + if ( ! file_exists( $form_file ) ) { |
|
| 309 | + do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset [' . $template_id . ']. File not found. file: ' . $form_file ); |
|
| 310 | 310 | return false; |
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // Load xml parser (from GravityForms) |
| 315 | - if( class_exists( 'GFCommon' ) ) { |
|
| 315 | + if ( class_exists( 'GFCommon' ) ) { |
|
| 316 | 316 | $xml_parser = GFCommon::get_base_path() . '/xml.php'; |
| 317 | 317 | } else { |
| 318 | 318 | $xml_parser = trailingslashit( WP_PLUGIN_DIR ) . 'gravityforms/xml.php'; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - if( file_exists( $xml_parser ) ) { |
|
| 321 | + if ( file_exists( $xml_parser ) ) { |
|
| 322 | 322 | require_once( $xml_parser ); |
| 323 | 323 | } else { |
| 324 | 324 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Gravity Forms XML Parser not found.', $xml_parser ); |
@@ -329,37 +329,37 @@ discard block |
||
| 329 | 329 | $xmlstr = file_get_contents( $form_file ); |
| 330 | 330 | |
| 331 | 331 | $options = array( |
| 332 | - "page" => array("unserialize_as_array" => true), |
|
| 333 | - "form"=> array("unserialize_as_array" => true), |
|
| 334 | - "field"=> array("unserialize_as_array" => true), |
|
| 335 | - "rule"=> array("unserialize_as_array" => true), |
|
| 336 | - "choice"=> array("unserialize_as_array" => true), |
|
| 337 | - "input"=> array("unserialize_as_array" => true), |
|
| 338 | - "routing_item"=> array("unserialize_as_array" => true), |
|
| 339 | - "creditCard"=> array("unserialize_as_array" => true), |
|
| 340 | - "routin"=> array("unserialize_as_array" => true), |
|
| 341 | - "confirmation" => array("unserialize_as_array" => true), |
|
| 342 | - "notification" => array("unserialize_as_array" => true) |
|
| 332 | + "page" => array( "unserialize_as_array" => true ), |
|
| 333 | + "form"=> array( "unserialize_as_array" => true ), |
|
| 334 | + "field"=> array( "unserialize_as_array" => true ), |
|
| 335 | + "rule"=> array( "unserialize_as_array" => true ), |
|
| 336 | + "choice"=> array( "unserialize_as_array" => true ), |
|
| 337 | + "input"=> array( "unserialize_as_array" => true ), |
|
| 338 | + "routing_item"=> array( "unserialize_as_array" => true ), |
|
| 339 | + "creditCard"=> array( "unserialize_as_array" => true ), |
|
| 340 | + "routin"=> array( "unserialize_as_array" => true ), |
|
| 341 | + "confirmation" => array( "unserialize_as_array" => true ), |
|
| 342 | + "notification" => array( "unserialize_as_array" => true ) |
|
| 343 | 343 | ); |
| 344 | 344 | |
| 345 | - $xml = new RGXML($options); |
|
| 346 | - $forms = $xml->unserialize($xmlstr); |
|
| 345 | + $xml = new RGXML( $options ); |
|
| 346 | + $forms = $xml->unserialize( $xmlstr ); |
|
| 347 | 347 | |
| 348 | - if( !$forms ) { |
|
| 349 | - do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file ); |
|
| 348 | + if ( ! $forms ) { |
|
| 349 | + do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. Error importing file. (File)', $form_file ); |
|
| 350 | 350 | return false; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - if( !empty( $forms[0] ) && is_array( $forms[0] ) ) { |
|
| 354 | - $form = $forms[0]; |
|
| 353 | + if ( ! empty( $forms[ 0 ] ) && is_array( $forms[ 0 ] ) ) { |
|
| 354 | + $form = $forms[ 0 ]; |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - if( empty( $form ) ) { |
|
| 357 | + if ( empty( $form ) ) { |
|
| 358 | 358 | do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms ); |
| 359 | 359 | return false; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form ); |
|
| 362 | + do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. (Form)', $form ); |
|
| 363 | 363 | |
| 364 | 364 | return $form; |
| 365 | 365 | |
@@ -373,38 +373,38 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | function import_fields( $file ) { |
| 375 | 375 | |
| 376 | - if( empty( $file ) || !file_exists( $file ) ) { |
|
| 376 | + if ( empty( $file ) || ! file_exists( $file ) ) { |
|
| 377 | 377 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields. File not found. (File)', $file ); |
| 378 | 378 | return false; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - if( !class_exists('WXR_Parser') ) { |
|
| 381 | + if ( ! class_exists( 'WXR_Parser' ) ) { |
|
| 382 | 382 | include_once GRAVITYVIEW_DIR . 'includes/lib/xml-parsers/parsers.php'; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | $parser = new WXR_Parser(); |
| 386 | 386 | $presets = $parser->parse( $file ); |
| 387 | 387 | |
| 388 | - if(is_wp_error( $presets )) { |
|
| 388 | + if ( is_wp_error( $presets ) ) { |
|
| 389 | 389 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Threw WP_Error.', $presets ); |
| 390 | 390 | return false; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - if( empty( $presets['posts'][0]['postmeta'] ) && !is_array( $presets['posts'][0]['postmeta'] ) ) { |
|
| 393 | + if ( empty( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) && ! is_array( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ) { |
|
| 394 | 394 | do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Meta not found in file.', $file ); |
| 395 | 395 | return false; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets['posts'][0]['postmeta'] ); |
|
| 398 | + do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets[ 'posts' ][ 0 ][ 'postmeta' ] ); |
|
| 399 | 399 | |
| 400 | 400 | $fields = $widgets = array(); |
| 401 | - foreach( $presets['posts'][0]['postmeta'] as $meta ) { |
|
| 402 | - switch ($meta['key']) { |
|
| 401 | + foreach ( $presets[ 'posts' ][ 0 ][ 'postmeta' ] as $meta ) { |
|
| 402 | + switch ( $meta[ 'key' ] ) { |
|
| 403 | 403 | case '_gravityview_directory_fields': |
| 404 | - $fields = maybe_unserialize( $meta['value'] ); |
|
| 404 | + $fields = maybe_unserialize( $meta[ 'value' ] ); |
|
| 405 | 405 | break; |
| 406 | 406 | case '_gravityview_directory_widgets': |
| 407 | - $widgets = maybe_unserialize( $meta['value'] ); |
|
| 407 | + $widgets = maybe_unserialize( $meta[ 'value' ] ); |
|
| 408 | 408 | break; |
| 409 | 409 | } |
| 410 | 410 | } |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | /** gf_entries page - entries table screen */ |
| 35 | 35 | |
| 36 | 36 | // capture bulk actions |
| 37 | - add_action( 'init', array( $this, 'process_bulk_action') ); |
|
| 37 | + add_action( 'init', array( $this, 'process_bulk_action' ) ); |
|
| 38 | 38 | // add hidden field with approve status |
| 39 | 39 | add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
| 40 | 40 | // process ajax approve entry requests |
| 41 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
| 41 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
| 42 | 42 | |
| 43 | 43 | // in case entry is edited (on admin or frontend) |
| 44 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
| 44 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
| 45 | 45 | |
| 46 | 46 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
| 47 | 47 | |
| 48 | 48 | // adding styles and scripts |
| 49 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
| 49 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
| 50 | 50 | // bypass Gravity Forms no-conflict mode |
| 51 | 51 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
| 52 | 52 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | function tooltips( $tooltips ) { |
| 63 | 63 | |
| 64 | - $tooltips['form_gravityview_fields'] = array( |
|
| 65 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
| 66 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
| 64 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
| 65 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
| 66 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | 69 | return $tooltips; |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
| 181 | - if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) { |
|
| 181 | + if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
| 182 | 182 | |
| 183 | 183 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
| 184 | 184 | |
| 185 | 185 | // The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form. |
| 186 | - $bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2']; |
|
| 186 | + $bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ]; |
|
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * The extra '-' is to make sure that there are at *least* two items in array. |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | // All entries are set to be updated, not just the visible ones |
| 202 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
| 202 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
| 203 | 203 | |
| 204 | 204 | // Convert the current entry search into GF-formatted search criteria |
| 205 | 205 | $search = array( |
| 206 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
| 207 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
| 208 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
| 206 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
| 207 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
| 208 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
| 209 | 209 | ); |
| 210 | 210 | |
| 211 | 211 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | } else { |
| 217 | 217 | |
| 218 | - $entries = $_POST['lead']; |
|
| 218 | + $entries = $_POST[ 'lead' ]; |
|
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | private static function update_bulk( $entries, $approved, $form_id ) { |
| 258 | 258 | |
| 259 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
| 259 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
| 260 | 260 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
| 261 | 261 | return false; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 264 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 265 | 265 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 266 | 266 | return false; |
| 267 | 267 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | // calculate approved field id |
| 272 | 272 | $approved_column_id = self::get_approved_column( $form_id ); |
| 273 | 273 | |
| 274 | - foreach( $entries as $entry_id ) { |
|
| 274 | + foreach ( $entries as $entry_id ) { |
|
| 275 | 275 | self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -290,14 +290,14 @@ discard block |
||
| 290 | 290 | * @param int $approvedcolumn (default: 0) |
| 291 | 291 | * @return boolean True: It worked; False: it failed |
| 292 | 292 | */ |
| 293 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
| 293 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
| 294 | 294 | |
| 295 | - if( !class_exists( 'GFAPI' ) ) { |
|
| 295 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
| 296 | 296 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
| 297 | 297 | return false; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if( empty( $approvedcolumn ) ) { |
|
| 300 | + if ( empty( $approvedcolumn ) ) { |
|
| 301 | 301 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 302 | 302 | } |
| 303 | 303 | |
@@ -316,10 +316,10 @@ discard block |
||
| 316 | 316 | self::update_approved_meta( $entry_id, $approved ); |
| 317 | 317 | |
| 318 | 318 | // add note to entry |
| 319 | - if( $result === true ) { |
|
| 319 | + if ( $result === true ) { |
|
| 320 | 320 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
| 321 | 321 | |
| 322 | - if( class_exists( 'GravityView_Entry_Notes' ) ){ |
|
| 322 | + if ( class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 323 | 323 | global $current_user; |
| 324 | 324 | get_currentuserinfo(); |
| 325 | 325 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | do_action( 'gravityview_clear_form_cache', $form_id ); |
| 334 | 334 | |
| 335 | - } else if( is_wp_error( $result ) ) { |
|
| 335 | + } else if ( is_wp_error( $result ) ) { |
|
| 336 | 336 | |
| 337 | 337 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
| 338 | 338 | |
@@ -354,12 +354,12 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | public static function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
| 356 | 356 | |
| 357 | - $approvedcolumn = self::get_approved_column( $form['id'] ); |
|
| 357 | + $approvedcolumn = self::get_approved_column( $form[ 'id' ] ); |
|
| 358 | 358 | |
| 359 | 359 | /** |
| 360 | 360 | * If the form doesn't contain the approve field, don't assume anything. |
| 361 | 361 | */ |
| 362 | - if( empty( $approvedcolumn ) ) { |
|
| 362 | + if ( empty( $approvedcolumn ) ) { |
|
| 363 | 363 | return; |
| 364 | 364 | } |
| 365 | 365 | |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | private static function update_approved_meta( $entry_id, $is_approved ) { |
| 382 | 382 | |
| 383 | 383 | // update entry meta |
| 384 | - if( function_exists('gform_update_meta') ) { |
|
| 384 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
| 385 | 385 | |
| 386 | 386 | gform_update_meta( $entry_id, 'is_approved', $is_approved ); |
| 387 | 387 | |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | */ |
| 394 | 394 | do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); |
| 395 | 395 | |
| 396 | - if( empty( $is_approved ) ) { |
|
| 396 | + if ( empty( $is_approved ) ) { |
|
| 397 | 397 | |
| 398 | 398 | /** |
| 399 | 399 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | } else { |
| 417 | 417 | |
| 418 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 418 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
| 419 | 419 | |
| 420 | 420 | } |
| 421 | 421 | } |
@@ -427,21 +427,21 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | public function ajax_update_approved() { |
| 429 | 429 | |
| 430 | - if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { |
|
| 430 | + if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) { |
|
| 431 | 431 | |
| 432 | 432 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
| 433 | 433 | |
| 434 | 434 | $result = false; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
| 437 | + else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) { |
|
| 438 | 438 | |
| 439 | 439 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
| 440 | 440 | |
| 441 | 441 | $result = false; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
| 444 | + else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) { |
|
| 445 | 445 | |
| 446 | 446 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
| 447 | 447 | |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | else { |
| 452 | 452 | |
| 453 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
|
| 453 | + $result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] ); |
|
| 454 | 454 | |
| 455 | - if( is_wp_error( $result ) ) { |
|
| 455 | + if ( is_wp_error( $result ) ) { |
|
| 456 | 456 | /** @var WP_Error $result */ |
| 457 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); |
|
| 457 | + do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() ); |
|
| 458 | 458 | $result = false; |
| 459 | 459 | } |
| 460 | 460 | |
@@ -474,29 +474,29 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | static public function get_approved_column( $form ) { |
| 476 | 476 | |
| 477 | - if( empty( $form ) ) { |
|
| 477 | + if ( empty( $form ) ) { |
|
| 478 | 478 | return null; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - if( !is_array( $form ) ) { |
|
| 481 | + if ( ! is_array( $form ) ) { |
|
| 482 | 482 | $form = GVCommon::get_form( $form ); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - foreach( $form['fields'] as $key => $field ) { |
|
| 485 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
| 486 | 486 | |
| 487 | - $field = (array) $field; |
|
| 487 | + $field = (array)$field; |
|
| 488 | 488 | |
| 489 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
| 490 | - if( !empty($field['inputs'][0]['id']) ) { |
|
| 491 | - return $field['inputs'][0]['id']; |
|
| 489 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
| 490 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
| 491 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
| 496 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
| 497 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
| 498 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
| 499 | - return $input['id']; |
|
| 496 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
| 497 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
| 498 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
| 499 | + return $input[ 'id' ]; |
|
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | } |
@@ -507,18 +507,18 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | |
| 509 | 509 | |
| 510 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 510 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 511 | 511 | |
| 512 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
| 512 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
| 513 | 513 | return; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - if( empty( $entry['id'] ) ) { |
|
| 516 | + if ( empty( $entry[ 'id' ] ) ) { |
|
| 517 | 517 | return; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - if( gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
| 521 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
| 520 | + if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
| 521 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; |
|
| 522 | 522 | } |
| 523 | 523 | } |
| 524 | 524 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | function add_scripts_and_styles( $hook ) { |
| 529 | 529 | |
| 530 | - if( !class_exists( 'RGForms' ) ) { |
|
| 530 | + if ( ! class_exists( 'RGForms' ) ) { |
|
| 531 | 531 | |
| 532 | 532 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
| 533 | 533 | |
@@ -536,40 +536,40 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | // enqueue styles & scripts gf_entries |
| 538 | 538 | // But only if we're on the main Entries page, not on reports pages |
| 539 | - if( RGForms::get_page() === 'entry_list' ) { |
|
| 539 | + if ( RGForms::get_page() === 'entry_list' ) { |
|
| 540 | 540 | |
| 541 | - $form_id = RGForms::get('id'); |
|
| 541 | + $form_id = RGForms::get( 'id' ); |
|
| 542 | 542 | |
| 543 | 543 | // If there are no forms identified, use the first form. That's how GF does it. |
| 544 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
| 544 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
| 545 | 545 | $forms = gravityview_get_forms(); |
| 546 | - if( !empty( $forms ) ) { |
|
| 547 | - $form_id = $forms[0]['id']; |
|
| 546 | + if ( ! empty( $forms ) ) { |
|
| 547 | + $form_id = $forms[ 0 ][ 'id' ]; |
|
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | $approvedcolumn = self::get_approved_column( $form_id ); |
| 552 | 552 | |
| 553 | - wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 553 | + wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 554 | 554 | wp_enqueue_style( 'gravityview_entries_list' ); |
| 555 | 555 | |
| 556 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 556 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 557 | 557 | |
| 558 | - wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 558 | + wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 559 | 559 | wp_enqueue_script( 'gravityview_gf_entries_scripts' ); |
| 560 | 560 | |
| 561 | 561 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
| 562 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), |
|
| 562 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ), |
|
| 563 | 563 | 'form_id' => $form_id, |
| 564 | 564 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
| 565 | 565 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
| 566 | - 'label_approve' => __( 'Approve', 'gravityview' ) , |
|
| 566 | + 'label_approve' => __( 'Approve', 'gravityview' ), |
|
| 567 | 567 | 'label_disapprove' => __( 'Disapprove', 'gravityview' ), |
| 568 | 568 | 'bulk_message' => $this->bulk_update_message, |
| 569 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
| 570 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
| 571 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
| 572 | - 'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ), |
|
| 569 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), |
|
| 570 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), |
|
| 571 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
| 572 | + 'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ), |
|
| 573 | 573 | ) ); |
| 574 | 574 | |
| 575 | 575 | } |
@@ -594,13 +594,13 @@ discard block |
||
| 594 | 594 | * @since 1.7.2 |
| 595 | 595 | * @param boolean $hide_if_no_connections |
| 596 | 596 | */ |
| 597 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 597 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 598 | 598 | |
| 599 | - if( $hide_if_no_connections ) { |
|
| 599 | + if ( $hide_if_no_connections ) { |
|
| 600 | 600 | |
| 601 | 601 | $connected_views = gravityview_get_connected_views( $form_id ); |
| 602 | 602 | |
| 603 | - if( empty( $connected_views ) ) { |
|
| 603 | + if ( empty( $connected_views ) ) { |
|
| 604 | 604 | $show_approve_column = false; |
| 605 | 605 | } |
| 606 | 606 | } |
@@ -610,18 +610,18 @@ discard block |
||
| 610 | 610 | * @param boolean $show_approve_column Whether the column will be shown |
| 611 | 611 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
| 612 | 612 | */ |
| 613 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 613 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 614 | 614 | |
| 615 | 615 | return $show_approve_column; |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | function register_gform_noconflict_script( $scripts ) { |
| 619 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
| 619 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
| 620 | 620 | return $scripts; |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | function register_gform_noconflict_style( $styles ) { |
| 624 | - $styles[] = 'gravityview_entries_list'; |
|
| 624 | + $styles[ ] = 'gravityview_entries_list'; |
|
| 625 | 625 | return $styles; |
| 626 | 626 | } |
| 627 | 627 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | if( $result === true ) { |
| 320 | 320 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
| 321 | 321 | |
| 322 | - if( class_exists( 'GravityView_Entry_Notes' ) ){ |
|
| 322 | + if( class_exists( 'GravityView_Entry_Notes' ) ) { |
|
| 323 | 323 | global $current_user; |
| 324 | 324 | get_currentuserinfo(); |
| 325 | 325 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
@@ -432,23 +432,17 @@ discard block |
||
| 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 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | $this->context_view_id = $_GET['gvid']; |
| 243 | 243 | |
| 244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 244 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 246 | 246 | $this->context_view_id = array_pop( $array_keys ); |
| 247 | 247 | unset( $array_keys ); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | global $post; |
| 270 | 270 | |
| 271 | 271 | // If in admin and NOT AJAX request, get outta here. |
| 272 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 272 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // User reported WooCommerce doesn't pass two args. |
| 375 | - if ( empty( $passed_post_id ) ) { |
|
| 375 | + if ( empty( $passed_post_id ) ) { |
|
| 376 | 376 | return $title; |
| 377 | 377 | } |
| 378 | 378 | |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | */ |
| 1109 | 1109 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1110 | 1110 | |
| 1111 | - switch( strtolower( $address_part ) ){ |
|
| 1111 | + switch( strtolower( $address_part ) ) { |
|
| 1112 | 1112 | case 'street': |
| 1113 | 1113 | $sort_field_id .= '.1'; |
| 1114 | 1114 | break; |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | */ |
| 1189 | 1189 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1190 | 1190 | |
| 1191 | - if ( empty( $single_entry ) ){ |
|
| 1191 | + if ( empty( $single_entry ) ) { |
|
| 1192 | 1192 | return false; |
| 1193 | 1193 | } else { |
| 1194 | 1194 | return $single_entry; |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | private function __construct() {} |
| 86 | 86 | |
| 87 | 87 | private function initialize() { |
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
| 89 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
| 89 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
| 90 | 90 | |
| 91 | 91 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
| 92 | 92 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -233,15 +233,15 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $this->context_view_id = $view_id; |
| 235 | 235 | |
| 236 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 236 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 237 | 237 | /** |
| 238 | 238 | * used on a has_multiple_views context |
| 239 | 239 | * @see GravityView_API::entry_link |
| 240 | 240 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
| 241 | 241 | */ |
| 242 | - $this->context_view_id = $_GET['gvid']; |
|
| 242 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 243 | 243 | |
| 244 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 244 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | 245 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 246 | 246 | $this->context_view_id = array_pop( $array_keys ); |
| 247 | 247 | unset( $array_keys ); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | global $post; |
| 270 | 270 | |
| 271 | 271 | // If in admin and NOT AJAX request, get outta here. |
| 272 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 272 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 273 | 273 | return; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 283 | 283 | |
| 284 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 284 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 285 | 285 | $this->setPostId( $post_id ); |
| 286 | 286 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 287 | 287 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -365,20 +365,20 @@ discard block |
||
| 365 | 365 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 366 | 366 | * @param array $entry Current entry |
| 367 | 367 | */ |
| 368 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 368 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 369 | 369 | |
| 370 | 370 | if ( ! $apply_outside_loop ) { |
| 371 | 371 | return $title; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // User reported WooCommerce doesn't pass two args. |
| 375 | - if ( empty( $passed_post_id ) ) { |
|
| 375 | + if ( empty( $passed_post_id ) ) { |
|
| 376 | 376 | return $title; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // Don't modify the title for anything other than the current view/post. |
| 380 | 380 | // This is true for embedded shortcodes and Views. |
| 381 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 381 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 382 | 382 | return $title; |
| 383 | 383 | } |
| 384 | 384 | |
@@ -388,19 +388,19 @@ discard block |
||
| 388 | 388 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
| 389 | 389 | } else { |
| 390 | 390 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 391 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 391 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 392 | 392 | $view_meta = $view_data; |
| 393 | 393 | break; |
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 398 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 399 | 399 | |
| 400 | - $title = $view_meta['atts']['single_title']; |
|
| 400 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 401 | 401 | |
| 402 | 402 | // We are allowing HTML in the fields, so no escaping the output |
| 403 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 403 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 404 | 404 | |
| 405 | 405 | $title = do_shortcode( $title ); |
| 406 | 406 | } |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | public function render_view( $passed_args ) { |
| 502 | 502 | |
| 503 | 503 | // validate attributes |
| 504 | - if ( empty( $passed_args['id'] ) ) { |
|
| 504 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
| 505 | 505 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
| 506 | 506 | return null; |
| 507 | 507 | } |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | return null; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - $view_id = $passed_args['id']; |
|
| 526 | + $view_id = $passed_args[ 'id' ]; |
|
| 527 | 527 | |
| 528 | 528 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
| 529 | 529 | |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | $passed_args = array_filter( $passed_args, 'strlen' ); |
| 537 | 537 | |
| 538 | 538 | //Override shortcode args over View template settings |
| 539 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
| 539 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
| 540 | 540 | |
| 541 | 541 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
| 542 | 542 | |
@@ -558,11 +558,11 @@ discard block |
||
| 558 | 558 | * Don't render View if user isn't allowed to see it |
| 559 | 559 | * @since 1.15 |
| 560 | 560 | */ |
| 561 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 561 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 562 | 562 | return null; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - if( $this->isGravityviewPostType() ) { |
|
| 565 | + if ( $this->isGravityviewPostType() ) { |
|
| 566 | 566 | |
| 567 | 567 | /** |
| 568 | 568 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -574,9 +574,9 @@ discard block |
||
| 574 | 574 | */ |
| 575 | 575 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
| 576 | 576 | |
| 577 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
| 577 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
| 578 | 578 | |
| 579 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 579 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 580 | 580 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 581 | 581 | } |
| 582 | 582 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | |
| 592 | 592 | $gravityview_view = new GravityView_View( $view_data ); |
| 593 | 593 | |
| 594 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
| 594 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
| 595 | 595 | |
| 596 | 596 | $gravityview_view->setPostId( $post_id ); |
| 597 | 597 | |
@@ -601,20 +601,20 @@ discard block |
||
| 601 | 601 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
| 602 | 602 | |
| 603 | 603 | //fetch template and slug |
| 604 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
| 604 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
| 605 | 605 | |
| 606 | 606 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
| 607 | 607 | |
| 608 | 608 | /** |
| 609 | 609 | * Disable fetching initial entries for views that don't need it (DataTables) |
| 610 | 610 | */ |
| 611 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
| 611 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
| 612 | 612 | |
| 613 | 613 | /** |
| 614 | 614 | * Hide View data until search is performed |
| 615 | 615 | * @since 1.5.4 |
| 616 | 616 | */ |
| 617 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
| 617 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
| 618 | 618 | $gravityview_view->setHideUntilSearched( true ); |
| 619 | 619 | $get_entries = false; |
| 620 | 620 | } |
@@ -622,23 +622,23 @@ discard block |
||
| 622 | 622 | |
| 623 | 623 | if ( $get_entries ) { |
| 624 | 624 | |
| 625 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
| 625 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
| 626 | 626 | // add filter to enable column sorting |
| 627 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
| 627 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
| 630 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
| 631 | 631 | |
| 632 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
| 632 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
| 633 | 633 | |
| 634 | 634 | } else { |
| 635 | 635 | |
| 636 | 636 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
| 637 | 637 | |
| 638 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
| 638 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
| 641 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
| 642 | 642 | $gravityview_view->setContext( 'directory' ); |
| 643 | 643 | $sections = array( 'header', 'body', 'footer' ); |
| 644 | 644 | |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | // user requested Single Entry View |
| 648 | 648 | do_action( 'gravityview_log_debug', '[render_view] Executing Single View' ); |
| 649 | 649 | |
| 650 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
| 650 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
| 651 | 651 | |
| 652 | 652 | $entry = $this->getEntry(); |
| 653 | 653 | |
@@ -674,20 +674,20 @@ discard block |
||
| 674 | 674 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
| 675 | 675 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
| 676 | 676 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
| 677 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
| 677 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
| 678 | 678 | return null; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | //fetch template and slug |
| 682 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
| 682 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
| 683 | 683 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
| 684 | 684 | |
| 685 | 685 | //fetch entry detail |
| 686 | - $view_entries['count'] = 1; |
|
| 687 | - $view_entries['entries'][] = $entry; |
|
| 688 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
| 686 | + $view_entries[ 'count' ] = 1; |
|
| 687 | + $view_entries[ 'entries' ][ ] = $entry; |
|
| 688 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
| 689 | 689 | |
| 690 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
| 690 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
| 691 | 691 | |
| 692 | 692 | // set back link label |
| 693 | 693 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -697,11 +697,11 @@ discard block |
||
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | // add template style |
| 700 | - self::add_style( $view_data['template_id'] ); |
|
| 700 | + self::add_style( $view_data[ 'template_id' ] ); |
|
| 701 | 701 | |
| 702 | 702 | // Prepare to render view and set vars |
| 703 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
| 704 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
| 703 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
| 704 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
| 705 | 705 | |
| 706 | 706 | // If Edit |
| 707 | 707 | if ( 'edit' === gravityview_get_context() ) { |
@@ -714,11 +714,11 @@ discard block |
||
| 714 | 714 | |
| 715 | 715 | } else { |
| 716 | 716 | // finaly we'll render some html |
| 717 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
| 717 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
| 718 | 718 | |
| 719 | 719 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
| 720 | 720 | foreach ( $sections as $section ) { |
| 721 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
| 721 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
| 722 | 722 | $gravityview_view->render( $view_slug, $section, false ); |
| 723 | 723 | } |
| 724 | 724 | } |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | $datetime_format = 'Y-m-d H:i:s'; |
| 773 | 773 | $search_is_outside_view_bounds = false; |
| 774 | 774 | |
| 775 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 775 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 776 | 776 | |
| 777 | 777 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 778 | 778 | |
@@ -800,14 +800,14 @@ discard block |
||
| 800 | 800 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 801 | 801 | |
| 802 | 802 | // Then we override the search and re-set the start date |
| 803 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 803 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 804 | 804 | } |
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 808 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 809 | 809 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 810 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 810 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 811 | 811 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
| 812 | 812 | } |
| 813 | 813 | } |
@@ -825,9 +825,9 @@ discard block |
||
| 825 | 825 | */ |
| 826 | 826 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 827 | 827 | |
| 828 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 829 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 830 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 828 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 829 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 830 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 831 | 831 | |
| 832 | 832 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
| 833 | 833 | } |
@@ -851,12 +851,12 @@ discard block |
||
| 851 | 851 | */ |
| 852 | 852 | public static function is_entry_approved( $entry, $args = array() ) { |
| 853 | 853 | |
| 854 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 854 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 855 | 855 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 856 | 856 | return true; |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
| 859 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); |
|
| 860 | 860 | |
| 861 | 861 | if ( $is_approved ) { |
| 862 | 862 | return true; |
@@ -889,26 +889,26 @@ discard block |
||
| 889 | 889 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
| 890 | 890 | |
| 891 | 891 | // implicity search |
| 892 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 892 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 893 | 893 | |
| 894 | 894 | // Search operator options. Options: `is` or `contains` |
| 895 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 895 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 896 | 896 | |
| 897 | - $search_criteria['field_filters'][] = array( |
|
| 897 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 898 | 898 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
| 899 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 899 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 900 | 900 | 'operator' => $operator, |
| 901 | 901 | ); |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 904 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 905 | 905 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | // Handle setting date range |
| 909 | 909 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 910 | 910 | |
| 911 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 911 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 912 | 912 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
| 913 | 913 | } |
| 914 | 914 | |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 920 | 920 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 921 | 921 | */ |
| 922 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 922 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 923 | 923 | |
| 924 | 924 | return $search_criteria; |
| 925 | 925 | } |
@@ -965,16 +965,16 @@ discard block |
||
| 965 | 965 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
| 966 | 966 | |
| 967 | 967 | // Paging & offset |
| 968 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 968 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 969 | 969 | |
| 970 | 970 | if ( -1 === $page_size ) { |
| 971 | 971 | $page_size = PHP_INT_MAX; |
| 972 | 972 | } |
| 973 | 973 | |
| 974 | - if ( isset( $args['offset'] ) ) { |
|
| 975 | - $offset = intval( $args['offset'] ); |
|
| 974 | + if ( isset( $args[ 'offset' ] ) ) { |
|
| 975 | + $offset = intval( $args[ 'offset' ] ); |
|
| 976 | 976 | } else { |
| 977 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 977 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 978 | 978 | $offset = ( $curr_page - 1 ) * $page_size; |
| 979 | 979 | } |
| 980 | 980 | |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | 'search_criteria' => $search_criteria, |
| 993 | 993 | 'sorting' => $sorting, |
| 994 | 994 | 'paging' => $paging, |
| 995 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 995 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 996 | 996 | ); |
| 997 | 997 | |
| 998 | 998 | /** |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 1018 | 1018 | * @param array $args View configuration args. |
| 1019 | 1019 | */ |
| 1020 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
| 1020 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
| 1021 | 1021 | |
| 1022 | 1022 | do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters ); |
| 1023 | 1023 | |
@@ -1057,8 +1057,8 @@ discard block |
||
| 1057 | 1057 | */ |
| 1058 | 1058 | public static function updateViewSorting( $args, $form_id ) { |
| 1059 | 1059 | $sorting = array(); |
| 1060 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
| 1061 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
| 1060 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
| 1061 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
| 1062 | 1062 | |
| 1063 | 1063 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1064 | 1064 | |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | |
| 1099 | 1099 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1100 | 1100 | |
| 1101 | - switch ( $sort_field['type'] ) { |
|
| 1101 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1102 | 1102 | |
| 1103 | 1103 | case 'address': |
| 1104 | 1104 | // Sorting by full address |
@@ -1115,7 +1115,7 @@ discard block |
||
| 1115 | 1115 | */ |
| 1116 | 1116 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1117 | 1117 | |
| 1118 | - switch( strtolower( $address_part ) ){ |
|
| 1118 | + switch ( strtolower( $address_part ) ) { |
|
| 1119 | 1119 | case 'street': |
| 1120 | 1120 | $sort_field_id .= '.1'; |
| 1121 | 1121 | break; |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | */ |
| 1196 | 1196 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1197 | 1197 | |
| 1198 | - if ( empty( $single_entry ) ){ |
|
| 1198 | + if ( empty( $single_entry ) ) { |
|
| 1199 | 1199 | return false; |
| 1200 | 1200 | } else { |
| 1201 | 1201 | return $single_entry; |
@@ -1222,7 +1222,7 @@ discard block |
||
| 1222 | 1222 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1223 | 1223 | * @since 1.15 |
| 1224 | 1224 | */ |
| 1225 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1225 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1226 | 1226 | continue; |
| 1227 | 1227 | } |
| 1228 | 1228 | |
@@ -1231,19 +1231,19 @@ discard block |
||
| 1231 | 1231 | $css_dependencies = array(); |
| 1232 | 1232 | |
| 1233 | 1233 | // If the thickbox is enqueued, add dependencies |
| 1234 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
| 1234 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
| 1235 | 1235 | |
| 1236 | 1236 | /** |
| 1237 | 1237 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1238 | 1238 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1239 | 1239 | */ |
| 1240 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1240 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1241 | 1241 | |
| 1242 | 1242 | /** |
| 1243 | 1243 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1244 | 1244 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1245 | 1245 | */ |
| 1246 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1246 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | /** |
@@ -1251,25 +1251,25 @@ discard block |
||
| 1251 | 1251 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1252 | 1252 | * @since 1.15 |
| 1253 | 1253 | */ |
| 1254 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1255 | - $css_dependencies[] = 'dashicons'; |
|
| 1254 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1255 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1259 | 1259 | |
| 1260 | 1260 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1261 | 1261 | |
| 1262 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
| 1262 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
| 1263 | 1263 | |
| 1264 | 1264 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1265 | 1265 | |
| 1266 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1266 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1267 | 1267 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1271 | 1271 | |
| 1272 | - self::add_style( $data['template_id'] ); |
|
| 1272 | + self::add_style( $data[ 'template_id' ] ); |
|
| 1273 | 1273 | |
| 1274 | 1274 | } |
| 1275 | 1275 | |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | } elseif ( empty( $template_id ) ) { |
| 1306 | 1306 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
| 1307 | 1307 | } else { |
| 1308 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
| 1308 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | 1311 | } |
@@ -1330,11 +1330,11 @@ discard block |
||
| 1330 | 1330 | * Not a table-based template; don't add sort icons |
| 1331 | 1331 | * @since 1.12 |
| 1332 | 1332 | */ |
| 1333 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1333 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1334 | 1334 | return $label; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1337 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1338 | 1338 | return $label; |
| 1339 | 1339 | } |
| 1340 | 1340 | |
@@ -1342,29 +1342,29 @@ discard block |
||
| 1342 | 1342 | |
| 1343 | 1343 | $class = 'gv-sort'; |
| 1344 | 1344 | |
| 1345 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1345 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1346 | 1346 | |
| 1347 | 1347 | $sort_args = array( |
| 1348 | - 'sort' => $field['id'], |
|
| 1348 | + 'sort' => $field[ 'id' ], |
|
| 1349 | 1349 | 'dir' => 'asc', |
| 1350 | 1350 | ); |
| 1351 | 1351 | |
| 1352 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1352 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1353 | 1353 | //toggle sorting direction. |
| 1354 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1355 | - $sort_args['dir'] = 'desc'; |
|
| 1354 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1355 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1356 | 1356 | $class .= ' gv-icon-sort-desc'; |
| 1357 | 1357 | } else { |
| 1358 | - $sort_args['dir'] = 'asc'; |
|
| 1358 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1359 | 1359 | $class .= ' gv-icon-sort-asc'; |
| 1360 | 1360 | } |
| 1361 | 1361 | } else { |
| 1362 | 1362 | $class .= ' gv-icon-caret-up-down'; |
| 1363 | 1363 | } |
| 1364 | 1364 | |
| 1365 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1365 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1366 | 1366 | |
| 1367 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1367 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1368 | 1368 | |
| 1369 | 1369 | } |
| 1370 | 1370 | |
@@ -1382,7 +1382,7 @@ discard block |
||
| 1382 | 1382 | |
| 1383 | 1383 | $field_type = $field_id; |
| 1384 | 1384 | |
| 1385 | - if( is_numeric( $field_id ) ) { |
|
| 1385 | + if ( is_numeric( $field_id ) ) { |
|
| 1386 | 1386 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1387 | 1387 | $field_type = $field->type; |
| 1388 | 1388 | } |
@@ -1405,7 +1405,7 @@ discard block |
||
| 1405 | 1405 | return false; |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1408 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1409 | 1409 | |
| 1410 | 1410 | } |
| 1411 | 1411 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public static function get_instance() { |
| 35 | 35 | |
| 36 | - if( ! self::$instance ) { |
|
| 36 | + if ( ! self::$instance ) { |
|
| 37 | 37 | self::$instance = new self; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) ); |
| 57 | 57 | add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 ); |
| 58 | 58 | add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 ); |
| 59 | - add_action( 'admin_init', array( $this, 'add_caps') ); |
|
| 59 | + add_action( 'admin_init', array( $this, 'add_caps' ) ); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -77,18 +77,18 @@ discard block |
||
| 77 | 77 | public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) { |
| 78 | 78 | |
| 79 | 79 | // Empty caps_to_check array |
| 80 | - if( ! $usercaps || ! $caps ) { |
|
| 80 | + if ( ! $usercaps || ! $caps ) { |
|
| 81 | 81 | return $usercaps; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled |
| 86 | 86 | */ |
| 87 | - if( ! empty( $usercaps['gravityview_full_access'] ) ) { |
|
| 87 | + if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) { |
|
| 88 | 88 | |
| 89 | 89 | $all_gravityview_caps = self::all_caps(); |
| 90 | 90 | |
| 91 | - foreach( $all_gravityview_caps as $gv_cap ) { |
|
| 91 | + foreach ( $all_gravityview_caps as $gv_cap ) { |
|
| 92 | 92 | $usercaps[ $gv_cap ] = true; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $all = $administrator; |
| 305 | 305 | |
| 306 | 306 | // If role is set, return caps_to_check for just that role. |
| 307 | - if( $single_role ) { |
|
| 307 | + if ( $single_role ) { |
|
| 308 | 308 | $caps = isset( ${$single_role} ) ? ${$single_role} : false; |
| 309 | 309 | return $flat_array ? $caps : array( $single_role => $caps ); |
| 310 | 310 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $has_cap = false; |
| 336 | 336 | |
| 337 | - if( empty( $caps_to_check ) ) { |
|
| 337 | + if ( empty( $caps_to_check ) ) { |
|
| 338 | 338 | return $has_cap; |
| 339 | 339 | } |
| 340 | 340 | |
@@ -342,13 +342,13 @@ discard block |
||
| 342 | 342 | $caps_to_check = self::maybe_add_full_access_caps( $caps_to_check ); |
| 343 | 343 | |
| 344 | 344 | foreach ( $caps_to_check as $cap ) { |
| 345 | - if( ! is_null( $object_id ) ) { |
|
| 345 | + if ( ! is_null( $object_id ) ) { |
|
| 346 | 346 | $has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id ); |
| 347 | 347 | } else { |
| 348 | 348 | $has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap ); |
| 349 | 349 | } |
| 350 | 350 | // At the first successful response, stop checking |
| 351 | - if( $has_cap ) { |
|
| 351 | + if ( $has_cap ) { |
|
| 352 | 352 | break; |
| 353 | 353 | } |
| 354 | 354 | } |
@@ -372,15 +372,15 @@ discard block |
||
| 372 | 372 | $all_gravityview_caps = self::all_caps(); |
| 373 | 373 | |
| 374 | 374 | // Are there any $caps_to_check that are from GravityView? |
| 375 | - if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) { |
|
| 376 | - $caps_to_check[] = 'gravityview_full_access'; |
|
| 375 | + if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) { |
|
| 376 | + $caps_to_check[ ] = 'gravityview_full_access'; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array(); |
| 380 | 380 | |
| 381 | 381 | // Are there any $caps_to_check that are from Gravity Forms? |
| 382 | - if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) { |
|
| 383 | - $caps_to_check[] = 'gform_full_access'; |
|
| 382 | + if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) { |
|
| 383 | + $caps_to_check[ ] = 'gform_full_access'; |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | return array_unique( $caps_to_check ); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $capabilities = self::all_caps(); |
| 403 | 403 | |
| 404 | 404 | // Loop through each role and remove GV caps_to_check |
| 405 | - foreach( $wp_roles->get_names() as $role_slug => $role_name ) { |
|
| 405 | + foreach ( $wp_roles->get_names() as $role_slug => $role_name ) { |
|
| 406 | 406 | foreach ( $capabilities as $cap ) { |
| 407 | 407 | $wp_roles->remove_cap( $role_slug, $cap ); |
| 408 | 408 | } |