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 / extensions / default-templates / class-default-templates.php
foogallery / extensions / default-templates Last commit date
carousel 7 months ago default 7 months ago grid 7 months ago image-viewer 7 months ago justified 7 months ago masonry 7 months ago shared 7 months ago simple-portfolio 7 months ago thumbnail 7 months ago .DS_Store 7 months ago class-default-templates-extension.php 7 months ago class-default-templates.php 7 months ago functions.php 7 months ago
class-default-templates.php
55 lines
1 <?php
2 /**
3 * Class to include and init default templates.
4 * The templates are no longer an extension and are built in and included by default
5 */
6
7 if ( ! class_exists( 'FooGallery_Default_Templates' ) ) {
8
9 define( 'FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_URL', plugin_dir_url( __FILE__ ) );
10 define( 'FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH', plugin_dir_path( __FILE__ ) );
11
12 define( 'FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_SHARED_URL', FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_URL . 'shared/' );
13 define( 'FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_SHARED_PATH', FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH . 'shared/' );
14
15 require_once FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH . 'functions.php';
16 require_once FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH . 'default/class-default-gallery-template.php';
17 require_once FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH . 'image-viewer/class-image-viewer-gallery-template.php';
18 require_once FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH . 'justified/class-justified-gallery-template.php';
19 require_once FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH . 'masonry/class-masonry-gallery-template.php';
20 require_once FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH . 'simple-portfolio/class-simple-portfolio-gallery-template.php';
21 require_once FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH . 'thumbnail/class-thumbnail-gallery-template.php';
22 require_once FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_PATH . 'carousel/class-carousel-gallery-template.php';
23
24 class FooGallery_Default_Templates {
25
26 function __construct() {
27 new FooGallery_Default_Gallery_Template();
28 new FooGallery_Image_Viewer_Gallery_Template();
29 new FooGallery_Justified_Gallery_Template();
30 new FooGallery_Masonry_Gallery_Template();
31 new FooGallery_Simple_Portfolio_Gallery_Template();
32 new FooGallery_Thumbnail_Gallery_Template();
33 new FooGallery_Carousel_Gallery_Template();
34
35 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
36 }
37
38 /***
39 * Enqueue the assets needed by the default templates
40 * @param $hook_suffix
41 */
42 function enqueue_assets( $hook_suffix ){
43 if( in_array( $hook_suffix, array( 'post.php', 'post-new.php' ) ) ) {
44 $screen = get_current_screen();
45
46 if ( is_object( $screen ) && FOOGALLERY_CPT_GALLERY == $screen->post_type ){
47
48 // Register, enqueue scripts and styles here
49 wp_enqueue_style( 'foogallery-core-admin-settings', FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_SHARED_URL . 'css/admin-foogallery.css', array(), FOOGALLERY_VERSION );
50 }
51 }
52 }
53 }
54 }
55