woocommerce_umf_page

WordPress Settings Page.

Description

woocommerce_umf_page(); 

Usage

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

Defined (1)

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

/admin/umf-settings.php  
  1. function woocommerce_umf_page() { 
  2. // Check the user capabilities 
  3. if ( !current_user_can( 'manage_woocommerce' ) ) { 
  4. wp_die( __( 'You do not have sufficient permissions to access this page.', 'woocommerce-umf' ) ); 
  5. // Save the field values 
  6. if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset( $_POST['umf_fields_submitted'] ) && $_POST['umf_fields_submitted'] == 'submitted' ) { 
  7.  
  8. if ( check_admin_referer( 'woo_umf_settings', 'woo_umf_nonce' ) ) { 
  9.  
  10. delete_option('woocommerce_umf_use_style'); 
  11. foreach ( $_POST as $key => $value ) { 
  12. if ( get_option( $key ) != $value ) { 
  13. update_option( $key, $value ); 
  14. } else { 
  15. add_option( $key, $value, '', 'no' ); 
  16.  
  17. ?> 
  18. <div class="wrap"> 
  19. <div id="icon-options-general" class="icon32"></div> 
  20. <h2><?php _e( 'WooCommerce - Upload My File', 'woocommerce-umf' ); ?></h2> 
  21. <?php if ( isset( $_POST['umf_fields_submitted'] ) && $_POST['umf_fields_submitted'] == 'submitted' ) { ?> 
  22. <div id="message" class="updated fade"><p><strong><?php _e( 'Your settings have been saved.', 'woocommerce-umf' ); ?></strong></p></div> 
  23. <?php } ?> 
  24. <div id="content"> 
  25. <form method="post" action="" id="umf_settings"> 
  26. <input type="hidden" name="umf_fields_submitted" value="submitted"> 
  27. <div id="poststuff"> 
  28. <div style="float:left; width:72%; padding-right:3%;"> 
  29. <div class="postbox"> 
  30. <div class="inside umf-settings"> 
  31. <h3><?php _e( 'General Settings', 'woocommerce-umf' ); ?></h3> 
  32. <table class="form-table"> 
  33. <tr> 
  34. <th> 
  35. <label for="woocommerce_umf_allowed_file_types"><b><?php _e( 'Allowed file types:', 'woocommerce-umf' ); ?></b></label> 
  36. </th> 
  37. <td> 
  38. <input type=text name="woocommerce_umf_allowed_file_types" class="regular-text" value="<?php if(!get_option( 'woocommerce_umf_allowed_file_types' )) { echo 'jpg, png'; } else { echo str_replace('.', '', stripslashes(get_option( 'woocommerce_umf_allowed_file_types' ))); }?>"/><br /> 
  39. <span class="description"><?php 
  40. echo __( 'Specify which file types are allowed for uploading, seperate by commas.', 'woocommerce-umf' ); 
  41. ?></span> 
  42. </td> 
  43. </tr> 
  44. <tr> 
  45. <th> 
  46. <label for="woocommerce_umf_max_uploadsize"><b><?php _e( 'Max. upload size:', 'woocommerce-umf' ); ?></b></label> 
  47. </th> 
  48. <td> 
  49. <input type=text name="woocommerce_umf_max_uploadsize" class="short" value="<?php if(!get_option( 'woocommerce_umf_max_uploadsize' )) { echo ini_get('upload_max_filesize'); } else { echo stripslashes(get_option( 'woocommerce_umf_max_uploadsize' )); }?>"/><br /> 
  50. <span class="description"><?php 
  51. echo __( 'Specify maximum upload size for all files in MegaBytes. Cannot exceed max. PHP upload size.', 'woocommerce-umf' ).'<br>'; 
  52. echo __( 'Note: recommended max. upload size below 8MB.', 'woocommerce-umf' ); 
  53. ?></span> 
  54. </td> 
  55. </tr> 
  56.  
  57. <tr> 
  58. <th> 
  59. <label for="woocommerce_umf_status"><b><?php _e( 'Required status(es):', 'woocommerce-umf' ); ?></b></label> 
  60. </th> 
  61. <td> 
  62. <?php $statusname=get_option( 'woocommerce_umf_status' ); 
  63. // WC 2.2 support 
  64. if (function_exists('wc_get_order_statuses')) { 
  65. $statuses = wc_get_order_statuses(); 
  66.  
  67. ksort($statuses); 
  68.  
  69. $values = array(); 
  70. $i=0; 
  71. // * @2.2.1 changed check for order status 
  72. foreach( $statuses as $status => $status_name ) { 
  73.  
  74. $status = str_replace('wc-', '', $status); 
  75. $values[ $status ] = $status_name; 
  76.  
  77. ?> 
  78. <input type=checkbox name="woocommerce_umf_status[<?php echo $i;?>]" value="<?php echo $status;?>" <?php if(isset($statusname[$i]) && $statusname[$i]==$status) { echo 'checked';}?>> <?php _e($status_name, 'woocommerce');?><br> 
  79. <?php $i++; 
  80.  
  81.  
  82.  
  83. } else { 
  84. $statuses = get_terms( 'shop_order_status', array( 'hide_empty' => false ) ); 
  85.  
  86. $values = array(); 
  87. $i=0; 
  88. // * @2.2.1 changed check for order status 
  89. foreach( $statuses as $status ) { 
  90. $values[ $status->slug ] = $status->name; 
  91. ?> 
  92. <input type=checkbox name="woocommerce_umf_status[<?php echo $i;?>]" value="<?php echo $status->slug;?>" <?php if(isset($statusname[$i]) && $statusname[$i]==$status->slug) { echo 'checked';}?>> <?php _e($status->name, 'woocommerce');?><br> 
  93. <?php $i++; 
  94.  
  95. ?> 
  96. <span class="description"> 
  97. <?php _e( 'Specify which order statuses will allow customers to upload files.', 'woocommerce-umf' );?> 
  98. </span> 
  99. </td> 
  100. </tr> 
  101. <tr> 
  102. <th> 
  103. <b><?php _e( 'Styling', 'woocommerce-umf' );?></b> 
  104. </th> 
  105. <td> 
  106. <input id=woocommerce_umf_use_style type=checkbox <?php if(get_option( 'woocommerce_umf_use_style')=='on') { echo 'checked';}?> name="woocommerce_umf_use_style"> <label for="woocommerce_umf_use_style"><?php _e( 'Enable WooCommerce Upload My File CSS:', 'woocommerce-umf' ); ?></label><br> 
  107. <span class="description"> 
  108. <?php _e( 'We\'ve made some default styling for the frontend. Do you want to use it?', 'woocommerce-umf' );?> 
  109. </span> 
  110. </td> 
  111. </tr> 
  112. <tr> 
  113. <td colspan=2> 
  114. <?php wp_nonce_field( 'woo_umf_settings', 'woo_umf_nonce' ); ?> 
  115. <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Changes', 'woocommerce-umf' ); ?>" /></p> 
  116. </td> 
  117. </tr> 
  118. </table> 
  119. </div> 
  120. </div> 
  121. </div> 
  122. <div style="float:right; width:25%;"> 
  123. <div class="postbox"> 
  124. <div class="inside umf-preview"> 
  125. <h3><?php _e( 'Buy Pro!', 'woocommerce-umf' ); ?></h3> 
  126. <p><?php echo __( 'Check out our ', 'woocommerce-umf' ); ?> <a href="http://wpfortune.com/shop/plugins/woocommerce-uploads/">website</a> <?php _e('to find out more about WooCommerce Uploads.', 'woocommerce-umf' );?></p> 
  127. <p><?php _e('For only € 35, 00 you will get a lot of features and access to our support section.', 'woocommerce-umf' );?></p> 
  128. <p><?php _e('A couple of features:', 'woocommerce-umf' );?></p> 
  129. <ul style="list-style:square;padding-left:20px;margin-top:-10px;"> 
  130. <li><strong><?php _e('New', 'woocommerce-umf' );?></strong>: <?php _e('Define upload path and filename', 'woocommerce-umf' );?></li> 
  131. <li><strong><?php _e('New', 'woocommerce-umf' );?></strong>: <?php _e('Hook into upload process after upload', 'woocommerce-umf' );?></li> 
  132. <li><?php _e('Fully customizable upload set on product level', 'woocommerce-umf' );?></li> 
  133. <li><?php _e('Upload files before checkout with our special add-on', 'woocommerce-umf' );?></li> 
  134. <li><?php _e('Choose in which order uploads will appear', 'woocommerce-umf' );?></li> 
  135. <li><?php _e('Use an AJAX Uploader with progress bar', 'woocommerce-umf' );?></li> 
  136. <li><?php _e('Upload LARGE ( > 1GB) files', 'woocommerce-umf' );?></li> 
  137. <li><?php _e('Product variation support', 'woocommerce-umf' );?></li> 
  138. <li><?php _e('Send admin notifications after upload', 'woocommerce-umf' );?></li> 
  139. <li><?php _e('Specify upload titles per product.', 'woocommerce-umf' );?></li><li><?php _e('File preview', 'woocommerce-umf' );?></li> 
  140. <li><?php _e('Preview thumbnails of uploaded files', 'woocommerce-umf' );?></li><li><?php _e('White or blacklist file types', 'woocommerce-umf' );?></li><li><?php _e('Let users delete files', 'woocommerce-umf' );?></li></ul> 
  141. </div> 
  142. </div> 
  143. </div> 
  144. </div> 
  145. </form> 
  146. </div> 
  147. </div> 
  148. <?php }