PageRenderTime 25ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/wp-e-commerce/wpsc-admin/includes/settings-pages/general.php

https://gitlab.com/endomorphosis/reservationtelco
PHP | 214 lines | 199 code | 13 blank | 2 comment | 22 complexity | fe70781744cc9a6a85b8c1c182a08432 MD5 | raw file
  1. <?php
  2. function wpsc_options_general(){
  3. global $wpdb;
  4. ?>
  5. <form name='cart_options' id='cart_options' method='post' action=''>
  6. <div id="options_general">
  7. <h2><?php _e('General Settings', 'wpsc'); ?></h2>
  8. <?php
  9. /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
  10. wpsc_settings_page_update_notification(); ?>
  11. <table class='wpsc_options form-table'>
  12. <tr>
  13. <th scope="row"><?php echo __('Base Country/Region', 'wpsc'); ?>: </th>
  14. <td>
  15. <select name='wpsc_options[base_country]' onchange='submit_change_country();'>
  16. <?php echo country_list(get_option('base_country')); ?>
  17. </select>
  18. <span id='options_country'>
  19. <?php
  20. $region_list = $wpdb->get_results("SELECT `".WPSC_TABLE_REGION_TAX."`.* FROM `".WPSC_TABLE_REGION_TAX."`, `".WPSC_TABLE_CURRENCY_LIST."` WHERE `".WPSC_TABLE_CURRENCY_LIST."`.`isocode` IN('".get_option('base_country')."') AND `".WPSC_TABLE_CURRENCY_LIST."`.`id` = `".WPSC_TABLE_REGION_TAX."`.`country_id`",ARRAY_A) ;
  21. if($region_list != null) {
  22. ?>
  23. <select name='wpsc_options[base_region]'>
  24. <?php
  25. foreach($region_list as $region) {
  26. if(get_option('base_region') == $region['id']) {
  27. $selected = "selected='selected'";
  28. } else {
  29. $selected = "";
  30. }
  31. ?>
  32. <option value='<?php echo $region['id']; ?>' <?php echo $selected; ?> ><?php echo $region['name']; ?></option> <?php
  33. }
  34. ?>
  35. </select>
  36. <?php } ?>
  37. </span>
  38. <br /><?php echo __('Select your primary business location.', 'wpsc');?>
  39. </td>
  40. </tr>
  41. <tr>
  42. <th scope="row"><?php echo __('Tax Settings', 'wpsc');?>:</th>
  43. <td>
  44. <span id='options_region'>
  45. <?php
  46. $country_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `isocode`='".get_option('base_country')."' LIMIT 1",ARRAY_A);
  47. echo $country_data['country'];
  48. $region_count = $wpdb->get_var("SELECT COUNT(*) AS `count` FROM `".WPSC_TABLE_REGION_TAX."`, `".WPSC_TABLE_CURRENCY_LIST."` WHERE `".WPSC_TABLE_CURRENCY_LIST."`.`isocode` IN('".get_option('base_country')."') AND `".WPSC_TABLE_CURRENCY_LIST."`.`id` = `".WPSC_TABLE_REGION_TAX."`.`country_id`") ;
  49. if($country_data['has_regions'] == 1) {
  50. ?>&nbsp;&nbsp;&nbsp;&nbsp;<a href='<?php echo add_query_arg(array( 'page' => 'wpsc-settings', 'isocode' => get_option('base_country') )); ?>'><?php echo $region_count ?> Regions</a>
  51. <?php } else { ?>
  52. <input type='hidden' name='country_id' value='<?php echo $country_data['id']; ?>' />
  53. &nbsp;&nbsp;&nbsp;&nbsp;<input type='text' name='country_tax' class='tax_forms' maxlength='5' size='5' value='<?php echo $country_data['tax']; ?>' />%
  54. <?php } ?>
  55. </span>
  56. </td>
  57. </tr>
  58. <tr>
  59. <th scope="row"><?php _e('Tax Included in prices','wpsc') ?>:</th>
  60. <td>
  61. <?php
  62. $tax_inprice0= '';
  63. $tax_inprice1= '';
  64. if(wpsc_tax_isincluded()){
  65. $tax_inprice1= 'checked="checked"';
  66. }else{
  67. $tax_inprice0= 'checked="checked"';
  68. }
  69. ?>
  70. <input <?php echo $tax_inprice1; ?> type='radio' name='wpsc_options[tax_inprice]' value='1' id='tax_inprice1' />
  71. <label for='tax_inprice1'><?php echo __('Yes', 'wpsc'); ?></label>
  72. <input <?php echo $tax_inprice0; ?> type='radio' name='wpsc_options[tax_inprice]' value='0' id='tax_inprice0' />
  73. <label for='tax_inprice1'><?php echo __('No', 'wpsc'); ?></label>
  74. </td>
  75. </tr>
  76. <?php /* START OF TARGET MARKET SELECTION */
  77. $countrylist = $wpdb->get_results("SELECT id,country,visible FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY country ASC ",ARRAY_A);
  78. ?>
  79. <tr>
  80. <th scope="row">
  81. <?php echo __('Target Markets', 'wpsc'); ?>:
  82. </th>
  83. <td>
  84. <?php
  85. // check for the suhosin module
  86. if(@extension_loaded('suhosin') && (@ini_get('suhosin.post.max_vars') > 0) && (@ini_get('suhosin.post.max_vars') < 500)) {
  87. echo "<em>".__("The Target Markets feature has been disabled because you have the Suhosin PHP extension installed on this server. If you need to use the Target Markets feature then disable the suhosin extension, if you can not do this, you will need to contact your hosting provider.
  88. ",'wpsc')."</em>";
  89. } else {
  90. ?>
  91. <span>Select: <a href='<?php echo add_query_arg(array('selected_all' => 'all'))?>' class='wpsc_select_all'>All</a>&nbsp; <a href='<?php echo add_query_arg(array( 'selected_all'=>'none'))?>' class='wpsc_select_none'>None</a></span><br />
  92. <div id='resizeable' class='ui-widget-content multiple-select'>
  93. <?php
  94. foreach((array)$countrylist as $country){
  95. $country['country'] = htmlspecialchars($country['country']);
  96. if($country['visible'] == 1){ ?>
  97. <input type='checkbox' name='countrylist2[]' value='<?php echo $country['id']; ?>' checked='checked' /><?php echo $country['country']; ?><br />
  98. <?php }else{ ?>
  99. <input type='checkbox' name='countrylist2[]' value='<?php echo $country['id']; ?>' /><?php echo $country['country']; ?><br />
  100. <?php }
  101. } ?>
  102. </div><br />
  103. Select the markets you are selling products to.
  104. <?php
  105. }
  106. ?>
  107. </td>
  108. </tr>
  109. </table>
  110. <h3 class="form_group"><?php echo __('Currency Settings', 'wpsc');?>:</h3>
  111. <table class='wpsc_options form-table'>
  112. <tr>
  113. <th scope="row"><?php echo __('Currency type', 'wpsc');?>:</th>
  114. <td>
  115. <select name='wpsc_options[currency_type]' onchange='getcurrency(this.options[this.selectedIndex].value);'>
  116. <?php
  117. $currency_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CURRENCY_LIST."` ORDER BY `country` ASC",ARRAY_A);
  118. foreach($currency_data as $currency) {
  119. if(get_option('currency_type') == $currency['id']) {
  120. $selected = "selected='selected'";
  121. } else {
  122. $selected = "";
  123. } ?>
  124. <option value='<?php echo $currency['id']; ?>' <?php echo $selected; ?> ><?php echo htmlspecialchars($currency['country']); ?> (<?php echo $currency['currency']; ?>)</option>
  125. <?php }
  126. $currency_data = $wpdb->get_row("SELECT `symbol`,`symbol_html`,`code` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id`='".get_option('currency_type')."' LIMIT 1",ARRAY_A) ;
  127. if($currency_data['symbol'] != '') {
  128. $currency_sign = $currency_data['symbol_html'];
  129. } else {
  130. $currency_sign = $currency_data['code'];
  131. }
  132. ?>
  133. </select>
  134. </td>
  135. </tr>
  136. <tr>
  137. <th scope="row"><?php echo __('Currency sign location', 'wpsc');?>:</th>
  138. <td>
  139. <?php
  140. $currency_sign_location = get_option('currency_sign_location');
  141. $csl1 = "";
  142. $csl2 = "";
  143. $csl3 = "";
  144. $csl4 = "";
  145. switch($currency_sign_location) {
  146. case 1:
  147. $csl1 = "checked ='checked'";
  148. break;
  149. case 2:
  150. $csl2 = "checked ='checked'";
  151. break;
  152. case 3:
  153. $csl3 = "checked ='checked'";
  154. break;
  155. case 4:
  156. $csl4 = "checked ='checked'";
  157. break;
  158. }
  159. ?>
  160. <input type='radio' value='1' name='wpsc_options[currency_sign_location]' id='csl1' <?php echo $csl1; ?> />
  161. <label for='csl1'>100<span id='cslchar1'><?php echo $currency_sign; ?></span></label> &nbsp;
  162. <input type='radio' value='2' name='wpsc_options[currency_sign_location]' id='csl2' <?php echo $csl2; ?> />
  163. <label for='csl2'>100 <span id='cslchar2'><?php echo $currency_sign; ?></span></label> &nbsp;
  164. <input type='radio' value='3' name='wpsc_options[currency_sign_location]' id='csl3' <?php echo $csl3; ?> />
  165. <label for='csl3'><span id='cslchar3'><?php echo $currency_sign; ?></span>100</label> &nbsp;
  166. <input type='radio' value='4' name='wpsc_options[currency_sign_location]' id='csl4' <?php echo $csl4; ?> />
  167. <label for='csl4'><span id='cslchar4'><?php echo $currency_sign; ?></span> 100</label>
  168. </td>
  169. </tr>
  170. <tr>
  171. <?php
  172. $decimals = get_option('wpsc_hide_decimals');
  173. switch($decimals){
  174. case '1':
  175. $decimal1 = 'checked="checked"';
  176. break;
  177. case '0':
  178. default:
  179. $decimal2 = 'checked="checked"';
  180. break;
  181. }
  182. ?>
  183. <th scope="row"><?php _e('Hide Decimals on Products Pages'); ?></th>
  184. <td>
  185. <input type='radio' value='1' name='wpsc_options[wpsc_hide_decimals]' id='hide_decimals1' <?php echo $decimal1; ?> />
  186. <label for='hide_decimals1'><?php _e('Yes'); ?></label>
  187. <input type='radio' value='0' name='wpsc_options[wpsc_hide_decimals]' id='hide_decimals2' <?php echo $decimal2; ?> />
  188. <label for='hide_decimals2'><?php _e('No'); ?></label>
  189. </td>
  190. </tr>
  191. </table>
  192. <div class="submit">
  193. <input type='hidden' name='wpsc_admin_action' value='submit_options' />
  194. <?php wp_nonce_field('update-options', 'wpsc-update-options'); ?>
  195. <input type="submit" value="<?php echo __('Update &raquo;', 'wpsc');?>" name="updateoption"/>
  196. </div>
  197. </div>
  198. </form>
  199. <?php
  200. }
  201. ?>