PluginProbe ʕ •ᴥ•ʔ
Gallery : FooGallery / 3.2.6
Gallery : FooGallery v3.2.6
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 4 weeks ago class-admin-notices.php 4 weeks ago class-admin.php 4 weeks ago class-attachment-fields.php 4 weeks ago class-columns.php 4 weeks ago class-demo-content.php 4 weeks ago class-extensions.php 4 weeks ago class-gallery-attachment-modal.php 4 weeks ago class-gallery-datasources.php 4 weeks ago class-gallery-editor.php 4 weeks ago class-gallery-metabox-fields.php 4 weeks ago class-gallery-metabox-items.php 4 weeks ago class-gallery-metabox-settings-helper.php 4 weeks ago class-gallery-metabox-settings.php 4 weeks ago class-gallery-metabox-template.php 4 weeks ago class-gallery-metaboxes.php 4 weeks ago class-menu.php 4 weeks ago class-pro-promotion.php 4 weeks ago class-settings.php 4 weeks ago class-silent-installer-skin.php 4 weeks ago class-trial-mode.php 4 weeks ago demo-content-galleries.php 4 weeks ago demo-content-images.php 4 weeks ago index.php 4 weeks ago pro-features.php 4 weeks ago view-features.php 4 weeks ago view-help-demos.php 4 weeks ago view-help-getting-started.php 4 weeks ago view-help-pro.php 4 weeks ago view-help.php 4 weeks ago view-system-info.php 4 weeks ago
class-pro-promotion.php
1385 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' => __( 'Captions', 'foogallery' ),
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' => __( 'Captions', 'foogallery' ),
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 );
515
516 return $settings;
517 }
518
519 /**
520 * Build up some trial and buy links shared for all promos
521 *
522 * @param $promotion
523 *
524 * @return string
525 */
526 private function build_promo_trial_html( $promotion, $plan = null ) {
527 if ( !isset( $plan ) ) {
528 $plan = __( 'PRO', 'foogallery' );
529 }
530 $trial_link = '<a href="' . $this->build_url('foogallery-trial', $promotion ) . '" target="_blank">' . __('start a 7 day free trial', 'foogallery') . '</a>';
531 $pro_link = '<a href="' . foogallery_admin_pricing_url() . '">' . __('Upgrade to', 'foogallery') . ' ' . $plan . '</a>';
532 return sprintf(
533 /* translators: 1: PRO plan name, 2: free trial link, 3: upgrade link. */
534 __( 'To try the %1$s features, %2$s (no credit card required). Or you can %3$s right now.', 'foogallery' ),
535 $plan,
536 $trial_link,
537 $pro_link
538 );
539 }
540
541 /**
542 * Adds promo choices for paging
543 * @param $choices
544 *
545 * @return mixed
546 */
547 public function add_promo_paging_choices( $choices ) {
548 $choices['promo-page'] = array(
549 'label' => __( 'Numbered', 'foogallery' ),
550 'tooltip' => __('Add numbered pagination controls to your larger galleries.', 'foogallery'),
551 'class' => 'foogallery-promo',
552 'icon' => 'dashicons-star-filled'
553 );
554 $choices['promo-infin'] = array(
555 'label' => __( 'Infinite Scroll', 'foogallery' ),
556 'tooltip' => __('Add the popular infinite scroll ability to your larger galleries.', 'foogallery'),
557 'class' => 'foogallery-promo',
558 'icon' => 'dashicons-star-filled'
559 );
560 $choices['promo-load'] = array(
561 'label' => __( 'Load More', 'foogallery' ),
562 'tooltip' => __('Add a Load More button to the end of your larger galleries.', 'foogallery'),
563 'class' => 'foogallery-promo',
564 'icon' => 'dashicons-star-filled'
565 );
566 return $choices;
567 }
568
569 /**
570 * Add promo paging fields to the gallery template
571 *
572 * @uses "foogallery_override_gallery_template_fields"
573 * @param $fields
574 * @param $template
575 *
576 * @return array
577 */
578 function add_paging_promo_fields( $fields, $template ) {
579 if ( $template && array_key_exists( 'paging_support', $template ) && true === $template['paging_support'] ) {
580 $fields[] = array(
581 'id' => 'promo_paging',
582 'title' => __( 'PRO Expert Feature : Advanced Pagination', 'foogallery' ),
583 'desc' => __( 'Besides the dot pagination, you can also add more advanced pagination to your galleries with a large number of images or videos:', 'foogallery' ) .
584 '<ul class="ul-disc"><li><strong>' . __('Numbered' ,'foogallery') . '</strong> ' . __( 'adds a numbered pagination control to top or bottom of your gallery.', 'foogallery' ) .
585 '</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' ) .
586 '</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' ) .
587 '</li></ul>' . $this->build_promo_trial_html( 'pagination', __( 'PRO Expert', 'foogallery' ) ) . '<br /><br />',
588 'cta' => $this->build_cta_buttons( 'foogallery-pagination' ),
589 'section' => __( 'Paging', 'foogallery' ),
590 'type' => 'promo',
591 'row_data'=> array(
592 'data-foogallery-change-selector' => 'input',
593 'data-foogallery-preview' => 'shortcode',
594 'data-foogallery-hidden' => true,
595 'data-foogallery-show-when-field' => 'paging_type',
596 'data-foogallery-show-when-field-operator' => 'indexOf',
597 'data-foogallery-show-when-field-value' => 'promo',
598 )
599 );
600 }
601
602 return $fields;
603 }
604
605 /**
606 * Add the preset choices to the hover effect preset field
607 *
608 * @param $choices
609 *
610 * @return array
611 */
612 function add_promo_preset_choices( $choices ) {
613 return array_merge( $choices, array(
614 'fg-promo-sadie' => array(
615 'label' => __( 'Sadie', 'foogallery' ),
616 'class' => 'foogallery-promo',
617 'icon' => 'dashicons-star-filled'
618 ),
619 'fg-promo-layla' => array(
620 'label' => __( 'Layla', 'foogallery' ),
621 'class' => 'foogallery-promo',
622 'icon' => 'dashicons-star-filled'
623 ),
624 'fg-promo-oscar' => array(
625 'label' => __( 'Oscar', 'foogallery' ),
626 'class' => 'foogallery-promo',
627 'icon' => 'dashicons-star-filled'
628 ),
629 'fg-promo-sarah' => array(
630 'label' => __( 'Sarah', 'foogallery' ),
631 'class' => 'foogallery-promo',
632 'icon' => 'dashicons-star-filled'
633 ),
634 'fg-promo-goliath' => array(
635 'label' => __( 'Goliath', 'foogallery' ),
636 'class' => 'foogallery-promo',
637 'icon' => 'dashicons-star-filled'
638 ),
639 'fg-promo-jazz' => array(
640 'label' => __( 'Jazz', 'foogallery' ),
641 'class' => 'foogallery-promo',
642 'icon' => 'dashicons-star-filled'
643 ),
644 'fg-promo-lily' => array(
645 'label' => __( 'Lily', 'foogallery' ),
646 'class' => 'foogallery-promo',
647 'icon' => 'dashicons-star-filled'
648 ),
649 'fg-promo-ming' => array(
650 'label' => __( 'Ming', 'foogallery' ),
651 'class' => 'foogallery-promo',
652 'icon' => 'dashicons-star-filled'
653 ),
654 'fg-promo-selena' => array(
655 'label' => __( 'Selena', 'foogallery' ),
656 'class' => 'foogallery-promo',
657 'icon' => 'dashicons-star-filled'
658 ),
659 'fg-promo-steve' => array(
660 'label' => __( 'Steve', 'foogallery' ),
661 'class' => 'foogallery-promo',
662 'icon' => 'dashicons-star-filled'
663 ),
664 'fg-promo-zoe' => array(
665 'label' => __( 'Zoe', 'foogallery' ),
666 'class' => 'foogallery-promo',
667 'icon' => 'dashicons-star-filled'
668 ),
669 ) );
670 }
671
672 /**
673 * Add the fields for presets promos
674 *
675 * @uses "foogallery_override_gallery_template_fields"
676 * @param $fields
677 * @param $template
678 *
679 * @return array
680 */
681 function add_preset_promo_fields( $fields, $template ) {
682 //$index_of_hover_effect_preset_field = foogallery_admin_fields_find_index_of_field( $fields, 'hover_effect_preset' );
683
684 $fields[] = array(
685 'id' => 'hover_effect_preset_promo_help',
686 'title' => __( 'PRO Starter Feature : Hover Effect Presets', 'foogallery' ),
687 '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' ) .
688 '<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') .
689 '<br />' . __(' You really need to see all the different effects in action to appreciate them.', 'foogallery' ) . '<br /><br />' .
690 $this->build_promo_trial_html( 'hover-presets', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
691 'class' => 'foogallery_promo_prostarter',
692 'type' => 'promo',
693 'cta' => $this->build_cta_buttons( 'foogallery-hover-presets' ),
694 'section' => __( 'Hover Effects', 'foogallery' ),
695 'row_data' => array(
696 'data-foogallery-hidden' => true,
697 'data-foogallery-show-when-field' => 'hover_effect_preset',
698 'data-foogallery-show-when-field-operator' => '!==',
699 'data-foogallery-show-when-field-value' => 'fg-preset fg-brad',
700 )
701 );
702
703 //array_splice( $fields, $index_of_hover_effect_preset_field, 0, $new_fields );
704
705 return $fields;
706 }
707
708 /**
709 * Add EXIF fields to the gallery templates
710 *
711 * @uses "foogallery_override_gallery_template_fields"
712 *
713 * @param $fields
714 * @param $template
715 *
716 * @return array
717 */
718 function add_exif_promo_fields( $fields, $template ) {
719 $fields[] = array(
720 'id' => 'promo_exif',
721 'title' => __( 'PRO Expert Feature : EXIF Metadata', 'foogallery' ),
722 'section' => __( 'EXIF', 'foogallery' ),
723 'desc' => __( 'Show image metadata within your galleries. A must-have for professional photographers wanting to showcase specific metadata about each image.', 'foogallery' )
724 . '<br /><br />' . $this->build_promo_trial_html( 'filtering', __( 'PRO Expert', 'foogallery' ) ). '<br /><br />',
725 'cta' => $this->build_cta_buttons( 'foogallery-exif' ),
726 'type' => 'promo',
727 'row_data' => array(
728 'data-foogallery-change-selector' => 'input',
729 'data-foogallery-value-selector' => 'input:checked',
730 )
731 );
732
733 return $fields;
734 }
735
736 /**
737 * Add ImageGallery schema promo fields to the gallery templates.
738 *
739 * @uses "foogallery_override_gallery_template_fields"
740 *
741 * @param array $fields Gallery template fields.
742 * @param array $template Current gallery template.
743 *
744 * @return array
745 */
746 function add_imagegallery_schema_promo_fields( $fields, $template ) {
747 unset( $template );
748
749 $fields[] = array(
750 'id' => 'promo_imagegallery_schema',
751 'title' => __( 'PRO Expert Feature : ImageGallery Schema', 'foogallery' ),
752 'section' => __( 'SEO', 'foogallery' ),
753 'section_order' => 98,
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' => __( 'Filtering', 'foogallery' ),
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' => __( 'Colors', 'foogallery' ),
835 'section_order' => 5,
836 'desc' => __( 'Extract dominant colors and palettes from your gallery images, then use those colors to create more art-directed galleries:', 'foogallery' ) .
837 '<ul class="ul-disc"><li><strong>' . __( 'Color Extraction', 'foogallery' ) . '</strong> - ' . __( 'extract dominant color metadata and palettes for each gallery image.', 'foogallery' ) .
838 '</li><li><strong>' . __( 'Color Sorting', 'foogallery' ) . '</strong> - ' . __( 'sort galleries by hue, saturation, lightness, or an overall color index.', 'foogallery' ) .
839 '</li><li><strong>' . __( 'Item Backgrounds', 'foogallery' ) . '</strong> - ' . __( 'apply each item\'s dominant color as an opaque or theme-aware tinted background.', 'foogallery' ) .
840 '</li><li><strong>' . __( 'Attachment Color Editing', 'foogallery' ) . '</strong> - ' . __( 'review extracted color values and fine-tune attachment colors from the gallery editor.', 'foogallery' ) .
841 '</li></ul>' . $this->build_promo_trial_html( 'colors', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
842 'class' => 'foogallery_promo_prostarter',
843 'cta' => $this->build_cta_buttons( 'foogallery-colors' ),
844 'type' => 'promo',
845 'row_data' => array(
846 'data-foogallery-change-selector' => 'input',
847 'data-foogallery-preview' => 'shortcode',
848 'data-foogallery-value-selector' => 'input:checked',
849 )
850 );
851
852 return $fields;
853 }
854
855 /**
856 * Returns the Dashicon that can be used in starter settings tabs.
857 *
858 * @param string $section_slug Section slug.
859 *
860 * @return string
861 */
862 function add_starter_section_icons( $section_slug ) {
863 if ( 'colors' === $section_slug ) {
864 return 'dashicons-art';
865 }
866
867 return $section_slug;
868 }
869
870 /**
871 * Returns the Dashicon that can be used in the settings tabs
872 *
873 * @param $section_slug
874 *
875 * @return string
876 */
877 function add_expert_section_icons( $section_slug ) {
878 if ( 'filtering' === $section_slug ) {
879 return 'dashicons-filter';
880 }
881
882 if ( 'lightbox' === $section_slug ) {
883 return 'dashicons-grid-view';
884 }
885
886 if ( 'exif' === strtolower( $section_slug ) ) {
887 return 'dashicons-info-outline';
888 }
889
890 if ( 'seo' === $section_slug ) {
891 return 'dashicons-search';
892 }
893
894 return $section_slug;
895 }
896
897 /**
898 * Add fields to the gallery template
899 *
900 * @uses "foogallery_override_gallery_template_fields"
901 *
902 * @param $fields
903 * @param $template
904 *
905 * @return array
906 */
907 function add_appearance_promo_fields( $fields, $template ) {
908
909 $fields[] = array(
910 'id' => 'filter_promo',
911 'title' => __( 'PRO Starter Feature : Thumbnail Effects (Like Instagram!)', 'foogallery' ),
912 'section' => __( 'Appearance', 'foogallery' ),
913 'desc' => __( 'Apply an effect to your gallery thumbnails, just like you can in Instagram. Choose from 12 unique effects!', 'foogallery' )
914 . '<br /><br />' . $this->build_promo_trial_html( 'appearance', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
915 'type' => 'promo',
916 'class' => 'foogallery_promo_prostarter',
917 'cta' => $this->build_cta_buttons( 'foogallery-thumbnail-filters' )
918 );
919
920 return $fields;
921 }
922
923 /**
924 * Add fields to the gallery template
925 *
926 * @uses "foogallery_override_gallery_template_fields"
927 *
928 * @param $fields
929 * @param $template
930 *
931 * @return array
932 */
933 function add_video_promo_fields( $fields ) {
934
935 $fields[] = array(
936 'id' => 'video_promo',
937 'section' => __( 'Video', 'foogallery' ),
938 'title' => __( 'PRO Expert Feature : Video Galleries', 'foogallery' ),
939 'desc' => __( 'Take your galleries to the next level with full video support:', 'foogallery' ) .
940 '<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' ) .
941 '</li><li><strong>' . __( 'Youtube Video Search', 'foogallery' ) . '</strong> - ' . __( 'Search for Youtube videos, and then import them into your galleries in seconds.', 'foogallery' ) .
942 '</li><li><strong>' . __( 'Vimeo Search And Import', 'foogallery' ) . '</strong> - ' . __( 'Import albums, channels, users or individual videos from Vimeo.', 'foogallery' ) .
943 '</li><li><strong>' . __( 'Import From Other Sources', 'foogallery' ) . '</strong> - ' . __( 'Import from other popular video sources, including Facebook, Daily Motion, TED and others!', 'foogallery' ) .
944 '</li><li><strong>' . __( 'Self-Hosted Videos', 'foogallery' ) . '</strong> - ' . __( 'Host your own videos? No problem! Upload them, select thumbnails and use in your gallery.', 'foogallery' ) .
945 '</li></ul>' . $this->build_promo_trial_html( 'videos', __( 'PRO Expert', 'foogallery' ) ) . '<br /><br />',
946 'type' => 'promo',
947 'default' => 'fg-video-default',
948 'cta' => $this->build_cta_buttons( 'foogallery-videos' )
949 );
950
951 return $fields;
952 }
953
954 /**
955 * Add Social Addon promo fields to the gallery template.
956 *
957 * @uses "foogallery_override_gallery_template_fields"
958 *
959 * @param $fields
960 * @param $template
961 *
962 * @return array
963 */
964 function add_social_addon_promo_fields( $fields, $template ) {
965 if ( $this->is_social_addon_active() ) {
966 return $fields;
967 }
968
969 $fields[] = array(
970 'id' => 'social_addon_promo',
971 'section' => __( 'Social', 'foogallery' ),
972 'title' => __( 'Social Addon: Sharing, Likes, and Comments', 'foogallery' ),
973 'desc' => __( 'Add social engagement and sharing to your galleries:', 'foogallery' ) .
974 '<ul class="ul-disc"><li><strong>' . __( 'Lightbox Sharing', 'foogallery' ) . '</strong> - ' . __( 'Let visitors share gallery items to social networks from the built-in lightbox.', 'foogallery' ) .
975 '</li><li><strong>' . __( 'Likes', 'foogallery' ) . '</strong> - ' . __( 'Add like buttons on thumbnails, and sort gallery images by most liked.', 'foogallery' ) .
976 '</li><li><strong>' . __( 'Comments', 'foogallery' ) . '</strong> - ' . __( 'Let visitors comment on your gallery images, or reply to other comments.', 'foogallery' ) .
977 '</li></ul>' . __( 'Includes all the settings you need for customization, moderation or allowing anonymous comments / likes.', 'foogallery' ) . '<br /><br />',
978 'type' => 'promo',
979 'cta' => $this->build_social_addon_cta_buttons(),
980 );
981
982 return $fields;
983 }
984
985 private function build_social_addon_cta_buttons() {
986 return array(
987 array(
988 'text' => __( 'Learn More', 'foogallery' ),
989 'link' => $this->build_url( 'foogallery-social' ),
990 ),
991 array(
992 'text' => __( 'View Addons', 'foogallery' ),
993 'link' => foogallery_admin_addon_url(),
994 'class' => 'button-secondary',
995 ),
996 );
997 }
998
999 private function build_cta_buttons( $url_name ) {
1000 return array(
1001 array(
1002 'text' => __( 'View Demo', 'foogallery' ),
1003 'link' => $this->build_url( $url_name )
1004 ),
1005 array(
1006 'text' => __( 'Compare PRO Plans', 'foogallery' ),
1007 'link' => $this->build_url( 'foogallery-plans' ),
1008 'class' => 'button-secondary'
1009 )
1010 );
1011 }
1012
1013 /**
1014 * Add our promo gallery templates
1015 * @param $gallery_templates
1016 *
1017 * @return array
1018 */
1019 function add_promo_templates( $gallery_templates ) {
1020
1021 $gallery_templates[] = array(
1022 'slug' => 'polaroid_promo',
1023 'name' => __( 'Polaroid PRO', 'foogallery' ),
1024 'preview_support' => false,
1025 'common_fields_support' => false,
1026 'lazyload_support' => false,
1027 'paging_support' => false,
1028 'thumbnail_dimensions' => false,
1029 'filtering_support' => false,
1030 'class' => 'is-pro',
1031 'icon' => '<svg viewBox="0 0 24 24">
1032 <!-- top left -->
1033 <g transform="rotate(-5 7 5)">
1034 <rect x="2" y="2" width="8" height="5"/>
1035 <rect x="2" y="7" width="8" height="2"/>
1036 </g>
1037
1038 <!-- top right -->
1039 <g transform="rotate(4 17 5)">
1040 <rect x="13" y="3" width="8" height="5"/>
1041 <rect x="13" y="8" width="8" height="2"/>
1042 </g>
1043
1044 <!-- bottom left -->
1045 <g transform="rotate(3 7 15)">
1046 <rect x="3" y="12" width="8" height="5"/>
1047 <rect x="3" y="17" width="8" height="2"/>
1048 </g>
1049
1050 <!-- bottom right -->
1051 <g transform="rotate(-4 17 15)">
1052 <rect x="14" y="13" width="8" height="5"/>
1053 <rect x="14" y="18" width="8" height="2"/>
1054 </g>
1055 </svg>',
1056 'fields' => array(
1057 array(
1058 'id' => 'polaroid_promo',
1059 'title' => __( 'Polaroid PRO Gallery Layout', 'foogallery' ),
1060 'desc' => __( 'Available in all PRO plans, the Polaroid PRO gallery layout is a fun take on the simple portfolio gallery. Image thumbnails are framed as Polaroid photos which are staggered on the page.', 'foogallery' ) . '<br />' .
1061 '<img src="https://assets.fooplugins.com/foogallery/foogallery-polaroid-gallery.jpg" alt="' . esc_attr__( 'Polaroid PRO gallery layout preview', 'foogallery' ) . '" />' .
1062 '<br /><br />' . $this->build_promo_trial_html( 'polaroid', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
1063 'section' => __( 'General', 'foogallery' ),
1064 'type' => 'promo',
1065 'class' => 'foogallery_promo_prostarter',
1066 'keep_in_promo' => true,
1067 'cta' => $this->build_cta_buttons( 'foogallery-polaroid' )
1068 )
1069 )
1070 );
1071
1072 $gallery_templates[] = array(
1073 'slug' => 'grid_promo',
1074 'name' => __( 'Grid PRO', 'foogallery'),
1075 'preview_support' => false,
1076 'common_fields_support' => false,
1077 'lazyload_support' => false,
1078 'paging_support' => false,
1079 'thumbnail_dimensions' => false,
1080 'filtering_support' => false,
1081 'class' => 'is-pro',
1082 'icon' => '<svg viewBox="0 0 24 24">
1083 <!-- Top row (3 small) -->
1084 <rect x="3" y="3" width="6" height="5"/>
1085 <rect x="9" y="3" width="6" height="5"/>
1086 <rect x="15" y="3" width="6" height="5"/>
1087 <!-- Middle row (1 large) -->
1088 <rect x="3" y="8" width="18" height="8"/>
1089 <!-- Bottom row (3 small) -->
1090 <rect x="3" y="16" width="6" height="5"/>
1091 <rect x="9" y="16" width="6" height="5"/>
1092 <rect x="15" y="16" width="6" height="5"/>
1093 </svg>',
1094 'fields' => array(
1095 array(
1096 'id' => 'grid_promo',
1097 'title' => __( 'Grid PRO Gallery Layout', 'foogallery' ),
1098 '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 />' .
1099 '<img src="https://assets.fooplugins.com/foogallery/foogallery-grid-gallery.jpg" alt="' . esc_attr__( 'Grid PRO gallery layout preview', 'foogallery' ) . '" />' .
1100 '<br /><br />' . $this->build_promo_trial_html( 'grid', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
1101 'section' => __( 'General', 'foogallery' ),
1102 'type' => 'promo',
1103 'class' => 'foogallery_promo_prostarter',
1104 'keep_in_promo' => true,
1105 'cta' => $this->build_cta_buttons( 'foogallery-grid' )
1106 )
1107 )
1108 );
1109
1110 $gallery_templates[] = array(
1111 'slug' => 'slider_promo',
1112 'name' => __( 'Slider PRO', 'foogallery'),
1113 'preview_support' => false,
1114 'common_fields_support' => false,
1115 'lazyload_support' => false,
1116 'paging_support' => false,
1117 'thumbnail_dimensions' => false,
1118 'filtering_support' => false,
1119 'class' => 'is-pro',
1120 'icon' => '<svg viewBox="0 0 24 24">
1121 <!-- Left thumbs -->
1122 <rect x="3" y="4" width="6" height="5"/>
1123 <rect x="3" y="9" width="6" height="5"/>
1124 <rect x="3" y="14" width="6" height="5"/>
1125 <!-- Main image -->
1126 <rect x="9" y="4" width="12" height="15"/>
1127 </svg>',
1128 'fields' => array(
1129 array(
1130 'id' => 'slider_promo',
1131 'title' => __( 'Slider PRO Gallery Layout', 'foogallery' ),
1132 '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 />' .
1133 '<img src="https://assets.fooplugins.com/foogallery/foogallery-slider-gallery-vertical.jpg" alt="' . esc_attr__( 'Vertical Slider PRO gallery layout preview', 'foogallery' ) . '" /><br /><br />' .
1134 '<img src="https://assets.fooplugins.com/foogallery/foogallery-slider-gallery-horizontal.jpg" alt="' . esc_attr__( 'Horizontal Slider PRO gallery layout preview', 'foogallery' ) . '" /><br /><br />' .
1135 $this->build_promo_trial_html( 'slider', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
1136 'section' => __( 'General', 'foogallery' ),
1137 'type' => 'promo',
1138 'class' => 'foogallery_promo_prostarter',
1139 'keep_in_promo' => true,
1140 'cta' => $this->build_cta_buttons( 'foogallery-slider' )
1141 )
1142 )
1143 );
1144
1145 $gallery_templates[] = array(
1146 'slug' => 'spotlight_promo',
1147 'name' => __( 'Spotlight PRO', 'foogallery' ),
1148 'preview_support' => false,
1149 'common_fields_support' => false,
1150 'lazyload_support' => false,
1151 'paging_support' => false,
1152 'thumbnail_dimensions' => false,
1153 'filtering_support' => false,
1154 'class' => 'is-pro',
1155 'icon' => '<svg viewBox="0 0 24 24">
1156 <rect x="3" y="4" width="18" height="17"/>
1157 <polygon points="5,11 7,9 7,13" />
1158 <polygon points="19,11 17,9 17,13" />
1159 <circle cx="8" cy="17" r="0.8"/>
1160 <circle cx="12" cy="17" r="0.8"/>
1161 <circle cx="16" cy="17" r="0.8"/>
1162 </svg>',
1163 'fields' => array(
1164 array(
1165 'id' => 'spotlight_promo',
1166 'title' => __( 'Spotlight PRO Gallery Layout', 'foogallery' ),
1167 '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 />' .
1168 '<img src="https://assets.fooplugins.com/foogallery/foogallery-spotlight-gallery.png" alt="' . esc_attr__( 'Spotlight PRO gallery layout preview', 'foogallery' ) . '" /><br /><br />' .
1169 $this->build_promo_trial_html( 'spotlight', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
1170 'section' => __( 'General', 'foogallery' ),
1171 'type' => 'promo',
1172 'class' => 'foogallery_promo_prostarter',
1173 'keep_in_promo' => true,
1174 'cta' => $this->build_cta_buttons( 'foogallery-spotlight' )
1175 )
1176 )
1177 );
1178
1179 return $gallery_templates;
1180 }
1181
1182 /**
1183 * Remove fields from the promo template
1184 *
1185 * @uses "foogallery_override_gallery_template_fields-template"
1186 * @param $fields
1187 * @param $template
1188 *
1189 * @return array
1190 */
1191 function remove_all_fields_from_promo_gallery_template( $fields, $template ) {
1192 $remaining_fields = array();
1193
1194 //remove all fields that are not of type promo
1195 foreach ($fields as $field) {
1196 if ( array_key_exists( 'keep_in_promo', $field ) ) {
1197 $remaining_fields[] = $field;
1198 }
1199 }
1200
1201 return $remaining_fields;
1202 }
1203
1204 /**
1205 * Add Ecommerce fields to the gallery templates
1206 *
1207 * @uses "foogallery_override_gallery_template_fields"
1208 *
1209 * @param $fields
1210 * @param $template
1211 *
1212 * @return array
1213 */
1214 function add_ecommerce_promo_fields( $fields, $template ) {
1215 $new_fields[] = array(
1216 'id' => 'promo_ecommerce',
1217 'title' => __( 'PRO Commerce Feature : WooCommerce Integration', 'foogallery' ),
1218 'section' => __( 'Ecommerce', 'foogallery' ),
1219 'desc' => __( 'Start making money from selling your photographs, with our deep integration with WooCommerce:', 'foogallery' ) .
1220 '<ul class="ul-disc"><li><strong>' . __( 'Product Datasource', 'foogallery' ) . '</strong> - ' . __( 'Create a dynamic product gallery that updates when you add or change products.', 'foogallery' ) .
1221 '</li><li><strong>' . __( 'Filter By Product Categories', 'foogallery' ) . '</strong> - ' . __( 'Filter your gallery images by product category.', 'foogallery' ) .
1222 '</li><li><strong>' . __( 'Sale Ribbons', 'foogallery' ) . '</strong> - ' . __( 'Draw attention to products on sale, and show a cool ribbon over your product.', 'foogallery' ) .
1223 '</li><li><strong>' . __( 'Add To Cart Buttons', 'foogallery' ) . '</strong> - ' . __( 'Add buttons to your products to easily add to cart or view.', 'foogallery' ) .
1224 '</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' ) .
1225 '</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' ) .
1226 '</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' ) .
1227 '</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' ) .
1228 '</li></ul>' . $this->build_promo_trial_html( 'ecommerce', __( 'PRO Commerce', 'foogallery' ) ) . '<br /><br />',
1229 'cta' => $this->build_cta_buttons( 'foogallery-commerce' ),
1230 'class' => 'foogallery_promo_commerce',
1231 'type' => 'promo',
1232 'row_data' => array(
1233 'data-foogallery-change-selector' => 'input',
1234 'data-foogallery-value-selector' => 'input:checked',
1235 )
1236 );
1237
1238 // find the index of the advanced section.
1239 $index = foogallery_admin_fields_find_index_of_section( $fields, __( 'Advanced', 'foogallery' ) );
1240
1241 array_splice( $fields, $index, 0, $new_fields );
1242
1243 return $fields;
1244 }
1245
1246
1247 /**
1248 * Add Protection fields to the gallery templates
1249 *
1250 * @uses "foogallery_override_gallery_template_fields"
1251 *
1252 * @param $fields
1253 * @param $template
1254 *
1255 * @return array
1256 */
1257 function add_protection_promo_fields( $fields, $template ) {
1258 $new_fields[] = array(
1259 'id' => 'promo_protection',
1260 'title' => __( 'PRO Commerce Feature : Image Protection', 'foogallery' ),
1261 'section' => __( 'Protection', 'foogallery' ),
1262 'desc' => __( 'Protect your images from theft:', 'foogallery' ) .
1263 '<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' ) .
1264 '</li><li><strong>' . __( 'Watermark Generation', 'foogallery' ) . '</strong> - ' . __( 'Generate advanced watermarks for all images in your gallery.', 'foogallery' ) .
1265 '</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' ) .
1266 '</li></ul>' . $this->build_promo_trial_html( 'protection', __( 'PRO Commerce', 'foogallery' ) ) . '<br /><br />',
1267 'cta' => $this->build_cta_buttons( 'foogallery-protection' ),
1268 'class' => 'foogallery_promo_commerce',
1269 'type' => 'promo',
1270 'row_data' => array(
1271 'data-foogallery-change-selector' => 'input',
1272 'data-foogallery-value-selector' => 'input:checked',
1273 )
1274 );
1275
1276 // find the index of the advanced section.
1277 $index = foogallery_admin_fields_find_index_of_section( $fields, __( 'Advanced', 'foogallery' ) );
1278
1279 array_splice( $fields, $index, 0, $new_fields );
1280
1281 return $fields;
1282 }
1283
1284 /**
1285 * Add the commerce promotion datasources
1286 *
1287 * @param $datasources
1288 *
1289 * @return mixed
1290 */
1291 function add_commerce_promo_datasources( $datasources ) {
1292 $datasources['products_promo'] = array(
1293 'id' => 'products_promo',
1294 'name' => __( 'WooCommerce Products', 'foogallery' ),
1295 'menu' => __( 'WooCommerce Products', 'foogallery' ),
1296 'public' => true,
1297 );
1298
1299 return $datasources;
1300 }
1301
1302 /**
1303 * Output the server folders datasource modal content
1304 *
1305 * @param $foogallery_id
1306 */
1307 function render_datasource_modal_content_products_promo( $foogallery_id, $datasource_value ) {
1308 $this->render_datasource_modal_content(
1309 __( 'WooCommerce Product Datasource', 'foogallery' ),
1310 __( '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' ),
1311 'foogallery-product-gallery',
1312 __( 'PRO Commerce', 'foogallery' ),
1313 'foogallery_promo_commerce'
1314 );
1315 }
1316
1317 /**
1318 * Returns the Dashicon that can be used in the settings tabs
1319 *
1320 * @param $section_slug
1321 *
1322 * @return string
1323 */
1324 function add_commerce_section_icons( $section_slug ) {
1325 if ( 'ecommerce' === strtolower( $section_slug ) ) {
1326 return 'dashicons-cart';
1327 }
1328
1329 if ( 'protection' === strtolower( $section_slug ) ) {
1330 return 'dashicons-lock';
1331 }
1332
1333 return $section_slug;
1334 }
1335
1336 /**
1337 * Add our commerce promo gallery templates
1338 * @param $gallery_templates
1339 *
1340 * @return array
1341 */
1342 function add_commerce_promo_templates( $gallery_templates ) {
1343
1344 $gallery_templates[] = array(
1345 'slug' => 'product_promo',
1346 'name' => __( 'Product Gallery', 'foogallery' ),
1347 'preview_support' => false,
1348 'common_fields_support' => false,
1349 'lazyload_support' => false,
1350 'paging_support' => false,
1351 'thumbnail_dimensions' => false,
1352 'filtering_support' => false,
1353 'class' => 'is-pro commerce',
1354 'icon' => '<svg viewBox="0 0 24 24">
1355 <!-- cart basket -->
1356 <path d="M6 7h13l-2 7H8z"/>
1357
1358 <!-- handle flipped inward -->
1359 <path d="M6 7V4h-3"/>
1360
1361 <!-- wheels -->
1362 <circle cx="9" cy="18" r="1.5"/>
1363 <circle cx="16" cy="18" r="1.5"/>
1364 </svg>',
1365 'fields' => array(
1366 array(
1367 'id' => 'product_promo',
1368 'title' => __( 'Product Gallery Layout', 'foogallery' ),
1369 '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' ) .
1370 '<br />' . '<img src="https://assets.fooplugins.com/foogallery/foogallery-product-gallery.png" alt="' . esc_attr__( 'Product gallery layout preview', 'foogallery' ) . '" />' .
1371 '<br /><br />' . $this->build_promo_trial_html( 'product-gallery', __( 'PRO Commerce', 'foogallery' ) ) . '<br /><br />',
1372 'section' => __( 'General', 'foogallery' ),
1373 'type' => 'promo',
1374 'class' => 'foogallery_promo_commerce',
1375 'keep_in_promo' => true,
1376 'cta' => $this->build_cta_buttons( 'foogallery-product-gallery' )
1377 )
1378 )
1379 );
1380
1381 return $gallery_templates;
1382 }
1383 }
1384 }
1385