| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
class WPCargo_Admin_Settings{ |
| 6 |
private $text_domain = 'wpcargo'; |
| 7 |
function __construct(){ |
| 8 |
add_action('admin_menu', array( $this, 'add_settings_menu' ), 1 ); |
| 9 |
//call register settings function |
| 10 |
add_action( 'admin_init', array( $this,'register_wpcargo_option_settings') ); |
| 11 |
} |
| 12 |
public function add_settings_menu(){ |
| 13 |
global $wpcargo; |
| 14 |
add_menu_page( |
| 15 |
wpcargo_brand_name(), |
| 16 |
wpcargo_brand_name(), |
| 17 |
'manage_options', |
| 18 |
'wpcargo-settings', |
| 19 |
array( $this, 'add_settings_menu_callback' ), |
| 20 |
'dashicons-book-alt', |
| 21 |
6 |
| 22 |
); |
| 23 |
add_submenu_page( |
| 24 |
'wpcargo-settings', |
| 25 |
wpcargo_general_settings_label(), |
| 26 |
wpcargo_general_settings_label(), |
| 27 |
'manage_options', |
| 28 |
'wpcargo-settings' |
| 29 |
); |
| 30 |
} |
| 31 |
function register_wpcargo_option_settings() { |
| 32 |
//register our settings |
| 33 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_option_settings' ); |
| 34 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_restrict_duplicate' ); |
| 35 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_page_settings' ); |
| 36 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_label_header' ); |
| 37 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_user_timezone' ); |
| 38 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_title_numdigit' ); |
| 39 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_title_suffix' ); |
| 40 |
// register_setting( 'wpcargo_option_settings_group', 'woointeg_dim_divisor' ); |
| 41 |
// register_setting( 'wpcargo_option_settings_group', 'woointeg_dim_divisor_inc' ); |
| 42 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_tax' ); |
| 43 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_print_ffamily' ); |
| 44 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_print_fsize' ); |
| 45 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_print_barcode_height' ); |
| 46 |
register_setting( 'wpcargo_option_settings_group', 'wpcargo_print_barcode_width' ); |
| 47 |
} |
| 48 |
public function add_settings_menu_callback() { |
| 49 |
global $wpcargo; |
| 50 |
$options = get_option('wpcargo_option_settings'); |
| 51 |
$page_options = get_option('wpcargo_page_settings'); |
| 52 |
$wpcargo_title_numdigit = $wpcargo->number_digit; |
| 53 |
$wpcargo_title_suffix = $wpcargo->suffix; |
| 54 |
$tax = $wpcargo->tax; |
| 55 |
?> |
| 56 |
<div class="wpcargo-settings"> |
| 57 |
<div class="wrap" id="wpc-left"> |
| 58 |
<h1><?php echo esc_html(wpcargo_brand_name()); ?> <?php esc_html_e('Settings', 'wpcargo'); ?></h1> |
| 59 |
<?php |
| 60 |
require_once( WPCARGO_PLUGIN_PATH.'admin/templates/admin-navigation.tpl.php' ); |
| 61 |
require_once( WPCARGO_PLUGIN_PATH.'admin/templates/settings-option.tpl.php' ); |
| 62 |
?> |
| 63 |
</div> |
| 64 |
<div class="wrap" id="wpc-right"> <a href="http://www.wpcargo.com/documentation/" target="_blank" class="wpc-documentation"> |
| 65 |
<div class="wpc-img"> <img src="<?php echo esc_url(WPCARGO_PLUGIN_URL.'/admin/assets/images/documentation.png'); ?>" /> </div> |
| 66 |
<div class="wpc-desc"> |
| 67 |
<h3><?php esc_html_e('Get Started Here', 'wpcargo'); ?></h3> |
| 68 |
<p><?php esc_html_e('Documentation', 'wpcargo'); ?></p> |
| 69 |
</div> |
| 70 |
</a> <a href="http://www.wpcargo.com/purchase/" target="_blank" class="wpc-add-ons"> |
| 71 |
<div class="wpc-img"> </div> |
| 72 |
<div class="wpc-desc"> |
| 73 |
<h3><?php esc_html_e('Add Ons', 'wpcargo'); ?></h3> |
| 74 |
<p><?php esc_html_e('More Info', 'wpcargo'); ?></p> |
| 75 |
</div> |
| 76 |
</a> <a href="https://www.facebook.com/wpcargo/" target="_blank" class="wpc-facebook"> |
| 77 |
<div class="wpc-img"> </div> |
| 78 |
<div class="wpc-desc"> |
| 79 |
<h3><?php esc_html_e('Facebook', 'wpcargo'); ?></h3> |
| 80 |
<p><?php esc_html_e('Like our page', 'wpcargo'); ?></p> |
| 81 |
</div> |
| 82 |
</a> <a href="http://www.wpcargo.com/" target="_blank" class="wpc-get-support"> |
| 83 |
<div class="wpc-img"> </div> |
| 84 |
<div class="wpc-desc"> |
| 85 |
<h3><?php esc_html_e('Get Support', 'wpcargo'); ?></h3> |
| 86 |
<p><?php esc_html_e('Contact Us', 'wpcargo'); ?></p> |
| 87 |
</div> |
| 88 |
</a> <a href="http://www.wptaskforce.com/" target="_blank" class="wpc-get-website-hosting"> |
| 89 |
<div class="wpc-img"> </div> |
| 90 |
<div class="wpc-desc"> |
| 91 |
<h3><?php esc_html_e('Get Website Hosting', 'wpcargo'); ?></h3> |
| 92 |
<p><?php esc_html_e('Free Website Design', 'wpcargo'); ?></p> |
| 93 |
</div> |
| 94 |
</a> |
| 95 |
</div> |
| 96 |
</div> |
| 97 |
<?php |
| 98 |
} |
| 99 |
} |
| 100 |
new WPCargo_Admin_Settings; |