PluginProbe
Thim Kit for Elementor – Pre-built Templates & Widgets for Elementor / 1.3.9
Thim Kit for Elementor – Pre-built Templates & Widgets for Elementor v1.3.9
1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.6.1 All 53 releases
thim-elementor-kit / thim-elementor-kit.php

thim-elementor-kit.php in Thim Kit for Elementor – Pre-built Templates & Widgets for Elementor 1.3.9, at thim-elementor-kit.php

255 lines 7.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Thim Elementor Kit
4 * Plugin URI: https://thimpress.com/
5 * Description: It is page builder for the Elementor page builder.
6 * Author: ThimPress
7 * Version: 1.3.9
8 * Author URI: https://thimpress.com
9 * Requires at least: 6.0
10 * Requires PHP: 7.4
11 * Text Domain: thim-elementor-kit
12 * Domain Path: /languages/
13 * Elementor tested up to: 4.0.2
14 */
15
16 use Elementor\Core\Files\Manager as Files_Manager;
17 use Elementor\Plugin;
18
19 defined( 'ABSPATH' ) || exit;
20
21 const THIM_EKIT_PLUGIN_FILE = __FILE__;
22 $default_headers = array(
23 'Version' => 'Version',
24 );
25 $plugin_info = get_file_data( THIM_EKIT_PLUGIN_FILE, $default_headers, 'plugin' );
26 define( 'THIM_EKIT_VERSION', $plugin_info['Version'] );
27 define( 'THIM_EKIT_PLUGIN_PATH', plugin_dir_path( THIM_EKIT_PLUGIN_FILE ) );
28 define( 'THIM_EKIT_PLUGIN_URL', plugin_dir_url( THIM_EKIT_PLUGIN_FILE ) );
29 define( 'THIM_EKIT_PLUGIN_BASE', plugin_basename( THIM_EKIT_PLUGIN_FILE ) );
30 define( 'THIM_EKIT_DEV', false );
31
32 /**
33 * Class Thim Elementor Kits Plugin
34 *
35 * @author Nhamdv from ThimPress <daonham95@gmail.com>
36 */
37 if ( ! class_exists( 'Thim_EL_Kit' ) ) {
38 final class Thim_EL_Kit {
39 protected static $instance = null;
40
41 public function __construct() {
42 if ( ! $this->elementor_is_active() ) {
43 add_action( 'admin_notices', array( $this, 'required_plugins_notice' ) );
44
45 return;
46 }
47
48 if ( defined( 'THIM_EKIT_PRO_VERSION' ) ) {
49 add_action( 'admin_notices', array( $this, 'notice_thim_elementor_kit_pro' ) );
50 }
51
52 $this->includes();
53
54 // Include files, handle on hook init.
55 add_action( 'init', array( $this, 'included_files_when_plugins_loaded' ) );
56
57 // set content is null when save with elementor
58 add_filter(
59 'elementor/editor/after_save',
60 function ( $post_id ) {
61
62 if ( get_post_type( $post_id ) !== 'thim_elementor_kit' ) {
63 return;
64 }
65
66 remove_action( 'elementor/editor/after_save', array( Plugin::$instance->db, 'save_post' ) );
67
68 wp_update_post(
69 array(
70 'ID' => $post_id,
71 'post_content' => '',
72 )
73 );
74 }
75 );
76
77 do_action( 'thim_ekit_loaded' );
78 }
79
80 protected function includes() {
81 // Utilities
82 require_once THIM_EKIT_PLUGIN_PATH . 'inc/utilities/singleton-trait.php';
83 require_once THIM_EKIT_PLUGIN_PATH . 'inc/utilities/class-response.php';
84 require_once THIM_EKIT_PLUGIN_PATH . 'inc/utilities/class-elementor.php';
85 // Group Add Control
86 require_once THIM_EKIT_PLUGIN_PATH . 'inc/utilities/group-control-trait.php';
87 require_once THIM_EKIT_PLUGIN_PATH . 'inc/utilities/login-register-trait.php';
88 require_once THIM_EKIT_PLUGIN_PATH . 'inc/utilities/widget-loop-trait.php';
89
90 // Include
91 require_once THIM_EKIT_PLUGIN_PATH . 'inc/class-dashboard.php';
92 require_once THIM_EKIT_PLUGIN_PATH . 'inc/class-settings.php';
93 require_once THIM_EKIT_PLUGIN_PATH . 'inc/class-post-type.php';
94 require_once THIM_EKIT_PLUGIN_PATH . 'inc/class-enqueue-scripts.php';
95 require_once THIM_EKIT_PLUGIN_PATH . 'inc/class-rest-api.php';
96 require_once THIM_EKIT_PLUGIN_PATH . 'inc/class-shortcode.php';
97 require_once THIM_EKIT_PLUGIN_PATH . 'inc/class-structured-data.php';
98 require_once THIM_EKIT_PLUGIN_PATH . 'inc/class-functions.php';
99
100 // Elementor
101 require_once THIM_EKIT_PLUGIN_PATH . 'inc/elementor/class-elementor.php';
102 require_once THIM_EKIT_PLUGIN_PATH . 'inc/modules/class-cache.php';
103 require_once THIM_EKIT_PLUGIN_PATH . 'inc/modules/class-modules.php';
104
105 // Upgrade.
106 require_once THIM_EKIT_PLUGIN_PATH . 'inc/upgrade/class-init.php';
107 require_once THIM_EKIT_PLUGIN_PATH . 'inc/external-plugin/class-thim-ekit-wpml.php';
108 }
109
110 /**
111 * Include files when plugins loaded.
112 *
113 * @return void
114 * @since 1.2.0
115 */
116 public function included_files_when_plugins_loaded() {
117 $this->load_textdomain();
118 require_once THIM_EKIT_PLUGIN_PATH . 'inc/modules/class-init.php';
119 }
120
121 public function load_textdomain() {
122 load_plugin_textdomain( 'thim-elementor-kit', false, basename( THIM_EKIT_PLUGIN_PATH ) . '/languages' );
123 }
124
125 public function register_activation_hook() {
126 if ( $this->elementor_is_active() ) {
127 if ( Plugin::$instance->files_manager instanceof Files_Manager ) {
128 Plugin::$instance->files_manager->clear_cache();
129 }
130 }
131 }
132
133 public function elementor_is_active() {
134 return defined( 'ELEMENTOR_VERSION' );
135 }
136
137 public function required_plugins_notice() {
138 $screen = get_current_screen();
139
140 if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) {
141 return;
142 }
143
144 $plugin = 'elementor/elementor.php';
145
146 $installed_plugins = get_plugins();
147 $is_elementor_installed = isset( $installed_plugins[ $plugin ] );
148
149 if ( $is_elementor_installed ) {
150 if ( ! current_user_can( 'activate_plugins' ) ) {
151 return;
152 }
153
154 $activation_url = wp_nonce_url(
155 'plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s',
156 'activate-plugin_' . $plugin
157 );
158
159 $message = sprintf(
160 '<p>%s</p>',
161 esc_html__( 'Thim Elementor Kit requires Elementor to be activated.', 'thim-elementor-kit' )
162 );
163 $message .= sprintf(
164 '<p><a href="%s" class="button-primary">%s</a></p>',
165 $activation_url,
166 esc_html__( 'Activate Elementor Now', 'thim-elementor-kit' )
167 );
168 } else {
169 if ( ! current_user_can( 'install_plugins' ) ) {
170 return;
171 }
172
173 $install_url = wp_nonce_url(
174 self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ),
175 'install-plugin_elementor'
176 );
177
178 $message = sprintf(
179 '<p>%s</p>',
180 esc_html__( 'Thim Elementor Kit requires Elementor to be installed.', 'thim-elementor-kit' )
181 );
182 $message .= sprintf(
183 '<p><a href="%s" class="button-primary">%s</a></p>',
184 $install_url,
185 esc_html__( 'Install Elementor Now', 'thim-elementor-kit' )
186 );
187 }
188
189 printf( '<div class="notice notice-error is-dismissible"><p>%s</p></div>', wp_kses_post( $message ) );
190 }
191
192 public function notice_thim_elementor_kit_pro() {
193 if ( ! current_user_can( 'activate_plugins' ) ) {
194 return;
195 }
196
197 // Deactive Thim Elementor Kit Pro.
198 deactivate_plugins( 'thim-elementor-kit-pro/thim-elementor-kit-pro.php' );
199
200 $deactivate_url = wp_nonce_url(
201 admin_url( 'plugins.php?action=deactivate&plugin=thim-elementor-kit-pro/thim-elementor-kit-pro.php' ),
202 'deactivate-plugin_thim-elementor-kit-pro/thim-elementor-kit-pro.php'
203 );
204 ?>
205 <div class="notice notice-error is-dismissible">
206 <p>
207 <?php
208 esc_html_e(
209 'Thim Elementor Kit Pro is merged into Thim Elementor Kit. Please deactivate Thim Elementor Kit Pro to avoid conflicts.',
210 'thim-elementor-kit'
211 );
212 ?>
213 </p>
214 <p><a href="
215 <?php
216 echo esc_url( $deactivate_url );
217 ?>
218 " class="button-primary">
219 <?php
220 esc_html_e( 'Deactivate Thim Elementor Kit Pro', 'thim-elementor-kit' );
221 ?>
222 </a></p>
223 </div>
224 <?php
225 }
226
227 public static function instance() {
228 if ( is_null( self::$instance ) ) {
229 self::$instance = new self();
230 }
231
232 return self::$instance;
233 }
234
235 public function __clone() {
236 _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'thim-elementor-kit' ), '1.0' );
237 }
238
239 public function __wakeup() {
240 _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'thim-elementor-kit' ), '1.0' );
241 }
242 }
243 }
244
245 // Update CSS Print Method in Elementor.
246 register_activation_hook(
247 __FILE__,
248 function () {
249 Thim_EL_Kit::instance()->register_activation_hook();
250 }
251 );
252
253 Thim_EL_Kit::instance();
254
255