UM_Admin_Metabox

The Ultimate Member UM Admin Metabox class.

Defined (1)

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

/admin/core/um-admin-metabox.php  
  1. class UM_Admin_Metabox { 
  2.  
  3. function __construct() { 
  4.  
  5. $this->slug = 'ultimatemember'; 
  6.  
  7. $this->in_edit = false; 
  8. $this->edit_mode_value = null; 
  9.  
  10. add_action('admin_head', array(&$this, 'admin_head'), 9); 
  11. add_action('admin_footer', array(&$this, 'load_modal_content'), 9); 
  12.  
  13. add_action( 'load-post.php', array(&$this, 'add_metabox'), 9 ); 
  14. add_action( 'load-post-new.php', array(&$this, 'add_metabox'), 9 ); 
  15.  
  16.  
  17. /*** 
  18. *** @Boolean check if we're viewing UM backend 
  19. ***/ 
  20. function is_UM_admin() { 
  21. global $current_screen; 
  22. $screen_id = $current_screen->id; 
  23. if ( is_admin() && ( strstr( $screen_id, 'ultimatemember') || strstr( $screen_id, 'um_') || strstr($screen_id, 'user') || strstr($screen_id, 'profile') ) ) 
  24. return true; 
  25. return false; 
  26.  
  27. /*** 
  28. *** @check that we're on a custom post type supported by UM 
  29. ***/ 
  30. function is_plugin_post_type() { 
  31. if (isset($_REQUEST['post_type'])) { 
  32. $post_type = $_REQUEST['post_type']; 
  33. if ( in_array($post_type, array('um_form', 'um_role', 'um_directory'))) { 
  34. return true; 
  35. } else if ( isset($_REQUEST['action'] ) && $_REQUEST['action'] == 'edit') { 
  36. $post_type = get_post_type(); 
  37. if ( in_array($post_type, array('um_form', 'um_role', 'um_directory'))) { 
  38. return true; 
  39. return false; 
  40.  
  41. /*** 
  42. *** @Gets the role meta 
  43. ***/ 
  44. function get_custom_post_meta($id) { 
  45. $all_meta = get_post_custom($id); 
  46. foreach($all_meta as $k=>$v) { 
  47. if (strstr($k, '_um_')) { 
  48. $um_meta[$k] = $v; 
  49. if (isset($um_meta)) 
  50. return $um_meta; 
  51.  
  52. /*** 
  53. *** @Runs on admin head 
  54. ***/ 
  55. function admin_head() { 
  56. global $post; 
  57. if ( $this->is_plugin_post_type() && isset($post->ID) ) { 
  58. $this->postmeta = $this->get_custom_post_meta($post->ID); 
  59.  
  60. /*** 
  61. *** @add a helper tooltip 
  62. ***/ 
  63. function _tooltip( $text ) { 
  64.  
  65. $output = '<span class="um-admin-tip n">'; 
  66. $output .= '<span class="um-admin-tipsy-n" title="'.$text.'"><i class="dashicons dashicons-editor-help"></i></span>'; 
  67. $output .= '</span>'; 
  68.  
  69. return $output; 
  70.  
  71.  
  72. /*** 
  73. *** @add a helper tooltip 
  74. ***/ 
  75. function tooltip( $text, $e = false ) { 
  76.  
  77. ?> 
  78.  
  79. <span class="um-admin-tip"> 
  80. <?php if ($e == 'e' ) { ?> 
  81. <span class="um-admin-tipsy-e" title="<?php echo $text; ?>"><i class="dashicons dashicons-editor-help"></i></span> 
  82. <?php } else { ?> 
  83. <span class="um-admin-tipsy-w" title="<?php echo $text; ?>"><i class="dashicons dashicons-editor-help"></i></span> 
  84. <?php } ?> 
  85. </span> 
  86.  
  87. <?php 
  88.  
  89.  
  90. /*** 
  91. *** @on/off UI 
  92. ***/ 
  93. function ui_on_off( $id, $default=0, $is_conditional=false, $cond1='', $cond1_show='', $cond1_hide='', $yes='', $no='' ) { 
  94.  
  95. $meta = (string)get_post_meta( get_the_ID(), $id, true ); 
  96. if ( $meta === '0' && $default > 0 ) { 
  97. $default = $meta; 
  98.  
  99. $yes = ( !empty( $yes ) ) ? $yes : __('Yes'); 
  100. $no = ( !empty( $no ) ) ? $no : __('No'); 
  101.  
  102. if (isset($this->postmeta[$id][0]) || $meta ) { 
  103. $active = ( isset( $this->postmeta[$id][0] ) ) ? $this->postmeta[$id][0] : $meta; 
  104. } else { 
  105. $active = $default; 
  106.  
  107. if ($is_conditional == true) { 
  108. $is_conditional = ' class="um-adm-conditional" data-cond1="'.$cond1.'" data-cond1-show="'.$cond1_show.'" data-cond1-hide="'.$cond1_hide.'"'; 
  109.  
  110. ?> 
  111.  
  112. <span class="um-admin-yesno"> 
  113. <span class="btn pos-<?php echo $active; ?>"></span> 
  114. <span class="yes" data-value="1"><?php echo $yes; ?></span> 
  115. <span class="no" data-value="0"><?php echo $no; ?></span> 
  116. <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $active; ?>" <?php echo $is_conditional; ?> /> 
  117. </span> 
  118.  
  119. <?php 
  120.  
  121. /*** 
  122. *** @Init the metaboxes 
  123. ***/ 
  124. function add_metabox() { 
  125. global $current_screen; 
  126.  
  127. if( $current_screen->id == 'um_form') { 
  128. add_action( 'add_meta_boxes', array(&$this, 'add_metabox_form'), 1 ); 
  129. add_action( 'save_post', array(&$this, 'save_metabox_form'), 10, 2 ); 
  130.  
  131. if( $current_screen->id == 'um_role') { 
  132. add_action( 'add_meta_boxes', array(&$this, 'add_metabox_role'), 1 ); 
  133. add_action( 'save_post', array(&$this, 'save_metabox_role'), 10, 2 ); 
  134.  
  135. if( $current_screen->id == 'um_directory') { 
  136. add_action( 'add_meta_boxes', array(&$this, 'add_metabox_directory'), 1 ); 
  137. add_action( 'save_post', array(&$this, 'save_metabox_directory'), 10, 2 ); 
  138.  
  139.  
  140. /*** 
  141. *** @load a directory metabox 
  142. ***/ 
  143. function load_metabox_directory( $object, $box ) { 
  144. global $ultimatemember; 
  145. $box['id'] = str_replace('um-admin-form-', '', $box['id']); 
  146. include_once um_path . 'admin/templates/directory/'. $box['id'] . '.php'; 
  147. wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_directory_nonce' ); 
  148.  
  149. /*** 
  150. *** @load a role metabox 
  151. ***/ 
  152. function load_metabox_role( $object, $box ) { 
  153. global $ultimatemember, $post; 
  154.  
  155. $box['id'] = str_replace('um-admin-form-', '', $box['id']); 
  156.  
  157. if ( $box['id'] == 'builder' ) { 
  158. $UM_Builder = new UM_Admin_Builder(); 
  159. $UM_Builder->form_id = get_the_ID(); 
  160.  
  161. preg_match('#\{.*?\}#s', $box['id'], $matches); 
  162.  
  163. if ( isset($matches[0]) ) { 
  164. $path = $matches[0]; 
  165. $box['id'] = preg_replace('~(\\{[^}]+\\})~', '', $box['id'] ); 
  166. } else { 
  167. $path = um_path; 
  168.  
  169. $path = str_replace('{', '', $path ); 
  170. $path = str_replace('}', '', $path ); 
  171.  
  172. include_once $path . 'admin/templates/role/'. $box['id'] . '.php'; 
  173. wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_role_nonce' ); 
  174.  
  175. /*** 
  176. *** @load a form metabox 
  177. ***/ 
  178. function load_metabox_form( $object, $box ) { 
  179. global $ultimatemember, $post; 
  180.  
  181. $box['id'] = str_replace('um-admin-form-', '', $box['id']); 
  182.  
  183. if ( $box['id'] == 'builder' ) { 
  184. $UM_Builder = new UM_Admin_Builder(); 
  185. $UM_Builder->form_id = get_the_ID(); 
  186.  
  187. preg_match('#\{.*?\}#s', $box['id'], $matches); 
  188.  
  189. if ( isset($matches[0]) ) { 
  190. $path = $matches[0]; 
  191. $box['id'] = preg_replace('~(\\{[^}]+\\})~', '', $box['id'] ); 
  192. } else { 
  193. $path = um_path; 
  194.  
  195. $path = str_replace('{', '', $path ); 
  196. $path = str_replace('}', '', $path ); 
  197.  
  198. include_once $path . 'admin/templates/form/'. $box['id'] . '.php'; 
  199. wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_form_nonce' ); 
  200.  
  201. /*** 
  202. *** @add directory metabox 
  203. ***/ 
  204. function add_metabox_directory() { 
  205.  
  206. add_meta_box('um-admin-form-general', __('General Options'), array(&$this, 'load_metabox_directory'), 'um_directory', 'normal', 'default'); 
  207. add_meta_box('um-admin-form-profile', __('Profile Card'), array(&$this, 'load_metabox_directory'), 'um_directory', 'normal', 'default'); 
  208. add_meta_box('um-admin-form-search', __('Search Options'), array(&$this, 'load_metabox_directory'), 'um_directory', 'normal', 'default'); 
  209. add_meta_box('um-admin-form-pagination', __('Results & Pagination'), array(&$this, 'load_metabox_directory'), 'um_directory', 'normal', 'default'); 
  210.  
  211. add_meta_box('um-admin-form-shortcode', __('Shortcode'), array(&$this, 'load_metabox_directory'), 'um_directory', 'side', 'default'); 
  212.  
  213. add_meta_box('um-admin-form-appearance', __('Styling: General'), array(&$this, 'load_metabox_directory'), 'um_directory', 'side', 'default'); 
  214.  
  215. add_meta_box('um-admin-form-profile_card', __('Styling: Profile Card'), array(&$this, 'load_metabox_directory'), 'um_directory', 'side', 'default'); 
  216.  
  217.  
  218. /*** 
  219. *** @add role metabox 
  220. ***/ 
  221. function add_metabox_role() { 
  222.  
  223. add_meta_box('um-admin-form-sync', __('Sync with WordPress Role', 'ultimatemember'), array(&$this, 'load_metabox_role'), 'um_role', 'side', 'default'); 
  224.  
  225. add_meta_box('um-admin-form-admin', __('Administrative Permissions', 'ultimatemember'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); 
  226.  
  227. add_meta_box('um-admin-form-general', __('General Permissions', 'ultimatemember'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); 
  228.  
  229. add_meta_box('um-admin-form-profile', __('Profile Access', 'ultimatemember'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); 
  230.  
  231. add_meta_box('um-admin-form-home', __('Homepage Options', 'ultimatemember'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); 
  232.  
  233. add_meta_box('um-admin-form-register', __('Registration Options', 'ultimatemember'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); 
  234.  
  235. add_meta_box('um-admin-form-login', __('Login Options', 'ultimatemember'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); 
  236.  
  237. add_meta_box('um-admin-form-logout', __('Logout Options', 'ultimatemember'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); 
  238.  
  239. add_meta_box('um-admin-form-delete', __('Delete Options', 'ultimatemember'), array(&$this, 'load_metabox_role'), 'um_role', 'normal', 'default'); 
  240.  
  241. do_action('um_admin_custom_role_metaboxes'); 
  242.  
  243.  
  244. /*** 
  245. *** @add form metabox 
  246. ***/ 
  247. function add_metabox_form() { 
  248.  
  249. add_meta_box('um-admin-form-mode', __('Select Form Type'), array(&$this, 'load_metabox_form'), 'um_form', 'normal', 'default'); 
  250. add_meta_box('um-admin-form-builder', __('Form Builder'), array(&$this, 'load_metabox_form'), 'um_form', 'normal', 'default'); 
  251. add_meta_box('um-admin-form-shortcode', __('Shortcode'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); 
  252.  
  253. add_meta_box('um-admin-form-register_customize', __('Customize this form'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); 
  254. add_meta_box('um-admin-form-register_css', __('Custom CSS'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); 
  255.  
  256. do_action('um_admin_custom_register_metaboxes'); 
  257.  
  258. add_meta_box('um-admin-form-profile_customize', __('Customize this form'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); 
  259. add_meta_box('um-admin-form-profile_settings', __('User Meta'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); 
  260. add_meta_box('um-admin-form-profile_css', __('Custom CSS'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); 
  261.  
  262. do_action('um_admin_custom_profile_metaboxes'); 
  263.  
  264. add_meta_box('um-admin-form-login_customize', __('Customize this form'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); 
  265. add_meta_box('um-admin-form-login_settings', __('Options'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); 
  266. add_meta_box('um-admin-form-login_css', __('Custom CSS'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); 
  267.  
  268. do_action('um_admin_custom_login_metaboxes'); 
  269.  
  270.  
  271. /*** 
  272. *** @save directory metabox 
  273. ***/ 
  274. function save_metabox_directory( $post_id, $post ) { 
  275. global $wpdb; 
  276.  
  277. // validate nonce 
  278. if ( !isset( $_POST['um_admin_save_metabox_directory_nonce'] ) || !wp_verify_nonce( $_POST['um_admin_save_metabox_directory_nonce'], basename( __FILE__ ) ) ) return $post_id; 
  279.  
  280. // validate post type 
  281. if ( $post->post_type != 'um_directory' ) return $post_id; 
  282.  
  283. // validate user 
  284. $post_type = get_post_type_object( $post->post_type ); 
  285. if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; 
  286.  
  287. $where = array( 'ID' => $post_id ); 
  288. if (empty($_POST['post_title'])) $_POST['post_title'] = 'Directory #'.$post_id; 
  289. $wpdb->update( $wpdb->posts, array( 'post_title' => $_POST['post_title'] ), $where ); 
  290.  
  291. // save 
  292. delete_post_meta( $post_id, '_um_roles' ); 
  293. delete_post_meta( $post_id, '_um_tagline_fields' ); 
  294. delete_post_meta( $post_id, '_um_reveal_fields' ); 
  295. delete_post_meta( $post_id, '_um_search_fields' ); 
  296. delete_post_meta( $post_id, '_um_roles_can_search' ); 
  297. delete_post_meta( $post_id, '_um_show_these_users' ); 
  298. foreach( $_POST as $k => $v ) { 
  299. if ( $k == '_um_show_these_users' && trim( $_POST[ $k ] ) ) { 
  300. $v = preg_split('/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY); 
  301. if (strstr($k, '_um_')) { 
  302. update_post_meta( $post_id, $k, $v); 
  303.  
  304.  
  305. /*** 
  306. *** @save role metabox 
  307. ***/ 
  308. function save_metabox_role( $post_id, $post ) { 
  309. global $wpdb; 
  310.  
  311. // validate nonce 
  312. if ( !isset( $_POST['um_admin_save_metabox_role_nonce'] ) || !wp_verify_nonce( $_POST['um_admin_save_metabox_role_nonce'], basename( __FILE__ ) ) ) return $post_id; 
  313.  
  314. // validate post type 
  315. if ( $post->post_type != 'um_role' ) return $post_id; 
  316.  
  317. // validate user 
  318. $post_type = get_post_type_object( $post->post_type ); 
  319. if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; 
  320.  
  321. $where = array( 'ID' => $post_id ); 
  322. if (empty($_POST['post_title'])) $_POST['post_title'] = 'Role #'.$post_id; 
  323. $wpdb->update( $wpdb->posts, array( 'post_title' => $_POST['post_title'], 'post_name' => sanitize_title( $_POST['post_title'] ) ), $where ); 
  324.  
  325. // save 
  326. delete_post_meta( $post_id, '_um_can_view_roles' ); 
  327. delete_post_meta( $post_id, '_um_can_edit_roles' ); 
  328. delete_post_meta( $post_id, '_um_can_delete_roles' ); 
  329.  
  330. do_action('um_admin_before_saving_role_meta', $post_id ); 
  331.  
  332. do_action('um_admin_before_save_role', $post_id, $post ); 
  333.  
  334. foreach( $_POST as $k => $v ) { 
  335. if (strstr($k, '_um_')) { 
  336. update_post_meta( $post_id, $k, $v); 
  337.  
  338. do_action('um_admin_after_editing_role', $post_id, $post); 
  339.  
  340. do_action('um_admin_after_save_role', $post_id, $post ); 
  341.  
  342.  
  343. /*** 
  344. *** @save form metabox 
  345. ***/ 
  346. function save_metabox_form( $post_id, $post ) { 
  347. global $wpdb; 
  348.  
  349. // validate nonce 
  350. if ( !isset( $_POST['um_admin_save_metabox_form_nonce'] ) || !wp_verify_nonce( $_POST['um_admin_save_metabox_form_nonce'], basename( __FILE__ ) ) ) return $post_id; 
  351.  
  352. // validate post type 
  353. if ( $post->post_type != 'um_form' ) return $post_id; 
  354.  
  355. // validate user 
  356. $post_type = get_post_type_object( $post->post_type ); 
  357. if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; 
  358.  
  359. $where = array( 'ID' => $post_id ); 
  360. if (empty($_POST['post_title'])) $_POST['post_title'] = 'Form #'.$post_id; 
  361. $wpdb->update( $wpdb->posts, array( 'post_title' => $_POST['post_title'] ), $where ); 
  362.  
  363. // save 
  364. delete_post_meta( $post_id, '_um_profile_metafields' ); 
  365. foreach( $_POST as $k => $v ) { 
  366. if (strstr($k, '_um_')) { 
  367. update_post_meta( $post_id, $k, $v); 
  368.  
  369.  
  370. /*** 
  371. *** @Load modal content 
  372. ***/ 
  373. function load_modal_content() { 
  374.  
  375. global $ultimatemember; 
  376.  
  377. $screen = get_current_screen(); 
  378. if ( $this->is_UM_admin() ) { 
  379. foreach( glob( um_path . 'admin/templates/modal/*.php' ) as $modal_content) { 
  380. include_once $modal_content; 
  381.  
  382. // needed on forms only 
  383. if ( !isset( $this->is_loaded ) && isset( $screen->id ) && strstr( $screen->id, 'um_form' ) ) { 
  384.  
  385. $settings['textarea_rows'] = 8; 
  386.  
  387. echo '<div class="um-hidden-editor-edit" style="display:none;">'; 
  388. wp_editor( '', 'um_editor_edit', $settings ); 
  389. echo '</div>'; 
  390.  
  391. echo '<div class="um-hidden-editor-new" style="display:none;">'; 
  392. wp_editor( '', 'um_editor_new', $settings ); 
  393. echo '</div>'; 
  394.  
  395.   
  396.  
  397. /*** 
  398. *** @Show field input for edit 
  399. ***/ 
  400. function field_input ( $attribute, $form_id=null, $field_args = array() ) { 
  401.  
  402. global $ultimatemember; 
  403.  
  404. if ( $this->in_edit == true ) { // we're editing a field 
  405. $real_attr = substr($attribute, 1); 
  406. $this->edit_mode_value = (isset( $this->edit_array[ $real_attr ] ) ) ? $this->edit_array[ $real_attr ] : null; 
  407.  
  408. switch($attribute) { 
  409.  
  410. default: 
  411.  
  412. do_action("um_admin_field_edit_hook{$attribute}", $this->edit_mode_value); 
  413.  
  414. break; 
  415.  
  416. case '_visibility': 
  417. ?> 
  418.  
  419. <p><label for="_visibility">Visibility <?php $this->tooltip( __('Select where this field should appear. This option should only be changed on the profile form and allows you to show a field in one mode only (edit or view) or in both modes.', 'ultimatemember') ); ?></label> 
  420. <select name="_visibility" id="_visibility" class="umaf-selectjs" style="width: 100%"> 
  421. <option value="all" <?php selected( 'all', $this->edit_mode_value ); ?>>View everywhere</option> 
  422. <option value="edit" <?php selected( 'edit', $this->edit_mode_value ); ?>>Edit mode only</option> 
  423. <option value="view" <?php selected( 'view', $this->edit_mode_value ); ?>>View mode only</option> 
  424. </select> 
  425. </p> 
  426.  
  427. <?php 
  428. break; 
  429.  
  430. case '_conditional_action': 
  431. case '_conditional_action1': 
  432. case '_conditional_action2': 
  433. case '_conditional_action3': 
  434. case '_conditional_action4': 
  435. ?> 
  436.  
  437. <p> 
  438. <select name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" class="umaf-selectjs" style="width: 90px"> 
  439.  
  440. <option></option> 
  441.  
  442. <?php 
  443. $actions = array('show', 'hide'); 
  444. foreach( $actions as $action ) { 
  445. ?> 
  446.  
  447. <option value="<?php echo $action; ?>" <?php selected( $action, $this->edit_mode_value ); ?>><?php echo $action; ?></option> 
  448.  
  449. <?php } ?> 
  450.  
  451. </select> 
  452.  
  453.   <?php _e('If'); ?> 
  454. </p> 
  455.  
  456. <?php 
  457. break; 
  458.  
  459. case '_conditional_field': 
  460. case '_conditional_field1': 
  461. case '_conditional_field2': 
  462. case '_conditional_field3': 
  463. case '_conditional_field4': 
  464. ?> 
  465.  
  466. <p> 
  467. <select name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" class="umaf-selectjs" style="width: 150px"> 
  468.  
  469. <option></option> 
  470.  
  471. <?php 
  472. $fields = $ultimatemember->query->get_attr( 'custom_fields', $form_id ); 
  473. foreach( $fields as $key => $array ) { 
  474. if ( isset( $array['title'] ) && isset( $this->edit_array['metakey'] ) && $key != $this->edit_array['metakey'] ) { 
  475. ?> 
  476.  
  477. <option value="<?php echo $key; ?>" <?php selected( $key, $this->edit_mode_value ); ?>><?php echo $array['title']; ?></option> 
  478.  
  479. <?php } } ?> 
  480.  
  481. </select> 
  482. </p> 
  483.  
  484. <?php 
  485. break; 
  486.  
  487. case '_conditional_operator': 
  488. case '_conditional_operator1': 
  489. case '_conditional_operator2': 
  490. case '_conditional_operator3': 
  491. case '_conditional_operator4': 
  492. ?> 
  493.  
  494. <p> 
  495. <select name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" class="umaf-selectjs" style="width: 150px"> 
  496.  
  497. <option></option> 
  498.  
  499. <?php 
  500. $operators = array('empty', 'not empty', 'equals to', 'not equals', 'greater than', 'less than', 'contains'); 
  501. foreach( $operators as $operator ) { 
  502. ?> 
  503.  
  504. <option value="<?php echo $operator; ?>" <?php selected( $operator, $this->edit_mode_value ); ?>><?php echo $operator; ?></option> 
  505.  
  506. <?php } ?> 
  507.  
  508. </select> 
  509. </p> 
  510.  
  511. <?php 
  512. break; 
  513.  
  514. case '_conditional_value': 
  515. case '_conditional_value1': 
  516. case '_conditional_value2': 
  517. case '_conditional_value3': 
  518. case '_conditional_value4': 
  519. ?> 
  520.  
  521. <p> 
  522. <input type="text" name="<?php echo $attribute; ?>" id="<?php echo $attribute; ?>" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 0; ?>" placeholder="<?php _e('Value'); ?>" style="width: 150px!important;position: relative;top: -1px;" /> 
  523. </p> 
  524.  
  525. <?php 
  526. break; 
  527.  
  528. case '_validate': 
  529. ?> 
  530.  
  531. <p><label for="_validate">Validate <?php $this->tooltip('Does this field require a special validation'); ?></label> 
  532. <select name="_validate" id="_validate" data-placeholder="Select a validation type..." class="umaf-selectjs um-adm-conditional" data-cond1='custom' data-cond1-show='_custom_validate' style="width: 100%"> 
  533.  
  534. <option value="" <?php selected( '', $this->edit_mode_value ); ?>></option>  
  535.  
  536. <?php foreach( $ultimatemember->builtin->validation_types() as $key => $name ) { ?> 
  537. <?php  
  538. $continue = apply_filters("um_builtin_validation_types_continue_loop", true, $key, $form_id, $field_args ); 
  539. if( $continue ) { ?> 
  540. <option value="<?php echo $key; ?>" <?php selected( $key, $this->edit_mode_value ); ?>><?php echo $name; ?></option> 
  541. <?php } ?> 
  542. <?php } ?> 
  543.  
  544. </select> 
  545. </p> 
  546.  
  547. <?php 
  548. break; 
  549.  
  550. case '_custom_validate': 
  551. ?> 
  552.  
  553. <p class="_custom_validate"><label for="_custom_validate">Custom Action <?php $this->tooltip('If you want to apply your custom validation, you can use action hooks to add custom validation. Please refer to documentation for further details.'); ?></label> 
  554. <input type="text" name="_custom_validate" id="_custom_validate" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  555. </p> 
  556.  
  557. <?php 
  558. break; 
  559.  
  560. case '_icon': 
  561.  
  562. if ( $this->set_field_type == 'row' ) { 
  563. $back = 'UM_edit_row'; 
  564.  
  565. ?> 
  566.  
  567. <p class="_heading_text"><label for="_icon">Icon <?php $this->tooltip('Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.'); ?></label> 
  568.  
  569. <a href="#" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo $back; ?>">Choose Icon</a> 
  570.  
  571. <span class="um-admin-icon-value"><?php if ( $this->edit_mode_value ) { ?><i class="<?php echo $this->edit_mode_value; ?>"></i><?php } else { ?>No Icon<?php } ?></span> 
  572.  
  573. <input type="hidden" name="_icon" id="_icon" value="<?php echo (isset( $this->edit_mode_value ) ) ? $this->edit_mode_value : ''; ?>" /> 
  574.  
  575. <?php if ( $this->edit_mode_value ) { ?> 
  576. <span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span> 
  577. <?php } else { ?> 
  578. <span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span> 
  579. <?php } ?> 
  580.  
  581. </p> 
  582.  
  583. <?php } else { 
  584.  
  585. if ( $this->in_edit ) { 
  586. $back = 'UM_edit_field'; 
  587. } else { 
  588. $back = 'UM_add_field'; 
  589.  
  590. ?> 
  591.  
  592. <div class="um-admin-tri"> 
  593.  
  594. <p><label for="_icon">Icon <?php $this->tooltip('Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.'); ?></label> 
  595.  
  596. <a href="#" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo $back; ?>">Choose Icon</a> 
  597.  
  598. <span class="um-admin-icon-value"><?php if ( $this->edit_mode_value ) { ?><i class="<?php echo $this->edit_mode_value; ?>"></i><?php } else { ?>No Icon<?php } ?></span> 
  599.  
  600. <input type="hidden" name="_icon" id="_icon" value="<?php echo (isset( $this->edit_mode_value ) ) ? $this->edit_mode_value : ''; ?>" /> 
  601.  
  602. <?php if ( $this->edit_mode_value ) { ?> 
  603. <span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span> 
  604. <?php } else { ?> 
  605. <span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span> 
  606. <?php } ?> 
  607.  
  608. </p> 
  609.  
  610. </div> 
  611.  
  612. <?php 
  613.  
  614.  
  615. break; 
  616.  
  617. case '_css_class': 
  618. ?> 
  619.  
  620. <p><label for="_css_class">CSS Class <?php $this->tooltip('Specify a custom CSS class to be applied to this element'); ?></label> 
  621. <input type="text" name="_css_class" id="_css_class" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  622. </p> 
  623.  
  624. <?php 
  625. break; 
  626.  
  627. case '_width': 
  628. ?> 
  629.  
  630. <p><label for="_width">Thickness (in pixels) <?php $this->tooltip('This is the width in pixels, e.g. 4 or 2, etc'); ?></label> 
  631. <input type="text" name="_width" id="_width" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 4; ?>" /> 
  632. </p> 
  633.  
  634. <?php 
  635. break; 
  636.  
  637. case '_divider_text': 
  638. ?> 
  639.  
  640. <p><label for="_divider_text">Optional Text <?php $this->tooltip( __('Optional text to include with the divider', 'ultimatemember') ); ?></label> 
  641. <input type="text" name="_divider_text" id="_divider_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  642. </p> 
  643.  
  644. <?php 
  645. break; 
  646.  
  647. case '_padding': 
  648. ?> 
  649.  
  650. <p><label for="_padding">Padding <?php $this->tooltip('Set padding for this section'); ?></label> 
  651. <input type="text" name="_padding" id="_padding" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px 0px 0px 0px'; ?>" /> 
  652. </p> 
  653.  
  654. <?php 
  655. break; 
  656.  
  657. case '_margin': 
  658. ?> 
  659.  
  660. <p><label for="_margin">Margin <?php $this->tooltip('Set margin for this section'); ?></label> 
  661. <input type="text" name="_margin" id="_margin" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px 0px 30px 0px'; ?>" /> 
  662. </p> 
  663.  
  664. <?php 
  665. break; 
  666.  
  667. case '_border': 
  668. ?> 
  669.  
  670. <p><label for="_border">Border <?php $this->tooltip('Set border for this section'); ?></label> 
  671. <input type="text" name="_border" id="_border" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px 0px 0px 0px'; ?>" /> 
  672. </p> 
  673.  
  674. <?php 
  675. break; 
  676.  
  677. case '_borderstyle': 
  678. ?> 
  679.  
  680. <p><label for="_borderstyle">Style <?php $this->tooltip('Choose the border style'); ?></label> 
  681. <select name="_borderstyle" id="_borderstyle" class="umaf-selectjs" style="width: 100%"> 
  682. <option value="solid" <?php selected( 'solid', $this->edit_mode_value ); ?>>Solid</option> 
  683. <option value="dotted" <?php selected( 'dotted', $this->edit_mode_value ); ?>>Dotted</option> 
  684. <option value="dashed" <?php selected( 'dashed', $this->edit_mode_value ); ?>>Dashed</option> 
  685. <option value="double" <?php selected( 'double', $this->edit_mode_value ); ?>>Double</option> 
  686. </select> 
  687. </p> 
  688.  
  689. <?php 
  690. break; 
  691.  
  692. case '_borderradius': 
  693. ?> 
  694.  
  695. <p><label for="_borderradius">Border Radius <?php $this->tooltip('Rounded corners can be applied by setting a pixels value here. e.g. 5px'); ?></label> 
  696. <input type="text" name="_borderradius" id="_borderradius" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px'; ?>" /> 
  697. </p> 
  698.  
  699. <?php 
  700. break; 
  701.  
  702. case '_bordercolor': 
  703. ?> 
  704.  
  705. <p><label for="_bordercolor">Border Color <?php $this->tooltip('Give a color to this border'); ?></label> 
  706. <input type="text" name="_bordercolor" id="_bordercolor" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  707. </p> 
  708.  
  709. <?php 
  710. break; 
  711.  
  712. case '_heading': 
  713. ?> 
  714.  
  715. <p><label for="_heading">Enable Row Heading <?php $this->tooltip('Whether to enable a heading for this row'); ?></label> 
  716. <?php if ( isset( $this->edit_mode_value ) ) $this->ui_on_off('_heading', $this->edit_mode_value, true, 1, '_heading_text', 'xxx' ); else $this->ui_on_off('_heading', 0, true, 1, '_heading_text', 'xxx'); ?> 
  717. </p> 
  718.  
  719. <?php 
  720. break; 
  721.  
  722. case '_heading_text': 
  723. ?> 
  724.  
  725. <p class="_heading_text"><label for="_heading_text">Heading Text <?php $this->tooltip('Enter the row heading text here'); ?></label> 
  726. <input type="text" name="_heading_text" id="_heading_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  727. </p> 
  728.  
  729. <?php 
  730. break; 
  731.  
  732. case '_background': 
  733. ?> 
  734.  
  735. <p><label for="_background">Background Color <?php $this->tooltip('This will be the background of entire section'); ?></label> 
  736. <input type="text" name="_background" id="_background" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  737. </p> 
  738.  
  739. <?php 
  740. break; 
  741.  
  742. case '_heading_background_color': 
  743. ?> 
  744.  
  745. <p class="_heading_text"><label for="_heading_background_color">Heading Background Color <?php $this->tooltip('This will be the background of the heading section'); ?></label> 
  746. <input type="text" name="_heading_background_color" id="_heading_background_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  747. </p> 
  748.  
  749. <?php 
  750. break; 
  751.  
  752. case '_heading_text_color': 
  753. ?> 
  754.  
  755. <p class="_heading_text"><label for="_heading_text_color">Heading Text Color <?php $this->tooltip('This will be the text color of heading part only'); ?></label> 
  756. <input type="text" name="_heading_text_color" id="_heading_text_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  757. </p> 
  758.  
  759. <?php 
  760. break; 
  761.  
  762. case '_text_color': 
  763. ?> 
  764.  
  765. <p><label for="_text_color">Text Color <?php $this->tooltip('This will be the text color of entire section'); ?></label> 
  766. <input type="text" name="_text_color" id="_text_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  767. </p> 
  768.  
  769. <?php 
  770. break; 
  771.  
  772. case '_icon_color': 
  773. ?> 
  774.  
  775. <p class="_heading_text"><label for="_icon_color">Icon Color <?php $this->tooltip('This will be the color of selected icon. By default It will be the same color as heading text color'); ?></label> 
  776. <input type="text" name="_icon_color" id="_icon_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  777. </p> 
  778.  
  779. <?php 
  780. break; 
  781.  
  782. case '_color': 
  783. ?> 
  784.  
  785. <p><label for="_color">Color <?php $this->tooltip('Select a color for this divider'); ?></label> 
  786. <input type="text" name="_color" id="_color" class="um-admin-colorpicker" data-default-color="#eeeeee" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '#eeeeee'; ?>" /> 
  787. </p> 
  788.  
  789. <?php 
  790. break; 
  791.  
  792. case '_url_text': 
  793. ?> 
  794.  
  795. <p><label for="_url_text">URL Alt Text <?php $this->tooltip('Entering custom text here will replace the url with a text link'); ?></label> 
  796. <input type="text" name="_url_text" id="_url_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" /> 
  797. </p> 
  798.  
  799. <?php 
  800. break; 
  801.  
  802. case '_url_target': 
  803. ?> 
  804.  
  805. <p><label for="_url_target">Link Target <?php $this->tooltip('Choose whether to open this link in same window or in a new window'); ?></label> 
  806. <select name="_url_target" id="_url_target" class="umaf-selectjs" style="width: 100%"> 
  807. <option value="_blank" <?php selected( '_blank', $this->edit_mode_value ); ?>>Open in new window</option> 
  808. <option value="_self" <?php selected( '_self', $this->edit_mode_value ); ?>>Same window</option> 
  809. </select> 
  810. </p> 
  811.  
  812. <?php 
  813. break; 
  814.  
  815. case '_url_rel': 
  816. ?> 
  817.  
  818. <p><label for="_url_rel">SEO Follow <?php $this->tooltip('Whether to follow or nofollow this link by search engines'); ?></label> 
  819. <select name="_url_rel" id="_url_rel" class="umaf-selectjs" style="width: 100%"> 
  820. <option value="follow" <?php selected( 'follow', $this->edit_mode_value ); ?>>Follow</option> 
  821. <option value="nofollow" <?php selected( 'nofollow', $this->edit_mode_value ); ?>>No-Follow</option> 
  822. </select> 
  823. </p> 
  824.  
  825. <?php 
  826. break; 
  827.  
  828. case '_force_good_pass': 
  829. ?> 
  830.  
  831. <p><label for="_force_good_pass">Force strong password? <?php $this->tooltip( __('Turn on to force users to create a strong password (A combination of one lowercase letter, one uppercase letter, and one number). If turned on this option is only applied to register forms and not to login forms.', 'ultimatemember') ); ?></label> 
  832. <?php if ( isset( $this->edit_mode_value ) ) $this->ui_on_off('_force_good_pass', $this->edit_mode_value ); else $this->ui_on_off('_force_good_pass', 0 ); ?> 
  833. </p> 
  834.  
  835. <?php 
  836. break; 
  837.  
  838. case '_force_confirm_pass': 
  839. ?> 
  840.  
  841. <p><label for="_force_confirm_pass">Automatically add a confirm password field? <?php $this->tooltip( __('Turn on to add a confirm password field. If turned on the confirm password field will only show on register forms and not on login forms.', 'ultimatemember') ); ?></label> 
  842. <?php if ( isset( $this->edit_mode_value ) ) $this->ui_on_off('_force_confirm_pass', $this->edit_mode_value ); else $this->ui_on_off('_force_confirm_pass', 1 ); ?> 
  843. </p> 
  844.  
  845. <?php 
  846. break; 
  847.  
  848. case '_style': 
  849. ?> 
  850.  
  851. <p><label for="_style">Style <?php $this->tooltip('This is the line-style of divider'); ?></label> 
  852. <select name="_style" id="_style" class="umaf-selectjs" style="width: 100%"> 
  853. <option value="solid" <?php selected( 'solid', $this->edit_mode_value ); ?>>Solid</option> 
  854. <option value="dotted" <?php selected( 'dotted', $this->edit_mode_value ); ?>>Dotted</option> 
  855. <option value="dashed" <?php selected( 'dashed', $this->edit_mode_value ); ?>>Dashed</option> 
  856. <option value="double" <?php selected( 'double', $this->edit_mode_value ); ?>>Double</option> 
  857. </select> 
  858. </p> 
  859.  
  860. <?php 
  861. break; 
  862.  
  863. case '_intervals': 
  864.  
  865. ?> 
  866.  
  867. <p><label for="_intervals">Time Intervals (in minutes) <?php $this->tooltip('Choose the minutes interval between each time in the time picker.'); ?></label> 
  868. <input type="text" name="_intervals" id="_intervals" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 60; ?>" placeholder="e.g. 30, 60, 120" /> 
  869. </p> 
  870.  
  871. <?php 
  872. break; 
  873.  
  874.  
  875. case '_format': 
  876.  
  877. if ( $this->set_field_type == 'date' ) {  
  878. ?> 
  879.  
  880. <p><label for="_format">Date User-Friendly Format <?php $this->tooltip('The display format of the date which is visible to user.'); ?></label> 
  881. <select name="_format" id="_format" class="umaf-selectjs" style="width: 100%"> 
  882. <option value="j M Y" <?php selected( 'j M Y', $this->edit_mode_value ); ?>><?php echo $ultimatemember->datetime->get_time('j M Y'); ?></option> 
  883. <option value="M j Y" <?php selected( 'M j Y', $this->edit_mode_value ); ?>><?php echo $ultimatemember->datetime->get_time('M j Y'); ?></option> 
  884. <option value="j F Y" <?php selected( 'j F Y', $this->edit_mode_value ); ?>><?php echo $ultimatemember->datetime->get_time('j F Y'); ?></option> 
  885. <option value="F j Y" <?php selected( 'F j Y', $this->edit_mode_value ); ?>><?php echo $ultimatemember->datetime->get_time('F j Y'); ?></option> 
  886. </select> 
  887. </p> 
  888.  
  889. <?php } else { ?> 
  890.  
  891. <p><label for="_format">Time Format <?php $this->tooltip('Choose the displayed time-format for this field'); ?></label> 
  892. <select name="_format" id="_format" class="umaf-selectjs" style="width: 100%"> 
  893. <option value="g:i a" <?php selected( 'g:i a', $this->edit_mode_value ); ?>><?php echo $ultimatemember->datetime->get_time('g:i a'); ?> ( 12-hr format )</option> 
  894. <option value="g:i A" <?php selected( 'g:i A', $this->edit_mode_value ); ?>><?php echo $ultimatemember->datetime->get_time('g:i A'); ?> ( 12-hr format )</option> 
  895. <option value="H:i" <?php selected( 'H:i', $this->edit_mode_value ); ?>><?php echo $ultimatemember->datetime->get_time('H:i'); ?> ( 24-hr format )</option> 
  896. </select> 
  897. </p> 
  898.  
  899. <?php 
  900. break; 
  901.  
  902. case '_pretty_format': 
  903. ?> 
  904.  
  905. <p><label for="_pretty_format">Displayed Date Format <?php $this->tooltip('Whether you wish to show the date in full or only show the years e.g. 25 Years'); ?></label> 
  906. <select name="_pretty_format" id="_pretty_format" class="umaf-selectjs" style="width: 100%"> 
  907. <option value="0" <?php selected( 0, $this->edit_mode_value ); ?>>Show full date</option> 
  908. <option value="1" <?php selected( 1, $this->edit_mode_value ); ?>>Show years only</option> 
  909. </select> 
  910. </p> 
  911.  
  912. <?php 
  913. break; 
  914.  
  915. case '_disabled_weekdays': 
  916.  
  917. if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) { 
  918. $values = $this->edit_mode_value; 
  919. } else { 
  920. $values = array(''); 
  921. ?> 
  922.  
  923. <p><label for="_disabled_weekdays">Disable specific weekdays <?php $this->tooltip('Disable specific week days from being available for selection in this date picker'); ?></label> 
  924. <select name="_disabled_weekdays[]" id="_disabled_weekdays" class="umaf-selectjs" multiple="multiple" style="width: 100%"> 
  925. <option value="1" <?php if ( in_array( 1, $values ) ) { echo 'selected'; } ?>>Sunday</option> 
  926. <option value="2" <?php if ( in_array( 2, $values ) ) { echo 'selected'; } ?>>Monday</option> 
  927. <option value="3" <?php if ( in_array( 3, $values ) ) { echo 'selected'; } ?>>Tuesday</option> 
  928. <option value="4" <?php if ( in_array( 4, $values ) ) { echo 'selected'; } ?>>Wednesday</option> 
  929. <option value="5" <?php if ( in_array( 5, $values ) ) { echo 'selected'; } ?>>Thursday</option> 
  930. <option value="6" <?php if ( in_array( 6, $values ) ) { echo 'selected'; } ?>>Friday</option> 
  931. <option value="7" <?php if ( in_array( 7, $values ) ) { echo 'selected'; } ?>>Saturday</option> 
  932. </select> 
  933. </p> 
  934.  
  935. <?php 
  936. break; 
  937.  
  938. case '_years': 
  939. ?> 
  940.  
  941. <p class="_years"><label for="_years">Number of Years to pick from <?php $this->tooltip('Number of years available for the date selection. Default to last 50 years'); ?></label> 
  942. <input type="text" name="_years" id="_years" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 50; ?>" /> 
  943. </p> 
  944.  
  945. <?php 
  946. break; 
  947.  
  948. case '_years_x': 
  949. ?> 
  950.  
  951. <p class="_years"><label for="_years_x">Years Selection <?php $this->tooltip('This decides which years should be shown relative to today date'); ?></label> 
  952. <select name="_years_x" id="_years_x" class="umaf-selectjs" style="width: 100%"> 
  953. <option value="equal" <?php selected( 'equal', $this->edit_mode_value ); ?>>Equal years before / after today</option> 
  954. <option value="past" <?php selected( 'past', $this->edit_mode_value ); ?>>Past years only</option> 
  955. <option value="future" <?php selected( 'future', $this->edit_mode_value ); ?>>Future years only</option> 
  956. </select> 
  957. </p> 
  958.  
  959. <?php 
  960. break; 
  961.  
  962. case '_range_start': 
  963. ?> 
  964.  
  965. <p class="_date_range"><label for="_range_start">Date Range Start <?php $this->tooltip('Set the minimum date/day in range in the format YYYY/MM/DD'); ?></label> 
  966. <input type="text" name="_range_start" id="_range_start" value="<?php echo $this->edit_mode_value; ?>" placeholder="YYYY/MM/DD" /> 
  967. </p> 
  968.  
  969. <?php 
  970. break; 
  971.  
  972. case '_range_end': 
  973. ?> 
  974.  
  975. <p class="_date_range"><label for="_range_end">Date Range End <?php $this->tooltip('Set the maximum date/day in range in the format YYYY/MM/DD'); ?></label> 
  976. <input type="text" name="_range_end" id="_range_end" value="<?php echo $this->edit_mode_value; ?>" placeholder="YYYY/MM/DD" /> 
  977. </p> 
  978.  
  979. <?php 
  980. break; 
  981.  
  982. case '_range': 
  983. ?> 
  984.  
  985. <p><label for="_range">Set Date Range <?php $this->tooltip('Whether to show a specific number of years or specify a date range to be available for the date picker.'); ?></label> 
  986. <select name="_range" id="_range" class="umaf-selectjs um-adm-conditional" data-cond1='years' data-cond1-show='_years' data-cond2="date_range" data-cond2-show="_date_range" style="width: 100%"> 
  987. <option value="years" <?php selected( 'years', $this->edit_mode_value ); ?>>Fixed Number of Years</option> 
  988. <option value="date_range" <?php selected( 'date_range', $this->edit_mode_value ); ?>>Specific Date Range</option> 
  989. </select> 
  990. </p> 
  991.  
  992. <?php 
  993. break; 
  994.  
  995. case '_content': 
  996.  
  997. if ( $this->set_field_type == 'shortcode' ) { 
  998.  
  999. ?> 
  1000.  
  1001. <p><label for="_content">Enter Shortcode <?php $this->tooltip('Enter the shortcode in the following textarea and it will be displayed on the fields'); ?></label> 
  1002. <textarea name="_content" id="_content" placeholder="e.g. [my_custom_shortcode]"><?php echo $this->edit_mode_value; ?></textarea> 
  1003. </p> 
  1004.  
  1005. <?php 
  1006.  
  1007. } else { 
  1008.  
  1009. ?> 
  1010.  
  1011. <div class="um-admin-editor-h"><label>Content Editor <?php $this->tooltip('Edit the content of this field here'); ?></label></div> 
  1012.  
  1013. <div class="um-admin-editor"><!-- editor dynamically loaded here --></div> 
  1014.  
  1015. <?php 
  1016.  
  1017.  
  1018. break; 
  1019.  
  1020. case '_crop': 
  1021. ?> 
  1022.  
  1023. <p><label for="_crop">Crop Feature <?php $this->tooltip('Enable/disable crop feature for this image upload and define ratio'); ?></label> 
  1024. <select name="_crop" id="_crop" class="umaf-selectjs" style="width: 100%"> 
  1025. <option value="0" <?php selected( '0', $this->edit_mode_value ); ?>>Turn Off (Default)</option> 
  1026. <option value="1" <?php selected( '1', $this->edit_mode_value ); ?>>Crop and force 1:1 ratio</option> 
  1027. <option value="3" <?php selected( '3', $this->edit_mode_value ); ?>>Crop and force user-defined ratio</option> 
  1028. </select> 
  1029. </p> 
  1030.  
  1031. <?php 
  1032. break; 
  1033.  
  1034. case '_allowed_types': 
  1035.  
  1036. if ( $this->set_field_type == 'image' ) { 
  1037.  
  1038. if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) { 
  1039. $values = $this->edit_mode_value; 
  1040. } else { 
  1041. $values = array('png', 'jpeg', 'jpg', 'gif'); 
  1042. ?> 
  1043.  
  1044. <p><label for="_allowed_types">Allowed Image Types <?php $this->tooltip('Select the image types that you want to allow to be uploaded via this field.'); ?></label> 
  1045. <select name="_allowed_types[]" id="_allowed_types" class="umaf-selectjs" multiple="multiple" style="width: 100%"> 
  1046. <?php foreach( $ultimatemember->files->allowed_image_types() as $e => $n ) { ?> 
  1047. <option value="<?php echo $e; ?>" <?php if ( in_array( $e, $values ) ) { echo 'selected'; } ?>><?php echo $n; ?></option> 
  1048. <?php } ?> 
  1049. </select> 
  1050. </p> 
  1051.  
  1052. <?php 
  1053.  
  1054. } else { 
  1055.  
  1056. if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) { 
  1057. $values = $this->edit_mode_value; 
  1058. } else { 
  1059. $values = array('pdf', 'txt'); 
  1060.  
  1061. ?> 
  1062.  
  1063. <p><label for="_allowed_types">Allowed File Types <?php $this->tooltip('Select the image types that you want to allow to be uploaded via this field.'); ?></label> 
  1064. <select name="_allowed_types[]" id="_allowed_types" class="umaf-selectjs" multiple="multiple" style="width: 100%"> 
  1065. <?php foreach( $ultimatemember->files->allowed_file_types() as $e => $n ) { ?> 
  1066. <option value="<?php echo $e; ?>" <?php if ( in_array( $e, $values ) ) { echo 'selected'; } ?>><?php echo $n; ?></option> 
  1067. <?php } ?> 
  1068. </select> 
  1069. </p> 
  1070.  
  1071. <?php 
  1072.  
  1073.  
  1074. break; 
  1075.  
  1076. case '_upload_text': 
  1077.  
  1078. if ( $this->set_field_type == 'image' ) $value = 'Drag & Drop Photo'; 
  1079. if ( $this->set_field_type == 'file' ) $value = 'Drag & Drop File'; 
  1080.  
  1081. ?> 
  1082.  
  1083. <p><label for="_upload_text">Upload Box Text <?php $this->tooltip('This is the headline that appears in the upload box for this field'); ?></label> 
  1084. <input type="text" name="_upload_text" id="_upload_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : $value; ?>" /> 
  1085. </p> 
  1086.  
  1087. <?php 
  1088. break; 
  1089.  
  1090. case '_upload_help_text': 
  1091. ?> 
  1092.  
  1093. <p><label for="_upload_help_text">Additional Instructions Text <?php $this->tooltip('If you need to add information or secondary line below the headline of upload box, enter it here'); ?></label> 
  1094. <input type="text" name="_upload_help_text" id="_upload_help_text" value="<?php echo $this->edit_mode_value; ?>" /> 
  1095. </p> 
  1096.  
  1097. <?php 
  1098. break; 
  1099.  
  1100. case '_button_text': 
  1101. ?> 
  1102.  
  1103. <p><label for="_button_text">Upload Box Text <?php $this->tooltip('The text that appears on the button. e.g. Upload'); ?></label> 
  1104. <input type="text" name="_button_text" id="_button_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 'Upload'; ?>" /> 
  1105. </p> 
  1106.  
  1107. <?php 
  1108. break; 
  1109.  
  1110. case '_max_size': 
  1111. ?> 
  1112.  
  1113. <p><label for="_max_size">Maximum Size in bytes <?php $this->tooltip('The maximum size for image that can be uploaded through this field. Leave empty for unlimited size.'); ?></label> 
  1114. <input type="text" name="_max_size" id="_max_size" value="<?php echo $this->edit_mode_value; ?>" /> 
  1115. </p> 
  1116.  
  1117. <?php 
  1118. break; 
  1119.  
  1120. case '_height': 
  1121. ?> 
  1122.  
  1123. <p><label for="_height">Textarea Height <?php $this->tooltip('The height of textarea in pixels. Default is 100 pixels'); ?></label> 
  1124. <input type="text" name="_height" id="_height" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '100px'; ?>" /> 
  1125. </p> 
  1126.  
  1127. <?php 
  1128. break; 
  1129.  
  1130. case '_spacing': 
  1131. ?> 
  1132.  
  1133. <p><label for="_spacing">Spacing <?php $this->tooltip('This is the required spacing in pixels. e.g. 20px'); ?></label> 
  1134. <input type="text" name="_spacing" id="_spacing" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '20px'; ?>" /> 
  1135. </p> 
  1136.  
  1137. <?php 
  1138. break; 
  1139.  
  1140. case '_is_multi': 
  1141. ?> 
  1142.  
  1143. <p><label for="_is_multi">Allow multiple selections <?php $this->tooltip('Enable/disable multiple selections for this field'); ?></label> 
  1144. <?php  
  1145. if ( isset( $this->edit_mode_value ) ) { 
  1146. $this->ui_on_off('_is_multi', $this->edit_mode_value, true, 1, '_max_selections', 'xxx'); 
  1147. } else { 
  1148. $this->ui_on_off('_is_multi', 0, true, 1, '_max_selections', 'xxx'); 
  1149. ?> 
  1150. </p> 
  1151.  
  1152. <?php 
  1153. break; 
  1154.  
  1155. case '_max_selections': 
  1156. ?> 
  1157.  
  1158. <p class="_max_selections"><label for="_max_selections">Maximum number of selections <?php $this->tooltip('Enter a number here to force a maximum number of selections by user for this field'); ?></label> 
  1159. <input type="text" name="_max_selections" id="_max_selections" value="<?php echo $this->edit_mode_value; ?>" /> 
  1160. </p> 
  1161.  
  1162. <?php 
  1163. break; 
  1164.  
  1165. case '_min_selections': 
  1166. ?> 
  1167.  
  1168. <p class="_min_selections"><label for="_min_selections">Minimum number of selections <?php $this->tooltip('Enter a number here to force a minimum number of selections by user for this field'); ?></label> 
  1169. <input type="text" name="_min_selections" id="_min_selections" value="<?php echo $this->edit_mode_value; ?>" /> 
  1170. </p> 
  1171.  
  1172. <?php 
  1173. break; 
  1174.  
  1175. case '_max_entries': 
  1176. ?> 
  1177.  
  1178. <p class="_max_entries"><label for="_max_selections">Maximum number of entries <?php $this->tooltip('This is the max number of entries the user can add via field group.'); ?></label> 
  1179. <input type="text" name="_max_entries" id="_max_entries" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 10; ?>" /> 
  1180. </p> 
  1181.  
  1182. <?php 
  1183. break; 
  1184.  
  1185. case '_max_words': 
  1186. ?> 
  1187.  
  1188. <p><label for="_max_words">Maximum allowed words <?php $this->tooltip('If you want to enable a maximum number of words to be input in this textarea. Leave empty to disable this setting'); ?></label> 
  1189. <input type="text" name="_max_words" id="_max_words" value="<?php echo $this->edit_mode_value; ?>" /> 
  1190. </p> 
  1191.  
  1192. <?php 
  1193. break; 
  1194.  
  1195. case '_min': 
  1196. ?> 
  1197.  
  1198. <p><label for="_min">Minimum Number <?php $this->tooltip( __('Minimum number that can be entered in this field', 'ultimatemember') ); ?></label> 
  1199. <input type="text" name="_min" id="_min" value="<?php echo $this->edit_mode_value; ?>" /> 
  1200. </p> 
  1201.  
  1202. <?php 
  1203. break; 
  1204.  
  1205. case '_max': 
  1206. ?> 
  1207.  
  1208. <p><label for="_max">Maximum Number <?php $this->tooltip( __('Maximum number that can be entered in this field', 'ultimatemember') ); ?></label> 
  1209. <input type="text" name="_max" id="_max" value="<?php echo $this->edit_mode_value; ?>" /> 
  1210. </p> 
  1211.  
  1212. <?php 
  1213. break; 
  1214.  
  1215. case '_min_chars': 
  1216. ?> 
  1217.  
  1218. <p><label for="_min_chars">Minimum length <?php $this->tooltip('If you want to enable a minimum number of characters to be input in this field. Leave empty to disable this setting'); ?></label> 
  1219. <input type="text" name="_min_chars" id="_min_chars" value="<?php echo $this->edit_mode_value; ?>" /> 
  1220. </p> 
  1221.  
  1222. <?php 
  1223. break; 
  1224.  
  1225. case '_max_chars': 
  1226. ?> 
  1227.  
  1228. <p><label for="_max_chars">Maximum length <?php $this->tooltip('If you want to enable a maximum number of characters to be input in this field. Leave empty to disable this setting'); ?></label> 
  1229. <input type="text" name="_max_chars" id="_max_chars" value="<?php echo $this->edit_mode_value; ?>" /> 
  1230. </p> 
  1231.  
  1232. <?php 
  1233. break; 
  1234.  
  1235. case '_html': 
  1236. ?> 
  1237.  
  1238. <p><label for="_html">Does this textarea accept HTML? <?php $this->tooltip('Turn on/off HTML tags for this textarea'); ?></label> 
  1239. <?php if ( isset( $this->edit_mode_value ) ) $this->ui_on_off('_html', $this->edit_mode_value ); else $this->ui_on_off('_html', 0); ?> 
  1240. </p> 
  1241.  
  1242. <?php 
  1243. break; 
  1244.  
  1245. case '_options': 
  1246.  
  1247. if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) { 
  1248. $values = implode("\n", $this->edit_mode_value); 
  1249. } else if ( $this->edit_mode_value ) { 
  1250. $values = $this->edit_mode_value; 
  1251. } else { 
  1252. $values = ''; 
  1253.  
  1254. ?> 
  1255.  
  1256. <p><label for="_options">Edit Choices <?php $this->tooltip('Enter one choice per line. This will represent the available choices or selections available for user.'); ?></label> 
  1257. <textarea name="_options" id="_options"><?php echo $values; ?></textarea> 
  1258. </p> 
  1259.  
  1260. <?php 
  1261. break; 
  1262.  
  1263. case '_title': 
  1264. ?> 
  1265.  
  1266. <p><label for="_title">Title <?php $this->tooltip('This is the title of the field for your reference in the backend. The title will not appear on the front-end of your website.'); ?></label> 
  1267. <input type="text" name="_title" id="_title" value="<?php echo htmlspecialchars($this->edit_mode_value, ENT_QUOTES); ?>" /> 
  1268. </p> 
  1269.  
  1270. <?php 
  1271. break; 
  1272.  
  1273. case '_id': 
  1274.  
  1275. ?> 
  1276.  
  1277. <p style="display:none"><label for="_id">Unique ID</label> 
  1278. <input type="text" name="_id" id="_id" value="<?php echo $this->edit_mode_value; ?>" /> 
  1279. </p> 
  1280.  
  1281. <?php 
  1282.  
  1283. break; 
  1284.  
  1285. case '_metakey': 
  1286.  
  1287. if ( $this->in_edit ) {  
  1288.  
  1289. ?> 
  1290.  
  1291. <p><label for="_metakey">Meta Key <?php $this->tooltip('The meta key cannot be changed for duplicated fields or when editing an existing field. If you require a different meta key please create a new field.'); ?></label> 
  1292. <input type="text" name="_metakey_locked" id="_metakey_locked" value="<?php echo $this->edit_mode_value; ?>" disabled /> 
  1293. </p> 
  1294.  
  1295. <?php } else { ?> 
  1296.  
  1297. <p><label for="_metakey">Meta Key <?php $this->tooltip('A meta key is required to store the entered info in this field in the database. The meta key should be unique to this field and be written in lowercase with an underscore ( _ ) separating words e.g country_list or job_title'); ?></label> 
  1298. <input type="text" name="_metakey" id="_metakey" value="" /> 
  1299. </p> 
  1300.  
  1301. <?php 
  1302.  
  1303.  
  1304. break; 
  1305.  
  1306. case '_help': 
  1307. ?> 
  1308.  
  1309. <p><label for="_help">Help Text <?php $this->tooltip('This is the text that appears in a tooltip when a user hovers over the info icon. Help text is useful for providing users with more information about what they should enter in the field. Leave blank if no help text is needed for field.'); ?></label> 
  1310. <input type="text" name="_help" id="_help" value="<?php echo $this->edit_mode_value; ?>" /> 
  1311. </p> 
  1312.  
  1313. <?php 
  1314. break; 
  1315.  
  1316. case '_default': 
  1317. ?> 
  1318.  
  1319. <?php if ( $this->set_field_type == 'textarea' ) { ?> 
  1320.  
  1321. <p><label for="_default">Default Text <?php $this->tooltip('Text to display by default in this field'); ?></label> 
  1322. <textarea name="_default" id="_default"><?php echo $this->edit_mode_value; ?></textarea> 
  1323. </p> 
  1324.  
  1325. <?php } elseif ( $this->set_field_type == 'rating' ) { ?> 
  1326.  
  1327. <p><label for="_default">Default Rating <?php $this->tooltip('If you wish the rating field to be prefilled with a number of stars, enter it here.'); ?></label> 
  1328. <input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" /> 
  1329. </p> 
  1330.  
  1331. <?php } else { ?> 
  1332.  
  1333. <p><label for="_default">Default Value <?php $this->tooltip('This option allows you to pre-fill the field with a default value prior to the user entering a value in the field. Leave blank to have no default value'); ?></label> 
  1334. <input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" /> 
  1335. </p> 
  1336.  
  1337. <?php } ?> 
  1338.  
  1339. <?php 
  1340. break; 
  1341.  
  1342. case '_label': 
  1343. ?> 
  1344.  
  1345. <p><label for="_label">Label <?php $this->tooltip('The field label is the text that appears above the field on your front-end form. Leave blank to not show a label above field.'); ?></label> 
  1346. <input type="text" name="_label" id="_label" value="<?php echo htmlspecialchars($this->edit_mode_value, ENT_QUOTES); ?>" /> 
  1347. </p> 
  1348.  
  1349. <?php 
  1350. break; 
  1351.  
  1352. case '_placeholder': 
  1353. ?> 
  1354.  
  1355. <p><label for="_placeholder">Placeholder <?php $this->tooltip('This is the text that appears within the field e.g please enter your email address. Leave blank to not show any placeholder text.'); ?></label> 
  1356. <input type="text" name="_placeholder" id="_placeholder" value="<?php echo htmlspecialchars($this->edit_mode_value, ENT_QUOTES); ?>" /> 
  1357. </p> 
  1358.  
  1359. <?php 
  1360. break; 
  1361.  
  1362. case '_public': 
  1363. ?> 
  1364.  
  1365. <p><label for="_public">Privacy <?php $this->tooltip('Field privacy allows you to select who can view this field on the front-end. The site admin can view all fields regardless of the option set here.'); ?></label> 
  1366. <select name="_public" id="_public" class="umaf-selectjs um-adm-conditional" data-cond1='-2' data-cond1-show='_roles' data-cond2='-3' data-cond2-show='_roles' style="width: 100%"> 
  1367. <option value="1" <?php selected( 1, $this->edit_mode_value ); ?>>Everyone</option> 
  1368. <option value="2" <?php selected( 2, $this->edit_mode_value ); ?>>Members</option> 
  1369. <option value="-1" <?php selected( -1, $this->edit_mode_value ); ?>>Only visible to profile owner and admins</option> 
  1370. <option value="-3" <?php selected( -3, $this->edit_mode_value ); ?>>Only visible to profile owner and specific roles</option> 
  1371. <option value="-2" <?php selected( -2, $this->edit_mode_value ); ?>>Only specific member roles</option> 
  1372. </select> 
  1373. </p> 
  1374.  
  1375. <?php 
  1376. break; 
  1377.  
  1378. case '_roles': 
  1379.  
  1380. if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) { 
  1381. $values = $this->edit_mode_value; 
  1382. } else { 
  1383. $values = array(''); 
  1384.  
  1385. ?> 
  1386.  
  1387. <p class="_roles"><label for="_roles">Select member roles <?php $this->tooltip('Select the member roles that can view this field on the front-end.'); ?></label> 
  1388. <select name="_roles[]" id="_roles" class="umaf-selectjs" style="width: 100%" multiple="multiple"> 
  1389.  
  1390. <?php foreach($ultimatemember->query->get_roles() as $key => $value) { ?> 
  1391.  
  1392. <option value="<?php echo $key; ?>" <?php if ( in_array( $key, $values ) ) { echo 'selected'; } ?>><?php echo $value; ?></option> 
  1393.  
  1394. <?php } ?> 
  1395.  
  1396. </select> 
  1397. </p> 
  1398.  
  1399. <?php 
  1400. break; 
  1401.  
  1402. case '_required': 
  1403.  
  1404. if ( $this->set_field_type == 'password' ) 
  1405. $def_required = 1; 
  1406. else  
  1407. $def_required = 0; 
  1408.  
  1409. ?> 
  1410.  
  1411. <div class="um-admin-tri"> 
  1412.  
  1413. <p><label for="_required">Is this field required? <?php $this->tooltip('This option allows you to set whether the field must be filled in before the form can be processed.'); ?></label> 
  1414. <?php if ( isset( $this->edit_mode_value ) ) $this->ui_on_off('_required', $this->edit_mode_value ); else $this->ui_on_off('_required', $def_required); ?> 
  1415. </p> 
  1416.  
  1417. </div> 
  1418.  
  1419. <?php 
  1420. break; 
  1421.  
  1422. case '_editable': 
  1423. ?> 
  1424.  
  1425. <div class="um-admin-tri"> 
  1426.  
  1427. <p><label for="_editable">Can user edit this field? <?php $this->tooltip('This option allows you to set whether or not the user can edit the information in this field.'); ?></label> 
  1428. <?php if ( isset( $this->edit_mode_value ) ) $this->ui_on_off('_editable', $this->edit_mode_value ); else $this->ui_on_off('_editable', 1); ?> 
  1429. </p> 
  1430.  
  1431. </div> 
  1432.  
  1433. <?php 
  1434. break; 
  1435.  
  1436. case '_number': 
  1437. ?> 
  1438.  
  1439. <p><label for="_number">Rating System <?php $this->tooltip('Choose whether you want a 5-stars or 10-stars ratings based here.'); ?></label> 
  1440. <select name="_number" id="_number" class="umaf-selectjs" style="width: 100%"> 
  1441. <option value="5" <?php selected( 5, $this->edit_mode_value ); ?>>5 stars rating system</option> 
  1442. <option value="10" <?php selected( 10, $this->edit_mode_value ); ?>>10 stars rating system</option> 
  1443. </select> 
  1444. </p> 
  1445.  
  1446. <?php 
  1447. break; 
  1448.  
  1449. case '_custom_dropdown_options_source': 
  1450. ?> 
  1451.  
  1452. <p><label for="_custom_dropdown_options_source">Choices Callback<?php $this->tooltip('Add a callback source to retrieve choices.'); ?></label> 
  1453. <input type="text" name="_custom_dropdown_options_source" id="_custom_dropdown_options_source" value="<?php echo htmlspecialchars($this->edit_mode_value, ENT_QUOTES); ?>" /> 
  1454. </p> 
  1455.  
  1456. <?php 
  1457. break; 
  1458.  
  1459.  
  1460. case '_parent_dropdown_relationship': 
  1461. ?> 
  1462.  
  1463. <p><label for="_parent_dropdown_relationship">Parent Option<?php $this->tooltip('Dynamically populates the option based from selected parent option.'); ?></label> 
  1464. <select name="_parent_dropdown_relationship" id="_parent_dropdown_relationship" class="umaf-selectjs" style="width: 100%"> 
  1465. <option value="">No Selected</option> 
  1466. <?php  
  1467. if ( $ultimatemember->builtin->custom_fields ) { 
  1468. foreach ($ultimatemember->builtin->custom_fields as $field_key => $array) { 
  1469. if( in_array( $array['type'], array( 'select' ) ) 
  1470. && $field_args['metakey'] != $array['metakey'] ) { 
  1471. echo "<option value='".$array['metakey']."' ".selected( $array['metakey'], $this->edit_mode_value ).">".$array['title']."</option>"; 
  1472.  
  1473. ?> 
  1474. </select> 
  1475. </p> 
  1476.  
  1477. <?php 
  1478. break; 
  1479.  
  1480.  
  1481.  
  1482.