|
1
|
|
|
<?php
|
|
2
|
|
|
/**
|
|
3
|
|
|
* FooGallery FooGrid Pro Extension
|
|
4
|
|
|
*
|
|
5
|
|
|
* A gallery with inline preview based on the Google image search results.
|
|
6
|
|
|
*
|
|
7
|
|
|
* @package FooGrid_Template_FooGallery_Extension
|
|
8
|
|
|
* @author FooPlugins
|
|
9
|
|
|
* @license GPL-2.0+
|
|
10
|
|
|
* @link https://fooplugins.com
|
|
11
|
|
|
* @copyright 2014 FooPlugins
|
|
12
|
|
|
*
|
|
13
|
|
|
* @wordpress-plugin
|
|
14
|
|
|
* Plugin Name: FooGallery - FooGrid
|
|
15
|
|
|
* Description: A gallery with inline preview based on Google\'s image search results.
|
|
16
|
|
|
* Version: 1.0.0
|
|
17
|
|
|
* Author: FooPlugins
|
|
18
|
|
|
* Author URI: https://fooplugins.com
|
|
19
|
|
|
* License: GPL-2.0+
|
|
20
|
|
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
|
21
|
|
|
*/
|
|
22
|
|
|
|
|
23
|
|
|
if ( !class_exists( 'FooGallery_FooGrid_Gallery_Template' ) ) {
|
|
24
|
|
|
|
|
25
|
|
|
define('FOOGALLERY_FOOGRID_GALLERY_TEMPLATE_URL', plugin_dir_url( __FILE__ ));
|
|
26
|
|
|
define('FOOGALLERY_FOOGRID_GALLERY_TEMPLATE_PATH', plugin_dir_path( __FILE__ ));
|
|
27
|
|
|
|
|
28
|
|
|
class FooGallery_FooGrid_Gallery_Template {
|
|
|
|
|
|
|
29
|
|
|
/**
|
|
30
|
|
|
* Wire up everything we need to run the extension
|
|
31
|
|
|
*/
|
|
32
|
|
|
function __construct() {
|
|
|
|
|
|
|
33
|
|
|
add_filter( 'foogallery_gallery_templates', array( $this, 'add_template' ), 100, 1 );
|
|
34
|
|
|
add_filter( 'foogallery_gallery_templates_files', array( $this, 'register_myself' ) );
|
|
35
|
|
|
add_filter( 'foogallery_located_template-foogridpro', array( $this, 'enqueue_dependencies' ) );
|
|
36
|
|
|
}
|
|
37
|
|
|
|
|
38
|
|
|
/**
|
|
39
|
|
|
* Register myself so that all associated JS and CSS files can be found and automatically included
|
|
40
|
|
|
* @param $extensions
|
|
41
|
|
|
*
|
|
42
|
|
|
* @return array
|
|
43
|
|
|
*/
|
|
44
|
|
|
function register_myself( $extensions ) {
|
|
45
|
|
|
$extensions[] = __FILE__;
|
|
46
|
|
|
return $extensions;
|
|
47
|
|
|
}
|
|
48
|
|
|
|
|
49
|
|
|
/**
|
|
50
|
|
|
* Enqueue any script or stylesheet file dependencies that your gallery template relies on
|
|
51
|
|
|
*
|
|
52
|
|
|
* @param $gallery
|
|
53
|
|
|
*/
|
|
54
|
|
|
function enqueue_dependencies( $gallery ) {
|
|
|
|
|
|
|
55
|
|
|
foogallery_enqueue_core_gallery_template_style();
|
|
56
|
|
|
foogallery_enqueue_core_gallery_template_script();
|
|
57
|
|
|
}
|
|
58
|
|
|
|
|
59
|
|
|
/**
|
|
60
|
|
|
* Add our gallery template to the list of templates available for every gallery
|
|
61
|
|
|
* @param $gallery_templates
|
|
62
|
|
|
*
|
|
63
|
|
|
* @return array
|
|
64
|
|
|
*/
|
|
65
|
|
|
function add_template( $gallery_templates ) {
|
|
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
$gallery_templates[] = array(
|
|
68
|
|
|
'slug' => 'foogridpro',
|
|
69
|
|
|
'name' => __( 'Grid PRO', 'foogallery'),
|
|
70
|
|
|
'preview_support' => true,
|
|
71
|
|
|
'common_fields_support' => true,
|
|
72
|
|
|
'lazyload_support' => true,
|
|
73
|
|
|
'paging_support' => true,
|
|
74
|
|
|
'thumbnail_dimensions' => true,
|
|
75
|
|
|
'fields' => array(
|
|
76
|
|
|
array(
|
|
77
|
|
|
'id' => 'thumbnail_size',
|
|
78
|
|
|
'title' => __('Thumbnail Size', 'foogallery'),
|
|
79
|
|
|
'desc' => __('Choose the size of your thumbs.', 'foogallery'),
|
|
80
|
|
|
'type' => 'thumb_size',
|
|
81
|
|
|
'default' => array(
|
|
82
|
|
|
'width' => 320,
|
|
83
|
|
|
'height' => 180,
|
|
84
|
|
|
'crop' => true
|
|
85
|
|
|
)
|
|
86
|
|
|
),
|
|
87
|
|
|
array(
|
|
88
|
|
|
'id' => 'thumbnail_link',
|
|
89
|
|
|
'title' => __('Thumbnail Link', 'foogallery'),
|
|
90
|
|
|
'default' => 'image' ,
|
|
91
|
|
|
'type' => 'thumb_link',
|
|
92
|
|
|
'desc' => __('You can choose to either link each thumbnail to the full size image or to the image\'s attachment page.', 'foogallery')
|
|
93
|
|
|
),
|
|
94
|
|
|
array(
|
|
95
|
|
|
'id' => 'theme',
|
|
96
|
|
|
'section' => __( 'General', 'foogallery' ),
|
|
97
|
|
|
'title' => __('Theme', 'foogallery'),
|
|
98
|
|
|
'desc' => __('The theme for the content viewer.', 'foogallery'),
|
|
99
|
|
|
'default' => '',
|
|
100
|
|
|
'type' => 'radio',
|
|
101
|
|
|
'spacer' => '<span class="spacer"></span>',
|
|
102
|
|
|
'choices' => array(
|
|
103
|
|
|
'' => __( 'Dark (Default)', 'foogallery' ),
|
|
104
|
|
|
'foogrid-light' => __( 'Light', 'foogallery' )
|
|
105
|
|
|
)
|
|
106
|
|
|
),
|
|
107
|
|
|
array(
|
|
108
|
|
|
'id' => 'transition',
|
|
109
|
|
|
'section' => __( 'General', 'foogallery' ),
|
|
110
|
|
|
'title' => __('Transition', 'foogallery'),
|
|
111
|
|
|
'desc' => __('Transition type to use switching between items, or no transitions at all.', 'foogallery'),
|
|
112
|
|
|
'default' => 'foogrid-transition-fade',
|
|
113
|
|
|
'type' => 'radio',
|
|
114
|
|
|
'spacer' => '<span class="spacer"></span>',
|
|
115
|
|
|
'choices' => array(
|
|
116
|
|
|
'foogrid-transition-fade' => __( 'Fade', 'foogallery' ),
|
|
117
|
|
|
'foogrid-transition-horizontal' => __( 'Horizontal', 'foogallery' ),
|
|
118
|
|
|
'foogrid-transition-vertical' => __( 'Vertical', 'foogallery' ),
|
|
119
|
|
|
'' => __( 'None', 'foogallery' )
|
|
120
|
|
|
)
|
|
121
|
|
|
),
|
|
122
|
|
|
array(
|
|
123
|
|
|
'id' => 'loop',
|
|
124
|
|
|
'section' => __( 'General', 'foogallery' ),
|
|
125
|
|
|
'title' => __('Loop', 'foogallery'),
|
|
126
|
|
|
'desc' => __('Whether the slider should loop (i.e. the first slide goes to the last, the last slide goes to the first).', 'foogallery'),
|
|
127
|
|
|
'default' => 'yes',
|
|
128
|
|
|
'type' => 'radio',
|
|
129
|
|
|
'spacer' => '<span class="spacer"></span>',
|
|
130
|
|
|
'choices' => array(
|
|
131
|
|
|
'yes' => __( 'Yes', 'foogallery' ),
|
|
132
|
|
|
'no' => __( 'No', 'foogallery' )
|
|
133
|
|
|
)
|
|
134
|
|
|
),
|
|
135
|
|
|
array(
|
|
136
|
|
|
'id' => 'columns',
|
|
137
|
|
|
'section' => __( 'General', 'foogallery' ),
|
|
138
|
|
|
'title' => __('Max Columns', 'foogallery'),
|
|
139
|
|
|
'desc' => __('The maximum number of thumbnail columns to display. * This amount is automatically reduced on small screen sizes.', 'foogallery'),
|
|
140
|
|
|
'default' => 'foogrid-cols-4',
|
|
141
|
|
|
'type' => 'select',
|
|
142
|
|
|
'choices' => array(
|
|
143
|
|
|
'foogrid-cols-2' => __( '2 Columns', 'foogallery' ),
|
|
144
|
|
|
'foogrid-cols-3' => __( '3 Columns', 'foogallery' ),
|
|
145
|
|
|
'foogrid-cols-4' => __( '4 Columns', 'foogallery' ),
|
|
146
|
|
|
'foogrid-cols-5' => __( '5 Columns', 'foogallery' ),
|
|
147
|
|
|
'foogrid-cols-6' => __( '6 Columns', 'foogallery' ),
|
|
148
|
|
|
'foogrid-cols-7' => __( '7 Columns', 'foogallery' ),
|
|
149
|
|
|
'foogrid-cols-8' => __( '8 Columns', 'foogallery' )
|
|
150
|
|
|
)
|
|
151
|
|
|
),
|
|
152
|
|
|
array(
|
|
153
|
|
|
'id' => 'captions',
|
|
154
|
|
|
'section' => __( 'General', 'foogallery' ),
|
|
155
|
|
|
'title' => __('Captions', 'foogallery'),
|
|
156
|
|
|
'desc' => __('The position of captions or no captions at all. * The caption will automatically switch to below the item on small screen sizes.', 'foogallery'),
|
|
157
|
|
|
'default' => 'foogrid-caption-below',
|
|
158
|
|
|
'type' => 'radio',
|
|
159
|
|
|
'spacer' => '<span class="spacer"></span>',
|
|
160
|
|
|
'choices' => array(
|
|
161
|
|
|
'foogrid-caption-below' => __( 'Below', 'foogallery' ),
|
|
162
|
|
|
//'foogrid-caption-right' => __( 'Right', 'foogallery' ),
|
|
|
|
|
|
|
163
|
|
|
'' => __( 'None', 'foogallery' )
|
|
164
|
|
|
)
|
|
165
|
|
|
),
|
|
166
|
|
|
array(
|
|
167
|
|
|
'id' => 'scroll',
|
|
168
|
|
|
'section' => __( 'General', 'foogallery' ),
|
|
169
|
|
|
'title' => __('Scroll', 'foogallery'),
|
|
170
|
|
|
'desc' => __('Whether the page is scrolled to the selected item.', 'foogallery'),
|
|
171
|
|
|
'default' => 'yes',
|
|
172
|
|
|
'type' => 'radio',
|
|
173
|
|
|
'spacer' => '<span class="spacer"></span>',
|
|
174
|
|
|
'choices' => array(
|
|
175
|
|
|
'yes' => __( 'Yes', 'foogallery' ),
|
|
176
|
|
|
'no' => __( 'No', 'foogallery' )
|
|
177
|
|
|
)
|
|
178
|
|
|
),
|
|
179
|
|
|
array(
|
|
180
|
|
|
'id' => 'scroll_smooth',
|
|
181
|
|
|
'section' => __( 'General', 'foogallery' ),
|
|
182
|
|
|
'title' => __('Smooth Scroll', 'foogallery'),
|
|
183
|
|
|
'desc' => __('Whether or not to perform a smooth scrolling animation to the selected item.', 'foogallery'),
|
|
184
|
|
|
'default' => 'yes',
|
|
185
|
|
|
'type' => 'radio',
|
|
186
|
|
|
'spacer' => '<span class="spacer"></span>',
|
|
187
|
|
|
'choices' => array(
|
|
188
|
|
|
'yes' => __( 'Yes', 'foogallery' ),
|
|
189
|
|
|
'no' => __( 'No', 'foogallery' )
|
|
190
|
|
|
)
|
|
191
|
|
|
),
|
|
192
|
|
|
array(
|
|
193
|
|
|
'id' => 'scroll_offset',
|
|
194
|
|
|
'section' => __( 'General', 'foogallery' ),
|
|
195
|
|
|
'title' => __('Scroll Offset', 'foogallery'),
|
|
196
|
|
|
'desc' => __('The amount to offset scrolling by. * This can be used to counter fixed headers.', 'foogallery'),
|
|
197
|
|
|
'type' => 'number',
|
|
198
|
|
|
'default' => 0
|
|
199
|
|
|
)
|
|
200
|
|
|
)
|
|
201
|
|
|
);
|
|
202
|
|
|
|
|
203
|
|
|
return $gallery_templates;
|
|
204
|
|
|
}
|
|
205
|
|
|
}
|
|
206
|
|
|
} |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.