@@ 38-64 (lines=27) @@ | ||
35 | * |
|
36 | * @since 3.0.0 |
|
37 | */ |
|
38 | public function __construct() { |
|
39 | ||
40 | $this->id = 'calendars'; |
|
41 | $this->option_group = 'settings'; |
|
42 | $this->label = __( 'Calendars', 'google-calendar-events' ); |
|
43 | //$this->description = __( 'Manage calendar preferences and calendar types settings and options.', 'google-calendar-events' ); |
|
44 | ||
45 | $calendars = simcal_get_calendar_types(); |
|
46 | $calendar_settings = array(); |
|
47 | if ( ! empty( $calendars ) && is_array( $calendars ) ) { |
|
48 | foreach ( $calendars as $calendar => $views ) { |
|
49 | ||
50 | $calendar_type = simcal_get_calendar( $calendar ); |
|
51 | ||
52 | if ( $calendar_type instanceof Calendar ) { |
|
53 | $settings = $calendar_type->settings_fields(); |
|
54 | if ( ! empty( $settings ) ) { |
|
55 | $calendar_settings[ $calendar ] = $settings; |
|
56 | } |
|
57 | } |
|
58 | } |
|
59 | } |
|
60 | ||
61 | $this->calendar_types = $calendar_settings; |
|
62 | $this->sections = $this->add_sections(); |
|
63 | $this->fields = $this->add_fields(); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Add sections. |
@@ 38-64 (lines=27) @@ | ||
35 | * |
|
36 | * @since 3.0.0 |
|
37 | */ |
|
38 | public function __construct() { |
|
39 | ||
40 | $this->id = 'feeds'; |
|
41 | $this->option_group = 'settings'; |
|
42 | $this->label = __( 'Event Sources', 'google-calendar-events' ); |
|
43 | //$this->description = __( 'Manage calendar event sources settings.', 'google-calendar-events' ); |
|
44 | ||
45 | $feeds_settings = array(); |
|
46 | $feeds = simcal_get_feed_types(); |
|
47 | if ( ! empty( $feeds ) && is_array( $feeds ) ) { |
|
48 | foreach ( $feeds as $feed ) { |
|
49 | ||
50 | $feed_type = simcal_get_feed( $feed ); |
|
51 | ||
52 | if ( $feed_type instanceof Feed ) { |
|
53 | $settings = $feed_type->settings_fields(); |
|
54 | if ( ! empty( $settings ) ) { |
|
55 | $feeds_settings[ $feed ] = $settings; |
|
56 | } |
|
57 | } |
|
58 | } |
|
59 | } |
|
60 | ||
61 | $this->feed_types = $feeds_settings; |
|
62 | $this->sections = $this->add_sections(); |
|
63 | $this->fields = $this->add_fields(); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Add sections. |