PluginProbe ʕ •ᴥ•ʔ
Responsive Lightbox & Gallery / trunk
Responsive Lightbox & Gallery vtrunk
2.7.8 trunk 1.0.0 1.0.1 1.0.1.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4.0 1.4.0.1 1.4.1 1.4.11 1.4.12 1.4.13 1.4.14 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3.1 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7
responsive-lightbox / includes / settings / class-settings-builder.php
responsive-lightbox / includes / settings Last commit date
class-settings-addons.php 4 months ago class-settings-base.php 5 months ago class-settings-builder.php 5 months ago class-settings-capabilities.php 5 months ago class-settings-folders.php 4 months ago class-settings-galleries.php 5 months ago class-settings-general.php 5 months ago class-settings-licenses.php 4 months ago class-settings-lightboxes.php 4 months ago class-settings-remote-library.php 5 months ago
class-settings-builder.php
134 lines
1 <?php
2 /**
3 * Responsive Lightbox Builder Settings
4 *
5 * @package Responsive_Lightbox
6 */
7
8 // exit if accessed directly
9 if ( ! defined( 'ABSPATH' ) )
10 exit;
11
12 /**
13 * Responsive Lightbox Builder Settings class.
14 *
15 * @class Responsive_Lightbox_Settings_Builder
16 */
17 class Responsive_Lightbox_Settings_Builder extends Responsive_Lightbox_Settings_Base {
18
19 /**
20 * Tab key identifier.
21 *
22 * @var string
23 */
24 const TAB_KEY = 'builder';
25
26 /**
27 * Validate settings for Builder tab.
28 *
29 * Handles field sanitization including permalink sanitization.
30 *
31 * @param array $input Input data from form submission.
32 * @return array Validated data.
33 */
34 public function validate( $input ) {
35 // check if this is a reset operation
36 if ( $this->is_reset_request() ) {
37 $input = $this->merge_with_defaults( [] );
38 add_settings_error( 'reset_rl_builder', 'settings_restored', esc_html__( 'Settings restored to defaults.', 'responsive-lightbox' ), 'updated' );
39 return $input;
40 }
41
42 // sanitize all fields (includes permalink sanitization via sanitize_field)
43 $input = $this->sanitize_fields( $input, 'builder' );
44
45 return $input;
46 }
47
48 /**
49 * Provide settings data for this tab.
50 *
51 * @param array $data Settings data.
52 * @return array
53 */
54 public function settings_data( $data ) {
55 // get main instance
56 $rl = Responsive_Lightbox();
57
58 // build archives category options
59 $archives_category_options = [
60 'all' => __( 'All', 'responsive-lightbox' )
61 ];
62
63 // add categories if gallery builder, categories, and archives are enabled
64 if ( $rl->options['builder']['gallery_builder'] && $rl->options['builder']['categories'] && $rl->options['builder']['archives'] ) {
65 $terms = get_terms( [ 'taxonomy' => 'rl_category', 'hide_empty' => false ] );
66
67 if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
68 foreach ( $terms as $term ) {
69 $archives_category_options[$term->slug] = $term->name;
70 }
71 }
72 }
73
74 $data[self::TAB_KEY] = [
75 'option_name' => 'responsive_lightbox_builder',
76 'option_group' => 'responsive_lightbox_builder',
77 'validate' => [ $this, 'validate' ],
78 'sections' => [
79 'responsive_lightbox_builder' => [
80 'title' => __( 'Gallery Builder Settings', 'responsive-lightbox' ),
81 'description' => '',
82 'fields' => [
83 'gallery_builder' => [
84 'title' => __( 'Gallery Builder', 'responsive-lightbox' ),
85 'type' => 'boolean',
86 'label' => __( 'Enable advanced gallery builder.', 'responsive-lightbox' )
87 ],
88 'categories' => [
89 'title' => __( 'Categories', 'responsive-lightbox' ),
90 'type' => 'boolean',
91 'label' => __( 'Enable Gallery Categories.', 'responsive-lightbox' ),
92 'description' => __( 'Enable if you want to use Gallery Categories.', 'responsive-lightbox' )
93 ],
94 'tags' => [
95 'title' => __( 'Tags', 'responsive-lightbox' ),
96 'type' => 'boolean',
97 'label' => __( 'Enable Gallery Tags.', 'responsive-lightbox' ),
98 'description' => __( 'Enable if you want to use Gallery Tags.', 'responsive-lightbox' )
99 ],
100 'permalink' => [
101 'title' => __( 'Gallery Permalink', 'responsive-lightbox' ),
102 'type' => 'text',
103 'description' => '<code>' . site_url() . '/<strong>' . untrailingslashit( esc_html( $rl->options['builder']['permalink'] ) ) . '</strong>/</code><br />' . esc_html__( 'Enter gallery page slug.', 'responsive-lightbox' )
104 ],
105 'permalink_categories' => [
106 'title' => __( 'Categories Permalink', 'responsive-lightbox' ),
107 'type' => 'text',
108 'description' => '<code>' . site_url() . '/<strong>' . untrailingslashit( esc_html( $rl->options['builder']['permalink_categories'] ) ) . '</strong>/</code><br />' . esc_html__( 'Enter gallery categories archive page slug.', 'responsive-lightbox' )
109 ],
110 'permalink_tags' => [
111 'title' => __( 'Tags Permalink', 'responsive-lightbox' ),
112 'type' => 'text',
113 'description' => '<code>' . site_url() . '/<strong>' . untrailingslashit( esc_html( $rl->options['builder']['permalink_tags'] ) ) . '</strong>/</code><br />' . esc_html__( 'Enter gallery tags archive page slug.', 'responsive-lightbox' )
114 ],
115 'archives' => [
116 'title' => __( 'Archives', 'responsive-lightbox' ),
117 'type' => 'boolean',
118 'label' => __( 'Enable gallery archives.', 'responsive-lightbox' )
119 ],
120 'archives_category' => [
121 'title' => __( 'Archives Category', 'responsive-lightbox' ),
122 'type' => 'select',
123 'description' => __( 'Select category for gallery archives.', 'responsive-lightbox' ),
124 'options' => $archives_category_options
125 ]
126 ]
127 ]
128 ]
129 ];
130
131 return $data;
132 }
133 }
134