item-fields.php
3 years ago
layout-settings.php
3 years ago
post-source.php
3 years ago
sc-settings.php
3 years ago
settings.php
3 years ago
style.php
3 years ago
settings.php
95 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Settings Page |
| 4 | * |
| 5 | * @package RT_TPG |
| 6 | */ |
| 7 | |
| 8 | use RT\ThePostGrid\Helpers\Fns; |
| 9 | use RT\ThePostGrid\Helpers\Options; |
| 10 | |
| 11 | // Do not allow directly accessing this file. |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit( 'This script cannot be accessed directly.' ); |
| 14 | } |
| 15 | ?> |
| 16 | |
| 17 | <div class="wrap rttpg-wrapper"> |
| 18 | <div id="upf-icon-edit-pages" class="icon32 icon32-posts-page"><br/></div> |
| 19 | <h2><?php esc_html_e( 'The Post Grid Settings', 'the-post-grid' ); ?></h2> |
| 20 | <h3><?php esc_html_e( 'General settings', 'the-post-grid' ); ?> |
| 21 | <a style="margin-left: 15px; font-size: 15px;" href="<?php echo esc_url( rtTpg()->docLink() ); ?>" target="_blank"><?php esc_html_e( 'Documentation', 'the-post-grid' ); ?></a> |
| 22 | </h3> |
| 23 | |
| 24 | <div class="rt-setting-wrapper"> |
| 25 | <div class="rt-response"></div> |
| 26 | <form id="rt-tpg-settings-form"> |
| 27 | <?php |
| 28 | $settings = get_option( rtTPG()->options['settings'] ); |
| 29 | $last_tab = isset( $settings['_tpg_last_active_tab'] ) ? trim( $settings['_tpg_last_active_tab'] ) : 'common-settings'; |
| 30 | $html = null; |
| 31 | $html .= '<div id="settings-tabs" class="rt-tabs rt-tab-container">'; |
| 32 | |
| 33 | $html .= '<ul class="tab-nav rt-tab-nav">'; |
| 34 | $html .= sprintf( |
| 35 | '<li%s><a href="#common-settings">%s</a></li> |
| 36 | <li%s><a href="#popup-fields">%s</a></li> |
| 37 | <li%s><a href="#social-share">%s</a></li> |
| 38 | <li%s><a href="#custom-script">%s</a></li> |
| 39 | <li%s><a href="#other-settings">%s</a></li>', |
| 40 | $last_tab == 'common-settings' ? ' class="active"' : '', |
| 41 | __( 'Common Settings', 'the-post-grid' ), |
| 42 | $last_tab == 'popup-fields' ? ' class="active"' : '', |
| 43 | __( 'PopUp field selection', 'the-post-grid' ), |
| 44 | $last_tab == 'social-share' ? ' class="active"' : '', |
| 45 | __( 'Social Share', 'the-post-grid' ), |
| 46 | $last_tab == 'custom-script' ? ' class="active"' : '', |
| 47 | __( 'Custom Script', 'the-post-grid' ), |
| 48 | $last_tab == 'other-settings' ? ' class="active"' : '', |
| 49 | __( 'Other Settings', 'the-post-grid' ) |
| 50 | ); |
| 51 | |
| 52 | ob_start(); |
| 53 | do_action( 'tpg_settings_tab_title', $last_tab ); |
| 54 | $html .= ob_get_clean(); |
| 55 | |
| 56 | $html .= '</ul>'; |
| 57 | |
| 58 | $html .= sprintf( '<div id="common-settings" class="rt-tab-content"%s>', $last_tab == 'common-settings' ? ' style="display:block"' : '' ); |
| 59 | $html .= Fns::rtFieldGenerator( Options::rtTPGSettingsCommonSettingsFields() ); |
| 60 | $html .= '</div>'; |
| 61 | |
| 62 | $html .= sprintf( '<div id="popup-fields" class="rt-tab-content"%s>', $last_tab == 'popup-fields' ? ' style="display:block"' : '' ); |
| 63 | $html .= Fns::rtFieldGenerator( Options::rtTpgSettingsDetailFieldSelection() ); |
| 64 | $html .= '</div>'; |
| 65 | |
| 66 | $html .= sprintf( '<div id="social-share" class="rt-tab-content"%s>', $last_tab == 'social-share' ? ' style="display:block"' : '' ); |
| 67 | $html .= Fns::rtFieldGenerator( Options::rtTPGSettingsSocialShareFields() ); |
| 68 | $html .= '</div>'; |
| 69 | |
| 70 | $html .= sprintf( '<div id="custom-script" class="rt-tab-content"%s>', $last_tab == 'custom-script' ? ' style="display:block"' : '' ); |
| 71 | $html .= Fns::rtFieldGenerator( Options::rtTPGSettingsCustomScriptFields() ); |
| 72 | $html .= '</div>'; |
| 73 | |
| 74 | $html .= sprintf( '<div id="other-settings" class="rt-tab-content"%s>', $last_tab == 'other-settings' ? ' style="display:block"' : '' ); |
| 75 | $html .= Fns::rtFieldGenerator( Options::rtTPGSettingsOtherSettingsFields() ); |
| 76 | $html .= '</div>'; |
| 77 | |
| 78 | ob_start(); |
| 79 | do_action( 'tpg_settings_tab_content', $last_tab ); |
| 80 | $html .= ob_get_clean(); |
| 81 | |
| 82 | $html .= sprintf( '<input type="hidden" id="_tpg_last_active_tab" name="_tpg_last_active_tab" value="%s"/>', $last_tab ); |
| 83 | $html .= '</div>'; |
| 84 | |
| 85 | Fns::print_html( $html, true ); |
| 86 | ?> |
| 87 | <p class="submit-wrap"><input type="submit" name="submit" class="button button-primary rtSaveButton" value="Save Changes"></p> |
| 88 | |
| 89 | <?php wp_nonce_field( rtTPG()->nonceText(), rtTPG()->nonceId() ); ?> |
| 90 | </form> |
| 91 | |
| 92 | <div class="rt-response"></div> |
| 93 | </div> |
| 94 | </div> |
| 95 |