/deprecated/includes/admin/pages/ninja-forms-settings/tabs/general-settings/general-settings.php

  1. <?php if ( ! defined( 'ABSPATH' ) ) exit; 
  2. add_action( 'init', 'ninja_forms_register_tab_general_settings', 9 ); 
  3.  
  4. function ninja_forms_register_tab_general_settings() { 
  5. $args = array( 
  6. 'name' => __( 'General', 'ninja-forms' ),  
  7. 'page' => 'ninja-forms-settings',  
  8. 'display_function' => '',  
  9. 'save_function' => 'ninja_forms_save_general_settings',  
  10. ); 
  11. ninja_forms_register_tab( 'general_settings', $args ); 
  12.  
  13. add_action('init', 'ninja_forms_register_general_settings_metabox'); 
  14.  
  15. function ninja_forms_register_general_settings_metabox() { 
  16.  
  17. $plugin_settings = nf_get_settings(); 
  18. if ( isset ( $plugin_settings['version'] ) ) { 
  19. $current_version = $plugin_settings['version']; 
  20. } else { 
  21. $current_version = NF_PLUGIN_VERSION; 
  22.  
  23. $args = array( 
  24. 'page' => 'ninja-forms-settings',  
  25. 'tab' => 'general_settings',  
  26. 'slug' => 'general_settings',  
  27. 'title' => __( 'General Settings', 'ninja-forms' ),  
  28. 'settings' => array( 
  29. array( 
  30. 'name' => 'version',  
  31. 'type' => 'desc',  
  32. 'label' => __( 'Version', 'ninja-forms' ),  
  33. 'desc' => $current_version,  
  34. ),  
  35. array( 
  36. 'name' => 'date_format',  
  37. 'type' => 'text',  
  38. 'label' => __( 'Date Format', 'ninja-forms' ),  
  39. 'desc' => 'e.g. m/d/Y, d/m/Y - ' . sprintf( __( 'Tries to follow the %sPHP date() function%s specifications, but not every format is supported.', 'ninja-forms' ), '<a href="http://www.php.net/manual/en/function.date.php" target="_blank">', '</a>' ),  
  40. ),  
  41. array( 
  42. 'name' => 'currency_symbol',  
  43. 'type' => 'text',  
  44. 'label' => __( 'Currency Symbol', 'ninja-forms' ),  
  45. 'desc' => 'e.g. $, £, €',  
  46. ),  
  47. ),  
  48. ); 
  49. ninja_forms_register_tab_metabox( $args ); 
  50.  
  51. $args = array( 
  52. 'page' => 'ninja-forms-settings',  
  53. 'tab' => 'general_settings',  
  54. 'slug' => 'recaptcha_settings',  
  55. 'title' => __( 'reCAPTCHA Settings', 'ninja-forms' ),  
  56. 'settings' => array( 
  57. array( 
  58. 'name' => 'recaptcha_site_key',  
  59. 'type' => 'text',  
  60. 'label' => __( 'reCAPTCHA Site Key', 'ninja-forms' ),  
  61. 'desc' => sprintf( __( 'Get a site key for your domain by registering %shere%s', 'ninja-forms' ), '<a href="https://www.google.com/recaptcha/intro/index.html" target="_blank">', '</a>' ) 
  62. ),  
  63. array( 
  64. 'name' => 'recaptcha_secret_key',  
  65. 'type' => 'text',  
  66. 'label' => __( 'reCAPTCHA Secret Key', 'ninja-forms' ),  
  67. 'desc' => '',  
  68. ),  
  69. array( 
  70. 'name' => 'recaptcha_lang',  
  71. 'type' => 'text',  
  72. 'label' => __( 'reCAPTCHA Language', 'ninja-forms' ),  
  73. 'desc' => 'e.g. en, da - ' . sprintf( __( 'Language used by reCAPTCHA. To get the code for your language click %shere%s', 'ninja-forms' ), '<a href="https://developers.google.com/recaptcha/docs/language" target="_blank">', '</a>' ) 
  74. ),  
  75. ),  
  76. 'state' => 'closed',  
  77. ); 
  78. $args['settings'] = apply_filters( 'nf_general_settings_recaptcha', $args['settings'] ); 
  79.  
  80. ninja_forms_register_tab_metabox( $args ); 
  81.  
  82. $args = array( 
  83. 'page' => 'ninja-forms-settings',  
  84. 'tab' => 'general_settings',  
  85. 'slug' => 'advanced_settings',  
  86. 'title' => __( 'Advanced Settings', 'ninja-forms' ),  
  87. 'settings' => array( 
  88. array( 
  89. 'name' => 'delete_on_uninstall',  
  90. 'type' => 'checkbox',  
  91. 'label' => __( 'Remove ALL Ninja Forms data upon uninstall?', 'ninja-forms' ),  
  92. 'desc' => sprintf( __( 'If this box is checked, ALL Ninja Forms data will be removed from the database upon deletion. %sAll form and submission data will be unrecoverable.%s', 'ninja-forms' ), '<span class="nf-nuke-warning">', '</span>' ),  
  93. ),  
  94. array( 
  95. 'name' => 'delete_prompt',  
  96. 'type' => '',  
  97. 'display_function' => 'nf_delete_on_uninstall_prompt',  
  98. ),  
  99. array( 
  100. 'name' => 'disable_admin_notices',  
  101. 'type' => 'checkbox',  
  102. 'label' => __( 'Disable Admin Notices', 'ninja-forms' ),  
  103. 'desc' => __( 'Never see an admin notice on the dashboard from Ninja Forms. Uncheck to see them again.', 'ninja-forms' ),  
  104. ),  
  105. ),  
  106. 'state' => 'closed',  
  107. ); 
  108. $args['settings'] = apply_filters( 'nf_general_settings_advanced', $args['settings'] ); 
  109.  
  110. ninja_forms_register_tab_metabox( $args ); 
  111.  
  112.  
  113. function nf_delete_on_uninstall_prompt() { 
  114. ?> 
  115. <div class="nf-delete-on-uninstall-prompt"> 
  116. <?php _e( 'This setting will COMPLETELY remove anything Ninja Forms related upon plugin deletion. This includes SUBMISSIONS and FORMS. It cannot be undone.', 'ninja-forms' ); ?> 
  117. </div> 
  118. <div class="nf-delete-on-uninstall-prompt-buttons"> 
  119. <div id="nf-admin-modal-cancel"> 
  120. <a class="submitdelete deletion modal-close nf-delete-on-uninstall-cancel" href="#"><?php _e( 'Cancel', 'ninja-forms' ); ?></a> 
  121. </div> 
  122. <div id="nf-admin-modal-update"> 
  123. <a class="button-primary nf-delete-on-uninstall-yes" href="#"><?php _e( 'Continue', 'ninja-forms' ); ?></a> 
  124. </div> 
  125. </div> 
  126.  
  127. <?php 
  128.  
  129. function ninja_forms_save_general_settings( $data ) { 
  130. $plugin_settings = nf_get_settings(); 
  131.  
  132. foreach( $data as $key => $val ) { 
  133. $plugin_settings[$key] = $val; 
  134.  
  135. update_option( 'ninja_forms_settings', $plugin_settings ); 
  136. $update_msg = __( 'Settings Saved', 'ninja-forms' ); 
  137. return $update_msg; 
.