| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Sellkit |
| 4 | 4 | * Plugin URI: https://getsellkit.com/ |
| 5 | 5 | * Description: Build unlimited sales funnels, one-click order bumps and upsells, custom thank you pages, and more. The free version of SellKit also offers a huge round of features to optimize your WooCommerce store: build and style single or multi-step checkout pages with advanced styling options. Add, remove & reorder form fields. Fasten the form submission process with pre-populated form data, Instant form validation, and removing cart page. All this and more is 100% free and for an unlimited number of sites. |
| 6 | - * Version: 1.3.2 | |
| 6 | + * Version: 2.3.0 | |
| 7 | 7 | * Author: Artbees |
| 8 | 8 | * Author URI: https://artbees.net |
| 9 | 9 | * Text Domain: sellkit |
| 10 | 10 | * License: GPL2 |
| @@ -122,8 +122,9 @@ | ||
| 122 | 122 | public $sellkit_menus = [ |
| 123 | 123 | 'sellkit-dashboard', |
| 124 | 124 | 'sellkit-funnel', |
| 125 | 125 | 'sellkit-settings', |
| 126 | + 'sellkit-checkout', | |
| 126 | 127 | ]; |
| 127 | 128 | |
| 128 | 129 | /** |
| 129 | 130 | * Has pro plugin or not. |
| @@ -156,13 +157,17 @@ | ||
| 156 | 157 | public function __construct() { |
| 157 | 158 | $this->define_constants(); |
| 158 | 159 | |
| 159 | 160 | $this->load_files( [ |
| 161 | + 'db', | |
| 160 | 162 | 'functions', |
| 163 | + 'funnel/redirect', | |
| 164 | + 'funnel/homepage', | |
| 161 | 165 | 'funnel/analytics/data-updater', |
| 166 | + 'global-checkout/class', | |
| 162 | 167 | 'funnel/class', |
| 168 | + 'funnel/contacts/base-contacts', | |
| 163 | 169 | 'funnel/steps', |
| 164 | - 'db', | |
| 165 | 170 | ] ); |
| 166 | 171 | |
| 167 | 172 | $this->db = new Database(); |
| 168 | 173 | |
| @@ -175,8 +180,10 @@ | ||
| 175 | 180 | |
| 176 | 181 | // Editor script. |
| 177 | 182 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_script' ] ); |
| 178 | 183 | |
| 184 | + add_action( 'requests-curl.before_request', [ $this, 'actions_before_curl_requests' ], 9999 ); | |
| 185 | + | |
| 179 | 186 | // Register activation hook. |
| 180 | 187 | register_activation_hook( __FILE__, array( $this, 'activation' ) ); |
| 181 | 188 | |
| 182 | 189 | if ( ! $this->is_sellkit_screen() ) { |
| @@ -188,8 +195,18 @@ | ||
| 188 | 195 | add_filter( 'admin_body_class', [ $this, 'sellkit_admin_body_class' ] ); |
| 189 | 196 | } |
| 190 | 197 | |
| 191 | 198 | /** |
| 199 | + * Actions before all curl requests. | |
| 200 | + * | |
| 201 | + * @since 1.5.4 | |
| 202 | + * @return void | |
| 203 | + */ | |
| 204 | + public function actions_before_curl_requests() { | |
| 205 | + session_write_close(); | |
| 206 | + } | |
| 207 | + | |
| 208 | + /** | |
| 192 | 209 | * Has sellKit pro. |
| 193 | 210 | * |
| 194 | 211 | * @since 1.1.0 |
| 195 | 212 | */ |
| @@ -220,12 +237,24 @@ | ||
| 220 | 237 | * |
| 221 | 238 | * @since 1.1.0 |
| 222 | 239 | */ |
| 223 | 240 | public function plugins_loaded() { |
| 241 | + if ( 'elementor' === $this->page_builder() ) { | |
| 242 | + $this->load_files( [ | |
| 243 | + 'elementor/class', | |
| 244 | + ] ); | |
| 245 | + } | |
| 246 | + | |
| 224 | 247 | $this->load_files( [ |
| 225 | - 'elementor/class', | |
| 226 | 248 | 'admin/class-promote-sellkit-pro', |
| 227 | 249 | ] ); |
| 250 | + | |
| 251 | + if ( class_exists( 'WooCommerce' ) && 'gutenberg' === $this->page_builder() ) { | |
| 252 | + $this->load_files( [ | |
| 253 | + 'block-editor/helper', | |
| 254 | + 'block-editor/class', | |
| 255 | + ] ); | |
| 256 | + } | |
| 228 | 257 | } |
| 229 | 258 | |
| 230 | 259 | /** |
| 231 | 260 | * Do some stuff on plugin activation. |
| @@ -242,17 +271,28 @@ | ||
| 242 | 271 | |
| 243 | 272 | Install::check_database_tables(); |
| 244 | 273 | |
| 245 | 274 | if ( empty( sellkit_get_option( 'current_db_version' ) ) ) { |
| 246 | - sellkit_update_option( 'current_db_version', '1.2.3' ); // @since 1.2.3 | |
| 275 | + sellkit_update_option( 'current_db_version', '1.2.7' ); // @since 1.5.0 | |
| 247 | 276 | } |
| 248 | 277 | |
| 249 | 278 | if ( ! wp_next_scheduled( 'sellkit_update_rfm_score' ) ) { |
| 250 | 279 | wp_schedule_event( time(), 'twicedaily', 'sellkit_update_rfm_score' ); |
| 251 | 280 | } |
| 281 | + | |
| 282 | + $this->sellkit_installed_time(); | |
| 252 | 283 | } |
| 253 | 284 | |
| 254 | 285 | /** |
| 286 | + * Saves sellkit installation time. | |
| 287 | + * | |
| 288 | + * @since 1.5.9 | |
| 289 | + */ | |
| 290 | + private function sellkit_installed_time() { | |
| 291 | + update_option( 'sellkit-installed-time', time() ); | |
| 292 | + } | |
| 293 | + | |
| 294 | + /** | |
| 255 | 295 | * Adding sellkit class to body. |
| 256 | 296 | * |
| 257 | 297 | * @param string $classes Sellkit the sellkit class. |
| 258 | 298 | * @return string |
| @@ -281,8 +321,9 @@ | ||
| 281 | 321 | 'admin/class-posts', |
| 282 | 322 | 'admin/settings/class-settings', |
| 283 | 323 | 'admin/class-custom-tables', |
| 284 | 324 | 'admin/funnel/class', |
| 325 | + 'admin/class-global-checkout', | |
| 285 | 326 | 'core/install', |
| 286 | 327 | ] ); |
| 287 | 328 | } |
| 288 | 329 | |
| @@ -370,10 +411,8 @@ | ||
| 370 | 411 | sellkit()->version() |
| 371 | 412 | ); |
| 372 | 413 | |
| 373 | 414 | wp_set_script_translations( 'sellkit', 'sellkit', sellkit()->plugin_dir() . 'languages' ); |
| 374 | - | |
| 375 | - $page = sellkit_htmlspecialchars( INPUT_GET, 'page' ); | |
| 376 | 415 | } |
| 377 | 416 | |
| 378 | 417 | /** |
| 379 | 418 | * Register admin menu. |
| @@ -386,8 +425,9 @@ | ||
| 386 | 425 | $initial_page = 'sellkit-dashboard'; |
| 387 | 426 | $submenu = [ |
| 388 | 427 | 'sellkit-dashboard' => esc_html__( 'Dashboard', 'sellkit' ), |
| 389 | 428 | 'sellkit-funnel' => esc_html__( 'Funnels', 'sellkit' ), |
| 429 | + 'sellkit-checkout' => esc_html__( 'Global Checkout', 'sellkit' ), | |
| 390 | 430 | ]; |
| 391 | 431 | |
| 392 | 432 | $submenu = apply_filters( 'sellkit_sub_menu', $submenu ); |
| 393 | 433 | |
| @@ -480,8 +520,9 @@ | ||
| 480 | 520 | 'contactSegmentation' => [ |
| 481 | 521 | 'conditionsOperators' => Operators::$condition_operator_names, |
| 482 | 522 | 'operators' => Operators::$names, |
| 483 | 523 | 'conditionsData' => Conditions::$data, |
| 524 | + 'browserLanguages' => Conditions\Browser_Language::browser_languages_array(), | |
| 484 | 525 | ], |
| 485 | 526 | 'adminUrl' => admin_url(), |
| 486 | 527 | 'url' => site_url(), |
| 487 | 528 | 'timezones' => timezone_identifiers_list(), |
| @@ -492,9 +533,35 @@ | ||
| 492 | 533 | 'funnelsTemplateSource' => Funnel::SELLKIT_FUNNELS_TEMPLATE_SOURCE, |
| 493 | 534 | 'removedContentBoxes' => Sellkit_Admin_Settings::get_removed_content_box(), |
| 494 | 535 | 'sellkitProIsActive' => $this->has_pro, |
| 495 | 536 | 'wcIsActivated' => $this->has_valid_dependencies(), |
| 537 | + 'activeTheme' => wp_get_theme()->get( 'Name' ), | |
| 538 | + 'pageBuilder' => $this->page_builder(), | |
| 496 | 539 | ]; |
| 540 | + } | |
| 541 | + | |
| 542 | + /** | |
| 543 | + * Get page builder. | |
| 544 | + * | |
| 545 | + * @since 2.3.0 | |
| 546 | + * @return string | |
| 547 | + */ | |
| 548 | + public function page_builder() { | |
| 549 | + $default = 'gutenberg'; | |
| 550 | + | |
| 551 | + if ( class_exists( 'Elementor\Plugin' ) ) { | |
| 552 | + $default = 'elementor'; | |
| 553 | + } | |
| 554 | + | |
| 555 | + $page_builder = sellkit_get_option( 'page_builder', '' ); | |
| 556 | + | |
| 557 | + if ( empty( $page_builder ) ) { | |
| 558 | + sellkit_update_option( 'page_builder', $default ); | |
| 559 | + | |
| 560 | + return $default; | |
| 561 | + } | |
| 562 | + | |
| 563 | + return $page_builder; | |
| 497 | 564 | } |
| 498 | 565 | |
| 499 | 566 | /** |
| 500 | 567 | * Get woocommerce settings data. |