Tribe__Admin__Help_Page::get_addons( string $plugin = null, string $is_active = null, string $is_important = null )
Get the Addons
Contents
Parameters
- $plugin
-
(string) (Optional) Plugin Name to filter.
Default value: null
- $is_active
-
(string) (Optional) Filter if it's active.
Default value: null
- $is_important
-
(string) (Optional) filter if the plugin is important.
Default value: null
Return
(array)
Source
File: src/Tribe/Admin/Help_Page.php
public function get_addons( $plugin = null, $is_active = null, $is_important = null ) {
$addons = array();
$addons['events-calendar-pro'] = array(
'id' => 'events-calendar-pro',
'title' => esc_html__( 'Events Calendar PRO', 'tribe-common' ),
'link' => 'http://m.tri.be/dr',
'plugin' => array( 'the-events-calendar' ),
'is_active' => class_exists( 'Tribe__Events__Pro__Main' ),
'is_important' => true,
);
$addons['eventbrite-tickets'] = array(
'id' => 'eventbrite-tickets',
'title' => esc_html__( 'Eventbrite Tickets', 'tribe-common' ),
'link' => 'http://m.tri.be/ds',
'plugin' => array( 'the-events-calendar' ),
'is_active' => class_exists( 'Tribe__Events__Tickets__Eventbrite__Main' ),
);
$addons['community-events'] = array(
'id' => 'community-events',
'title' => esc_html__( 'Community Events', 'tribe-common' ),
'link' => 'http://m.tri.be/dt',
'plugin' => array( 'the-events-calendar' ),
'is_active' => class_exists( 'Tribe__Events__Community__Main' ),
);
$addons['event-aggregator'] = array(
'id' => 'event-aggregator',
'title' => esc_html__( 'Event Aggregator', 'tribe-common' ),
'link' => 'http://m.tri.be/19mk',
'plugin' => array( 'the-events-calendar' ),
'is_active' => class_exists( 'Tribe__Events__Aggregator' ) && tribe( 'events-aggregator.main' )->is_service_active(),
);
$addons['events-filter-bar'] = array(
'id' => 'events-filter-bar',
'title' => esc_html__( 'Filter Bar', 'tribe-common' ),
'link' => 'http://m.tri.be/hu',
'plugin' => array( 'the-events-calendar' ),
'is_active' => class_exists( 'Tribe__Events__Filterbar__View' ),
);
$addons['event-tickets-plus'] = array(
'id' => 'event-tickets-plus',
'title' => esc_html__( 'Event Tickets Plus', 'tribe-common' ),
'link' => 'http://m.tri.be/18wa',
'plugin' => array( 'event-tickets' ),
'is_active' => class_exists( 'Tribe__Tickets_Plus__Main' ),
'is_important' => true,
);
$addons['event-community-tickets'] = array(
'id' => 'event-community-tickets',
'title' => esc_html__( 'Community Tickets', 'tribe-common' ),
'link' => 'http://m.tri.be/18m2',
'plugin' => array( 'event-tickets' ),
'is_active' => class_exists( 'Tribe__Events__Community__Tickets__Main' ),
);
/**
* Filter the array of premium addons upsold on the sidebar of the Settings > Help tab
*
* @param array $addons
*/
$addons = (array) apply_filters( 'tribe_help_addons', $addons );
// Should I filter something
if ( is_null( $plugin ) && is_null( $is_active ) && is_null( $is_important ) ) {
return $addons;
}
// Allow for easily grab the addons for a plugin
$filtered = array();
foreach ( $addons as $id => $addon ) {
if ( ! is_null( $plugin ) && ! in_array( $plugin, (array) $addon['plugin'] ) ) {
continue;
}
// Filter by is_active
if (
! is_null( $is_active ) &&
( ! isset( $addon['is_active'] ) || $is_active !== $addon['is_active'] )
) {
continue;
}
// Filter by is_important
if (
! is_null( $is_important ) &&
( ! isset( $addon['is_important'] ) || $is_important !== $addon['is_important'] )
) {
continue;
}
$filtered[ $id ] = $addon;
}
return $filtered;
}
Changelog
| Version | Description |
|---|---|
| 4.0 | Introduced. |