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