PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.13
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.13
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/helpers/FrmShortcodeHelper.php +14 -71 6.296.13 View file →
@@ -18,66 +18,17 @@
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
27 - return is_array( $atts ) ? $atts : array();
28 - }
29 -
30 - /**
31 - * Returns shortcodes that are shown/hidden based on the context.
32 - *
33 - * @since 6.16.3
34 - *
35 - * @return array
36 - */
37 - public static function get_contextual_shortcodes() {
38 - return array(
39 - 'address' => array(
40 - 'admin_email' => __( 'Admin email', 'formidable' ),
41 - 'default-from-email' => __( 'Default from email', 'formidable' ),
42 - 'default-email' => __( 'Default email', 'formidable' ),
43 - ),
44 - 'body' => array(
45 - 'default-message' => __( 'Default Msg', 'formidable' ),
46 - 'default-html' => __( 'Default HTML', 'formidable' ),
47 - 'default-plain' => __( 'Default Plain', 'formidable' ),
48 - ),
49 - );
50 - }
51 -
52 - /**
53 - * Get contextual shortcodes.
54 - *
55 - * @since 6.16.3
56 - *
57 - * @return array
58 - */
59 - public static function get_contextual_shortcode_values() {
60 - $contextual_shortcodes = self::get_contextual_shortcodes();
61 - return array_merge( $contextual_shortcodes['address'], $contextual_shortcodes['body'] );
62 - }
63 -
64 - /**
65 - * Get flattened format of contextual shortcodes.
66 - *
67 - * @since 6.16.3
68 - *
69 - * @return array
70 - */
71 - public static function get_contextual_codes() {
72 - $contextual_shortcodes = self::get_contextual_shortcodes();
73 - $result = array();
74 -
75 - foreach ( $contextual_shortcodes as $type => $shortcodes ) {
76 - $result[ $type ] = array_keys( $shortcodes );
26 + if ( ! is_array( $atts ) ) {
27 + $atts = array();
77 28 }
78 29
79 - return $result;
30 + return $atts;
80 31 }
81 32
82 33 /**
83 34 * Get the name of the shortcode from the regEx
@@ -98,15 +49,13 @@
98 49 'conditional_check' => false,
99 50 'foreach' => false,
100 51 )
101 52 );
102 -
103 53 if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
104 54 $args['conditional_check'] = true;
105 55 }
106 56
107 57 $prefix = '';
108 -
109 58 if ( $args['conditional_check'] ) {
110 59 if ( $args['conditional'] ) {
111 60 $prefix = 'if ';
112 61 } elseif ( $args['foreach'] ) {
@@ -114,29 +63,23 @@
114 63 }
115 64 }
116 65
117 66 $with_tags = $args['conditional_check'] ? 3 : 2;
118 -
119 - if ( empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
120 - return $shortcodes[ $with_tags - 1 ][ $short_key ];
67 + if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
68 + $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
69 + $tag = str_replace( ']', '', $tag );
70 + $tag = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag );
71 + $tags = preg_split( '/\s+/', $tag, 2 );
72 + if ( is_array( $tags ) ) {
73 + $tag = $tags[0];
74 + }
75 + } else {
76 + $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
121 77 }
122 78
123 - $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
124 - $tag = str_replace( ']', '', $tag );
125 - $tag = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag );
126 - $tags = preg_split( '/\s+/', $tag, 2 );
127 -
128 - return is_array( $tags ) ? $tags[0] : $tag;
79 + return $tag;
129 80 }
130 81
131 - /**
132 - * @param bool $no_vars
133 - * @param string $code
134 - * @param string $replace_with
135 - * @param string $html
136 - *
137 - * @return void
138 - */
139 82 public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
140 83 if ( $no_vars ) {
141 84 $html = str_replace( '[if ' . $code . ']', '', $html );
142 85 $html = str_replace( '[/if ' . $code . ']', '', $html );