| @@ -8,9 +8,8 @@ | ||
| 8 | 8 | * |
| 9 | 9 | * @since 1.0.22 |
| 10 | 10 | */ |
| 11 | 11 | class UWP_Author_Box_Widget extends WP_Super_Duper { |
| 12 | - public $arguments; | |
| 13 | 12 | |
| 14 | 13 | /** |
| 15 | 14 | * Register the profile widget with WordPress. |
| 16 | 15 | * |
| @@ -29,8 +28,19 @@ | ||
| 29 | 28 | 'widget_ops' => array( |
| 30 | 29 | 'classname' => 'uwp_widgets uwp_widget_author_box bsui', |
| 31 | 30 | 'description' => esc_html__('Displays author box.','userswp'), |
| 32 | 31 | ), |
| 32 | + 'arguments' => array( | |
| 33 | + 'title' => array( | |
| 34 | + 'title' => __( 'Widget title', 'userswp' ), | |
| 35 | + 'desc' => __( 'Enter widget title.', 'userswp' ), | |
| 36 | + 'type' => 'text', | |
| 37 | + 'desc_tip' => true, | |
| 38 | + 'default' => '', | |
| 39 | + 'advanced' => false | |
| 40 | + ), | |
| 41 | + ) | |
| 42 | + | |
| 33 | 43 | ); |
| 34 | 44 | |
| 35 | 45 | |
| 36 | 46 | parent::__construct( $options ); |
| @@ -35,72 +45,8 @@ | ||
| 35 | 45 | |
| 36 | 46 | parent::__construct( $options ); |
| 37 | 47 | } |
| 38 | 48 | |
| 39 | - /** | |
| 40 | - * Set widget arguments. | |
| 41 | - * | |
| 42 | - */ | |
| 43 | - public function set_arguments() | |
| 44 | - { | |
| 45 | - $arguments = array( | |
| 46 | - 'title' => array( | |
| 47 | - 'title' => __('Widget title', 'userswp'), | |
| 48 | - 'desc' => __('Enter widget title.', 'userswp'), | |
| 49 | - 'type' => 'text', | |
| 50 | - 'desc_tip' => true, | |
| 51 | - 'default' => '', | |
| 52 | - 'advanced' => false | |
| 53 | - ) | |
| 54 | - ); | |
| 55 | - | |
| 56 | - // margins mobile | |
| 57 | - $arguments['mt'] = sd_get_margin_input('mt', array('device_type' => 'Mobile')); | |
| 58 | - $arguments['mr'] = sd_get_margin_input('mr', array('device_type' => 'Mobile')); | |
| 59 | - $arguments['mb'] = sd_get_margin_input('mb', array('device_type' => 'Mobile')); | |
| 60 | - $arguments['ml'] = sd_get_margin_input('ml', array('device_type' => 'Mobile')); | |
| 61 | - | |
| 62 | - // margins tablet | |
| 63 | - $arguments['mt_md'] = sd_get_margin_input('mt', array('device_type' => 'Tablet')); | |
| 64 | - $arguments['mr_md'] = sd_get_margin_input('mr', array('device_type' => 'Tablet')); | |
| 65 | - $arguments['mb_md'] = sd_get_margin_input('mb', array('device_type' => 'Tablet')); | |
| 66 | - $arguments['ml_md'] = sd_get_margin_input('ml', array('device_type' => 'Tablet')); | |
| 67 | - | |
| 68 | - // margins desktop | |
| 69 | - $arguments['mt_lg'] = sd_get_margin_input('mt', array('device_type' => 'Desktop')); | |
| 70 | - $arguments['mr_lg'] = sd_get_margin_input('mr', array('device_type' => 'Desktop')); | |
| 71 | - $arguments['mb_lg'] = sd_get_margin_input('mb', array('device_type' => 'Desktop')); | |
| 72 | - $arguments['ml_lg'] = sd_get_margin_input('ml', array('device_type' => 'Desktop')); | |
| 73 | - | |
| 74 | - // padding | |
| 75 | - $arguments['pt'] = sd_get_padding_input('pt', array('device_type' => 'Mobile')); | |
| 76 | - $arguments['pr'] = sd_get_padding_input('pr', array('device_type' => 'Mobile')); | |
| 77 | - $arguments['pb'] = sd_get_padding_input('pb', array('device_type' => 'Mobile')); | |
| 78 | - $arguments['pl'] = sd_get_padding_input('pl', array('device_type' => 'Mobile')); | |
| 79 | - | |
| 80 | - // padding tablet | |
| 81 | - $arguments['pt_md'] = sd_get_padding_input('pt', array('device_type' => 'Tablet')); | |
| 82 | - $arguments['pr_md'] = sd_get_padding_input('pr', array('device_type' => 'Tablet')); | |
| 83 | - $arguments['pb_md'] = sd_get_padding_input('pb', array('device_type' => 'Tablet')); | |
| 84 | - $arguments['pl_md'] = sd_get_padding_input('pl', array('device_type' => 'Tablet')); | |
| 85 | - | |
| 86 | - // padding desktop | |
| 87 | - $arguments['pt_lg'] = sd_get_padding_input('pt', array('device_type' => 'Desktop')); | |
| 88 | - $arguments['pr_lg'] = sd_get_padding_input('pr', array('device_type' => 'Desktop')); | |
| 89 | - $arguments['pb_lg'] = sd_get_padding_input('pb', array('device_type' => 'Desktop')); | |
| 90 | - $arguments['pl_lg'] = sd_get_padding_input('pl', array('device_type' => 'Desktop')); | |
| 91 | - | |
| 92 | - // border | |
| 93 | - $arguments['border'] = sd_get_border_input('border'); | |
| 94 | - $arguments['rounded'] = sd_get_border_input('rounded'); | |
| 95 | - $arguments['rounded_size'] = sd_get_border_input('rounded_size'); | |
| 96 | - | |
| 97 | - // shadow | |
| 98 | - $arguments['shadow'] = sd_get_shadow_input('shadow'); | |
| 99 | - | |
| 100 | - return apply_filters('uwp_author_box_widget_arguments', $arguments); | |
| 101 | - } | |
| 102 | - | |
| 103 | 49 | /** |
| 104 | 50 | * The Super block output function. |
| 105 | 51 | * |
| 106 | 52 | * @param array $args |
| @@ -112,13 +58,8 @@ | ||
| 112 | 58 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 113 | 59 | |
| 114 | 60 | global $post, $wpdb; |
| 115 | 61 | |
| 116 | - // Ensure we have an array. | |
| 117 | - if ( ! is_array( $args ) ) { | |
| 118 | - $args = array(); | |
| 119 | - } | |
| 120 | - | |
| 121 | 62 | if(empty($post->ID)){ |
| 122 | 63 | return ''; |
| 123 | 64 | } |
| 124 | 65 | |
| @@ -130,9 +71,9 @@ | ||
| 130 | 71 | |
| 131 | 72 | $design_style = uwp_get_option("design_style",'bootstrap'); |
| 132 | 73 | if( $design_style =='bootstrap'){ |
| 133 | 74 | $output = uwp_get_option('author_box_content_bootstrap'); |
| 134 | - if(!$output){$output = UsersWP_Defaults::author_box_content_bootstrap( $args );} | |
| 75 | + if(!$output){$output = UsersWP_Defaults::author_box_content_bootstrap();} | |
| 135 | 76 | }else{ |
| 136 | 77 | $output = uwp_get_option('author_box_content'); |
| 137 | 78 | if(!$output){$output = UsersWP_Defaults::author_box_content();} |
| 138 | 79 | } |
| @@ -144,9 +85,8 @@ | ||
| 144 | 85 | $author_id = $post->post_author; |
| 145 | 86 | $author_link = uwp_build_profile_tab_url($author_id); |
| 146 | 87 | $user = get_user_by('id', $author_id); |
| 147 | 88 | $author_name = esc_attr( $user->display_name ); |
| 148 | - $author_display_name = uwp_get_username($user->ID); | |
| 149 | 89 | $author_bio = get_user_meta($author_id, 'description', true); |
| 150 | 90 | $limit_words = apply_filters('uwp_author_bio_content_limit', uwp_get_option('author_box_bio_limit', 200)); |
| 151 | 91 | $author_bio = wp_trim_words( $author_bio, $limit_words, '...' ); |
| 152 | 92 | $meta_table = get_usermeta_table_prefix() . 'uwp_usermeta'; |
| @@ -160,9 +100,8 @@ | ||
| 160 | 100 | '[#post_modified#]' => esc_attr( $post->post_modified ), |
| 161 | 101 | '[#post_date#]' => esc_attr( $post->post_date ), |
| 162 | 102 | '[#author_id#]' => absint( $post->post_author ), |
| 163 | 103 | '[#author_name#]' => esc_attr( $author_name ), |
| 164 | - '[#author_display_name#]' => $author_display_name, | |
| 165 | 104 | '[#author_link#]' => esc_url( $author_link ), |
| 166 | 105 | '[#author_bio#]' => esc_textarea( $author_bio ), |
| 167 | 106 | '[#author_image#]' => get_avatar($post->post_author, $avatar_size), |
| 168 | 107 | '[#author_image_url#]' => get_avatar_url($post->post_author, $avatar_size), |