PluginProbe ʕ •ᴥ•ʔ
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel / trunk
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel vtrunk
trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / includes / admin / class-trial-mode.php
foogallery / includes / admin Last commit date
class-admin-notice-custom-css.php 7 months ago class-admin-notices.php 7 months ago class-admin.php 7 months ago class-attachment-fields.php 7 months ago class-columns.php 7 months ago class-demo-content.php 7 months ago class-extensions.php 7 months ago class-gallery-attachment-modal.php 7 months ago class-gallery-datasources.php 7 months ago class-gallery-editor.php 7 months ago class-gallery-metabox-fields.php 7 months ago class-gallery-metabox-items.php 7 months ago class-gallery-metabox-settings-helper.php 7 months ago class-gallery-metabox-settings.php 7 months ago class-gallery-metabox-template.php 7 months ago class-gallery-metaboxes.php 7 months ago class-menu.php 7 months ago class-pro-promotion.php 7 months ago class-settings.php 7 months ago class-silent-installer-skin.php 7 months ago class-trial-mode.php 7 months ago demo-content-galleries.php 7 months ago demo-content-images.php 7 months ago index.php 11 years ago pro-features.php 7 months ago view-features.php 7 months ago view-help-demos.php 7 months ago view-help-getting-started.php 7 months ago view-help-pro.php 7 months ago view-help.php 7 months ago view-system-info.php 7 months ago
class-trial-mode.php
76 lines
1 <?php
2 /*
3 * FooGallery Trial Mode class
4 */
5
6 if ( ! class_exists( 'FooGallery_Trial_Mode' ) ) {
7 class FooGallery_Trial_Mode {
8
9 private $current_plan;
10 private $is_free;
11 private $is_trial;
12 private $plan_starter;
13 private $plan_expert;
14 private $plan_commerce;
15
16 function __construct() {
17 add_action( 'admin_init', array( $this, 'init_trial_mode' ) );
18 }
19
20 /**
21 * Returns true if the trial mode is enabled
22 * @return bool
23 */
24 private function is_trial_mode_enabled() {
25 return foogallery_get_setting( 'enable_trial_mode' ) === 'on';
26 }
27
28 /**
29 * Initialize the trial mode
30 */
31 function init_trial_mode() {
32 if ( $this->is_trial_mode_enabled() ) {
33 // Determine current plan, and show promotions based on the current plan.
34 $fs_instance = foogallery_fs();
35 $this->current_plan = $fs_instance->get_plan_name();
36 $this->is_free = $fs_instance->is_free_plan();
37 $this->is_trial = $fs_instance->is_trial();
38
39 $this->plan_starter = false;
40 $this->plan_expert = false;
41 $this->plan_commerce = false;
42
43 if ( !$this->is_free ) {
44 if ( FOOGALLERY_PRO_PLAN_STARTER === $this->current_plan ) {
45 $this->plan_starter = true;
46 } else if ( FOOGALLERY_PRO_PLAN_EXPERT == $this->current_plan ) {
47 $this->plan_expert = true;
48 } else if ( FOOGALLERY_PRO_PLAN_COMMERCE == $this->current_plan ) {
49 $this->plan_commerce = true;
50 }
51 }
52
53 add_filter( 'foogallery_gallery_templates', array( $this, 'change_gallery_templates' ), 999 );
54 }
55 }
56
57 function change_gallery_templates( $templates ) {
58
59 // add a pulse to the card, so it stands out.
60 if ( array_key_exists( 'polaroid_new', $templates ) ) {
61 $templates['polaroid_new']['html'] = '<div data-balloon="' . __( 'This layout is part of PRO Starter plan', 'foogallery' ) . '" class="pulse pro-starter"></div>';
62 }
63 if ( array_key_exists( 'foogridpro', $templates ) ) {
64 $templates['foogridpro']['html'] = '<div data-balloon="' . __( 'This layout is part of PRO Starter plan', 'foogallery' ) . '" class="pulse pro-starter"></div>';
65 }
66 if ( array_key_exists( 'slider', $templates ) ) {
67 $templates['slider']['html'] = '<div data-balloon="' . __( 'This layout is part of PRO Starter plan', 'foogallery' ) . '" class="pulse pro-starter"></div>';
68 }
69 if ( array_key_exists( 'product', $templates ) ) {
70 $templates['product']['html'] = '<div data-balloon="' . __( 'This layout is part of PRO Commerce plan', 'foogallery') . '" class="pulse pro-commerce"></div>';
71 }
72
73 return $templates;
74 }
75 }
76 }