| @@ -18,9 +18,8 @@ | ||
| 18 | 18 | * @return array |
| 19 | 19 | */ |
| 20 | 20 | public static function get_shortcode_attribute_array( $text ) { |
| 21 | 21 | $atts = array(); |
| 22 | - | |
| 23 | 22 | if ( $text !== '' ) { |
| 24 | 23 | $atts = shortcode_parse_atts( $text ); |
| 25 | 24 | } |
| 26 | 25 | |
| @@ -34,9 +33,8 @@ | ||
| 34 | 33 | /** |
| 35 | 34 | * Returns shortcodes that are shown/hidden based on the context. |
| 36 | 35 | * |
| 37 | 36 | * @since 6.16.3 |
| 38 | - * | |
| 39 | 37 | * @return array |
| 40 | 38 | */ |
| 41 | 39 | public static function get_contextual_shortcodes() { |
| 42 | 40 | return array( |
| @@ -74,9 +72,8 @@ | ||
| 74 | 72 | */ |
| 75 | 73 | public static function get_contextual_codes() { |
| 76 | 74 | $contextual_shortcodes = self::get_contextual_shortcodes(); |
| 77 | 75 | $result = array(); |
| 78 | - | |
| 79 | 76 | foreach ( $contextual_shortcodes as $type => $shortcodes ) { |
| 80 | 77 | $result[ $type ] = array_keys( $shortcodes ); |
| 81 | 78 | } |
| 82 | 79 | return $result; |
| @@ -101,15 +98,13 @@ | ||
| 101 | 98 | 'conditional_check' => false, |
| 102 | 99 | 'foreach' => false, |
| 103 | 100 | ) |
| 104 | 101 | ); |
| 105 | - | |
| 106 | 102 | if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) { |
| 107 | 103 | $args['conditional_check'] = true; |
| 108 | 104 | } |
| 109 | 105 | |
| 110 | 106 | $prefix = ''; |
| 111 | - | |
| 112 | 107 | if ( $args['conditional_check'] ) { |
| 113 | 108 | if ( $args['conditional'] ) { |
| 114 | 109 | $prefix = 'if '; |
| 115 | 110 | } elseif ( $args['foreach'] ) { |
| @@ -117,15 +112,13 @@ | ||
| 117 | 112 | } |
| 118 | 113 | } |
| 119 | 114 | |
| 120 | 115 | $with_tags = $args['conditional_check'] ? 3 : 2; |
| 121 | - | |
| 122 | 116 | if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
| 123 | 117 | $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
| 124 | 118 | $tag = str_replace( ']', '', $tag ); |
| 125 | 119 | $tag = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag ); |
| 126 | 120 | $tags = preg_split( '/\s+/', $tag, 2 ); |
| 127 | - | |
| 128 | 121 | if ( is_array( $tags ) ) { |
| 129 | 122 | $tag = $tags[0]; |
| 130 | 123 | } |
| 131 | 124 | } else { |
| @@ -134,16 +127,8 @@ | ||
| 134 | 127 | |
| 135 | 128 | return $tag; |
| 136 | 129 | } |
| 137 | 130 | |
| 138 | - /** | |
| 139 | - * @param bool $no_vars | |
| 140 | - * @param string $code | |
| 141 | - * @param string $replace_with | |
| 142 | - * @param string $html | |
| 143 | - * | |
| 144 | - * @return void | |
| 145 | - */ | |
| 146 | 131 | public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
| 147 | 132 | if ( $no_vars ) { |
| 148 | 133 | $html = str_replace( '[if ' . $code . ']', '', $html ); |
| 149 | 134 | $html = str_replace( '[/if ' . $code . ']', '', $html ); |