@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @deprecated |
| 115 | 115 | * @see The `gravityview/view_collection/from_post/meta_keys` filter. |
| 116 | 116 | */ |
| 117 | - $meta_keys = (array) apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' ); |
|
| 117 | + $meta_keys = (array)apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' ); |
|
| 118 | 118 | |
| 119 | 119 | /** What about inside post meta values? */ |
| 120 | 120 | foreach ( $meta_keys as $meta_key ) { |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | /** Let's find us some [gravityview] shortcodes perhaps. */ |
| 170 | 170 | foreach ( Shortcode::parse( $content ) as $shortcode ) { |
| 171 | - if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) { |
|
| 171 | + if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) { |
|
| 172 | 172 | continue; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
| 176 | - $view = View::by_id( $shortcode->atts['id'] ); |
|
| 175 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
| 176 | + $view = View::by_id( $shortcode->atts[ 'id' ] ); |
|
| 177 | 177 | if ( ! $view ) { |
| 178 | 178 | continue; |
| 179 | 179 | } |
@@ -60,21 +60,21 @@ discard block |
||
| 60 | 60 | public function dismiss_notice() { |
| 61 | 61 | |
| 62 | 62 | // No dismiss sent |
| 63 | - if( empty( $_GET['gv-dismiss'] ) || empty( $_GET['notice'] ) ) { |
|
| 63 | + if ( empty( $_GET[ 'gv-dismiss' ] ) || empty( $_GET[ 'notice' ] ) ) { |
|
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Invalid nonce |
| 68 | - if( !wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) { |
|
| 68 | + if ( ! wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $notice_id = esc_attr( $_GET['notice'] ); |
|
| 72 | + $notice_id = esc_attr( $_GET[ 'notice' ] ); |
|
| 73 | 73 | |
| 74 | 74 | //don't display a message if use has dismissed the message for this version |
| 75 | 75 | $dismissed_notices = (array)get_transient( 'gravityview_dismissed_notices' ); |
| 76 | 76 | |
| 77 | - $dismissed_notices[] = $notice_id; |
|
| 77 | + $dismissed_notices[ ] = $notice_id; |
|
| 78 | 78 | |
| 79 | 79 | $dismissed_notices = array_unique( $dismissed_notices ); |
| 80 | 80 | |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | private function is_notice_dismissed( $notice ) { |
| 98 | 98 | |
| 99 | 99 | // There are no dismissed notices. |
| 100 | - if( empty( self::$dismissed_notices ) ) { |
|
| 100 | + if ( empty( self::$dismissed_notices ) ) { |
|
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // Has the |
| 105 | - $is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices ); |
|
| 105 | + $is_dismissed = ! empty( $notice[ 'dismiss' ] ) && in_array( $notice[ 'dismiss' ], self::$dismissed_notices ); |
|
| 106 | 106 | |
| 107 | 107 | return $is_dismissed ? true : false; |
| 108 | 108 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | private function check_show_multisite_notices() { |
| 129 | 129 | |
| 130 | - if( ! is_multisite() ) { |
|
| 130 | + if ( ! is_multisite() ) { |
|
| 131 | 131 | return true; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // or they don't have admin capabilities |
| 140 | - if( ! is_super_admin() ) { |
|
| 140 | + if ( ! is_super_admin() ) { |
|
| 141 | 141 | return false; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -160,48 +160,48 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | $notices = apply_filters( 'gravityview/admin/notices', self::$admin_notices ); |
| 162 | 162 | |
| 163 | - if( empty( $notices ) || ! $this->check_show_multisite_notices() ) { |
|
| 163 | + if ( empty( $notices ) || ! $this->check_show_multisite_notices() ) { |
|
| 164 | 164 | return; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | //don't display a message if use has dismissed the message for this version |
| 168 | 168 | // TODO: Use get_user_meta instead of get_transient |
| 169 | - self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' ); |
|
| 169 | + self::$dismissed_notices = isset( $_GET[ 'show-dismissed-notices' ] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' ); |
|
| 170 | 170 | |
| 171 | 171 | $output = ''; |
| 172 | 172 | |
| 173 | - foreach( $notices as $notice ) { |
|
| 173 | + foreach ( $notices as $notice ) { |
|
| 174 | 174 | |
| 175 | 175 | // If the user doesn't have the capability to see the warning |
| 176 | - if( isset( $notice['cap'] ) && false === GVCommon::has_cap( $notice['cap'] ) ) { |
|
| 176 | + if ( isset( $notice[ 'cap' ] ) && false === GVCommon::has_cap( $notice[ 'cap' ] ) ) { |
|
| 177 | 177 | gravityview()->log->debug( 'Notice not shown because user does not have the capability to view it.', array( 'data' => $notice ) ); |
| 178 | 178 | continue; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if( true === $this->is_notice_dismissed( $notice ) ) { |
|
| 181 | + if ( true === $this->is_notice_dismissed( $notice ) ) { |
|
| 182 | 182 | gravityview()->log->debug( 'Notice not shown because the notice has already been dismissed.', array( 'data' => $notice ) ); |
| 183 | 183 | continue; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $output .= '<div id="message" style="position:relative" class="notice '. gravityview_sanitize_html_class( $notice['class'] ).'">'; |
|
| 186 | + $output .= '<div id="message" style="position:relative" class="notice ' . gravityview_sanitize_html_class( $notice[ 'class' ] ) . '">'; |
|
| 187 | 187 | |
| 188 | 188 | // Too cute to leave out. |
| 189 | 189 | $output .= gravityview_get_floaty(); |
| 190 | 190 | |
| 191 | - if( !empty( $notice['title'] ) ) { |
|
| 192 | - $output .= '<h3>'.esc_html( $notice['title'] ) .'</h3>'; |
|
| 191 | + if ( ! empty( $notice[ 'title' ] ) ) { |
|
| 192 | + $output .= '<h3>' . esc_html( $notice[ 'title' ] ) . '</h3>'; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $message = isset( $notice['message'] ) ? $notice['message'] : ''; |
|
| 195 | + $message = isset( $notice[ 'message' ] ) ? $notice[ 'message' ] : ''; |
|
| 196 | 196 | |
| 197 | - if( !empty( $notice['dismiss'] ) ) { |
|
| 197 | + if ( ! empty( $notice[ 'dismiss' ] ) ) { |
|
| 198 | 198 | |
| 199 | - $dismiss = esc_attr($notice['dismiss']); |
|
| 199 | + $dismiss = esc_attr( $notice[ 'dismiss' ] ); |
|
| 200 | 200 | |
| 201 | 201 | $url = esc_url( add_query_arg( array( 'gv-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) ); |
| 202 | 202 | |
| 203 | 203 | $align = is_rtl() ? 'alignleft' : 'alignright'; |
| 204 | - $message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="' . $align . ' button button-link">'.esc_html__('Dismiss', 'gravityview' ).'</a></p>'; |
|
| 204 | + $message .= '<a href="' . $url . '" data-notice="' . $dismiss . '" class="' . $align . ' button button-link">' . esc_html__( 'Dismiss', 'gravityview' ) . '</a></p>'; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | $output .= wpautop( $message ); |
@@ -233,14 +233,14 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public static function add_notice( $notice = array() ) { |
| 235 | 235 | |
| 236 | - if( !isset( $notice['message'] ) ) { |
|
| 236 | + if ( ! isset( $notice[ 'message' ] ) ) { |
|
| 237 | 237 | gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) ); |
| 238 | 238 | return; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
| 241 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
| 242 | 242 | |
| 243 | - self::$admin_notices[] = $notice; |
|
| 243 | + self::$admin_notices[ ] = $notice; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -64,6 +64,9 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | + /** |
|
| 68 | + * @param string $component |
|
| 69 | + */ |
|
| 67 | 70 | private function load_components( $component ) { |
| 68 | 71 | |
| 69 | 72 | $dir = trailingslashit( self::$file ); |
@@ -104,7 +107,7 @@ discard block |
||
| 104 | 107 | * |
| 105 | 108 | * @param array $args Existing reserved args |
| 106 | 109 | * |
| 107 | - * @return array |
|
| 110 | + * @return string[] |
|
| 108 | 111 | */ |
| 109 | 112 | public function add_reserved_arg( $args ) { |
| 110 | 113 | |
@@ -200,7 +203,7 @@ discard block |
||
| 200 | 203 | * "You can edit this post from the post page" fields, for example. |
| 201 | 204 | * |
| 202 | 205 | * @param $entry array Gravity Forms entry object |
| 203 | - * @param $view_id int GravityView view id |
|
| 206 | + * @param integer $view_id int GravityView view id |
|
| 204 | 207 | * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
| 205 | 208 | * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
| 206 | 209 | * @return string |
@@ -303,7 +306,7 @@ discard block |
||
| 303 | 306 | * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
| 304 | 307 | * |
| 305 | 308 | * @param array $entry Gravity Forms entry array |
| 306 | - * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0 |
|
| 309 | + * @param integer $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0 |
|
| 307 | 310 | * @return bool |
| 308 | 311 | */ |
| 309 | 312 | public static function check_user_cap_edit_entry( $entry, $view = 0 ) { |
@@ -18,84 +18,84 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | class GravityView_Edit_Entry { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 21 | + /** |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | 24 | static $file; |
| 25 | 25 | |
| 26 | 26 | static $instance; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Component instances. |
|
| 30 | - * @var array |
|
| 31 | - */ |
|
| 32 | - public $instances = array(); |
|
| 28 | + /** |
|
| 29 | + * Component instances. |
|
| 30 | + * @var array |
|
| 31 | + */ |
|
| 32 | + public $instances = array(); |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | function __construct() { |
| 36 | 36 | |
| 37 | - self::$file = plugin_dir_path( __FILE__ ); |
|
| 37 | + self::$file = plugin_dir_path( __FILE__ ); |
|
| 38 | 38 | |
| 39 | - if( is_admin() ) { |
|
| 40 | - $this->load_components( 'admin' ); |
|
| 41 | - } |
|
| 39 | + if( is_admin() ) { |
|
| 40 | + $this->load_components( 'admin' ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | $this->load_components( 'locking' ); |
| 44 | 44 | |
| 45 | - $this->load_components( 'render' ); |
|
| 45 | + $this->load_components( 'render' ); |
|
| 46 | 46 | |
| 47 | - // If GF User Registration Add-on exists |
|
| 48 | - $this->load_components( 'user-registration' ); |
|
| 47 | + // If GF User Registration Add-on exists |
|
| 48 | + $this->load_components( 'user-registration' ); |
|
| 49 | 49 | |
| 50 | - $this->add_hooks(); |
|
| 50 | + $this->add_hooks(); |
|
| 51 | 51 | |
| 52 | 52 | // Process hooks for addons that may or may not be present |
| 53 | 53 | $this->addon_specific_hooks(); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | - static function getInstance() { |
|
| 57 | + static function getInstance() { |
|
| 58 | 58 | |
| 59 | - if( empty( self::$instance ) ) { |
|
| 60 | - self::$instance = new GravityView_Edit_Entry; |
|
| 61 | - } |
|
| 59 | + if( empty( self::$instance ) ) { |
|
| 60 | + self::$instance = new GravityView_Edit_Entry; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return self::$instance; |
|
| 64 | - } |
|
| 63 | + return self::$instance; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | - private function load_components( $component ) { |
|
| 67 | + private function load_components( $component ) { |
|
| 68 | 68 | |
| 69 | - $dir = trailingslashit( self::$file ); |
|
| 69 | + $dir = trailingslashit( self::$file ); |
|
| 70 | 70 | |
| 71 | - $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
| 72 | - $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
| 71 | + $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
| 72 | + $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
| 73 | 73 | |
| 74 | - // Loads component and pass extension's instance so that component can |
|
| 75 | - // talk each other. |
|
| 76 | - require_once $filename; |
|
| 77 | - $this->instances[ $component ] = new $classname( $this ); |
|
| 78 | - $this->instances[ $component ]->load(); |
|
| 74 | + // Loads component and pass extension's instance so that component can |
|
| 75 | + // talk each other. |
|
| 76 | + require_once $filename; |
|
| 77 | + $this->instances[ $component ] = new $classname( $this ); |
|
| 78 | + $this->instances[ $component ]->load(); |
|
| 79 | 79 | |
| 80 | - } |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - private function add_hooks() { |
|
| 82 | + private function add_hooks() { |
|
| 83 | 83 | |
| 84 | - // Add front-end access to Gravity Forms delete file action |
|
| 85 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 84 | + // Add front-end access to Gravity Forms delete file action |
|
| 85 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 86 | 86 | |
| 87 | - // Make sure this hook is run for non-admins |
|
| 88 | - add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 87 | + // Make sure this hook is run for non-admins |
|
| 88 | + add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 89 | 89 | |
| 90 | - add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
|
| 90 | + add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
|
| 91 | 91 | |
| 92 | - // add template path to check for field |
|
| 93 | - add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
| 92 | + // add template path to check for field |
|
| 93 | + add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
| 94 | 94 | |
| 95 | 95 | add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 ); |
| 96 | 96 | |
| 97 | 97 | add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) ); |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Adds "edit" to the list of internal reserved query args |
@@ -166,74 +166,74 @@ discard block |
||
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * Include this extension templates path |
|
| 171 | - * @param array $file_paths List of template paths ordered |
|
| 172 | - */ |
|
| 173 | - public function add_template_path( $file_paths ) { |
|
| 174 | - |
|
| 175 | - // Index 100 is the default GravityView template path. |
|
| 176 | - $file_paths[ 110 ] = self::$file; |
|
| 177 | - |
|
| 178 | - return $file_paths; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * |
|
| 183 | - * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
| 184 | - * |
|
| 185 | - * @param $view_id int GravityView view id |
|
| 186 | - * @param $form_id int Gravity Forms form id |
|
| 187 | - * @param $entry_id int Gravity Forms entry id |
|
| 188 | - * @return string |
|
| 189 | - */ |
|
| 190 | - public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
| 191 | - return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * The edit entry link creates a secure link with a nonce |
|
| 197 | - * |
|
| 198 | - * It also mimics the URL structure Gravity Forms expects to have so that |
|
| 199 | - * it formats the display of the edit form like it does in the backend, like |
|
| 200 | - * "You can edit this post from the post page" fields, for example. |
|
| 201 | - * |
|
| 202 | - * @param $entry array Gravity Forms entry object |
|
| 203 | - * @param $view_id int GravityView view id |
|
| 204 | - * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
| 205 | - * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
| 206 | - * @return string |
|
| 207 | - */ |
|
| 208 | - public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
| 209 | - |
|
| 210 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
| 211 | - |
|
| 212 | - $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
| 213 | - |
|
| 214 | - $url = add_query_arg( array( |
|
| 215 | - 'edit' => wp_create_nonce( $nonce_key ) |
|
| 216 | - ), $base ); |
|
| 217 | - |
|
| 218 | - if( $post_id ) { |
|
| 219 | - $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * Allow passing params to dynamically populate entry with values |
|
| 224 | - * @since 1.9.2 |
|
| 225 | - */ |
|
| 226 | - if( !empty( $field_values ) ) { |
|
| 227 | - |
|
| 228 | - if( is_array( $field_values ) ) { |
|
| 229 | - // If already an array, no parse_str() needed |
|
| 230 | - $params = $field_values; |
|
| 231 | - } else { |
|
| 232 | - parse_str( $field_values, $params ); |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - $url = add_query_arg( $params, $url ); |
|
| 236 | - } |
|
| 169 | + /** |
|
| 170 | + * Include this extension templates path |
|
| 171 | + * @param array $file_paths List of template paths ordered |
|
| 172 | + */ |
|
| 173 | + public function add_template_path( $file_paths ) { |
|
| 174 | + |
|
| 175 | + // Index 100 is the default GravityView template path. |
|
| 176 | + $file_paths[ 110 ] = self::$file; |
|
| 177 | + |
|
| 178 | + return $file_paths; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * |
|
| 183 | + * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
| 184 | + * |
|
| 185 | + * @param $view_id int GravityView view id |
|
| 186 | + * @param $form_id int Gravity Forms form id |
|
| 187 | + * @param $entry_id int Gravity Forms entry id |
|
| 188 | + * @return string |
|
| 189 | + */ |
|
| 190 | + public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
| 191 | + return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * The edit entry link creates a secure link with a nonce |
|
| 197 | + * |
|
| 198 | + * It also mimics the URL structure Gravity Forms expects to have so that |
|
| 199 | + * it formats the display of the edit form like it does in the backend, like |
|
| 200 | + * "You can edit this post from the post page" fields, for example. |
|
| 201 | + * |
|
| 202 | + * @param $entry array Gravity Forms entry object |
|
| 203 | + * @param $view_id int GravityView view id |
|
| 204 | + * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
| 205 | + * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
| 206 | + * @return string |
|
| 207 | + */ |
|
| 208 | + public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
| 209 | + |
|
| 210 | + $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
| 211 | + |
|
| 212 | + $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
| 213 | + |
|
| 214 | + $url = add_query_arg( array( |
|
| 215 | + 'edit' => wp_create_nonce( $nonce_key ) |
|
| 216 | + ), $base ); |
|
| 217 | + |
|
| 218 | + if( $post_id ) { |
|
| 219 | + $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * Allow passing params to dynamically populate entry with values |
|
| 224 | + * @since 1.9.2 |
|
| 225 | + */ |
|
| 226 | + if( !empty( $field_values ) ) { |
|
| 227 | + |
|
| 228 | + if( is_array( $field_values ) ) { |
|
| 229 | + // If already an array, no parse_str() needed |
|
| 230 | + $params = $field_values; |
|
| 231 | + } else { |
|
| 232 | + parse_str( $field_values, $params ); |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + $url = add_query_arg( $params, $url ); |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | 238 | /** |
| 239 | 239 | * @filter `gravityview/edit/link` Filter the edit URL link. |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @param \GV\View $view The View. |
| 243 | 243 | */ |
| 244 | 244 | return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) ); |
| 245 | - } |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | 248 | * Edit mode doesn't allow certain field types. |
@@ -297,19 +297,19 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
| 300 | - /** |
|
| 301 | - * checks if user has permissions to edit a specific entry |
|
| 302 | - * |
|
| 303 | - * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
| 304 | - * |
|
| 305 | - * @param array $entry Gravity Forms entry array |
|
| 306 | - * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0 |
|
| 307 | - * @return bool |
|
| 308 | - */ |
|
| 309 | - public static function check_user_cap_edit_entry( $entry, $view = 0 ) { |
|
| 300 | + /** |
|
| 301 | + * checks if user has permissions to edit a specific entry |
|
| 302 | + * |
|
| 303 | + * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
| 304 | + * |
|
| 305 | + * @param array $entry Gravity Forms entry array |
|
| 306 | + * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0 |
|
| 307 | + * @return bool |
|
| 308 | + */ |
|
| 309 | + public static function check_user_cap_edit_entry( $entry, $view = 0 ) { |
|
| 310 | 310 | |
| 311 | - // No permission by default |
|
| 312 | - $user_can_edit = false; |
|
| 311 | + // No permission by default |
|
| 312 | + $user_can_edit = false; |
|
| 313 | 313 | |
| 314 | 314 | // get user_edit setting |
| 315 | 315 | if ( empty( $view ) ) { |
@@ -327,60 +327,60 @@ discard block |
||
| 327 | 327 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - // If they can edit any entries (as defined in Gravity Forms) |
|
| 331 | - // Or if they can edit other people's entries |
|
| 332 | - // Then we're good. |
|
| 333 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
| 330 | + // If they can edit any entries (as defined in Gravity Forms) |
|
| 331 | + // Or if they can edit other people's entries |
|
| 332 | + // Then we're good. |
|
| 333 | + if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
| 334 | 334 | |
| 335 | - gravityview()->log->debug( 'User has ability to edit all entries.' ); |
|
| 335 | + gravityview()->log->debug( 'User has ability to edit all entries.' ); |
|
| 336 | 336 | |
| 337 | - $user_can_edit = true; |
|
| 337 | + $user_can_edit = true; |
|
| 338 | 338 | |
| 339 | - } else if( !isset( $entry['created_by'] ) ) { |
|
| 339 | + } else if( !isset( $entry['created_by'] ) ) { |
|
| 340 | 340 | |
| 341 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
| 341 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
| 342 | 342 | |
| 343 | - $user_can_edit = false; |
|
| 343 | + $user_can_edit = false; |
|
| 344 | 344 | |
| 345 | - } else { |
|
| 345 | + } else { |
|
| 346 | 346 | |
| 347 | - $current_user = wp_get_current_user(); |
|
| 347 | + $current_user = wp_get_current_user(); |
|
| 348 | 348 | |
| 349 | - // User edit is disabled |
|
| 350 | - if( empty( $user_edit ) ) { |
|
| 349 | + // User edit is disabled |
|
| 350 | + if( empty( $user_edit ) ) { |
|
| 351 | 351 | |
| 352 | - gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
|
| 352 | + gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
|
| 353 | 353 | |
| 354 | - $user_can_edit = false; |
|
| 355 | - } |
|
| 354 | + $user_can_edit = false; |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | - // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
| 358 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 357 | + // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
| 358 | + else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 359 | 359 | |
| 360 | - gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
|
| 360 | + gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
|
| 361 | 361 | |
| 362 | - $user_can_edit = true; |
|
| 362 | + $user_can_edit = true; |
|
| 363 | 363 | |
| 364 | - } else if( ! is_user_logged_in() ) { |
|
| 364 | + } else if( ! is_user_logged_in() ) { |
|
| 365 | 365 | |
| 366 | - gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
|
| 366 | + gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
|
| 367 | 367 | |
| 368 | - $user_can_edit = false; // Here just for clarity |
|
| 369 | - } |
|
| 368 | + $user_can_edit = false; // Here just for clarity |
|
| 369 | + } |
|
| 370 | 370 | |
| 371 | - } |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | - /** |
|
| 374 | - * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
| 375 | - * @since 1.15 Added `$entry` and `$view_id` parameters |
|
| 376 | - * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
| 377 | - * @param[in] array $entry Gravity Forms entry array {@since 1.15} |
|
| 378 | - * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
| 379 | - */ |
|
| 380 | - $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
| 373 | + /** |
|
| 374 | + * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
| 375 | + * @since 1.15 Added `$entry` and `$view_id` parameters |
|
| 376 | + * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
| 377 | + * @param[in] array $entry Gravity Forms entry array {@since 1.15} |
|
| 378 | + * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
| 379 | + */ |
|
| 380 | + $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
| 381 | 381 | |
| 382 | - return (bool) $user_can_edit; |
|
| 383 | - } |
|
| 382 | + return (bool) $user_can_edit; |
|
| 383 | + } |
|
| 384 | 384 | |
| 385 | 385 | |
| 386 | 386 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
| 38 | 38 | |
| 39 | - if( is_admin() ) { |
|
| 39 | + if ( is_admin() ) { |
|
| 40 | 40 | $this->load_components( 'admin' ); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | static function getInstance() { |
| 58 | 58 | |
| 59 | - if( empty( self::$instance ) ) { |
|
| 59 | + if ( empty( self::$instance ) ) { |
|
| 60 | 60 | self::$instance = new GravityView_Edit_Entry; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | private function add_hooks() { |
| 83 | 83 | |
| 84 | 84 | // Add front-end access to Gravity Forms delete file action |
| 85 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 85 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
| 86 | 86 | |
| 87 | 87 | // Make sure this hook is run for non-admins |
| 88 | - add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 88 | + add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
| 89 | 89 | |
| 90 | 90 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
| 91 | 91 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function add_reserved_arg( $args ) { |
| 110 | 110 | |
| 111 | - $args[] = 'edit'; |
|
| 111 | + $args[ ] = 'edit'; |
|
| 112 | 112 | |
| 113 | 113 | return $args; |
| 114 | 114 | } |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function addon_specific_hooks() { |
| 121 | 121 | |
| 122 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
| 123 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
| 122 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
| 123 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | } |
@@ -207,15 +207,15 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
| 209 | 209 | |
| 210 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
| 210 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
| 211 | 211 | |
| 212 | - $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
| 212 | + $base = gv_entry_link( $entry, $post_id ?: $view_id ); |
|
| 213 | 213 | |
| 214 | 214 | $url = add_query_arg( array( |
| 215 | 215 | 'edit' => wp_create_nonce( $nonce_key ) |
| 216 | 216 | ), $base ); |
| 217 | 217 | |
| 218 | - if( $post_id ) { |
|
| 218 | + if ( $post_id ) { |
|
| 219 | 219 | $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | * Allow passing params to dynamically populate entry with values |
| 224 | 224 | * @since 1.9.2 |
| 225 | 225 | */ |
| 226 | - if( !empty( $field_values ) ) { |
|
| 226 | + if ( ! empty( $field_values ) ) { |
|
| 227 | 227 | |
| 228 | - if( is_array( $field_values ) ) { |
|
| 228 | + if ( is_array( $field_values ) ) { |
|
| 229 | 229 | // If already an array, no parse_str() needed |
| 230 | 230 | $params = $field_values; |
| 231 | 231 | } else { |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * @param array $entry The entry. |
| 242 | 242 | * @param \GV\View $view The View. |
| 243 | 243 | */ |
| 244 | - return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) ); |
|
| 244 | + return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) ); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function modify_field_blacklist( $fields = array(), $context = NULL ) { |
| 254 | 254 | |
| 255 | - if( empty( $context ) || $context !== 'edit' ) { |
|
| 255 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
| 256 | 256 | return $fields; |
| 257 | 257 | } |
| 258 | 258 | |
@@ -330,15 +330,15 @@ discard block |
||
| 330 | 330 | // If they can edit any entries (as defined in Gravity Forms) |
| 331 | 331 | // Or if they can edit other people's entries |
| 332 | 332 | // Then we're good. |
| 333 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
| 333 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
| 334 | 334 | |
| 335 | 335 | gravityview()->log->debug( 'User has ability to edit all entries.' ); |
| 336 | 336 | |
| 337 | 337 | $user_can_edit = true; |
| 338 | 338 | |
| 339 | - } else if( !isset( $entry['created_by'] ) ) { |
|
| 339 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
| 340 | 340 | |
| 341 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
| 341 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
|
| 342 | 342 | |
| 343 | 343 | $user_can_edit = false; |
| 344 | 344 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $current_user = wp_get_current_user(); |
| 348 | 348 | |
| 349 | 349 | // User edit is disabled |
| 350 | - if( empty( $user_edit ) ) { |
|
| 350 | + if ( empty( $user_edit ) ) { |
|
| 351 | 351 | |
| 352 | 352 | gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
| 353 | 353 | |
@@ -355,13 +355,13 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
| 358 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 358 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
| 359 | 359 | |
| 360 | 360 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
| 361 | 361 | |
| 362 | 362 | $user_can_edit = true; |
| 363 | 363 | |
| 364 | - } else if( ! is_user_logged_in() ) { |
|
| 364 | + } else if ( ! is_user_logged_in() ) { |
|
| 365 | 365 | |
| 366 | 366 | gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
| 367 | 367 | |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
| 381 | 381 | |
| 382 | - return (bool) $user_can_edit; |
|
| 382 | + return (bool)$user_can_edit; |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $this->label = esc_html__( 'Number Sequence', 'gravityview' ); |
| 42 | 42 | $this->description = esc_html__( 'Display a sequential result number for each entry.', 'gravityview' ); |
| 43 | 43 | |
| 44 | - add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips') ); |
|
| 44 | + add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips' ) ); |
|
| 45 | 45 | |
| 46 | 46 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
| 47 | 47 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return $entry_default_fields; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $entry_default_fields['sequence'] = array( |
|
| 68 | + $entry_default_fields[ 'sequence' ] = array( |
|
| 69 | 69 | 'label' => __( 'Result Number', 'gravityview' ), |
| 70 | 70 | 'type' => $this->name, |
| 71 | 71 | 'desc' => $this->description, |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $return = $tooltips; |
| 86 | 86 | |
| 87 | - $return['reverse_sequence'] = array( |
|
| 88 | - 'title' => __('Reverse the order of the result numbers', 'gravityview'), |
|
| 89 | - 'value' => __('Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview'), |
|
| 87 | + $return[ 'reverse_sequence' ] = array( |
|
| 88 | + 'title' => __( 'Reverse the order of the result numbers', 'gravityview' ), |
|
| 89 | + 'value' => __( 'Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview' ), |
|
| 90 | 90 | ); |
| 91 | 91 | |
| 92 | 92 | return $return; |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 96 | 96 | |
| 97 | - unset ( $field_options['search_filter'] ); |
|
| 97 | + unset ( $field_options[ 'search_filter' ] ); |
|
| 98 | 98 | |
| 99 | 99 | $new_fields = array( |
| 100 | 100 | 'start' => array( |
| 101 | 101 | 'type' => 'number', |
| 102 | 102 | 'label' => __( 'First Number in the Sequence', 'gravityview' ), |
| 103 | - 'desc' => __('For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview'), |
|
| 103 | + 'desc' => __( 'For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview' ), |
|
| 104 | 104 | 'value' => '1', |
| 105 | 105 | 'merge_tags' => false, |
| 106 | 106 | ), |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | $return = $text; |
| 157 | 157 | |
| 158 | 158 | $context = new \GV\Template_Context(); |
| 159 | - $context->view = \GV\View::by_id( $view_data['view_id'] ); |
|
| 159 | + $context->view = \GV\View::by_id( $view_data[ 'view_id' ] ); |
|
| 160 | 160 | $context->entry = \GV\GF_Entry::from_entry( $entry ); |
| 161 | 161 | |
| 162 | 162 | $gv_field = \GV\Internal_Field::by_id( 'sequence' ); |
| 163 | 163 | $merge_tag_context = \GV\Utils::get( $legacy_field, 'UID' ); |
| 164 | - $merge_tag_context = $entry['id'] . "/{$merge_tag_context}"; |
|
| 164 | + $merge_tag_context = $entry[ 'id' ] . "/{$merge_tag_context}"; |
|
| 165 | 165 | |
| 166 | 166 | foreach ( $matches as $match ) { |
| 167 | 167 | |
| 168 | - $full_tag = $match[0]; |
|
| 169 | - $property = $match[1]; |
|
| 168 | + $full_tag = $match[ 0 ]; |
|
| 169 | + $property = $match[ 1 ]; |
|
| 170 | 170 | |
| 171 | 171 | $gv_field->reverse = false; |
| 172 | 172 | $gv_field->start = 1; |
@@ -185,12 +185,12 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | // If there is a field with the ID of the start number, the merge tag won't work. |
| 187 | 187 | // In that case, you can use "=" instead: `{sequence start=10}` |
| 188 | - if( 1 === sizeof( $maybe_start ) ) { |
|
| 188 | + if ( 1 === sizeof( $maybe_start ) ) { |
|
| 189 | 189 | $maybe_start = explode( '=', $modifier ); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if ( 'start' === rgar( $maybe_start, 0 ) && is_numeric( rgar( $maybe_start, 1 ) ) ) { |
| 193 | - $gv_field->start = (int) rgar( $maybe_start, 1 ); |
|
| 193 | + $gv_field->start = (int)rgar( $maybe_start, 1 ); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $merge_tag_context_modifiers = $merge_tag_context . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start; |
| 202 | 202 | |
| 203 | 203 | if ( ! isset( $merge_tag_sequences[ $merge_tag_context_modifiers ] ) ) { |
| 204 | - $gv_field->UID = $legacy_field['UID'] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start; |
|
| 204 | + $gv_field->UID = $legacy_field[ 'UID' ] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start; |
|
| 205 | 205 | $context->field = $gv_field; |
| 206 | 206 | $sequence = $merge_tag_sequences[ $merge_tag_context_modifiers ] = $this->get_sequence( $context ); |
| 207 | 207 | } else { |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $total = $context->view->get_entries()->total(); |
| 247 | 247 | remove_filter( 'gform_gf_query_sql', $callback ); |
| 248 | 248 | |
| 249 | - unset( $sql_query['paginate'] ); |
|
| 249 | + unset( $sql_query[ 'paginate' ] ); |
|
| 250 | 250 | |
| 251 | 251 | global $wpdb; |
| 252 | 252 | |
@@ -26,52 +26,52 @@ |
||
| 26 | 26 | |
| 27 | 27 | <?php // list all the available templates (type= fresh or custom ) ?> |
| 28 | 28 | <div class="gv-grid"> |
| 29 | - <?php foreach( $templates as $id => $template ) { |
|
| 29 | + <?php foreach ( $templates as $id => $template ) { |
|
| 30 | 30 | $selected = ( $id == $current_template ) ? ' gv-selected' : ''; |
| 31 | - $placeholder = ! empty( $template['buy_source'] ); |
|
| 32 | - $is_included = ! empty( $template['included'] ); |
|
| 31 | + $placeholder = ! empty( $template[ 'buy_source' ] ); |
|
| 32 | + $is_included = ! empty( $template[ 'included' ] ); |
|
| 33 | 33 | $plugin_data = GravityView_Admin_Installer::get_wp_plugins_data( \GV\Utils::get( $template, 'textdomain', '' ) ); |
| 34 | 34 | $button_text = empty( $plugin_data ) ? esc_html__( 'Install Layout', 'gravityview' ) : esc_html__( 'Activate & Select Layout', 'gravityview' ); |
| 35 | 35 | $button_class = 'gv-layout-' . ( empty( $plugin_data ) ? 'install' : 'activate' ); |
| 36 | - $template_path = isset($plugin_data['path']) ? $plugin_data['path'] : ''; |
|
| 36 | + $template_path = isset( $plugin_data[ 'path' ] ) ? $plugin_data[ 'path' ] : ''; |
|
| 37 | 37 | |
| 38 | 38 | ?> |
| 39 | 39 | <div class="gv-grid-col-1-4"> |
| 40 | - <div class="gv-view-types-module<?php echo $selected; if( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>"> |
|
| 40 | + <div class="gv-view-types-module<?php echo $selected; if ( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>"> |
|
| 41 | 41 | <div class="gv-view-types-normal"> |
| 42 | - <img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>"> |
|
| 43 | - <h5><?php echo esc_html( $template['label'] ); ?></h5> |
|
| 44 | - <p class="description"><?php echo esc_html( $template['description'] ); ?></p> |
|
| 42 | + <img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>"> |
|
| 43 | + <h5><?php echo esc_html( $template[ 'label' ] ); ?></h5> |
|
| 44 | + <p class="description"><?php echo esc_html( $template[ 'description' ] ); ?></p> |
|
| 45 | 45 | </div> |
| 46 | 46 | <div class="gv-view-types-hover"> |
| 47 | 47 | <div> |
| 48 | 48 | <?php |
| 49 | - if( $is_included ) { |
|
| 49 | + if ( $is_included ) { |
|
| 50 | 50 | ?> |
| 51 | 51 | <p><a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gv-admin-installer' ) ); ?>" class="button button-secondary button-hero <?php echo $button_class; ?>" rel="internal" data-template-path="<?php echo $template_path; ?>"><?php echo $button_text; ?></a></p> |
| 52 | - <?php if( !empty( $template['license'] ) ) { ?> |
|
| 53 | - <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', ' ', $template['license'] ) ) ); ?></p> |
|
| 52 | + <?php if ( ! empty( $template[ 'license' ] ) ) { ?> |
|
| 53 | + <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', ' ', $template[ 'license' ] ) ) ); ?></p> |
|
| 54 | 54 | <?php } ?> |
| 55 | 55 | <?php |
| 56 | - } elseif( $placeholder ) { |
|
| 57 | - $utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template['license'] ) . '&utm_content=' . urlencode( $template['slug'] ); |
|
| 56 | + } elseif ( $placeholder ) { |
|
| 57 | + $utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template[ 'license' ] ) . '&utm_content=' . urlencode( $template[ 'slug' ] ); |
|
| 58 | 58 | ?> |
| 59 | - <p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p> |
|
| 59 | + <p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p> |
|
| 60 | 60 | |
| 61 | - <?php if( !empty( $template['preview'] ) ) { ?> |
|
| 62 | - <p><a href="<?php echo esc_url( $template['preview'] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview'); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p> |
|
| 61 | + <?php if ( ! empty( $template[ 'preview' ] ) ) { ?> |
|
| 62 | + <p><a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview' ); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p> |
|
| 63 | 63 | <?php } ?> |
| 64 | 64 | |
| 65 | - <?php if( ! empty( $template['license'] ) ) { ?> |
|
| 66 | - <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', ' ', $template['license'] ) ) . '</a>' ); ?></p> |
|
| 65 | + <?php if ( ! empty( $template[ 'license' ] ) ) { ?> |
|
| 66 | + <p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', ' ', $template[ 'license' ] ) ) . '</a>' ); ?></p> |
|
| 67 | 67 | <?php } ?> |
| 68 | 68 | <?php } |
| 69 | 69 | |
| 70 | - if ($placeholder || $is_included) { ?> </div><div class="hidden"> <?php } ?> |
|
| 70 | + if ( $placeholder || $is_included ) { ?> </div><div class="hidden"> <?php } ?> |
|
| 71 | 71 | |
| 72 | - <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p> |
|
| 73 | - <?php if( !empty( $template['preview'] ) ) { ?> |
|
| 74 | - <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a> |
|
| 72 | + <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></a></p> |
|
| 73 | + <?php if ( ! empty( $template[ 'preview' ] ) ) { ?> |
|
| 74 | + <a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview' ); ?>"></i></a> |
|
| 75 | 75 | <?php } ?> |
| 76 | 76 | </div> |
| 77 | 77 | </div> |
@@ -97,13 +97,13 @@ |
||
| 97 | 97 | // Set the $_field_id var |
| 98 | 98 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
| 99 | 99 | |
| 100 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 100 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 101 | 101 | $default = 'tick'; |
| 102 | 102 | } else { |
| 103 | 103 | $default = 'both'; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $field_options['choice_display'] = array( |
|
| 106 | + $field_options[ 'choice_display' ] = array( |
|
| 107 | 107 | 'type' => 'radio', |
| 108 | 108 | 'class' => 'vertical', |
| 109 | 109 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -14,42 +14,42 @@ |
||
| 14 | 14 | |
| 15 | 15 | $field_info_items = array(); |
| 16 | 16 | |
| 17 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
| 18 | - $field_info_items[] = array( |
|
| 19 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
| 17 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
| 18 | + $field_info_items[ ] = array( |
|
| 19 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
| 20 | 20 | 'class' => 'gv-sublabel' |
| 21 | 21 | ); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | // Fields with IDs, not like Source URL or Entry ID |
| 25 | - if( is_numeric( $this->id ) ) { |
|
| 25 | + if ( is_numeric( $this->id ) ) { |
|
| 26 | 26 | |
| 27 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
| 27 | + $field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] ); |
|
| 28 | 28 | |
| 29 | - if ( ! empty( $this->item['parent'] ) ) { |
|
| 30 | - $field_info_items[] = array( |
|
| 31 | - 'value' => sprintf( esc_html__( 'Parent: %s', 'gravityview' ), esc_attr( $this->item['parent']['label'] ) ), |
|
| 29 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 30 | + $field_info_items[ ] = array( |
|
| 31 | + 'value' => sprintf( esc_html__( 'Parent: %s', 'gravityview' ), esc_attr( $this->item[ 'parent' ][ 'label' ] ) ), |
|
| 32 | 32 | ); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $field_info_items[] = array( |
|
| 36 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ), |
|
| 37 | - 'hide_in_picker' => ! empty( $this->item['parent'] ), |
|
| 35 | + $field_info_items[ ] = array( |
|
| 36 | + 'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ), |
|
| 37 | + 'hide_in_picker' => ! empty( $this->item[ 'parent' ] ), |
|
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - $field_info_items[] = array( |
|
| 41 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
| 40 | + $field_info_items[ ] = array( |
|
| 41 | + 'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ), |
|
| 42 | 42 | ); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if( !empty( $this->item['desc'] ) ) { |
|
| 46 | - $field_info_items[] = array( |
|
| 47 | - 'value' => $this->item['desc'] |
|
| 45 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
| 46 | + $field_info_items[ ] = array( |
|
| 47 | + 'value' => $this->item[ 'desc' ] |
|
| 48 | 48 | ); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $field_info_items[] = array( |
|
| 52 | - 'value' => sprintf( __('Form ID: %s', 'gravityview' ), $this->form_id ), |
|
| 51 | + $field_info_items[ ] = array( |
|
| 52 | + 'value' => sprintf( __( 'Form ID: %s', 'gravityview' ), $this->form_id ), |
|
| 53 | 53 | 'hide_in_picker' => true, |
| 54 | 54 | ); |
| 55 | 55 | |
@@ -29,24 +29,24 @@ |
||
| 29 | 29 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 30 | 30 | |
| 31 | 31 | // Don't link to entry; doesn't make sense. |
| 32 | - unset( $field_options['show_as_link'] ); |
|
| 32 | + unset( $field_options[ 'show_as_link' ] ); |
|
| 33 | 33 | |
| 34 | - if( 'edit' === $context ) { |
|
| 34 | + if ( 'edit' === $context ) { |
|
| 35 | 35 | return $field_options; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $add_options = array(); |
| 39 | - $add_options['link_to_source'] = array( |
|
| 39 | + $add_options[ 'link_to_source' ] = array( |
|
| 40 | 40 | 'type' => 'checkbox', |
| 41 | 41 | 'label' => __( 'Link to URL:', 'gravityview' ), |
| 42 | - 'desc' => __('Display as a link to the Source URL', 'gravityview'), |
|
| 42 | + 'desc' => __( 'Display as a link to the Source URL', 'gravityview' ), |
|
| 43 | 43 | 'value' => false, |
| 44 | 44 | 'merge_tags' => false, |
| 45 | 45 | ); |
| 46 | - $add_options['source_link_text'] = array( |
|
| 46 | + $add_options[ 'source_link_text' ] = array( |
|
| 47 | 47 | 'type' => 'text', |
| 48 | 48 | 'label' => __( 'Link Text:', 'gravityview' ), |
| 49 | - 'desc' => __('Customize the link text. If empty, the link text will be the URL.', 'gravityview'), |
|
| 49 | + 'desc' => __( 'Customize the link text. If empty, the link text will be the URL.', 'gravityview' ), |
|
| 50 | 50 | 'value' => NULL, |
| 51 | 51 | 'merge_tags' => true, |
| 52 | 52 | 'requires' => 'link_to_source', |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | continue; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
| 72 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
| 71 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
| 72 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
| 73 | 73 | $form = GravityView_View::getInstance()->getForm(); |
| 74 | 74 | |
| 75 | 75 | /** @type GF_Field_Address $address_field */ |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $choices = array(); |
| 79 | 79 | |
| 80 | 80 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
| 81 | - if( method_exists( $this, $method_name ) ) { |
|
| 81 | + if ( method_exists( $this, $method_name ) ) { |
|
| 82 | 82 | /** |
| 83 | 83 | * @uses GravityView_Field_Address::get_choices_country() |
| 84 | 84 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | $choices = $this->{$method_name}( $address_field, $form ); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if( ! empty( $choices ) ) { |
|
| 90 | - $search_field['choices'] = $choices; |
|
| 91 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
| 89 | + if ( ! empty( $choices ) ) { |
|
| 90 | + $search_field[ 'choices' ] = $choices; |
|
| 91 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
| 92 | 92 | } else { |
| 93 | - $search_field['type'] = 'text'; |
|
| 94 | - $search_field['input'] = 'input_text'; |
|
| 93 | + $search_field[ 'type' ] = 'text'; |
|
| 94 | + $search_field[ 'input' ] = 'input_text'; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $country_choices = array(); |
| 117 | 117 | |
| 118 | 118 | foreach ( $countries as $key => $country ) { |
| 119 | - $country_choices[] = array( |
|
| 119 | + $country_choices[ ] = array( |
|
| 120 | 120 | 'value' => $country, |
| 121 | 121 | 'text' => $country, |
| 122 | 122 | ); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | private function get_choices_state( $address_field, $form ) { |
| 143 | 143 | |
| 144 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
| 144 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
| 145 | 145 | |
| 146 | 146 | $state_choices = array(); |
| 147 | 147 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | $states = GFCommon::get_canadian_provinces(); |
| 154 | 154 | break; |
| 155 | 155 | default: |
| 156 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
| 157 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
| 156 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
| 157 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
| 158 | 158 | break; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -163,19 +163,19 @@ discard block |
||
| 163 | 163 | $state_subchoices = array(); |
| 164 | 164 | |
| 165 | 165 | foreach ( $state as $key => $substate ) { |
| 166 | - $state_subchoices[] = array( |
|
| 166 | + $state_subchoices[ ] = array( |
|
| 167 | 167 | 'value' => is_numeric( $key ) ? $substate : $key, |
| 168 | 168 | 'text' => $substate, |
| 169 | 169 | ); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $state_choices[] = array( |
|
| 172 | + $state_choices[ ] = array( |
|
| 173 | 173 | 'text' => $key, |
| 174 | 174 | 'value' => $state_subchoices, |
| 175 | 175 | ); |
| 176 | 176 | |
| 177 | 177 | } else { |
| 178 | - $state_choices[] = array( |
|
| 178 | + $state_choices[ ] = array( |
|
| 179 | 179 | 'value' => is_numeric( $key ) ? $state : $key, |
| 180 | 180 | 'text' => $state, |
| 181 | 181 | ); |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | // Use the same inputs as the "text" input type allows |
| 200 | 200 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
| 201 | 201 | |
| 202 | - $input_types['street'] = $text_inputs; |
|
| 203 | - $input_types['street2'] = $text_inputs; |
|
| 204 | - $input_types['city'] = $text_inputs; |
|
| 202 | + $input_types[ 'street' ] = $text_inputs; |
|
| 203 | + $input_types[ 'street2' ] = $text_inputs; |
|
| 204 | + $input_types[ 'city' ] = $text_inputs; |
|
| 205 | 205 | |
| 206 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 207 | - $input_types['zip'] = array( 'input_text' ); |
|
| 208 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 206 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 207 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
| 208 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 209 | 209 | |
| 210 | 210 | return $input_types; |
| 211 | 211 | } |
@@ -226,12 +226,12 @@ discard block |
||
| 226 | 226 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
| 227 | 227 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
| 228 | 228 | |
| 229 | - if( 'address' !== $field_type && $input_id ) { |
|
| 229 | + if ( 'address' !== $field_type && $input_id ) { |
|
| 230 | 230 | return $input_type; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
| 234 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 234 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 235 | 235 | $input_type = $address_field_name; |
| 236 | 236 | } |
| 237 | 237 | |
@@ -279,17 +279,17 @@ discard block |
||
| 279 | 279 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 280 | 280 | |
| 281 | 281 | // If this is NOT the full address field, return default options. |
| 282 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 282 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 283 | 283 | return $field_options; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - if( 'edit' === $context ) { |
|
| 286 | + if ( 'edit' === $context ) { |
|
| 287 | 287 | return $field_options; |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | $add_options = array(); |
| 291 | 291 | |
| 292 | - $add_options['show_map_link'] = array( |
|
| 292 | + $add_options[ 'show_map_link' ] = array( |
|
| 293 | 293 | 'type' => 'checkbox', |
| 294 | 294 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
| 295 | 295 | 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | $this->add_field_support( 'new_window', $add_options ); |
| 303 | 303 | |
| 304 | - $add_options['new_window']['requires'] = 'show_map_link'; |
|
| 304 | + $add_options[ 'new_window' ][ 'requires' ] = 'show_map_link'; |
|
| 305 | 305 | |
| 306 | 306 | return $add_options + $field_options; |
| 307 | 307 | } |