PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.8.23.5
Pods – Custom Content Types and Fields v2.8.23.5
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / tribe-common / src / Tribe / App_Shop.php
pods / tribe-common / src / Tribe Last commit date
Admin 1 week ago Ajax 1 week ago Asset 1 week ago Context 1 week ago Customizer 1 week ago Debug_Bar 1 week ago Dialog 1 week ago Documentation 1 week ago Duplicate 1 week ago Editor 1 week ago Image 1 week ago JSON_LD 1 week ago Languages 1 week ago Log 1 week ago Meta 1 week ago Models 1 week ago PUE 1 week ago Process 1 week ago Promoter 1 week ago REST 1 week ago Repository 1 week ago Service_Providers 1 week ago Shortcode 1 week ago Support 1 week ago Tabbed_View 1 week ago Tooltip 1 week ago Traits 1 week ago Utils 1 week ago Validator 1 week ago Widget 1 week ago Abstract_Deactivation.php 1 week ago Abstract_Plugin_Register.php 1 week ago App_Shop.php 1 week ago Assets.php 1 week ago Assets_Pipeline.php 1 week ago Autoloader.php 1 week ago Cache.php 1 week ago Cache_Listener.php 1 week ago Changelog_Reader.php 1 week ago Container.php 1 week ago Context.php 1 week ago Cost_Utils.php 1 week ago Credits.php 1 week ago Customizer.php 1 week ago DB_Lock.php 1 week ago Data.php 1 week ago Date_Utils.php 1 week ago Db.php 1 week ago Debug.php 1 week ago Dependency.php 1 week ago Deprecation.php 1 week ago Editor.php 1 week ago Error.php 1 week ago Exception.php 1 week ago Extension.php 1 week ago Extension_Loader.php 1 week ago Feature_Detection.php 1 week ago Field.php 1 week ago Field_Conditional.php 1 week ago Freemius.php 1 week ago Log.php 1 week ago Main.php 1 week ago Notices.php 1 week ago Plugin_Meta_Links.php 1 week ago Plugins.php 1 week ago Plugins_API.php 1 week ago Post_History.php 1 week ago Post_Transient.php 1 week ago Promise.php 1 week ago Repository.php 1 week ago Rewrite.php 1 week ago Settings.php 1 week ago Settings_Manager.php 1 week ago Settings_Tab.php 1 week ago Simple_Table.php 1 week ago Support.php 1 week ago Tabbed_View.php 1 week ago Template.php 1 week ago Template_Factory.php 1 week ago Template_Part_Cache.php 1 week ago Templates.php 1 week ago Terms.php 1 week ago Timezones.php 1 week ago Tracker.php 1 week ago Updater.php 1 week ago Validate.php 1 week ago View_Helpers.php 1 week ago
App_Shop.php
317 lines
1 <?php
2
3 // don't load directly
4 if ( ! defined( 'ABSPATH' ) ) {
5 die( '-1' );
6 }
7
8 if ( ! class_exists( 'Tribe__App_Shop' ) ) {
9 /**
10 * Class that handles the integration with our Shop App API
11 */
12 class Tribe__App_Shop {
13
14 /**
15 * Slug of the WP admin menu item
16 */
17 const MENU_SLUG = 'tribe-app-shop';
18
19 /**
20 * Singleton instance
21 *
22 * @var null or Tribe__App_Shop
23 */
24 private static $instance = null;
25 /**
26 * The slug for the new admin page
27 *
28 * @var string
29 */
30 private $admin_page = null;
31
32 /**
33 * Class constructor
34 */
35 public function __construct() {
36 add_action( 'admin_menu', [ $this, 'add_menu_page' ], 100 );
37 add_action( 'wp_before_admin_bar_render', [ $this, 'add_toolbar_item' ], 20 );
38
39 $this->register_assets();
40 }
41
42 /**
43 * Adds the page to the admin menu
44 */
45 public function add_menu_page() {
46 if ( ! Tribe__Settings::instance()->should_setup_pages() ) {
47 return;
48 }
49
50 $page_title = esc_html__( 'Event Add-Ons', 'tribe-common' );
51 $menu_title = esc_html__( 'Event Add-Ons', 'tribe-common' );
52 $capability = apply_filters( 'tribe_events_addon_page_capability', 'install_plugins' );
53
54 $where = Tribe__Settings::instance()->get_parent_slug();
55
56 $this->admin_page = add_submenu_page(
57 $where,
58 $page_title,
59 $menu_title,
60 $capability,
61 self::MENU_SLUG,
62 [
63 $this,
64 'do_menu_page',
65 ]
66 );
67 }
68
69 /**
70 * Adds a link to the shop app to the WP admin bar
71 */
72 public function add_toolbar_item() {
73
74 $capability = apply_filters( 'tribe_events_addon_page_capability', 'install_plugins' );
75
76 // prevent users who cannot install plugins from seeing addons link
77 if ( current_user_can( $capability ) ) {
78 global $wp_admin_bar;
79
80 $wp_admin_bar->add_menu( [
81 'id' => 'tribe-events-app-shop',
82 'title' => esc_html__( 'Event Add-Ons', 'tribe-common' ),
83 'href' => Tribe__Settings::instance()->get_url( [ 'page' => self::MENU_SLUG ] ),
84 'parent' => 'tribe-events-settings-group',
85 ] );
86 }
87 }
88
89 /**
90 * Registers the plugin assets
91 */
92 protected function register_assets() {
93 tribe_assets(
94 Tribe__Main::instance(),
95 [
96 [ 'tribe-app-shop-css', 'app-shop.css' ],
97 [ 'tribe-app-shop-js', 'app-shop.js', [ 'jquery' ] ],
98 ],
99 'admin_enqueue_scripts',
100 [
101 'conditionals' => [ $this, 'is_current_page' ],
102 ]
103 );
104 }
105
106 /**
107 * Checks if the current page is the app shop
108 *
109 * @since 4.5.7
110 *
111 * @return bool
112 */
113 public function is_current_page() {
114 if ( ! Tribe__Settings::instance()->should_setup_pages() || ! did_action( 'admin_menu' ) ) {
115 return false;
116 }
117
118 if ( is_null( $this->admin_page ) ) {
119 _doing_it_wrong(
120 __FUNCTION__,
121 'Function was called before it is possible to accurately determine what the current page is.',
122 '4.5.6'
123 );
124 return false;
125 }
126
127 return Tribe__Admin__Helpers::instance()->is_screen( $this->admin_page );
128 }
129
130 /**
131 * Renders the Shop App page
132 */
133 public function do_menu_page() {
134 $main = Tribe__Main::instance();
135 $products = $this->get_all_products();
136 $bundles = $this->get_bundles();
137 $extensions = $this->get_extensions();
138 include_once Tribe__Main::instance()->plugin_path . 'src/admin-views/app-shop.php';
139 }
140
141 /**
142 * Gets all products from the API
143 *
144 * @return array|WP_Error
145 */
146 private function get_all_products() {
147 $all_products = tribe( 'plugins.api' )->get_products();
148
149 $products = [
150 'the-events-calendar' => (object) $all_products['the-events-calendar'],
151 'events-calendar-pro' => (object) $all_products['events-calendar-pro'],
152 'events-virtual' => (object) $all_products['events-virtual'],
153 'event-aggregator' => (object) $all_products['event-aggregator'],
154 'event-tickets' => (object) $all_products['event-tickets'],
155 'event-tickets-plus' => (object) $all_products['event-tickets-plus'],
156 'promoter' => (object) $all_products['promoter'],
157 'tribe-filterbar' => (object) $all_products['tribe-filterbar'],
158 'events-community' => (object) $all_products['events-community'],
159 'events-community-tickets' => (object) $all_products['events-community-tickets'],
160 'tribe-eventbrite' => (object) $all_products['tribe-eventbrite'],
161 'image-widget-plus' => (object) $all_products['image-widget-plus'],
162 ];
163
164 return $products;
165 }
166
167 /**
168 * Gets product bundles
169 *
170 * @return array|WP_Error
171 */
172 private function get_bundles() {
173 $bundles = [
174 (object) [
175 'title' => __( 'Events Marketing Bundle', 'tribe-common' ),
176 'logo' => 'images/logo/bundle-event-marketing.svg',
177 'link' => 'https://evnt.is/1aj3',
178 'discount' => __( 'Save over 20%', 'tribe-common' ),
179 'description' => __( 'Ticket sales, attendee management, and email marketing for your events', 'tribe-common' ),
180 'includes' => [
181 'events-calendar-pro',
182 'event-tickets-plus',
183 'promoter',
184 ],
185 ],
186 (object) [
187 'title' => __( 'Event Importer Bundle', 'tribe-common' ),
188 'logo' => 'images/logo/bundle-event-importer.svg',
189 'link' => 'https://evnt.is/1aj2',
190 'discount' => __( 'Save over 25%', 'tribe-common' ),
191 'description' => __( 'Fill your calendar with events from across the web, including Google Calendar, Meetup, and more.', 'tribe-common' ),
192 'includes' => [
193 'events-calendar-pro',
194 'tribe-filterbar',
195 'event-aggregator'
196 ],
197 ],
198 (object) [
199 'title' => __( 'Virtual Events Marketing Bundle', 'tribe-common' ),
200 'logo' => 'images/logo/bundle-virtual-events.svg',
201 'link' => 'http://evnt.is/ve-bundle',
202 'discount' => __( 'Save over 20%', 'tribe-common' ),
203 'description' => __( 'Streamline your online events and increase revenue.', 'tribe-common' ),
204 'includes' => [
205 'events-calendar-pro',
206 'event-tickets-plus',
207 'events-virtual',
208 'promoter',
209 ],
210 'features' => [
211 __( 'Sell tickets and earn revenue for online events', 'tribe-common' ),
212 __( 'Zoom integration', 'tribe-common' ),
213 __( 'Automated emails optimized for virtual events', 'tribe-common' ),
214 __( 'Add recurring events', 'tribe-common' ),
215 ],
216 ],
217 (object) [
218 'title' => __( 'Community Manager Bundle', 'tribe-common' ),
219 'logo' => 'images/logo/bundle-community-manager.svg',
220 'link' => 'https://evnt.is/1aj4',
221 'discount' => __( 'Save over 20%', 'tribe-common' ), /* code review: fix this */
222 'description' => __( 'Handle event submissions with ticket sales and everything you need to build a robust community.', 'tribe-common' ),
223 'includes' => [
224 'event-tickets-plus',
225 'events-community',
226 'events-community-tickets',
227 'tribe-filterbar',
228 ],
229 ],
230 (object) [
231 'title' => __( 'Ultimate Bundle', 'tribe-common' ),
232 'logo' => 'images/logo/bundle-ultimate.svg',
233 'link' => 'https://evnt.is/1aj5',
234 'discount' => __( 'Save over 20%', 'tribe-common' ), /* code review: fix this */
235 'description' => __( 'All of our premium events management plugins at a deep discount.', 'tribe-common' ),
236 'includes' => [
237 'events-calendar-pro',
238 'event-tickets-plus',
239 //'events-virtual', // not yet added to the bundle
240 'events-community',
241 'events-community-tickets',
242 'tribe-filterbar',
243 'event-aggregator',
244 'tribe-eventbrite',
245 //'promoter', // not yet added to the bundle
246 ],
247 ],
248
249 ];
250
251 return $bundles;
252 }
253
254 /**
255 * Gets product extensions
256 *
257 * @return array|WP_Error
258 */
259 private function get_extensions() {
260 $extensions = [
261 (object) [
262 'title' => __( 'Website URL CTA', 'tribe-common' ),
263 'link' => 'https://evnt.is/1aj6',
264 'image' => 'images/shop/extension-web-url-cta.jpg',
265 'description' => __( 'Create a strong call-to-action for attendees to "Join Webinar" instead of only sharing a website address.', 'tribe-common' ),
266 ],
267 (object) [
268 'title' => __( 'Link Directly to Webinar', 'tribe-common' ),
269 'link' => 'https://evnt.is/1aj7',
270 'image' => 'images/shop/extension-link-to-webinar.jpg',
271 'description' => __( 'When users click on the event title, they’ll be taken right to the source of your event, offering a direct route to join.', 'tribe-common' ),
272 ],
273 (object) [
274 'title' => __( 'Events Happening Now', 'tribe-common' ),
275 'link' => 'https://evnt.is/1aj8',
276 'image' => 'images/shop/extension-events-happening-now.jpg',
277 'description' => __( 'Use this shortcode to display events that are currently in progress, like webinars and livestreams.', 'tribe-common' ),
278 ],
279 (object) [
280 'title' => __( 'Custom Venue Links', 'tribe-common' ),
281 'link' => 'https://evnt.is/1aj9',
282 'image' => 'images/shop/extension-custom-venue-links.jpg',
283 'description' => __( 'Turn the venue name for your event into a clickable URL — a great way to link directly to a venue’s website or a virtual meeting.', 'tribe-common' ),
284 ],
285 (object) [
286 'title' => __( 'Adjust Label', 'tribe-common' ),
287 'link' => 'https://evnt.is/1aja',
288 'image' => 'images/shop/extension-change-label.jpg',
289 'description' => __( 'Change "Events" to "Webinars," or "Venues" to "Livestream," or "Organizers" to "Hosts." Tailor your calendar for virtual events and meetings.', 'tribe-common' ),
290 ],
291 (object) [
292 'title' => __( 'Reach Attendees', 'tribe-common' ),
293 'link' => 'https://evnt.is/1ajc',
294 'image' => 'images/shop/extension-advanced-options.jpg',
295 'description' => __( 'From registration to attendance history, view every step of the event lifecycle with this HubSpot integration.', 'tribe-common' ),
296 ],
297 ];
298
299 return $extensions;
300 }
301
302 /**
303 * Static Singleton Factory Method
304 *
305 * @return Tribe__App_Shop
306 */
307 public static function instance() {
308 if ( ! isset( self::$instance ) ) {
309 $className = __CLASS__;
310 self::$instance = new $className;
311 }
312
313 return self::$instance;
314 }
315 }
316 }
317