| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; // Exit if accessed directly |
| 5 |
} |
| 6 |
|
| 7 |
?> |
| 8 |
|
| 9 |
<div class="merchant-module-page"> |
| 10 |
|
| 11 |
<div class="merchant-module-page-content mrc-w-100"> |
| 12 |
|
| 13 |
<form method="post" action="" class="merchant-module-page-ajax-form"> |
| 14 |
|
| 15 |
<input type="hidden" name="merchant_nonce" value="<?php echo esc_attr( wp_create_nonce( 'merchant_nonce' ) ); ?>" /> |
| 16 |
|
| 17 |
<div class="merchant-module-page-ajax-header"> |
| 18 |
<div class="merchant-module-page-ajax-notice"><?php esc_html_e( 'Your settings have been modified. Save?', 'merchant' ); ?></div> |
| 19 |
<div class="merchant-module-page-ajax-buttons"> |
| 20 |
<a href="<?php echo esc_url( add_query_arg( array( 'page' => 'merchant' ) ) ); ?>" class="merchant-module-discard-button"><?php esc_html_e( 'Discard', 'merchant' ); ?></a> |
| 21 |
<button type="submit" name="merchant_save" value="save" class="merchant-module-save-button"><span class="merchant-module-save-button-label"><?php esc_html_e( 'Save', 'merchant' ); ?></span><i class="dashicons dashicons-update-alt"></i></button> |
| 22 |
</div> |
| 23 |
</div> |
| 24 |
|
| 25 |
<div class="merchant-module-page-header"> |
| 26 |
|
| 27 |
<div class="merchant-module-page-header-content"> |
| 28 |
|
| 29 |
<div class="merchant-module-page-back"> |
| 30 |
<a href="<?php echo esc_url( add_query_arg( array( 'page' => 'merchant' ), 'admin.php' ) ); ?>"> |
| 31 |
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 32 |
<path d="M13.3329 7.20013H4.46628L7.19961 4.20013L6.46628 3.4668L2.59961 7.6668L6.46628 11.5335L7.19961 10.8001L4.53294 8.20013H13.3329V7.20013Z" fill="#1D2327"/> |
| 33 |
</svg> |
| 34 |
<span><?php esc_html_e( 'Go Back', 'merchant' ); ?></span> |
| 35 |
</a> |
| 36 |
</div> |
| 37 |
|
| 38 |
<div class="merchant-module-page-heading"> |
| 39 |
<div class="merchant-module-page-info"> |
| 40 |
<div class="merchant-module-page-title"> |
| 41 |
<?php esc_html_e( 'Global Settings', 'merchant' ); ?> |
| 42 |
</div> |
| 43 |
<div class="merchant-module-page-desc"> |
| 44 |
<?php |
| 45 |
$page_desc = defined( 'MERCHANT_PRO_VERSION' ) ? __( 'License activation, operating mode selection and custom code.', 'merchant' ) : __( 'Operating mode selection and custom code.', 'merchant' ); |
| 46 |
echo esc_html( $page_desc ); |
| 47 |
?> |
| 48 |
</div> |
| 49 |
</div> |
| 50 |
</div> |
| 51 |
|
| 52 |
</div> |
| 53 |
|
| 54 |
</div> |
| 55 |
|
| 56 |
<?php require MERCHANT_DIR . 'admin/views/wpvibe-banner.php'; ?> |
| 57 |
|
| 58 |
<div class="merchant-module-page-content mrc-w-100"> |
| 59 |
|
| 60 |
<?php |
| 61 |
|
| 62 |
/** |
| 63 |
* Hook: 'merchant_admin_settings_before_options' |
| 64 |
* |
| 65 |
* @since 1.0 |
| 66 |
*/ |
| 67 |
do_action( 'merchant_admin_settings_before_options' ); |
| 68 |
|
| 69 |
// Save the WPVibe MCP toggle only when WPVibe is active to avoid overwriting the stored value with the unchecked-checkbox default. |
| 70 |
if ( is_plugin_active( 'vibe-ai/vibe-ai.php' ) ) { |
| 71 |
Merchant_Admin_Options::save_options( array( |
| 72 |
'module' => 'global-settings', |
| 73 |
'fields' => array( |
| 74 |
array( |
| 75 |
'id' => 'wpvibe_mcp_write_access', |
| 76 |
'type' => 'switcher', |
| 77 |
'default' => false, |
| 78 |
), |
| 79 |
), |
| 80 |
) ); |
| 81 |
} |
| 82 |
|
| 83 |
Merchant_Admin_Options::create( array( |
| 84 |
'module' => 'global-settings', |
| 85 |
'title' => esc_html__( 'Merchant Analytics', 'merchant' ), |
| 86 |
'fields' => array( |
| 87 |
// Analytics toggle |
| 88 |
array( |
| 89 |
'id' => 'analytics_toggle', |
| 90 |
'type' => 'switcher', |
| 91 |
'title' => __( 'Enable analytics', 'merchant' ), |
| 92 |
'desc' => __( 'Track revenue and performance insights from our modules. No personal data is collected. Disable this if you prefer not to track analytics.', 'merchant' ), |
| 93 |
'default' => true, |
| 94 |
), |
| 95 |
array( |
| 96 |
'id' => 'usage_statistics_tracking', |
| 97 |
'type' => 'switcher', |
| 98 |
'title' => __( 'Enable modules usage tracking', 'merchant' ), |
| 99 |
'desc' => __( 'Track which modules are used on your site. This helps us improve our products and services. No personal data is collected.', 'merchant' ), |
| 100 |
'default' => false, |
| 101 |
), |
| 102 |
), |
| 103 |
) ); |
| 104 |
|
| 105 |
Merchant_Admin_Options::create( array( |
| 106 |
'module' => 'global-settings', |
| 107 |
'title' => esc_html__( 'Merchant Operating Mode', 'merchant' ), |
| 108 |
'fields' => array( |
| 109 |
array( |
| 110 |
'id' => 'operating_mode', |
| 111 |
'type' => 'radio_alt', |
| 112 |
'options' => array( |
| 113 |
'active' => array( |
| 114 |
'title' => esc_html__( 'Active', 'merchant' ), |
| 115 |
'desc' => esc_html__( 'Merchant is active and visible for all customers. This is the standard operating mode.', 'merchant' ), |
| 116 |
), |
| 117 |
'preview' => array( |
| 118 |
'title' => esc_html__( 'Preview', 'merchant' ), |
| 119 |
'desc' => esc_html__( 'All Merchant modules are active and visible only to admins. Use this mode to test Merchant modules before going live.', 'merchant' ), |
| 120 |
), |
| 121 |
'inactive' => array( |
| 122 |
'title' => esc_html__( 'Inactive', 'merchant' ), |
| 123 |
'desc' => esc_html__( 'Merchant is inactive for everyone, including you. While in this mode, your store operates like Merchant is not installed.', 'merchant' ), |
| 124 |
), |
| 125 |
), |
| 126 |
'default' => 'active', |
| 127 |
), |
| 128 |
), |
| 129 |
) ); |
| 130 |
|
| 131 |
Merchant_Admin_Options::create( array( |
| 132 |
'module' => 'global-settings', |
| 133 |
'title' => esc_html__( 'Global Customizations', 'merchant' ), |
| 134 |
'fields' => array( |
| 135 |
array( |
| 136 |
'type' => 'warning', |
| 137 |
'content' => esc_html__( 'These settings allow you to add custom code, and are recommended for developers or advanced users only', 'merchant' ), |
| 138 |
), |
| 139 |
|
| 140 |
array( |
| 141 |
'type' => 'divider', |
| 142 |
), |
| 143 |
|
| 144 |
array( |
| 145 |
'id' => 'custom_css', |
| 146 |
'type' => 'textarea_code', |
| 147 |
'title' => esc_html__( 'Custom CSS', 'merchant' ), |
| 148 |
), |
| 149 |
|
| 150 |
array( |
| 151 |
'id' => 'custom_js', |
| 152 |
'type' => 'textarea_code', |
| 153 |
'title' => esc_html__( 'Custom JS', 'merchant' ), |
| 154 |
), |
| 155 |
|
| 156 |
), |
| 157 |
) ); |
| 158 |
|
| 159 |
/** |
| 160 |
* Hook: 'merchant_admin_settings_after_options' |
| 161 |
* |
| 162 |
* @since 1.0 |
| 163 |
*/ |
| 164 |
do_action( 'merchant_admin_settings_after_options' ); |
| 165 |
?> |
| 166 |
</div> |
| 167 |
</form> |
| 168 |
</div> |
| 169 |
</div> |
| 170 |
|