WooParc_page

WooCommerce PostNL Parcelware Settings Page.

Description

WooParc_page(); 

Usage

  1. if ( !function_exists( 'WooParc_page' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-postnl-parcelware/admin/settings.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = WooParc_page(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/admin/settings.php  
  1. function WooParc_page() { 
  2. $version="0.2"; 
  3.  
  4. // Enqueue Datepicker script and styles 
  5. wp_enqueue_script('jquery-ui-datepicker'); 
  6.  
  7. wp_register_style( 'ui-smooth', plugins_url('css/jquery-ui-1.10.3.custom.min.css', dirname(__FILE__)) ); 
  8. wp_enqueue_style( 'ui-smooth' ); 
  9.  
  10.  
  11. // Check the user capabilities 
  12. if ( !current_user_can("manage_woocommerce" ) ) { 
  13. wp_die( __("You do not have sufficient permissions to access this page.", "woo-parc" ) ); 
  14.  
  15. // Save settings 
  16. if ( isset( $_POST['wooparc_submitted'] ) && $_POST['wooparc_submitted'] == 'submitted' ) { 
  17. check_admin_referer("wooparc_nonce"); 
  18. foreach ( $_POST as $key => $value ) { 
  19. if ( get_option( $key ) != $value ) { 
  20. update_option( $key, $value ); 
  21. } else { 
  22. add_option( $key, $value, '', 'no' ); 
  23.  
  24. ?> 
  25.  
  26. <script type="text/javascript"> 
  27. // Datepickers 
  28. jQuery(document).ready(function() { 
  29. jQuery('.date').datepicker({ 
  30. dateFormat : 'dd-mm-yy',  
  31. maxDate:'0D',  
  32. showOn: "both",  
  33. buttonImage: "<?php echo plugins_url("woocommerce-postnl-parcelware/img/icon-calendar.png" );?>",  
  34. buttonImageOnly: true 
  35. }); 
  36. }); 
  37. </script> 
  38. <style>.ui-datepicker{position:absolute;left:-999em;}.ui-datepicker-trigger {position:relative;top:5px;} .disabled {opacity:0.5;}</style> 
  39. <div class="wrap"> 
  40. <div id="icon-options-general" class="icon32"></div> 
  41. <h2><?php _e("WooCommerce PostNL Parcelware", "woo-parc" ); ?></h2> 
  42. <?php if ( isset( $_POST['wooparc_submitted'] ) && $_POST['wooparc_submitted']=='submitted') { ?> 
  43. <div id="message" class="updated fade"><p><strong><?php _e("Your settings have been saved.", "woo-parc" ); ?></strong></p></div> 
  44. <?php } 
  45. if ( isset( $_POST['wooparc_submitted'] ) && $_POST['wooparc_submitted']=='restore') { ?> 
  46. <div id="message" class="updated fade"><p><strong><?php _e("Restore settings saved / Restore successful.", "woo-parc" ); ?></strong></p></div> 
  47. <?php } ?> 
  48. <div id="content"> 
  49. <div id="poststuff"> 
  50. <div style="float:left; width:72%; padding-right:3%;"> 
  51.  
  52. <form method="get" action="" id="wooparc_export"> 
  53. <?php wp_nonce_field('wooparc_nonce'); ?> 
  54. <input type=hidden name=wooparc_last_export value="<?php echo WooParc_today();?>"> 
  55. <input type="hidden" name="wooparc_submitted" value="exported"> 
  56. <input type="hidden" name="wooparc_type" value="quick"> 
  57. <div class="postbox"> 
  58. <h3><?php _e("Quick Export", "woo-parc" ); ?></h3> 
  59. <div class="inside"> 
  60. <p><?php _e("Please specify date range and order status for your Quick Export.", "woo-parc" ); ?> <?php _e( "Make sure you've saved Advanced export settings before using Quick Export", "woo-parc" ); ?></p> 
  61. <table class="form-table"> 
  62. <tr> 
  63. <th> 
  64. <label for="wooparc_datefrom"><b><?php _e("Date from:", "woo-parc" ); ?></b></label> 
  65. </th> 
  66. <td> 
  67. <input type="text" id="wooparc_datefrom" name="wooparc_datefrom" class=date value="<?php echo WooParc_lastexport();?>"/> 
  68.  <span class="description"> 
  69. <?php _e("Default: last export date", "woo-parc" );?> 
  70. </span> 
  71. </td> 
  72. </tr> 
  73. <tr> 
  74. <th> 
  75. <label for="wooparc_dateto"><b><?php _e("Date to:", "woo-parc" ); ?></b></label> 
  76. </th> 
  77. <td> 
  78. <input type="text" id="wooparc_dateto" name="wooparc_dateto" class=date value="<?php echo WooParc_today();?>"> 
  79.  <span class="description"> 
  80. <?php _e("Default: today", "woo-parc" );?> 
  81. </span> 
  82. </td> 
  83. </tr> 
  84. <tr> 
  85. <th> 
  86. <label for="wooparc_orderstatus"><b><?php _e("With order status:", "woo-parc" ); ?></b></label> 
  87. </th> 
  88. <td> 
  89. <select name=wooparc_orderstatus id=wooparc_orderstatus> 
  90. <option value="" <?php selected( get_option("wooparc_orderstatus" ), ''); ?>><?php _e("All statusses", "woo-parc" ); ?></option> 
  91. <?php 
  92. // retrieve all active WooCommerce order statuses 
  93. if (function_exists('wc_get_order_statuses')) { 
  94.  
  95. $statuses = wc_get_order_statuses(); 
  96. ksort($statuses); 
  97.  
  98. foreach($statuses as $status => $status_name ) { 
  99.  
  100. $status = str_replace('wc-', '', $status); 
  101. ?> 
  102. <option value="<?php echo $status;?>" <?php selected( get_option("wooparc_orderstatus" ), $status ); ?>><?php _e( $status_name, "woocommerce");?></option> 
  103. <?php 
  104.  
  105. } else { 
  106.  
  107. $statuses = get_terms("shop_order_status", array("hide_empty" => false ) ); 
  108. foreach( $statuses as $status ) { 
  109. ?> 
  110. <option value="<?php echo $status->slug;?>" <?php selected( get_option("wooparc_orderstatus" ), $status->slug ); ?>><?php _e($status->name, "woocommerce");?></option> 
  111. <?php 
  112.  
  113. ?> 
  114. </select> 
  115. </td> 
  116. </tr> 
  117. <tr> 
  118. <td colspan=2> 
  119. <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e("Export to Parcelware", "woo-parc" ); ?>" /></p> 
  120. </td> 
  121. </tr> 
  122. </table> 
  123. </div> 
  124. </div> 
  125. </form> 
  126. <form method="post" action="" id="wooparc_settings"> 
  127. <?php wp_nonce_field('wooparc_nonce'); ?> 
  128. <input type=hidden name=wooparc_version value="<?php echo $version;?>"> 
  129. <input type="hidden" name="wooparc_submitted" value="submitted"> 
  130. <div class="postbox"> 
  131. <h3><?php _e("Advanced export settings", "woo-parc" ); ?></h3> 
  132. <div class="inside"> 
  133. <p><?php _e("Please specify your Parcelware export defaults / settings.", "woo-parc" ); ?></p> 
  134. <table class="form-table"> 
  135. <tr> 
  136. <th> 
  137. <label for="wooparc_actions"><b><?php _e("Add to actions column:", "woo-parc" ); ?></b></label> 
  138. </th> 
  139. <td> 
  140. <input type="radio" id="wooparc_actions_yes" name="wooparc_actions" value="1" <?php checked(get_option("wooparc_actions" )== 1);?>> <label for=wooparc_actions_yes><?php _e("Yes", "woo-parc");?></label>    
  141. <input type="radio" id="wooparc_actions_no" name="wooparc_actions" value="0" <?php checked(get_option("wooparc_actions" )== 0);?>> <label for=wooparc_actions_no><?php _e("No", "woo-parc");?></label><br> 
  142. <span class="description"> 
  143. <?php _e("Add Parcelware export to order overview page actions column.", "woo-parc" );?> 
  144. </span> 
  145. </td> 
  146. </tr> 
  147. <tr> 
  148. <th> 
  149. <label for="wooparc_actions_price"><b><?php _e("Add shipping costs:", "woo-parc" ); ?></b></label> 
  150. </th> 
  151. <td> 
  152. <input type="radio" id="wooparc_actions_price_yes" name="wooparc_actions_price" value="1" <?php checked(get_option("wooparc_actions_price" )== 1);?>> <label for=wooparc_actions_price_yes><?php _e("To export button inside Actions column", "woo-parc");?></label><br> 
  153. <input type="radio" id="wooparc_actions_price_shipping" name="wooparc_actions_price" value="2" <?php checked(get_option("wooparc_actions_price" )== 2);?>> <label for=wooparc_actions_price_shipping><?php _e("To Shipping column", "woo-parc");?></label><br> 
  154. <input type="radio" id="wooparc_actions_price_no" name="wooparc_actions_price" value="0" <?php checked(get_option("wooparc_actions_price" )== 0);?>> <label for=wooparc_actions_price_no><?php _e("No", "woo-parc");?></label><br> 
  155. <span class="description"> 
  156. <?php _e("Add shipping costs to order overview page.", "woo-parc" );?> 
  157. </span> 
  158. </td> 
  159. </tr>  
  160. <tr> 
  161. <th> 
  162. <label for="wooparc_address2"><b><?php _e("Use address 2:", "woo-parc" ); ?></b></label> 
  163. </th> 
  164. <td> 
  165. <input type="radio" id="wooparc_address2_yes" name="wooparc_address2" value="1" <?php checked(get_option("wooparc_address2" )== 1);?>> <label for=wooparc_address2_yes><?php _e("Yes", "woo-parc");?></label>    
  166. <input type="radio" id="wooparc_address2_no" name="wooparc_address2" value="0" <?php checked(get_option("wooparc_address2" )== 0);?>> <label for=wooparc_address2_no><?php _e("No", "woo-parc");?></label><br> 
  167. <span class="description"> 
  168. <?php _e("Do you want to show the second address field? You can use this to receive a apartment, suite, unit, etc.", "woo-parc" );?><br> 
  169. <?php _e("Not required for PostNL Parcelware.", "woo-parc" );?><br> 
  170. </span> 
  171. </td> 
  172. </tr> 
  173. <tr> 
  174. <td colspan=2> 
  175. <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e("Save settings", "woo-parc" ); ?>" /></p> 
  176. </td> 
  177. </tr> 
  178. </table> 
  179. </div> 
  180. </div> 
  181. </form> 
  182. </div> 
  183. <?php // right column with Plugin information ?> 
  184. <div style="float:right; width:25%;"> 
  185. <div class="postbox"> 
  186. <h3><?php _e( 'Buy Pro!', 'woo-parc' ); ?></h3> 
  187. <div class="inside parc-preview"> 
  188. <p><?php echo __( 'Check out our ', 'woo-parc' ); ?> <a href="http://wpfortune.com/shop/plugins/woocommerce-parcelware-postnl/">website</a> <?php _e('to find out more about WooCommerce Parcelware For PostNL.', 'woo-parc' );?></p> 
  189. <p><?php _e('For only € 50, 00 you will get a lot of features and access to our support section.', 'woo-parc' );?></p> 
  190. <p><?php _e('A couple of features:', 'woo-parc' );?></p> 
  191. <ul style="list-style:square;padding-left:20px;margin-top:-10px;"> 
  192. <li><strong><?php _e('New', 'woo-parc'); ?>:</strong> <?php _e('More clear settings layout', 'woo-parc'); ?></li> 
  193. <li><strong><?php _e('New', 'woo-parc'); ?>:</strong> <?php _e('Support for PostNL Services (Rembours, send by registered mail etc.)', 'woo-parc'); ?></li> 
  194. <li><strong><?php _e('New', 'woo-parc'); ?>:</strong> <?php _e('Let customers choose whether to deliver packages by neighbours', 'woo-parc'); ?></li> 
  195. <li><strong><?php _e('New', 'woo-parc'); ?>:</strong> <?php _e('View backup information', 'woo-parc'); ?></li> 
  196. <li><?php _e('Define your own export filename.', 'woo-parc' );?></li> 
  197. <li><?php _e('Bulk export orders to Parcelware.', 'woo-parc' );?></li> 
  198. <li><?php _e('Change order status after export.', 'woo-parc' );?></li> 
  199. <li><?php _e('Define export based on shipping method & shipping cost.', 'woo-parc' );?></li> 
  200. <li><?php _e('Replace checkout field address in seperated fields for street, number and extension.', 'woo-parc' );?></li> 
  201. <li><?php _e('Backup last export and restore it.', 'woo-parc' );?></li> 
  202. </ul> 
  203. </div> 
  204. </div> 
  205. <div class="postbox"> 
  206. <h3><?php _e("Show Your Love", "woo-parc" ); ?></h3> 
  207. <div class="inside parc-preview"> 
  208. <p><?php echo sprintf(__("This plugin is developed by %s, a Dutch graphic design and webdevelopment company.", "woo-parc" ), 'Geev vormgeeving'); ?></p> 
  209. <p><?php _e("If you are happy with this plugin please show your love by liking us on Facebook", "woo-parc" ); ?></p> 
  210. <iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fgeevvormgeeving&width=220&height=62&show_faces=false&colorscheme=light&stream=false&border_color&header=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100%; height:62px;" allowTransparency="true"></iframe> 
  211. <p><?php _e("Or", "woo-parc" ); ?></p> 
  212. <ul style="list-style:square;padding-left:20px;margin-top:-10px;"> 
  213. <li><a href="http://wordpress.org/extend/plugins/woocommerce-postnl-parcelware/screenshots/" target=_blank title="WooCommerce PostNL Parcelware"><?php _e("Rate the plugin 5★ on WordPress.org", "woo-parc" ); ?></a></li> 
  214. <li><a href="http://wordpress.geev.nl/product/woocommerce-postnl-parcelware/" target=_blank title="WooCommerce PostNL Parcelware"><?php _e("Blog about it & link to the plugin page", "woo-parc" ); ?></a></li> 
  215. </ul> 
  216. </div> 
  217. </div> 
  218. </div> 
  219. </div> 
  220. </div> 
  221. </div> 
  222. <?php }