@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @return GravityView_Field | bool |
| 43 | 43 | */ |
| 44 | 44 | public static function create( $properties ) { |
| 45 | - $type = isset( $properties['type'] ) ? $properties['type'] : ''; |
|
| 46 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
| 45 | + $type = isset( $properties[ 'type' ] ) ? $properties[ 'type' ] : ''; |
|
| 46 | + $type = empty( $properties[ 'inputType' ] ) ? $type : $properties[ 'inputType' ]; |
|
| 47 | 47 | if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) { |
| 48 | 48 | return new GravityView_Field( $properties ); |
| 49 | 49 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @return bool True: yes, it exists; False: nope |
| 63 | 63 | */ |
| 64 | 64 | public static function exists( $field_name ) { |
| 65 | - return isset( self::$_fields["{$field_name}"] ); |
|
| 65 | + return isset( self::$_fields[ "{$field_name}" ] ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $field_type = is_a( $gf_field, 'GF_Field' ) ? get_class( $gf_field ) : $gf_field; |
| 98 | 98 | |
| 99 | - foreach( self::$_fields as $field ) { |
|
| 100 | - if( $field_type === $field->_gf_field_class_name ) { |
|
| 99 | + foreach ( self::$_fields as $field ) { |
|
| 100 | + if ( $field_type === $field->_gf_field_class_name ) { |
|
| 101 | 101 | return $field; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public static function get_all( $group = '' ) { |
| 118 | 118 | |
| 119 | - if( '' !== $group ) { |
|
| 119 | + if ( '' !== $group ) { |
|
| 120 | 120 | $return_fields = self::$_fields; |
| 121 | 121 | foreach ( $return_fields as $key => $field ) { |
| 122 | - if( $group !== $field->group ) { |
|
| 122 | + if ( $group !== $field->group ) { |
|
| 123 | 123 | unset( $return_fields[ $key ] ); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * If the method changes to public, use Gravity Forms' method |
| 25 | 25 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 26 | 26 | */ |
| 27 | - if( $reflection->isPublic() ) { |
|
| 27 | + if ( $reflection->isPublic() ) { |
|
| 28 | 28 | return parent::copy_post_image( $url, $post_id ); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | //making sure there is a valid upload folder |
| 45 | - if ( ! ( ( $upload_dir = wp_upload_dir( $time ) ) && false === $upload_dir['error'] ) ) { |
|
| 45 | + if ( ! ( ( $upload_dir = wp_upload_dir( $time ) ) && false === $upload_dir[ 'error' ] ) ) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -57,17 +57,17 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | $upload_dir = gf_apply_filters( 'gform_media_upload_path', $form_id, $upload_dir, $form_id, $post_id ); |
| 59 | 59 | |
| 60 | - if ( ! file_exists( $upload_dir['path'] ) ) { |
|
| 61 | - if ( ! wp_mkdir_p( $upload_dir['path'] ) ) { |
|
| 60 | + if ( ! file_exists( $upload_dir[ 'path' ] ) ) { |
|
| 61 | + if ( ! wp_mkdir_p( $upload_dir[ 'path' ] ) ) { |
|
| 62 | 62 | return false; |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $name = basename( $url ); |
| 67 | - $filename = wp_unique_filename( $upload_dir['path'], $name ); |
|
| 67 | + $filename = wp_unique_filename( $upload_dir[ 'path' ], $name ); |
|
| 68 | 68 | |
| 69 | 69 | // the destination path |
| 70 | - $new_file = $upload_dir['path'] . "/$filename"; |
|
| 70 | + $new_file = $upload_dir[ 'path' ] . "/$filename"; |
|
| 71 | 71 | |
| 72 | 72 | // the source path |
| 73 | 73 | $y = substr( $time, 0, 4 ); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $target_root_url = RGFormsModel::get_upload_url( $form_id ) . "/$y/$m/"; |
| 77 | 77 | $upload_root_info = array( 'path' => $target_root, 'url' => $target_root_url ); |
| 78 | 78 | $upload_root_info = gf_apply_filters( 'gform_upload_path', $form_id, $upload_root_info, $form_id ); |
| 79 | - $path = str_replace( $upload_root_info['url'], $upload_root_info['path'], $url ); |
|
| 79 | + $path = str_replace( $upload_root_info[ 'url' ], $upload_root_info[ 'path' ], $url ); |
|
| 80 | 80 | |
| 81 | 81 | // copy the file to the destination path |
| 82 | 82 | if ( ! copy( $path, $new_file ) ) { |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // Set correct file permissions |
| 87 | 87 | $stat = stat( dirname( $new_file ) ); |
| 88 | - $perms = $stat['mode'] & 0000666; |
|
| 88 | + $perms = $stat[ 'mode' ] & 0000666; |
|
| 89 | 89 | @ chmod( $new_file, $perms ); |
| 90 | 90 | |
| 91 | 91 | // Compute the URL |
| 92 | - $url = $upload_dir['url'] . "/$filename"; |
|
| 92 | + $url = $upload_dir[ 'url' ] . "/$filename"; |
|
| 93 | 93 | |
| 94 | 94 | if ( is_multisite() ) { |
| 95 | 95 | delete_transient( 'dirsize_cache' ); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $type = wp_check_filetype( $new_file ); |
| 99 | 99 | |
| 100 | - return array( 'file' => $new_file, 'url' => $url, 'type' => $type['type'] ); |
|
| 100 | + return array( 'file' => $new_file, 'url' => $url, 'type' => $type[ 'type' ] ); |
|
| 101 | 101 | |
| 102 | 102 | } |
| 103 | 103 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * If the method changes to public, use Gravity Forms' method |
| 125 | 125 | * @todo: If/when the method is public, remove the unneeded copied code. |
| 126 | 126 | */ |
| 127 | - if( $reflection->isPublic() ) { |
|
| 127 | + if ( $reflection->isPublic() ) { |
|
| 128 | 128 | return parent::media_handle_upload( $url, $post_id, $post_data ); |
| 129 | 129 | } |
| 130 | 130 | |
@@ -145,21 +145,21 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | $name_parts = pathinfo( $name ); |
| 148 | - $name = trim( substr( $name, 0, - ( 1 + strlen( $name_parts['extension'] ) ) ) ); |
|
| 148 | + $name = trim( substr( $name, 0, - ( 1 + strlen( $name_parts[ 'extension' ] ) ) ) ); |
|
| 149 | 149 | |
| 150 | - $url = $file['url']; |
|
| 151 | - $type = $file['type']; |
|
| 152 | - $file = $file['file']; |
|
| 150 | + $url = $file[ 'url' ]; |
|
| 151 | + $type = $file[ 'type' ]; |
|
| 152 | + $file = $file[ 'file' ]; |
|
| 153 | 153 | $title = $name; |
| 154 | 154 | $content = ''; |
| 155 | 155 | |
| 156 | 156 | // use image exif/iptc data for title and caption defaults if possible |
| 157 | 157 | if ( $image_meta = @wp_read_image_metadata( $file ) ) { |
| 158 | - if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { |
|
| 159 | - $title = $image_meta['title']; |
|
| 158 | + if ( trim( $image_meta[ 'title' ] ) && ! is_numeric( sanitize_title( $image_meta[ 'title' ] ) ) ) { |
|
| 159 | + $title = $image_meta[ 'title' ]; |
|
| 160 | 160 | } |
| 161 | - if ( trim( $image_meta['caption'] ) ) { |
|
| 162 | - $content = $image_meta['caption']; |
|
| 161 | + if ( trim( $image_meta[ 'caption' ] ) ) { |
|
| 162 | + $content = $image_meta[ 'caption' ]; |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 25 | 25 | |
| 26 | - unset ( $field_options['search_filter'] ); |
|
| 26 | + unset ( $field_options[ 'search_filter' ] ); |
|
| 27 | 27 | |
| 28 | - if( 'edit' === $context ) { |
|
| 28 | + if ( 'edit' === $context ) { |
|
| 29 | 29 | return $field_options; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $this->add_field_support('link_to_post', $field_options ); |
|
| 32 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
| 33 | 33 | |
| 34 | 34 | // @since 1.5.4 |
| 35 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 35 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 36 | 36 | |
| 37 | 37 | return $field_options; |
| 38 | 38 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $url = $title = $caption = $description = ''; |
| 59 | 59 | |
| 60 | 60 | // If there's a |:| match, process. Otherwise, empty array! |
| 61 | - if( preg_match( '/\|\:\|/', $value ) ) { |
|
| 61 | + if ( preg_match( '/\|\:\|/', $value ) ) { |
|
| 62 | 62 | list( $url, $title, $caption, $description ) = array_pad( explode( '|:|', $value ), 4, false ); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Image $field ) { |
| 89 | 89 | |
| 90 | - $id = (int) $field->id; |
|
| 91 | - $form_id = $form['id']; |
|
| 90 | + $id = (int)$field->id; |
|
| 91 | + $form_id = $form[ 'id' ]; |
|
| 92 | 92 | $input_name = "input_{$id}"; |
| 93 | 93 | $field_id = sprintf( 'input_%d_%d', $form_id, $id ); |
| 94 | 94 | $img_name = null; |
@@ -96,16 +96,16 @@ discard block |
||
| 96 | 96 | // Convert |:| to associative array |
| 97 | 97 | $img_array = $this->explode_value( $value ); |
| 98 | 98 | |
| 99 | - if( ! empty( $img_array['url'] ) ) { |
|
| 99 | + if ( ! empty( $img_array[ 'url' ] ) ) { |
|
| 100 | 100 | |
| 101 | - $img_name = basename( $img_array['url'] ); |
|
| 101 | + $img_name = basename( $img_array[ 'url' ] ); |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * Set the $uploaded_files value so that the .ginput_preview renders, and the file upload is hidden |
| 105 | 105 | * @see GF_Field_Post_Image::get_field_input See the `<span class='ginput_preview'>` code |
| 106 | 106 | * @see GFFormsModel::get_temp_filename See the `rgget( $input_name, self::$uploaded_files[ $form_id ] );` code |
| 107 | 107 | */ |
| 108 | - if( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
| 108 | + if ( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
| 109 | 109 | GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $img_name; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | * @hack |
| 135 | 135 | */ |
| 136 | 136 | if ( $img_name ) { |
| 137 | - $current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array['url'] ) ); |
|
| 138 | - $gf_post_image_field_output = str_replace('<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>'.$current_file, $gf_post_image_field_output ); |
|
| 137 | + $current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array[ 'url' ] ) ); |
|
| 138 | + $gf_post_image_field_output = str_replace( '<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>' . $current_file, $gf_post_image_field_output ); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | return $gf_post_image_field_output; |
@@ -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; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
| 38 | 38 | |
| 39 | - if( is_admin() ) { |
|
| 39 | + if ( is_admin() ) { |
|
| 40 | 40 | $this->load_components( 'admin' ); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | static function getInstance() { |
| 57 | 57 | |
| 58 | - if( empty( self::$instance ) ) { |
|
| 58 | + if ( empty( self::$instance ) ) { |
|
| 59 | 59 | self::$instance = new GravityView_Edit_Entry; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | private function add_hooks() { |
| 82 | 82 | |
| 83 | 83 | // Add front-end access to Gravity Forms delete file action |
| 84 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file') ); |
|
| 84 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file' ) ); |
|
| 85 | 85 | |
| 86 | 86 | // Make sure this hook is run for non-admins |
| 87 | - add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file') ); |
|
| 87 | + add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file' ) ); |
|
| 88 | 88 | |
| 89 | 89 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
| 90 | 90 | |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function addon_specific_hooks() { |
| 101 | 101 | |
| 102 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
| 103 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
| 102 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
| 103 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
| 148 | 148 | |
| 149 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
| 149 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
| 150 | 150 | |
| 151 | 151 | $base = gv_entry_link( $entry, $post_id ); |
| 152 | 152 | |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | * Allow passing params to dynamically populate entry with values |
| 161 | 161 | * @since 1.9.2 |
| 162 | 162 | */ |
| 163 | - if( !empty( $field_values ) ) { |
|
| 163 | + if ( ! empty( $field_values ) ) { |
|
| 164 | 164 | |
| 165 | - if( is_array( $field_values ) ) { |
|
| 165 | + if ( is_array( $field_values ) ) { |
|
| 166 | 166 | // If already an array, no parse_str() needed |
| 167 | 167 | $params = $field_values; |
| 168 | 168 | } else { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function modify_field_blacklist( $fields = array(), $context = NULL ) { |
| 186 | 186 | |
| 187 | - if( empty( $context ) || $context !== 'edit' ) { |
|
| 187 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
| 188 | 188 | return $fields; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -226,24 +226,24 @@ discard block |
||
| 226 | 226 | // If they can edit any entries (as defined in Gravity Forms) |
| 227 | 227 | // Or if they can edit other people's entries |
| 228 | 228 | // Then we're good. |
| 229 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
| 229 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
| 230 | 230 | |
| 231 | - do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.'); |
|
| 231 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.' ); |
|
| 232 | 232 | |
| 233 | 233 | $user_can_edit = true; |
| 234 | 234 | |
| 235 | - } else if( !isset( $entry['created_by'] ) ) { |
|
| 235 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
| 236 | 236 | |
| 237 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.'); |
|
| 237 | + do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.' ); |
|
| 238 | 238 | |
| 239 | 239 | $user_can_edit = false; |
| 240 | 240 | |
| 241 | 241 | } else { |
| 242 | 242 | |
| 243 | 243 | // get user_edit setting |
| 244 | - if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 244 | + if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 245 | 245 | // if View ID not specified or is the current view |
| 246 | - $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
| 246 | + $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' ); |
|
| 247 | 247 | } else { |
| 248 | 248 | // in case is specified and not the current view |
| 249 | 249 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
@@ -252,21 +252,21 @@ discard block |
||
| 252 | 252 | $current_user = wp_get_current_user(); |
| 253 | 253 | |
| 254 | 254 | // User edit is disabled |
| 255 | - if( empty( $user_edit ) ) { |
|
| 255 | + if ( empty( $user_edit ) ) { |
|
| 256 | 256 | |
| 257 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
| 257 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
| 258 | 258 | |
| 259 | 259 | $user_can_edit = false; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
| 263 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 263 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
| 264 | 264 | |
| 265 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 265 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 266 | 266 | |
| 267 | 267 | $user_can_edit = true; |
| 268 | 268 | |
| 269 | - } else if( ! is_user_logged_in() ) { |
|
| 269 | + } else if ( ! is_user_logged_in() ) { |
|
| 270 | 270 | |
| 271 | 271 | do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' ); |
| 272 | 272 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $labels = array( |
| 31 | 31 | 'cancel' => __( 'Cancel', 'gravityview' ), |
| 32 | - 'submit' => __( 'Update', 'gravityview') |
|
| 32 | + 'submit' => __( 'Update', 'gravityview' ) |
|
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $object->form, $object->entry, $object->view_id ); |
| 44 | 44 | |
| 45 | 45 | ?> |
| 46 | - <input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" /> |
|
| 46 | + <input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels[ 'submit' ] ); ?>" name="save" /> |
|
| 47 | 47 | |
| 48 | - <a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a> |
|
| 48 | + <a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels[ 'cancel' ] ); ?></a> |
|
| 49 | 49 | <?php |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -59,5 +59,5 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | ?> |
| 61 | 61 | <input type="hidden" name="action" value="update" /> |
| 62 | - <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" /> |
|
| 62 | + <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" /> |
|
| 63 | 63 | </div> |
@@ -11,10 +11,10 @@ |
||
| 11 | 11 | ?> |
| 12 | 12 | |
| 13 | 13 | <div class="gv-search-box gv-search-date"> |
| 14 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
| 15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
| 15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 16 | 16 | <?php } ?> |
| 17 | 17 | <p> |
| 18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 19 | 19 | </p> |
| 20 | 20 | </div> |
| 21 | 21 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
| 10 | 10 | |
| 11 | 11 | ?> |
| 12 | 12 | <div class="gv-search-box gv-search-field-text"> |
| 13 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
| 14 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 13 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
| 14 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 15 | 15 | <?php } ?> |
| 16 | 16 | <p> |
| 17 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
| 17 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"> |
|
| 18 | 18 | </p> |
| 19 | 19 | </div> |
| 20 | 20 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | die; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
| 19 | +if ( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
| 20 | 20 | require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' ); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | 'atts' => NULL, |
| 158 | 158 | ) ); |
| 159 | 159 | |
| 160 | - foreach ($atts as $key => $value) { |
|
| 161 | - if( is_null( $value ) ) { |
|
| 160 | + foreach ( $atts as $key => $value ) { |
|
| 161 | + if ( is_null( $value ) ) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } |
| 164 | 164 | $this->{$key} = $value; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | static function getInstance( $passed_post = NULL ) { |
| 191 | 191 | |
| 192 | - if( empty( self::$instance ) ) { |
|
| 192 | + if ( empty( self::$instance ) ) { |
|
| 193 | 193 | self::$instance = new self( $passed_post ); |
| 194 | 194 | } |
| 195 | 195 | |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function getCurrentField( $key = NULL ) { |
| 204 | 204 | |
| 205 | - if( !empty( $key ) ) { |
|
| 206 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
| 205 | + if ( ! empty( $key ) ) { |
|
| 206 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
| 207 | 207 | return $this->_current_field[ $key ]; |
| 208 | 208 | } |
| 209 | 209 | return NULL; |
@@ -214,16 +214,16 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | public function setCurrentFieldSetting( $key, $value ) { |
| 216 | 216 | |
| 217 | - if( !empty( $this->_current_field ) ) { |
|
| 218 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
| 217 | + if ( ! empty( $this->_current_field ) ) { |
|
| 218 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public function getCurrentFieldSetting( $key ) { |
| 224 | - $settings = $this->getCurrentField('field_settings'); |
|
| 224 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
| 225 | 225 | |
| 226 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
| 226 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
| 227 | 227 | return $settings[ $key ]; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -254,8 +254,8 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function getAtts( $key = NULL ) { |
| 256 | 256 | |
| 257 | - if( !empty( $key ) ) { |
|
| 258 | - if( isset( $this->atts[ $key ] ) ) { |
|
| 257 | + if ( ! empty( $key ) ) { |
|
| 258 | + if ( isset( $this->atts[ $key ] ) ) { |
|
| 259 | 259 | return $this->atts[ $key ]; |
| 260 | 260 | } |
| 261 | 261 | return NULL; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
| 323 | 323 | |
| 324 | - if( $fields && !empty( $key ) ) { |
|
| 324 | + if ( $fields && ! empty( $key ) ) { |
|
| 325 | 325 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
| 326 | 326 | } |
| 327 | 327 | |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | public function getField( $key ) { |
| 343 | 343 | |
| 344 | - if( !empty( $key ) ) { |
|
| 345 | - if( isset( $this->fields[ $key ] ) ) { |
|
| 344 | + if ( ! empty( $key ) ) { |
|
| 345 | + if ( isset( $this->fields[ $key ] ) ) { |
|
| 346 | 346 | return $this->fields[ $key ]; |
| 347 | 347 | } |
| 348 | 348 | } |
@@ -442,8 +442,8 @@ discard block |
||
| 442 | 442 | public function getPaginationCounts() { |
| 443 | 443 | |
| 444 | 444 | $paging = $this->getPaging(); |
| 445 | - $offset = $paging['offset']; |
|
| 446 | - $page_size = $paging['page_size']; |
|
| 445 | + $offset = $paging[ 'offset' ]; |
|
| 446 | + $page_size = $paging[ 'page_size' ]; |
|
| 447 | 447 | $total = $this->getTotalEntries(); |
| 448 | 448 | |
| 449 | 449 | if ( empty( $total ) ) { |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | */ |
| 465 | 465 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
| 466 | 466 | |
| 467 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
| 467 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | /** |
@@ -548,16 +548,16 @@ discard block |
||
| 548 | 548 | */ |
| 549 | 549 | public function getCurrentEntry() { |
| 550 | 550 | |
| 551 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
| 551 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
| 552 | 552 | $entries = $this->getEntries(); |
| 553 | - $entry = $entries[0]; |
|
| 553 | + $entry = $entries[ 0 ]; |
|
| 554 | 554 | } else { |
| 555 | 555 | $entry = $this->_current_entry; |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /** @since 1.16 Fixes DataTables empty entry issue */ |
| 559 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
| 560 | - $entry = $this->_current_field['entry']; |
|
| 559 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
| 560 | + $entry = $this->_current_field[ 'entry' ]; |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | return $entry; |
@@ -594,8 +594,8 @@ discard block |
||
| 594 | 594 | */ |
| 595 | 595 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
| 596 | 596 | |
| 597 | - if( empty( $zone ) ) { |
|
| 598 | - do_action('gravityview_log_error', 'GravityView_View[renderZone] No zone defined.'); |
|
| 597 | + if ( empty( $zone ) ) { |
|
| 598 | + do_action( 'gravityview_log_error', 'GravityView_View[renderZone] No zone defined.' ); |
|
| 599 | 599 | return NULL; |
| 600 | 600 | } |
| 601 | 601 | |
@@ -604,33 +604,33 @@ discard block |
||
| 604 | 604 | 'context' => $this->getContext(), |
| 605 | 605 | 'entry' => $this->getCurrentEntry(), |
| 606 | 606 | 'form' => $this->getForm(), |
| 607 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
| 607 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
| 608 | 608 | ); |
| 609 | 609 | |
| 610 | 610 | $final_atts = wp_parse_args( $atts, $defaults ); |
| 611 | 611 | |
| 612 | 612 | $output = ''; |
| 613 | 613 | |
| 614 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
| 614 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
| 615 | 615 | |
| 616 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
| 616 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
| 617 | 617 | |
| 618 | 618 | // Backward compatibility |
| 619 | - if( 'table' === $this->getTemplatePartSlug() ) { |
|
| 619 | + if ( 'table' === $this->getTemplatePartSlug() ) { |
|
| 620 | 620 | /** |
| 621 | 621 | * Modify the fields displayed in the table |
| 622 | 622 | * @var array |
| 623 | 623 | */ |
| 624 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
| 624 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | - if( empty( $fields ) ) { |
|
| 627 | + if ( empty( $fields ) ) { |
|
| 628 | 628 | return NULL; |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | $field_output = ''; |
| 632 | 632 | foreach ( $fields as $field ) { |
| 633 | - $final_atts['field'] = $field; |
|
| 633 | + $final_atts[ 'field' ] = $field; |
|
| 634 | 634 | |
| 635 | 635 | $field_output .= gravityview_field_output( $final_atts ); |
| 636 | 636 | } |
@@ -641,21 +641,21 @@ discard block |
||
| 641 | 641 | * @since 1.7.6 |
| 642 | 642 | * @param boolean $hide_empty_zone Default: false |
| 643 | 643 | */ |
| 644 | - if( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
| 644 | + if ( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
| 645 | 645 | return NULL; |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 649 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
| 648 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 649 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | $output .= $field_output; |
| 653 | 653 | |
| 654 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 654 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 655 | 655 | $output .= '</div>'; |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | - if( $echo ) { |
|
| 658 | + if ( $echo ) { |
|
| 659 | 659 | echo $output; |
| 660 | 660 | } |
| 661 | 661 | |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | */ |
| 674 | 674 | function locate_template( $template_names, $load = false, $require_once = true ) { |
| 675 | 675 | |
| 676 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 676 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 677 | 677 | |
| 678 | 678 | $located = $this->located_templates[ $template_names ]; |
| 679 | 679 | |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | // Set $load to always false so we handle it here. |
| 683 | 683 | $located = parent::locate_template( $template_names, false, $require_once ); |
| 684 | 684 | |
| 685 | - if( is_string( $template_names ) ) { |
|
| 685 | + if ( is_string( $template_names ) ) { |
|
| 686 | 686 | $this->located_templates[ $template_names ] = $located; |
| 687 | 687 | } |
| 688 | 688 | } |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | * @return mixed|null The stored data. |
| 701 | 701 | */ |
| 702 | 702 | public function __get( $name ) { |
| 703 | - if( isset( $this->{$name} ) ) { |
|
| 703 | + if ( isset( $this->{$name} ) ) { |
|
| 704 | 704 | return $this->{$name}; |
| 705 | 705 | } else { |
| 706 | 706 | return NULL; |
@@ -729,15 +729,15 @@ discard block |
||
| 729 | 729 | $additional = array(); |
| 730 | 730 | |
| 731 | 731 | // form-19-table-body.php |
| 732 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 732 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 733 | 733 | |
| 734 | 734 | // view-3-table-body.php |
| 735 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
| 735 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
| 736 | 736 | |
| 737 | - if( $this->getPostId() ) { |
|
| 737 | + if ( $this->getPostId() ) { |
|
| 738 | 738 | |
| 739 | 739 | // page-19-table-body.php |
| 740 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 740 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | // Combine with existing table-body.php and table.php |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | |
| 760 | 760 | do_action( 'gravityview_log_debug', '[render] Rendering Template File', $template_file ); |
| 761 | 761 | |
| 762 | - if( !empty( $template_file) ) { |
|
| 762 | + if ( ! empty( $template_file ) ) { |
|
| 763 | 763 | |
| 764 | 764 | if ( $require_once ) { |
| 765 | 765 | require_once( $template_file ); |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | */ |
| 777 | 777 | public function render_widget_hooks( $view_id ) { |
| 778 | 778 | |
| 779 | - if( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
| 779 | + if ( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
| 780 | 780 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Not rendering widgets; single entry' ); |
| 781 | 781 | return; |
| 782 | 782 | } |
@@ -784,9 +784,9 @@ discard block |
||
| 784 | 784 | $view_data = gravityview_get_current_view_data( $view_id ); |
| 785 | 785 | |
| 786 | 786 | // get View widget configuration |
| 787 | - $widgets = (array)$view_data['widgets']; |
|
| 787 | + $widgets = (array)$view_data[ 'widgets' ]; |
|
| 788 | 788 | |
| 789 | - switch( current_filter() ) { |
|
| 789 | + switch ( current_filter() ) { |
|
| 790 | 790 | default: |
| 791 | 791 | case 'gravityview_before': |
| 792 | 792 | $zone = 'header'; |
@@ -800,9 +800,9 @@ discard block |
||
| 800 | 800 | * Filter widgets not in the current zone |
| 801 | 801 | * @since 1.16 |
| 802 | 802 | */ |
| 803 | - foreach( $widgets as $key => $widget ) { |
|
| 803 | + foreach ( $widgets as $key => $widget ) { |
|
| 804 | 804 | // The widget isn't in the current zone |
| 805 | - if( false === strpos( $key, $zone ) ) { |
|
| 805 | + if ( false === strpos( $key, $zone ) ) { |
|
| 806 | 806 | unset( $widgets[ $key ] ); |
| 807 | 807 | } |
| 808 | 808 | } |
@@ -817,8 +817,8 @@ discard block |
||
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | // Prevent being called twice |
| 820 | - if( did_action( $zone.'_'.$view_id.'_widgets' ) ) { |
|
| 821 | - do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__ , $zone.'_'.$view_id.'_widgets' ) ); |
|
| 820 | + if ( did_action( $zone . '_' . $view_id . '_widgets' ) ) { |
|
| 821 | + do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__, $zone . '_' . $view_id . '_widgets' ) ); |
|
| 822 | 822 | return; |
| 823 | 823 | } |
| 824 | 824 | |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | |
| 830 | 830 | $default_css_class = 'gv-grid gv-widgets-' . $zone; |
| 831 | 831 | |
| 832 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 832 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 833 | 833 | $default_css_class .= ' gv-widgets-no-results'; |
| 834 | 834 | } |
| 835 | 835 | |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | * @param string $zone Current widget zone, either `header` or `footer` |
| 841 | 841 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
| 842 | 842 | */ |
| 843 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
| 843 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
| 844 | 844 | |
| 845 | 845 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 846 | 846 | |
@@ -848,17 +848,17 @@ discard block |
||
| 848 | 848 | ?> |
| 849 | 849 | <div class="<?php echo $css_class; ?>"> |
| 850 | 850 | <?php |
| 851 | - foreach( $rows as $row ) { |
|
| 852 | - foreach( $row as $col => $areas ) { |
|
| 853 | - $column = ($col == '2-2') ? '1-2 gv-right' : $col.' gv-left'; |
|
| 851 | + foreach ( $rows as $row ) { |
|
| 852 | + foreach ( $row as $col => $areas ) { |
|
| 853 | + $column = ( $col == '2-2' ) ? '1-2 gv-right' : $col . ' gv-left'; |
|
| 854 | 854 | ?> |
| 855 | 855 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 856 | 856 | <?php |
| 857 | - if( !empty( $areas ) ) { |
|
| 858 | - foreach( $areas as $area ) { |
|
| 859 | - if( !empty( $widgets[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 860 | - foreach( $widgets[ $zone .'_'. $area['areaid'] ] as $widget ) { |
|
| 861 | - do_action( "gravityview_render_widget_{$widget['id']}", $widget ); |
|
| 857 | + if ( ! empty( $areas ) ) { |
|
| 858 | + foreach ( $areas as $area ) { |
|
| 859 | + if ( ! empty( $widgets[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 860 | + foreach ( $widgets[ $zone . '_' . $area[ 'areaid' ] ] as $widget ) { |
|
| 861 | + do_action( "gravityview_render_widget_{$widget[ 'id' ]}", $widget ); |
|
| 862 | 862 | } |
| 863 | 863 | } |
| 864 | 864 | } |
@@ -874,8 +874,8 @@ discard block |
||
| 874 | 874 | * Prevent widgets from being called twice. |
| 875 | 875 | * Checking for loop_start prevents themes and plugins that pre-process shortcodes from triggering the action before displaying. Like, ahem, the Divi theme and WordPress SEO plugin |
| 876 | 876 | */ |
| 877 | - if( did_action( 'loop_start' ) ) { |
|
| 878 | - do_action( $zone.'_'.$view_id.'_widgets' ); |
|
| 877 | + if ( did_action( 'loop_start' ) ) { |
|
| 878 | + do_action( $zone . '_' . $view_id . '_widgets' ); |
|
| 879 | 879 | } |
| 880 | 880 | } |
| 881 | 881 | |