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