-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclass-contextlywpsiderailwidget.php
More file actions
63 lines (56 loc) · 1.37 KB
/
class-contextlywpsiderailwidget.php
File metadata and controls
63 lines (56 loc) · 1.37 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
<?php
/**
* Siderail widget.
*
* @package Contextly Related Links
* @link https://contextly.com
*/
/**
* Adds Siderail widget.
*/
class ContextlyWpSiderailWidget extends WP_Widget {
/**
* Register widget with WordPress.
*/
public function __construct() {
parent::__construct(
'contextly_siderail_widget',
__( 'Contextly Siderail', 'contextly_linker_textdomain' ),
array( 'description' => __( 'Displays links recommended by Contextly.', 'contextly_linker_textdomain' ) )
);
}
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget( $args, $instance ) {
if ( ! $GLOBALS['contextly']->is_load_widget() ) {
return;
}
$classes = array(
Contextly::WIDGET_SIDERAIL_CLASS,
Contextly::WIDGET_PLACEMENT_CLASS,
Contextly::CLEARFIX_CLASS,
);
echo $args['before_widget']; // WPCS: XSS ok.
printf( '<div class="%s"></div>', esc_attr( Contextly::join_classes( $classes ) ) );
echo $args['after_widget']; // WPCS: XSS ok.
}
/**
* Admin form for display widget form.
*
* @param array $instance widget instance.
* @return void
*/
public function form( $instance ) {
?>
<p>
Options for the Siderail are in the Contextly Control Panel.
</p>
<?php
}
} // class ContextlyWpSiderailWidget