PluginProbe ʕ •ᴥ•ʔ
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel / trunk
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel vtrunk
trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / includes / admin / class-pro-promotion.php
foogallery / includes / admin Last commit date
class-admin-notice-custom-css.php 7 months ago class-admin-notices.php 7 months ago class-admin.php 7 months ago class-attachment-fields.php 7 months ago class-columns.php 7 months ago class-demo-content.php 7 months ago class-extensions.php 7 months ago class-gallery-attachment-modal.php 7 months ago class-gallery-datasources.php 7 months ago class-gallery-editor.php 7 months ago class-gallery-metabox-fields.php 7 months ago class-gallery-metabox-items.php 7 months ago class-gallery-metabox-settings-helper.php 7 months ago class-gallery-metabox-settings.php 7 months ago class-gallery-metabox-template.php 7 months ago class-gallery-metaboxes.php 7 months ago class-menu.php 7 months ago class-pro-promotion.php 7 months ago class-settings.php 7 months ago class-silent-installer-skin.php 7 months ago class-trial-mode.php 7 months ago demo-content-galleries.php 7 months ago demo-content-images.php 7 months ago index.php 11 years ago pro-features.php 7 months ago view-features.php 7 months ago view-help-demos.php 7 months ago view-help-getting-started.php 7 months ago view-help-pro.php 7 months ago view-help.php 7 months ago view-system-info.php 7 months ago
class-pro-promotion.php
1114 lines
1 <?php
2 /*
3 * FooGallery Pro Feature Promotion class
4 */
5
6 if ( ! class_exists( 'FooGallery_Pro_Promotion' ) ) {
7 class FooGallery_Pro_Promotion {
8
9 private $urls = array(
10 'foogallery-pagination' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/pagination/',
11 'foogallery-filtering' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/filtering/',
12 'foogallery-hover-presets' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/hover-presets/',
13 'foogallery-captions' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/custom-captions/',
14 'foogallery-lightbox' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/pro-lightbox/',
15 'foogallery-thumbnail-filters' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/filter-effects/',
16 'foogallery-loaded-effects' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/animated-loaded-effects/',
17 'foogallery-polaroid' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/polaroid-gallery/',
18 'foogallery-grid' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/grid-gallery/',
19 'foogallery-slider' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/slider-gallery/',
20 'foogallery-videos' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/video-gallery/',
21 'foogallery-exif' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/exif-data/',
22 'foogallery-bulk-copy' => 'https://fooplugins.com/bulk-copy-foogallery-pro/',
23 'foogallery-trial' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/start-trial/',
24 'foogallery-pricing' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/compare-plans/',
25 'foogallery-plans' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/compare-plans/#compare',
26 'foobox-pro' => 'https://fooplugins.com/foobox/',
27 'foogallery-datasources' => 'https://fooplugins.com/load-galleries-from-other-sources/',
28 'foogallery-commerce' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/woocommerce-integration/',
29 'foogallery-product-gallery' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/woocommerce-integration/#product-gallery',
30 'foogallery-protection' => 'https://fooplugins.com/foogallery-wordpress-gallery-plugin/photo-watermark/',
31 'foogallery-master' => 'https://fooplugins.com/documentation/foogallery/pro-commerce/use-master-gallery/',
32 'foogallery-import-export' => 'https://fooplugins.com/documentation/foogallery/getting-started-foogallery/import-export/',
33 'foogallery_whitelabeling' => 'https://fooplugins.com/documentation/foogallery/pro-commerce/white-labeling/'
34 );
35
36 function __construct() {
37 add_action( 'admin_init', array( $this, 'include_promos' ) );
38 }
39
40 /**
41 * conditionally include promos
42 */
43 function include_promos() {
44 global $foogallery_admin_datasource_instance;
45
46 add_filter( 'foogallery_admin_settings_override', array( $this, 'include_promo_settings' ) );
47
48 if ( $this->can_show_promo() ) {
49
50 // Determine current plan, and show promotions based on the current plan.
51 $fs_instance = foogallery_fs();
52 $current_plan = $fs_instance->get_plan_name();
53 $is_free = $fs_instance->is_free_plan();
54 $is_trial = $fs_instance->is_trial();
55
56 // If in trial mode, skip showing promotions
57 if ( $is_trial ) {
58 return;
59 }
60
61 $show_starter_promos = true;
62 $show_expert_promos = true;
63 $show_commerce_promos = true;
64
65 if ( !$is_free ) {
66 if ( FOOGALLERY_PRO_PLAN_STARTER === $current_plan ) {
67 $show_starter_promos = false;
68 } else if ( FOOGALLERY_PRO_PLAN_EXPERT == $current_plan ) {
69 $show_starter_promos = $show_expert_promos = false;
70 } else {
71 // Do not show any promos!
72 return;
73 }
74 }
75
76 if ( $show_starter_promos ) {
77 //PRO Starter Templates
78 add_filter( 'foogallery_gallery_templates', array( $this, 'add_promo_templates' ), 99, 1 );
79 add_filter( 'foogallery_override_gallery_template_fields-polaroid_promo', array( $this, 'remove_all_fields_from_promo_gallery_template' ), 999, 2 );
80 add_filter( 'foogallery_override_gallery_template_fields-grid_promo', array( $this, 'remove_all_fields_from_promo_gallery_template' ), 999, 2 );
81 add_filter( 'foogallery_override_gallery_template_fields-slider_promo', array( $this, 'remove_all_fields_from_promo_gallery_template' ), 999, 2 );
82
83 //presets
84 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_preset_promo_fields' ), 99, 2 );
85 add_filter( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_choices', array( $this, 'add_promo_preset_choices' ), 10, 1 );
86
87 //Instagram filters
88 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_appearance_promo_fields' ), 20, 2 );
89 }
90
91 if ( $show_expert_promos ) {
92 //Videos
93 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_video_promo_fields' ) );
94
95 //filtering
96 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_filtering_promo_fields' ), 10, 2 );
97
98 //paging
99 add_filter( 'foogallery_gallery_template_paging_type_choices', array( $this, 'add_promo_paging_choices' ) );
100 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_paging_promo_fields' ), 10, 2 );
101
102 //Datasource promos
103 add_action( 'foogallery_gallery_datasources', array( $this, 'add_expert_promo_datasources' ), 99 );
104 //add_action( 'foogallery_gallery_metabox_items_add', array( $this, 'add_datasources_css' ), 9 );
105 add_action( 'foogallery_admin_datasource_modal_content', array( $this, 'render_datasource_modal_content_default' ) );
106 add_action( 'foogallery-datasource-modal-content_folders_promo', array( $this, 'render_datasource_modal_content_folders_promo' ), 10, 3 );
107 add_action( 'foogallery-datasource-modal-content_media_tags_promo', array( $this, 'render_datasource_modal_content_taxonomy_promo' ), 10, 3 );
108 add_action( 'foogallery-datasource-modal-content_media_categories_promo', array( $this, 'render_datasource_modal_content_taxonomy_promo' ), 10, 3 );
109 add_action( 'foogallery-datasource-modal-content_lightroom_promo', array( $this, 'render_datasource_modal_content_lightroom_promo' ), 10, 3 );
110 add_action( 'foogallery-datasource-modal-content_rml_promo', array( $this, 'render_datasource_modal_content_rml_promo' ), 10, 3 );
111 add_action( 'foogallery-datasource-modal-content_post_query_promo', array( $this, 'render_datasource_modal_content_post_query_promo' ), 10, 3 );
112 remove_action( 'foogallery_admin_datasource_modal_content', array( $foogallery_admin_datasource_instance, 'render_datasource_modal_default_content' ) );
113
114 //Custom Captions
115 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_advanced_caption_fields' ), 100, 2 );
116
117 //EXIF
118 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_exif_promo_fields' ), 10, 2 );
119
120 //Bulk Copy Settings
121 add_action( 'add_meta_boxes_' . FOOGALLERY_CPT_GALLERY, array( $this, 'add_bulk_copy_meta_box_to_gallery' ) );
122
123 add_filter( 'foogallery_gallery_settings_metabox_section_icon', array( $this, 'add_expert_section_icons' ) );
124
125 //EXIF global settings (TODO)
126 }
127
128 if ( $show_commerce_promos ) {
129
130 add_filter( 'foogallery_gallery_settings_metabox_section_icon', array( $this, 'add_commerce_section_icons' ) );
131
132 //Ecommerce Settings
133 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_ecommerce_promo_fields' ), 90, 2 );
134
135 //Product Datasource
136 add_action( 'foogallery_gallery_datasources', array( $this, 'add_commerce_promo_datasources' ), 99 );
137 add_action( 'foogallery-datasource-modal-content_products_promo', array( $this, 'render_datasource_modal_content_products_promo' ), 10, 3 );
138
139 //Product Gallery Template
140 add_filter( 'foogallery_gallery_templates', array( $this, 'add_commerce_promo_templates' ), 999, 1 );
141 add_filter( 'foogallery_override_gallery_template_fields-product_promo', array( $this, 'remove_all_fields_from_promo_gallery_template' ), 999, 2 );
142
143 //Watermarking & Protection Settings
144 add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_protection_promo_fields' ), 80, 2 );
145
146 //Watermarking & Protection global settings (TODO)
147
148 //Ecommerce global settings (TODO)
149 }
150 }
151 }
152
153 /**
154 * Add a metabox to the gallery for bulk copying
155 * @param $post
156 */
157 function add_bulk_copy_meta_box_to_gallery($post) {
158 add_meta_box(
159 'foogallery_bulk_copy',
160 __( 'Bulk Copy', 'foogallery' ),
161 array( $this, 'render_gallery_bulk_copy_metabox' ),
162 FOOGALLERY_CPT_GALLERY,
163 'normal',
164 'low'
165 );
166 }
167
168 /**
169 * Render the bulk copy metabox on the gallery edit page
170 * @param $post
171 */
172 function render_gallery_bulk_copy_metabox( $post ) {
173 $this->render_datasource_modal_content(
174 __('Bulk Copy Settings', 'foogallery' ),
175 __('Copy settings from one gallery to other galleries in bulk. You can choose which settings, and what galleries to copy them to.', 'foogallery' ),
176 'foogallery-bulk-copy'
177 );
178 }
179
180 /**
181 * Add caption fields to the gallery template
182 *
183 * @param $fields
184 * @param $template
185 *
186 * @return array
187 */
188 function add_advanced_caption_fields( $fields, $template ) {
189
190 //add caption type field before other caption fields
191 $new_fields[] = array(
192 'id' => 'promo_captions_type',
193 'title' => __( 'Caption Type', 'foogallery' ),
194 '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' ),
195 'section' => __( 'Captions', 'foogallery' ),
196 'type' => 'radio',
197 'default' => '',
198 'choices' => array(
199 '' => __( 'Default', 'foogallery' ),
200 'custom' => array(
201 'label' => __( 'Custom', 'foogallery' ),
202 'tooltip' => __('Captions can be built up using custom HTML and placeholders', 'foogallery'),
203 'class' => 'foogallery-promo',
204 'icon' => 'dashicons-star-filled'
205 )
206 ),
207 'row_data' => array(
208 'data-foogallery-change-selector' => 'input:radio',
209 'data-foogallery-value-selector' => 'input:checked',
210 )
211 );
212
213 $new_fields[] = array(
214 'id' => 'promo_custom_captions',
215 'title' => __( 'PRO Expert Feature : Advanced Custom Captions', 'foogallery' ),
216 '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')
217 . '<br /><br />' . $this->build_promo_trial_html( 'pagination', __( 'PRO Expert', 'foogallery' ) ) . '<br /><br />',
218 'cta' => $this->build_cta_buttons( 'foogallery-captions' ),
219 'section' => __( 'Captions', 'foogallery' ),
220 'type' => 'promo',
221 'row_data'=> array(
222 'data-foogallery-change-selector' => 'input',
223 'data-foogallery-hidden' => true,
224 'data-foogallery-show-when-field' => 'promo_captions_type',
225 'data-foogallery-show-when-field-value' => 'custom',
226 )
227 );
228
229 $field_index = foogallery_admin_fields_find_index_of_field( $fields, 'caption_title_source' );
230
231 array_splice( $fields, $field_index, 0, $new_fields );
232
233 return $fields;
234 }
235
236 function add_datasources_css() {
237 ?>
238 <style>
239 .gallery_datasources_button {
240 color: #1d7b30 !important;
241 border-color: #1d7b30 !important;
242 background-color: #f7fff6 !important;
243 }
244 </style>
245 <?php
246 }
247
248 /**
249 * Output the default datasource modal content
250 *
251 * @param $foogallery_id
252 */
253 function render_datasource_modal_content_default() {
254 $this->render_datasource_modal_content(
255 __('Dynamic Galleries From Other Sources', 'foogallery' ),
256 __('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' )
257 );
258 }
259
260 /**
261 * Output the server folders datasource modal content
262 *
263 * @param $foogallery_id
264 */
265 function render_datasource_modal_content_folders_promo( $foogallery_id, $datasource_value ) {
266 $this->render_datasource_modal_content(
267 __('Server Folder Datasource', 'foogallery' ),
268 __('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' )
269 );
270 }
271
272 /**
273 * Output the tags datasource modal content
274 *
275 * @param $foogallery_id
276 */
277 function render_datasource_modal_content_taxonomy_promo( $foogallery_id, $datasource_value ) {
278 $this->render_datasource_modal_content(
279 __('Media Tags/Categories Datasource', 'foogallery' ),
280 __('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' )
281 );
282 }
283
284
285 /**
286 * Output the lightroom datasource modal content
287 *
288 * @param $foogallery_id
289 */
290 function render_datasource_modal_content_lightroom_promo( $foogallery_id, $datasource_value ) {
291 $this->render_datasource_modal_content(
292 __('Adobe Lightroom Datasource', 'foogallery' ),
293 __('We have integrated with the WP/LR Sync plugin to enable you to create galleries from a collection within Adobe Lightroom.', 'foogallery' )
294 );
295 }
296
297 /**
298 * Output the RML datasource modal content
299 *
300 * @param $foogallery_id
301 */
302 function render_datasource_modal_content_rml_promo( $foogallery_id, $datasource_value ) {
303 $this->render_datasource_modal_content(
304 __('Real Media Library Datasource', 'foogallery' ),
305 __('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' )
306 );
307 }
308
309 /**
310 * Output the Post Query datasource modal content
311 *
312 * @param $foogallery_id
313 */
314 function render_datasource_modal_content_post_query_promo( $foogallery_id, $datasource_value ) {
315 $this->render_datasource_modal_content(
316 __('Post Query Datasource', 'foogallery' ),
317 __('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' )
318 );
319 }
320
321 function render_datasource_modal_content( $datasouce_title, $datasource_desc,
322 $datasource_url_name = 'foogallery-datasources', $plan = null, $class = '' ) {
323 if ( !isset( $plan ) ) {
324 $plan = __('PRO Expert', 'foogallery');
325 }
326 ?>
327 <div class="foogallery_template_field_type-promo <?php echo esc_attr( $class ); ?>">
328 <div class="foogallery-promo">
329 <strong><?php echo esc_attr( $plan ); ?> <?php esc_html_e('Feature', 'foogallery' ); ?> : <?php echo esc_html( $datasouce_title ); ?></strong>
330 <br><br>
331 <?php echo esc_html( $datasource_desc ); ?>
332 <br><br>
333 <?php echo $this->build_promo_trial_html( 'datasources', $plan ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
334 <br><br>
335 <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>
336 <a class="button-secondary" href="<?php echo esc_url( $this->build_url( 'foogallery-plans' ) ); ?>" target="_blank"><?php echo esc_html__( 'Compare Plans', 'foogallery' ); ?></a>
337 </div>
338 </div>
339 <?php
340 }
341
342 /**
343 * Add the expert promotion datasources
344 *
345 * @param $datasources
346 *
347 * @return mixed
348 */
349 function add_expert_promo_datasources( $datasources ) {
350 $datasources['media_tags_promo'] = array(
351 'id' => 'media_tags_promo',
352 'name' => __( 'Media Tags', 'foogallery' ),
353 'menu' => __( 'Media Tags', 'foogallery' ),
354 'public' => true,
355 );
356
357 $datasources['media_categories_promo'] = array(
358 'id' => 'media_categories_promo',
359 'name' => __( 'Media Categories', 'foogallery' ),
360 'menu' => __( 'Media Categories', 'foogallery' ),
361 'public' => true,
362 );
363
364 $datasources['folders_promo'] = array(
365 'id' => 'folders_promo',
366 'name' => __( 'Server Folder', 'foogallery' ),
367 'menu' => __( 'Server Folder', 'foogallery' ),
368 'public' => true
369 );
370
371 $datasources['lightroom_promo'] = array(
372 'id' => 'lightroom_promo',
373 'name' => __( 'Adobe Lightroom', 'foogallery' ),
374 'menu' => __( 'Adobe Lightroom', 'foogallery' ),
375 'public' => true
376 );
377
378 $datasources['rml_promo'] = array(
379 'id' => 'rml_promo',
380 'name' => __( 'Real Media Library', 'foogallery' ),
381 'menu' => __( 'Real Media Library', 'foogallery' ),
382 'public' => true
383 );
384
385 $datasources['post_query_promo'] = array(
386 'id' => 'post_query_promo',
387 'name' => __( 'Post Query', 'foogallery' ),
388 'menu' => __( 'Post Query', 'foogallery' ),
389 'public' => true
390 );
391
392 return $datasources;
393 }
394
395 /**
396 * Builds up a URL that can be used for tracking
397 *
398 * @param $url_name
399 * @param $promotion
400 *
401 * @return string
402 */
403 private function build_url( $url_name, $promotion = '') {
404 if ( empty( $promotion ) ) {
405 $promotion = $url_name;
406 }
407
408 $promotion = str_replace( 'foogallery-', '', $promotion );
409
410 return foogallery_admin_url( $this->urls[ $url_name ], 'promos', $promotion );
411 }
412
413 /**
414 * Returns true if the promo areas can be shown
415 * @return bool
416 */
417 private function can_show_promo() {
418 return foogallery_get_setting( 'pro_promo_disabled' ) !== 'on';
419 }
420
421 /*
422 * Include promo settings
423 */
424 public function include_promo_settings( $settings ) {
425 $settings['settings'][] = array(
426 'id' => 'pro_promo_disabled',
427 'title' => __( 'Disable PRO Promotions', 'foogallery' ),
428 'desc' => __( 'Disable all premium upsell promotions throughout the WordPress admin.', 'foogallery' ),
429 'type' => 'checkbox',
430 'tab' => 'advanced'
431 );
432
433 return $settings;
434 }
435
436 /**
437 * Build up some trial and buy links shared for all promos
438 *
439 * @param $promotion
440 *
441 * @return string
442 */
443 private function build_promo_trial_html( $promotion, $plan = null ) {
444 if ( !isset( $plan ) ) {
445 $plan = __( 'PRO', 'foogallery' );
446 }
447 $trial_link = '<a href="' . $this->build_url('foogallery-trial', $promotion ) . '" target="_blank">' . __('start a 7 day free trial', 'foogallery') . '</a>';
448 $pro_link = '<a href="' . foogallery_admin_pricing_url() . '">' . __('Upgrade to', 'foogallery') . ' ' . $plan . '</a>';
449 return sprintf( __('To try the %s features, %s (no credit card required). Or you can %s right now.', 'foogallery' ), $plan, $trial_link, $pro_link );
450 }
451
452 /**
453 * Adds promo choices for paging
454 * @param $choices
455 *
456 * @return mixed
457 */
458 public function add_promo_paging_choices( $choices ) {
459 $choices['promo-page'] = array(
460 'label' => __( 'Numbered', 'foogallery' ),
461 'tooltip' => __('Add numbered pagination controls to your larger galleries.', 'foogallery'),
462 'class' => 'foogallery-promo',
463 'icon' => 'dashicons-star-filled'
464 );
465 $choices['promo-infin'] = array(
466 'label' => __( 'Infinite Scroll', 'foogallery' ),
467 'tooltip' => __('Add the popular infinite scroll ability to your larger galleries.', 'foogallery'),
468 'class' => 'foogallery-promo',
469 'icon' => 'dashicons-star-filled'
470 );
471 $choices['promo-load'] = array(
472 'label' => __( 'Load More', 'foogallery' ),
473 'tooltip' => __('Add a Load More button to the end of your larger galleries.', 'foogallery'),
474 'class' => 'foogallery-promo',
475 'icon' => 'dashicons-star-filled'
476 );
477 return $choices;
478 }
479
480 /**
481 * Add promo paging fields to the gallery template
482 *
483 * @uses "foogallery_override_gallery_template_fields"
484 * @param $fields
485 * @param $template
486 *
487 * @return array
488 */
489 function add_paging_promo_fields( $fields, $template ) {
490 if ( $template && array_key_exists( 'paging_support', $template ) && true === $template['paging_support'] ) {
491 $fields[] = array(
492 'id' => 'promo_paging',
493 'title' => __( 'PRO Expert Feature : Advanced Pagination', 'foogallery' ),
494 'desc' => __( 'Besides the dot pagination, you can also add more advanced pagination to your galleries with a large number of images or videos:', 'foogallery' ) .
495 '<ul class="ul-disc"><li><strong>' . __('Numbered' ,'foogallery') . '</strong> ' . __( 'adds a numbered pagination control to top or bottom of your gallery.', 'foogallery' ) .
496 '</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' ) .
497 '</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' ) .
498 '</li></ul>' . $this->build_promo_trial_html( 'pagination', __( 'PRO Expert', 'foogallery' ) ) . '<br /><br />',
499 'cta' => $this->build_cta_buttons( 'foogallery-pagination' ),
500 'section' => __( 'Paging', 'foogallery' ),
501 'type' => 'promo',
502 'row_data'=> array(
503 'data-foogallery-change-selector' => 'input',
504 'data-foogallery-preview' => 'shortcode',
505 'data-foogallery-hidden' => true,
506 'data-foogallery-show-when-field' => 'paging_type',
507 'data-foogallery-show-when-field-operator' => 'indexOf',
508 'data-foogallery-show-when-field-value' => 'promo',
509 )
510 );
511 }
512
513 return $fields;
514 }
515
516 /**
517 * Add the preset choices to the hover effect preset field
518 *
519 * @param $choices
520 *
521 * @return array
522 */
523 function add_promo_preset_choices( $choices ) {
524 return array_merge( $choices, array(
525 'fg-promo-sadie' => array(
526 'label' => __( 'Sadie', 'foogallery' ),
527 'class' => 'foogallery-promo',
528 'icon' => 'dashicons-star-filled'
529 ),
530 'fg-promo-layla' => array(
531 'label' => __( 'Layla', 'foogallery' ),
532 'class' => 'foogallery-promo',
533 'icon' => 'dashicons-star-filled'
534 ),
535 'fg-promo-oscar' => array(
536 'label' => __( 'Oscar', 'foogallery' ),
537 'class' => 'foogallery-promo',
538 'icon' => 'dashicons-star-filled'
539 ),
540 'fg-promo-sarah' => array(
541 'label' => __( 'Sarah', 'foogallery' ),
542 'class' => 'foogallery-promo',
543 'icon' => 'dashicons-star-filled'
544 ),
545 'fg-promo-goliath' => array(
546 'label' => __( 'Goliath', 'foogallery' ),
547 'class' => 'foogallery-promo',
548 'icon' => 'dashicons-star-filled'
549 ),
550 'fg-promo-jazz' => array(
551 'label' => __( 'Jazz', 'foogallery' ),
552 'class' => 'foogallery-promo',
553 'icon' => 'dashicons-star-filled'
554 ),
555 'fg-promo-lily' => array(
556 'label' => __( 'Lily', 'foogallery' ),
557 'class' => 'foogallery-promo',
558 'icon' => 'dashicons-star-filled'
559 ),
560 'fg-promo-ming' => array(
561 'label' => __( 'Ming', 'foogallery' ),
562 'class' => 'foogallery-promo',
563 'icon' => 'dashicons-star-filled'
564 ),
565 'fg-promo-selena' => array(
566 'label' => __( 'Selena', 'foogallery' ),
567 'class' => 'foogallery-promo',
568 'icon' => 'dashicons-star-filled'
569 ),
570 'fg-promo-steve' => array(
571 'label' => __( 'Steve', 'foogallery' ),
572 'class' => 'foogallery-promo',
573 'icon' => 'dashicons-star-filled'
574 ),
575 'fg-promo-zoe' => array(
576 'label' => __( 'Zoe', 'foogallery' ),
577 'class' => 'foogallery-promo',
578 'icon' => 'dashicons-star-filled'
579 ),
580 ) );
581 }
582
583 /**
584 * Add the fields for presets promos
585 *
586 * @uses "foogallery_override_gallery_template_fields"
587 * @param $fields
588 * @param $template
589 *
590 * @return array
591 */
592 function add_preset_promo_fields( $fields, $template ) {
593 //$index_of_hover_effect_preset_field = foogallery_admin_fields_find_index_of_field( $fields, 'hover_effect_preset' );
594
595 $fields[] = array(
596 'id' => 'hover_effect_preset_promo_help',
597 'title' => __( 'PRO Starter Feature : Hover Effect Presets', 'foogallery' ),
598 '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' ) .
599 '<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') .
600 '<br />' . __(' You really need to see all the different effects in action to appreciate them.', 'foogallery' ) . '<br /><br />' .
601 $this->build_promo_trial_html( 'hover-presets', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
602 'class' => 'foogallery_promo_prostarter',
603 'type' => 'promo',
604 'cta' => $this->build_cta_buttons( 'foogallery-hover-presets' ),
605 'section' => __( 'Hover Effects', 'foogallery' ),
606 'row_data' => array(
607 'data-foogallery-hidden' => true,
608 'data-foogallery-show-when-field' => 'hover_effect_preset',
609 'data-foogallery-show-when-field-operator' => '!==',
610 'data-foogallery-show-when-field-value' => 'fg-preset fg-brad',
611 )
612 );
613
614 //array_splice( $fields, $index_of_hover_effect_preset_field, 0, $new_fields );
615
616 return $fields;
617 }
618
619 /**
620 * Add EXIF fields to the gallery templates
621 *
622 * @uses "foogallery_override_gallery_template_fields"
623 *
624 * @param $fields
625 * @param $template
626 *
627 * @return array
628 */
629 function add_exif_promo_fields( $fields, $template ) {
630 $fields[] = array(
631 'id' => 'promo_exif',
632 'title' => __( 'PRO Expert Feature : EXIF Metadata', 'foogallery' ),
633 'section' => __( 'EXIF', 'foogallery' ),
634 'desc' => __( 'Show image metadata within your galleries. A must-have for professional photographers wanting to showcase specific metadata about each image.', 'foogallery' )
635 . '<br /><br />' . $this->build_promo_trial_html( 'filtering', __( 'PRO Expert', 'foogallery' ) ). '<br /><br />',
636 'cta' => $this->build_cta_buttons( 'foogallery-exif' ),
637 'type' => 'promo',
638 'row_data' => array(
639 'data-foogallery-change-selector' => 'input',
640 'data-foogallery-value-selector' => 'input:checked',
641 )
642 );
643
644 return $fields;
645 }
646
647 /**
648 * Add filtering fields to the gallery templates
649 *
650 * @uses "foogallery_override_gallery_template_fields"
651 *
652 * @param $fields
653 * @param $template
654 *
655 * @return array
656 */
657 function add_filtering_promo_fields( $fields, $template ) {
658 if ( $template && array_key_exists( 'filtering_support', $template ) && true === $template['filtering_support'] ) {
659 $fields[] = array(
660 'id' => 'promo_filtering',
661 'title' => __( 'PRO Expert Feature : Filtering by Tags or Categories', 'foogallery' ),
662 'section' => __( 'Filtering', 'foogallery' ),
663 'desc' => __( 'Add frontend filtering to your gallery, simply by assigning media tags or media categories to your gallery attachments. Other filtering features include:', 'foogallery' ) .
664 '<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' ) .
665 '</li><li><strong>' . __('Look &amp; Feel' ,'foogallery') . '</strong> - ' . __( 'display the filters above or below the gallery, and choose a color theme.', 'foogallery' ) .
666 '</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' ) .
667 '</li><li><strong>' . __('Show Counters' ,'foogallery') . '</strong> - ' . __( 'show the number of items in each tag filter.', 'foogallery' ) .
668 '</li><li><strong>' . __('Adjust Size & Opacity' ,'foogallery') . '</strong> - ' . __( 'adjust the size and opacity of each filter based on the number of items.', 'foogallery' ) .
669 '</li></ul>' . $this->build_promo_trial_html( 'filtering', __( 'PRO Expert', 'foogallery' ) ). '<br /><br />',
670 'cta' => $this->build_cta_buttons( 'foogallery-filtering' ),
671 'type' => 'promo',
672 'row_data' => array(
673 'data-foogallery-change-selector' => 'input',
674 'data-foogallery-preview' => 'shortcode',
675 'data-foogallery-value-selector' => 'input:checked',
676 )
677 );
678 }
679
680 return $fields;
681 }
682
683 /**
684 * Returns the Dashicon that can be used in the settings tabs
685 *
686 * @param $section_slug
687 *
688 * @return string
689 */
690 function add_expert_section_icons( $section_slug ) {
691 if ( 'filtering' === $section_slug ) {
692 return 'dashicons-filter';
693 }
694
695 if ( 'lightbox' === $section_slug ) {
696 return 'dashicons-grid-view';
697 }
698
699 if ( 'exif' === strtolower( $section_slug ) ) {
700 return 'dashicons-info-outline';
701 }
702
703 return $section_slug;
704 }
705
706 /**
707 * Add fields to the gallery template
708 *
709 * @uses "foogallery_override_gallery_template_fields"
710 *
711 * @param $fields
712 * @param $template
713 *
714 * @return array
715 */
716 function add_appearance_promo_fields( $fields, $template ) {
717
718 $fields[] = array(
719 'id' => 'filter_promo',
720 'title' => __( 'PRO Starter Feature : Thumbnail Filters (Like Instagram!)', 'foogallery' ),
721 'section' => __( 'Appearance', 'foogallery' ),
722 'desc' => __( 'Apply a filter to your gallery thumbnails, just like you can in Instagram. Choose from 12 unique filters!', 'foogallery' )
723 . '<br /><br />' . $this->build_promo_trial_html( 'appearance', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
724 'type' => 'promo',
725 'class' => 'foogallery_promo_prostarter',
726 'cta' => $this->build_cta_buttons( 'foogallery-thumbnail-filters' )
727 );
728
729 return $fields;
730 }
731
732 /**
733 * Add fields to the gallery template
734 *
735 * @uses "foogallery_override_gallery_template_fields"
736 *
737 * @param $fields
738 * @param $template
739 *
740 * @return array
741 */
742 function add_video_promo_fields( $fields ) {
743
744 $fields[] = array(
745 'id' => 'video_promo',
746 'section' => __( 'Video', 'foogallery' ),
747 'title' => __( 'PRO Expert Feature : Video Galleries', 'foogallery' ),
748 'desc' => __( 'Take your galleries to the next level with full video support:', 'foogallery' ) .
749 '<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' ) .
750 '</li><li><strong>' . __( 'Youtube Video Search', 'foogallery' ) . '</strong> - ' . __( 'Search for Youtube videos, and then import them into your galleries in seconds.', 'foogallery' ) .
751 '</li><li><strong>' . __( 'Vimeo Search And Import', 'foogallery' ) . '</strong> - ' . __( 'Import albums, channels, users or individual videos from Vimeo.', 'foogallery' ) .
752 '</li><li><strong>' . __( 'Import From Other Sources', 'foogallery' ) . '</strong> - ' . __( 'Import from other popular video sources, including Facebook, Daily Motion, TED and others!', 'foogallery' ) .
753 '</li><li><strong>' . __( 'Self-Hosted Videos', 'foogallery' ) . '</strong> - ' . __( 'Host your own videos? No problem! Upload them, select thumbnails and use in your gallery.', 'foogallery' ) .
754 '</li></ul>' . $this->build_promo_trial_html( 'videos', __( 'PRO Expert', 'foogallery' ) ) . '<br /><br />',
755 'type' => 'promo',
756 'default' => 'fg-video-default',
757 'cta' => $this->build_cta_buttons( 'foogallery-videos' )
758 );
759
760 return $fields;
761 }
762
763 private function build_cta_buttons( $url_name ) {
764 return array(
765 array(
766 'text' => __( 'View Demo', 'foogallery' ),
767 'link' => $this->build_url( $url_name )
768 ),
769 array(
770 'text' => __( 'Compare PRO Plans', 'foogallery' ),
771 'link' => $this->build_url( 'foogallery-plans' ),
772 'class' => 'button-secondary'
773 )
774 );
775 }
776
777 /**
778 * Add our promo gallery templates
779 * @param $gallery_templates
780 *
781 * @return array
782 */
783 function add_promo_templates( $gallery_templates ) {
784
785 $gallery_templates[] = array(
786 'slug' => 'polaroid_promo',
787 'name' => __( 'Polaroid PRO', 'foogallery' ),
788 'preview_support' => false,
789 'common_fields_support' => false,
790 'lazyload_support' => false,
791 'paging_support' => false,
792 'thumbnail_dimensions' => false,
793 'filtering_support' => false,
794 'class' => 'is-pro',
795 'icon' => '<svg viewBox="0 0 24 24">
796 <!-- top left -->
797 <g transform="rotate(-5 7 5)">
798 <rect x="2" y="2" width="8" height="5"/>
799 <rect x="2" y="7" width="8" height="2"/>
800 </g>
801
802 <!-- top right -->
803 <g transform="rotate(4 17 5)">
804 <rect x="13" y="3" width="8" height="5"/>
805 <rect x="13" y="8" width="8" height="2"/>
806 </g>
807
808 <!-- bottom left -->
809 <g transform="rotate(3 7 15)">
810 <rect x="3" y="12" width="8" height="5"/>
811 <rect x="3" y="17" width="8" height="2"/>
812 </g>
813
814 <!-- bottom right -->
815 <g transform="rotate(-4 17 15)">
816 <rect x="14" y="13" width="8" height="5"/>
817 <rect x="14" y="18" width="8" height="2"/>
818 </g>
819 </svg>',
820 'fields' => array(
821 array(
822 'id' => 'polaroid_promo',
823 'title' => __( 'Polaroid PRO Gallery Layout', 'foogallery' ),
824 '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 />' .
825 '<img src="https://assets.fooplugins.com/foogallery/foogallery-polaroid-gallery.jpg" />' .
826 '<br /><br />' . $this->build_promo_trial_html( 'polaroid', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
827 'section' => __( 'General', 'foogallery' ),
828 'type' => 'promo',
829 'class' => 'foogallery_promo_prostarter',
830 'keep_in_promo' => true,
831 'cta' => $this->build_cta_buttons( 'foogallery-polaroid' )
832 )
833 )
834 );
835
836 $gallery_templates[] = array(
837 'slug' => 'grid_promo',
838 'name' => __( 'Grid PRO', 'foogallery'),
839 'preview_support' => false,
840 'common_fields_support' => false,
841 'lazyload_support' => false,
842 'paging_support' => false,
843 'thumbnail_dimensions' => false,
844 'filtering_support' => false,
845 'class' => 'is-pro',
846 'icon' => '<svg viewBox="0 0 24 24">
847 <!-- Top row (3 small) -->
848 <rect x="3" y="3" width="6" height="5"/>
849 <rect x="9" y="3" width="6" height="5"/>
850 <rect x="15" y="3" width="6" height="5"/>
851 <!-- Middle row (1 large) -->
852 <rect x="3" y="8" width="18" height="8"/>
853 <!-- Bottom row (3 small) -->
854 <rect x="3" y="16" width="6" height="5"/>
855 <rect x="9" y="16" width="6" height="5"/>
856 <rect x="15" y="16" width="6" height="5"/>
857 </svg>',
858 'fields' => array(
859 array(
860 'id' => 'grid_promo',
861 'title' => __( 'Grid PRO Gallery Layout', 'foogallery' ),
862 '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 />' .
863 '<img src="https://assets.fooplugins.com/foogallery/foogallery-grid-gallery.jpg" />' .
864 '<br /><br />' . $this->build_promo_trial_html( 'grid', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
865 'section' => __( 'General', 'foogallery' ),
866 'type' => 'promo',
867 'class' => 'foogallery_promo_prostarter',
868 'keep_in_promo' => true,
869 'cta' => $this->build_cta_buttons( 'foogallery-grid' )
870 )
871 )
872 );
873
874 $gallery_templates[] = array(
875 'slug' => 'slider_promo',
876 'name' => __( 'Slider PRO', 'foogallery'),
877 'preview_support' => false,
878 'common_fields_support' => false,
879 'lazyload_support' => false,
880 'paging_support' => false,
881 'thumbnail_dimensions' => false,
882 'filtering_support' => false,
883 'class' => 'is-pro',
884 'icon' => '<svg viewBox="0 0 24 24">
885 <!-- Left thumbs -->
886 <rect x="3" y="4" width="6" height="5"/>
887 <rect x="3" y="9" width="6" height="5"/>
888 <rect x="3" y="14" width="6" height="5"/>
889 <!-- Main image -->
890 <rect x="9" y="4" width="12" height="15"/>
891 </svg>',
892 'fields' => array(
893 array(
894 'id' => 'slider_promo',
895 'title' => __( 'Slider PRO Gallery Layout', 'foogallery' ),
896 '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 />' .
897 '<img src="https://assets.fooplugins.com/foogallery/foogallery-slider-gallery-vertical.jpg" /><br /><br />' .
898 '<img src="https://assets.fooplugins.com/foogallery/foogallery-slider-gallery-horizontal.jpg" /><br /><br />' .
899 $this->build_promo_trial_html( 'slider', __( 'PRO Starter', 'foogallery' ) ) . '<br /><br />',
900 'section' => __( 'General', 'foogallery' ),
901 'type' => 'promo',
902 'class' => 'foogallery_promo_prostarter',
903 'keep_in_promo' => true,
904 'cta' => $this->build_cta_buttons( 'foogallery-slider' )
905 )
906 )
907 );
908
909 return $gallery_templates;
910 }
911
912 /**
913 * Remove fields from the promo template
914 *
915 * @uses "foogallery_override_gallery_template_fields-template"
916 * @param $fields
917 * @param $template
918 *
919 * @return array
920 */
921 function remove_all_fields_from_promo_gallery_template( $fields, $template ) {
922 $remaining_fields = array();
923
924 //remove all fields that are not of type promo
925 foreach ($fields as $field) {
926 if ( array_key_exists( 'keep_in_promo', $field ) ) {
927 $remaining_fields[] = $field;
928 }
929 }
930
931 return $remaining_fields;
932 }
933
934 /**
935 * Add Ecommerce fields to the gallery templates
936 *
937 * @uses "foogallery_override_gallery_template_fields"
938 *
939 * @param $fields
940 * @param $template
941 *
942 * @return array
943 */
944 function add_ecommerce_promo_fields( $fields, $template ) {
945 $new_fields[] = array(
946 'id' => 'promo_ecommerce',
947 'title' => __( 'PRO Commerce Feature : WooCommerce Integration', 'foogallery' ),
948 'section' => __( 'Ecommerce', 'foogallery' ),
949 'desc' => __( 'Start making money from selling your photographs, with our deep integration with WooCommerce:', 'foogallery' ) .
950 '<ul class="ul-disc"><li><strong>' . __( 'Product Datasource', 'foogallery' ) . '</strong> - ' . __( 'Create a dynamic product gallery that updates when you add or change products.', 'foogallery' ) .
951 '</li><li><strong>' . __( 'Filter By Product Categories', 'foogallery' ) . '</strong> - ' . __( 'Filter your gallery images by product category.', 'foogallery' ) .
952 '</li><li><strong>' . __( 'Sale Ribbons', 'foogallery' ) . '</strong> - ' . __( 'Draw attention to products on sale, and show a cool ribbon over your product.', 'foogallery' ) .
953 '</li><li><strong>' . __( 'Add To Cart Buttons', 'foogallery' ) . '</strong> - ' . __( 'Add buttons to your products to easily add to cart or view.', 'foogallery' ) .
954 '</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' ) .
955 '</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' ) .
956 '</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' ) .
957 '</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' ) .
958 '</li></ul>' . $this->build_promo_trial_html( 'ecommerce', __( 'PRO Commerce', 'foogallery' ) ) . '<br /><br />',
959 'cta' => $this->build_cta_buttons( 'foogallery-commerce' ),
960 'class' => 'foogallery_promo_commerce',
961 'type' => 'promo',
962 'row_data' => array(
963 'data-foogallery-change-selector' => 'input',
964 'data-foogallery-value-selector' => 'input:checked',
965 )
966 );
967
968 // find the index of the advanced section.
969 $index = foogallery_admin_fields_find_index_of_section( $fields, __( 'Advanced', 'foogallery' ) );
970
971 array_splice( $fields, $index, 0, $new_fields );
972
973 return $fields;
974 }
975
976
977 /**
978 * Add Protection fields to the gallery templates
979 *
980 * @uses "foogallery_override_gallery_template_fields"
981 *
982 * @param $fields
983 * @param $template
984 *
985 * @return array
986 */
987 function add_protection_promo_fields( $fields, $template ) {
988 $new_fields[] = array(
989 'id' => 'promo_protection',
990 'title' => __( 'PRO Commerce Feature : Image Protection', 'foogallery' ),
991 'section' => __( 'Protection', 'foogallery' ),
992 'desc' => __( 'Protect your images from theft:', 'foogallery' ) .
993 '<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' ) .
994 '</li><li><strong>' . __( 'Watermark Generation', 'foogallery' ) . '</strong> - ' . __( 'Generate advanced watermarks for all images in your gallery.', 'foogallery' ) .
995 '</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' ) .
996 '</li></ul>' . $this->build_promo_trial_html( 'protection', __( 'PRO Commerce', 'foogallery' ) ) . '<br /><br />',
997 'cta' => $this->build_cta_buttons( 'foogallery-protection' ),
998 'class' => 'foogallery_promo_commerce',
999 'type' => 'promo',
1000 'row_data' => array(
1001 'data-foogallery-change-selector' => 'input',
1002 'data-foogallery-value-selector' => 'input:checked',
1003 )
1004 );
1005
1006 // find the index of the advanced section.
1007 $index = foogallery_admin_fields_find_index_of_section( $fields, __( 'Advanced', 'foogallery' ) );
1008
1009 array_splice( $fields, $index, 0, $new_fields );
1010
1011 return $fields;
1012 }
1013
1014 /**
1015 * Add the commerce promotion datasources
1016 *
1017 * @param $datasources
1018 *
1019 * @return mixed
1020 */
1021 function add_commerce_promo_datasources( $datasources ) {
1022 $datasources['products_promo'] = array(
1023 'id' => 'products_promo',
1024 'name' => __( 'WooCommerce Products', 'foogallery' ),
1025 'menu' => __( 'WooCommerce Products', 'foogallery' ),
1026 'public' => true,
1027 );
1028
1029 return $datasources;
1030 }
1031
1032 /**
1033 * Output the server folders datasource modal content
1034 *
1035 * @param $foogallery_id
1036 */
1037 function render_datasource_modal_content_products_promo( $foogallery_id, $datasource_value ) {
1038 $this->render_datasource_modal_content(
1039 __( 'WooCommerce Product Datasource', 'foogallery' ),
1040 __( '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' ),
1041 'foogallery-product-gallery',
1042 __( 'PRO Commerce', 'foogallery' ),
1043 'foogallery_promo_commerce'
1044 );
1045 }
1046
1047 /**
1048 * Returns the Dashicon that can be used in the settings tabs
1049 *
1050 * @param $section_slug
1051 *
1052 * @return string
1053 */
1054 function add_commerce_section_icons( $section_slug ) {
1055 if ( 'ecommerce' === strtolower( $section_slug ) ) {
1056 return 'dashicons-cart';
1057 }
1058
1059 if ( 'protection' === strtolower( $section_slug ) ) {
1060 return 'dashicons-lock';
1061 }
1062
1063 return $section_slug;
1064 }
1065
1066 /**
1067 * Add our commerce promo gallery templates
1068 * @param $gallery_templates
1069 *
1070 * @return array
1071 */
1072 function add_commerce_promo_templates( $gallery_templates ) {
1073
1074 $gallery_templates[] = array(
1075 'slug' => 'product_promo',
1076 'name' => __( 'Product Gallery', 'foogallery' ),
1077 'preview_support' => false,
1078 'common_fields_support' => false,
1079 'lazyload_support' => false,
1080 'paging_support' => false,
1081 'thumbnail_dimensions' => false,
1082 'filtering_support' => false,
1083 'class' => 'is-pro commerce',
1084 'icon' => '<svg viewBox="0 0 24 24">
1085 <!-- cart basket -->
1086 <path d="M6 7h13l-2 7H8z"/>
1087
1088 <!-- handle flipped inward -->
1089 <path d="M6 7V4h-3"/>
1090
1091 <!-- wheels -->
1092 <circle cx="9" cy="18" r="1.5"/>
1093 <circle cx="16" cy="18" r="1.5"/>
1094 </svg>',
1095 'fields' => array(
1096 array(
1097 'id' => 'product_promo',
1098 'title' => __( 'Product Gallery Layout', 'foogallery' ),
1099 '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' ) .
1100 '<br />' . '<img src="https://assets.fooplugins.com/foogallery/foogallery-product-gallery.png" />' .
1101 '<br /><br />' . $this->build_promo_trial_html( 'product-gallery', __( 'PRO Commerce', 'foogallery' ) ) . '<br /><br />',
1102 'section' => __( 'General', 'foogallery' ),
1103 'type' => 'promo',
1104 'class' => 'foogallery_promo_commerce',
1105 'keep_in_promo' => true,
1106 'cta' => $this->build_cta_buttons( 'foogallery-product-gallery' )
1107 )
1108 )
1109 );
1110
1111 return $gallery_templates;
1112 }
1113 }
1114 }