| @@ -21,10 +21,9 @@ | ||
| 21 | 21 | true |
| 22 | 22 | ); |
| 23 | 23 | |
| 24 | 24 | $icon = apply_filters( 'frm_icon', 'svg' ); |
| 25 | - | |
| 26 | - if ( str_starts_with( $icon, 'data:image/svg+xml;base64,' ) ) { | |
| 25 | + if ( 0 === strpos( $icon, 'data:image/svg+xml;base64,' ) ) { | |
| 27 | 26 | $icon = ' ' . FrmAppHelper::get_menu_icon_class(); |
| 28 | 27 | } else { |
| 29 | 28 | $icon = str_replace( 'dashicons-', '', $icon ); |
| 30 | 29 | } |
| @@ -29,9 +28,8 @@ | ||
| 29 | 28 | $icon = str_replace( 'dashicons-', '', $icon ); |
| 30 | 29 | } |
| 31 | 30 | |
| 32 | 31 | $block_name = FrmAppHelper::get_menu_name(); |
| 33 | - | |
| 34 | 32 | if ( $block_name === 'Formidable' ) { |
| 35 | 33 | $block_name = 'Formidable Forms'; |
| 36 | 34 | } |
| 37 | 35 | |
| @@ -63,28 +61,12 @@ | ||
| 63 | 61 | ), |
| 64 | 62 | ); |
| 65 | 63 | |
| 66 | 64 | wp_localize_script( 'formidable-form-selector', 'formidable_form_selector', $script_vars ); |
| 67 | - | |
| 68 | 65 | if ( function_exists( 'wp_set_script_translations' ) ) { |
| 69 | 66 | wp_set_script_translations( 'formidable-form-selector', 'formidable' ); |
| 70 | 67 | } |
| 71 | - } | |
| 72 | 68 | |
| 73 | - /** | |
| 74 | - * Enqueue Formidable Simple Blocks' JS and CSS for the content. | |
| 75 | - * | |
| 76 | - * @since 6.26 | |
| 77 | - * | |
| 78 | - * @return void | |
| 79 | - */ | |
| 80 | - public static function block_assets() { | |
| 81 | - if ( ! is_admin() ) { | |
| 82 | - return; | |
| 83 | - } | |
| 84 | - | |
| 85 | - $version = FrmAppHelper::plugin_version(); | |
| 86 | - | |
| 87 | 69 | wp_enqueue_style( |
| 88 | 70 | 'formidable_block-editor-css', |
| 89 | 71 | FrmAppHelper::plugin_url() . '/css/frm_blocks.css', |
| 90 | 72 | array( 'wp-edit-blocks' ), |
| @@ -97,9 +79,8 @@ | ||
| 97 | 79 | * |
| 98 | 80 | * @since 6.8 |
| 99 | 81 | * |
| 100 | 82 | * @param int $addon_id Addon ID. |
| 101 | - * | |
| 102 | 83 | * @return array|false |
| 103 | 84 | */ |
| 104 | 85 | private static function get_addon_info( $addon_id ) { |
| 105 | 86 | $api = new FrmFormApi(); |
| @@ -193,9 +174,8 @@ | ||
| 193 | 174 | /** |
| 194 | 175 | * Renders a form given the specified attributes. |
| 195 | 176 | * |
| 196 | 177 | * @param array $attributes |
| 197 | - * | |
| 198 | 178 | * @return string |
| 199 | 179 | */ |
| 200 | 180 | public static function simple_form_render( $attributes ) { |
| 201 | 181 | if ( ! isset( $attributes['formId'] ) ) { |
| @@ -205,9 +185,8 @@ | ||
| 205 | 185 | ob_start(); |
| 206 | 186 | |
| 207 | 187 | /** |
| 208 | 188 | * @since 5.5.2 |
| 209 | - * | |
| 210 | 189 | * @param array $attributes |
| 211 | 190 | */ |
| 212 | 191 | do_action( 'frm_before_simple_form_render', $attributes ); |
| 213 | 192 | |
| @@ -220,19 +199,9 @@ | ||
| 220 | 199 | $params = array_filter( $attributes ); |
| 221 | 200 | $params['id'] = $params['formId']; |
| 222 | 201 | unset( $params['formId'] ); |
| 223 | 202 | |
| 224 | - // Still pass false for title and description options if nothing is set, | |
| 225 | - // So a default doesn't overwrite the block option. | |
| 226 | - $params['title'] = ! empty( $params['title'] ); | |
| 227 | - $params['description'] = ! empty( $params['description'] ); | |
| 228 | - | |
| 229 | 203 | $form .= FrmFormsController::get_form_shortcode( $params ); |
| 230 | - | |
| 231 | - if ( ! empty( $attributes['className'] ) ) { | |
| 232 | - $form = preg_replace( '/\bfrm_forms\b/', 'frm_forms ' . esc_attr( $attributes['className'] ), $form, 1 ); | |
| 233 | - } | |
| 234 | - | |
| 235 | 204 | return self::maybe_remove_fade_on_load_for_block_preview( $form ); |
| 236 | 205 | } |
| 237 | 206 | |
| 238 | 207 | /** |
| @@ -239,14 +208,13 @@ | ||
| 239 | 208 | * Remove fade on load when /wp-json/wp/v2/block-renderer/formidable/simple-form is called. |
| 240 | 209 | * With the class set, the form never appears in the form block preview. |
| 241 | 210 | * |
| 242 | 211 | * @param string $form |
| 243 | - * | |
| 244 | 212 | * @return string |
| 245 | 213 | */ |
| 246 | 214 | private static function maybe_remove_fade_on_load_for_block_preview( $form ) { |
| 247 | 215 | if ( is_callable( 'wp_is_json_request' ) && wp_is_json_request() ) { |
| 248 | - return str_replace( ' frm_logic_form ', ' ', $form ); | |
| 216 | + $form = str_replace( ' frm_logic_form ', ' ', $form ); | |
| 249 | 217 | } |
| 250 | 218 | return $form; |
| 251 | 219 | } |
| 252 | 220 | } |