1
1
<?php
2
-
3
- // Adds compatibility methods between WP_Widget and scbForms
4
-
2
+ /**
3
+ * Adds compatibility methods between WP_Widget and scbForms.
4
+ */
5
5
abstract class scbWidget extends WP_Widget {
6
+
7
+ /**
8
+ * Widget defaults.
9
+ * @var array
10
+ */
6
11
protected $ defaults = array ();
7
12
13
+ /**
14
+ * Widgets to register.
15
+ * @var array
16
+ */
8
17
private static $ scb_widgets = array ();
9
18
19
+ /**
20
+ * Initializes widget.
21
+ *
22
+ * @param string $class
23
+ * @param string $file (optional)
24
+ * @param string $base (optional)
25
+ *
26
+ * @return void
27
+ */
10
28
public static function init ( $ class , $ file = '' , $ base = '' ) {
11
29
self ::$ scb_widgets [] = $ class ;
12
30
@@ -18,13 +36,25 @@ public static function init( $class, $file = '', $base = '' ) {
18
36
}
19
37
}
20
38
39
+ /**
40
+ * Registers widgets.
41
+ *
42
+ * @return void
43
+ */
21
44
public static function _scb_register () {
22
45
foreach ( self ::$ scb_widgets as $ widget ) {
23
46
register_widget ( $ widget );
24
47
}
25
48
}
26
49
27
- // A pre-filled method, for convenience
50
+ /**
51
+ * Displays widget content.
52
+ *
53
+ * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
54
+ * @param array $instance The settings for the particular instance of the widget.
55
+ *
56
+ * @return void
57
+ */
28
58
public function widget ( $ args , $ instance ) {
29
59
$ instance = wp_parse_args ( $ instance , $ this ->defaults );
30
60
@@ -43,15 +73,27 @@ public function widget( $args, $instance ) {
43
73
echo $ after_widget ;
44
74
}
45
75
46
- // This is where the actual widget content goes
76
+ /**
77
+ * This is where the actual widget content goes.
78
+ *
79
+ * @param array $instance The settings for the particular instance of the widget.
80
+ *
81
+ * @return void
82
+ */
47
83
protected function content ( $ instance ) { }
48
84
49
85
50
86
//_____HELPER METHODS_____
51
87
52
88
53
- // See scbForms::input()
54
- // Allows extra parameter $args['title']
89
+ /**
90
+ * Generates a input form field.
91
+ *
92
+ * @param array $args
93
+ * @param array $formdata (optional)
94
+ *
95
+ * @return string
96
+ */
55
97
protected function input ( $ args , $ formdata = array () ) {
56
98
$ prefix = array ( 'widget- ' . $ this ->id_base , $ this ->number );
57
99
0 commit comments