-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathwidget.php
More file actions
167 lines (138 loc) · 6.05 KB
/
Copy pathwidget.php
File metadata and controls
167 lines (138 loc) · 6.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
add_filter('widget_text', 'do_shortcode');
add_action( 'widgets_init', 'widget_new_author' );
function widget_new_author() {
register_widget( 'Widget_new_author' );
}
class Widget_new_author extends WP_Widget {
function Widget_new_author() {
$widget_ops = array( 'classname' => 'widget-new-author', 'description' => __('New users on the website','rcl') );
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'widget-new-author' );
$this->WP_Widget( 'widget-new-author', __('New users','rcl'), $widget_ops, $control_ops );
}
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', $instance['title'] );
$count_user = $instance['count_user'];
$all = $instance['page_all_users'];
if ( !$count_user ) $count_user = 12;
echo $before_widget;
if ( $title ) echo $before_title . $title . $after_title;
echo do_shortcode('[userlist type="mini" filter="0" widget="1" limit="'.$count_user.'" search="no"]');
if($all) echo '<p class="clear alignright"><a href="'.get_permalink($all).'">'.__('All users','rcl').'</a></p>';
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['count_user'] = $new_instance['count_user'];
$instance['page_all_users'] = $new_instance['page_all_users'];
return $instance;
}
function form( $instance ) {
$defaults = array( 'title' => __('New users','rcl'), 'count_user' => '12');
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title','rcl'); ?>:</label>
<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('The number of displayed users','rcl'); ?>:</label>
<input id="<?php echo $this->get_field_id( 'count_user' ); ?>" name="<?php echo $this->get_field_name( 'count_user' ); ?>" value="<?php echo $instance['count_user']; ?>" style="width:100%;" />
</p>
<?php
$args = array(
'selected' => $instance['page_all_users'],
'name' => $this->get_field_name( 'page_all_users' ),
'show_option_none' => __('Not selected','rcl'),
'echo' => 0
);
?>
<p>
<label for="<?php echo $this->get_field_id( 'page_all_users' ); ?>"><?php _e('Page all users','rcl'); ?>:</label>
<?php echo wp_dropdown_pages( $args ); ?>
</p>
<?php
}
}
add_action( 'widgets_init', 'widget_online_users' );
function widget_online_users() {
register_widget( 'Widget_online_users' );
}
class Widget_online_users extends WP_Widget {
function Widget_online_users() {
$widget_ops = array( 'classname' => 'widget_online_users', 'description' => __('Conclusion the users in the network','rcl') );
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'online-users-widget' );
$this->WP_Widget( 'online-users-widget', __('Users on the network','rcl'), $widget_ops, $control_ops );
}
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', $instance['title'] );
$all = $instance['page_all_users'];
echo $before_widget;
if ( $title ) echo $before_title . $title . $after_title;
echo do_shortcode('[userlist type="mini" limit="10" onlyaction="1" widget="1" orderby="action" search="no"]');
if($all) echo '<p class="clear alignright"><a href="'.get_permalink($all).'">'.__('All users','rcl').'</a></p>';
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['page_all_users'] = $new_instance['page_all_users'];
return $instance;
}
function form( $instance ) {
$defaults = array( 'title' => __('Right now','rcl'));
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title','rcl'); ?>:</label>
<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />
</p>
<?php
$args = array(
'selected' => $instance['page_all_users'],
'name' => $this->get_field_name( 'page_all_users' ),
'show_option_none' => __('Not selected','rcl'),
'echo' => 0
);
?>
<p>
<label for="<?php echo $instance['page_all_users']; ?>"><?php _e('Page all users','rcl'); ?>:</label>
<?php echo wp_dropdown_pages( $args ); ?>
</p>
<?php
}
}
add_action( 'widgets_init', 'widget_author_profil' );
function widget_author_profil() {
register_widget( 'Widget_author_profil' );
}
class Widget_author_profil extends WP_Widget {
function Widget_author_profil() {
$widget_ops = array( 'classname' => 'widget_author_profil', 'description' => __('The block with the main profile information','rcl') );
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'widget-author-profil' );
$this->WP_Widget( 'widget-author-profil', __('User profile','rcl'), $widget_ops, $control_ops );
}
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', $instance['title'] );
echo $before_widget;
if ( $title ) echo $before_title . $title . $after_title;
echo rcl_get_authorize_form();
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
return $instance;
}
function form( $instance ) {
$defaults = array( 'title' => __('Control panel','rcl'));
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title','rcl'); ?>:</label>
<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />
</p>
<?php
}
}