@@ -34,7 +34,7 @@ |
||
| 34 | 34 | global $post; |
| 35 | 35 | |
| 36 | 36 | if ( $post ) { |
| 37 | - $context['post'] = $post; |
|
| 37 | + $context[ 'post' ] = $post; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | \GV\Mocks\Legacy_Context::push( $context ); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | wp_embed_register_handler( 'gravityview_entry', self::get_entry_regex(), array( __CLASS__, 'render' ), 20000 ); |
| 27 | 27 | wp_oembed_add_provider( self::get_entry_regex(), self::$provider_url, true ); |
| 28 | 28 | |
| 29 | - if ( ! empty( $_GET['gv_oembed_provider'] ) && ! empty( $_GET['url'] ) ) { |
|
| 29 | + if ( ! empty( $_GET[ 'gv_oembed_provider' ] ) && ! empty( $_GET[ 'url' ] ) ) { |
|
| 30 | 30 | add_action( 'template_redirect', array( __CLASS__, 'render_provider_request' ) ); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | 45 | public static function render_provider_request() { |
| 46 | - if ( ! empty( $_GET['url'] ) ) { |
|
| 47 | - $url = $_GET['url']; |
|
| 46 | + if ( ! empty( $_GET[ 'url' ] ) ) { |
|
| 47 | + $url = $_GET[ 'url' ]; |
|
| 48 | 48 | } else { |
| 49 | 49 | header( 'HTTP/1.0 404 Not Found' ); |
| 50 | 50 | exit; |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | private static function parse_matches( $matches, $url ) { |
| 113 | 113 | // If not using permalinks, re-assign values for matching groups |
| 114 | - if ( ! empty( $matches['entry_slug2'] ) ) { |
|
| 115 | - $matches['is_cpt'] = $matches['is_cpt2']; |
|
| 116 | - $matches['slug'] = $matches['slug2']; |
|
| 117 | - $matches['entry_slug'] = $matches['entry_slug2']; |
|
| 118 | - unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] ); |
|
| 114 | + if ( ! empty( $matches[ 'entry_slug2' ] ) ) { |
|
| 115 | + $matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ]; |
|
| 116 | + $matches[ 'slug' ] = $matches[ 'slug2' ]; |
|
| 117 | + $matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ]; |
|
| 118 | + unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] ); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ( empty( $matches['entry_slug'] ) ) { |
|
| 121 | + if ( empty( $matches[ 'entry_slug' ] ) ) { |
|
| 122 | 122 | gravityview()->log->error( 'Entry slug not parsed by regex.', array( 'data' => $matches ) ); |
| 123 | 123 | return null; |
| 124 | 124 | } else { |
| 125 | - $entry_id = $matches['entry_slug']; |
|
| 125 | + $entry_id = $matches[ 'entry_slug' ]; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if ( ! $entry = \GV\GF_Entry::by_id( $entry_id ) ) { |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if ( ! $view_id = url_to_postid( $url ) ) { |
| 134 | - $view = \GV\View::from_post( get_page_by_path( $matches['slug'], OBJECT, 'gravityview' ) ); |
|
| 134 | + $view = \GV\View::from_post( get_page_by_path( $matches[ 'slug' ], OBJECT, 'gravityview' ) ); |
|
| 135 | 135 | } else { |
| 136 | 136 | $view = \GV\View::by_id( $view_id ); |
| 137 | 137 | } |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | return ' |
| 165 | 165 | <div class="loading-placeholder" style="background-color:#e6f0f5;"> |
| 166 | - <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3> |
|
| 166 | + <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3> |
|
| 167 | 167 | <p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;"> |
| 168 | - '.$embed_text.' |
|
| 168 | + '.$embed_text . ' |
|
| 169 | 169 | </p> |
| 170 | 170 | <br style="clear: both;"> |
| 171 | 171 | </div>'; |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | private static function render_preview_notice() { |
| 180 | 180 | $floaty = \GravityView_Admin::get_floaty(); |
| 181 | 181 | $title = esc_html__( 'This will look better when it is embedded.', 'gravityview' ); |
| 182 | - $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview'); |
|
| 183 | - return '<div class="updated notice">'.$floaty.'<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>'; |
|
| 182 | + $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' ); |
|
| 183 | + return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>'; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if ( $entry['status'] != 'active' ) { |
|
| 202 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 203 | 203 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 204 | 204 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | if ( $view->settings->get( 'show_only_approved' ) ) { |
| 208 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 208 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 209 | 209 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 210 | 210 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 211 | 211 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | // Catch either |
| 270 | 270 | $match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})"; |
| 271 | 271 | |
| 272 | - return '#'.$match_regex.'#i'; |
|
| 272 | + return '#' . $match_regex . '#i'; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | do_action( 'gravityview/template/list/body/before', $context ); |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | - * @action `gravityview_list_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
| 148 | - * @deprecated Use `gravityview/template/list/body/before` |
|
| 149 | - * @since 1.0.7 |
|
| 150 | - * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
| 151 | - */ |
|
| 147 | + * @action `gravityview_list_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows. |
|
| 148 | + * @deprecated Use `gravityview/template/list/body/before` |
|
| 149 | + * @since 1.0.7 |
|
| 150 | + * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
| 151 | + */ |
|
| 152 | 152 | do_action( 'gravityview_list_body_before', \GravityView_View::getInstance() /** ugh! */ ); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | do_action( 'gravityview/template/list/body/after', $context ); |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | - * @action `gravityview_list_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
| 174 | - * @deprecated Use `gravityview/template/list/body/after` |
|
| 175 | - * @since 1.0.7 |
|
| 176 | - * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
| 177 | - */ |
|
| 173 | + * @action `gravityview_list_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows. |
|
| 174 | + * @deprecated Use `gravityview/template/list/body/after` |
|
| 175 | + * @since 1.0.7 |
|
| 176 | + * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
| 177 | + */ |
|
| 178 | 178 | do_action( 'gravityview_list_body_after', \GravityView_View::getInstance() /** ugh! */ ); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -205,11 +205,11 @@ discard block |
||
| 205 | 205 | $zone = str_replace( '/', '_', $zone ); |
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | - * @action `gravityview_list_entry_$zone_before` Inside the `entry`, before any rows are rendered. Can be used to insert additional rows. |
|
| 209 | - * @deprecated Use `gravityview/template/list/entry/$zone/before` |
|
| 210 | - * @since 1.0.7 |
|
| 211 | - * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
| 212 | - */ |
|
| 208 | + * @action `gravityview_list_entry_$zone_before` Inside the `entry`, before any rows are rendered. Can be used to insert additional rows. |
|
| 209 | + * @deprecated Use `gravityview/template/list/entry/$zone/before` |
|
| 210 | + * @since 1.0.7 |
|
| 211 | + * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
| 212 | + */ |
|
| 213 | 213 | do_action( sprintf( 'gravityview_list_entry%sbefore', $zone ), $entry->as_entry(), \GravityView_View::getInstance() /** ugh! */ ); |
| 214 | 214 | } |
| 215 | 215 | |
@@ -240,11 +240,11 @@ discard block |
||
| 240 | 240 | $zone = str_replace( '/', '_', $zone ); |
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | - * @action `gravityview_list_entry_$zone_after` Inside the `entry`, after any rows are rendered. Can be used to insert additional rows. |
|
| 244 | - * @deprecated Use `gravityview/template/list/entry/after` |
|
| 245 | - * @since 1.0.7 |
|
| 246 | - * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
| 247 | - */ |
|
| 243 | + * @action `gravityview_list_entry_$zone_after` Inside the `entry`, after any rows are rendered. Can be used to insert additional rows. |
|
| 244 | + * @deprecated Use `gravityview/template/list/entry/after` |
|
| 245 | + * @since 1.0.7 |
|
| 246 | + * @param GravityView_View $gravityview_view Current GravityView_View object. |
|
| 247 | + */ |
|
| 248 | 248 | do_action( sprintf( 'gravityview_list_entry%safter', $zone ), $entry->as_entry(), \GravityView_View::getInstance() /** ugh! */ ); |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -64,9 +64,9 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | $hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context ); |
| 66 | 66 | |
| 67 | - $extras['hide_empty'] = $hide_empty; |
|
| 68 | - $extras['label'] = $label; |
|
| 69 | - $extras['value'] = $value; |
|
| 67 | + $extras[ 'hide_empty' ] = $hide_empty; |
|
| 68 | + $extras[ 'label' ] = $label; |
|
| 69 | + $extras[ 'value' ] = $value; |
|
| 70 | 70 | |
| 71 | 71 | return \gravityview_field_output( $extras, $context ); |
| 72 | 72 | } |
@@ -146,59 +146,59 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | if ( $this->request && $this->request->is_view() && $post ) { |
| 148 | 148 | if ( $this->field && $this->field->type ) { |
| 149 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->field->type, $slug_name ); |
|
| 150 | - $this->field->inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->field->inputType, $slug_name ); |
|
| 151 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->field->type ); |
|
| 152 | - $this->field->inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->field->inputType ); |
|
| 153 | - $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $this->field->type, $slug_name ); |
|
| 154 | - $this->field->inputType && $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $this->field->inputType, $slug_name ); |
|
| 155 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $this->field->type ); |
|
| 156 | - $this->field->inputType && $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $this->field->inputType ); |
|
| 149 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->field->type, $slug_name ); |
|
| 150 | + $this->field->inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->field->inputType, $slug_name ); |
|
| 151 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->field->type ); |
|
| 152 | + $this->field->inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->field->inputType ); |
|
| 153 | + $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $this->field->type, $slug_name ); |
|
| 154 | + $this->field->inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $this->field->inputType, $slug_name ); |
|
| 155 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $this->field->type ); |
|
| 156 | + $this->field->inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $this->field->inputType ); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
| 160 | - $specifics []= sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $this->view->ID ); |
|
| 161 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 162 | - $specifics []= sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
| 159 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
| 160 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $this->view->ID ); |
|
| 161 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 162 | + $specifics [ ] = sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** Field-specific */ |
| 166 | 166 | if ( $this->field && $this->view ) { |
| 167 | 167 | |
| 168 | 168 | if ( $this->field->ID ) { |
| 169 | - $specifics []= sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $this->view->form->ID, $this->field->ID, $slug_name ); |
|
| 170 | - $specifics []= sprintf( '%sform-%d-field-%d.php', $slug_dir, $this->view->form->ID, $this->field->ID ); |
|
| 169 | + $specifics [ ] = sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $this->view->form->ID, $this->field->ID, $slug_name ); |
|
| 170 | + $specifics [ ] = sprintf( '%sform-%d-field-%d.php', $slug_dir, $this->view->form->ID, $this->field->ID ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if ( $this->field->type ) { |
| 174 | - $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $this->view->form->ID, $this->field->type, $slug_name ); |
|
| 175 | - $this->field->inputType && $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $this->view->form->ID, $this->field->inputType, $slug_name ); |
|
| 176 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $this->view->form->ID, $this->field->type ); |
|
| 177 | - $this->field->inputType && $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $this->view->form->ID, $this->field->inputType ); |
|
| 178 | - |
|
| 179 | - $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $this->view->ID, $this->field->type, $slug_name ); |
|
| 180 | - $this->field->inputType && $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $this->view->ID, $this->field->inputType, $slug_name ); |
|
| 181 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $this->view->ID, $this->field->type ); |
|
| 182 | - $this->field->inputType && $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $this->view->ID, $this->field->inputType ); |
|
| 183 | - |
|
| 184 | - $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $this->field->type, $slug_name ); |
|
| 185 | - $this->field->inputType && $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $this->field->inputType, $slug_name ); |
|
| 186 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $this->field->type ); |
|
| 187 | - $this->field->inputType && $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $this->field->inputType ); |
|
| 174 | + $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $this->view->form->ID, $this->field->type, $slug_name ); |
|
| 175 | + $this->field->inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $this->view->form->ID, $this->field->inputType, $slug_name ); |
|
| 176 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $this->view->form->ID, $this->field->type ); |
|
| 177 | + $this->field->inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $this->view->form->ID, $this->field->inputType ); |
|
| 178 | + |
|
| 179 | + $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $this->view->ID, $this->field->type, $slug_name ); |
|
| 180 | + $this->field->inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $this->view->ID, $this->field->inputType, $slug_name ); |
|
| 181 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $this->view->ID, $this->field->type ); |
|
| 182 | + $this->field->inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $this->view->ID, $this->field->inputType ); |
|
| 183 | + |
|
| 184 | + $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $this->field->type, $slug_name ); |
|
| 185 | + $this->field->inputType && $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $this->field->inputType, $slug_name ); |
|
| 186 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $this->field->type ); |
|
| 187 | + $this->field->inputType && $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $this->field->inputType ); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if ( $this->view ) { |
| 192 | 192 | /** Generic field templates */ |
| 193 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
| 194 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
| 193 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
| 194 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
| 195 | 195 | |
| 196 | - $specifics []= sprintf( '%sview-%d-field.php', $slug_dir, $this->view->ID ); |
|
| 197 | - $specifics []= sprintf( '%sform-%d-field.php', $slug_dir, $this->view->form->ID ); |
|
| 196 | + $specifics [ ] = sprintf( '%sview-%d-field.php', $slug_dir, $this->view->ID ); |
|
| 197 | + $specifics [ ] = sprintf( '%sform-%d-field.php', $slug_dir, $this->view->form->ID ); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
| 201 | - $specifics []= sprintf( '%sfield.php', $slug_dir ); |
|
| 200 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
| 201 | + $specifics [ ] = sprintf( '%sfield.php', $slug_dir ); |
|
| 202 | 202 | |
| 203 | 203 | |
| 204 | 204 | return array_merge( $specifics, $templates ); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | /** Prevent any PHP warnings that may be generated. */ |
| 225 | 225 | ob_start(); |
| 226 | 226 | |
| 227 | - $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $this->entry['currency'], false, 'html' ); |
|
| 227 | + $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $this->entry[ 'currency' ], false, 'html' ); |
|
| 228 | 228 | |
| 229 | 229 | if ( $errors = ob_get_clean() ) { |
| 230 | 230 | gravityview()->log->error( 'Errors when calling GFCommon::get_lead_field_display()', array( 'data' => $errors ) ); |
@@ -113,14 +113,14 @@ |
||
| 113 | 113 | |
| 114 | 114 | /** Require critical legacy core files. @todo Deprecate */ |
| 115 | 115 | require_once $this->plugin->dir( 'includes/helper-functions.php' ); |
| 116 | - require_once $this->plugin->dir( 'includes/class-common.php'); |
|
| 117 | - require_once $this->plugin->dir( 'includes/connector-functions.php'); |
|
| 116 | + require_once $this->plugin->dir( 'includes/class-common.php' ); |
|
| 117 | + require_once $this->plugin->dir( 'includes/connector-functions.php' ); |
|
| 118 | 118 | require_once $this->plugin->dir( 'includes/class-gravityview-compatibility.php' ); |
| 119 | 119 | require_once $this->plugin->dir( 'includes/class-gravityview-roles-capabilities.php' ); |
| 120 | 120 | require_once $this->plugin->dir( 'includes/class-gravityview-admin-notices.php' ); |
| 121 | 121 | require_once $this->plugin->dir( 'includes/class-admin.php' ); |
| 122 | - require_once $this->plugin->dir( 'includes/class-post-types.php'); |
|
| 123 | - require_once $this->plugin->dir( 'includes/class-cache.php'); |
|
| 122 | + require_once $this->plugin->dir( 'includes/class-post-types.php' ); |
|
| 123 | + require_once $this->plugin->dir( 'includes/class-cache.php' ); |
|
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * GravityView extensions and widgets. |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field). |
| 167 | 167 | */ |
| 168 | 168 | public static function from_configuration( $configuration ) { |
| 169 | - if ( empty( $configuration['id'] ) ) { |
|
| 169 | + if ( empty( $configuration[ 'id' ] ) ) { |
|
| 170 | 170 | $field = new self(); |
| 171 | 171 | gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) ); |
| 172 | 172 | $field->update_configuration( $configuration ); |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | } else { |
| 180 | 180 | $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); |
| 181 | 181 | } |
| 182 | - $trace = $trace[1]; |
|
| 183 | - if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) { |
|
| 182 | + $trace = $trace[ 1 ]; |
|
| 183 | + if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) { |
|
| 184 | 184 | $field = new self(); |
| 185 | 185 | gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' ); |
| 186 | 186 | $field->update_configuration( $configuration ); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** Determine the field implementation to use, and try to use. */ |
| 191 | - $field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 191 | + $field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @filter `gravityview/field/class` Filter the field class about to be created from the configuration. |
@@ -227,24 +227,24 @@ discard block |
||
| 227 | 227 | public function update_configuration( $configuration ) { |
| 228 | 228 | $configuration = wp_parse_args( $configuration, $this->as_configuration() ); |
| 229 | 229 | |
| 230 | - if ( $this->ID != $configuration['id'] ) { |
|
| 230 | + if ( $this->ID != $configuration[ 'id' ] ) { |
|
| 231 | 231 | /** Smelling trouble here... */ |
| 232 | 232 | gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) ); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $this->ID = $configuration['id']; |
|
| 236 | - $this->label = $configuration['label']; |
|
| 237 | - $this->show_label = $configuration['show_label'] == '1'; |
|
| 238 | - $this->custom_label = $configuration['custom_label']; |
|
| 239 | - $this->custom_class = $configuration['custom_class']; |
|
| 240 | - $this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : ''; |
|
| 241 | - $this->search_filter = $configuration['search_filter'] == '1'; |
|
| 242 | - $this->show_as_link = $configuration['show_as_link'] == '1'; |
|
| 235 | + $this->ID = $configuration[ 'id' ]; |
|
| 236 | + $this->label = $configuration[ 'label' ]; |
|
| 237 | + $this->show_label = $configuration[ 'show_label' ] == '1'; |
|
| 238 | + $this->custom_label = $configuration[ 'custom_label' ]; |
|
| 239 | + $this->custom_class = $configuration[ 'custom_class' ]; |
|
| 240 | + $this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : ''; |
|
| 241 | + $this->search_filter = $configuration[ 'search_filter' ] == '1'; |
|
| 242 | + $this->show_as_link = $configuration[ 'show_as_link' ] == '1'; |
|
| 243 | 243 | |
| 244 | 244 | /** Shared among all field types (sort of). */ |
| 245 | 245 | $shared_configuration_keys = array( |
| 246 | 246 | 'id', 'label', 'show_label', 'custom_label', 'custom_class', |
| 247 | - 'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 247 | + 'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 248 | 248 | ); |
| 249 | 249 | |
| 250 | 250 | /** Everything else goes into the properties for now. @todo subclasses! */ |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | public function get_label( View $view = null, Source $source = null, Entry $entry = null, Request $request = null ) { |
| 271 | 271 | /** A custom label is available. */ |
| 272 | 272 | if ( ! empty( $this->custom_label ) ) { |
| 273 | - return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null ); |
|
| 273 | + return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null ); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | return ''; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * @return mixed|null The value for the given configuration key, null if doesn't exist. |
| 348 | 348 | */ |
| 349 | 349 | public function __get( $key ) { |
| 350 | - switch( $key ): |
|
| 350 | + switch ( $key ): |
|
| 351 | 351 | default: |
| 352 | 352 | if ( isset( $this->configuration[ $key ] ) ) { |
| 353 | 353 | return $this->configuration[ $key ]; |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @return boolean Whether this $key is set or not. |
| 364 | 364 | */ |
| 365 | 365 | public function __isset( $key ) { |
| 366 | - switch( $key ): |
|
| 366 | + switch ( $key ): |
|
| 367 | 367 | default: |
| 368 | 368 | return isset( $this->configuration[ $key ] ); |
| 369 | 369 | endswitch; |
@@ -112,10 +112,10 @@ |
||
| 112 | 112 | */ |
| 113 | 113 | public function is_edit_entry() { |
| 114 | 114 | /** |
| 115 | - * @filter `gravityview_is_edit_entry` Whether we're currently on the Edit Entry screen \n |
|
| 116 | - * The Edit Entry functionality overrides this value. |
|
| 117 | - * @param boolean $is_edit_entry |
|
| 118 | - */ |
|
| 115 | + * @filter `gravityview_is_edit_entry` Whether we're currently on the Edit Entry screen \n |
|
| 116 | + * The Edit Entry functionality overrides this value. |
|
| 117 | + * @param boolean $is_edit_entry |
|
| 118 | + */ |
|
| 119 | 119 | if ( ( $entry = $this->is_entry() ) && apply_filters( 'gravityview_is_edit_entry', false ) ) { |
| 120 | 120 | return $entry; |
| 121 | 121 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public static function is_add_oembed_preview() { |
| 47 | 47 | /** The preview request is a parse-embed AJAX call without a type set. */ |
| 48 | - return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) ); |
|
| 48 | + return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @return boolean |
| 64 | 64 | */ |
| 65 | 65 | public static function is_rest() { |
| 66 | - return ! empty( $GLOBALS['wp']->query_vars['rest_route'] ); |
|
| 66 | + return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $get = $_GET; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - return $this->is_view() && ( isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ) ); |
|
| 144 | + return $this->is_view() && ( isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] ) ); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | if ( $this->field ) { |
| 79 | 79 | return array( |
| 80 | 80 | 'key' => $this->field->ID, |
| 81 | - 'direction' => $this->direction ? : self::ASC, |
|
| 81 | + 'direction' => $this->direction ?: self::ASC, |
|
| 82 | 82 | 'is_numeric' => self::ALPHA ? true : false, |
| 83 | 83 | ); |
| 84 | 84 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ( ! $entry instanceof Entry ) { |
| 45 | 45 | continue; |
| 46 | 46 | } |
| 47 | - $_entry->entries[ $entry['form_id'] ] = &$entry; |
|
| 47 | + $_entry->entries[ $entry[ 'form_id' ] ] = &$entry; |
|
| 48 | 48 | } |
| 49 | 49 | return $_entry; |
| 50 | 50 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | foreach ( $this->entries as $entry ) { |
| 67 | 67 | $entry = $entry->as_entry(); |
| 68 | - $_entry['_multi'][ $entry['form_id'] ] = $entry; |
|
| 68 | + $_entry[ '_multi' ][ $entry[ 'form_id' ] ] = $entry; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |