PluginProbe
Ultimate Post Kit / 4.2.1
Ultimate Post Kit v4.2.1
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.2.1, at ultimate-post-kit.php

197 lines 5.8 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.2.1
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.2.1' );
23 define( 'BDTUPK__FILE__', __FILE__ );
24
25 /**
26 * Loads translations
27 *
28 * @return void
29 */
30
31 if ( ! function_exists( 'ultimate_post_kit_load_textdomain' ) ) {
32 function ultimate_post_kit_load_textdomain() {
33 load_plugin_textdomain( 'ultimate-post-kit', false, basename( dirname( __FILE__ ) ) . '/languages' );
34 }
35 add_action( 'init', 'ultimate_post_kit_load_textdomain' );
36 }
37
38
39 if ( ! function_exists( '_is_upk_pro_installed' ) ) {
40
41 function _is_upk_pro_installed() {
42
43 if ( ! function_exists( 'get_plugins' ) ) {
44 require_once ABSPATH . 'wp-admin/includes/plugin.php';
45 }
46
47 $file_path = 'ultimate-post-kit-pro/ultimate-post-kit-pro.php';
48 $installed_plugins = get_plugins();
49
50 return isset( $installed_plugins[ $file_path ] );
51 }
52 }
53
54 if ( ! function_exists( '_is_upk_pro_activated' ) ) {
55
56 function _is_upk_pro_activated() {
57
58 if ( ! function_exists( 'get_plugins' ) ) {
59 require_once ABSPATH . 'wp-admin/includes/plugin.php';
60 }
61
62 $file_path = 'ultimate-post-kit-pro/ultimate-post-kit-pro.php';
63
64 if ( is_plugin_active( $file_path ) ) {
65 return true;
66 }
67
68 return false;
69 }
70 }
71
72 // Load white label configuration if it exists (before defining BDTUPK_TITLE)
73 if ( ! defined( 'BDTUPK_WL' ) ) {
74 if ( get_option( 'upk_white_label_enabled' ) ) {
75 define( 'BDTUPK_WL', true );
76 $white_label_config = dirname( __FILE__ ) . '/admin/white-label/white-label-config.php';
77 if ( file_exists( $white_label_config ) ) {
78 require_once( $white_label_config );
79 }
80 }
81 }
82
83
84
85 // Helper function here
86 require_once ( dirname( __FILE__ ) . '/includes/helper.php' );
87
88 if ( ! _is_upk_pro_activated() ) {
89 require_once BDTUPK_INC_PATH . 'class-pro-widget-map.php';
90 }
91
92 if ( function_exists( 'upk_license_validation' ) && true !== upk_license_validation() ) {
93 require_once BDTUPK_INC_PATH . 'class-pro-widget-map.php';
94 }
95
96 require_once ( dirname( __FILE__ ) . '/includes/utils.php' );
97
98 // Widgets filters here
99 require_once ( BDTUPK_INC_PATH . 'ultimate-post-kit-filters.php' );
100
101
102 /**
103 * Plugin load here correctly
104 * Also loaded the language file from here
105 */
106 function ultimate_post_kit_load_plugin() {
107
108 if ( ! did_action( 'elementor/loaded' ) ) {
109 add_action( 'admin_notices', 'ultimate_post_kit_fail_load' );
110
111 return;
112 }
113
114 require_once( dirname( __FILE__ ) . '/includes/setup-wizard/init.php' );
115
116 // Element pack widget and assets loader
117 require_once ( BDTUPK_PATH . 'loader.php' );
118
119 // Initialize custom CSS/JS injection on frontend
120 add_action( 'wp_head', 'upk_inject_header_custom_code', 999 );
121 add_action( 'wp_footer', 'upk_inject_footer_custom_code', 999 );
122 }
123
124 add_action( 'plugins_loaded', 'ultimate_post_kit_load_plugin' );
125
126
127 /**
128 * Check Elementor installed and activated correctly
129 */
130 function ultimate_post_kit_fail_load() {
131 $screen = get_current_screen();
132 if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) {
133 return;
134 }
135
136 $plugin = 'elementor/elementor.php';
137
138 if ( _is_elementor_installed() ) {
139 if ( ! current_user_can( 'activate_plugins' ) ) {
140 return;
141 }
142 $activation_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin );
143 $admin_message = '<p>' . esc_html__( 'Ops! Ultimate Post Kit not working because you need to activate the Elementor plugin first.', 'ultimate-post-kit' ) . '</p>';
144 $admin_message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__( 'Activate Elementor Now', 'ultimate-post-kit' ) ) . '</p>';
145 } else {
146 if ( ! current_user_can( 'install_plugins' ) ) {
147 return;
148 }
149 $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );
150 $admin_message = '<p>' . esc_html__( 'Ops! Ultimate Post Kit not working because you need to install the Elementor plugin', 'ultimate-post-kit' ) . '</p>';
151 $admin_message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__( 'Install Elementor Now', 'ultimate-post-kit' ) ) . '</p>';
152 }
153
154 echo '<div class="error">' . wp_kses_post( $admin_message ) . '</div>';
155 }
156
157 /**
158 * Check the elementor installed or not
159 */
160 if ( ! function_exists( '_is_elementor_installed' ) ) {
161
162 function _is_elementor_installed() {
163 $file_path = 'elementor/elementor.php';
164 $installed_plugins = get_plugins();
165
166 return isset( $installed_plugins[ $file_path ] );
167 }
168 }
169
170
171
172 /**
173 * Review Automation Integration
174 */
175
176 if ( ! function_exists( 'rc_upk_core_plugin' ) ) {
177 function rc_upk_core_plugin() {
178
179 require_once BDTUPK_INC_PATH . 'feedback-hub/start.php';
180
181 rc_dynamic_init( array(
182 'sdk_version' => '1.0.0',
183 'plugin_name' => 'Ultimate Post Kit',
184 'plugin_icon' => BDTUPK_ASSETS_URL . 'images/logo.svg',
185 'slug' => 'ultimate_post_kit_options',
186 'menu' => array(
187 'slug' => 'ultimate_post_kit_options',
188 ),
189 'review_url' => 'https://bdt.to/ultimate-post-kit-elementor-addons-review',
190 'plugin_title' => 'Yay! Great that you\'re using Ultimate Post Kit',
191 '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>',
192 ) );
193
194 }
195 add_action( 'admin_init', 'rc_upk_core_plugin' );
196 }
197