diff --git a/admin/core/um-admin-metabox.php b/admin/core/um-admin-metabox.php index 633368ec..1be0e641 100644 --- a/admin/core/um-admin-metabox.php +++ b/admin/core/um-admin-metabox.php @@ -105,10 +105,13 @@ class UM_Admin_Metabox { /*** *** @on/off UI ***/ - function ui_on_off( $id, $default=0, $is_conditional=false, $cond1='', $cond1_show='', $cond1_hide='' ) { + function ui_on_off( $id, $default=0, $is_conditional=false, $cond1='', $cond1_show='', $cond1_hide='', $yes='', $no='' ) { $meta = get_post_meta( get_the_ID(), $id, true ); + $yes = ( !empty( $yes ) ) ? $yes : __('Yes'); + $no = ( !empty( $no ) ) ? $no : __('No'); + if (isset($this->postmeta[$id][0]) || $meta ) { $active = ( isset( $this->postmeta[$id][0] ) ) ? $this->postmeta[$id][0] : $meta; } else { @@ -123,8 +126,8 @@ class UM_Admin_Metabox { - Yes - No + + /> @@ -187,7 +190,19 @@ class UM_Admin_Metabox { $UM_Builder->form_id = get_the_ID(); } - include_once um_path . 'admin/templates/form/'. $box['id'] . '.php'; + preg_match('#\{.*?\}#s', $box['id'], $matches); + + if ( isset($matches[0]) ){ + $path = $matches[0]; + $box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] ); + } else { + $path = um_path; + } + + $path = str_replace('{','', $path ); + $path = str_replace('}','', $path ); + + include_once $path . 'admin/templates/form/'. $box['id'] . '.php'; wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_form_nonce' ); } @@ -244,9 +259,15 @@ class UM_Admin_Metabox { add_meta_box('um-admin-form-shortcode', __('Shortcode'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); add_meta_box('um-admin-form-register_customize', __('Customize this form'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); + + do_action('um_admin_custom_register_metaboxes'); + add_meta_box('um-admin-form-profile_customize', __('Customize this form'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); + add_meta_box('um-admin-form-login_customize', __('Customize this form'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); + do_action('um_admin_custom_login_metaboxes'); + add_meta_box('um-admin-form-profile_settings', __('User Meta'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default'); add_meta_box('um-admin-form-login_settings', __('Options'), array(&$this, 'load_metabox_form'), 'um_form', 'side', 'default');