PluginProbe
Ultimate Post Kit / 4.5.0
Ultimate Post Kit v4.5.0
4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 All 145 releases
ultimate-post-kit / ultimate-post-kit.php

ultimate-post-kit.php in Ultimate Post Kit 4.5.0, at ultimate-post-kit.php

179 lines 5.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Ultimate Post Kit
5 * Plugin URI: https://postkit.pro/
6 * Description: <a href="https://postkit.pro/">Ultimate Post Kit</a> is a packed of post related elementor widgets. This plugin gives you post related widget features for elementor page builder plugin.
7 * Version: 4.5.0
8 * Author: BdThemes
9 * Author URI: https://bdthemes.com/
10 * Text Domain: ultimate-post-kit
11 * Domain Path: /languages
12 * License: GPL3
13 * Elementor requires at least: 4.0.0
14 * Elementor tested up to: 4.2.2
15 */
16
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 // Some pre define value for easy use
22 define( 'BDTUPK_VER', '4.5.0' );
23 define( 'BDTUPK__FILE__', __FILE__ );
24
25 /**
26 * Loads translations
27 *
28 * @return void
29 */
30
31 // Translations for plugins hosted on WordPress.org load automatically since WP 4.6.
32
33
34 if ( ! function_exists( '_is_upk_pro_installed' ) ) {
35
36 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- established function name relied on across the plugin family / feedback SDK; renaming would break integration.
37 function _is_upk_pro_installed() {
38
39 if ( ! function_exists( 'get_plugins' ) ) {
40 require_once ABSPATH . 'wp-admin/includes/plugin.php';
41 }
42
43 $file_path = 'ultimate-post-kit-pro/ultimate-post-kit-pro.php';
44 $installed_plugins = get_plugins();
45
46 return isset( $installed_plugins[ $file_path ] );
47 }
48 }
49
50 if ( ! function_exists( '_is_upk_pro_activated' ) ) {
51
52 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- established function name relied on across the plugin family / feedback SDK; renaming would break integration.
53 function _is_upk_pro_activated() {
54
55 if ( ! function_exists( 'get_plugins' ) ) {
56 require_once ABSPATH . 'wp-admin/includes/plugin.php';
57 }
58
59 $file_path = 'ultimate-post-kit-pro/ultimate-post-kit-pro.php';
60
61 if ( is_plugin_active( $file_path ) ) {
62 return true;
63 }
64
65 return false;
66 }
67 }
68
69 // Helper function here
70 require_once ( dirname( __FILE__ ) . '/includes/helper.php' );
71
72 if ( ! _is_upk_pro_activated() ) {
73 require_once BDTUPK_INC_PATH . 'class-pro-widget-map.php';
74 }
75
76 if ( function_exists( 'upk_license_validation' ) && true !== upk_license_validation() ) {
77 require_once BDTUPK_INC_PATH . 'class-pro-widget-map.php';
78 }
79
80 require_once ( dirname( __FILE__ ) . '/includes/utils.php' );
81
82 // Widgets filters here
83 require_once ( BDTUPK_INC_PATH . 'ultimate-post-kit-filters.php' );
84
85
86 /**
87 * Plugin load here correctly
88 * Also loaded the language file from here
89 */
90 function ultimate_post_kit_load_plugin() {
91
92 if ( ! did_action( 'elementor/loaded' ) ) {
93 add_action( 'admin_notices', 'ultimate_post_kit_fail_load' );
94
95 return;
96 }
97
98 require_once( dirname( __FILE__ ) . '/includes/setup-wizard/init.php' );
99
100 // Element pack widget and assets loader
101 require_once ( BDTUPK_PATH . 'loader.php' );
102 }
103
104 add_action( 'plugins_loaded', 'ultimate_post_kit_load_plugin' );
105
106
107 /**
108 * Check Elementor installed and activated correctly
109 */
110 function ultimate_post_kit_fail_load() {
111 $screen = get_current_screen();
112 if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) {
113 return;
114 }
115
116 $plugin = 'elementor/elementor.php';
117
118 if ( _is_elementor_installed() ) {
119 if ( ! current_user_can( 'activate_plugins' ) ) {
120 return;
121 }
122 $activation_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin );
123 $admin_message = '<p>' . esc_html__( 'Ops! Ultimate Post Kit not working because you need to activate the Elementor plugin first.', 'ultimate-post-kit' ) . '</p>';
124 $admin_message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__( 'Activate Elementor Now', 'ultimate-post-kit' ) ) . '</p>';
125 } else {
126 if ( ! current_user_can( 'install_plugins' ) ) {
127 return;
128 }
129 $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );
130 $admin_message = '<p>' . esc_html__( 'Ops! Ultimate Post Kit not working because you need to install the Elementor plugin', 'ultimate-post-kit' ) . '</p>';
131 $admin_message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__( 'Install Elementor Now', 'ultimate-post-kit' ) ) . '</p>';
132 }
133
134 echo '<div class="error">' . wp_kses_post( $admin_message ) . '</div>';
135 }
136
137 /**
138 * Check the elementor installed or not
139 */
140 if ( ! function_exists( '_is_elementor_installed' ) ) {
141
142 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- established function name relied on across the plugin family / feedback SDK; renaming would break integration.
143 function _is_elementor_installed() {
144 $file_path = 'elementor/elementor.php';
145 $installed_plugins = get_plugins();
146
147 return isset( $installed_plugins[ $file_path ] );
148 }
149 }
150
151
152
153 /**
154 * Review Automation Integration
155 */
156
157 if ( ! function_exists( 'rc_upk_core_plugin' ) ) {
158 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- established function name relied on across the plugin family / feedback SDK; renaming would break integration.
159 function rc_upk_core_plugin() {
160
161 require_once BDTUPK_INC_PATH . 'feedback-hub/start.php';
162
163 rc_dynamic_init( array(
164 'sdk_version' => '1.0.0',
165 'plugin_name' => 'Ultimate Post Kit',
166 'plugin_icon' => BDTUPK_ASSETS_URL . 'images/logo.svg',
167 'slug' => 'ultimate_post_kit_options',
168 'menu' => array(
169 'slug' => 'ultimate_post_kit_options',
170 ),
171 'review_url' => 'https://bdt.to/ultimate-post-kit-elementor-addons-review',
172 'plugin_title' => 'Yay! Great that you\'re using Ultimate Post Kit',
173 'plugin_msg' => '<p>Loved using Ultimate Post Kit on your website? Share your experience in a review and help us spread the love to everyone right now. Good words will help the community.</p>',
174 ) );
175
176 }
177 add_action( 'admin_init', 'rc_upk_core_plugin' );
178 }
179