Completed
Branch FET-10486-add-timestamp-checki... (611b15)
by
unknown
105:07 queued 90:18
created

EspressoWidget   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 3
A getIdBase() 0 4 1
1
<?php
2
namespace EventEspresso\widgets;
3
4
defined('EVENT_ESPRESSO_VERSION') || exit;
5
6
7
8
/**
9
 * Class EspressoWidget
10
 * Description
11
 *
12
 * @package       Event Espresso
13
 * @author        Brent Christensen
14
 * @since         $VID:$
15
 */
16
class EspressoWidget extends \WP_Widget
17
{
18
19
20
21
    /**
22
     * @param string $name
23
     * @param array  $widget_options
24
     * @param array  $control_options
25
     */
26
    public function __construct($name = '', array $widget_options = array(), array $control_options = array())
27
    {
28
        $id_base = EspressoWidget::getIdBase(get_class($this));
29
        $control_options['id_base'] = $id_base;
30
        $control_options['height'] = isset($control_options['height']) ? $control_options['height'] : 300;
31
        $control_options['width'] = isset($control_options['width']) ? $control_options['width'] : 350;
32
        // Register widget with WordPress
33
        parent::__construct($id_base, $name, $widget_options, $control_options);
34
    }
35
36
37
38
    /**
39
     * @param string $widget_class
40
     * @return string
41
     */
42
    public static function getIdBase($widget_class)
43
    {
44
        return sanitize_title(str_replace(array('EEW_', '_'), array('EE_', '-'), $widget_class)) . '-widget';
45
    }
46
47
48
}
49
// End of file EspressoWidget.php
50
// Location: EventEspresso\widgets/EspressoWidget.php