item-fields.php
9 months ago
layout-settings.php
9 months ago
post-source.php
9 months ago
sc-settings.php
9 months ago
settings.php
9 months ago
style.php
9 months ago
settings.php
155 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 | use RT\ThePostGrid\Helpers\Svg; |
| 11 | |
| 12 | // Do not allow directly accessing this file. |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit( 'This script cannot be accessed directly.' ); |
| 15 | } |
| 16 | ?> |
| 17 | |
| 18 | <div class=" rttpg-wrapper"> |
| 19 | <div id="upf-icon-edit-pages" class="icon32 icon32-posts-page"><br/></div> |
| 20 | |
| 21 | <?php require_once trailingslashit( RT_THE_POST_GRID_PLUGIN_PATH ) . 'resources/parts/settings-header.php'; ?> |
| 22 | |
| 23 | <div class="rt-setting-wrapper"> |
| 24 | <div class="rt-response"></div> |
| 25 | <div class="settings-container"> |
| 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 | $last_tab = ! empty( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : $last_tab; |
| 31 | ?> |
| 32 | <div id="settings-tabs" class="rt-tabs rt-tab-container"> |
| 33 | <div class="rt-settings-sidebar"> |
| 34 | <ul class="tab-nav rt-tab-nav"> |
| 35 | <?php |
| 36 | $tabs = [ |
| 37 | 'common-settings' => [ |
| 38 | 'label' => __( 'Common Settings', 'the-post-grid' ), |
| 39 | 'icon' => 'settings', |
| 40 | 'size' => 16, |
| 41 | ], |
| 42 | 'popup-fields' => [ |
| 43 | 'label' => __( 'PopUp field selection', 'the-post-grid' ), |
| 44 | 'icon' => 'popup', |
| 45 | ], |
| 46 | 'social-share' => [ |
| 47 | 'label' => __( 'Social Share', 'the-post-grid' ), |
| 48 | 'icon' => 'share', |
| 49 | ], |
| 50 | 'custom-script' => [ |
| 51 | 'label' => __( 'Custom Script', 'the-post-grid' ), |
| 52 | 'icon' => 'code', |
| 53 | ], |
| 54 | 'ai-integration-settings' => [ |
| 55 | 'label' => __( 'AI Integration', 'the-post-grid' ), |
| 56 | 'icon' => 'ai', |
| 57 | 'size' => 18 |
| 58 | ], |
| 59 | 'myaccount-settings' => [ |
| 60 | 'label' => __( 'My Account', 'the-post-grid' ), |
| 61 | 'icon' => 'user', |
| 62 | ], |
| 63 | 'event-settings' => [ |
| 64 | 'label' => __( 'Event Settings', 'the-post-grid' ), |
| 65 | 'icon' => 'calender', |
| 66 | ], |
| 67 | 'other-settings' => [ |
| 68 | 'label' => __( 'Other Settings', 'the-post-grid' ), |
| 69 | 'icon' => 'tools', |
| 70 | ], |
| 71 | ]; |
| 72 | ?> |
| 73 | |
| 74 | <?php foreach ( $tabs as $tab_id => $tab ) : ?> |
| 75 | <li class="<?php echo $last_tab === $tab_id ? 'active' : ''; ?>"> |
| 76 | <a href="#<?php echo esc_attr( $tab_id ); ?>"> |
| 77 | <?php Svg::get_svg( $tab['icon'], $tab['size'] ?? '15' ); ?> |
| 78 | |
| 79 | <?php echo esc_html( $tab['label'] ); ?> |
| 80 | </a> |
| 81 | </li> |
| 82 | <?php endforeach; ?> |
| 83 | <?php do_action( 'tpg_settings_tab_title', $last_tab ); ?> |
| 84 | </ul> |
| 85 | </div> |
| 86 | <div class="rt-settings-content"> |
| 87 | <!-- Common Settings --> |
| 88 | <div id="common-settings" class="rt-tab-content" <?php echo $last_tab === 'common-settings' ? 'style="display:block"' : ''; ?>> |
| 89 | <?php echo Fns::rtFieldGenerator( Options::rtTPGSettingsCommonSettingsFields() ); ?> |
| 90 | </div> |
| 91 | |
| 92 | <!-- Popup Fields --> |
| 93 | <div id="popup-fields" class="rt-tab-content" <?php echo $last_tab === 'popup-fields' ? 'style="display:block"' : ''; ?>> |
| 94 | <?php echo Fns::rtFieldGenerator( Options::rtTpgSettingsDetailFieldSelection() ); ?> |
| 95 | </div> |
| 96 | |
| 97 | <!-- Social Share --> |
| 98 | <div id="social-share" class="rt-tab-content" <?php echo $last_tab === 'social-share' ? 'style="display:block"' : ''; ?>> |
| 99 | <?php echo Fns::rtFieldGenerator( Options::rtTPGSettingsSocialShareFields() ); ?> |
| 100 | </div> |
| 101 | |
| 102 | <!-- Custom Script --> |
| 103 | <div id="custom-script" class="rt-tab-content" <?php echo $last_tab === 'custom-script' ? 'style="display:block"' : ''; ?>> |
| 104 | <?php echo Fns::rtFieldGenerator( Options::rtTPGSettingsCustomScriptFields() ); ?> |
| 105 | </div> |
| 106 | |
| 107 | <!-- Other Settings --> |
| 108 | <div id="other-settings" class="rt-tab-content" <?php echo $last_tab === 'other-settings' ? 'style="display:block"' : ''; ?>> |
| 109 | <?php echo Fns::rtFieldGenerator( Options::rtTPGSettingsOtherSettingsFields() ); ?> |
| 110 | </div> |
| 111 | |
| 112 | <!-- AI Integration --> |
| 113 | <div id="ai-integration-settings" class="rt-tab-content" <?php echo $last_tab === 'ai-integration-settings' ? 'style="display:block"' : ''; ?>> |
| 114 | <?php echo Fns::rtFieldGenerator( Options::rtTPGAiIntegrationSettings() ); ?> |
| 115 | |
| 116 | <div class="rt-ai-integration-settings-chatgpt" style="display:none;"> |
| 117 | <?php echo Fns::rtFieldGenerator( Options::rtTPGChatGPGSettings() ); ?> |
| 118 | </div> |
| 119 | |
| 120 | <div class="rt-ai-integration-settings-gemini" style="display:none;"> |
| 121 | <?php echo Fns::rtFieldGenerator( Options::rtTPGGeminiSettings() ); ?> |
| 122 | </div> |
| 123 | </div> |
| 124 | |
| 125 | <!-- My Account --> |
| 126 | <div id="myaccount-settings" class="rt-tab-content" <?php echo $last_tab === 'myaccount-settings' ? 'style="display:block"' : ''; ?>> |
| 127 | <?php echo Fns::rtFieldGenerator( Options::rtTPGMyAccountSettings() ); ?> |
| 128 | </div> |
| 129 | |
| 130 | <!-- Event Settings --> |
| 131 | <div id="event-settings" class="rt-tab-content" <?php echo $last_tab === 'event-settings' ? 'style="display:block"' : ''; ?>> |
| 132 | <?php echo Fns::rtFieldGenerator( Options::rtTPGEventSettings() ); ?> |
| 133 | </div> |
| 134 | |
| 135 | <?php do_action( 'tpg_settings_tab_content', $last_tab ); ?> |
| 136 | |
| 137 | <input type="hidden" id="_tpg_last_active_tab" name="_tpg_last_active_tab" value="<?php echo esc_attr( $last_tab ); ?>"/> |
| 138 | |
| 139 | <div class="content-footer"> |
| 140 | <p class="submit-wrap"> |
| 141 | <input type="submit" name="submit" class="button button-primary rtSaveButton" value="Save Changes"> |
| 142 | </p> |
| 143 | |
| 144 | <?php wp_nonce_field( rtTPG()->nonceText(), rtTPG()->nonceId() ); ?> |
| 145 | </div> |
| 146 | </div> |
| 147 | |
| 148 | <?php require_once trailingslashit( RT_THE_POST_GRID_PLUGIN_PATH ) . 'resources/parts/settings-promo.php'; ?> |
| 149 | </div> |
| 150 | </form> |
| 151 | |
| 152 | </div> |
| 153 | </div> |
| 154 | </div> |
| 155 |