|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
if ( !class_exists( 'FooGallery_Simple_Portfolio_Gallery_Template' ) ) { |
|
4
|
|
|
|
|
5
|
|
|
define('FOOGALLERY_SIMPLE_PORTFOLIO_GALLERY_TEMPLATE_URL', plugin_dir_url( __FILE__ )); |
|
6
|
|
|
|
|
7
|
|
|
class FooGallery_Simple_Portfolio_Gallery_Template { |
|
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Wire up everything we need to run the extension |
|
10
|
|
|
*/ |
|
11
|
|
|
function __construct() { |
|
|
|
|
|
|
12
|
|
|
add_filter( 'foogallery_gallery_templates', array( $this, 'add_template' ) ); |
|
13
|
|
|
add_filter( 'foogallery_gallery_templates_files', array( $this, 'register_myself' ) ); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Register myself so that all associated JS and CSS files can be found and automatically included |
|
18
|
|
|
* @param $extensions |
|
19
|
|
|
* |
|
20
|
|
|
* @return array |
|
21
|
|
|
*/ |
|
22
|
|
|
function register_myself( $extensions ) { |
|
|
|
|
|
|
23
|
|
|
$extensions[] = __FILE__; |
|
24
|
|
|
return $extensions; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Add our gallery template to the list of templates available for every gallery |
|
29
|
|
|
* @param $gallery_templates |
|
30
|
|
|
* |
|
31
|
|
|
* @return array |
|
32
|
|
|
*/ |
|
33
|
|
|
function add_template( $gallery_templates ) { |
|
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
$gallery_templates[] = array( |
|
36
|
|
|
'slug' => 'simple_portfolio', |
|
37
|
|
|
'name' => __( 'Simple Portfolio', 'foogallery' ), |
|
38
|
|
|
'fields' => array( |
|
39
|
|
|
array( |
|
40
|
|
|
'id' => 'help', |
|
41
|
|
|
'title' => __( 'Tip', 'foogallery' ), |
|
42
|
|
|
'type' => 'html', |
|
43
|
|
|
'help' => true, |
|
44
|
|
|
'desc' => __( 'The Simple Portfolio template works best when you have <strong>captions and descriptions</strong> set for every attachment in the gallery.<br />To change captions and descriptions, simply hover over the thumbnail above and click the "i" icon.', 'foogallery' ), |
|
45
|
|
|
), |
|
46
|
|
|
array( |
|
47
|
|
|
'id' => 'thumbnail_dimensions', |
|
48
|
|
|
'title' => __( 'Thumbnail Size', 'foogallery' ), |
|
49
|
|
|
'desc' => __( 'Choose the size of your thumbnails.', 'foogallery' ), |
|
50
|
|
|
'type' => 'thumb_size', |
|
51
|
|
|
'default' => array( |
|
52
|
|
|
'width' => 250, |
|
53
|
|
|
'height' => 200, |
|
54
|
|
|
'crop' => true, |
|
55
|
|
|
), |
|
56
|
|
|
), |
|
57
|
|
|
array( |
|
58
|
|
|
'id' => 'thumbnail_link', |
|
59
|
|
|
'title' => __( 'Thumbnail Link', 'foogallery' ), |
|
60
|
|
|
'default' => 'image', |
|
61
|
|
|
'type' => 'thumb_link', |
|
62
|
|
|
'spacer' => '<span class="spacer"></span>', |
|
63
|
|
|
'desc' => __( 'You can choose to link each thumbnail to the full size image, or to the image\'s attachment page, or you can choose to not link to anything.', 'foogallery' ) |
|
64
|
|
|
), |
|
65
|
|
|
array( |
|
66
|
|
|
'id' => 'lightbox', |
|
67
|
|
|
'title' => __( 'Lightbox', 'foogallery' ), |
|
68
|
|
|
'desc' => __( 'Choose which lightbox you want to display images with. The lightbox will only work if you set the thumbnail link to "Full Size Image".', 'foogallery' ), |
|
69
|
|
|
'type' => 'lightbox', |
|
70
|
|
|
), |
|
71
|
|
|
array( |
|
72
|
|
|
'id' => 'gutter', |
|
73
|
|
|
'title' => __( 'Gutter', 'foogallery' ), |
|
74
|
|
|
'desc' => __( 'The spacing between each thumbnail in the gallery.', 'foogallery' ), |
|
75
|
|
|
'type' => 'number', |
|
76
|
|
|
'class' => 'small-text', |
|
77
|
|
|
'default' => 40, |
|
78
|
|
|
'step' => '1', |
|
79
|
|
|
'min' => '0', |
|
80
|
|
|
) |
|
81
|
|
|
), |
|
82
|
|
|
); |
|
83
|
|
|
|
|
84
|
|
|
return $gallery_templates; |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
} |
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.