PluginProbe
Responsive Gallery Grid / 2.3.5
Responsive Gallery Grid v2.3.5
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.5, at responsive-gallery-grid.php

119 lines 4.6 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.5
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.5' );
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 // echo '<pre>'.print_r($rgg_settings,true).'</pre>';
62 // echo '<pre>'.print_r($rgg_options,true).'</pre>';
63
64 if (count($rgg_settings) == 0) return;
65
66 $rgg_settings['rgg_is_pro'] = RGG_IS_PRO;
67
68 $deps = array('jquery');
69
70 foreach ($rgg_settings as $single_gallery_settings) {
71
72 if ($single_gallery_settings['lightbox'] == 'swipebox') {
73 wp_enqueue_script( 'rgg-swipebox', RGG_PLUGIN_DIR_URL . '/lib/swipebox/js/jquery.swipebox.min.js', array( 'jquery' ), RGG_VERSION );
74 $deps[] = 'rgg-swipebox';
75 }
76 if ($single_gallery_settings['lightbox'] == 'simplelightbox') {
77 wp_enqueue_script( 'rgg-simplelightbox', RGG_PLUGIN_DIR_URL . '/lib/simplelightbox/simple-lightbox.min.js', array( 'jquery' ), RGG_VERSION );
78 $deps[] = 'rgg-simplelightbox';
79 }
80 if ($single_gallery_settings['lightbox'] == 'image-above') {
81 wp_enqueue_script('slick', '//cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.js', ['jquery'], RGG_VERSION);
82 $deps[] = 'slick';
83 }
84
85 }
86
87 wp_enqueue_script('jquery');
88 wp_enqueue_script('rgg-main', RGG_PLUGIN_DIR_URL.'/js/main.js', $deps, RGG_VERSION );
89 wp_localize_script( 'rgg-main', 'rgg_params', $rgg_settings );
90 }
91
92 function rgg_register_styles() {
93
94 //global $rgg_settings, $rgg_options;
95
96 // enqueue css
97
98 $deps = array();
99
100 // 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.
101 // TODO: at least minimize it then?
102
103 wp_enqueue_style( 'rgg-swipebox', RGG_PLUGIN_DIR_URL.'/lib/swipebox/css/swipebox.min.css', array(), RGG_VERSION);
104 $deps[] = 'rgg-swipebox';
105
106 wp_enqueue_style( 'rgg-simplelightbox', RGG_PLUGIN_DIR_URL.'/lib/simplelightbox/simplelightbox.min.css', array(), RGG_VERSION);
107 $deps[] = 'rgg-simplelightbox';
108
109 wp_enqueue_style('slickstyle', '//cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.css', [], RGG_VERSION);
110 wp_enqueue_style('slick-theme', RGG_PLUGIN_DIR_URL.'/lib/slick/slick-theme.css', ['slickstyle'], RGG_VERSION);
111 $deps[] = 'slick-theme';
112
113 wp_enqueue_style( 'rgg-style', RGG_PLUGIN_DIR_URL.'/css/style.css', $deps, RGG_VERSION );
114
115 }
116
117 add_action('wp_footer', 'rgg_register_scripts');
118 add_action('wp_enqueue_scripts', 'rgg_register_styles');
119 }