Completed
Branch BUG-10375-migrations-not-repor... (1e9646)
by
unknown
62:53 queued 49:42
created

EventsArchiveIframe::__construct()   B

Complexity

Conditions 2
Paths 1

Size

Total Lines 44
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 31
nc 1
nop 1
dl 0
loc 44
rs 8.8571
c 1
b 0
f 0
1
<?php
2
namespace EventEspresso\modules\events_archive;
3
4
use EventEspresso\core\libraries\iframe_display\Iframe;
5
6
if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
    exit( 'No direct script access allowed' );
8
}
9
10
11
12
/**
13
 * Class EventsArchiveIframe
14
 *
15
 * @package       Event Espresso
16
 * @author        Brent Christensen
17
 * @since         4.9
18
 */
19
class EventsArchiveIframe extends Iframe
20
{
21
22
23
24
    /**
25
     * EventsArchiveIframe constructor.
26
     *
27
     * @param \EED_Events_Archive $EED_Events_Archive
28
     * @throws \DomainException
29
     */
30
    public function __construct( $EED_Events_Archive )
31
    {
32
        \EE_Registry::instance()->REQ->set_espresso_page( true );
33
        add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true');
34
        $EED_Events_Archive->event_list();
35
        $event_list = new \EES_Espresso_Events();
36
        parent::__construct(
37
            esc_html__( 'Event List', 'event_espresso' ),
38
            $event_list->process_shortcode()
39
        );
40
        $this->addStylesheets(
41
            apply_filters(
42
                'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
43
                array(
44
                    'espresso_default'           => is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )
45
                        ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
46
                        : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
47
                ),
48
                $this
49
            )
50
        );
51
        $this->addScripts(
52
            apply_filters(
53
                'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
54
                array(
55
                    'gmap_api' => sprintf(
56
                        'https://maps.googleapis.com/maps/api/js?key=%s',
57
                        apply_filters(
58
                            'FHEE__EEH_Maps__espresso_google_maps_js__api_key',
59
                            \EE_Registry::instance()->CFG->map_settings->google_map_api_key
60
                        )
61
                    ),
62
                    'ee_gmap'  => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0',
63
                ),
64
                $this
65
            )
66
        );
67
        $this->addLocalizedVars(
68
            array(
69
                'ee_gmap' => \EEH_Maps::$gmap_vars,
70
            ),
71
            'ee_gmap_vars'
72
        );
73
    }
74
75
76
77
}
78
// End of file EventsArchiveIframe.php
79
// Location: EventEspresso\modules\events_archive/EventsArchiveIframe.php