Skip to content

Commit 6247385

Browse files
authored
Merge pull request #1 from h1dd3nsn1p3r/dev-sniper
👻 Initial commit
2 parents e689372 + 32e05c3 commit 6247385

29 files changed

+13842
-0
lines changed

LICENSE.txt

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

README.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
=== Addonify Gutenberg Block Image & Gallery Lightbox ===
2+
Contributors: addonify
3+
Donate link: https://github.com/addonify/addonify-gutenberg-block-image-gallery-lightbox
4+
Tags: gutenberg, block, image, gallery, lightbox
5+
Requires at least: 5.0.0
6+
Tested up to: 5.7.2
7+
Stable tag: 1.0.0
8+
License: GPLv2 or later
9+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10+
11+
A simple plugin that makes Gutenberg block image clickable to preview it in LightBox popup.
12+
13+
== Description ==
14+
15+
A simple plugin that makes Gutenberg block image clickable to preview it in Lightbox popup. Technically, This plugin finds `IMG` tag inside Gutenberg wp block image or gallery & it uses lightGallery js to preview images in LightBox.
16+
17+
Talking about the benefits it ✅ Works with any theme. While it might impact your webpage ❗️ load time it has to find the `class` name from **DOM** using **jQuery**.
18+
19+
== Installation ==
20+
21+
1. Download the plugin.
22+
2. Unzip the downloaded zip file.
23+
3. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
24+
4. Activate `Addonify Wishlist` from Dashboard > Plugins.
25+
26+
== Changelog ==
27+
28+
= 1.0.0 = Released on: 21 May 2021
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
/**
4+
*
5+
* @link https://addonify.com/
6+
* @since 1.0.0
7+
* @package Addonify_Gutenberg_Block_Image_Gallery_Lightbox
8+
*
9+
* @wordpress-plugin
10+
* Plugin Name: Addonify Gutenberg Block Image & Gallery Lightbox
11+
* Plugin URI: https://github.com/addonify/addonify-gutenberg-block-image-gallery-lightbox
12+
* Description: A simple plugin that makes Gutenberg block image clickable to preview it in LightBox popup.
13+
* Version: 1.0.0
14+
* Author: Addonify
15+
* Author URI: https://github.com/addonify/addonify-gutenberg-block-image-gallery-lightbox
16+
* License: GPL-2.0+
17+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
18+
* Text Domain: addonify-gutenberg-block-image-gallery-lightbox
19+
* Domain Path: /languages
20+
*/
21+
22+
// If this file is called directly, abort.
23+
if ( ! defined( 'WPINC' ) ) {
24+
die;
25+
}
26+
27+
/**
28+
* Currently plugin version.
29+
* Start at version 1.0.0 and use SemVer - https://semver.org
30+
* Rename this for your plugin and update it as you release new versions.
31+
*/
32+
define( 'ADDONIFY_GUTENBERG_BLOCK_IMAGE_GALLERY_LIGHTBOX_VERSION', '1.0.0' );
33+
34+
/**
35+
* The code that runs during plugin activation.
36+
* This action is documented in includes/class-addonify-gutenberg-block-image-gallery-lightbox-activator.php
37+
*/
38+
function activate_addonify_gutenberg_block_image_gallery_lightbox() {
39+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-activator.php';
40+
Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Activator::activate();
41+
}
42+
43+
/**
44+
* The code that runs during plugin deactivation.
45+
* This action is documented in includes/class-addonify-gutenberg-block-image-gallery-lightbox-deactivator.php
46+
*/
47+
function deactivate_addonify_gutenberg_block_image_gallery_lightbox() {
48+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-deactivator.php';
49+
Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Deactivator::deactivate();
50+
}
51+
52+
register_activation_hook( __FILE__, 'activate_addonify_gutenberg_block_image_gallery_lightbox' );
53+
register_deactivation_hook( __FILE__, 'deactivate_addonify_gutenberg_block_image_gallery_lightbox' );
54+
55+
/**
56+
* The core plugin class that is used to define internationalization,
57+
* admin-specific hooks, and public-facing site hooks.
58+
*/
59+
require plugin_dir_path( __FILE__ ) . 'includes/class-addonify-gutenberg-block-image-gallery-lightbox.php';
60+
61+
/**
62+
* Begins execution of the plugin.
63+
*
64+
* Since everything within the plugin is registered via hooks,
65+
* then kicking off the plugin from this point in the file does
66+
* not affect the page life cycle.
67+
*
68+
* @since 1.0.0
69+
*/
70+
function run_addonify_gutenberg_block_image_gallery_lightbox() {
71+
72+
$plugin = new Addonify_Gutenberg_Block_Image_Gallery_Lightbox();
73+
$plugin->run();
74+
75+
}
76+
run_addonify_gutenberg_block_image_gallery_lightbox();

gulpfile.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
var wpPot = require('gulp-wp-pot');
5+
6+
// if you have package.json and package-lock.json then "npm install"
7+
8+
// or
9+
10+
// npm init
11+
// npm install gulp gulp-wp-pot --save-dev
12+
// gulp makepot
13+
14+
// Task to run
15+
gulp.task('makepot', function() {
16+
17+
return gulp.src(['**/*.php', '!node_modules/**'])
18+
.pipe(wpPot({
19+
domain: 'addonify-gutenberg-block-image-gallery-lightbox',
20+
package: 'Addonify Gutenberg Block Image & Gallery Lightbox'
21+
}))
22+
.pipe(gulp.dest('languages/addonify-gutenberg-block-image-gallery-lightbox.pot'));
23+
});

includes/class-activator.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/**
4+
* Fired during plugin activation
5+
*
6+
* @link https://addonify.com/
7+
* @since 1.0.0
8+
*
9+
* @package Addonify_Gutenberg_Block_Image_Gallery_Lightbox
10+
* @subpackage Addonify_Gutenberg_Block_Image_Gallery_Lightbox/includes
11+
*/
12+
13+
/**
14+
* Fired during plugin activation.
15+
*
16+
* This class defines all code necessary to run during the plugin's activation.
17+
*
18+
* @since 1.0.0
19+
* @package Addonify_Gutenberg_Block_Image_Gallery_Lightbox
20+
* @subpackage Addonify_Gutenberg_Block_Image_Gallery_Lightbox/includes
21+
* @author Addonify <addonify@gmail.com>
22+
*/
23+
class Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Activator {
24+
25+
/**
26+
* Short Description. (use period)
27+
*
28+
* Long Description.
29+
*
30+
* @since 1.0.0
31+
*/
32+
public static function activate() {
33+
34+
}
35+
36+
}
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
<?php
2+
3+
/**
4+
* The file that defines the core plugin class
5+
*
6+
* A class definition that includes attributes and functions used across both the
7+
* public-facing side of the site and the admin area.
8+
*
9+
* @link https://addonify.com/
10+
* @since 1.0.0
11+
*
12+
* @package Addonify_Gutenberg_Block_Image_Gallery_Lightbox
13+
* @subpackage Addonify_Gutenberg_Block_Image_Gallery_Lightbox/includes
14+
*/
15+
16+
/**
17+
* The core plugin class.
18+
*
19+
* This is used to define internationalization, admin-specific hooks, and
20+
* public-facing site hooks.
21+
*
22+
* Also maintains the unique identifier of this plugin as well as the current
23+
* version of the plugin.
24+
*
25+
* @since 1.0.0
26+
* @package Addonify_Gutenberg_Block_Image_Gallery_Lightbox
27+
* @subpackage Addonify_Gutenberg_Block_Image_Gallery_Lightbox/includes
28+
* @author Addonify <addonify@gmail.com>
29+
*/
30+
class Addonify_Gutenberg_Block_Image_Gallery_Lightbox {
31+
32+
/**
33+
* The loader that's responsible for maintaining and registering all hooks that power
34+
* the plugin.
35+
*
36+
* @since 1.0.0
37+
* @access protected
38+
* @var Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Loader $loader Maintains and registers all hooks for the plugin.
39+
*/
40+
protected $loader;
41+
42+
/**
43+
* The unique identifier of this plugin.
44+
*
45+
* @since 1.0.0
46+
* @access protected
47+
* @var string $plugin_name The string used to uniquely identify this plugin.
48+
*/
49+
protected $plugin_name;
50+
51+
/**
52+
* The current version of the plugin.
53+
*
54+
* @since 1.0.0
55+
* @access protected
56+
* @var string $version The current version of the plugin.
57+
*/
58+
protected $version;
59+
60+
/**
61+
* Define the core functionality of the plugin.
62+
*
63+
* Set the plugin name and the plugin version that can be used throughout the plugin.
64+
* Load the dependencies, define the locale, and set the hooks for the admin area and
65+
* the public-facing side of the site.
66+
*
67+
* @since 1.0.0
68+
*/
69+
public function __construct() {
70+
if ( defined( 'ADDONIFY_GUTENBERG_BLOCK_IMAGE_GALLERY_LIGHTBOX_VERSION' ) ) {
71+
$this->version = ADDONIFY_GUTENBERG_BLOCK_IMAGE_GALLERY_LIGHTBOX_VERSION;
72+
} else {
73+
$this->version = '1.0.0';
74+
}
75+
$this->plugin_name = 'addonify-gutenberg-block-image-gallery-lightbox';
76+
77+
$this->load_dependencies();
78+
$this->set_locale();
79+
$this->define_public_hooks();
80+
81+
}
82+
83+
/**
84+
* Load the required dependencies for this plugin.
85+
*
86+
* Include the following files that make up the plugin:
87+
*
88+
* - Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Loader. Orchestrates the hooks of the plugin.
89+
* - Addonify_Gutenberg_Block_Image_Gallery_Lightbox_i18n. Defines internationalization functionality.
90+
* - Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Admin. Defines all hooks for the admin area.
91+
* - Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Public. Defines all hooks for the public side of the site.
92+
*
93+
* Create an instance of the loader which will be used to register the hooks
94+
* with WordPress.
95+
*
96+
* @since 1.0.0
97+
* @access private
98+
*/
99+
private function load_dependencies() {
100+
101+
/**
102+
* The class responsible for orchestrating the actions and filters of the
103+
* core plugin.
104+
*/
105+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-loader.php';
106+
107+
/**
108+
* The class responsible for defining internationalization functionality
109+
* of the plugin.
110+
*/
111+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-i18n.php';
112+
113+
/**
114+
* The class responsible for defining all actions that occur in the public-facing
115+
* side of the site.
116+
*/
117+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-addonify-gutenberg-block-image-gallery-lightbox-public.php';
118+
119+
$this->loader = new Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Loader();
120+
121+
}
122+
123+
/**
124+
* Define the locale for this plugin for internationalization.
125+
*
126+
* Uses the Addonify_Gutenberg_Block_Image_Gallery_Lightbox_i18n class in order to set the domain and to register the hook
127+
* with WordPress.
128+
*
129+
* @since 1.0.0
130+
* @access private
131+
*/
132+
private function set_locale() {
133+
134+
$plugin_i18n = new Addonify_Gutenberg_Block_Image_Gallery_Lightbox_i18n();
135+
136+
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
137+
138+
}
139+
140+
/**
141+
* Register all of the hooks related to the public-facing functionality
142+
* of the plugin.
143+
*
144+
* @since 1.0.0
145+
* @access private
146+
*/
147+
private function define_public_hooks() {
148+
149+
$plugin_public = new Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Public( $this->get_plugin_name(), $this->get_version() );
150+
151+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
152+
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
153+
154+
}
155+
156+
/**
157+
* Run the loader to execute all of the hooks with WordPress.
158+
*
159+
* @since 1.0.0
160+
*/
161+
public function run() {
162+
$this->loader->run();
163+
}
164+
165+
/**
166+
* The name of the plugin used to uniquely identify it within the context of
167+
* WordPress and to define internationalization functionality.
168+
*
169+
* @since 1.0.0
170+
* @return string The name of the plugin.
171+
*/
172+
public function get_plugin_name() {
173+
return $this->plugin_name;
174+
}
175+
176+
/**
177+
* The reference to the class that orchestrates the hooks with the plugin.
178+
*
179+
* @since 1.0.0
180+
* @return Addonify_Gutenberg_Block_Image_Gallery_Lightbox_Loader Orchestrates the hooks of the plugin.
181+
*/
182+
public function get_loader() {
183+
return $this->loader;
184+
}
185+
186+
/**
187+
* Retrieve the version number of the plugin.
188+
*
189+
* @since 1.0.0
190+
* @return string The version number of the plugin.
191+
*/
192+
public function get_version() {
193+
return $this->version;
194+
}
195+
196+
}

0 commit comments

Comments
 (0)