PluginProbe ʕ •ᴥ•ʔ
Gallery : FooGallery / 3.3.3
Gallery : FooGallery v3.3.3
3.3.2 3.3.3 3.3.0 3.1.31 3.1.32 3.1.34 3.1.36 3.2.0 3.2.6 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-pro-promotion.php
foogallery / includes / admin Last commit date
class-admin-notice-custom-css.php 2 days ago class-admin-notices.php 2 days ago class-admin.php 2 days ago class-attachment-fields.php 2 days ago class-columns.php 2 days ago class-demo-content.php 2 days ago class-extensions.php 2 days ago class-gallery-attachment-modal.php 2 days ago class-gallery-datasources.php 2 days ago class-gallery-editor.php 2 days ago class-gallery-metabox-fields.php 2 days ago class-gallery-metabox-items.php 2 days ago class-gallery-metabox-settings-helper.php 2 days ago class-gallery-metabox-settings.php 2 days ago class-gallery-metabox-template.php 2 days ago class-gallery-metaboxes.php 2 days ago class-menu.php 2 days ago class-pro-promotion.php 2 days ago class-settings.php 2 days ago class-silent-installer-skin.php 2 days ago class-trial-mode.php 2 days ago demo-content-galleries.php 2 days ago demo-content-images.php 2 days ago index.php 2 days ago pro-features.php 2 days ago view-features.php 2 days ago view-help-demos.php 2 days ago view-help-getting-started.php 2 days ago view-help-pro.php 2 days ago view-help.php 2 days ago view-system-info.php 2 days ago
class-pro-promotion.php
1384 lines
1 <?php
2 /*
3 * FooGallery Pro Feature Promotion class
4 */
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit;
8 }
9
10 if ( ! class_exists( 'FooGallery_Pro_Promotion' ) ) {
11 class FooGallery_Pro_Promotion {
12
13 private $urls = array(
14 'foogallery-pagination' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/pagination/',
15 'foogallery-filtering' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/filtering/',
16 'foogallery-hover-presets' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/hover-presets/',
17 'foogallery-captions' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/custom-captions/',
18 'foogallery-lightbox' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/pro-lightbox/',
19 'foogallery-thumbnail-filters' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/filter-effects/',
20 'foogallery-colors' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/color-sorting-gallery/',
21 'foogallery-loaded-effects' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/animated-loaded-effects/',
22 'foogallery-polaroid' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/polaroid-gallery/',
23 'foogallery-grid' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/grid-gallery/',
24 'foogallery-slider' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/slider-gallery/',
25 'foogallery-spotlight' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/spotlight-gallery/',
26 'foogallery-videos' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/video-gallery/',
27 'foogallery-social' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/social/',
28 'foogallery-exif' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/exif-data/',
29 'foogallery-imagegallery-schema' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/pro-expert',
30 'foogallery-bulk-copy' => 'https://fooplugins.com/bulk-copy-foogallery-pro/',
31 'foogallery-trial' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/start-trial/',
32 'foogallery-pricing' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/compare-plans/',
33 'foogallery-plans' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/compare-plans/#compare',
34 'foobox-pro' => 'https://fooplugins.com/foobox/',
35 'foogallery-datasources' => 'https://fooplugins.com/load-galleries-from-other-sources/',
36 'foogallery-commerce' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/woocommerce-integration/',
37 'foogallery-product-gallery' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/woocommerce-integration/#product-gallery',
38 'foogallery-protection' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/photo-watermark/',
39 'foogallery-master' => 'https://fooplugins.com/documentation/foogallery/pro-commerce/use-master-gallery/',
40 'foogallery-import-export' => 'https://fooplugins.com/documentation/foogallery/getting-started-foogallery/import-export/',
41 'foogallery_whitelabeling' => 'https://fooplugins.com/documentation/foogallery/pro-commerce/white-labeling/'
42 );
43
44 function __construct() {
45 add_action( 'admin_init', array( $this, 'include_promos' ) );
46 }
47
48 /**
49 * conditionally include promos
50 */
51 function include_promos() {
52 global $foogallery_admin_datasource_instance;
53
54 add_filter( 'foogallery_admin_settings_override', array( $this, 'include_promo_settings' ) );
55
56 if ( $this->can_show_promo() ) {
57
58 // Determine current plan, and show promotions based on the current plan.
59 $fs_instance = foogallery_fs();
60 $current_plan = $fs_instance->get_plan_name();
61 $is_free = $fs_instance->is_free_plan();
62 $is_trial = $fs_instance->is_trial();
63
64 // If in trial mode, skip showing promotions
65 if ( $is_trial ) {
66 return;
67 }
68
69 if ( $this->should_show_social_addon_promo() ) {
70 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_social_addon_promo_fields' ), 15, 2 );
71 }
72
73 $show_starter_promos = true;
74 $show_expert_promos = true;
75 $show_commerce_promos = true;
76 $show_plan_promos = true;
77
78 if ( !$is_free ) {
79 if ( FOOGALLERY_PRO_PLAN_STARTER === $current_plan ) {
80 $show_starter_promos = false;
81 } else if ( FOOGALLERY_PRO_PLAN_EXPERT == $current_plan ) {
82 $show_starter_promos = $show_expert_promos = false;
83 } else {
84 $show_starter_promos = $show_expert_promos = $show_commerce_promos = false;
85 $show_plan_promos = false;
86 }
87 }
88
89 if ( ! $show_plan_promos ) {
90 return;
91 }
92
93 if ( $show_starter_promos ) {
94 //PRO Starter Templates
95 add_filter( 'foogallery_gallery_templates', array( $this, 'add_promo_templates' ), 99, 1 );
96 add_filter( 'foogallery_override_gallery_template_fields-polaroid_promo', array( $this, 'remove_all_fields_from_promo_gallery_template' ), 999, 2 );
97 add_filter( 'foogallery_override_gallery_template_fields-grid_promo', array( $this, 'remove_all_fields_from_promo_gallery_template' ), 999, 2 );
98 add_filter( 'foogallery_override_gallery_template_fields-slider_promo', array( $this, 'remove_all_fields_from_promo_gallery_template' ), 999, 2 );
99 add_filter( 'foogallery_override_gallery_template_fields-spotlight_promo', array( $this, 'remove_all_fields_from_promo_gallery_template' ), 999, 2 );
100
101 //presets
102 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_preset_promo_fields' ), 99, 2 );
103 add_filter( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_choices', array( $this, 'add_promo_preset_choices' ), 10, 1 );
104
105 //Instagram filters
106 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_appearance_promo_fields' ), 20, 2 );
107
108 //Colors
109 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_colors_promo_fields' ), 20, 2 );
110 add_filter( 'foogallery_gallery_settings_metabox_section_icon', array( $this, 'add_starter_section_icons' ) );
111 }
112
113 if ( $show_expert_promos ) {
114 //Videos
115 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_video_promo_fields' ) );
116
117 //filtering
118 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_filtering_promo_fields' ), 10, 2 );
119
120 //paging
121 add_filter( 'foogallery_gallery_template_paging_type_choices', array( $this, 'add_promo_paging_choices' ) );
122 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_paging_promo_fields' ), 10, 2 );
123
124 //Datasource promos
125 add_action( 'foogallery_gallery_datasources', array( $this, 'add_expert_promo_datasources' ), 99 );
126 //add_action( 'foogallery_gallery_metabox_items_add', array( $this, 'add_datasources_css' ), 9 );
127 add_action( 'foogallery_admin_datasource_modal_content', array( $this, 'render_datasource_modal_content_default' ) );
128 add_action( 'foogallery-datasource-modal-content_folders_promo', array( $this, 'render_datasource_modal_content_folders_promo' ), 10, 3 );
129 add_action( 'foogallery-datasource-modal-content_media_tags_promo', array( $this, 'render_datasource_modal_content_taxonomy_promo' ), 10, 3 );
130 add_action( 'foogallery-datasource-modal-content_media_categories_promo', array( $this, 'render_datasource_modal_content_taxonomy_promo' ), 10, 3 );
131 add_action( 'foogallery-datasource-modal-content_lightroom_promo', array( $this, 'render_datasource_modal_content_lightroom_promo' ), 10, 3 );
132 add_action( 'foogallery-datasource-modal-content_rml_promo', array( $this, 'render_datasource_modal_content_rml_promo' ), 10, 3 );
133 add_action( 'foogallery-datasource-modal-content_post_query_promo', array( $this, 'render_datasource_modal_content_post_query_promo' ), 10, 3 );
134 remove_action( 'foogallery_admin_datasource_modal_content', array( $foogallery_admin_datasource_instance, 'render_datasource_modal_default_content' ) );
135
136 //Custom Captions
137 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_advanced_caption_fields' ), 100, 2 );
138
139 //EXIF
140 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_exif_promo_fields' ), 10, 2 );
141
142 //ImageGallery Schema
143 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_imagegallery_schema_promo_fields' ), 90, 2 );
144
145 //Bulk Copy Settings
146 add_action( 'add_meta_boxes_' . FOOGALLERY_CPT_GALLERY, array( $this, 'add_bulk_copy_meta_box_to_gallery' ) );
147
148 add_filter( 'foogallery_gallery_settings_metabox_section_icon', array( $this, 'add_expert_section_icons' ) );
149
150 //EXIF global settings (TODO)
151 }
152
153 if ( $show_commerce_promos ) {
154
155 add_filter( 'foogallery_gallery_settings_metabox_section_icon', array( $this, 'add_commerce_section_icons' ) );
156
157 //Ecommerce Settings
158 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_ecommerce_promo_fields' ), 90, 2 );
159
160 //Product Datasource
161 add_action( 'foogallery_gallery_datasources', array( $this, 'add_commerce_promo_datasources' ), 99 );
162 add_action( 'foogallery-datasource-modal-content_products_promo', array( $this, 'render_datasource_modal_content_products_promo' ), 10, 3 );
163
164 //Product Gallery Template
165 add_filter( 'foogallery_gallery_templates', array( $this, 'add_commerce_promo_templates' ), 999, 1 );
166 add_filter( 'foogallery_override_gallery_template_fields-product_promo', array( $this, 'remove_all_fields_from_promo_gallery_template' ), 999, 2 );
167
168 //Watermarking & Protection Settings
169 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_protection_promo_fields' ), 80, 2 );
170
171 //Watermarking & Protection global settings (TODO)
172
173 //Ecommerce global settings (TODO)
174 }
175 }
176 }
177
178 /**
179 * Add a metabox to the gallery for bulk copying
180 * @param $post
181 */
182 function add_bulk_copy_meta_box_to_gallery($post) {
183 add_meta_box(
184 'foogallery_bulk_copy',
185 __( 'Bulk Copy', 'foogallery' ),
186 array( $this, 'render_gallery_bulk_copy_metabox' ),
187 FOOGALLERY_CPT_GALLERY,
188 'normal',
189 'low'
190 );
191 }
192
193 /**
194 * Render the bulk copy metabox on the gallery edit page
195 * @param $post
196 */
197 function render_gallery_bulk_copy_metabox( $post ) {
198 $this->render_datasource_modal_content(
199 __('Bulk Copy Settings', 'foogallery' ),
200 __('Copy settings from one gallery to other galleries in bulk. You can choose which settings, and what galleries to copy them to.', 'foogallery' ),
201 'foogallery-bulk-copy'
202 );
203 }
204
205 /**
206 * Add caption fields to the gallery template
207 *
208 * @param $fields
209 * @param $template
210 *
211 * @return array
212 */
213 function add_advanced_caption_fields( $fields, $template ) {
214
215 //add caption type field before other caption fields
216 $new_fields[] = array(
217 'id' => 'promo_captions_type',
218 'title' => __( 'Caption Type', 'foogallery' ),
219 'desc' => __( 'What type of captions do you want to display in the gallery. By default, captions will be built up from the image attributes for both the caption title and description.', 'foogallery' ),
220 'section_id' => 'captions',
221 'type' => 'radio',
222 'default' => '',
223 'choices' => array(
224 '' => __( 'Default', 'foogallery' ),
225 'custom' => array(
226 'label' => __( 'Custom', 'foogallery' ),
227 'tooltip' => __('Captions can be built up using custom HTML and placeholders', 'foogallery'),
228 'class' => 'foogallery-promo',
229 'icon' => 'dashicons-star-filled'
230 )
231 ),
232 'row_data' => array(
233 'data-foogallery-change-selector' => 'input:radio',
234 'data-foogallery-value-selector' => 'input:checked',
235 )
236 );
237
238 $new_fields[] = array(
239 'id' => 'promo_custom_captions',
240 'title' => __( 'PRO Expert Feature : Advanced Custom Captions', 'foogallery' ),
241 'desc' => __( 'Take complete control over your image captions, and customize them by using HTML and pre-defined placeholders. Integrates with popular solutions like ACF and Pods for unlimited possibilities.', 'foogallery')
242 . '<br /><br />' . $this->build_promo_trial_html( 'pagination', __( 'PRO Expert', 'foogallery' ) ) . '<br /><br />',
243 'cta' => $this->build_cta_buttons( 'foogallery-captions' ),
244 'section_id' => 'captions',
245 'type' => 'promo',
246 'row_data'=> array(
247 'data-foogallery-change-selector' => 'input',
248 'data-foogallery-hidden' => true,
249 'data-foogallery-show-when-field' => 'promo_captions_type',
250 'data-foogallery-show-when-field-value' => 'custom',
251 )
252 );
253
254 $field_index = foogallery_admin_fields_find_index_of_field( $fields, 'caption_title_source' );
255
256 array_splice( $fields, $field_index, 0, $new_fields );
257
258 return $fields;
259 }
260
261 function add_datasources_css() {
262 ?>
263 <style>
264 .gallery_datasources_button {
265 color: #1d7b30 !important;
266 border-color: #1d7b30 !important;
267 background-color: #f7fff6 !important;
268 }
269 </style>
270 <?php
271 }
272
273 /**
274 * Output the default datasource modal content
275 *
276 * @param $foogallery_id
277 */
278 function render_datasource_modal_content_default() {
279 $this->render_datasource_modal_content(
280 __('Dynamic Galleries From Other Sources', 'foogallery' ),
281 __('Create dynamic galleries by using other sources for your images. Load images from a directory on your server, or load all images for a specific tag, or even sync your Adobe Lightroom images and show them in your gallery.', 'foogallery' )
282 );
283 }
284
285 /**
286 * Output the server folders datasource modal content
287 *
288 * @param $foogallery_id
289 */
290 function render_datasource_modal_content_folders_promo( $foogallery_id, $datasource_value ) {
291 $this->render_datasource_modal_content(
292 __('Server Folder Datasource', 'foogallery' ),
293 __('Create a dynamic gallery by loadings images directly from a folder/directory on your server. This allows you to FTP or upload images directly to your server, and then your gallery will dynamically change to include all newly added/updated images.', 'foogallery' )
294 );
295 }
296
297 /**
298 * Output the tags datasource modal content
299 *
300 * @param $foogallery_id
301 */
302 function render_datasource_modal_content_taxonomy_promo( $foogallery_id, $datasource_value ) {
303 $this->render_datasource_modal_content(
304 __('Media Tags/Categories Datasource', 'foogallery' ),
305 __('Create a dynamic gallery by loadings images for specific tags or categories. This means you only need to upload a new image and add the correct tag, for it to show in the gallery. You can specify different tags or categories for each image or video in your media library.', 'foogallery' )
306 );
307 }
308
309
310 /**
311 * Output the lightroom datasource modal content
312 *
313 * @param $foogallery_id
314 */
315 function render_datasource_modal_content_lightroom_promo( $foogallery_id, $datasource_value ) {
316 $this->render_datasource_modal_content(
317 __('Adobe Lightroom Datasource', 'foogallery' ),
318 __('We have integrated with the WP/LR Sync plugin to enable you to create galleries from a collection within Adobe Lightroom.', 'foogallery' )
319 );
320 }
321
322 /**
323 * Output the RML datasource modal content
324 *
325 * @param $foogallery_id
326 */
327 function render_datasource_modal_content_rml_promo( $foogallery_id, $datasource_value ) {
328 $this->render_datasource_modal_content(
329 __('Real Media Library Datasource', 'foogallery' ),
330 __('Real Media Library is a media library organization plugin. It allows you to sort your library into folders and subfolders. You will need the plugin, available on Code Canyon, in order to create galleries from these folders in your media library.', 'foogallery' )
331 );
332 }
333
334 /**
335 * Output the Post Query datasource modal content
336 *
337 * @param $foogallery_id
338 */
339 function render_datasource_modal_content_post_query_promo( $foogallery_id, $datasource_value ) {
340 $this->render_datasource_modal_content(
341 __('Post Query Datasource', 'foogallery' ),
342 __('You can also pull a gallery from post types on your site. This includes items like your blog posts, pages or articles. Choose a post type, the number of items you want to show in your gallery, posts that you want to exclude, and whether you want the gallery to link to the featured image or the post itself.', 'foogallery' )
343 );
344 }
345
346 function render_datasource_modal_content( $datasouce_title, $datasource_desc,
347 $datasource_url_name = 'foogallery-datasources', $plan = null, $class = '' ) {
348 if ( !isset( $plan ) ) {
349 $plan = __('PRO Expert', 'foogallery');
350 }
351 ?>
352 <div class="foogallery_template_field_type-promo <?php echo esc_attr( $class ); ?>">
353 <div class="foogallery-promo">
354 <strong><?php echo esc_attr( $plan ); ?> <?php esc_html_e('Feature', 'foogallery' ); ?> : <?php echo esc_html( $datasouce_title ); ?></strong>
355 <br><br>
356 <?php echo esc_html( $datasource_desc ); ?>
357 <br><br>
358 <?php echo $this->build_promo_trial_html( 'datasources', $plan ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
359 <br><br>
360 <a class="button-primary" href="<?php echo esc_url( $this->build_url( $datasource_url_name ) ); ?>" target="_blank"><?php echo esc_html__( 'Learn More', 'foogallery' ); ?></a>
361 <a class="button-secondary" href="<?php echo esc_url( $this->build_url( 'foogallery-plans' ) ); ?>" target="_blank"><?php echo esc_html__( 'Compare Plans', 'foogallery' ); ?></a>
362 </div>
363 </div>
364 <?php
365 }
366
367 /**
368 * Add the expert promotion datasources
369 *
370 * @param $datasources
371 *
372 * @return mixed
373 */
374 function add_expert_promo_datasources( $datasources ) {
375 $datasources['media_tags_promo'] = array(
376 'id' => 'media_tags_promo',
377 'name' => __( 'Media Tags', 'foogallery' ),
378 'menu' => __( 'Media Tags', 'foogallery' ),
379 'public' => true,
380 );
381
382 $datasources['media_categories_promo'] = array(
383 'id' => 'media_categories_promo',
384 'name' => __( 'Media Categories', 'foogallery' ),
385 'menu' => __( 'Media Categories', 'foogallery' ),
386 'public' => true,
387 );
388
389 $datasources['folders_promo'] = array(
390 'id' => 'folders_promo',
391 'name' => __( 'Server Folder', 'foogallery' ),
392 'menu' => __( 'Server Folder', 'foogallery' ),
393 'public' => true
394 );
395
396 $datasources['lightroom_promo'] = array(
397 'id' => 'lightroom_promo',
398 'name' => __( 'Adobe Lightroom', 'foogallery' ),
399 'menu' => __( 'Adobe Lightroom', 'foogallery' ),
400 'public' => true
401 );
402
403 $datasources['rml_promo'] = array(
404 'id' => 'rml_promo',
405 'name' => __( 'Real Media Library', 'foogallery' ),
406 'menu' => __( 'Real Media Library', 'foogallery' ),
407 'public' => true
408 );
409
410 $datasources['post_query_promo'] = array(
411 'id' => 'post_query_promo',
412 'name' => __( 'Post Query', 'foogallery' ),
413 'menu' => __( 'Post Query', 'foogallery' ),
414 'public' => true
415 );
416
417 return $datasources;
418 }
419
420 /**
421 * Builds up a URL that can be used for tracking
422 *
423 * @param $url_name
424 * @param $promotion
425 *
426 * @return string
427 */
428 private function build_url( $url_name, $promotion = '') {
429 if ( empty( $promotion ) ) {
430 $promotion = $url_name;
431 }
432
433 $promotion = str_replace( 'foogallery-', '', $promotion );
434
435 return foogallery_admin_url( $this->urls[ $url_name ], 'promos', $promotion );
436 }
437
438 /**
439 * Returns true if the promo areas can be shown
440 * @return bool
441 */
442 private function can_show_promo() {
443 return foogallery_get_setting( 'pro_promo_disabled' ) !== 'on';
444 }
445
446 /**
447 * Returns true if the Social Addon promo should be shown.
448 *
449 * @return bool
450 */
451 private function should_show_social_addon_promo() {
452 return ! $this->is_social_addon_active();
453 }
454
455 /**
456 * Returns true if the Social Addon is active.
457 *
458 * @return bool
459 */
460 private function is_social_addon_active() {
461 $is_active = false;
462
463 if ( defined( 'FG_SOCIAL_VERSION' ) ) {
464 $is_active = true;
465 }
466
467 if ( ! $is_active ) {
468 $classes = array(
469 'FooPlugins\\FooGallery\\Social\\Init',
470 );
471
472 foreach ( $classes as $class ) {
473 if ( class_exists( $class ) ) {
474 $is_active = true;
475 break;
476 }
477 }
478 }
479
480 if ( ! $is_active && function_exists( 'foogallery_social_is_enabled_for_current_gallery' ) ) {
481 $is_active = true;
482 }
483
484 if ( ! $is_active ) {
485 if ( ! function_exists( 'is_plugin_active' ) ) {
486 require_once ABSPATH . 'wp-admin/includes/plugin.php';
487 }
488
489 $plugin_files = array(
490 'foogallery-social/index.php',
491 );
492
493 foreach ( $plugin_files as $plugin_file ) {
494 if ( function_exists( 'is_plugin_active' ) && is_plugin_active( $plugin_file ) ) {
495 $is_active = true;
496 break;
497 }
498 }
499 }
500
501 return (bool) apply_filters( 'foogallery_is_social_addon_active', $is_active );
502 }
503
504 /*
505 * Include promo settings
506 */
507 public function include_promo_settings( $settings ) {
508 $settings['settings'][] = array(
509 'id' => 'pro_promo_disabled',
510 'title' => __( 'Disable PRO Promotions', 'foogallery' ),
511 'desc' => __( 'Disable all premium upsell promotions throughout the WordPress admin.', 'foogallery' ),
512 'type' => 'checkbox',
513 'tab' => 'advanced',
514 'section' => __( 'WordPress Admin', 'foogallery' ),
515 );
516
517 return $settings;
518 }
519
520 /**
521 * Build up some trial and buy links shared for all promos
522 *
523 * @param $promotion
524 *
525 * @return string
526 */
527 private function build_promo_trial_html( $promotion, $plan = null ) {
528 if ( !isset( $plan ) ) {
529 $plan = __( 'PRO', 'foogallery' );
530 }
531 $trial_link = '<a href="' . $this->build_url('foogallery-trial', $promotion ) . '" target="_blank">' . __('start a 7 day free trial', 'foogallery') . '</a>';
532 $pro_link = '<a href="' . foogallery_admin_pricing_url() . '">' . __('Upgrade to', 'foogallery') . ' ' . $plan . '</a>';
533 return sprintf(
534 /* translators: 1: PRO plan name, 2: free trial link, 3: upgrade link. */
535 __( 'To try the %1$s features, %2$s (no credit card required). Or you can %3$s right now.', 'foogallery' ),
536 $plan,
537 $trial_link,
538 $pro_link
539 );
540 }
541
542 /**
543 * Adds promo choices for paging
544 * @param $choices
545 *
546 * @return mixed
547 */
548 public function add_promo_paging_choices( $choices ) {
549 $choices['promo-page'] = array(
550 'label' => __( 'Numbered', 'foogallery' ),
551 'tooltip' => __('Add numbered pagination controls to your larger galleries.', 'foogallery'),
552 'class' => 'foogallery-promo',
553 'icon' => 'dashicons-star-filled'
554 );
555 $choices['promo-infin'] = array(
556 'label' => __( 'Infinite Scroll', 'foogallery' ),
557 'tooltip' => __('Add the popular infinite scroll ability to your larger galleries.', 'foogallery'),
558 'class' => 'foogallery-promo',
559 'icon' => 'dashicons-star-filled'
560 );
561 $choices['promo-load'] = array(
562 'label' => __( 'Load More', 'foogallery' ),
563 'tooltip' => __('Add a Load More button to the end of your larger galleries.', 'foogallery'),
564 'class' => 'foogallery-promo',
565 'icon' => 'dashicons-star-filled'
566 );
567 return $choices;
568 }
569
570 /**
571 * Add promo paging fields to the gallery template
572 *
573 * @uses "foogallery_override_gallery_template_fields"
574 * @param $fields
575 * @param $template
576 *
577 * @return array
578 */
579 function add_paging_promo_fields( $fields, $template ) {
580 if ( $template && array_key_exists( 'paging_support', $template ) && true === $template['paging_support'] ) {
581 $fields[] = array(
582 'id' => 'promo_paging',
583 'title' => __( 'PRO Expert Feature : Advanced Pagination', 'foogallery' ),
584 'desc' => __( 'Besides the dot pagination, you can also add more advanced pagination to your galleries with a large number of images or videos:', 'foogallery' ) .
585 '<ul class="ul-disc"><li><strong>' . __('Numbered' ,'foogallery') . '</strong> ' . __( 'adds a numbered pagination control to top or bottom of your gallery.', 'foogallery' ) .
586 '</li><li><strong>' . __('Infinite Scroll' ,'foogallery') . '</strong> ' . __( 'adds the popular \'infinite scroll\' capability to your gallery, so as your visitors scroll, the gallery will load more items.', 'foogallery' ) .
587 '</li><li><strong>' . __('Load More' ,'foogallery') . '</strong> ' . __( 'adds a \'Load More\' button to the end of your gallery. When visitors click the button, the next set of items will load in the gallery.', 'foogallery' ) .
588 '</li></ul>' . $this->build_promo_trial_html( 'pagination', __( 'PRO Expert', 'foogallery' ) ) . '<br /><br />',
589 'cta' => $this->build_cta_buttons( 'foogallery-pagination' ),
590 'section_id' => 'paging',
591 'type' => 'promo',
592 'row_data'=> array(
593 'data-foogallery-change-selector' => 'input',
594 'data-foogallery-preview' => 'shortcode',
595 'data-foogallery-hidden' => true,
596 'data-foogallery-show-when-field' => 'paging_type',
597 'data-foogallery-show-when-field-operator' => 'indexOf',
598 'data-foogallery-show-when-field-value' => 'promo',
599 )
600 );
601 }
602
603 return $fields;
604 }
605
606 /**
607 * Add the preset choices to the hover effect preset field
608 *
609 * @param $choices
610 *
611 * @return array
612 */
613 function add_promo_preset_choices( $choices ) {
614 return array_merge( $choices, array(
615 'fg-promo-sadie' => array(
616 'label' => __( 'Sadie', 'foogallery' ),
617 'class' => 'foogallery-promo',
618 'icon' => 'dashicons-star-filled'
619 ),
620 'fg-promo-layla' => array(
621 'label' => __( 'Layla', 'foogallery' ),
622 'class' => 'foogallery-promo',
623 'icon' => 'dashicons-star-filled'
624 ),
625 'fg-promo-oscar' => array(
626 'label' => __( 'Oscar', 'foogallery' ),
627 'class' => 'foogallery-promo',
628 'icon' => 'dashicons-star-filled'
629 ),
630 'fg-promo-sarah' => array(
631 'label' => __( 'Sarah', 'foogallery' ),
632 'class' => 'foogallery-promo',
633 'icon' => 'dashicons-star-filled'
634 ),
635 'fg-promo-goliath' => array(
636 'label' => __( 'Goliath', 'foogallery' ),
637 'class' => 'foogallery-promo',
638 'icon' => 'dashicons-star-filled'
639 ),
640 'fg-promo-jazz' => array(
641 'label' => __( 'Jazz', 'foogallery' ),
642 'class' => 'foogallery-promo',
643 'icon' => 'dashicons-star-filled'
644 ),
645 'fg-promo-lily' => array(
646 'label' => __( 'Lily', 'foogallery' ),
647 'class' => 'foogallery-promo',
648 'icon' => 'dashicons-star-filled'
649 ),
650 'fg-promo-ming' => array(
651 'label' => __( 'Ming', 'foogallery' ),
652 'class' => 'foogallery-promo',
653 'icon' => 'dashicons-star-filled'
654 ),
655 'fg-promo-selena' => array(
656 'label' => __( 'Selena', 'foogallery' ),
657 'class' => 'foogallery-promo',
658 'icon' => 'dashicons-star-filled'
659 ),
660 'fg-promo-steve' => array(
661 'label' => __( 'Steve', 'foogallery' ),
662 'class' => 'foogallery-promo',
663 'icon' => 'dashicons-star-filled'
664 ),
665 'fg-promo-zoe' => array(
666 'label' => __( 'Zoe', 'foogallery' ),
667 'class' => 'foogallery-promo',
668 'icon' => 'dashicons-star-filled'
669 ),
670 ) );
671 }
672
673 /**
674 * Add the fields for presets promos
675 *
676 * @uses "foogallery_override_gallery_template_fields"
677 * @param $fields
678 * @param $template
679 *
680 * @return array
681 */
682 function add_preset_promo_fields( $fields, $template ) {
683 //$index_of_hover_effect_preset_field = foogallery_admin_fields_find_index_of_field( $fields, 'hover_effect_preset' );
684
685 $fields[] = array(
686 'id' => 'hover_effect_preset_promo_help',
687 'title' => __( 'PRO Starter Feature : Hover Effect Presets', 'foogallery' ),
688 'desc' => __( 'There are 11 more stylish hover effect presets to choose from, which takes all the hard work out of making your galleries look professional and elegant.', 'foogallery' ) .
689 '<br />' . __( 'Some of the effects like "Sarah" add subtle colors on hover, while other effects like "Layla" and "Oscar" add different shapes to the thumbnail.', 'foogallery') .
690 '<br />' . __(' You really need to see all the different effects in action to appreciate them.', 'foogallery' ) . '<br /><br />' .
691 $this->build_promo_trial_html( 'hover-presets', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
692 'class' => 'foogallery_promo_prostarter',
693 'type' => 'promo',
694 'cta' => $this->build_cta_buttons( 'foogallery-hover-presets' ),
695 'section_id' => 'hover-effects',
696 'row_data' => array(
697 'data-foogallery-hidden' => true,
698 'data-foogallery-show-when-field' => 'hover_effect_preset',
699 'data-foogallery-show-when-field-operator' => '!==',
700 'data-foogallery-show-when-field-value' => 'fg-preset fg-brad',
701 )
702 );
703
704 //array_splice( $fields, $index_of_hover_effect_preset_field, 0, $new_fields );
705
706 return $fields;
707 }
708
709 /**
710 * Add EXIF fields to the gallery templates
711 *
712 * @uses "foogallery_override_gallery_template_fields"
713 *
714 * @param $fields
715 * @param $template
716 *
717 * @return array
718 */
719 function add_exif_promo_fields( $fields, $template ) {
720 $fields[] = array(
721 'id' => 'promo_exif',
722 'title' => __( 'PRO Expert Feature : EXIF Metadata', 'foogallery' ),
723 'section_id' => 'exif',
724 'desc' => __( 'Show image metadata within your galleries. A must-have for professional photographers wanting to showcase specific metadata about each image.', 'foogallery' )
725 . '<br /><br />' . $this->build_promo_trial_html( 'filtering', __( 'PRO Expert', 'foogallery' ) ). '<br /><br />',
726 'cta' => $this->build_cta_buttons( 'foogallery-exif' ),
727 'type' => 'promo',
728 'row_data' => array(
729 'data-foogallery-change-selector' => 'input',
730 'data-foogallery-value-selector' => 'input:checked',
731 )
732 );
733
734 return $fields;
735 }
736
737 /**
738 * Add ImageGallery schema promo fields to the gallery templates.
739 *
740 * @uses "foogallery_override_gallery_template_fields"
741 *
742 * @param array $fields Gallery template fields.
743 * @param array $template Current gallery template.
744 *
745 * @return array
746 */
747 function add_imagegallery_schema_promo_fields( $fields, $template ) {
748 unset( $template );
749
750 $fields[] = array(
751 'id' => 'promo_imagegallery_schema',
752 'title' => __( 'PRO Expert Feature : ImageGallery Schema', 'foogallery' ),
753 'section_id' => 'seo',
754 'desc' => __( 'Help search engines and scrapers understand your gallery images by outputting ImageGallery JSON-LD schema on pages where FooGallery usage is detected:', 'foogallery' ) .
755 '<ul class="ul-disc"><li><strong>' . __( 'Page-level ImageGallery schema', 'foogallery' ) . '</strong> - ' . __( 'outputs structured data in the page head for eligible singular pages and posts.', 'foogallery' ) .
756 '</li><li><strong>' . __( 'ImageObject details', 'foogallery' ) . '</strong> - ' . __( 'uses attachment titles, captions, descriptions, dates, and full image URLs for each gallery image.', 'foogallery' ) .
757 '</li><li><strong>' . __( 'Per-gallery overrides', 'foogallery' ) . '</strong> - ' . __( 'customize schema names, descriptions, keywords, authors, licenses, and publication dates per gallery.', 'foogallery' ) .
758 '</li></ul>' . $this->build_promo_trial_html( 'imagegallery-schema', __( 'PRO Expert', 'foogallery' ) ) . '<br /><br />',
759 'class' => 'foogallery_promo_pro',
760 'cta' => array(
761 array(
762 'text' => __( 'Learn More', 'foogallery' ),
763 'link' => $this->build_url( 'foogallery-imagegallery-schema' ),
764 ),
765 array(
766 'text' => __( 'Compare PRO Plans', 'foogallery' ),
767 'link' => $this->build_url( 'foogallery-plans' ),
768 'class' => 'button-secondary',
769 ),
770 ),
771 'type' => 'promo',
772 'row_data' => array(
773 'data-foogallery-change-selector' => 'input',
774 'data-foogallery-preview' => 'shortcode',
775 'data-foogallery-value-selector' => 'input:checked',
776 )
777 );
778
779 return $fields;
780 }
781
782 /**
783 * Add filtering fields to the gallery templates
784 *
785 * @uses "foogallery_override_gallery_template_fields"
786 *
787 * @param $fields
788 * @param $template
789 *
790 * @return array
791 */
792 function add_filtering_promo_fields( $fields, $template ) {
793 if ( $template && array_key_exists( 'filtering_support', $template ) && true === $template['filtering_support'] ) {
794 $fields[] = array(
795 'id' => 'promo_filtering',
796 'title' => __( 'PRO Expert Feature : Filtering by Tags or Categories', 'foogallery' ),
797 'section_id' => 'filtering',
798 'desc' => __( 'Add frontend filtering to your gallery, simply by assigning media tags or media categories to your gallery attachments. Other filtering features include:', 'foogallery' ) .
799 '<ul class="ul-disc"><li><strong>' . __('Filter Source' ,'foogallery') . '</strong> - ' . __( 'choose to filter the gallery by tag or category, or any other attachment taxonomy.', 'foogallery' ) .
800 '</li><li><strong>' . __('Look &amp; Feel' ,'foogallery') . '</strong> - ' . __( 'display the filters above or below the gallery, and choose a color theme.', 'foogallery' ) .
801 '</li><li><strong>' . __('Selection Mode' ,'foogallery') . '</strong> - ' . __( 'allow your visitors to select a single or multiple filters. Multiple also supports union or intersection modes.', 'foogallery' ) .
802 '</li><li><strong>' . __('Show Counters' ,'foogallery') . '</strong> - ' . __( 'show the number of items in each tag filter.', 'foogallery' ) .
803 '</li><li><strong>' . __('Adjust Size & Opacity' ,'foogallery') . '</strong> - ' . __( 'adjust the size and opacity of each filter based on the number of items.', 'foogallery' ) .
804 '</li></ul>' . $this->build_promo_trial_html( 'filtering', __( 'PRO Expert', 'foogallery' ) ). '<br /><br />',
805 'cta' => $this->build_cta_buttons( 'foogallery-filtering' ),
806 'type' => 'promo',
807 'row_data' => array(
808 'data-foogallery-change-selector' => 'input',
809 'data-foogallery-preview' => 'shortcode',
810 'data-foogallery-value-selector' => 'input:checked',
811 )
812 );
813 }
814
815 return $fields;
816 }
817
818 /**
819 * Add Colors fields to the gallery templates.
820 *
821 * @uses "foogallery_override_gallery_template_fields"
822 *
823 * @param array $fields Gallery template fields.
824 * @param array $template Current gallery template.
825 *
826 * @return array
827 */
828 function add_colors_promo_fields( $fields, $template ) {
829 unset( $template );
830
831 $fields[] = array(
832 'id' => 'promo_colors',
833 'title' => __( 'PRO Starter Feature : Colors', 'foogallery' ),
834 'section_id' => 'colors',
835 'desc' => __( 'Extract dominant colors and palettes from your gallery images, then use those colors to create more art-directed galleries:', 'foogallery' ) .
836 '<ul class="ul-disc"><li><strong>' . __( 'Color Extraction', 'foogallery' ) . '</strong> - ' . __( 'extract dominant color metadata and palettes for each gallery image.', 'foogallery' ) .
837 '</li><li><strong>' . __( 'Color Sorting', 'foogallery' ) . '</strong> - ' . __( 'sort galleries by hue, saturation, lightness, or an overall color index.', 'foogallery' ) .
838 '</li><li><strong>' . __( 'Item Backgrounds', 'foogallery' ) . '</strong> - ' . __( 'apply each item\'s dominant color as an opaque or theme-aware tinted background.', 'foogallery' ) .
839 '</li><li><strong>' . __( 'Attachment Color Editing', 'foogallery' ) . '</strong> - ' . __( 'review extracted color values and fine-tune attachment colors from the gallery editor.', 'foogallery' ) .
840 '</li></ul>' . $this->build_promo_trial_html( 'colors', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
841 'class' => 'foogallery_promo_prostarter',
842 'cta' => $this->build_cta_buttons( 'foogallery-colors' ),
843 'type' => 'promo',
844 'row_data' => array(
845 'data-foogallery-change-selector' => 'input',
846 'data-foogallery-preview' => 'shortcode',
847 'data-foogallery-value-selector' => 'input:checked',
848 )
849 );
850
851 return $fields;
852 }
853
854 /**
855 * Returns the Dashicon that can be used in starter settings tabs.
856 *
857 * @param string $section_slug Section slug.
858 *
859 * @return string
860 */
861 function add_starter_section_icons( $section_slug ) {
862 if ( 'colors' === $section_slug ) {
863 return 'dashicons-art';
864 }
865
866 return $section_slug;
867 }
868
869 /**
870 * Returns the Dashicon that can be used in the settings tabs
871 *
872 * @param $section_slug
873 *
874 * @return string
875 */
876 function add_expert_section_icons( $section_slug ) {
877 if ( 'filtering' === $section_slug ) {
878 return 'dashicons-filter';
879 }
880
881 if ( 'lightbox' === $section_slug ) {
882 return 'dashicons-grid-view';
883 }
884
885 if ( 'exif' === strtolower( $section_slug ) ) {
886 return 'dashicons-info-outline';
887 }
888
889 if ( 'seo' === $section_slug ) {
890 return 'dashicons-search';
891 }
892
893 return $section_slug;
894 }
895
896 /**
897 * Add fields to the gallery template
898 *
899 * @uses "foogallery_override_gallery_template_fields"
900 *
901 * @param $fields
902 * @param $template
903 *
904 * @return array
905 */
906 function add_appearance_promo_fields( $fields, $template ) {
907
908 $fields[] = array(
909 'id' => 'filter_promo',
910 'title' => __( 'PRO Starter Feature : Thumbnail Effects (Like Instagram!)', 'foogallery' ),
911 'section_id' => 'appearance',
912 'desc' => __( 'Apply an effect to your gallery thumbnails, just like you can in Instagram. Choose from 12 unique effects!', 'foogallery' )
913 . '<br /><br />' . $this->build_promo_trial_html( 'appearance', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
914 'type' => 'promo',
915 'class' => 'foogallery_promo_prostarter',
916 'cta' => $this->build_cta_buttons( 'foogallery-thumbnail-filters' )
917 );
918
919 return $fields;
920 }
921
922 /**
923 * Add fields to the gallery template
924 *
925 * @uses "foogallery_override_gallery_template_fields"
926 *
927 * @param $fields
928 * @param $template
929 *
930 * @return array
931 */
932 function add_video_promo_fields( $fields ) {
933
934 $fields[] = array(
935 'id' => 'video_promo',
936 'section_id' => 'video',
937 'title' => __( 'PRO Expert Feature : Video Galleries', 'foogallery' ),
938 'desc' => __( 'Take your galleries to the next level with full video support:', 'foogallery' ) .
939 '<ul class="ul-disc"><li><strong>' . __( 'Video Galleries', 'foogallery' ) . '</strong> - ' . __( 'Easily import videos to create beautiful video galleries. Or mix images and videos if you like.', 'foogallery' ) .
940 '</li><li><strong>' . __( 'Youtube Video Search', 'foogallery' ) . '</strong> - ' . __( 'Search for Youtube videos, and then import them into your galleries in seconds.', 'foogallery' ) .
941 '</li><li><strong>' . __( 'Vimeo Search And Import', 'foogallery' ) . '</strong> - ' . __( 'Import albums, channels, users or individual videos from Vimeo.', 'foogallery' ) .
942 '</li><li><strong>' . __( 'Import From Other Sources', 'foogallery' ) . '</strong> - ' . __( 'Import from other popular video sources, including Facebook, Daily Motion, TED and others!', 'foogallery' ) .
943 '</li><li><strong>' . __( 'Self-Hosted Videos', 'foogallery' ) . '</strong> - ' . __( 'Host your own videos? No problem! Upload them, select thumbnails and use in your gallery.', 'foogallery' ) .
944 '</li></ul>' . $this->build_promo_trial_html( 'videos', __( 'PRO Expert', 'foogallery' ) ) . '<br /><br />',
945 'type' => 'promo',
946 'default' => 'fg-video-default',
947 'cta' => $this->build_cta_buttons( 'foogallery-videos' )
948 );
949
950 return $fields;
951 }
952
953 /**
954 * Add Social Addon promo fields to the gallery template.
955 *
956 * @uses "foogallery_override_gallery_template_fields"
957 *
958 * @param $fields
959 * @param $template
960 *
961 * @return array
962 */
963 function add_social_addon_promo_fields( $fields, $template ) {
964 if ( $this->is_social_addon_active() ) {
965 return $fields;
966 }
967
968 $fields[] = array(
969 'id' => 'social_addon_promo',
970 'section_id' => 'social',
971 'title' => __( 'Social Addon: Sharing, Likes, and Comments', 'foogallery' ),
972 'desc' => __( 'Add social engagement and sharing to your galleries:', 'foogallery' ) .
973 '<ul class="ul-disc"><li><strong>' . __( 'Lightbox Sharing', 'foogallery' ) . '</strong> - ' . __( 'Let visitors share gallery items to social networks from the built-in lightbox.', 'foogallery' ) .
974 '</li><li><strong>' . __( 'Likes', 'foogallery' ) . '</strong> - ' . __( 'Add like buttons on thumbnails, and sort gallery images by most liked.', 'foogallery' ) .
975 '</li><li><strong>' . __( 'Comments', 'foogallery' ) . '</strong> - ' . __( 'Let visitors comment on your gallery images, or reply to other comments.', 'foogallery' ) .
976 '</li></ul>' . __( 'Includes all the settings you need for customization, moderation or allowing anonymous comments / likes.', 'foogallery' ) . '<br /><br />',
977 'type' => 'promo',
978 'cta' => $this->build_social_addon_cta_buttons(),
979 );
980
981 return $fields;
982 }
983
984 private function build_social_addon_cta_buttons() {
985 return array(
986 array(
987 'text' => __( 'Learn More', 'foogallery' ),
988 'link' => $this->build_url( 'foogallery-social' ),
989 ),
990 array(
991 'text' => __( 'View Addons', 'foogallery' ),
992 'link' => foogallery_admin_addon_url(),
993 'class' => 'button-secondary',
994 ),
995 );
996 }
997
998 private function build_cta_buttons( $url_name ) {
999 return array(
1000 array(
1001 'text' => __( 'View Demo', 'foogallery' ),
1002 'link' => $this->build_url( $url_name )
1003 ),
1004 array(
1005 'text' => __( 'Compare PRO Plans', 'foogallery' ),
1006 'link' => $this->build_url( 'foogallery-plans' ),
1007 'class' => 'button-secondary'
1008 )
1009 );
1010 }
1011
1012 /**
1013 * Add our promo gallery templates
1014 * @param $gallery_templates
1015 *
1016 * @return array
1017 */
1018 function add_promo_templates( $gallery_templates ) {
1019
1020 $gallery_templates[] = array(
1021 'slug' => 'polaroid_promo',
1022 'name' => __( 'Polaroid PRO', 'foogallery' ),
1023 'preview_support' => false,
1024 'common_fields_support' => false,
1025 'lazyload_support' => false,
1026 'paging_support' => false,
1027 'thumbnail_dimensions' => false,
1028 'filtering_support' => false,
1029 'class' => 'is-pro',
1030 'icon' => '<svg viewBox="0 0 24 24">
1031 <!-- top left -->
1032 <g transform="rotate(-5 7 5)">
1033 <rect x="2" y="2" width="8" height="5"/>
1034 <rect x="2" y="7" width="8" height="2"/>
1035 </g>
1036
1037 <!-- top right -->
1038 <g transform="rotate(4 17 5)">
1039 <rect x="13" y="3" width="8" height="5"/>
1040 <rect x="13" y="8" width="8" height="2"/>
1041 </g>
1042
1043 <!-- bottom left -->
1044 <g transform="rotate(3 7 15)">
1045 <rect x="3" y="12" width="8" height="5"/>
1046 <rect x="3" y="17" width="8" height="2"/>
1047 </g>
1048
1049 <!-- bottom right -->
1050 <g transform="rotate(-4 17 15)">
1051 <rect x="14" y="13" width="8" height="5"/>
1052 <rect x="14" y="18" width="8" height="2"/>
1053 </g>
1054 </svg>',
1055 'fields' => array(
1056 array(
1057 'id' => 'polaroid_promo',
1058 'title' => __( 'Polaroid PRO Gallery Layout', 'foogallery' ),
1059 'desc' => __( 'Available in all PRO plans, the Polaroid PRO gallery layout is a fun take on the Portfolio gallery. Image thumbnails are framed as Polaroid photos which are staggered on the page.', 'foogallery' ) . '<br />' .
1060 '<img src="https://assets.fooplugins.com/foogallery/foogallery-polaroid-gallery.jpg" alt="' . esc_attr__( 'Polaroid PRO gallery layout preview', 'foogallery' ) . '" />' .
1061 '<br /><br />' . $this->build_promo_trial_html( 'polaroid', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
1062 'section_id' => 'general',
1063 'type' => 'promo',
1064 'class' => 'foogallery_promo_prostarter',
1065 'keep_in_promo' => true,
1066 'cta' => $this->build_cta_buttons( 'foogallery-polaroid' )
1067 )
1068 )
1069 );
1070
1071 $gallery_templates[] = array(
1072 'slug' => 'grid_promo',
1073 'name' => __( 'Grid PRO', 'foogallery'),
1074 'preview_support' => false,
1075 'common_fields_support' => false,
1076 'lazyload_support' => false,
1077 'paging_support' => false,
1078 'thumbnail_dimensions' => false,
1079 'filtering_support' => false,
1080 'class' => 'is-pro',
1081 'icon' => '<svg viewBox="0 0 24 24">
1082 <!-- Top row (3 small) -->
1083 <rect x="3" y="3" width="6" height="5"/>
1084 <rect x="9" y="3" width="6" height="5"/>
1085 <rect x="15" y="3" width="6" height="5"/>
1086 <!-- Middle row (1 large) -->
1087 <rect x="3" y="8" width="18" height="8"/>
1088 <!-- Bottom row (3 small) -->
1089 <rect x="3" y="16" width="6" height="5"/>
1090 <rect x="9" y="16" width="6" height="5"/>
1091 <rect x="15" y="16" width="6" height="5"/>
1092 </svg>',
1093 'fields' => array(
1094 array(
1095 'id' => 'grid_promo',
1096 'title' => __( 'Grid PRO Gallery Layout', 'foogallery' ),
1097 'desc' => __( 'Available in all PRO plans, the Grid PRO gallery layout creates a stylish grid gallery that allows you to "preview" each image, similar to how Google Image Search works.', 'foogallery' ) . '<br /><br />' .
1098 '<img src="https://assets.fooplugins.com/foogallery/foogallery-grid-gallery.jpg" alt="' . esc_attr__( 'Grid PRO gallery layout preview', 'foogallery' ) . '" />' .
1099 '<br /><br />' . $this->build_promo_trial_html( 'grid', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
1100 'section_id' => 'general',
1101 'type' => 'promo',
1102 'class' => 'foogallery_promo_prostarter',
1103 'keep_in_promo' => true,
1104 'cta' => $this->build_cta_buttons( 'foogallery-grid' )
1105 )
1106 )
1107 );
1108
1109 $gallery_templates[] = array(
1110 'slug' => 'slider_promo',
1111 'name' => __( 'Slider PRO', 'foogallery'),
1112 'preview_support' => false,
1113 'common_fields_support' => false,
1114 'lazyload_support' => false,
1115 'paging_support' => false,
1116 'thumbnail_dimensions' => false,
1117 'filtering_support' => false,
1118 'class' => 'is-pro',
1119 'icon' => '<svg viewBox="0 0 24 24">
1120 <!-- Left thumbs -->
1121 <rect x="3" y="4" width="6" height="5"/>
1122 <rect x="3" y="9" width="6" height="5"/>
1123 <rect x="3" y="14" width="6" height="5"/>
1124 <!-- Main image -->
1125 <rect x="9" y="4" width="12" height="15"/>
1126 </svg>',
1127 'fields' => array(
1128 array(
1129 'id' => 'slider_promo',
1130 'title' => __( 'Slider PRO Gallery Layout', 'foogallery' ),
1131 'desc' => __( 'Available in all PRO plans, the Slider PRO gallery layout creates an amazing slider gallery in either a horizontal or a vertical layout.', 'foogallery' ) . '<br /><br />' .
1132 '<img src="https://assets.fooplugins.com/foogallery/foogallery-slider-gallery-vertical.jpg" alt="' . esc_attr__( 'Vertical Slider PRO gallery layout preview', 'foogallery' ) . '" /><br /><br />' .
1133 '<img src="https://assets.fooplugins.com/foogallery/foogallery-slider-gallery-horizontal.jpg" alt="' . esc_attr__( 'Horizontal Slider PRO gallery layout preview', 'foogallery' ) . '" /><br /><br />' .
1134 $this->build_promo_trial_html( 'slider', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
1135 'section_id' => 'general',
1136 'type' => 'promo',
1137 'class' => 'foogallery_promo_prostarter',
1138 'keep_in_promo' => true,
1139 'cta' => $this->build_cta_buttons( 'foogallery-slider' )
1140 )
1141 )
1142 );
1143
1144 $gallery_templates[] = array(
1145 'slug' => 'spotlight_promo',
1146 'name' => __( 'Spotlight PRO', 'foogallery' ),
1147 'preview_support' => false,
1148 'common_fields_support' => false,
1149 'lazyload_support' => false,
1150 'paging_support' => false,
1151 'thumbnail_dimensions' => false,
1152 'filtering_support' => false,
1153 'class' => 'is-pro',
1154 'icon' => '<svg viewBox="0 0 24 24">
1155 <rect x="3" y="4" width="18" height="17"/>
1156 <polygon points="5,11 7,9 7,13" />
1157 <polygon points="19,11 17,9 17,13" />
1158 <circle cx="8" cy="17" r="0.8"/>
1159 <circle cx="12" cy="17" r="0.8"/>
1160 <circle cx="16" cy="17" r="0.8"/>
1161 </svg>',
1162 'fields' => array(
1163 array(
1164 'id' => 'spotlight_promo',
1165 'title' => __( 'Spotlight PRO Gallery Layout', 'foogallery' ),
1166 'desc' => __( 'Available in all PRO plans, the Spotlight PRO gallery layout offers a clean and effective way to showcase images inline without opening them in a lightbox. Scroll through gallery images with navigational arrows and dots for a modern, focused presentation.', 'foogallery' ) . '<br /><br />' .
1167 '<img src="https://assets.fooplugins.com/foogallery/foogallery-spotlight-gallery.png" alt="' . esc_attr__( 'Spotlight PRO gallery layout preview', 'foogallery' ) . '" /><br /><br />' .
1168 $this->build_promo_trial_html( 'spotlight', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
1169 'section_id' => 'general',
1170 'type' => 'promo',
1171 'class' => 'foogallery_promo_prostarter',
1172 'keep_in_promo' => true,
1173 'cta' => $this->build_cta_buttons( 'foogallery-spotlight' )
1174 )
1175 )
1176 );
1177
1178 return $gallery_templates;
1179 }
1180
1181 /**
1182 * Remove fields from the promo template
1183 *
1184 * @uses "foogallery_override_gallery_template_fields-template"
1185 * @param $fields
1186 * @param $template
1187 *
1188 * @return array
1189 */
1190 function remove_all_fields_from_promo_gallery_template( $fields, $template ) {
1191 $remaining_fields = array();
1192
1193 //remove all fields that are not of type promo
1194 foreach ($fields as $field) {
1195 if ( array_key_exists( 'keep_in_promo', $field ) ) {
1196 $remaining_fields[] = $field;
1197 }
1198 }
1199
1200 return $remaining_fields;
1201 }
1202
1203 /**
1204 * Add Ecommerce fields to the gallery templates
1205 *
1206 * @uses "foogallery_override_gallery_template_fields"
1207 *
1208 * @param $fields
1209 * @param $template
1210 *
1211 * @return array
1212 */
1213 function add_ecommerce_promo_fields( $fields, $template ) {
1214 $new_fields[] = array(
1215 'id' => 'promo_ecommerce',
1216 'title' => __( 'PRO Commerce Feature : WooCommerce Integration', 'foogallery' ),
1217 'section_id' => 'ecommerce',
1218 'desc' => __( 'Start making money from selling your photographs, with our deep integration with WooCommerce:', 'foogallery' ) .
1219 '<ul class="ul-disc"><li><strong>' . __( 'Product Datasource', 'foogallery' ) . '</strong> - ' . __( 'Create a dynamic product gallery that updates when you add or change products.', 'foogallery' ) .
1220 '</li><li><strong>' . __( 'Filter By Product Categories', 'foogallery' ) . '</strong> - ' . __( 'Filter your gallery images by product category.', 'foogallery' ) .
1221 '</li><li><strong>' . __( 'Sale Ribbons', 'foogallery' ) . '</strong> - ' . __( 'Draw attention to products on sale, and show a cool ribbon over your product.', 'foogallery' ) .
1222 '</li><li><strong>' . __( 'Add To Cart Buttons', 'foogallery' ) . '</strong> - ' . __( 'Add buttons to your products to easily add to cart or view.', 'foogallery' ) .
1223 '</li><li><strong>' . __( 'Custom Caption Support', 'foogallery' ) . '</strong> - ' . __( 'Already using our advanced custom captions? Now you can include any product info in your caption template.', 'foogallery' ) .
1224 '</li><li><strong>' . __( 'Product Variation Support', 'foogallery' ) . '</strong> - ' . __( 'Using variable products? No problem! Show variations in the lightbox and add directly to cart from the lightbox.', 'foogallery' ) .
1225 '</li><li><strong>' . __( 'Manually Link Products', 'foogallery' ) . '</strong> - ' . __( 'You can also manually link a product to each item in your gallery for complete control.', 'foogallery' ) .
1226 '</li><li><strong>' . __( 'Master Product', 'foogallery' ) . '</strong> - ' . __( 'You can set a "Master Product" for all items in the gallery. Info from the attachment will be transferred to items in the cart and order.', 'foogallery' ) .
1227 '</li></ul>' . $this->build_promo_trial_html( 'ecommerce', __( 'PRO Commerce', 'foogallery' ) ) . '<br /><br />',
1228 'cta' => $this->build_cta_buttons( 'foogallery-commerce' ),
1229 'class' => 'foogallery_promo_commerce',
1230 'type' => 'promo',
1231 'row_data' => array(
1232 'data-foogallery-change-selector' => 'input',
1233 'data-foogallery-value-selector' => 'input:checked',
1234 )
1235 );
1236
1237 // find the index of the advanced section.
1238 $index = foogallery_admin_fields_find_index_of_section( $fields, 'advanced' );
1239
1240 array_splice( $fields, $index, 0, $new_fields );
1241
1242 return $fields;
1243 }
1244
1245
1246 /**
1247 * Add Protection fields to the gallery templates
1248 *
1249 * @uses "foogallery_override_gallery_template_fields"
1250 *
1251 * @param $fields
1252 * @param $template
1253 *
1254 * @return array
1255 */
1256 function add_protection_promo_fields( $fields, $template ) {
1257 $new_fields[] = array(
1258 'id' => 'promo_protection',
1259 'title' => __( 'PRO Commerce Feature : Image Protection', 'foogallery' ),
1260 'section_id' => 'protection',
1261 'desc' => __( 'Protect your images from theft:', 'foogallery' ) .
1262 '<ul class="ul-disc"><li><strong>' . __( 'Disable Right Click', 'foogallery' ) . '</strong> - ' . __( 'Prevent your visitors from being able to right click on thumbnails and full size images in the lightbox.', 'foogallery' ) .
1263 '</li><li><strong>' . __( 'Watermark Generation', 'foogallery' ) . '</strong> - ' . __( 'Generate advanced watermarks for all images in your gallery.', 'foogallery' ) .
1264 '</li><li><strong>' . __( 'Built-in watermark designs', 'foogallery' ) . '</strong> - ' . __( 'You can choose one of our built-in repeating watermarks, or you can upload and use your own.', 'foogallery' ) .
1265 '</li></ul>' . $this->build_promo_trial_html( 'protection', __( 'PRO Commerce', 'foogallery' ) ) . '<br /><br />',
1266 'cta' => $this->build_cta_buttons( 'foogallery-protection' ),
1267 'class' => 'foogallery_promo_commerce',
1268 'type' => 'promo',
1269 'row_data' => array(
1270 'data-foogallery-change-selector' => 'input',
1271 'data-foogallery-value-selector' => 'input:checked',
1272 )
1273 );
1274
1275 // find the index of the advanced section.
1276 $index = foogallery_admin_fields_find_index_of_section( $fields, 'advanced' );
1277
1278 array_splice( $fields, $index, 0, $new_fields );
1279
1280 return $fields;
1281 }
1282
1283 /**
1284 * Add the commerce promotion datasources
1285 *
1286 * @param $datasources
1287 *
1288 * @return mixed
1289 */
1290 function add_commerce_promo_datasources( $datasources ) {
1291 $datasources['products_promo'] = array(
1292 'id' => 'products_promo',
1293 'name' => __( 'WooCommerce Products', 'foogallery' ),
1294 'menu' => __( 'WooCommerce Products', 'foogallery' ),
1295 'public' => true,
1296 );
1297
1298 return $datasources;
1299 }
1300
1301 /**
1302 * Output the server folders datasource modal content
1303 *
1304 * @param $foogallery_id
1305 */
1306 function render_datasource_modal_content_products_promo( $foogallery_id, $datasource_value ) {
1307 $this->render_datasource_modal_content(
1308 __( 'WooCommerce Product Datasource', 'foogallery' ),
1309 __( 'Create a dynamic gallery from your WooCommerce products. You can limit how many products, only show certain categories or exclude specific products from your product gallery. Your gallery will dynamically update when you add or change any of your products.', 'foogallery' ),
1310 'foogallery-product-gallery',
1311 __( 'PRO Commerce', 'foogallery' ),
1312 'foogallery_promo_commerce'
1313 );
1314 }
1315
1316 /**
1317 * Returns the Dashicon that can be used in the settings tabs
1318 *
1319 * @param $section_slug
1320 *
1321 * @return string
1322 */
1323 function add_commerce_section_icons( $section_slug ) {
1324 if ( 'ecommerce' === strtolower( $section_slug ) ) {
1325 return 'dashicons-cart';
1326 }
1327
1328 if ( 'protection' === strtolower( $section_slug ) ) {
1329 return 'dashicons-lock';
1330 }
1331
1332 return $section_slug;
1333 }
1334
1335 /**
1336 * Add our commerce promo gallery templates
1337 * @param $gallery_templates
1338 *
1339 * @return array
1340 */
1341 function add_commerce_promo_templates( $gallery_templates ) {
1342
1343 $gallery_templates[] = array(
1344 'slug' => 'product_promo',
1345 'name' => __( 'Product Gallery', 'foogallery' ),
1346 'preview_support' => false,
1347 'common_fields_support' => false,
1348 'lazyload_support' => false,
1349 'paging_support' => false,
1350 'thumbnail_dimensions' => false,
1351 'filtering_support' => false,
1352 'class' => 'is-pro commerce',
1353 'icon' => '<svg viewBox="0 0 24 24">
1354 <!-- cart basket -->
1355 <path d="M6 7h13l-2 7H8z"/>
1356
1357 <!-- handle flipped inward -->
1358 <path d="M6 7V4h-3"/>
1359
1360 <!-- wheels -->
1361 <circle cx="9" cy="18" r="1.5"/>
1362 <circle cx="16" cy="18" r="1.5"/>
1363 </svg>',
1364 'fields' => array(
1365 array(
1366 'id' => 'product_promo',
1367 'title' => __( 'Product Gallery Layout', 'foogallery' ),
1368 'desc' => __( 'Only available in the Commerce PRO plan, the Product Gallery layout works out of the box with the WooCommerce Product Datasource, making it very easy for you to start selling your photographs online.', 'foogallery' ) .
1369 '<br />' . '<img src="https://assets.fooplugins.com/foogallery/foogallery-product-gallery.png" alt="' . esc_attr__( 'Product gallery layout preview', 'foogallery' ) . '" />' .
1370 '<br /><br />' . $this->build_promo_trial_html( 'product-gallery', __( 'PRO Commerce', 'foogallery' ) ) . '<br /><br />',
1371 'section_id' => 'general',
1372 'type' => 'promo',
1373 'class' => 'foogallery_promo_commerce',
1374 'keep_in_promo' => true,
1375 'cta' => $this->build_cta_buttons( 'foogallery-product-gallery' )
1376 )
1377 )
1378 );
1379
1380 return $gallery_templates;
1381 }
1382 }
1383 }
1384