PluginProbe
Responsive Gallery Grid / 2.3.8
Responsive Gallery Grid v2.3.8
2.4.1 2.4 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.3 1.3.1 1.3.2 1.3.3 1.3.4 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.2.1 2.2.2 All 47 releases
responsive-gallery-grid / responsive-gallery-grid.php

responsive-gallery-grid.php in Responsive Gallery Grid 2.3.8, at responsive-gallery-grid.php

115 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Responsive Gallery Grid
4 Plugin URI: https://responsive-gallery-grid.bdwm.be
5 Description: Converts the default wordpress gallery to a Google+ styled image gallery grid, where the images are scaled to fill the gallery container, while maintaining image aspect ratio's.
6 Author: Jules Colle, BDWM
7 Author URI: http://bdwm.be
8 Version: 2.3.8
9
10 Copyright 2013-2016 Jules Colle (email : jules@bdwm.be)
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License, version 2, as
14 published by the Free Software Foundation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25 */
26
27 // don't do anything if the RGG plugin is already loaded
28 // (RGG and RGG Pro should not be activated together, but if they are, make sure only the first one loaded is used.)
29
30 if (!function_exists('rgg_gallery_shortcode')) {
31
32 define('RGG_PLUGIN', 'rgg');
33 define('RGG_OPTIONS', 'rgg_options');
34
35 define( 'RGG_VERSION', '2.3.8' );
36 define( 'RGG_REQUIRED_WP_VERSION', '4.1' );
37 define( 'RGG_PLUGIN_PATH', __FILE__ );
38 define( 'RGG_PLUGIN_BASENAME', plugin_basename( RGG_PLUGIN_PATH ) );
39 define( 'RGG_PLUGIN_NAME', trim( dirname( RGG_PLUGIN_BASENAME ), '/' ) );
40 define( 'RGG_PLUGIN_DIR', untrailingslashit( dirname( RGG_PLUGIN_PATH ) ) );
41 define( 'RGG_PLUGIN_DIR_URL', plugins_url('',RGG_PLUGIN_PATH));
42
43 define('RGG_IS_PRO', file_exists(RGG_PLUGIN_DIR.'/pro/rgg_pro_options.php'));
44
45 global $rgg_options, $rgg_settings;
46 $rgg_settings = array();
47 require_once RGG_PLUGIN_DIR.'/rgg-options.php';
48 if (RGG_IS_PRO) {
49 require_once RGG_PLUGIN_DIR.'/pro/update.php';
50 }
51 require_once RGG_PLUGIN_DIR.'/gallery-shortcode.php';
52
53
54 // register scripts and styles
55
56 function rgg_register_scripts() {
57
58
59 global $rgg_settings, $rgg_options;
60
61 if (count($rgg_settings) == 0) return;
62
63 $rgg_settings['rgg_is_pro'] = RGG_IS_PRO;
64
65 $deps = array('jquery');
66
67 foreach ($rgg_settings as $single_gallery_settings) {
68
69 if (!is_array($single_gallery_settings)) {
70 continue;
71 }
72
73 if (
74 $single_gallery_settings['lightbox'] == 'simplelightbox'
75 ) {
76 wp_enqueue_script( 'rgg-simplelightbox', RGG_PLUGIN_DIR_URL . '/lib/simplelightbox/simple-lightbox.min.js', array( 'jquery' ), RGG_VERSION );
77 $deps[] = 'rgg-simplelightbox';
78 }
79 if ($single_gallery_settings['lightbox'] == 'image-above') {
80 wp_enqueue_script('slick', RGG_PLUGIN_DIR_URL.'/lib/slick/slick.1.9.0.min.js', ['jquery'], RGG_VERSION);
81 $deps[] = 'slick';
82 }
83
84 }
85
86 wp_enqueue_script('jquery');
87 wp_enqueue_script('rgg-main', RGG_PLUGIN_DIR_URL.'/js/main.js', $deps, RGG_VERSION );
88 wp_localize_script( 'rgg-main', 'rgg_params', $rgg_settings );
89 }
90
91 function rgg_register_styles() {
92
93 //global $rgg_settings, $rgg_options;
94
95 // enqueue css
96
97 $deps = array();
98
99 // big change: load all css always. (in header.) This is because there is no way to know at this point if a shortcode will be loaded that will need the css.
100 // TODO: at least minimize it then?
101
102 wp_enqueue_style( 'rgg-simplelightbox', RGG_PLUGIN_DIR_URL.'/lib/simplelightbox/simplelightbox.min.css', array(), RGG_VERSION);
103 $deps[] = 'rgg-simplelightbox';
104
105 wp_enqueue_style('slickstyle', RGG_PLUGIN_DIR_URL.'/lib/slick/slick.1.9.0.min.css', [], RGG_VERSION);
106 wp_enqueue_style('slick-theme', RGG_PLUGIN_DIR_URL.'/lib/slick/slick-theme.css', ['slickstyle'], RGG_VERSION);
107 $deps[] = 'slick-theme';
108
109 wp_enqueue_style( 'rgg-style', RGG_PLUGIN_DIR_URL.'/css/style.css', $deps, RGG_VERSION );
110
111 }
112
113 add_action('wp_footer', 'rgg_register_scripts');
114 add_action('wp_enqueue_scripts', 'rgg_register_styles');
115 }