@@ -4,10 +4,10 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | function __construct() { |
| 6 | 6 | |
| 7 | - if( ! is_admin() ) { return; } |
|
| 7 | + if ( ! is_admin() ) { return; } |
|
| 8 | 8 | |
| 9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
| 10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
| 10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 49 | 49 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 50 | 50 | |
| 51 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
| 51 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
| 52 | 52 | |
| 53 | 53 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
| 54 | 54 | |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function no_views_text() { |
| 66 | 66 | |
| 67 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
| 67 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
| 68 | 68 | return __( 'No Views found in Trash', 'gravityview' ); |
| 69 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
| 69 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
| 70 | 70 | return __( 'No Views found.', 'gravityview' ); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if( $error ) { |
|
| 113 | + if ( $error ) { |
|
| 114 | 114 | ?> |
| 115 | 115 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
| 116 | 116 | <?php echo gravityview_get_floaty(); ?> |
@@ -129,23 +129,23 @@ discard block |
||
| 129 | 129 | public function backend_actions() { |
| 130 | 130 | |
| 131 | 131 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 132 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
| 133 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
| 134 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
| 135 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
| 136 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
| 137 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
| 138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
| 139 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-installer.php' ); |
|
| 140 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
| 141 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
| 132 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
| 133 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
| 134 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
| 135 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
| 136 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
| 137 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
| 138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
| 139 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-installer.php' ); |
|
| 140 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
| 141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
| 145 | 145 | * |
| 146 | 146 | * Nice place to insert extensions' backend stuff |
| 147 | 147 | */ |
| 148 | - do_action('gravityview_include_backend_actions'); |
|
| 148 | + do_action( 'gravityview_include_backend_actions' ); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $actions = array(); |
| 163 | 163 | |
| 164 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 165 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 164 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 165 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 169 | - $actions[] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 168 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 169 | + $actions[ ] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | return array_merge( $actions, $links ); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | // By default, there will only be one item being modified. |
| 195 | 195 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
| 196 | 196 | // of modified items that will override this array. |
| 197 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 197 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 198 | 198 | |
| 199 | 199 | // If we're starting fresh, a new form was created. |
| 200 | 200 | // We should let the user know this is the case. |
@@ -202,60 +202,60 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $new_form_text = ''; |
| 204 | 204 | |
| 205 | - if( !empty( $start_fresh ) ) { |
|
| 205 | + if ( ! empty( $start_fresh ) ) { |
|
| 206 | 206 | |
| 207 | 207 | // Get the form that was created |
| 208 | 208 | $connected_form = gravityview_get_form_id( $post_id ); |
| 209 | 209 | |
| 210 | - if( !empty( $connected_form ) ) { |
|
| 210 | + if ( ! empty( $connected_form ) ) { |
|
| 211 | 211 | $form = gravityview_get_form( $connected_form ); |
| 212 | - $form_name = esc_attr( $form['title'] ); |
|
| 212 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
| 213 | 213 | $image = self::get_floaty(); |
| 214 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
| 215 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
| 214 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
| 215 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
| 216 | 216 | |
| 217 | 217 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
| 218 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
| 218 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
| 219 | 219 | $new_form_text = wpautop( $new_form_text ); |
| 220 | 220 | |
| 221 | 221 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $messages['gravityview'] = array( |
|
| 225 | + $messages[ 'gravityview' ] = array( |
|
| 226 | 226 | 0 => '', // Unused. Messages start at index 1. |
| 227 | 227 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 228 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 228 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 229 | 229 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 230 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 230 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 231 | 231 | 3 => __( 'View deleted.', 'gravityview' ), |
| 232 | 232 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 233 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 233 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 234 | 234 | /* translators: %s: date and time of the revision */ |
| 235 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
| 235 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
| 236 | 236 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 237 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 237 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 238 | 238 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 239 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 239 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 240 | 240 | 8 => __( 'View submitted.', 'gravityview' ), |
| 241 | 241 | 9 => sprintf( |
| 242 | 242 | /* translators: Date and time the View is scheduled to be published */ |
| 243 | 243 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
| 244 | 244 | // translators: Publish box date format, see http://php.net/date |
| 245 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 245 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 246 | 246 | ) . $new_form_text, |
| 247 | 247 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 248 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 248 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | 251 | * These apply to `bulk_post_updated_messages` |
| 252 | 252 | * @file wp-admin/edit.php |
| 253 | 253 | */ |
| 254 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
| 255 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
| 256 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
| 257 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
| 258 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
| 254 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
| 255 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
| 256 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
| 257 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
| 258 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
| 259 | 259 | ); |
| 260 | 260 | |
| 261 | 261 | return $messages; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $args = array(); |
| 115 | 115 | |
| 116 | - $view_id = is_null ( $view ) ? null : $view->ID; |
|
| 116 | + $view_id = is_null( $view ) ? null : $view->ID; |
|
| 117 | 117 | |
| 118 | 118 | $permalink = null; |
| 119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $view_collection = View_Collection::from_post( $post ); |
| 128 | 128 | |
| 129 | - if( 1 < $view_collection->count() ) { |
|
| 130 | - $args['gvid'] = $view_id; |
|
| 129 | + if ( 1 < $view_collection->count() ) { |
|
| 130 | + $args[ 'gvid' ] = $view_id; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -156,21 +156,21 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | $link_parts = explode( '?', $permalink ); |
| 158 | 158 | |
| 159 | - $query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : ''; |
|
| 159 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 160 | 160 | |
| 161 | - $permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query; |
|
| 161 | + $permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query; |
|
| 162 | 162 | } else { |
| 163 | 163 | $args[ $entry_endpoint_name ] = $entry_slug; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | if ( $track_directory ) { |
| 167 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
| 168 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 167 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 168 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if ( $sort = Utils::_GET( 'sort' ) ) { |
| 172 | - $args['sort'] = $sort; |
|
| 173 | - $args['dir'] = Utils::_GET( 'dir' ); |
|
| 172 | + $args[ 'sort' ] = $sort; |
|
| 173 | + $args[ 'dir' ] = Utils::_GET( 'dir' ); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'total' => wp_count_posts( 'gravityview' )->publish, |
| 64 | 64 | ); |
| 65 | 65 | foreach ( $items as $item ) { |
| 66 | - $data['views'][] = $this->prepare_view_for_response( $item, $request ); |
|
| 66 | + $data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return new \WP_REST_Response( $data, 200 ); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $url = $request->get_url_params(); |
| 84 | 84 | |
| 85 | - $view_id = intval( $url['id'] ); |
|
| 85 | + $view_id = intval( $url[ 'id' ] ); |
|
| 86 | 86 | |
| 87 | 87 | $item = get_post( $view_id ); |
| 88 | 88 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // Only output the fields that should be displayed. |
| 112 | 112 | $allowed = array(); |
| 113 | 113 | foreach ( $view->fields->by_position( "{$context}_*" )->by_visible()->all() as $field ) { |
| 114 | - $allowed[] = $field->ID; |
|
| 114 | + $allowed[ ] = $field->ID; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | public function get_sub_items( $request ) { |
| 157 | 157 | |
| 158 | 158 | $url = $request->get_url_params(); |
| 159 | - $view_id = intval( $url['id'] ); |
|
| 159 | + $view_id = intval( $url[ 'id' ] ); |
|
| 160 | 160 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
| 161 | 161 | |
| 162 | - if( $post_id = $request->get_param('post_id') ) { |
|
| 162 | + if ( $post_id = $request->get_param( 'post_id' ) ) { |
|
| 163 | 163 | global $post; |
| 164 | 164 | |
| 165 | 165 | $post = get_post( $post_id ); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $data = array( 'entries' => $entries->all(), 'total' => $entries->total() ); |
| 217 | 217 | |
| 218 | - foreach ( $data['entries'] as &$entry ) { |
|
| 218 | + foreach ( $data[ 'entries' ] as &$entry ) { |
|
| 219 | 219 | $entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | public function get_sub_item( $request ) { |
| 236 | 236 | $url = $request->get_url_params(); |
| 237 | - $view_id = intval( $url['id'] ); |
|
| 238 | - $entry_id = intval( $url['s_id'] ); |
|
| 237 | + $view_id = intval( $url[ 'id' ] ); |
|
| 238 | + $entry_id = intval( $url[ 's_id' ] ); |
|
| 239 | 239 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
| 240 | 240 | |
| 241 | 241 | $view = \GV\View::by_id( $view_id ); |
@@ -270,32 +270,32 @@ discard block |
||
| 270 | 270 | // Add all the WP_Post data |
| 271 | 271 | $view_post = $view_post->to_array(); |
| 272 | 272 | |
| 273 | - unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] ); |
|
| 273 | + unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] ); |
|
| 274 | 274 | |
| 275 | 275 | $return = wp_parse_args( $item, $view_post ); |
| 276 | 276 | |
| 277 | - $return['title'] = $return['post_title']; |
|
| 277 | + $return[ 'title' ] = $return[ 'post_title' ]; |
|
| 278 | 278 | |
| 279 | - $return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array(); |
|
| 280 | - unset( $return['atts'], $return['view_id'] ); |
|
| 279 | + $return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array(); |
|
| 280 | + unset( $return[ 'atts' ], $return[ 'view_id' ] ); |
|
| 281 | 281 | |
| 282 | - $return['search_criteria'] = array( |
|
| 282 | + $return[ 'search_criteria' ] = array( |
|
| 283 | 283 | 'page_size' => rgars( $return, 'settings/page_size' ), |
| 284 | 284 | 'sort_field' => rgars( $return, 'settings/sort_field' ), |
| 285 | 285 | 'sort_direction' => rgars( $return, 'settings/sort_direction' ), |
| 286 | 286 | 'offset' => rgars( $return, 'settings/offset' ), |
| 287 | 287 | ); |
| 288 | 288 | |
| 289 | - unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] ); |
|
| 289 | + unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] ); |
|
| 290 | 290 | |
| 291 | 291 | // Redact for non-logged ins |
| 292 | 292 | if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) { |
| 293 | - unset( $return['settings'] ); |
|
| 294 | - unset( $return['search_criteria'] ); |
|
| 293 | + unset( $return[ 'settings' ] ); |
|
| 294 | + unset( $return[ 'search_criteria' ] ); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) { |
| 298 | - unset( $return['form'] ); |
|
| 298 | + unset( $return[ 'form' ] ); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | return $return; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $view_id = func_get_arg( 1 ); // $view_id override |
| 307 | 307 | } else { |
| 308 | 308 | $url = $request->get_url_params(); |
| 309 | - $view_id = intval( $url['id'] ); |
|
| 309 | + $view_id = intval( $url[ 'id' ] ); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | if ( ! $view = \GV\View::by_id( $view_id ) ) { |
@@ -359,8 +359,8 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | $url = $request->get_url_params(); |
| 362 | - $view_id = intval( $url['id'] ); |
|
| 363 | - $entry_id = intval( $url['s_id'] ); |
|
| 362 | + $view_id = intval( $url[ 'id' ] ); |
|
| 363 | + $entry_id = intval( $url[ 's_id' ] ); |
|
| 364 | 364 | |
| 365 | 365 | $view = \GV\View::by_id( $view_id ); |
| 366 | 366 | |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - if ( $entry['form_id'] != $view->form->ID ) { |
|
| 371 | + if ( $entry[ 'form_id' ] != $view->form->ID ) { |
|
| 372 | 372 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - if ( $entry['status'] != 'active' ) { |
|
| 375 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 376 | 376 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 377 | 377 | } |
| 378 | 378 | |
@@ -380,10 +380,10 @@ discard block |
||
| 380 | 380 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 383 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 384 | 384 | |
| 385 | 385 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 386 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 386 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 387 | 387 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 388 | 388 | } |
| 389 | 389 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $atts = shortcode_atts( self::$defaults, $atts ); |
| 77 | 77 | |
| 78 | - $atts['action'] = 'edit'; |
|
| 78 | + $atts[ 'action' ] = 'edit'; |
|
| 79 | 79 | |
| 80 | 80 | return $this->shortcode( $atts, $content, $context ); |
| 81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $atts = shortcode_atts( self::$defaults, $atts ); |
| 93 | 93 | |
| 94 | - $atts['action'] = 'delete'; |
|
| 94 | + $atts[ 'action' ] = 'delete'; |
|
| 95 | 95 | |
| 96 | 96 | return $this->shortcode( $atts, $content, $context ); |
| 97 | 97 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $this->settings = shortcode_atts( self::$defaults, $atts, $context ); |
| 133 | 133 | |
| 134 | - $this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] ); |
|
| 134 | + $this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] ); |
|
| 135 | 135 | |
| 136 | 136 | if ( empty( $this->view_id ) ) { |
| 137 | 137 | gravityview()->log->error( 'A View ID was not defined and we are not inside a View' ); |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | return null; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $this->entry = $this->get_entry( $this->settings['entry_id'] ); |
|
| 142 | + $this->entry = $this->get_entry( $this->settings[ 'entry_id' ] ); |
|
| 143 | 143 | |
| 144 | 144 | if ( empty( $this->entry ) ) { |
| 145 | - gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings['entry_id'] ) ); |
|
| 145 | + gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings[ 'entry_id' ] ) ); |
|
| 146 | 146 | |
| 147 | 147 | return null; |
| 148 | 148 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | gravityview()->log->debug( '{context} atts:', array( 'context' => $context, 'data' => $atts ) ); |
| 151 | 151 | |
| 152 | 152 | if ( ! $this->has_cap() ) { |
| 153 | - gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings['action'] ), 'entry_id' => $this->entry['id'] ) ); |
|
| 153 | + gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings[ 'action' ] ), 'entry_id' => $this->entry[ 'id' ] ) ); |
|
| 154 | 154 | |
| 155 | 155 | return null; |
| 156 | 156 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Get just the URL, not the tag |
| 167 | - if ( 'url' === $this->settings['return'] ) { |
|
| 167 | + if ( 'url' === $this->settings[ 'return' ] ) { |
|
| 168 | 168 | return $url; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | private function get_link_atts() { |
| 187 | 187 | |
| 188 | - wp_parse_str( $this->settings['link_atts'], $link_atts ); |
|
| 188 | + wp_parse_str( $this->settings[ 'link_atts' ], $link_atts ); |
|
| 189 | 189 | |
| 190 | - if ( 'delete' === $this->settings['action'] ) { |
|
| 191 | - $link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
| 190 | + if ( 'delete' === $this->settings[ 'action' ] ) { |
|
| 191 | + $link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - return (array) $link_atts; |
|
| 194 | + return (array)$link_atts; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | return do_shortcode( $content ); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - switch ( $this->settings['action'] ) { |
|
| 214 | + switch ( $this->settings[ 'action' ] ) { |
|
| 215 | 215 | case 'edit': |
| 216 | 216 | $anchor_text = __( 'Edit Entry', 'gravityview' ); |
| 217 | 217 | break; |
@@ -239,9 +239,9 @@ discard block |
||
| 239 | 239 | private function get_url() { |
| 240 | 240 | |
| 241 | 241 | // if post_id is not defined, default to view_id |
| 242 | - $post_id = empty( $this->settings['post_id'] ) ? $this->view_id : $this->settings['post_id']; |
|
| 242 | + $post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : $this->settings[ 'post_id' ]; |
|
| 243 | 243 | |
| 244 | - switch ( $this->settings['action'] ) { |
|
| 244 | + switch ( $this->settings[ 'action' ] ) { |
|
| 245 | 245 | case 'edit': |
| 246 | 246 | $url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id ); |
| 247 | 247 | break; |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | private function has_cap() { |
| 268 | 268 | |
| 269 | - switch ( $this->settings['action'] ) { |
|
| 269 | + switch ( $this->settings[ 'action' ] ) { |
|
| 270 | 270 | case 'edit': |
| 271 | 271 | $has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id ); |
| 272 | 272 | break; |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | private function maybe_add_field_values_query_args( $url ) { |
| 333 | 333 | |
| 334 | - if ( $url && ! empty( $this->settings['field_values'] ) ) { |
|
| 334 | + if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) { |
|
| 335 | 335 | |
| 336 | - wp_parse_str( $this->settings['field_values'], $field_values ); |
|
| 336 | + wp_parse_str( $this->settings[ 'field_values' ], $field_values ); |
|
| 337 | 337 | |
| 338 | 338 | $url = add_query_arg( $field_values, $url ); |
| 339 | 339 | } |
@@ -79,8 +79,9 @@ |
||
| 79 | 79 | * Check permissions. |
| 80 | 80 | */ |
| 81 | 81 | while ( $error = $view->can_render( array( 'shortcode' ), $request ) ) { |
| 82 | - if ( ! is_wp_error( $error ) ) |
|
| 83 | - break; |
|
| 82 | + if ( ! is_wp_error( $error ) ) { |
|
| 83 | + break; |
|
| 84 | + } |
|
| 84 | 85 | |
| 85 | 86 | switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) { |
| 86 | 87 | case 'post_password_required': |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | 'detail' => null, |
| 42 | 42 | ) ); |
| 43 | 43 | |
| 44 | - if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) { |
|
| 45 | - if ( $atts['detail'] && $view = $request->is_view() ) { |
|
| 44 | + if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) { |
|
| 45 | + if ( $atts[ 'detail' ] && $view = $request->is_view() ) { |
|
| 46 | 46 | $view_id = $view->ID; |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 114 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * View details. |
| 118 | 118 | */ |
| 119 | - if ( $atts['detail'] ) { |
|
| 119 | + if ( $atts[ 'detail' ] ) { |
|
| 120 | 120 | return self::_return( $this->detail( $view, $entries, $atts ) ); |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | return self::_return( '' ); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if ( $entry['status'] != 'active' ) { |
|
| 135 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 136 | 136 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 137 | 137 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 138 | 138 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 146 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 146 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 147 | 147 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 148 | 148 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 149 | 149 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return self::_return( '' ); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if ( $entry['status'] != 'active' ) { |
|
| 166 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 167 | 167 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 168 | 168 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 177 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 177 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 178 | 178 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 179 | 179 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 180 | 180 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $error = \GVCommon::check_entry_display( $entry->as_entry() ); |
| 184 | 184 | |
| 185 | - if( is_wp_error( $error ) ) { |
|
| 185 | + if ( is_wp_error( $error ) ) { |
|
| 186 | 186 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) ); |
| 187 | 187 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 188 | 188 | } |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | // Mock the request with the actual View, not the global one |
| 200 | 200 | $mock_request = new \GV\Mock_Request(); |
| 201 | - $mock_request->returns['is_view'] = $view; |
|
| 202 | - $mock_request->returns['is_entry'] = $request->is_entry(); |
|
| 203 | - $mock_request->returns['is_edit_entry'] = $request->is_edit_entry(); |
|
| 204 | - $mock_request->returns['is_search'] = $request->is_search(); |
|
| 201 | + $mock_request->returns[ 'is_view' ] = $view; |
|
| 202 | + $mock_request->returns[ 'is_entry' ] = $request->is_entry(); |
|
| 203 | + $mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry(); |
|
| 204 | + $mock_request->returns[ 'is_search' ] = $request->is_search(); |
|
| 205 | 205 | |
| 206 | 206 | $request = $mock_request; |
| 207 | 207 | } |
@@ -237,16 +237,16 @@ discard block |
||
| 237 | 237 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
| 238 | 238 | |
| 239 | 239 | // Only keep the passed attributes after making sure that they're valid pairs |
| 240 | - $filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts ); |
|
| 240 | + $filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts ); |
|
| 241 | 241 | |
| 242 | 242 | $atts = array(); |
| 243 | 243 | |
| 244 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
| 244 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
| 245 | 245 | |
| 246 | 246 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
| 247 | 247 | $passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value ); |
| 248 | 248 | |
| 249 | - switch( $defaults[ $key ]['type'] ) { |
|
| 249 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Make sure number fields are numeric. |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
| 255 | 255 | */ |
| 256 | 256 | case 'number': |
| 257 | - if( is_numeric( $passed_value ) ) { |
|
| 257 | + if ( is_numeric( $passed_value ) ) { |
|
| 258 | 258 | $atts[ $key ] = ( $passed_value + 0 ); |
| 259 | 259 | } |
| 260 | 260 | break; |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | case 'select': |
| 271 | 271 | case 'radio': |
| 272 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
| 273 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 272 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
| 273 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 274 | 274 | $atts[ $key ] = $passed_value; |
| 275 | 275 | } |
| 276 | 276 | break; |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - $atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
| 285 | + $atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
| 286 | 286 | |
| 287 | 287 | return $atts; |
| 288 | 288 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | private function detail( $view, $entries, $atts ) { |
| 300 | 300 | $output = ''; |
| 301 | 301 | |
| 302 | - switch ( $key = $atts['detail'] ): |
|
| 302 | + switch ( $key = $atts[ 'detail' ] ): |
|
| 303 | 303 | case 'total_entries': |
| 304 | 304 | $output = number_format_i18n( $entries->total() ); |
| 305 | 305 | break; |
@@ -526,7 +526,7 @@ |
||
| 526 | 526 | $column = 'lead_id'; |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - $results = $wpdb->get_results( $wpdb->prepare( "SELECT $column, meta_value FROM $table WHERE form_id = (SELECT form_id FROM $table WHERE $column = %d LIMIT 1) AND meta_key = 'gravityview_unique_id'", $id_or_string ) ); |
|
| 529 | + $results = $wpdb->get_results( $wpdb->prepare( "select $column, meta_value FROM $table WHERE form_id = (SELECT form_id FROM $table WHERE $column = %d LIMIT 1) AND meta_key = 'gravityview_unique_id'", $id_or_string ) ); |
|
| 530 | 530 | |
| 531 | 531 | if ( $results ) { |
| 532 | 532 | $cache = array_replace( $cache, array_combine( wp_list_pluck( $results, $column ), wp_list_pluck( $results, 'meta_value' ) ) ); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $form = $gravityview_view->getForm(); |
| 33 | 33 | |
| 34 | - if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) { |
|
| 34 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) { |
|
| 35 | 35 | /** Allow to fall through for back compatibility testing purposes. */ |
| 36 | 36 | } else { |
| 37 | 37 | return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label ); |
@@ -39,29 +39,29 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $label = ''; |
| 41 | 41 | |
| 42 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
| 42 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
| 43 | 43 | |
| 44 | - $label = $field['label']; |
|
| 44 | + $label = $field[ 'label' ]; |
|
| 45 | 45 | |
| 46 | 46 | // Support Gravity Forms 1.9+ |
| 47 | - if( class_exists( 'GF_Field' ) ) { |
|
| 47 | + if ( class_exists( 'GF_Field' ) ) { |
|
| 48 | 48 | |
| 49 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
| 49 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
| 50 | 50 | |
| 51 | - if( $field_object ) { |
|
| 51 | + if ( $field_object ) { |
|
| 52 | 52 | |
| 53 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
| 53 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
| 54 | 54 | |
| 55 | 55 | // This is a complex field, with labels on a per-input basis |
| 56 | - if( $input ) { |
|
| 56 | + if ( $input ) { |
|
| 57 | 57 | |
| 58 | 58 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
| 59 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
| 59 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
| 60 | 60 | |
| 61 | 61 | } else { |
| 62 | 62 | |
| 63 | 63 | // This is a field with one label |
| 64 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
| 64 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
| 73 | - if ( !empty( $field['custom_label'] ) ) { |
|
| 73 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
| 74 | 74 | |
| 75 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
| 75 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
| 76 | 76 | |
| 77 | 77 | } |
| 78 | 78 | |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $width = NULL; |
| 136 | 136 | |
| 137 | - if( !empty( $field['width'] ) ) { |
|
| 138 | - $width = absint( $field['width'] ); |
|
| 137 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
| 138 | + $width = absint( $field[ 'width' ] ); |
|
| 139 | 139 | |
| 140 | 140 | // If using percentages, limit to 100% |
| 141 | - if( '%d%%' === $format && $width > 100 ) { |
|
| 141 | + if ( '%d%%' === $format && $width > 100 ) { |
|
| 142 | 142 | $width = 100; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -159,42 +159,42 @@ discard block |
||
| 159 | 159 | public static function field_class( $field, $form = NULL, $entry = NULL ) { |
| 160 | 160 | $classes = array(); |
| 161 | 161 | |
| 162 | - if( !empty( $field['custom_class'] ) ) { |
|
| 162 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
| 163 | 163 | |
| 164 | - $custom_class = $field['custom_class']; |
|
| 164 | + $custom_class = $field[ 'custom_class' ]; |
|
| 165 | 165 | |
| 166 | - if( !empty( $entry ) ) { |
|
| 166 | + if ( ! empty( $entry ) ) { |
|
| 167 | 167 | |
| 168 | 168 | // We want the merge tag to be formatted as a class. The merge tag may be |
| 169 | 169 | // replaced by a multiple-word value that should be output as a single class. |
| 170 | 170 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
| 171 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 171 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 172 | 172 | |
| 173 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
| 173 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
| 174 | 174 | |
| 175 | 175 | // And then we want life to return to normal |
| 176 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
| 176 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // And now we want the spaces to be handled nicely. |
| 180 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
| 180 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
| 181 | 181 | |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if(!empty($field['id'])) { |
|
| 185 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
| 186 | - $form_id = '-'.$form['id']; |
|
| 184 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
| 185 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 186 | + $form_id = '-' . $form[ 'id' ]; |
|
| 187 | 187 | } else { |
| 188 | 188 | // @deprecated path. Form should always be given. |
| 189 | 189 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
| 190 | 190 | $gravityview_view = GravityView_View::getInstance(); |
| 191 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
| 191 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
| 194 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - return esc_attr(implode(' ', $classes)); |
|
| 197 | + return esc_attr( implode( ' ', $classes ) ); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | * @return string Sanitized unique HTML `id` attribute for the field |
| 211 | 211 | */ |
| 212 | 212 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
| 213 | - $id = $field['id']; |
|
| 213 | + $id = $field[ 'id' ]; |
|
| 214 | 214 | |
| 215 | 215 | if ( ! empty( $id ) ) { |
| 216 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
| 217 | - $form_id = '-' . $form['id']; |
|
| 216 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
| 217 | + $form_id = '-' . $form[ 'id' ]; |
|
| 218 | 218 | } else { |
| 219 | 219 | // @deprecated path. Form should always be given. |
| 220 | 220 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
| 225 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | return esc_attr( $id ); |
@@ -262,14 +262,14 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) { |
| 264 | 264 | |
| 265 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
| 265 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
| 266 | 266 | gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) ); |
| 267 | 267 | return NULL; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | $href = self::entry_link( $entry, $base_id ); |
| 271 | 271 | |
| 272 | - if( '' === $href ) { |
|
| 272 | + if ( '' === $href ) { |
|
| 273 | 273 | return NULL; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | } else { |
| 307 | 307 | $gravityview_view = GravityView_View::getInstance(); |
| 308 | 308 | |
| 309 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 309 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
| 310 | 310 | $is_search = true; |
| 311 | 311 | } |
| 312 | 312 | } |
@@ -402,9 +402,9 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | // If we've saved the permalink in memory, use it |
| 404 | 404 | // @since 1.3 |
| 405 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
| 405 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
| 406 | 406 | |
| 407 | - if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) { |
|
| 407 | + if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) { |
|
| 408 | 408 | $link = home_url(); |
| 409 | 409 | } |
| 410 | 410 | |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | // If not yet saved, cache the permalink. |
| 415 | 415 | // @since 1.3 |
| 416 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
| 416 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | // Deal with returning to proper pagination for embedded views |
@@ -421,13 +421,13 @@ discard block |
||
| 421 | 421 | |
| 422 | 422 | $args = array(); |
| 423 | 423 | |
| 424 | - if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
| 425 | - $args['pagenum'] = intval( $pagenum ); |
|
| 424 | + if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
| 425 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - if( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
| 429 | - $args['sort'] = $sort; |
|
| 430 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
| 428 | + if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
| 429 | + $args[ 'sort' ] = $sort; |
|
| 430 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | $link = add_query_arg( $args, $link ); |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
| 465 | 465 | |
| 466 | 466 | // Generate an unique hash to use as the default value |
| 467 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
| 467 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
| 468 | 468 | |
| 469 | 469 | /** |
| 470 | 470 | * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
| 476 | 476 | |
| 477 | 477 | // Make sure we have something - use the original ID as backup. |
| 478 | - if( empty( $slug ) ) { |
|
| 478 | + if ( empty( $slug ) ) { |
|
| 479 | 479 | $slug = $id; |
| 480 | 480 | } |
| 481 | 481 | |
@@ -569,15 +569,15 @@ discard block |
||
| 569 | 569 | * @param boolean $custom Should we process the custom entry slug? |
| 570 | 570 | */ |
| 571 | 571 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
| 572 | - if( $custom ) { |
|
| 572 | + if ( $custom ) { |
|
| 573 | 573 | // create the gravityview_unique_id and save it |
| 574 | 574 | |
| 575 | 575 | // Get the entry hash |
| 576 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
| 576 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
| 577 | 577 | |
| 578 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
| 578 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) ); |
|
| 579 | 579 | |
| 580 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 580 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
| 581 | 581 | |
| 582 | 582 | } |
| 583 | 583 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | |
| 597 | 597 | if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
| 598 | 598 | $entry = GVCommon::get_entry( $entry ); |
| 599 | - } else if( empty( $entry ) ) { |
|
| 599 | + } else if ( empty( $entry ) ) { |
|
| 600 | 600 | // @deprecated path |
| 601 | 601 | $entry = GravityView_frontend::getInstance()->getEntry(); |
| 602 | 602 | } |
@@ -616,9 +616,9 @@ discard block |
||
| 616 | 616 | |
| 617 | 617 | $query_arg_name = \GV\Entry::get_endpoint_name(); |
| 618 | 618 | |
| 619 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
| 619 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 620 | 620 | |
| 621 | - if ( get_option('permalink_structure') && !is_preview() ) { |
|
| 621 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
| 622 | 622 | |
| 623 | 623 | $args = array(); |
| 624 | 624 | |
@@ -628,9 +628,9 @@ discard block |
||
| 628 | 628 | */ |
| 629 | 629 | $link_parts = explode( '?', $directory_link ); |
| 630 | 630 | |
| 631 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
| 631 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 632 | 632 | |
| 633 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
| 633 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
| 634 | 634 | |
| 635 | 635 | } else { |
| 636 | 636 | |
@@ -642,22 +642,22 @@ discard block |
||
| 642 | 642 | */ |
| 643 | 643 | if ( $add_directory_args ) { |
| 644 | 644 | |
| 645 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
| 646 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 645 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 646 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | /** |
| 650 | 650 | * @since 1.7 |
| 651 | 651 | */ |
| 652 | 652 | if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
| 653 | - $args['sort'] = $sort; |
|
| 654 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
| 653 | + $args[ 'sort' ] = $sort; |
|
| 654 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
| 660 | - $args['gvid'] = gravityview_get_view_id(); |
|
| 660 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | return add_query_arg( $args, $directory_link ); |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | function gv_class( $field, $form = NULL, $entry = array() ) { |
| 681 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
| 681 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | /** |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | $view_id = 0; |
| 702 | 702 | if ( $context->view ) { |
| 703 | 703 | $view_id = $context->view->ID; |
| 704 | - if( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 704 | + if ( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
| 705 | 705 | $hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() ); |
| 706 | 706 | } |
| 707 | 707 | } |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | $default_css_class .= ' gv-container-no-results'; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
| 732 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
| 733 | 733 | |
| 734 | 734 | /** |
| 735 | 735 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | |
| 757 | 757 | $value = GravityView_API::field_value( $entry, $field ); |
| 758 | 758 | |
| 759 | - if( $value === '' ) { |
|
| 759 | + if ( $value === '' ) { |
|
| 760 | 760 | /** |
| 761 | 761 | * @filter `gravityview_empty_value` What to display when a field is empty |
| 762 | 762 | * @param string $value (empty string) |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | */ |
| 870 | 870 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
| 871 | 871 | |
| 872 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 872 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
| 873 | 873 | |
| 874 | 874 | // For the complete field value as generated by Gravity Forms |
| 875 | 875 | return $display_value; |
@@ -903,16 +903,16 @@ discard block |
||
| 903 | 903 | $terms = explode( ', ', $value ); |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | - foreach ($terms as $term_name ) { |
|
| 906 | + foreach ( $terms as $term_name ) { |
|
| 907 | 907 | |
| 908 | 908 | // If we're processing a category, |
| 909 | - if( $taxonomy === 'category' ) { |
|
| 909 | + if ( $taxonomy === 'category' ) { |
|
| 910 | 910 | |
| 911 | 911 | // Use rgexplode to prevent errors if : doesn't exist |
| 912 | 912 | list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 ); |
| 913 | 913 | |
| 914 | 914 | // The explode was succesful; we have the category ID |
| 915 | - if( !empty( $term_id )) { |
|
| 915 | + if ( ! empty( $term_id ) ) { |
|
| 916 | 916 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
| 917 | 917 | } else { |
| 918 | 918 | // We have to fall back to the name |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | } |
| 926 | 926 | |
| 927 | 927 | // There's still a tag/category here. |
| 928 | - if( $term ) { |
|
| 928 | + if ( $term ) { |
|
| 929 | 929 | |
| 930 | 930 | $term_link = get_term_link( $term, $taxonomy ); |
| 931 | 931 | |
@@ -934,11 +934,11 @@ discard block |
||
| 934 | 934 | continue; |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 937 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | |
| 941 | - return implode(', ', $output ); |
|
| 941 | + return implode( ', ', $output ); |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | /** |
@@ -952,8 +952,8 @@ discard block |
||
| 952 | 952 | |
| 953 | 953 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
| 954 | 954 | |
| 955 | - if( empty( $link ) ) { |
|
| 956 | - return strip_tags( $output); |
|
| 955 | + if ( empty( $link ) ) { |
|
| 956 | + return strip_tags( $output ); |
|
| 957 | 957 | } |
| 958 | 958 | |
| 959 | 959 | return $output; |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | $fe = GravityView_frontend::getInstance(); |
| 973 | 973 | |
| 974 | 974 | // Solve problem when loading content via admin-ajax.php |
| 975 | - if( ! $fe->getGvOutputData() ) { |
|
| 975 | + if ( ! $fe->getGvOutputData() ) { |
|
| 976 | 976 | |
| 977 | 977 | gravityview()->log->debug( 'gv_output_data not defined; parsing content.' ); |
| 978 | 978 | |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | } |
| 981 | 981 | |
| 982 | 982 | // Make 100% sure that we're dealing with a properly called situation |
| 983 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 983 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
| 984 | 984 | |
| 985 | 985 | gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) ); |
| 986 | 986 | |
@@ -1202,12 +1202,12 @@ discard block |
||
| 1202 | 1202 | function gravityview_get_files_array( $value, $gv_class = '', $context = null ) { |
| 1203 | 1203 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 1204 | 1204 | |
| 1205 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
| 1206 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
| 1205 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
| 1206 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1210 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1209 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
| 1210 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' ); |
|
| 1211 | 1211 | } |
| 1212 | 1212 | |
| 1213 | 1213 | if ( is_null( $context ) ) { |
@@ -1310,21 +1310,21 @@ discard block |
||
| 1310 | 1310 | } else { |
| 1311 | 1311 | // @deprecated path |
| 1312 | 1312 | // Required fields. |
| 1313 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
| 1313 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
| 1314 | 1314 | gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) ); |
| 1315 | 1315 | return ''; |
| 1316 | 1316 | } |
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | 1319 | if ( $context instanceof \GV\Template_Context ) { |
| 1320 | - $entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1321 | - $field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1322 | - $form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1320 | + $entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() ); |
|
| 1321 | + $field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() ); |
|
| 1322 | + $form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() ); |
|
| 1323 | 1323 | } else { |
| 1324 | 1324 | // @deprecated path |
| 1325 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
| 1326 | - $field = $args['field']; |
|
| 1327 | - $form = $args['form']; |
|
| 1325 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
| 1326 | + $field = $args[ 'field' ]; |
|
| 1327 | + $form = $args[ 'form' ]; |
|
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | 1330 | /** |
@@ -1342,40 +1342,40 @@ discard block |
||
| 1342 | 1342 | ); |
| 1343 | 1343 | |
| 1344 | 1344 | if ( $context instanceof \GV\Template_Context ) { |
| 1345 | - $placeholders['value'] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1345 | + $placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' ); |
|
| 1346 | 1346 | } else { |
| 1347 | 1347 | // @deprecated path |
| 1348 | - $placeholders['value'] = gv_value( $entry, $field ); |
|
| 1348 | + $placeholders[ 'value' ] = gv_value( $entry, $field ); |
|
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | // If the value is empty and we're hiding empty, return empty. |
| 1352 | - if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
| 1352 | + if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
| 1353 | 1353 | return ''; |
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | - if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
| 1357 | - $placeholders['value'] = wpautop( $placeholders['value'] ); |
|
| 1356 | + if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
| 1357 | + $placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] ); |
|
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | 1360 | // Get width setting, if exists |
| 1361 | - $placeholders['width'] = GravityView_API::field_width( $field ); |
|
| 1361 | + $placeholders[ 'width' ] = GravityView_API::field_width( $field ); |
|
| 1362 | 1362 | |
| 1363 | 1363 | // If replacing with CSS inline formatting, let's do it. |
| 1364 | - $placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' ); |
|
| 1364 | + $placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' ); |
|
| 1365 | 1365 | |
| 1366 | 1366 | // Grab the Class using `gv_class` |
| 1367 | - $placeholders['class'] = gv_class( $field, $form, $entry ); |
|
| 1368 | - $placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1367 | + $placeholders[ 'class' ] = gv_class( $field, $form, $entry ); |
|
| 1368 | + $placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
| 1369 | 1369 | |
| 1370 | 1370 | if ( $context instanceof \GV\Template_Context ) { |
| 1371 | - $placeholders['label_value'] = \GV\Utils::get( $args, 'label' ); |
|
| 1371 | + $placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' ); |
|
| 1372 | 1372 | } else { |
| 1373 | 1373 | // Default Label value |
| 1374 | - $placeholders['label_value'] = gv_label( $field, $entry ); |
|
| 1374 | + $placeholders[ 'label_value' ] = gv_label( $field, $entry ); |
|
| 1375 | 1375 | } |
| 1376 | 1376 | |
| 1377 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
| 1378 | - $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1377 | + if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) { |
|
| 1378 | + $placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
| 1379 | 1379 | } |
| 1380 | 1380 | |
| 1381 | 1381 | /** |
@@ -1386,7 +1386,7 @@ discard block |
||
| 1386 | 1386 | * @since 2.0 |
| 1387 | 1387 | * @param \GV\Template_Context $context The context. |
| 1388 | 1388 | */ |
| 1389 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context ); |
|
| 1389 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context ); |
|
| 1390 | 1390 | |
| 1391 | 1391 | /** |
| 1392 | 1392 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1413,7 +1413,7 @@ discard block |
||
| 1413 | 1413 | foreach ( $placeholders as $tag => $value ) { |
| 1414 | 1414 | |
| 1415 | 1415 | // If the tag doesn't exist just skip it |
| 1416 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
| 1416 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
| 1417 | 1417 | continue; |
| 1418 | 1418 | } |
| 1419 | 1419 | |
@@ -28,31 +28,31 @@ discard block |
||
| 28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 29 | 29 | |
| 30 | 30 | // Tooltips |
| 31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 32 | 32 | |
| 33 | 33 | // adding styles and scripts |
| 34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 39 | - |
|
| 40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 42 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers') ); |
|
| 43 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 44 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 45 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 39 | + |
|
| 40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 42 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ) ); |
|
| 43 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 44 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 45 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 46 | 46 | |
| 47 | 47 | // @todo check if this hook is needed.. |
| 48 | 48 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
| 49 | 49 | |
| 50 | 50 | // Add Connected Form column |
| 51 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 51 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 52 | 52 | |
| 53 | 53 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 54 | 54 | |
| 55 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 55 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 56 | 56 | |
| 57 | 57 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 58 | 58 | |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | function suggest_support_articles( $localization_data = array() ) { |
| 73 | 73 | |
| 74 | - if( ! gravityview()->request->is_view() ) { |
|
| 74 | + if ( ! gravityview()->request->is_view() ) { |
|
| 75 | 75 | return $localization_data; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $localization_data['suggest'] = array( |
|
| 78 | + $localization_data[ 'suggest' ] = array( |
|
| 79 | 79 | '57ef23539033602e61d4a560', |
| 80 | 80 | '54c67bb9e4b0512429885513', |
| 81 | 81 | '54c67bb9e4b0512429885512', |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 97 | 97 | global $pagenow; |
| 98 | 98 | |
| 99 | - if ( !is_admin() ) { |
|
| 99 | + if ( ! is_admin() ) { |
|
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false; |
|
| 103 | + $form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false; |
|
| 104 | 104 | |
| 105 | - if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 105 | + if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -119,18 +119,18 @@ discard block |
||
| 119 | 119 | function add_view_dropdown() { |
| 120 | 120 | $current_screen = get_current_screen(); |
| 121 | 121 | |
| 122 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 122 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $forms = gravityview_get_forms(); |
| 127 | 127 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
| 128 | 128 | // If there are no forms to select, show no forms. |
| 129 | - if( !empty( $forms ) ) { ?> |
|
| 129 | + if ( ! empty( $forms ) ) { ?> |
|
| 130 | 130 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 131 | 131 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 132 | - <?php foreach( $forms as $form ) { ?> |
|
| 133 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 132 | + <?php foreach ( $forms as $form ) { ?> |
|
| 133 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 134 | 134 | <?php } ?> |
| 135 | 135 | </select> |
| 136 | 136 | <?php } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 145 | 145 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 146 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 146 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -166,9 +166,9 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | $connected_views = gravityview_get_connected_views( $id, array( 'post_status' => 'any' ) ); |
| 168 | 168 | |
| 169 | - if( empty( $connected_views ) ) { |
|
| 169 | + if ( empty( $connected_views ) ) { |
|
| 170 | 170 | |
| 171 | - $menu_items['gravityview'] = array( |
|
| 171 | + $menu_items[ 'gravityview' ] = array( |
|
| 172 | 172 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 173 | 173 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 174 | 174 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -184,22 +184,22 @@ discard block |
||
| 184 | 184 | $sub_menu_items = array(); |
| 185 | 185 | foreach ( (array)$connected_views as $view ) { |
| 186 | 186 | |
| 187 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 187 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 191 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 192 | 192 | |
| 193 | - $sub_menu_items[] = array( |
|
| 193 | + $sub_menu_items[ ] = array( |
|
| 194 | 194 | 'label' => esc_attr( $label ), |
| 195 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 195 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 196 | 196 | ); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // If there were no items added, then let's create the parent menu |
| 200 | - if( $sub_menu_items ) { |
|
| 200 | + if ( $sub_menu_items ) { |
|
| 201 | 201 | |
| 202 | - $sub_menu_items[] = array( |
|
| 202 | + $sub_menu_items[ ] = array( |
|
| 203 | 203 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 204 | 204 | 'link_class' => 'gv-create-view', |
| 205 | 205 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -208,14 +208,14 @@ discard block |
||
| 208 | 208 | ); |
| 209 | 209 | |
| 210 | 210 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 211 | - $sub_menu_items[] = array( |
|
| 211 | + $sub_menu_items[ ] = array( |
|
| 212 | 212 | 'url' => '#', |
| 213 | 213 | 'label' => '', |
| 214 | 214 | 'menu_class' => 'hidden', |
| 215 | 215 | 'capabilities' => '', |
| 216 | 216 | ); |
| 217 | 217 | |
| 218 | - $menu_items['gravityview'] = array( |
|
| 218 | + $menu_items[ 'gravityview' ] = array( |
|
| 219 | 219 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 220 | 220 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 221 | 221 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | $add = array( 'captcha', 'page' ); |
| 245 | 245 | |
| 246 | 246 | // Don't allowing editing the following values: |
| 247 | - if( $context === 'edit' ) { |
|
| 248 | - $add[] = 'post_id'; |
|
| 247 | + if ( $context === 'edit' ) { |
|
| 248 | + $add[ ] = 'post_id'; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | $return = array_merge( $array, $add ); |
@@ -268,32 +268,32 @@ discard block |
||
| 268 | 268 | foreach ( $default_args as $key => $arg ) { |
| 269 | 269 | |
| 270 | 270 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 271 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 271 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 272 | 272 | |
| 273 | 273 | // By default, use `tooltip` if defined. |
| 274 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 274 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 275 | 275 | |
| 276 | 276 | // Otherwise, use the description as a tooltip. |
| 277 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
| 278 | - $tooltip = $arg['desc']; |
|
| 277 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
| 278 | + $tooltip = $arg[ 'desc' ]; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // If there's no tooltip set, continue |
| 282 | - if( empty( $tooltip ) ) { |
|
| 282 | + if ( empty( $tooltip ) ) { |
|
| 283 | 283 | continue; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Add the tooltip |
| 287 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 288 | - 'title' => $arg['label'], |
|
| 287 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 288 | + 'title' => $arg[ 'label' ], |
|
| 289 | 289 | 'value' => $tooltip, |
| 290 | 290 | ); |
| 291 | 291 | |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 295 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 296 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 294 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 295 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 296 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 297 | 297 | ); |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 313 | 313 | |
| 314 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 314 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 315 | 315 | |
| 316 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 316 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | return $tooltips; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * |
| 328 | 328 | * @return void |
| 329 | 329 | */ |
| 330 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 330 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 331 | 331 | |
| 332 | 332 | $output = ''; |
| 333 | 333 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 350 | 350 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 351 | 351 | |
| 352 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 352 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 353 | 353 | |
| 354 | 354 | break; |
| 355 | 355 | |
@@ -390,44 +390,44 @@ discard block |
||
| 390 | 390 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 391 | 391 | |
| 392 | 392 | // Either the form is empty or the form ID is 0, not yet set. |
| 393 | - if( empty( $form ) ) { |
|
| 393 | + if ( empty( $form ) ) { |
|
| 394 | 394 | return ''; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | // The $form is passed as the form ID |
| 398 | - if( !is_array( $form ) ) { |
|
| 398 | + if ( ! is_array( $form ) ) { |
|
| 399 | 399 | $form = gravityview_get_form( $form ); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - $form_id = $form['id']; |
|
| 402 | + $form_id = $form[ 'id' ]; |
|
| 403 | 403 | $links = array(); |
| 404 | 404 | |
| 405 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 405 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 406 | 406 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 407 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 408 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 407 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 408 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 409 | 409 | } else { |
| 410 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 410 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 413 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 414 | 414 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 415 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 415 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 418 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 419 | 419 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 420 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 420 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 423 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 424 | 424 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 425 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 425 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | $output = ''; |
| 429 | 429 | |
| 430 | - if( !empty( $include_form_link ) ) { |
|
| 430 | + if ( ! empty( $include_form_link ) ) { |
|
| 431 | 431 | $output .= $form_link; |
| 432 | 432 | } |
| 433 | 433 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | */ |
| 440 | 440 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 441 | 441 | |
| 442 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 442 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 443 | 443 | |
| 444 | 444 | return $output; |
| 445 | 445 | } |
@@ -453,8 +453,8 @@ discard block |
||
| 453 | 453 | // Get the date column and save it for later to add back in. |
| 454 | 454 | // This adds it after the Data Source column. |
| 455 | 455 | // This way, we don't need to do array_slice, array_merge, etc. |
| 456 | - $date = $columns['date']; |
|
| 457 | - unset( $columns['date'] ); |
|
| 456 | + $date = $columns[ 'date' ]; |
|
| 457 | + unset( $columns[ 'date' ] ); |
|
| 458 | 458 | |
| 459 | 459 | $data_source_required_caps = array( |
| 460 | 460 | 'gravityforms_edit_forms', |
@@ -465,14 +465,14 @@ discard block |
||
| 465 | 465 | 'gravityforms_preview_forms', |
| 466 | 466 | ); |
| 467 | 467 | |
| 468 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 469 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 468 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 469 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 472 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 473 | 473 | |
| 474 | 474 | // Add the date back in. |
| 475 | - $columns['date'] = $date; |
|
| 475 | + $columns[ 'date' ] = $date; |
|
| 476 | 476 | |
| 477 | 477 | return $columns; |
| 478 | 478 | } |
@@ -486,12 +486,12 @@ discard block |
||
| 486 | 486 | */ |
| 487 | 487 | function save_postdata( $post_id ) { |
| 488 | 488 | |
| 489 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 489 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 490 | 490 | return; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | // validate post_type |
| 494 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 494 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 495 | 495 | return; |
| 496 | 496 | } |
| 497 | 497 | |
@@ -506,64 +506,64 @@ discard block |
||
| 506 | 506 | $statii = array(); |
| 507 | 507 | |
| 508 | 508 | // check if this is a start fresh View |
| 509 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 509 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 510 | 510 | |
| 511 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 511 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 512 | 512 | // save form id |
| 513 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 513 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 514 | 514 | |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 517 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 518 | 518 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
| 519 | 519 | return; |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Was this a start fresh? |
| 523 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 524 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 523 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 524 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 525 | 525 | } else { |
| 526 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 526 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | // Check if we have a template id |
| 530 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 530 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 531 | 531 | |
| 532 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 532 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 533 | 533 | |
| 534 | 534 | // now save template id |
| 535 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 535 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | |
| 539 | 539 | // save View Configuration metabox |
| 540 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 540 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 541 | 541 | |
| 542 | 542 | // template settings |
| 543 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 544 | - $_POST['template_settings'] = array(); |
|
| 543 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 544 | + $_POST[ 'template_settings' ] = array(); |
|
| 545 | 545 | } |
| 546 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 546 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 547 | 547 | |
| 548 | 548 | $fields = array(); |
| 549 | 549 | |
| 550 | 550 | // Directory&single Visible Fields |
| 551 | - if( !empty( $preset_fields ) ) { |
|
| 551 | + if ( ! empty( $preset_fields ) ) { |
|
| 552 | 552 | |
| 553 | 553 | $fields = $preset_fields; |
| 554 | 554 | |
| 555 | - } elseif( !empty( $_POST['gv_fields'] ) ) { |
|
| 555 | + } elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 556 | 556 | $fields = _gravityview_process_posted_fields(); |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | $fields = map_deep( $fields, 'addslashes' ); |
| 560 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 560 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 561 | 561 | |
| 562 | 562 | // Directory Visible Widgets |
| 563 | - if( empty( $_POST['widgets'] ) ) { |
|
| 564 | - $_POST['widgets'] = array(); |
|
| 563 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 564 | + $_POST[ 'widgets' ] = array(); |
|
| 565 | 565 | } |
| 566 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
| 566 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
| 567 | 567 | |
| 568 | 568 | } // end save view configuration |
| 569 | 569 | |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
| 574 | 574 | * @since 1.17.2 |
| 575 | 575 | */ |
| 576 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
| 576 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
| 577 | 577 | |
| 578 | 578 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
| 579 | 579 | } |
@@ -617,20 +617,20 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | $output = ''; |
| 619 | 619 | |
| 620 | - if( !empty( $fields ) ) { |
|
| 620 | + if ( ! empty( $fields ) ) { |
|
| 621 | 621 | |
| 622 | - foreach( $fields as $id => $details ) { |
|
| 622 | + foreach ( $fields as $id => $details ) { |
|
| 623 | 623 | |
| 624 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
| 624 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
| 625 | 625 | continue; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | // Edit mode only allows editing the parent fields, not single inputs. |
| 629 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
| 629 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 630 | 630 | continue; |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, $settings = array(), $form ); |
|
| 633 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, $settings = array(), $form ); |
|
| 634 | 634 | |
| 635 | 635 | } // End foreach |
| 636 | 636 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | echo $output; |
| 639 | 639 | |
| 640 | 640 | // For the EDIT view we only want to allow the form fields. |
| 641 | - if( $context === 'edit' ) { |
|
| 641 | + if ( $context === 'edit' ) { |
|
| 642 | 642 | return; |
| 643 | 643 | } |
| 644 | 644 | |
@@ -662,16 +662,16 @@ discard block |
||
| 662 | 662 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
| 663 | 663 | array( |
| 664 | 664 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
| 665 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
| 665 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
| 666 | 666 | 'field_id' => 'all-fields', |
| 667 | 667 | 'label_type' => 'field', |
| 668 | 668 | 'input_type' => NULL, |
| 669 | 669 | 'field_options' => NULL, |
| 670 | 670 | 'settings_html' => NULL, |
| 671 | 671 | ) |
| 672 | - )); |
|
| 672 | + ) ); |
|
| 673 | 673 | |
| 674 | - if( !empty( $additional_fields )) { |
|
| 674 | + if ( ! empty( $additional_fields ) ) { |
|
| 675 | 675 | foreach ( (array)$additional_fields as $item ) { |
| 676 | 676 | |
| 677 | 677 | // Prevent items from not having index set |
@@ -682,16 +682,16 @@ discard block |
||
| 682 | 682 | 'input_type' => NULL, |
| 683 | 683 | 'field_options' => NULL, |
| 684 | 684 | 'settings_html' => NULL, |
| 685 | - )); |
|
| 685 | + ) ); |
|
| 686 | 686 | |
| 687 | 687 | // Backward compat. |
| 688 | - if( !empty( $item['field_options'] ) ) { |
|
| 688 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 689 | 689 | // Use settings_html from now on. |
| 690 | - $item['settings_html'] = $item['field_options']; |
|
| 690 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | // Render a label for each of them |
| 694 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
| 694 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
| 695 | 695 | |
| 696 | 696 | } |
| 697 | 697 | } |
@@ -704,54 +704,54 @@ discard block |
||
| 704 | 704 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 705 | 705 | * @return array |
| 706 | 706 | */ |
| 707 | - function get_entry_default_fields($form, $zone) { |
|
| 707 | + function get_entry_default_fields( $form, $zone ) { |
|
| 708 | 708 | |
| 709 | 709 | $entry_default_fields = array(); |
| 710 | 710 | |
| 711 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 711 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 712 | 712 | |
| 713 | 713 | $entry_default_fields = array( |
| 714 | 714 | 'id' => array( |
| 715 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 715 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 716 | 716 | 'type' => 'id', |
| 717 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 717 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 718 | 718 | ), |
| 719 | 719 | 'date_created' => array( |
| 720 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 721 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 720 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 721 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 722 | 722 | 'type' => 'date_created', |
| 723 | 723 | ), |
| 724 | 724 | 'source_url' => array( |
| 725 | - 'label' => __('Source URL', 'gravityview'), |
|
| 725 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 726 | 726 | 'type' => 'source_url', |
| 727 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 727 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 728 | 728 | ), |
| 729 | 729 | 'ip' => array( |
| 730 | - 'label' => __('User IP', 'gravityview'), |
|
| 730 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 731 | 731 | 'type' => 'ip', |
| 732 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 732 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 733 | 733 | ), |
| 734 | 734 | 'created_by' => array( |
| 735 | - 'label' => __('User', 'gravityview'), |
|
| 735 | + 'label' => __( 'User', 'gravityview' ), |
|
| 736 | 736 | 'type' => 'created_by', |
| 737 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 737 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 738 | 738 | ), |
| 739 | 739 | |
| 740 | 740 | /** |
| 741 | 741 | * @since 1.7.2 |
| 742 | 742 | */ |
| 743 | 743 | 'other_entries' => array( |
| 744 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 744 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 745 | 745 | 'type' => 'other_entries', |
| 746 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 746 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 747 | 747 | ), |
| 748 | 748 | ); |
| 749 | 749 | |
| 750 | - if( 'single' !== $zone) { |
|
| 750 | + if ( 'single' !== $zone ) { |
|
| 751 | 751 | |
| 752 | - $entry_default_fields['entry_link'] = array( |
|
| 753 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 754 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 752 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 753 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 754 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 755 | 755 | 'type' => 'entry_link', |
| 756 | 756 | ); |
| 757 | 757 | } |
@@ -761,10 +761,10 @@ discard block |
||
| 761 | 761 | /** |
| 762 | 762 | * @since 1.2 |
| 763 | 763 | */ |
| 764 | - $entry_default_fields['custom'] = array( |
|
| 765 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 764 | + $entry_default_fields[ 'custom' ] = array( |
|
| 765 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 766 | 766 | 'type' => 'custom', |
| 767 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 767 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 768 | 768 | ); |
| 769 | 769 | |
| 770 | 770 | /** |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | * @param string|array $form form_ID or form object |
| 774 | 774 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 775 | 775 | */ |
| 776 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 776 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | /** |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | */ |
| 785 | 785 | function get_available_fields( $form = '', $zone = NULL ) { |
| 786 | 786 | |
| 787 | - if( empty( $form ) ) { |
|
| 787 | + if ( empty( $form ) ) { |
|
| 788 | 788 | gravityview()->log->error( '$form is empty' ); |
| 789 | 789 | return array(); |
| 790 | 790 | } |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | $fields = gravityview_get_form_fields( $form, true ); |
| 794 | 794 | |
| 795 | 795 | // get meta fields ( only if form was already created ) |
| 796 | - if( !is_array( $form ) ) { |
|
| 796 | + if ( ! is_array( $form ) ) { |
|
| 797 | 797 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 798 | 798 | } else { |
| 799 | 799 | $meta_fields = array(); |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | $fields = $fields + $meta_fields + $default_fields; |
| 807 | 807 | |
| 808 | 808 | // Move Custom Content to top |
| 809 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
| 809 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
| 810 | 810 | |
| 811 | 811 | return $fields; |
| 812 | 812 | } |
@@ -820,11 +820,11 @@ discard block |
||
| 820 | 820 | |
| 821 | 821 | $widgets = $this->get_registered_widgets(); |
| 822 | 822 | |
| 823 | - if( !empty( $widgets ) ) { |
|
| 823 | + if ( ! empty( $widgets ) ) { |
|
| 824 | 824 | |
| 825 | - foreach( $widgets as $id => $details ) { |
|
| 825 | + foreach ( $widgets as $id => $details ) { |
|
| 826 | 826 | |
| 827 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 827 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 828 | 828 | |
| 829 | 829 | } |
| 830 | 830 | } |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 854 | 854 | global $post; |
| 855 | 855 | |
| 856 | - if( $type === 'widget' ) { |
|
| 856 | + if ( $type === 'widget' ) { |
|
| 857 | 857 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 858 | 858 | } else { |
| 859 | 859 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -865,10 +865,10 @@ discard block |
||
| 865 | 865 | $form_id = null; |
| 866 | 866 | |
| 867 | 867 | // if saved values, get available fields to label everyone |
| 868 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 868 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 869 | 869 | |
| 870 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 871 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 870 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 871 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 872 | 872 | } else { |
| 873 | 873 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
| 874 | 874 | } |
@@ -886,44 +886,44 @@ discard block |
||
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | - foreach( $rows as $row ) : |
|
| 890 | - foreach( $row as $col => $areas ) : |
|
| 891 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 889 | + foreach ( $rows as $row ) : |
|
| 890 | + foreach ( $row as $col => $areas ) : |
|
| 891 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 892 | 892 | |
| 893 | 893 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 894 | 894 | |
| 895 | - <?php foreach( $areas as $area ) : ?> |
|
| 895 | + <?php foreach ( $areas as $area ) : ?> |
|
| 896 | 896 | |
| 897 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 898 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 897 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 898 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 899 | 899 | |
| 900 | 900 | <?php // render saved fields |
| 901 | 901 | |
| 902 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 902 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 903 | 903 | |
| 904 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 904 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 905 | 905 | |
| 906 | 906 | // Maybe has a form ID |
| 907 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
| 907 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
| 908 | 908 | |
| 909 | 909 | $input_type = NULL; |
| 910 | 910 | |
| 911 | 911 | if ( $form_id ) { |
| 912 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
| 912 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
| 913 | 913 | } else { |
| 914 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 914 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 915 | 915 | } |
| 916 | 916 | |
| 917 | - if ( !$original_item ) { |
|
| 918 | - gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) ); |
|
| 917 | + if ( ! $original_item ) { |
|
| 918 | + gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) ); |
|
| 919 | 919 | |
| 920 | 920 | $original_item = $field; |
| 921 | 921 | } else { |
| 922 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 922 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | // Field options dialog box |
| 926 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 926 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 927 | 927 | |
| 928 | 928 | $item = array( |
| 929 | 929 | 'input_type' => $input_type, |
@@ -936,23 +936,23 @@ discard block |
||
| 936 | 936 | $item = wp_parse_args( $item, $original_item ); |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | - switch( $type ) { |
|
| 939 | + switch ( $type ) { |
|
| 940 | 940 | case 'widget': |
| 941 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 941 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 942 | 942 | break; |
| 943 | 943 | default: |
| 944 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
| 944 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | } // End if zone is not empty ?> |
| 949 | 949 | |
| 950 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
| 950 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
| 951 | 951 | </div> |
| 952 | 952 | <div class="gv-droppable-area-action"> |
| 953 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
| 953 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
| 954 | 954 | |
| 955 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
| 955 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
| 956 | 956 | </div> |
| 957 | 957 | </div> |
| 958 | 958 | |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | $default_widget_areas = GravityView_Widget::get_default_widget_areas(); |
| 975 | 975 | |
| 976 | 976 | $widgets = array(); |
| 977 | - if( !empty( $post_id ) ) { |
|
| 977 | + if ( ! empty( $post_id ) ) { |
|
| 978 | 978 | $widgets = gravityview_get_directory_widgets( $post_id ); |
| 979 | 979 | } |
| 980 | 980 | |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | // list of available fields to be shown in the popup |
| 1008 | 1008 | $forms = gravityview_get_forms( 'any' ); |
| 1009 | 1009 | |
| 1010 | - $form_ids = array_map( function ($form) { return $form['id']; }, $forms); |
|
| 1010 | + $form_ids = array_map( function( $form ) { return $form[ 'id' ]; }, $forms ); |
|
| 1011 | 1011 | |
| 1012 | 1012 | foreach ( $form_ids as $form_id ) { |
| 1013 | 1013 | $filter_field_id = sprintf( 'gv-field-filter-%s-%d', $context, $form_id ); |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | </div> |
| 1021 | 1021 | |
| 1022 | 1022 | <div id="available-fields-<?php echo $filter_field_id; ?>" aria-live="polite" role="listbox"> |
| 1023 | - <?php do_action('gravityview_render_available_fields', $form_id, $context ); ?> |
|
| 1023 | + <?php do_action( 'gravityview_render_available_fields', $form_id, $context ); ?> |
|
| 1024 | 1024 | </div> |
| 1025 | 1025 | |
| 1026 | 1026 | <div class="gv-no-results hidden description"><?php esc_html_e( 'No fields were found matching the search.', 'gravityview' ); ?></div> |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | * @return string HTML of the active areas |
| 1040 | 1040 | */ |
| 1041 | 1041 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 1042 | - if( empty( $template_id ) ) { |
|
| 1042 | + if ( empty( $template_id ) ) { |
|
| 1043 | 1043 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
| 1044 | 1044 | return ''; |
| 1045 | 1045 | } |
@@ -1053,12 +1053,12 @@ discard block |
||
| 1053 | 1053 | */ |
| 1054 | 1054 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 1055 | 1055 | |
| 1056 | - if( empty( $template_areas ) ) { |
|
| 1056 | + if ( empty( $template_areas ) ) { |
|
| 1057 | 1057 | |
| 1058 | 1058 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
| 1059 | 1059 | $output = '<div>'; |
| 1060 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
| 1061 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
| 1060 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
| 1061 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
| 1062 | 1062 | $output .= '</div>'; |
| 1063 | 1063 | } else { |
| 1064 | 1064 | |
@@ -1073,7 +1073,7 @@ discard block |
||
| 1073 | 1073 | |
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | - if( $echo ) { |
|
| 1076 | + if ( $echo ) { |
|
| 1077 | 1077 | echo $output; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
@@ -1093,26 +1093,26 @@ discard block |
||
| 1093 | 1093 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 1094 | 1094 | |
| 1095 | 1095 | // Add the GV font (with the Astronaut) |
| 1096 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 1096 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 1097 | 1097 | |
| 1098 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 1098 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 1099 | 1099 | |
| 1100 | 1100 | // Don't process any scripts below here if it's not a GravityView page. |
| 1101 | - if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1101 | + if ( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1102 | 1102 | return; |
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 1106 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 1106 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
| 1107 | 1107 | |
| 1108 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1108 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 1109 | 1109 | |
| 1110 | 1110 | //enqueue scripts |
| 1111 | 1111 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
| 1112 | 1112 | |
| 1113 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1113 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1114 | 1114 | 'cookiepath' => COOKIEPATH, |
| 1115 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1115 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
| 1116 | 1116 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1117 | 1117 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
| 1118 | 1118 | 'label_close' => __( 'Close', 'gravityview' ), |
@@ -1124,9 +1124,9 @@ discard block |
||
| 1124 | 1124 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1125 | 1125 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1126 | 1126 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
| 1127 | - )); |
|
| 1127 | + ) ); |
|
| 1128 | 1128 | |
| 1129 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1129 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1130 | 1130 | |
| 1131 | 1131 | // Enqueue scripts needed for merge tags |
| 1132 | 1132 | self::enqueue_gravity_forms_scripts(); |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | ); |
| 1152 | 1152 | |
| 1153 | 1153 | if ( wp_is_mobile() ) { |
| 1154 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1154 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | 1157 | wp_enqueue_script( $scripts ); |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | * |
| 50 | 50 | * @param array $items Scripts or styles to exclude from no-conflict |
| 51 | 51 | * |
| 52 | - * @return array |
|
| 52 | + * @return string[] |
|
| 53 | 53 | */ |
| 54 | 54 | public function register_noconflict( $items ) { |
| 55 | 55 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function add_admin_menu() { |
| 97 | 97 | |
| 98 | - $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
| 98 | + $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
| 99 | 99 | |
| 100 | 100 | $menu_text = sprintf( '<span title="%s">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text ); |
| 101 | 101 | |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | - * When on the Installer page, show a different notice than on the Settings page |
|
| 114 | - * |
|
| 113 | + * When on the Installer page, show a different notice than on the Settings page |
|
| 114 | + * |
|
| 115 | 115 | * @param array $notice |
| 116 | 116 | * |
| 117 | 117 | * @return string License notice |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | public function maybe_modify_license_notice( $notice = '' ) { |
| 120 | 120 | |
| 121 | 121 | if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) { |
| 122 | - return $notice; |
|
| 123 | - } |
|
| 122 | + return $notice; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
| 125 | + return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -160,43 +160,43 @@ discard block |
||
| 160 | 160 | * Get downloads data from transient or from API; save transient after getting data from API |
| 161 | 161 | * |
| 162 | 162 | * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: { |
| 163 | - * @type array $info { |
|
| 164 | - * @type string $id int 17 |
|
| 165 | - * @type string $slug Extension slug |
|
| 166 | - * @type string $title Extension title |
|
| 167 | - * @type string $create_date in '2018-07-19 20:03:10' format |
|
| 168 | - * @type string $modified_date |
|
| 169 | - * @type string $status |
|
| 170 | - * @type string $link URL to public plugin page |
|
| 171 | - * @type string $content |
|
| 172 | - * @type string $excerpt |
|
| 173 | - * @type string $thumbnail URL to thumbnail |
|
| 174 | - * @type array $category Taxonomy details for the plugin's category { |
|
| 175 | - * @type int $term_id => int 30 |
|
| 176 | - * @type string $name => string 'Plugins' (length=7) |
|
| 177 | - * @type string $slug => string 'plugins' (length=7) |
|
| 178 | - * @type int $term_group => int 0 |
|
| 179 | - * @type int $term_taxonomy_id => int 30 |
|
| 180 | - * @type string $taxonomy => string 'download_category' (length=17) |
|
| 181 | - * @type string $description => string '' (length=0) |
|
| 182 | - * @type int $parent => int 0 |
|
| 183 | - * @type int $count => int 4 |
|
| 184 | - * @type string $filter => string 'raw' (length=3) |
|
| 185 | - * } |
|
| 186 | - * @type array $tags {see $category above} |
|
| 187 | - * @type string $textdomain string 'gravityview' (length=11) |
|
| 188 | - * } |
|
| 189 | - * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
| 190 | - * @type array $licensing { |
|
| 191 | - * @type bool $enabled Is licensing enabled for the extension |
|
| 192 | - * @type string $version Version number |
|
| 193 | - * @type string $exp_unit Expiration unit ('years') |
|
| 194 | - * @type string $exp_length Expiration length ('1') |
|
| 195 | - * } |
|
| 196 | - * @type array $files Array of files. Empty if user has no access to the file. { |
|
| 197 | - * @type string $file string URL of the file download |
|
| 198 | - * } |
|
| 199 | - * } |
|
| 163 | + * @type array $info { |
|
| 164 | + * @type string $id int 17 |
|
| 165 | + * @type string $slug Extension slug |
|
| 166 | + * @type string $title Extension title |
|
| 167 | + * @type string $create_date in '2018-07-19 20:03:10' format |
|
| 168 | + * @type string $modified_date |
|
| 169 | + * @type string $status |
|
| 170 | + * @type string $link URL to public plugin page |
|
| 171 | + * @type string $content |
|
| 172 | + * @type string $excerpt |
|
| 173 | + * @type string $thumbnail URL to thumbnail |
|
| 174 | + * @type array $category Taxonomy details for the plugin's category { |
|
| 175 | + * @type int $term_id => int 30 |
|
| 176 | + * @type string $name => string 'Plugins' (length=7) |
|
| 177 | + * @type string $slug => string 'plugins' (length=7) |
|
| 178 | + * @type int $term_group => int 0 |
|
| 179 | + * @type int $term_taxonomy_id => int 30 |
|
| 180 | + * @type string $taxonomy => string 'download_category' (length=17) |
|
| 181 | + * @type string $description => string '' (length=0) |
|
| 182 | + * @type int $parent => int 0 |
|
| 183 | + * @type int $count => int 4 |
|
| 184 | + * @type string $filter => string 'raw' (length=3) |
|
| 185 | + * } |
|
| 186 | + * @type array $tags {see $category above} |
|
| 187 | + * @type string $textdomain string 'gravityview' (length=11) |
|
| 188 | + * } |
|
| 189 | + * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
| 190 | + * @type array $licensing { |
|
| 191 | + * @type bool $enabled Is licensing enabled for the extension |
|
| 192 | + * @type string $version Version number |
|
| 193 | + * @type string $exp_unit Expiration unit ('years') |
|
| 194 | + * @type string $exp_length Expiration length ('1') |
|
| 195 | + * } |
|
| 196 | + * @type array $files Array of files. Empty if user has no access to the file. { |
|
| 197 | + * @type string $file string URL of the file download |
|
| 198 | + * } |
|
| 199 | + * } |
|
| 200 | 200 | */ |
| 201 | 201 | public function get_downloads_data() { |
| 202 | 202 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | ) ); |
| 225 | 225 | |
| 226 | 226 | if ( is_wp_error( $response ) ) { |
| 227 | - gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
| 227 | + gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
| 228 | 228 | return $response; |
| 229 | 229 | } |
| 230 | 230 | |
@@ -277,10 +277,10 @@ discard block |
||
| 277 | 277 | <div class="gv-admin-installer-notice notice inline error"> |
| 278 | 278 | <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3> |
| 279 | 279 | <?php |
| 280 | - if ( is_wp_error( $downloads_data ) ) { |
|
| 281 | - echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
| 282 | - } |
|
| 283 | - ?> |
|
| 280 | + if ( is_wp_error( $downloads_data ) ) { |
|
| 281 | + echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
| 282 | + } |
|
| 283 | + ?> |
|
| 284 | 284 | </div> |
| 285 | 285 | </div> |
| 286 | 286 | <?php |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | protected function render_download( $download, $wp_plugins ) { |
| 337 | 337 | |
| 338 | 338 | |
| 339 | - $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
| 339 | + $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
| 340 | 340 | |
| 341 | - $download_info = $details['download_info']; |
|
| 341 | + $download_info = $details['download_info']; |
|
| 342 | 342 | |
| 343 | 343 | ?> |
| 344 | 344 | <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
@@ -360,43 +360,43 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | <div class="addon-excerpt"><?php |
| 362 | 362 | |
| 363 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
| 363 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
| 364 | 364 | |
| 365 | - // Allow some pure HTML tags, but remove everything else from the excerpt. |
|
| 366 | - $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
|
| 367 | - $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' ); |
|
| 365 | + // Allow some pure HTML tags, but remove everything else from the excerpt. |
|
| 366 | + $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
|
| 367 | + $replacements = array( '[b]', '[/b]', '[i]', '[/i]', '[code]', '[/code]' ); |
|
| 368 | 368 | |
| 369 | - $excerpt = str_replace( $tags, $replacements, $excerpt ); |
|
| 370 | - $excerpt = esc_html( strip_tags( $excerpt ) ); |
|
| 369 | + $excerpt = str_replace( $tags, $replacements, $excerpt ); |
|
| 370 | + $excerpt = esc_html( strip_tags( $excerpt ) ); |
|
| 371 | 371 | $excerpt = str_replace( $replacements, $tags, $excerpt ); |
| 372 | 372 | |
| 373 | 373 | echo wpautop( $excerpt ); |
| 374 | - ?></div> |
|
| 374 | + ?></div> |
|
| 375 | 375 | </div> |
| 376 | 376 | </div> |
| 377 | 377 | <?php |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
| 381 | - * Generates details array for the download to keep the render_download() method a bit tidier |
|
| 382 | - * |
|
| 381 | + * Generates details array for the download to keep the render_download() method a bit tidier |
|
| 382 | + * |
|
| 383 | 383 | * @param array $download Single download, as returned by {@see get_downloads_data} |
| 384 | 384 | * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()} |
| 385 | 385 | * |
| 386 | 386 | * @return array { |
| 387 | - * @type array $download_info |
|
| 388 | - * @type string $plugin_path |
|
| 389 | - * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
| 390 | - * @type string $status_label |
|
| 391 | - * @type string $button_title Title attribute to show when hovering over the download's button |
|
| 392 | - * @type string $button_class CSS class to use for the button |
|
| 393 | - * @type string $button_label Text to use for the download's anchor link |
|
| 394 | - * @type string $href URL for the download's button |
|
| 395 | - * @type bool $spinner Whether to show the spinner icon |
|
| 396 | - * @type string $item_class CSS class for the download container |
|
| 397 | - * @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions") |
|
| 398 | - * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
| 399 | - * } |
|
| 387 | + * @type array $download_info |
|
| 388 | + * @type string $plugin_path |
|
| 389 | + * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
| 390 | + * @type string $status_label |
|
| 391 | + * @type string $button_title Title attribute to show when hovering over the download's button |
|
| 392 | + * @type string $button_class CSS class to use for the button |
|
| 393 | + * @type string $button_label Text to use for the download's anchor link |
|
| 394 | + * @type string $href URL for the download's button |
|
| 395 | + * @type bool $spinner Whether to show the spinner icon |
|
| 396 | + * @type string $item_class CSS class for the download container |
|
| 397 | + * @type string $required_license The name of the required license for the download ("All Access" or "Core + Extensions") |
|
| 398 | + * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
| 399 | + * } |
|
| 400 | 400 | */ |
| 401 | 401 | private function get_download_display_details( $download, $wp_plugins ) { |
| 402 | 402 | |
@@ -487,18 +487,18 @@ discard block |
||
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
| 490 | - } |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | 492 | /** |
| 493 | - * Returns the base price for an extension |
|
| 494 | - * |
|
| 493 | + * Returns the base price for an extension |
|
| 494 | + * |
|
| 495 | 495 | * @param array $download |
| 496 | 496 | * |
| 497 | 497 | * @return float Base price for an extension. If not for sale separately, returns 0 |
| 498 | 498 | */ |
| 499 | 499 | private function get_download_base_price( $download ) { |
| 500 | 500 | |
| 501 | - $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
| 501 | + $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
| 502 | 502 | $base_price = \GFCommon::to_number( $base_price ); |
| 503 | 503 | |
| 504 | 504 | unset( $download['pricing']['amount'] ); |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | return floatval( $base_price ); |
| 512 | - } |
|
| 512 | + } |
|
| 513 | 513 | |
| 514 | 514 | /** |
| 515 | 515 | * Handle AJAX request to activate extension |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
| 529 | 529 | wp_send_json_error( array( |
| 530 | - 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
|
| 531 | - ) ); |
|
| 530 | + 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
|
| 531 | + ) ); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | wp_send_json_success(); |
@@ -549,10 +549,10 @@ discard block |
||
| 549 | 549 | deactivate_plugins( $data['path'] ); |
| 550 | 550 | |
| 551 | 551 | if( is_plugin_active( $data['path'] ) ) { |
| 552 | - wp_send_json_error( array( |
|
| 553 | - 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
|
| 554 | - ) ); |
|
| 555 | - } |
|
| 552 | + wp_send_json_error( array( |
|
| 553 | + 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
|
| 554 | + ) ); |
|
| 555 | + } |
|
| 556 | 556 | |
| 557 | 557 | wp_send_json_success(); |
| 558 | 558 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function register_noconflict( $items ) { |
| 55 | 55 | |
| 56 | - $items[] = 'gravityview-admin-installer'; |
|
| 56 | + $items[ ] = 'gravityview-admin-installer'; |
|
| 57 | 57 | |
| 58 | 58 | return $items; |
| 59 | 59 | } |
@@ -70,17 +70,17 @@ discard block |
||
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) { |
|
| 73 | + add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) { |
|
| 74 | 74 | foreach ( $downloads_data as $extension ) { |
| 75 | - if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) { |
|
| 75 | + if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) { |
|
| 76 | 76 | continue; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - return (object) array( |
|
| 80 | - 'slug' => $extension['info']['slug'], |
|
| 81 | - 'name' => $extension['info']['title'], |
|
| 82 | - 'version' => $extension['licensing']['version'], |
|
| 83 | - 'download_link' => $extension['files'][0]['file'], |
|
| 79 | + return (object)array( |
|
| 80 | + 'slug' => $extension[ 'info' ][ 'slug' ], |
|
| 81 | + 'name' => $extension[ 'info' ][ 'title' ], |
|
| 82 | + 'version' => $extension[ 'licensing' ][ 'version' ], |
|
| 83 | + 'download_link' => $extension[ 'files' ][ 0 ][ 'file' ], |
|
| 84 | 84 | ); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | foreach ( $all_plugins as $path => $plugin ) { |
| 144 | 144 | |
| 145 | - if ( empty( $plugin['TextDomain'] ) ) { |
|
| 145 | + if ( empty( $plugin[ 'TextDomain' ] ) ) { |
|
| 146 | 146 | continue; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $wp_plugins[ $plugin['TextDomain'] ] = array( |
|
| 149 | + $wp_plugins[ $plugin[ 'TextDomain' ] ] = array( |
|
| 150 | 150 | 'path' => $path, |
| 151 | - 'version' => $plugin['Version'], |
|
| 151 | + 'version' => $plugin[ 'Version' ], |
|
| 152 | 152 | 'activated' => is_plugin_active( $path ) |
| 153 | 153 | ); |
| 154 | 154 | } |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $downloads_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
| 232 | 232 | |
| 233 | - if ( empty( $downloads_data['products'] ) ) { |
|
| 233 | + if ( empty( $downloads_data[ 'products' ] ) ) { |
|
| 234 | 234 | return array(); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - $this->set_downloads_data( $downloads_data['products'] ); |
|
| 237 | + $this->set_downloads_data( $downloads_data[ 'products' ] ); |
|
| 238 | 238 | |
| 239 | - return $downloads_data['products']; |
|
| 239 | + return $downloads_data[ 'products' ]; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | foreach ( $downloads_data as $extension ) { |
| 311 | 311 | |
| 312 | - if ( empty( $extension['info'] ) ) { |
|
| 312 | + if ( empty( $extension[ 'info' ] ) ) { |
|
| 313 | 313 | continue; |
| 314 | 314 | } |
| 315 | 315 | |
@@ -338,29 +338,29 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | $details = $this->get_download_display_details( $download, $wp_plugins ); |
| 340 | 340 | |
| 341 | - $download_info = $details['download_info']; |
|
| 341 | + $download_info = $details[ 'download_info' ]; |
|
| 342 | 342 | |
| 343 | 343 | ?> |
| 344 | - <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
|
| 344 | + <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>"> |
|
| 345 | 345 | <div class="addon-inner"> |
| 346 | - <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a> |
|
| 347 | - <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3> |
|
| 346 | + <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a> |
|
| 347 | + <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3> |
|
| 348 | 348 | <div> |
| 349 | - <?php if( $details['status_label'] ) { ?> |
|
| 350 | - <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>"> |
|
| 351 | - <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span> |
|
| 349 | + <?php if ( $details[ 'status_label' ] ) { ?> |
|
| 350 | + <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>"> |
|
| 351 | + <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span> |
|
| 352 | 352 | </div> |
| 353 | 353 | <?php } ?> |
| 354 | 354 | |
| 355 | - <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>"> |
|
| 356 | - <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span> |
|
| 357 | - <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?> |
|
| 355 | + <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>"> |
|
| 356 | + <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span> |
|
| 357 | + <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?> |
|
| 358 | 358 | </a> |
| 359 | 359 | </div> |
| 360 | 360 | |
| 361 | 361 | <div class="addon-excerpt"><?php |
| 362 | 362 | |
| 363 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
| 363 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] ); |
|
| 364 | 364 | |
| 365 | 365 | // Allow some pure HTML tags, but remove everything else from the excerpt. |
| 366 | 366 | $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | private function get_download_display_details( $download, $wp_plugins ) { |
| 402 | 402 | |
| 403 | - $download_info = wp_parse_args( (array) $download['info'], array( |
|
| 403 | + $download_info = wp_parse_args( (array)$download[ 'info' ], array( |
|
| 404 | 404 | 'thumbnail' => '', |
| 405 | 405 | 'title' => '', |
| 406 | 406 | 'textdomain' => '', |
@@ -411,9 +411,9 @@ discard block |
||
| 411 | 411 | 'installer_excerpt' => null, // May not be defined |
| 412 | 412 | ) ); |
| 413 | 413 | |
| 414 | - $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false ); |
|
| 414 | + $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false ); |
|
| 415 | 415 | |
| 416 | - $has_access = ! empty( $download['files'] ); |
|
| 416 | + $has_access = ! empty( $download[ 'files' ] ); |
|
| 417 | 417 | $spinner = true; |
| 418 | 418 | $href = $plugin_path = '#'; |
| 419 | 419 | $status = $item_class = $button_title = $button_class = ''; |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' ); |
| 424 | 424 | |
| 425 | 425 | // The license is not active - no matter what level, this should not work |
| 426 | - if( ! $is_active && empty( $base_price ) ) { |
|
| 426 | + if ( ! $is_active && empty( $base_price ) ) { |
|
| 427 | 427 | $spinner = false; |
| 428 | 428 | $button_class = 'disabled disabled-license'; |
| 429 | 429 | $button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license ); |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $status_label = ''; |
| 436 | 436 | $button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price ); |
| 437 | 437 | $button_class = 'button-primary button-large'; |
| 438 | - $href = $download_info['link']; |
|
| 438 | + $href = $download_info[ 'link' ]; |
|
| 439 | 439 | $item_class = 'featured'; |
| 440 | 440 | } |
| 441 | 441 | |
@@ -454,8 +454,8 @@ discard block |
||
| 454 | 454 | $href = add_query_arg( |
| 455 | 455 | array( |
| 456 | 456 | 'action' => 'install-plugin', |
| 457 | - 'plugin' => $download_info['slug'], |
|
| 458 | - '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ), |
|
| 457 | + 'plugin' => $download_info[ 'slug' ], |
|
| 458 | + '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ), |
|
| 459 | 459 | ), |
| 460 | 460 | self_admin_url( 'update.php' ) |
| 461 | 461 | ); |
@@ -467,26 +467,26 @@ discard block |
||
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | // Access and the plugin is installed but not active |
| 470 | - else if ( false === $wp_plugin['activated'] ) { |
|
| 470 | + else if ( false === $wp_plugin[ 'activated' ] ) { |
|
| 471 | 471 | |
| 472 | 472 | $status = 'inactive'; |
| 473 | 473 | $status_label = __( 'Inactive', 'gravityview' ); |
| 474 | 474 | $button_label = __( 'Activate', 'gravityview' ); |
| 475 | - $plugin_path = $wp_plugin['path']; |
|
| 475 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 476 | 476 | |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | // Access and the plugin is installed and active |
| 480 | 480 | else { |
| 481 | 481 | |
| 482 | - $plugin_path = $wp_plugin['path']; |
|
| 482 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 483 | 483 | $status = 'active'; |
| 484 | 484 | $status_label = __( 'Active', 'gravityview' ); |
| 485 | 485 | $button_label = __( 'Deactivate', 'gravityview' ); |
| 486 | 486 | |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | - return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 489 | + return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | /** |
@@ -501,11 +501,11 @@ discard block |
||
| 501 | 501 | $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
| 502 | 502 | $base_price = \GFCommon::to_number( $base_price ); |
| 503 | 503 | |
| 504 | - unset( $download['pricing']['amount'] ); |
|
| 504 | + unset( $download[ 'pricing' ][ 'amount' ] ); |
|
| 505 | 505 | |
| 506 | 506 | // Price options array, not single price |
| 507 | - if ( ! $base_price && ! empty( $download['pricing'] ) ) { |
|
| 508 | - $base_price = array_shift( $download['pricing'] ); |
|
| 507 | + if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) { |
|
| 508 | + $base_price = array_shift( $download[ 'pricing' ] ); |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | return floatval( $base_price ); |
@@ -519,13 +519,13 @@ discard block |
||
| 519 | 519 | public function activate_download() { |
| 520 | 520 | $data = \GV\Utils::_POST( 'data', array() ); |
| 521 | 521 | |
| 522 | - if ( empty( $data['path'] ) ) { |
|
| 522 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 523 | 523 | return; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - $result = activate_plugin( $data['path'] ); |
|
| 526 | + $result = activate_plugin( $data[ 'path' ] ); |
|
| 527 | 527 | |
| 528 | - if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
|
| 528 | + if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) { |
|
| 529 | 529 | wp_send_json_error( array( |
| 530 | 530 | 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
| 531 | 531 | ) ); |
@@ -542,13 +542,13 @@ discard block |
||
| 542 | 542 | public function deactivate_download() { |
| 543 | 543 | $data = \GV\Utils::_POST( 'data', array() ); |
| 544 | 544 | |
| 545 | - if ( empty( $data['path'] ) ) { |
|
| 545 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 546 | 546 | return; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - deactivate_plugins( $data['path'] ); |
|
| 549 | + deactivate_plugins( $data[ 'path' ] ); |
|
| 550 | 550 | |
| 551 | - if( is_plugin_active( $data['path'] ) ) { |
|
| 551 | + if ( is_plugin_active( $data[ 'path' ] ) ) { |
|
| 552 | 552 | wp_send_json_error( array( |
| 553 | 553 | 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
| 554 | 554 | ) ); |
@@ -32,19 +32,19 @@ discard block |
||
| 32 | 32 | // If there's an overriding CSS file in the current template folder, use it. |
| 33 | 33 | $template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file; |
| 34 | 34 | |
| 35 | - if( file_exists( $template_css_path ) ) { |
|
| 35 | + if ( file_exists( $template_css_path ) ) { |
|
| 36 | 36 | $path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file; |
| 37 | 37 | gravityview()->log->debug( 'Stylesheet override ({css_file})', array( 'css_file' => esc_attr( $css_file ) ) ); |
| 38 | 38 | } else { |
| 39 | 39 | // Default: use GravityView CSS file |
| 40 | 40 | |
| 41 | 41 | // If no path is provided, assume default plugin templates CSS folder |
| 42 | - if( '' === $dir_path ) { |
|
| 42 | + if ( '' === $dir_path ) { |
|
| 43 | 43 | $dir_path = GRAVITYVIEW_DIR . 'templates/css/'; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // plugins_url() expects a path to a file, not directory. We append a file to be stripped. |
| 47 | - $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
| 47 | + $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return $path; |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
| 84 | 84 | |
| 85 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
| 85 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
| 86 | 86 | |
| 87 | - if( empty( $permalink_args ) ) { |
|
| 87 | + if ( empty( $permalink_args ) ) { |
|
| 88 | 88 | return array(); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -109,15 +109,15 @@ discard block |
||
| 109 | 109 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
| 110 | 110 | |
| 111 | 111 | $output = ''; |
| 112 | - if( is_array( $current ) ) { |
|
| 113 | - if( in_array( $value, $current ) ) { |
|
| 112 | + if ( is_array( $current ) ) { |
|
| 113 | + if ( in_array( $value, $current ) ) { |
|
| 114 | 114 | $output = __checked_selected_helper( true, true, false, $type ); |
| 115 | 115 | } |
| 116 | 116 | } else { |
| 117 | 117 | $output = __checked_selected_helper( $value, $current, false, $type ); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if( $echo ) { |
|
| 120 | + if ( $echo ) { |
|
| 121 | 121 | echo $output; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
| 128 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
| 128 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | function gravityview_strip_whitespace( $string ) { |
| 173 | 173 | $string = normalize_whitespace( $string ); |
| 174 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
| 174 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @return string Included file contents |
| 186 | 186 | */ |
| 187 | 187 | function gravityview_ob_include( $file_path, $object = NULL ) { |
| 188 | - if( ! file_exists( $file_path ) ) { |
|
| 188 | + if ( ! file_exists( $file_path ) ) { |
|
| 189 | 189 | gravityview()->log->error( 'File path does not exist. {path}', array( 'path' => $file_path ) ); |
| 190 | 190 | return ''; |
| 191 | 191 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | $width = $height * 0.7586206897; |
| 211 | 211 | |
| 212 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
| 212 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
| 213 | 213 | $style = 'margin:10px 10px 10px 0;'; |
| 214 | 214 | $css_class = is_string( $css_class ) ? $css_class : 'alignright'; |
| 215 | 215 | } else { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $css_class = is_string( $css_class ) ? $css_class : 'alignleft'; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - return '<img src="'. esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) .'" class="'. gravityview_sanitize_html_class( $css_class ).'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
| 220 | + return '<img src="' . esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) . '" class="' . gravityview_sanitize_html_class( $css_class ) . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | function gravityview_number_format( $number, $decimals = '' ) { |
| 241 | 241 | global $wp_locale; |
| 242 | 242 | |
| 243 | - if( '' === $decimals ) { |
|
| 243 | + if ( '' === $decimals ) { |
|
| 244 | 244 | |
| 245 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
| 245 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | 248 | * Calculate the position of the decimal point in the number |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $parts = parse_url( $value ); |
| 272 | 272 | |
| 273 | 273 | // No domain? Strange...show the original text. |
| 274 | - if( empty( $parts['host'] ) ) { |
|
| 274 | + if ( empty( $parts[ 'host' ] ) ) { |
|
| 275 | 275 | return $value; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -284,16 +284,16 @@ discard block |
||
| 284 | 284 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
| 285 | 285 | * If true: `http://example.com => example.com` |
| 286 | 286 | */ |
| 287 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
| 287 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
| 288 | 288 | |
| 289 | - if( isset( $parts['scheme'] ) ) { |
|
| 290 | - $return .= $parts['scheme']; |
|
| 289 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
| 290 | + $return .= $parts[ 'scheme' ]; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | // The domain, which may contain a subdomain |
| 296 | - $domain = $parts['host']; |
|
| 296 | + $domain = $parts[ 'host' ]; |
|
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | 299 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -301,10 +301,10 @@ discard block |
||
| 301 | 301 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
| 302 | 302 | * If true: `www.example.com => example.com` |
| 303 | 303 | */ |
| 304 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
| 304 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
| 305 | 305 | |
| 306 | - if( $strip_www ) { |
|
| 307 | - $domain = str_replace('www.', '', $domain ); |
|
| 306 | + if ( $strip_www ) { |
|
| 307 | + $domain = str_replace( 'www.', '', $domain ); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -314,11 +314,11 @@ discard block |
||
| 314 | 314 | * If true: `http://demo.example.com => example.com` \n |
| 315 | 315 | * If false: `http://demo.example.com => demo.example.com` |
| 316 | 316 | */ |
| 317 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
| 317 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
| 318 | 318 | |
| 319 | - if( $strip_subdomains ) { |
|
| 319 | + if ( $strip_subdomains ) { |
|
| 320 | 320 | |
| 321 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
| 321 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
| 322 | 322 | |
| 323 | 323 | } |
| 324 | 324 | |
@@ -332,12 +332,12 @@ discard block |
||
| 332 | 332 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
| 333 | 333 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
| 334 | 334 | */ |
| 335 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
| 335 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
| 336 | 336 | |
| 337 | - if( empty( $root_only ) ) { |
|
| 337 | + if ( empty( $root_only ) ) { |
|
| 338 | 338 | |
| 339 | - if( isset( $parts['path'] ) ) { |
|
| 340 | - $return .= $parts['path']; |
|
| 339 | + if ( isset( $parts[ 'path' ] ) ) { |
|
| 340 | + $return .= $parts[ 'path' ]; |
|
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
@@ -347,12 +347,12 @@ discard block |
||
| 347 | 347 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
| 348 | 348 | * If true: `http://example.com/?query=example => example.com` |
| 349 | 349 | */ |
| 350 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
| 350 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
| 351 | 351 | |
| 352 | - if( empty( $strip_query_string ) ) { |
|
| 352 | + if ( empty( $strip_query_string ) ) { |
|
| 353 | 353 | |
| 354 | - if( isset( $parts['query'] ) ) { |
|
| 355 | - $return .= '?'.$parts['query']; |
|
| 354 | + if ( isset( $parts[ 'query' ] ) ) { |
|
| 355 | + $return .= '?' . $parts[ 'query' ]; |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | } |
@@ -369,8 +369,8 @@ discard block |
||
| 369 | 369 | */ |
| 370 | 370 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
| 371 | 371 | |
| 372 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
| 373 | - return $matches['domain']; |
|
| 372 | + if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
| 373 | + return $matches[ 'domain' ]; |
|
| 374 | 374 | } else { |
| 375 | 375 | return $string_maybe_has_subdomain; |
| 376 | 376 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
| 441 | 441 | $value = true; |
| 442 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 442 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 443 | 443 | $value = false; |
| 444 | 444 | } |
| 445 | 445 | } |
@@ -468,19 +468,19 @@ discard block |
||
| 468 | 468 | */ |
| 469 | 469 | function gv_maybe_json_decode( $value, $assoc = false, $depth = 512, $options = 0 ) { |
| 470 | 470 | |
| 471 | - if( ! is_string( $value ) ) { |
|
| 471 | + if ( ! is_string( $value ) ) { |
|
| 472 | 472 | return $value; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | $decoded = json_decode( $value ); |
| 476 | 476 | |
| 477 | 477 | // There was a JSON error (PHP 5.3+) |
| 478 | - if( function_exists('json_last_error') && JSON_ERROR_NONE !== json_last_error() ) { |
|
| 478 | + if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) { |
|
| 479 | 479 | return $value; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | // It wasn't JSON (PHP < 5.3 fallback) |
| 483 | - if( is_null( $decoded ) ) { |
|
| 483 | + if ( is_null( $decoded ) ) { |
|
| 484 | 484 | return $value; |
| 485 | 485 | } |
| 486 | 486 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | // Use the original function, if exists. |
| 505 | 505 | // Requires WP 4.4+ |
| 506 | - if( function_exists( 'map_deep') ) { |
|
| 506 | + if ( function_exists( 'map_deep' ) ) { |
|
| 507 | 507 | return map_deep( $value, $callback ); |
| 508 | 508 | } |
| 509 | 509 | |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | $exploded = explode( '.', "{$field_id}" ); |
| 570 | 570 | |
| 571 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
| 571 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /** |
@@ -609,13 +609,13 @@ discard block |
||
| 609 | 609 | */ |
| 610 | 610 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
| 611 | 611 | |
| 612 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
| 612 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
| 613 | 613 | |
| 614 | 614 | $choices = array(); |
| 615 | 615 | |
| 616 | 616 | if ( is_array( $terms ) ) { |
| 617 | 617 | foreach ( $terms as $term_id => $term_name ) { |
| 618 | - $choices[] = array( |
|
| 618 | + $choices[ ] = array( |
|
| 619 | 619 | 'text' => $term_name, |
| 620 | 620 | 'value' => $term_id |
| 621 | 621 | ); |
@@ -639,21 +639,21 @@ discard block |
||
| 639 | 639 | function _gravityview_process_posted_fields() { |
| 640 | 640 | $fields = array(); |
| 641 | 641 | |
| 642 | - if( !empty( $_POST['gv_fields'] ) ) { |
|
| 643 | - if ( ! is_array( $_POST['gv_fields'] ) ) { |
|
| 642 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 643 | + if ( ! is_array( $_POST[ 'gv_fields' ] ) ) { |
|
| 644 | 644 | |
| 645 | 645 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
| 646 | 646 | $fields_holder = array(); |
| 647 | - GVCommon::gv_parse_str( $_POST['gv_fields'], $fields_holder ); |
|
| 647 | + GVCommon::gv_parse_str( $_POST[ 'gv_fields' ], $fields_holder ); |
|
| 648 | 648 | |
| 649 | - if ( isset( $fields_holder['fields'] ) ) { |
|
| 650 | - $fields = $fields_holder['fields']; |
|
| 649 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
| 650 | + $fields = $fields_holder[ 'fields' ]; |
|
| 651 | 651 | } else { |
| 652 | 652 | gravityview()->log->error( 'No `fields` key was found after parsing $fields string', array( 'data' => $fields_holder ) ); |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | } else { |
| 656 | - $fields = $_POST['gv_fields']; |
|
| 656 | + $fields = $_POST[ 'gv_fields' ]; |
|
| 657 | 657 | } |
| 658 | 658 | } |
| 659 | 659 | |