| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | 'class_name' => __CLASS__, |
| 26 | 26 | 'base_id' => 'uwp_forgot', |
| 27 | 27 | 'name' => __('UWP > Forgot','userswp'), |
| 28 | 28 | 'widget_ops' => array( |
| 29 | - 'classname' => 'uwp-forgot-class', | |
| 29 | + 'classname' => 'uwp-forgot-class bsui', | |
| 30 | 30 | 'description' => esc_html__('Displays forgot password form.','userswp'), |
| 31 | 31 | ), |
| 32 | 32 | 'arguments' => array( |
| 33 | 33 | 'title' => array( |
| @@ -37,8 +37,38 @@ | ||
| 37 | 37 | 'desc_tip' => true, |
| 38 | 38 | 'default' => '', |
| 39 | 39 | 'advanced' => false |
| 40 | 40 | ), |
| 41 | + 'form_title' => array( | |
| 42 | + 'title' => __( 'Form title', 'userswp' ), | |
| 43 | + 'desc' => __( 'Enter the form title (or "0" for no title)', 'userswp' ), | |
| 44 | + 'type' => 'text', | |
| 45 | + 'desc_tip' => true, | |
| 46 | + 'default' => '', | |
| 47 | + 'placeholder' => __('Forgot Password?', 'userswp'), | |
| 48 | + 'advanced' => true | |
| 49 | + ), | |
| 50 | + 'design_style' => array( | |
| 51 | + 'title' => __('Design Style', 'userswp'), | |
| 52 | + 'desc' => __('The design style to use.', 'userswp'), | |
| 53 | + 'type' => 'select', | |
| 54 | + 'options' => array( | |
| 55 | + "" => __('default', 'userswp'), | |
| 56 | + "bootstrap" => __('Style 1', 'userswp'), | |
| 57 | + ), | |
| 58 | + 'default' => '', | |
| 59 | + 'desc_tip' => true, | |
| 60 | + 'advanced' => true | |
| 61 | + ), | |
| 62 | + 'css_class' => array( | |
| 63 | + 'type' => 'text', | |
| 64 | + 'title' => __('Extra class:', 'userswp'), | |
| 65 | + 'desc' => __('Give the wrapper an extra class so you can style things as you want.', 'userswp'), | |
| 66 | + 'placeholder' => '', | |
| 67 | + 'default' => '', | |
| 68 | + 'desc_tip' => true, | |
| 69 | + 'advanced' => true, | |
| 70 | + ), | |
| 41 | 71 | ) |
| 42 | 72 | |
| 43 | 73 | ); |
| 44 | 74 | |
| @@ -45,37 +75,49 @@ | ||
| 45 | 75 | |
| 46 | 76 | parent::__construct( $options ); |
| 47 | 77 | } |
| 48 | 78 | |
| 79 | + /** | |
| 80 | + * The Super block output function. | |
| 81 | + * | |
| 82 | + * @param array $args | |
| 83 | + * @param array $widget_args | |
| 84 | + * @param string $content | |
| 85 | + * | |
| 86 | + * @return mixed|string|bool | |
| 87 | + */ | |
| 49 | 88 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 50 | 89 | |
| 51 | - if (is_user_logged_in()) { | |
| 90 | + if (is_user_logged_in() && !is_admin()) { | |
| 52 | 91 | return false; |
| 53 | 92 | } |
| 54 | 93 | |
| 94 | + $defaults = array( | |
| 95 | + 'form_title' => __('Forgot Password?','userswp'), | |
| 96 | + 'css_class' => '' | |
| 97 | + ); | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * Parse incoming $args into an array and merge it with $defaults | |
| 101 | + */ | |
| 102 | + $args = wp_parse_args( $args, $defaults ); | |
| 103 | + | |
| 55 | 104 | ob_start(); |
| 56 | 105 | |
| 57 | 106 | echo '<div class="uwp_widgets uwp_widget_forgot">'; |
| 58 | 107 | |
| 59 | - $temp_obj = new UsersWP_Templates(); | |
| 108 | + $design_style = !empty($args['design_style']) ? esc_attr($args['design_style']) : uwp_get_option("design_style",'bootstrap'); | |
| 109 | + $template = $design_style ? $design_style."/forgot.php" : "forgot.php"; | |
| 60 | 110 | |
| 61 | - $template = $temp_obj->uwp_locate_template('forgot'); | |
| 62 | - | |
| 63 | 111 | echo '<div class="uwp_page">'; |
| 64 | 112 | |
| 65 | - if ($template) { | |
| 66 | - include($template); | |
| 67 | - } | |
| 113 | + uwp_get_template($template, $args); | |
| 68 | 114 | |
| 69 | 115 | echo '</div>'; |
| 70 | 116 | |
| 71 | 117 | echo '</div>'; |
| 72 | 118 | |
| 73 | - $output = ob_get_contents(); | |
| 74 | - | |
| 75 | - ob_end_clean(); | |
| 76 | - | |
| 77 | - return trim($output); | |
| 119 | + return ob_get_clean(); | |
| 78 | 120 | |
| 79 | 121 | } |
| 80 | 122 | |
| 81 | 123 | } |