@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | - $class .= ' merge-tag-support mt-position-right '; |
|
| 31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | + $class .= ' merge-tag-support mt-position-right '; |
|
| 33 | 33 | |
| 34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
| 35 | - $class .= ' mt-hide_all_fields '; |
|
| 36 | - } |
|
| 37 | - } |
|
| 34 | + if( empty( $this->field['show_all_fields'] ) ) { |
|
| 35 | + $class .= ' mt-hide_all_fields '; |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | $class .= rgar( $this->field, 'class' ); |
| 40 | 40 | $placeholder = rgar( $this->field, 'placeholder' ); |
@@ -55,20 +55,20 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | function codemirror( $field_id = '' ) { |
| 57 | 57 | |
| 58 | - // Enqueue code editor and settings for manipulating HTML. |
|
| 59 | - $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
|
| 58 | + // Enqueue code editor and settings for manipulating HTML. |
|
| 59 | + $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
|
| 60 | 60 | |
| 61 | - // Bail if user disabled CodeMirror. |
|
| 62 | - if ( false === $settings ) { |
|
| 63 | - return; |
|
| 64 | - } |
|
| 61 | + // Bail if user disabled CodeMirror. |
|
| 62 | + if ( false === $settings ) { |
|
| 63 | + return; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - ?> |
|
| 66 | + ?> |
|
| 67 | 67 | |
| 68 | 68 | <script> |
| 69 | 69 | wp.codeEditor.initialize( "<?php echo $field_id;?>", {}); |
| 70 | 70 | </script> |
| 71 | 71 | <?php |
| 72 | - } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | ?> |
| 10 | 10 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 11 | 11 | |
| 12 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
| 12 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
| 13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
| 14 | 14 | ?><div> |
| 15 | 15 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | function render_input( $override_input = null ) { |
| 22 | - if( isset( $override_input ) ) { |
|
| 22 | + if ( isset( $override_input ) ) { |
|
| 23 | 23 | echo $override_input; |
| 24 | 24 | return; |
| 25 | 25 | } |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
| 32 | 32 | $class .= ' merge-tag-support mt-position-right '; |
| 33 | 33 | |
| 34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
| 34 | + if ( empty( $this->field[ 'show_all_fields' ] ) ) { |
|
| 35 | 35 | $class .= ' mt-hide_all_fields '; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | # $this->codemirror( $this->get_field_id() ); |
| 50 | 50 | |
| 51 | 51 | ?> |
| 52 | - <textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo absint( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
| 52 | + <textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo absint( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
| 53 | 53 | <?php |
| 54 | 54 | } |
| 55 | 55 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | ?> |
| 67 | 67 | |
| 68 | 68 | <script> |
| 69 | - wp.codeEditor.initialize( "<?php echo $field_id;?>", {}); |
|
| 69 | + wp.codeEditor.initialize( "<?php echo $field_id; ?>", {}); |
|
| 70 | 70 | </script> |
| 71 | 71 | <?php |
| 72 | 72 | } |
@@ -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 | } |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | $additional = array(); |
| 99 | 99 | |
| 100 | 100 | // form-19-table-body.php |
| 101 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
| 101 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
| 102 | 102 | |
| 103 | 103 | // view-3-table-body.php |
| 104 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
| 104 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
| 105 | 105 | |
| 106 | 106 | global $post; |
| 107 | 107 | if ( $post ) { |
| 108 | 108 | // page-19-table-body.php |
| 109 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
| 109 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | // Combine with existing table-body.php and table.php |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | ob_start(); |
| 131 | 131 | |
| 132 | 132 | $request = new Mock_Request(); |
| 133 | - $request->returns['is_view'] = $this->view; |
|
| 133 | + $request->returns[ 'is_view' ] = $this->view; |
|
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | 136 | * You got one shot. One opportunity. To render all the widgets you have ever wanted. |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | global $wp_filter; |
| 144 | 144 | foreach ( array( 'gravityview_before', 'gravityview_after' ) as $hook ) { |
| 145 | - foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) { |
|
| 145 | + foreach ( $wp_filter[ $hook ]->callbacks[ 10 ] as $function_key => $callback ) { |
|
| 146 | 146 | if ( strpos( $function_key, 'render_widget_hooks' ) ) { |
| 147 | - unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] ); |
|
| 147 | + unset( $wp_filter[ $hook ]->callbacks[ 10 ][ $function_key ] ); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | if ( $this->entry ) { |
| 156 | 156 | |
| 157 | - $request->returns['is_entry'] = $this->entry; |
|
| 157 | + $request->returns[ 'is_entry' ] = $this->entry; |
|
| 158 | 158 | |
| 159 | 159 | global $post; |
| 160 | 160 | |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | * This allows us to fake it till we make it. |
| 189 | 189 | */ |
| 190 | 190 | $parameters = $this->view->settings->as_atts(); |
| 191 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
| 191 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
| 192 | 192 | $has_multisort = true; |
| 193 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
| 194 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
| 195 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
| 193 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
| 194 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
| 195 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | 'fields' => $this->view->fields->by_visible( $this->view ), |
| 212 | 212 | 'in_the_loop' => true, |
| 213 | 213 | ), empty( $parameters ) ? array() : array( |
| 214 | - 'paging' => $parameters['paging'], |
|
| 215 | - 'sorting' => $parameters['sorting'], |
|
| 214 | + 'paging' => $parameters[ 'paging' ], |
|
| 215 | + 'sorting' => $parameters[ 'sorting' ], |
|
| 216 | 216 | ), $post ? array( |
| 217 | 217 | 'post' => $post, |
| 218 | 218 | ) : array() ) ); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | var $is_searchable = true; |
| 13 | 13 | |
| 14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 15 | 15 | |
| 16 | 16 | var $_gf_field_class_name = 'GF_Field_Post_Category'; |
| 17 | 17 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $entry = GFAPI::get_entry( $entry_id ); |
| 47 | 47 | $post_id = \GV\Utils::get( $entry, 'post_id' ); |
| 48 | 48 | |
| 49 | - if( empty( $post_id ) ) { |
|
| 49 | + if ( empty( $post_id ) ) { |
|
| 50 | 50 | return false; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $post_category_fields = GFAPI::get_fields_by_type( $form, 'post_category' ); |
| 56 | 56 | |
| 57 | - if( $post_category_fields ) { |
|
| 57 | + if ( $post_category_fields ) { |
|
| 58 | 58 | |
| 59 | 59 | $updated_categories = array(); |
| 60 | 60 | |
@@ -121,18 +121,18 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return mixed |
| 123 | 123 | */ |
| 124 | - function edit_entry_post_category_choices( $choices, $field, $form_id ) { |
|
| 124 | + function edit_entry_post_category_choices( $choices, $field, $form_id ) { |
|
| 125 | 125 | |
| 126 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
| 126 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
| 127 | 127 | |
| 128 | 128 | // $entry['post_id'] should always be set, but we check to make sure. |
| 129 | - if( $entry && isset( $entry['post_id'] ) && $post_id = $entry['post_id'] ) { |
|
| 129 | + if ( $entry && isset( $entry[ 'post_id' ] ) && $post_id = $entry[ 'post_id' ] ) { |
|
| 130 | 130 | |
| 131 | 131 | $post_categories = wp_get_post_categories( $post_id, array( 'fields' => 'ids' ) ); |
| 132 | 132 | |
| 133 | 133 | // Always use the live value |
| 134 | 134 | foreach ( $choices as &$choice ) { |
| 135 | - $choice['isSelected'] = in_array( $choice['value'], array_values( $post_categories ) ); |
|
| 135 | + $choice[ 'isSelected' ] = in_array( $choice[ 'value' ], array_values( $post_categories ) ); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -141,15 +141,15 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 143 | 143 | |
| 144 | - if( 'edit' === $context ) { |
|
| 144 | + if ( 'edit' === $context ) { |
|
| 145 | 145 | return $field_options; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 149 | - $this->add_field_support('link_to_term', $field_options ); |
|
| 150 | - $this->add_field_support('new_window', $field_options ); |
|
| 148 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 149 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
| 150 | + $this->add_field_support( 'new_window', $field_options ); |
|
| 151 | 151 | |
| 152 | - $field_options['new_window']['requires'] = 'link_to_term'; |
|
| 152 | + $field_options[ 'new_window' ][ 'requires' ] = 'link_to_term'; |
|
| 153 | 153 | |
| 154 | 154 | return $field_options; |
| 155 | 155 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | var $is_searchable = true; |
| 16 | 16 | |
| 17 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 17 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 18 | 18 | |
| 19 | 19 | var $_gf_field_class_name = 'GF_Field_Post_Tags'; |
| 20 | 20 | |
@@ -29,15 +29,15 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 31 | 31 | |
| 32 | - if( 'edit' === $context ) { |
|
| 32 | + if ( 'edit' === $context ) { |
|
| 33 | 33 | return $field_options; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 37 | - $this->add_field_support('link_to_term', $field_options ); |
|
| 38 | - $this->add_field_support('new_window', $field_options ); |
|
| 36 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 37 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
| 38 | + $this->add_field_support( 'new_window', $field_options ); |
|
| 39 | 39 | |
| 40 | - $field_options['new_window']['requires'] = 'link_to_term'; |
|
| 40 | + $field_options[ 'new_window' ][ 'requires' ] = 'link_to_term'; |
|
| 41 | 41 | |
| 42 | 42 | return $field_options; |
| 43 | 43 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | if ( 'single' === $context ) { |
| 36 | - unset( $field_options['new_window'] ); |
|
| 36 | + unset( $field_options[ 'new_window' ] ); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return $field_options; |
@@ -16,17 +16,17 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | function gravityview_register_gravityview_widgets() { |
| 18 | 18 | |
| 19 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 19 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
| 20 | 20 | |
| 21 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' ); |
|
| 22 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
| 23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-gravityforms.php' ); |
|
| 24 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
| 25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
| 26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
| 21 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
| 22 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
| 23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-gravityforms.php' ); |
|
| 24 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
| 25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
| 26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
| 27 | 27 | |
| 28 | - if( class_exists('GFPolls') ) { |
|
| 29 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
| 28 | + if ( class_exists( 'GFPolls' ) ) { |
|
| 29 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | } |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | $value = $this->get_value( $atts ); |
| 62 | 62 | |
| 63 | 63 | if ( false === $operator && is_null( $value ) ) { |
| 64 | - if ( false !== $atts['if'] ) { // Only-if test |
|
| 65 | - $match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) ); |
|
| 64 | + if ( false !== $atts[ 'if' ] ) { // Only-if test |
|
| 65 | + $match = $authed && ! in_array( strtolower( $atts[ 'if' ] ), array( '', '0', 'false', 'no' ) ); |
|
| 66 | 66 | } else { |
| 67 | 67 | $match = $authed; // Just login test |
| 68 | 68 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | // Need to match all AND |
| 83 | 83 | foreach ( $and_values as $and_value ) { |
| 84 | - $match = $authed && \GVCommon::matches_operation( $atts['if'], $and_value, $operator ); |
|
| 84 | + $match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $and_value, $operator ); |
|
| 85 | 85 | if ( ! $match ) { |
| 86 | 86 | break; |
| 87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | // Only need to match a single OR |
| 93 | 93 | foreach ( $or_values as $or_value ) { |
| 94 | 94 | |
| 95 | - $match = \GVCommon::matches_operation( $atts['if'], $or_value, $operator ); |
|
| 95 | + $match = \GVCommon::matches_operation( $atts[ 'if' ], $or_value, $operator ); |
|
| 96 | 96 | |
| 97 | 97 | // Negate the negative operators |
| 98 | 98 | if ( ( $authed && $match ) || ( $authed && ( ! $match && in_array( $operator, array( 'isnot', 'not_contains', 'not_in' ) ) ) ) ) { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | } else { |
| 104 | - $match = $authed && \GVCommon::matches_operation( $atts['if'], $value, $operator ); |
|
| 104 | + $match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $value, $operator ); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $output = $this->get_output( $match, $atts, $output ); |
@@ -189,8 +189,8 @@ discard block |
||
| 189 | 189 | * @return string The output. |
| 190 | 190 | */ |
| 191 | 191 | private function get_output( $match, $atts, $content ) { |
| 192 | - if ( ! $match && ! empty( $atts['else'] ) ) { |
|
| 193 | - return $atts['else']; // Attributized else is easy :) |
|
| 192 | + if ( ! $match && ! empty( $atts[ 'else' ] ) ) { |
|
| 193 | + return $atts[ 'else' ]; // Attributized else is easy :) |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | $if = ''; |
@@ -317,18 +317,18 @@ discard block |
||
| 317 | 317 | $atts = array_intersect_key( $supplied_atts, $atts ); |
| 318 | 318 | |
| 319 | 319 | // Strip whitespace if it's not default false |
| 320 | - if ( isset( $atts['if'] ) && is_string( $atts['if'] ) ) { |
|
| 321 | - $atts['if'] = trim( $atts['if'] ); |
|
| 320 | + if ( isset( $atts[ 'if' ] ) && is_string( $atts[ 'if' ] ) ) { |
|
| 321 | + $atts[ 'if' ] = trim( $atts[ 'if' ] ); |
|
| 322 | 322 | } else { |
| 323 | - $atts['if'] = false; |
|
| 323 | + $atts[ 'if' ] = false; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if ( isset( $atts['logged_in'] ) ) { |
|
| 326 | + if ( isset( $atts[ 'logged_in' ] ) ) { |
|
| 327 | 327 | // Truthy |
| 328 | - if ( in_array( strtolower( $atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) { |
|
| 329 | - $atts['logged_in'] = false; |
|
| 328 | + if ( in_array( strtolower( $atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) { |
|
| 329 | + $atts[ 'logged_in' ] = false; |
|
| 330 | 330 | } else { |
| 331 | - $atts['logged_in'] = true; |
|
| 331 | + $atts[ 'logged_in' ] = true; |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
@@ -61,14 +61,16 @@ discard block |
||
| 61 | 61 | $value = $this->get_value( $atts ); |
| 62 | 62 | |
| 63 | 63 | if ( false === $operator && is_null( $value ) ) { |
| 64 | - if ( false !== $atts['if'] ) { // Only-if test |
|
| 64 | + if ( false !== $atts['if'] ) { |
|
| 65 | +// Only-if test |
|
| 65 | 66 | $match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) ); |
| 66 | 67 | } else { |
| 67 | 68 | $match = $authed; // Just login test |
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | $output = $this->get_output( $match, $atts, $content ); |
| 71 | - } else { // Regular test |
|
| 72 | + } else { |
|
| 73 | +// Regular test |
|
| 72 | 74 | |
| 73 | 75 | $output = $content; |
| 74 | 76 | |
@@ -199,12 +201,15 @@ discard block |
||
| 199 | 201 | $opens = 0; // inner opens |
| 200 | 202 | $found = false; // found split position |
| 201 | 203 | |
| 202 | - while ( $content ) { // scan |
|
| 204 | + while ( $content ) { |
|
| 205 | +// scan |
|
| 203 | 206 | |
| 204 | 207 | if ( ! preg_match( '#(.*?)(\[\/?(gvlogic|else).*?])(.*)#s', $content, $matches ) ) { |
| 205 | - if ( ! $found ) { // We're still iffing. |
|
| 208 | + if ( ! $found ) { |
|
| 209 | +// We're still iffing. |
|
| 206 | 210 | $if .= $content; |
| 207 | - } else { // We are elsing |
|
| 211 | + } else { |
|
| 212 | +// We are elsing |
|
| 208 | 213 | $else .= $content; |
| 209 | 214 | } |
| 210 | 215 | break; // No more shortcodes |
@@ -212,9 +217,11 @@ discard block |
||
| 212 | 217 | |
| 213 | 218 | list( $_, $before_shortcode, $shortcode, $_, $after_shortcode ) = $matches; |
| 214 | 219 | |
| 215 | - if ( ! $found ) { // We're still iffing. |
|
| 220 | + if ( ! $found ) { |
|
| 221 | +// We're still iffing. |
|
| 216 | 222 | $if .= $before_shortcode; |
| 217 | - } else { // We are elsing |
|
| 223 | + } else { |
|
| 224 | +// We are elsing |
|
| 218 | 225 | $else .= $before_shortcode; |
| 219 | 226 | } |
| 220 | 227 | |
@@ -238,9 +245,11 @@ discard block |
||
| 238 | 245 | } |
| 239 | 246 | |
| 240 | 247 | // Tack on the shortcode |
| 241 | - if ( ! $found ) { // We're still iffing. |
|
| 248 | + if ( ! $found ) { |
|
| 249 | +// We're still iffing. |
|
| 242 | 250 | $if .= $shortcode; |
| 243 | - } else { // We are elsing |
|
| 251 | + } else { |
|
| 252 | +// We are elsing |
|
| 244 | 253 | $else .= $shortcode; |
| 245 | 254 | } |
| 246 | 255 | } |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | add_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10, 4 ); |
| 24 | 24 | add_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) ); |
| 25 | 25 | |
| 26 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') ); |
|
| 27 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') ); |
|
| 26 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 27 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
| 28 | 28 | |
| 29 | 29 | add_action( 'gravityview/template/after', array( $this, 'print_scripts' ) ); |
| 30 | 30 | |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | remove_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10 ); |
| 93 | 93 | remove_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) ); |
| 94 | 94 | |
| 95 | - remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') ); |
|
| 96 | - remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') ); |
|
| 95 | + remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 96 | + remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
| 97 | 97 | |
| 98 | 98 | remove_action( 'wp_footer', array( $this, 'output_footer' ) ); |
| 99 | 99 | } |