@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | * @param mixed $field_id Field ID or Field array |
| 334 | 334 | * @return string field type |
| 335 | 335 | */ |
| 336 | -function gravityview_get_field_type( $form = null , $field_id = '' ) { |
|
| 337 | - return GVCommon::get_field_type( $form, $field_id ); |
|
| 336 | +function gravityview_get_field_type( $form = null, $field_id = '' ) { |
|
| 337 | + return GVCommon::get_field_type( $form, $field_id ); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | |
@@ -347,8 +347,8 @@ discard block |
||
| 347 | 347 | * @return string HTML of the output. Empty string if $view_id is empty. |
| 348 | 348 | */ |
| 349 | 349 | function get_gravityview( $view_id = '', $atts = array() ) { |
| 350 | - if( !empty( $view_id ) ) { |
|
| 351 | - $atts['id'] = $view_id; |
|
| 350 | + if ( ! empty( $view_id ) ) { |
|
| 351 | + $atts[ 'id' ] = $view_id; |
|
| 352 | 352 | $args = wp_parse_args( $atts, \GV\View_Settings::defaults() ); |
| 353 | 353 | $GravityView_frontend = GravityView_frontend::getInstance(); |
| 354 | 354 | $GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) ); |
@@ -391,19 +391,19 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) { |
| 393 | 393 | |
| 394 | - if( class_exists('GFFormsModel') && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 394 | + if ( class_exists( 'GFFormsModel' ) && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 395 | 395 | |
| 396 | 396 | /** @var GF_Field_Radio|GF_Field_Checkbox $form_field */ |
| 397 | - foreach( $form_fields as $form_field ) { |
|
| 397 | + foreach ( $form_fields as $form_field ) { |
|
| 398 | 398 | $field_id = $form_field->id; |
| 399 | - foreach( $view_fields as $zone ) { |
|
| 399 | + foreach ( $view_fields as $zone ) { |
|
| 400 | 400 | |
| 401 | 401 | // ACF compatibility; ACF-added fields aren't arrays |
| 402 | 402 | if ( ! is_array( $zone ) ) { continue; } |
| 403 | 403 | |
| 404 | - foreach( $zone as $field ) { |
|
| 404 | + foreach ( $zone as $field ) { |
|
| 405 | 405 | // If it's an input, not the parent and the parent ID matches a checkbox or radio |
| 406 | - if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) { |
|
| 406 | + if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) { |
|
| 407 | 407 | return true; |
| 408 | 408 | } |
| 409 | 409 | } |
@@ -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=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js 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=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js 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,16 +79,16 @@ 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 ) ) { |
|
| 91 | + if ( empty( $views ) ) { |
|
| 92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
| 93 | 93 | return; |
| 94 | 94 | } |
@@ -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="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</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="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</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 ); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | private function add_hooks() { |
| 38 | 38 | /** @see \GV\Field::get_value_filters */ |
| 39 | 39 | add_filter( "gravityview/field/{$this->name}/output", array( $this, 'get_content' ), 4, 2 ); |
| 40 | - add_action( 'gravityview/template/after', array( $this, 'print_script'), 10, 1 ); |
|
| 40 | + add_action( 'gravityview/template/after', array( $this, 'print_script' ), 10, 1 ); |
|
| 41 | 41 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | function add_default_field( $entry_default_fields = array(), $form = array(), $zone = '' ) { |
| 54 | 54 | |
| 55 | - if( 'edit' !== $zone ) { |
|
| 55 | + if ( 'edit' !== $zone ) { |
|
| 56 | 56 | $entry_default_fields[ $this->name ] = array( |
| 57 | 57 | 'label' => $this->label, |
| 58 | 58 | 'desc' => $this->description, |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function get_content( $output, $template ) { |
| 77 | 77 | $entry = $template->entry; |
| 78 | 78 | |
| 79 | - $star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png'; |
|
| 79 | + $star_url = GFCommon::get_base_url() . '/images/star' . intval( $entry[ 'is_starred' ] ) . '.png'; |
|
| 80 | 80 | |
| 81 | 81 | $entry_id = ''; |
| 82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // if( $show_as_star ) |
| 88 | - $output = '<img class="gv-star-image" '.$entry_id.' data-is_starred="'. intval( $entry['is_starred'] ) .'" src="'. esc_attr( $star_url ) .'" />'; |
|
| 88 | + $output = '<img class="gv-star-image" ' . $entry_id . ' data-is_starred="' . intval( $entry[ 'is_starred' ] ) . '" src="' . esc_attr( $star_url ) . '" />'; |
|
| 89 | 89 | |
| 90 | 90 | self::$has_star_field = true; |
| 91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function print_script( $context ) { |
| 104 | 104 | |
| 105 | - if( ! self::$has_star_field ) { |
|
| 105 | + if ( ! self::$has_star_field ) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
| 50 | 50 | |
| 51 | 51 | /** Overridden by a template. */ |
| 52 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
| 52 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
| 53 | 53 | |
| 54 | 54 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
| 55 | 55 | $return = GFCommon::to_money( $amount, \GV\Utils::get( $entry, 'currency' ) ); |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
| 90 | 90 | */ |
| 91 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 91 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 92 | 92 | |
| 93 | 93 | $return = $text; |
| 94 | 94 | |
| 95 | 95 | foreach ( $matches as $match ) { |
| 96 | 96 | |
| 97 | - $full_tag = $match[0]; |
|
| 98 | - $modifier = isset( $match[1] ) ? $match[1] : false; |
|
| 97 | + $full_tag = $match[ 0 ]; |
|
| 98 | + $modifier = isset( $match[ 1 ] ) ? $match[ 1 ] : false; |
|
| 99 | 99 | |
| 100 | 100 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
| 101 | 101 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function get_content( $output, $entry = array(), $field_settings = array(), $field = array() ) { |
| 61 | 61 | |
| 62 | 62 | /** Overridden by a template. */ |
| 63 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
| 63 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
| 64 | 64 | |
| 65 | 65 | return $this->get_string_from_value( $output ); |
| 66 | 66 | } |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | switch ( intval( $value ) ) { |
| 93 | 93 | case self::NOT_FULFILLED: |
| 94 | 94 | default: |
| 95 | - $return = __('Not Fulfilled', 'gravityview'); |
|
| 95 | + $return = __( 'Not Fulfilled', 'gravityview' ); |
|
| 96 | 96 | break; |
| 97 | 97 | |
| 98 | 98 | case self::FULFILLED: |
| 99 | - $return = __('Fulfilled', 'gravityview'); |
|
| 99 | + $return = __( 'Fulfilled', 'gravityview' ); |
|
| 100 | 100 | break; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return string Original text if {is_fulfilled} isn't found. Otherwise, "Not Fulfilled" or "Fulfilled" |
| 118 | 118 | */ |
| 119 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 119 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 120 | 120 | |
| 121 | 121 | $return = $text; |
| 122 | 122 | |
| 123 | 123 | foreach ( $matches as $match ) { |
| 124 | 124 | |
| 125 | - $full_tag = $match[0]; |
|
| 125 | + $full_tag = $match[ 0 ]; |
|
| 126 | 126 | |
| 127 | 127 | $fulfilled = \GV\Utils::get( $entry, 'is_fulfilled' ); |
| 128 | 128 | |
@@ -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 ); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @var array |
| 87 | 87 | */ |
| 88 | - private $template_data_var_names = array('data'); |
|
| 88 | + private $template_data_var_names = array( 'data' ); |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Clean up template data. |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | public function set_template_data( $data, $var_name = 'data' ) { |
| 139 | 139 | global $wp_query; |
| 140 | 140 | |
| 141 | - $wp_query->query_vars[ $var_name ] = (object) $data; |
|
| 141 | + $wp_query->query_vars[ $var_name ] = (object)$data; |
|
| 142 | 142 | |
| 143 | 143 | // Add $var_name to custom variable store if not default value |
| 144 | - if( $var_name !== 'data' ) { |
|
| 145 | - $this->template_data_var_names[] = $var_name; |
|
| 144 | + if ( $var_name !== 'data' ) { |
|
| 145 | + $this->template_data_var_names[ ] = $var_name; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | return $this; |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | // Remove each custom data reference from $wp_query |
| 167 | 167 | foreach ( $custom_var_names as $var ) { |
| 168 | - if ( isset( $wp_query->query_vars[$var] ) ) { |
|
| 169 | - unset( $wp_query->query_vars[$var] ); |
|
| 168 | + if ( isset( $wp_query->query_vars[ $var ] ) ) { |
|
| 169 | + unset( $wp_query->query_vars[ $var ] ); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | protected function get_template_file_names( $slug, $name ) { |
| 187 | 187 | $templates = array(); |
| 188 | 188 | if ( isset( $name ) ) { |
| 189 | - $templates[] = $slug . '-' . $name . '.php'; |
|
| 189 | + $templates[ ] = $slug . '-' . $name . '.php'; |
|
| 190 | 190 | } |
| 191 | - $templates[] = $slug . '.php'; |
|
| 191 | + $templates[ ] = $slug . '.php'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * Allow template choices to be filtered. |
@@ -224,18 +224,18 @@ discard block |
||
| 224 | 224 | public function locate_template( $template_names, $load = false, $require_once = true ) { |
| 225 | 225 | |
| 226 | 226 | // Use $template_names as a cache key - either first element of array or the variable itself if it's a string |
| 227 | - $cache_key = is_array( $template_names ) ? $template_names[0] : $template_names; |
|
| 227 | + $cache_key = is_array( $template_names ) ? $template_names[ 0 ] : $template_names; |
|
| 228 | 228 | |
| 229 | 229 | // If the key is in the cache array, we've already located this file. |
| 230 | - if ( isset( $this->template_path_cache[$cache_key] ) ) { |
|
| 231 | - $located = $this->template_path_cache[$cache_key]; |
|
| 230 | + if ( isset( $this->template_path_cache[ $cache_key ] ) ) { |
|
| 231 | + $located = $this->template_path_cache[ $cache_key ]; |
|
| 232 | 232 | } else { |
| 233 | 233 | |
| 234 | 234 | // No file found yet. |
| 235 | 235 | $located = false; |
| 236 | 236 | |
| 237 | 237 | // Remove empty entries. |
| 238 | - $template_names = array_filter( (array) $template_names ); |
|
| 238 | + $template_names = array_filter( (array)$template_names ); |
|
| 239 | 239 | $template_paths = $this->get_template_paths(); |
| 240 | 240 | |
| 241 | 241 | // Try to find a template file. |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | if ( file_exists( $template_path . $template_name ) ) { |
| 249 | 249 | $located = $template_path . $template_name; |
| 250 | 250 | // Store the template path in the cache |
| 251 | - $this->template_path_cache[$cache_key] = $located; |
|
| 251 | + $this->template_path_cache[ $cache_key ] = $located; |
|
| 252 | 252 | break 2; |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | // Only add this conditionally, so non-child themes don't redundantly check active theme twice. |
| 285 | 285 | if ( get_stylesheet_directory() !== get_template_directory() ) { |
| 286 | - $file_paths[1] = trailingslashit( get_stylesheet_directory() ) . $theme_directory; |
|
| 286 | + $file_paths[ 1 ] = trailingslashit( get_stylesheet_directory() ) . $theme_directory; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | private function maybe_add_hooks() { |
| 111 | 111 | $class_exists = $this->class_name && class_exists( $this->class_name ); |
| 112 | 112 | $function_exists = $this->function_name && function_exists( $this->function_name ); |
| 113 | - $constant_defined = $this->constant_name && defined("{$this->constant_name}"); |
|
| 113 | + $constant_defined = $this->constant_name && defined( "{$this->constant_name}" ); |
|
| 114 | 114 | |
| 115 | - if( $class_exists || $function_exists || $constant_defined ) { |
|
| 115 | + if ( $class_exists || $function_exists || $constant_defined ) { |
|
| 116 | 116 | $this->add_hooks(); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -124,23 +124,23 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | protected function add_hooks() { |
| 126 | 126 | |
| 127 | - if( $this->meta_keys ) { |
|
| 127 | + if ( $this->meta_keys ) { |
|
| 128 | 128 | add_filter( 'gravityview/data/parse/meta_keys', array( $this, 'merge_meta_keys' ), 10, 2 ); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if( $this->content_meta_keys ) { |
|
| 131 | + if ( $this->content_meta_keys ) { |
|
| 132 | 132 | add_filter( 'gravityview/view_collection/from_post/meta_keys', array( $this, 'merge_content_meta_keys' ), 10, 3 ); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if( $this->script_handles ) { |
|
| 135 | + if ( $this->script_handles ) { |
|
| 136 | 136 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'merge_noconflict_scripts' ) ); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if( $this->style_handles ) { |
|
| 139 | + if ( $this->style_handles ) { |
|
| 140 | 140 | add_filter( 'gravityview_noconflict_styles', array( $this, 'merge_noconflict_styles' ) ); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if( $this->post_type_support ) { |
|
| 143 | + if ( $this->post_type_support ) { |
|
| 144 | 144 | add_filter( 'gravityview_post_type_support', array( $this, 'merge_post_type_support' ), 10, 2 ); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -39,19 +39,19 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | function merge_content_meta_keys( $meta_keys = array(), $post = null, & $views = null ) { |
| 41 | 41 | |
| 42 | - if( empty( $post->panels_data ) || empty( $post->panels_data['widgets'] ) ) { |
|
| 42 | + if ( empty( $post->panels_data ) || empty( $post->panels_data[ 'widgets' ] ) ) { |
|
| 43 | 43 | return $meta_keys; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - foreach ( (array) $post->panels_data['widgets'] as $widget ) { |
|
| 46 | + foreach ( (array)$post->panels_data[ 'widgets' ] as $widget ) { |
|
| 47 | 47 | |
| 48 | 48 | $views->merge( \GV\View_Collection::from_content( \GV\Utils::get( $widget, 'text' ) ) ); |
| 49 | 49 | |
| 50 | - if ( empty( $widget['tabs'] ) || ! is_array( $widget['tabs'] ) ) { |
|
| 50 | + if ( empty( $widget[ 'tabs' ] ) || ! is_array( $widget[ 'tabs' ] ) ) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - foreach ( $widget['tabs'] as $tab ) { |
|
| 54 | + foreach ( $widget[ 'tabs' ] as $tab ) { |
|
| 55 | 55 | |
| 56 | 56 | // Livemesh Tabs |
| 57 | 57 | $backup = \GV\Utils::get( $tab, 'tab_content' ); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // SiteOrigin Tabs |
| 60 | 60 | $content = \GV\Utils::get( $tab, 'content_text', $backup ); |
| 61 | 61 | |
| 62 | - if( $content ) { |
|
| 62 | + if ( $content ) { |
|
| 63 | 63 | $views->merge( \GV\View_Collection::from_content( $content ) ); |
| 64 | 64 | } |
| 65 | 65 | } |