| @@ -8,62 +8,30 @@ | ||
| 8 | 8 | |
| 9 | 9 | public static function init(): void { |
| 10 | 10 | self::send(); |
| 11 | 11 | |
| 12 | - $options = get_option( '_wp_coder_tools', [] ); | |
| 13 | - | |
| 14 | - $tools = [ | |
| 15 | - 'integrations' => __( 'Integrations', 'wpcoderpro' ), | |
| 16 | - 'content' => __( 'Content & Templates', 'wpcoderpro' ), | |
| 17 | - 'developer' => __( 'Developer', 'wpcoderpro' ), | |
| 18 | - ]; | |
| 19 | - | |
| 20 | 12 | ?> |
| 21 | - | |
| 22 | - <div class="wowp-settings wowp-tools"> | |
| 13 | + <div class="wrap wowp-wrap wpcoder-tools-wrap wowp-settings"> | |
| 23 | 14 | <form method="post"> |
| 15 | + <fieldset style="display: block;"> | |
| 16 | + <legend> | |
| 17 | + <?php esc_html_e( 'Tools', 'wpcoder' ); ?> | |
| 18 | + </legend> | |
| 19 | + <div class="tab-content-wrapper wowp-tab-content"> | |
| 20 | + <?php require_once plugin_dir_path( __FILE__ ) . '/page.php'; ?> | |
| 21 | + </div> | |
| 22 | + <div class="wowp-field is-full has-mt"> | |
| 23 | + <?php | |
| 24 | + submit_button( __( 'Save', 'wpcoder' ), 'primary large', 'submit', false ); ?> | |
| 25 | + </div> | |
| 24 | 26 | |
| 25 | - <div class="wowp-snippets__header"> | |
| 26 | - <h3 class="wowp-snippets__header-title">Tools & Integrations</h3> | |
| 27 | - <p class="wowp-snippets__header-description">Manage useful features and external service | |
| 28 | - integrations to enhance your site.</p> | |
| 29 | - </div> | |
| 30 | - | |
| 31 | - <div class="wowp-snippets__tabs" id="wowp-snippets-tabs"> | |
| 32 | 27 | <?php |
| 33 | - foreach ( $tools as $key => $value ) { | |
| 34 | - $tab = ! empty( $options['tool_tab'] ) ? $options['tool_tab'] : 'integrations'; | |
| 35 | - echo '<input type="radio" class="wowp-snippets__tabs-radio" name="wp_coder_tool[tool_tab]" value="' . esc_attr( $key ) . '" id="wowp-tab-' . esc_attr( $key ) . '" ' . checked( $tab, | |
| 36 | - $key, false ) . '>'; | |
| 37 | - } | |
| 38 | - echo '<div class="wowp-snippets__tabs-labels">'; | |
| 39 | - foreach ( $tools as $key => $value ) { | |
| 40 | - echo '<label class="wowp-snippets__tabs-tab" for="wowp-tab-' . esc_attr( $key ) . '"><span class="icon icon-' . esc_attr( $key ) . '"></span>' . esc_html( $value ) . '</label>'; | |
| 41 | - } | |
| 42 | - echo '</div>'; | |
| 43 | - foreach ( $tools as $key => $value ) { | |
| 44 | - echo '<div class="wowp-snippets__tabs-content" data-content="wowp-tab-' . esc_attr( $key ) . '">'; | |
| 45 | - require_once plugin_dir_path( __FILE__ ) . 'pages/' . esc_attr( $key ) . '.php'; | |
| 46 | - echo '<input type="submit" name="submit" class="wowp-button button button-dark button-hero" value="' . esc_attr__( 'Save', | |
| 47 | - 'wpcoderpro' ) . '">'; | |
| 48 | - echo '</div>'; | |
| 49 | - } | |
| 50 | - | |
| 51 | - ?> | |
| 52 | - </div> | |
| 53 | - | |
| 54 | - <?php | |
| 55 | - // require_once plugin_dir_path( __FILE__ ) . '/page.php'; ?> | |
| 56 | - | |
| 57 | - <?php | |
| 58 | - // submit_button( __( 'Save', 'wpcoderpro' ), 'wowp-button button button-dark button-hero', 'submit', false ); ?> | |
| 59 | - | |
| 60 | - <?php | |
| 61 | - wp_nonce_field( WPCoder::PREFIX . '_tools_action', WPCoder::PREFIX . '_save_tools' ); ?> | |
| 62 | - | |
| 28 | + wp_nonce_field( WPCoder::PREFIX . '_tools_action', WPCoder::PREFIX . '_save_tools' ); ?> | |
| 29 | + </fieldset> | |
| 63 | 30 | </form> |
| 64 | 31 | </div> |
| 65 | 32 | <?php |
| 33 | + | |
| 66 | 34 | } |
| 67 | 35 | |
| 68 | 36 | private static function option( $name = '', $def = '' ) { |
| 69 | 37 | $options = get_option( '_wp_coder_tools', [] ); |
| @@ -82,9 +50,9 @@ | ||
| 82 | 50 | private static function field( $type = 'checkbox', $name = '', $def = '', $placeholder = '' ) { |
| 83 | 51 | $options = get_option( '_wp_coder_tools', [] ); |
| 84 | 52 | if ( $type === 'checkbox' ) { |
| 85 | 53 | $checked = array_key_exists( $name, $options ) ? 'checked' : ''; |
| 86 | - echo '<input type="checkbox" name="wp_coder_tool[' . esc_attr( $name ) . ']" ' . esc_attr( $checked ) . ' value="1" id="' . esc_attr( $name ) . '">'; | |
| 54 | + echo '<input type="checkbox" name="wp_coder_tool[' . esc_attr( $name ) . ']" ' . esc_attr( $checked ) . ' value="1">'; | |
| 87 | 55 | } elseif ( $type === 'textarea' ) { |
| 88 | 56 | $value = ! empty( $options[ $name ] ) ? $options[ $name ] : $def; |
| 89 | 57 | echo '<textarea name="wp_coder_tool[' . esc_attr( $name ) . ']" placeholder="' . esc_attr( $placeholder ) . '">' . esc_attr( $value ) . '</textarea>'; |
| 90 | 58 | } else { |