PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.8.23.4
Pods – Custom Content Types and Fields v2.8.23.4
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 2 weeks ago Ajax 2 weeks ago Asset 2 weeks ago Context 2 weeks ago Customizer 2 weeks ago Debug_Bar 2 weeks ago Dialog 2 weeks ago Documentation 2 weeks ago Duplicate 2 weeks ago Editor 2 weeks ago Image 2 weeks ago JSON_LD 2 weeks ago Languages 2 weeks ago Log 2 weeks ago Meta 2 weeks ago Models 2 weeks ago PUE 2 weeks ago Process 2 weeks ago Promoter 2 weeks ago REST 2 weeks ago Repository 2 weeks ago Service_Providers 2 weeks ago Shortcode 2 weeks ago Support 2 weeks ago Tabbed_View 2 weeks ago Tooltip 2 weeks ago Traits 2 weeks ago Utils 2 weeks ago Validator 2 weeks ago Widget 2 weeks ago Abstract_Deactivation.php 2 weeks ago Abstract_Plugin_Register.php 2 weeks ago App_Shop.php 2 weeks ago Assets.php 2 weeks ago Assets_Pipeline.php 2 weeks ago Autoloader.php 2 weeks ago Cache.php 2 weeks ago Cache_Listener.php 2 weeks ago Changelog_Reader.php 2 weeks ago Container.php 2 weeks ago Context.php 2 weeks ago Cost_Utils.php 2 weeks ago Credits.php 2 weeks ago Customizer.php 2 weeks ago DB_Lock.php 2 weeks ago Data.php 2 weeks ago Date_Utils.php 2 weeks ago Db.php 2 weeks ago Debug.php 2 weeks ago Dependency.php 2 weeks ago Deprecation.php 2 weeks ago Editor.php 2 weeks ago Error.php 2 weeks ago Exception.php 2 weeks ago Extension.php 2 weeks ago Extension_Loader.php 2 weeks ago Feature_Detection.php 2 weeks ago Field.php 2 weeks ago Field_Conditional.php 2 weeks ago Freemius.php 2 weeks ago Log.php 2 weeks ago Main.php 2 weeks ago Notices.php 2 weeks ago Plugin_Meta_Links.php 2 weeks ago Plugins.php 2 weeks ago Plugins_API.php 2 weeks ago Post_History.php 2 weeks ago Post_Transient.php 2 weeks ago Promise.php 2 weeks ago Repository.php 2 weeks ago Rewrite.php 2 weeks ago Settings.php 2 weeks ago Settings_Manager.php 2 weeks ago Settings_Tab.php 2 weeks ago Simple_Table.php 2 weeks ago Support.php 2 weeks ago Tabbed_View.php 2 weeks ago Template.php 2 weeks ago Template_Factory.php 2 weeks ago Template_Part_Cache.php 2 weeks ago Templates.php 2 weeks ago Terms.php 2 weeks ago Timezones.php 2 weeks ago Tracker.php 2 weeks ago Updater.php 2 weeks ago Validate.php 2 weeks ago View_Helpers.php 2 weeks 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