| @@ -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 | |
| @@ -31,60 +30,8 @@ | ||
| 31 | 30 | return $atts; |
| 32 | 31 | } |
| 33 | 32 | |
| 34 | 33 | /** |
| 35 | - * Returns shortcodes that are shown/hidden based on the context. | |
| 36 | - * | |
| 37 | - * @since 6.16.3 | |
| 38 | - * | |
| 39 | - * @return array | |
| 40 | - */ | |
| 41 | - public static function get_contextual_shortcodes() { | |
| 42 | - return array( | |
| 43 | - 'address' => array( | |
| 44 | - 'admin_email' => __( 'Admin email', 'formidable' ), | |
| 45 | - 'default-from-email' => __( 'Default from email', 'formidable' ), | |
| 46 | - 'default-email' => __( 'Default email', 'formidable' ), | |
| 47 | - ), | |
| 48 | - 'body' => array( | |
| 49 | - 'default-message' => __( 'Default Msg', 'formidable' ), | |
| 50 | - 'default-html' => __( 'Default HTML', 'formidable' ), | |
| 51 | - 'default-plain' => __( 'Default Plain', 'formidable' ), | |
| 52 | - ), | |
| 53 | - ); | |
| 54 | - } | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * Get contextual shortcodes. | |
| 58 | - * | |
| 59 | - * @since 6.16.3 | |
| 60 | - * | |
| 61 | - * @return array | |
| 62 | - */ | |
| 63 | - public static function get_contextual_shortcode_values() { | |
| 64 | - $contextual_shortcodes = self::get_contextual_shortcodes(); | |
| 65 | - return array_merge( $contextual_shortcodes['address'], $contextual_shortcodes['body'] ); | |
| 66 | - } | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * Get flattened format of contextual shortcodes. | |
| 70 | - * | |
| 71 | - * @since 6.16.3 | |
| 72 | - * | |
| 73 | - * @return array | |
| 74 | - */ | |
| 75 | - public static function get_contextual_codes() { | |
| 76 | - $contextual_shortcodes = self::get_contextual_shortcodes(); | |
| 77 | - $result = array(); | |
| 78 | - | |
| 79 | - foreach ( $contextual_shortcodes as $type => $shortcodes ) { | |
| 80 | - $result[ $type ] = array_keys( $shortcodes ); | |
| 81 | - } | |
| 82 | - | |
| 83 | - return $result; | |
| 84 | - } | |
| 85 | - | |
| 86 | - /** | |
| 87 | 34 | * Get the name of the shortcode from the regEx |
| 88 | 35 | * |
| 89 | 36 | * @since 3.0 |
| 90 | 37 | * |
| @@ -102,15 +49,13 @@ | ||
| 102 | 49 | 'conditional_check' => false, |
| 103 | 50 | 'foreach' => false, |
| 104 | 51 | ) |
| 105 | 52 | ); |
| 106 | - | |
| 107 | 53 | if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) { |
| 108 | 54 | $args['conditional_check'] = true; |
| 109 | 55 | } |
| 110 | 56 | |
| 111 | 57 | $prefix = ''; |
| 112 | - | |
| 113 | 58 | if ( $args['conditional_check'] ) { |
| 114 | 59 | if ( $args['conditional'] ) { |
| 115 | 60 | $prefix = 'if '; |
| 116 | 61 | } elseif ( $args['foreach'] ) { |
| @@ -118,15 +63,13 @@ | ||
| 118 | 63 | } |
| 119 | 64 | } |
| 120 | 65 | |
| 121 | 66 | $with_tags = $args['conditional_check'] ? 3 : 2; |
| 122 | - | |
| 123 | 67 | if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
| 124 | 68 | $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
| 125 | 69 | $tag = str_replace( ']', '', $tag ); |
| 126 | 70 | $tag = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag ); |
| 127 | 71 | $tags = preg_split( '/\s+/', $tag, 2 ); |
| 128 | - | |
| 129 | 72 | if ( is_array( $tags ) ) { |
| 130 | 73 | $tag = $tags[0]; |
| 131 | 74 | } |
| 132 | 75 | } else { |
| @@ -135,16 +78,8 @@ | ||
| 135 | 78 | |
| 136 | 79 | return $tag; |
| 137 | 80 | } |
| 138 | 81 | |
| 139 | - /** | |
| 140 | - * @param bool $no_vars | |
| 141 | - * @param string $code | |
| 142 | - * @param string $replace_with | |
| 143 | - * @param string $html | |
| 144 | - * | |
| 145 | - * @return void | |
| 146 | - */ | |
| 147 | 82 | public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
| 148 | 83 | if ( $no_vars ) { |
| 149 | 84 | $html = str_replace( '[if ' . $code . ']', '', $html ); |
| 150 | 85 | $html = str_replace( '[/if ' . $code . ']', '', $html ); |