| @@ -2,22 +2,67 @@ | ||
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | ?> |
| 6 | -<div id="template"> | |
| 6 | +<div class="frm_wrap"> | |
| 7 | + <form method="post"> | |
| 8 | + <div class="frm_page_container"> | |
| 9 | + <?php | |
| 10 | + FrmAppHelper::get_admin_header( | |
| 11 | + array( | |
| 12 | + 'label' => __( 'Custom CSS', 'formidable' ), | |
| 13 | + 'hide_title' => false, | |
| 14 | + 'publish' => array( 'FrmStylesHelper::save_button', array() ), | |
| 15 | + 'nav' => FrmStylesHelper::get_style_menu( 'custom_css' ), | |
| 16 | + ) | |
| 17 | + ); | |
| 18 | + ?> | |
| 19 | + | |
| 20 | + <div class="columns-2"> | |
| 21 | + <div id="post-body-content"> | |
| 22 | + | |
| 23 | + <div class="frm-inner-content" id="template"> | |
| 24 | + | |
| 25 | + <h2 class="frm-h2"> | |
| 26 | + <?php esc_html_e( 'Add Custom CSS', 'formidable' ); ?> | |
| 27 | + </h2> | |
| 7 | 28 | <p class="howto"> |
| 8 | 29 | <?php esc_html_e( 'You can add custom css here or in your theme style.css. Any CSS added here will be used anywhere the Formidable CSS is loaded.', 'formidable' ); ?> |
| 9 | 30 | </p> |
| 10 | 31 | |
| 11 | - <?php | |
| 12 | - require FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php'; | |
| 32 | + <?php require FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php'; ?> | |
| 33 | + <input type="hidden" name="ID" value="<?php echo esc_attr( $style->ID ); ?>" /> | |
| 34 | + <input type="hidden" name="<?php echo esc_attr( $frm_style->get_field_name( 'post_title', '' ) ); ?>" value="<?php echo esc_attr( $style->post_title ); ?>" /> | |
| 35 | + <input type="hidden" name="<?php echo esc_attr( $frm_style->get_field_name( 'menu_order', '' ) ); ?>" value="<?php echo esc_attr( $style->menu_order ); ?>" /> | |
| 36 | + <input type="hidden" name="style_name" value="frm_style_<?php echo esc_attr( $style->post_name ); ?>" /> | |
| 37 | + <input type="hidden" name="frm_action" value="save_css" /> | |
| 38 | + <?php wp_nonce_field( 'frm_custom_css_nonce', 'frm_custom_css' ); ?> | |
| 13 | 39 | |
| 14 | - $textarea_params = array( | |
| 15 | - 'name' => 'frm_custom_css', | |
| 16 | - 'id' => $id, | |
| 17 | - ); | |
| 18 | - if ( ! empty( $settings ) ) { | |
| 19 | - $textarea_params['class'] = 'hide-if-js'; | |
| 20 | - } | |
| 21 | - ?> | |
| 22 | - <textarea <?php FrmAppHelper::array_to_html_params( $textarea_params, true ); ?>><?php echo FrmAppHelper::esc_textarea( $custom_css ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></textarea> | |
| 40 | + <textarea name="<?php echo esc_attr( $frm_style->get_field_name( 'custom_css' ) ); ?>" id="<?php echo esc_attr( $id ); ?>" class="<?php echo empty( $settings ) ? '' : 'hide-if-js'; ?>"><?php echo FrmAppHelper::esc_textarea( $style->post_content['custom_css'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></textarea> | |
| 41 | + | |
| 42 | + <?php | |
| 43 | + if ( ! empty( $settings ) ) { | |
| 44 | + wp_add_inline_script( | |
| 45 | + 'code-editor', | |
| 46 | + sprintf( | |
| 47 | + 'jQuery( function() { wp.codeEditor.initialize( "' . esc_attr( $id ) . '", %s ); } );', | |
| 48 | + wp_json_encode( $settings ) | |
| 49 | + ) | |
| 50 | + ); | |
| 51 | + } | |
| 52 | + | |
| 53 | + foreach ( $style->post_content as $k => $v ) { | |
| 54 | + if ( $k === 'custom_css' ) { | |
| 55 | + continue; | |
| 56 | + } | |
| 57 | + ?> | |
| 58 | + <input type="hidden" value="<?php echo esc_attr( $v ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $k ) ); ?>" /> | |
| 59 | + <?php | |
| 60 | + } | |
| 61 | + ?> | |
| 62 | + | |
| 63 | +</div> | |
| 64 | +</div> | |
| 65 | +</div> | |
| 66 | +</div> | |
| 67 | +</form> | |
| 23 | 68 | </div> |