PluginProbe
Pixel Gallery Addons for Elementor – Easy Grid, Creative Gallery, Drag and Drop Grid, Custom Grid Layout, Portfolio Gallery / trunk
Pixel Gallery Addons for Elementor – Easy Grid, Creative Gallery, Drag and Drop Grid, Custom Grid Layout, Portfolio Gallery vtrunk
2.1.14 2.1.13 2.1.12 2.1.11 2.1.10 2.1.9 2.1.8 2.1.7 trunk 1.2.2 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.4.0 1.4.1 1.4.10 1.4.11 1.4.2 1.4.3 1.4.5 1.4.6 All 74 releases
pixel-gallery / pixel-gallery.php

pixel-gallery.php in Pixel Gallery Addons for Elementor – Easy Grid, Creative Gallery, Drag and Drop Grid, Custom Grid Layout, Portfolio Gallery trunk, at pixel-gallery.php

186 lines 6.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Pixel Gallery
4 * Plugin URI: https://pixelgallery.pro/
5 * Description: The all-new <a href="https://pixelgallery.pro/">Pixel Gallery</a> brings incredibly advanced, and super-flexible widgets, and A to Z essential addons to the Elementor page builder for WordPress. Explore expertly-coded widgets with first-class support by experts.
6 * Version: 2.2.0
7 * Author: BdThemes
8 * Author URI: https://bdthemes.com/
9 * Text Domain: pixel-gallery
10 * Domain Path: /languages
11 * Requires at least: 6.0
12 * Tested up to: 7.0
13 * Requires PHP: 7.4
14 * License: GPLv3 or later
15 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
16 * Elementor requires at least: 4.0.0
17 * Elementor tested up to: 4.2.2
18 */
19
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit; // Exit if accessed directly.
22 }
23
24 // Some pre defined value for easy use
25 define( 'BDTPG_VER', '2.2.0' );
26 define( 'BDTPG_TPL_DB_VER', '1.0.0' );
27 define( 'BDTPG__FILE__', __FILE__ );
28
29 if ( ! defined( 'BDTPG_TITLE' ) ) {
30 define( 'BDTPG_TITLE', 'Pixel Gallery' );
31 }
32
33 if ( ! function_exists( 'pixel_gallery_is_pro_installed' ) ) {
34
35 function pixel_gallery_is_pro_installed() {
36
37 if ( ! function_exists( 'get_plugins' ) ) {
38 require_once ABSPATH . 'wp-admin/includes/plugin.php';
39 }
40
41 $file_path = 'pixel-gallery-pro/pixel-gallery-pro.php';
42 $installed_plugins = get_plugins();
43
44 return isset( $installed_plugins[ $file_path ] );
45 }
46 }
47
48 if ( ! function_exists( 'pixel_gallery_is_pro_activated' ) ) {
49
50 function pixel_gallery_is_pro_activated() {
51
52 if ( ! function_exists( 'get_plugins' ) ) {
53 require_once ABSPATH . 'wp-admin/includes/plugin.php';
54 }
55
56 return is_plugin_active( 'pixel-gallery-pro/pixel-gallery-pro.php' );
57 }
58 }
59
60 /*
61 * Deprecated aliases. These names predate the current prefixing rules and are
62 * part of the public contract with released Pixel Gallery Pro versions, so they
63 * are kept as thin wrappers around the prefixed functions above.
64 */
65 if ( ! function_exists( '_is_pg_pro_installed' ) ) {
66 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Deprecated alias for pixel_gallery_is_pro_installed(); kept for Pixel Gallery Pro back-compat.
67 function _is_pg_pro_installed() {
68 return pixel_gallery_is_pro_installed();
69 }
70 }
71
72 if ( ! function_exists( '_is_pg_pro_activated' ) ) {
73 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Deprecated alias for pixel_gallery_is_pro_activated(); kept for Pixel Gallery Pro back-compat.
74 function _is_pg_pro_activated() {
75 return pixel_gallery_is_pro_activated();
76 }
77 }
78
79 // Helper function here
80 require_once ( dirname( __FILE__ ) . '/includes/helper.php' );
81
82 if ( ! pixel_gallery_is_pro_activated() ) {
83 require_once BDTPG_INC_PATH . 'class-pro-widget-map.php';
84 }
85
86 if ( function_exists( 'pixel_gallery_license_validation' ) && true !== pixel_gallery_license_validation() ) {
87 require_once BDTPG_INC_PATH . 'class-pro-widget-map.php';
88 }
89
90 require_once ( dirname( __FILE__ ) . '/includes/utils.php' );
91
92 /**
93 * Plugin load here correctly
94 * Also loaded the language file from here
95 */
96 function pixel_gallery_load_plugin() {
97
98 if ( ! did_action( 'elementor/loaded' ) ) {
99 add_action( 'admin_notices', 'pixel_gallery_fail_load' );
100
101 return;
102 }
103
104 // Setup wizard init file
105 require_once( dirname( __FILE__ ) . '/includes/setup-wizard/init.php' );
106
107 // Widgets filters here
108 require_once ( BDTPG_INC_PATH . 'pixel-gallery-filters.php' );
109
110 // Pixel gallery widget and assets loader
111 require_once ( BDTPG_PATH . 'loader.php' );
112 }
113
114 add_action( 'plugins_loaded', 'pixel_gallery_load_plugin', 9 );
115
116
117 /**
118 * Check Elementor installed and activated correctly
119 */
120 function pixel_gallery_fail_load() {
121
122 $screen = get_current_screen();
123
124 if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) {
125 return;
126 }
127
128 $plugin = 'elementor/elementor.php';
129
130 if ( pixel_gallery_is_elementor_installed() ) {
131 if ( ! current_user_can( 'activate_plugins' ) ) {
132 return;
133 }
134 $activation_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin );
135 $admin_message = '<p>' . esc_html__( 'Ops! Pixel Gallery not working because you need to activate the Elementor plugin first.', 'pixel-gallery' ) . '</p>';
136 $admin_message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__( 'Activate Elementor Now', 'pixel-gallery' ) ) . '</p>';
137 } else {
138 if ( ! current_user_can( 'install_plugins' ) ) {
139 return;
140 }
141 $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );
142 $admin_message = '<p>' . esc_html__( 'Ops! Pixel Gallery not working because you need to install the Elementor plugin', 'pixel-gallery' ) . '</p>';
143 $admin_message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__( 'Install Elementor Now', 'pixel-gallery' ) ) . '</p>';
144 }
145
146 printf( '<div class="error">%1$s</div>', wp_kses_post( $admin_message ) );
147 }
148
149 /**
150 * Check the elementor installed or not
151 */
152 if ( ! function_exists( 'pixel_gallery_is_elementor_installed' ) ) {
153 function pixel_gallery_is_elementor_installed() {
154 $file_path = 'elementor/elementor.php';
155 $installed_plugins = get_plugins();
156
157 return isset( $installed_plugins[ $file_path ] );
158 }
159 }
160
161 if ( ! function_exists( '_is_elementor_installed' ) ) {
162 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Deprecated alias for pixel_gallery_is_elementor_installed(); kept for Pixel Gallery Pro back-compat.
163 function _is_elementor_installed() {
164 return pixel_gallery_is_elementor_installed();
165 }
166 }
167
168 /**
169 * Added biggopti after install or upgrade to v6
170 *
171 * @param string $plugin
172 * @return void
173 */
174 function pixel_gallery_activation_redirect( $plugin ) {
175 if ( ! did_action( 'elementor/loaded' ) ) {
176 return;
177 }
178
179 if ( $plugin == plugin_basename( BDTPG__FILE__ ) ) {
180 wp_safe_redirect( admin_url( 'admin.php?page=pixel_gallery_options&notice=v6' ) );
181 exit;
182 }
183 }
184
185 add_action( 'activated_plugin', 'pixel_gallery_activation_redirect', 20 );
186