@@ -34,23 +34,23 @@ discard block |
||
34 | 34 | |
35 | 35 | $merge_tags = array( |
36 | 36 | array( |
37 | - 'label' => __('Entry Creator: Display Name', 'gravityview'), |
|
37 | + 'label' => __( 'Entry Creator: Display Name', 'gravityview' ), |
|
38 | 38 | 'tag' => '{created_by:display_name}' |
39 | 39 | ), |
40 | 40 | array( |
41 | - 'label' => __('Entry Creator: Email', 'gravityview'), |
|
41 | + 'label' => __( 'Entry Creator: Email', 'gravityview' ), |
|
42 | 42 | 'tag' => '{created_by:user_email}' |
43 | 43 | ), |
44 | 44 | array( |
45 | - 'label' => __('Entry Creator: Username', 'gravityview'), |
|
45 | + 'label' => __( 'Entry Creator: Username', 'gravityview' ), |
|
46 | 46 | 'tag' => '{created_by:user_login}' |
47 | 47 | ), |
48 | 48 | array( |
49 | - 'label' => __('Entry Creator: User ID', 'gravityview'), |
|
49 | + 'label' => __( 'Entry Creator: User ID', 'gravityview' ), |
|
50 | 50 | 'tag' => '{created_by:ID}' |
51 | 51 | ), |
52 | 52 | array( |
53 | - 'label' => __('Entry Creator: Roles', 'gravityview'), |
|
53 | + 'label' => __( 'Entry Creator: Roles', 'gravityview' ), |
|
54 | 54 | 'tag' => '{created_by:roles}' |
55 | 55 | ), |
56 | 56 | ); |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
79 | 79 | |
80 | 80 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
81 | - if( empty( $entry['created_by'] ) ) { |
|
81 | + if ( empty( $entry[ 'created_by' ] ) ) { |
|
82 | 82 | return $text; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Get the creator of the entry |
86 | - $entry_creator = new WP_User( $entry['created_by'] ); |
|
86 | + $entry_creator = new WP_User( $entry[ 'created_by' ] ); |
|
87 | 87 | |
88 | 88 | foreach ( $matches as $match ) { |
89 | 89 | |
90 | - $full_tag = $match[0]; |
|
91 | - $property = $match[1]; |
|
90 | + $full_tag = $match[ 0 ]; |
|
91 | + $property = $match[ 1 ]; |
|
92 | 92 | |
93 | - switch( $property ) { |
|
93 | + switch ( $property ) { |
|
94 | 94 | /** @since 1.13.2 */ |
95 | 95 | case 'roles': |
96 | 96 | $value = implode( ', ', $entry_creator->roles ); |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | |
114 | 114 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
115 | 115 | |
116 | - if( 'edit' === $context ) { |
|
116 | + if ( 'edit' === $context ) { |
|
117 | 117 | return $field_options; |
118 | 118 | } |
119 | 119 | |
120 | - $field_options['name_display'] = array( |
|
120 | + $field_options[ 'name_display' ] = array( |
|
121 | 121 | 'type' => 'select', |
122 | 122 | 'label' => __( 'User Format', 'gravityview' ), |
123 | - 'desc' => __( 'How should the User information be displayed?', 'gravityview'), |
|
123 | + 'desc' => __( 'How should the User information be displayed?', 'gravityview' ), |
|
124 | 124 | 'choices' => array( |
125 | - 'display_name' => __('Display Name (Example: "Ellen Ripley")', 'gravityview'), |
|
126 | - 'user_login' => __('Username (Example: "nostromo")', 'gravityview'), |
|
127 | - 'ID' => __('User ID # (Example: 426)', 'gravityview'), |
|
125 | + 'display_name' => __( 'Display Name (Example: "Ellen Ripley")', 'gravityview' ), |
|
126 | + 'user_login' => __( 'Username (Example: "nostromo")', 'gravityview' ), |
|
127 | + 'ID' => __( 'User ID # (Example: 426)', 'gravityview' ), |
|
128 | 128 | ), |
129 | 129 | 'value' => 'display_name' |
130 | 130 | ); |
@@ -36,9 +36,9 @@ |
||
36 | 36 | |
37 | 37 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
38 | 38 | |
39 | - unset ( $field_options['search_filter'], $field_options['show_as_link'] ); |
|
39 | + unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] ); |
|
40 | 40 | |
41 | - if( 'edit' === $context ) { |
|
41 | + if ( 'edit' === $context ) { |
|
42 | 42 | return $field_options; |
43 | 43 | } |
44 | 44 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $list_rows = maybe_unserialize( $field_value ); |
62 | 62 | |
63 | - if( ! is_array( $list_rows ) ) { |
|
63 | + if ( ! is_array( $list_rows ) ) { |
|
64 | 64 | do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value ); |
65 | 65 | return null; |
66 | 66 | } |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | foreach ( $list_row as $column_key => $column_value ) { |
74 | 74 | |
75 | 75 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
76 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
77 | - $column_values[] = $column_value; |
|
76 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
77 | + $column_values[ ] = $column_value; |
|
78 | 78 | } |
79 | 79 | $current_column++; |
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | 83 | // Return the array of values |
84 | - if( 'raw' === $format ) { |
|
84 | + if ( 'raw' === $format ) { |
|
85 | 85 | return $column_values; |
86 | 86 | } |
87 | 87 | // Return the Gravity Forms Field output |
@@ -104,26 +104,26 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function _filter_field_label( $label, $field, $form, $entry ) { |
106 | 106 | |
107 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
107 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
108 | 108 | |
109 | 109 | // Not a list field |
110 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
110 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
111 | 111 | return $label; |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Custom label is defined, so use it |
115 | - if( ! empty( $field['custom_label'] ) ) { |
|
115 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
116 | 116 | return $label; |
117 | 117 | } |
118 | 118 | |
119 | - $field_id_array = explode( '.', $field['id'] ); |
|
119 | + $field_id_array = explode( '.', $field[ 'id' ] ); |
|
120 | 120 | |
121 | 121 | // Parent field, not column field |
122 | - if( ! isset( $field_id_array[1] ) ) { |
|
122 | + if ( ! isset( $field_id_array[ 1 ] ) ) { |
|
123 | 123 | return $label; |
124 | 124 | } |
125 | 125 | |
126 | - $column_id = intval( $field_id_array[1] ); |
|
126 | + $column_id = intval( $field_id_array[ 1 ] ); |
|
127 | 127 | |
128 | 128 | return self::get_column_label( $field_object, $column_id, $label ); |
129 | 129 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
143 | 143 | |
144 | 144 | // Doesn't have columns enabled |
145 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
145 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
146 | 146 | return $backup_label; |
147 | 147 | } |
148 | 148 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
61 | 61 | |
62 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
62 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -100,31 +100,31 @@ discard block |
||
100 | 100 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
101 | 101 | |
102 | 102 | // If the search is being sorted |
103 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
103 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
104 | 104 | |
105 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
105 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
109 | 109 | * @see modify_sort_id() |
110 | 110 | */ |
111 | - if( ! empty( $pieces[1] ) ) { |
|
111 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
112 | 112 | |
113 | 113 | // Pass these to the _modify_query_sort_by_time_hack() method |
114 | - $this->_time_format = $pieces[1]; |
|
115 | - $this->_date_format = $pieces[2]; |
|
114 | + $this->_time_format = $pieces[ 1 ]; |
|
115 | + $this->_date_format = $pieces[ 2 ]; |
|
116 | 116 | |
117 | 117 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
118 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
118 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
122 | 122 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
123 | 123 | */ |
124 | - $criteria['sorting']['is_numeric'] = true; |
|
124 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
125 | 125 | |
126 | 126 | // Modify the Gravity Forms WP Query |
127 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
127 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * then we want to modify the query. |
148 | 148 | * @see GFFormsModel::sort_by_field_query() |
149 | 149 | */ |
150 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
150 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
151 | 151 | |
152 | - if( $this->_time_format === '24' ) { |
|
152 | + if ( $this->_time_format === '24' ) { |
|
153 | 153 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
154 | 154 | } else { |
155 | 155 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -195,18 +195,18 @@ discard block |
||
195 | 195 | // Set variables |
196 | 196 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
197 | 197 | |
198 | - if( 'edit' === $context ) { |
|
198 | + if ( 'edit' === $context ) { |
|
199 | 199 | return $field_options; |
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Set default date format based on field ID and Form ID |
204 | 204 | */ |
205 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
205 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
206 | 206 | |
207 | - $this->add_field_support('date_display', $field_options ); |
|
207 | + $this->add_field_support( 'date_display', $field_options ); |
|
208 | 208 | |
209 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
209 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
210 | 210 | |
211 | 211 | return $field_options; |
212 | 212 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private function _get_time_format() { |
222 | 222 | global $post; |
223 | 223 | |
224 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
224 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
225 | 225 | |
226 | 226 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | // GF defaults to 12, so should we. |
241 | 241 | $time_format = '12'; |
242 | 242 | |
243 | - if( $form_id ) { |
|
243 | + if ( $form_id ) { |
|
244 | 244 | $form = GFAPI::get_form( $form_id ); |
245 | 245 | |
246 | 246 | if ( $form ) { |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | |
285 | 285 | $field_id_array = explode( '.', $field_id ); |
286 | 286 | |
287 | - $field_input_id = isset( $field_id_array[1] ) ? intval( $field_id_array[1] ) : 0; |
|
287 | + $field_input_id = isset( $field_id_array[ 1 ] ) ? intval( $field_id_array[ 1 ] ) : 0; |
|
288 | 288 | |
289 | 289 | $default = 'h:i A'; |
290 | 290 | |
291 | 291 | // This doesn't take into account 24-hour |
292 | - switch( $field_input_id ) { |
|
292 | + switch ( $field_input_id ) { |
|
293 | 293 | // Hours |
294 | 294 | case 1: |
295 | 295 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | public function dismiss_notice() { |
58 | 58 | |
59 | 59 | // No dismiss sent |
60 | - if( empty( $_GET['gv-dismiss'] ) ) { |
|
60 | + if ( empty( $_GET[ 'gv-dismiss' ] ) ) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // Invalid nonce |
65 | - if( !wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) { |
|
65 | + if ( ! wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) { |
|
66 | 66 | return; |
67 | 67 | } |
68 | 68 | |
69 | - $notice_id = esc_attr( $_GET['notice'] ); |
|
69 | + $notice_id = esc_attr( $_GET[ 'notice' ] ); |
|
70 | 70 | |
71 | 71 | //don't display a message if use has dismissed the message for this version |
72 | 72 | $dismissed_notices = (array)get_transient( 'gravityview_dismissed_notices' ); |
73 | 73 | |
74 | - $dismissed_notices[] = $notice_id; |
|
74 | + $dismissed_notices[ ] = $notice_id; |
|
75 | 75 | |
76 | 76 | $dismissed_notices = array_unique( $dismissed_notices ); |
77 | 77 | |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | private function is_notice_dismissed( $notice ) { |
95 | 95 | |
96 | 96 | // There are no dismissed notices. |
97 | - if( empty( self::$dismissed_notices ) ) { |
|
97 | + if ( empty( self::$dismissed_notices ) ) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | |
101 | 101 | // Has the |
102 | - $is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices ); |
|
102 | + $is_dismissed = ! empty( $notice[ 'dismiss' ] ) && in_array( $notice[ 'dismiss' ], self::$dismissed_notices ); |
|
103 | 103 | |
104 | 104 | return $is_dismissed ? true : false; |
105 | 105 | } |
@@ -124,17 +124,17 @@ discard block |
||
124 | 124 | */ |
125 | 125 | private function check_show_multisite_notices() { |
126 | 126 | |
127 | - if( ! is_multisite() ) { |
|
127 | + if ( ! is_multisite() ) { |
|
128 | 128 | return true; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // It's network activated but the user can't manage network plugins; they can't do anything about it. |
132 | - if( GravityView_Plugin::is_network_activated() && ! is_main_site() ) { |
|
132 | + if ( GravityView_Plugin::is_network_activated() && ! is_main_site() ) { |
|
133 | 133 | return false; |
134 | 134 | } |
135 | 135 | |
136 | 136 | // or they don't have admin capabilities |
137 | - if( ! is_super_admin() ) { |
|
137 | + if ( ! is_super_admin() ) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | |
@@ -157,48 +157,48 @@ discard block |
||
157 | 157 | */ |
158 | 158 | $notices = apply_filters( 'gravityview/admin/notices', self::$admin_notices ); |
159 | 159 | |
160 | - if( empty( $notices ) || ! $this->check_show_multisite_notices() ) { |
|
160 | + if ( empty( $notices ) || ! $this->check_show_multisite_notices() ) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 | |
164 | 164 | //don't display a message if use has dismissed the message for this version |
165 | 165 | // TODO: Use get_user_meta instead of get_transient |
166 | - self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' ); |
|
166 | + self::$dismissed_notices = isset( $_GET[ 'show-dismissed-notices' ] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' ); |
|
167 | 167 | |
168 | 168 | $output = ''; |
169 | 169 | |
170 | - foreach( $notices as $notice ) { |
|
170 | + foreach ( $notices as $notice ) { |
|
171 | 171 | |
172 | 172 | // If the user doesn't have the capability to see the warning |
173 | - if( isset( $notice['cap'] ) && false === GVCommon::has_cap( $notice['cap'] ) ) { |
|
173 | + if ( isset( $notice[ 'cap' ] ) && false === GVCommon::has_cap( $notice[ 'cap' ] ) ) { |
|
174 | 174 | do_action( 'gravityview_log_debug', 'Notice not shown because user does not have the capability to view it.', $notice ); |
175 | 175 | continue; |
176 | 176 | } |
177 | 177 | |
178 | - if( true === $this->is_notice_dismissed( $notice ) ) { |
|
178 | + if ( true === $this->is_notice_dismissed( $notice ) ) { |
|
179 | 179 | do_action( 'gravityview_log_debug', 'Notice not shown because the notice has already been dismissed.', $notice ); |
180 | 180 | continue; |
181 | 181 | } |
182 | 182 | |
183 | - $output .= '<div id="message" style="position:relative" class="notice '. gravityview_sanitize_html_class( $notice['class'] ).'">'; |
|
183 | + $output .= '<div id="message" style="position:relative" class="notice ' . gravityview_sanitize_html_class( $notice[ 'class' ] ) . '">'; |
|
184 | 184 | |
185 | 185 | // Too cute to leave out. |
186 | 186 | $output .= gravityview_get_floaty(); |
187 | 187 | |
188 | - if( !empty( $notice['title'] ) ) { |
|
189 | - $output .= '<h3>'.esc_html( $notice['title'] ) .'</h3>'; |
|
188 | + if ( ! empty( $notice[ 'title' ] ) ) { |
|
189 | + $output .= '<h3>' . esc_html( $notice[ 'title' ] ) . '</h3>'; |
|
190 | 190 | } |
191 | 191 | |
192 | - $message = isset( $notice['message'] ) ? $notice['message'] : ''; |
|
192 | + $message = isset( $notice[ 'message' ] ) ? $notice[ 'message' ] : ''; |
|
193 | 193 | |
194 | - if( !empty( $notice['dismiss'] ) ) { |
|
194 | + if ( ! empty( $notice[ 'dismiss' ] ) ) { |
|
195 | 195 | |
196 | - $dismiss = esc_attr($notice['dismiss']); |
|
196 | + $dismiss = esc_attr( $notice[ 'dismiss' ] ); |
|
197 | 197 | |
198 | 198 | $url = esc_url( add_query_arg( array( 'gv-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) ); |
199 | 199 | |
200 | 200 | $align = is_rtl() ? 'alignleft' : 'alignright'; |
201 | - $message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="' . $align . ' button button-link">'.esc_html__('Dismiss', 'gravityview' ).'</a></p>'; |
|
201 | + $message .= '<a href="' . $url . '" data-notice="' . $dismiss . '" class="' . $align . ' button button-link">' . esc_html__( 'Dismiss', 'gravityview' ) . '</a></p>'; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | $output .= wpautop( $message ); |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public static function add_notice( $notice = array() ) { |
227 | 227 | |
228 | - if( !isset( $notice['message'] ) ) { |
|
228 | + if ( ! isset( $notice[ 'message' ] ) ) { |
|
229 | 229 | do_action( 'gravityview_log_error', 'GravityView_Admin[add_notice] Notice not set', $notice ); |
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
233 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
234 | 234 | |
235 | - self::$admin_notices[] = $notice; |
|
235 | + self::$admin_notices[ ] = $notice; |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | function __construct() { |
22 | 22 | |
23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
24 | 24 | |
25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
26 | 26 | |
27 | 27 | // adding styles and scripts |
28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
29 | 29 | |
30 | 30 | // ajax - populate sort fields based on the selected view |
31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function is_post_editor_screen() { |
42 | 42 | global $current_screen, $pagenow; |
43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @since 1.15.3 |
57 | 57 | */ |
58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if( !$this->is_post_editor_screen() ) { |
|
62 | + if ( ! $this->is_post_editor_screen() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | ?> |
66 | - <a href="#TB_inline?width=480&inlineId=select_gravityview_view&width=600&height=800" class="thickbox button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
66 | + <a href="#TB_inline?width=480&inlineId=select_gravityview_view&width=600&height=800" class="thickbox button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
67 | 67 | <?php |
68 | 68 | |
69 | 69 | } |
@@ -79,17 +79,17 @@ discard block |
||
79 | 79 | function add_shortcode_popup() { |
80 | 80 | global $post; |
81 | 81 | |
82 | - if( !$this->is_post_editor_screen() ) { |
|
82 | + if ( ! $this->is_post_editor_screen() ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - $post_type = get_post_type_object($post->post_type); |
|
86 | + $post_type = get_post_type_object( $post->post_type ); |
|
87 | 87 | |
88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
89 | 89 | |
90 | 90 | // If there are no views set up yet, we get outta here. |
91 | - if( empty( $views ) ) { |
|
92 | - echo '<div id="select_gravityview_view"><div class="wrap">'. GravityView_Post_Types::no_views_text() .'</div></div>'; |
|
91 | + if ( empty( $views ) ) { |
|
92 | + echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Post_Types::no_views_text() . '</div></div>'; |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://gravityview.co/support/documentation/202934188/" target="_blank">', '</a>' ); ?></p> |
|
102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://gravityview.co/support/documentation/202934188/" target="_blank">', '</a>' ); ?></p> |
|
103 | 103 | |
104 | 104 | <div> |
105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
109 | 109 | <?php |
110 | - foreach( $views as $view ) { |
|
111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
110 | + foreach ( $views as $view ) { |
|
111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $settings as $key => $setting ) { |
127 | 127 | |
128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
129 | 129 | |
130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </table> |
135 | 135 | |
136 | 136 | <div class="submit"> |
137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
139 | 139 | </div> |
140 | 140 | |
141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function add_scripts_and_styles() { |
158 | 158 | |
159 | - if( ! $this->is_post_editor_screen() ) { |
|
159 | + if ( ! $this->is_post_editor_screen() ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | |
168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
169 | 169 | |
170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
171 | 171 | |
172 | 172 | //enqueue styles |
173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
175 | 175 | |
176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
177 | 177 | |
178 | 178 | // custom js |
179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
185 | - )); |
|
184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
185 | + ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | function get_sortable_fields() { |
199 | 199 | |
200 | 200 | // Not properly formatted request |
201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
202 | 202 | exit( false ); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Not valid request |
206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
207 | 207 | exit( false ); |
208 | 208 | } |
209 | 209 | |
210 | - $viewid = (int)$_POST['viewid']; |
|
210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
211 | 211 | |
212 | 212 | // fetch form id assigned to the view |
213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | // Load even when invalid to allow for export |
20 | 20 | add_action( 'init', array( 'GravityView_Post_Types', 'init_post_types' ) ); |
21 | 21 | |
22 | - if( GravityView_Compatibility::is_valid() ) { |
|
22 | + if ( GravityView_Compatibility::is_valid() ) { |
|
23 | 23 | add_action( 'init', array( 'GravityView_Post_Types', 'init_rewrite' ) ); |
24 | 24 | } |
25 | 25 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | $supports = array( 'title', 'revisions' ); |
45 | 45 | |
46 | - if( $is_hierarchical ) { |
|
47 | - $supports[] = 'page-attributes'; |
|
46 | + if ( $is_hierarchical ) { |
|
47 | + $supports[ ] = 'page-attributes'; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | */ |
160 | 160 | static function no_views_text() { |
161 | 161 | |
162 | - if( !class_exists( 'GravityView_Admin' ) ) { |
|
163 | - require_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
162 | + if ( ! class_exists( 'GravityView_Admin' ) ) { |
|
163 | + require_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | // Floaty the astronaut |
167 | 167 | $image = GravityView_Admin::get_floaty(); |
168 | 168 | |
169 | - if( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
|
169 | + if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
|
170 | 170 | $output = sprintf( esc_attr__( "%sYou don't have any active views. Let’s go %screate one%s!%s\n\nIf you feel like you're lost in space and need help getting started, check out the %sGetting Started%s page.", 'gravityview' ), '<h3>', '<a href="' . admin_url( 'post-new.php?post_type=gravityview' ) . '">', '</a>', '</h3>', '<a href="' . admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) . '">', '</a>' ); |
171 | 171 | } else { |
172 | 172 | $output = esc_attr__( 'There are no active Views', 'gravityview' ); |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | 'slug' => 'edit', |
25 | 25 | 'type' => 'internal', |
26 | 26 | 'label' => __( 'Edit Table', 'gravityview' ), |
27 | - 'description' => __('Display items in a table view.', 'gravityview'), |
|
28 | - 'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE), |
|
29 | - 'css_source' => plugins_url('templates/css/table-view.css', GRAVITYVIEW_FILE), |
|
27 | + 'description' => __( 'Display items in a table view.', 'gravityview' ), |
|
28 | + 'logo' => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ), |
|
29 | + 'css_source' => plugins_url( 'templates/css/table-view.css', GRAVITYVIEW_FILE ), |
|
30 | 30 | ); |
31 | 31 | |
32 | 32 | $settings = wp_parse_args( $settings, $edit_settings ); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | '1-1' => array( |
43 | 43 | array( |
44 | 44 | 'areaid' => 'edit-fields', |
45 | - 'title' => __('Visible Edit Fields', 'gravityview' ) |
|
45 | + 'title' => __( 'Visible Edit Fields', 'gravityview' ) |
|
46 | 46 | ) |
47 | 47 | ) |
48 | 48 | ) |
@@ -22,27 +22,27 @@ |
||
22 | 22 | |
23 | 23 | <?php // list all the available templates (type= fresh or custom ) ?> |
24 | 24 | <div class="gv-grid"> |
25 | - <?php foreach( $templates as $id => $template ) { |
|
25 | + <?php foreach ( $templates as $id => $template ) { |
|
26 | 26 | $selected = ( $id == $current_template ) ? ' gv-selected' : ''; ?> |
27 | 27 | |
28 | 28 | <div class="gv-grid-col-1-3"> |
29 | - <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>"> |
|
29 | + <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>"> |
|
30 | 30 | <div class="gv-view-types-hover"> |
31 | 31 | <div> |
32 | - <?php if( !empty( $template['buy_source'] ) ) { ?> |
|
33 | - <p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p> |
|
32 | + <?php if ( ! empty( $template[ 'buy_source' ] ) ) { ?> |
|
33 | + <p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p> |
|
34 | 34 | <?php } else { ?> |
35 | - <p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p> |
|
36 | - <?php if( !empty( $template['preview'] ) ) { ?> |
|
37 | - <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> |
|
35 | + <p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></a></p> |
|
36 | + <?php if ( ! empty( $template[ 'preview' ] ) ) { ?> |
|
37 | + <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> |
|
38 | 38 | <?php } ?> |
39 | 39 | <?php } ?> |
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | <div class="gv-view-types-normal"> |
43 | - <img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>"> |
|
44 | - <h5><?php echo esc_attr( $template['label'] ); ?></h5> |
|
45 | - <p class="description"><?php echo esc_attr( $template['description'] ); ?></p> |
|
43 | + <img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>"> |
|
44 | + <h5><?php echo esc_attr( $template[ 'label' ] ); ?></h5> |
|
45 | + <p class="description"><?php echo esc_attr( $template[ 'description' ] ); ?></p> |
|
46 | 46 | </div> |
47 | 47 | </div> |
48 | 48 | </div> |