| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Instantio - Instant Checkout for WooCommerce |
| 4 |
* Plugin URI: https://wpinstant.io/ |
| 5 |
* Description: WooCommerce Quick Checkout through Side Cart, Floating Cart, Popup Cart & Direct Checkout Button. The whole checkout process would take only 15-25 seconds. Less Cart Abandonment and Better Sales Rate. |
| 6 |
* Author: Themefic |
| 7 |
* Text Domain: instantio |
| 8 |
* Domain Path: /lang/ |
| 9 |
* Author URI: https://themefic.com |
| 10 |
* Tags: woocommerce, direct checkout, floating cart, side cart, ajax cart, cart popup, ajax add to cart, one page checkout, single page checkout, fly cart, mini cart, quick buy, instant checkout, quick checkout, same page checkout, sidebar cart, sticky cart, woocommerce ajax, one click checkout, woocommerce one page checkout, direct checkout woocommerce, woocommerce one click checkout, woocommerce quick checkout, woocommerce express checkout, woocommerce simple checkout, skip cart page woocommerce, woocommerce cart popup, edit woocommerce checkout page, woocommerce direct checkout |
| 11 |
* Version: 2.2.3 |
| 12 |
* WC tested up to: 5.8 |
| 13 |
*/ |
| 14 |
|
| 15 |
// don't load directly |
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
die( '-1' ); |
| 18 |
} |
| 19 |
|
| 20 |
// Define INSTANTIO_VERSION. |
| 21 |
if ( ! defined( 'INSTANTIO_VERSION' ) ) { |
| 22 |
define( 'INSTANTIO_VERSION', '2.2.3' ); |
| 23 |
} |
| 24 |
// INSTANTIO Defines |
| 25 |
define( 'INS_PATH', plugin_dir_path( __FILE__ ) ); |
| 26 |
define( 'INS_ADMIN_PATH', INS_PATH.'admin' ); |
| 27 |
define( 'INS_INC_PATH', INS_PATH.'inc' ); |
| 28 |
define( 'INS_LAYOUTS_PATH', INS_INC_PATH.'/layouts' ); |
| 29 |
define( 'INS_URL', plugin_dir_url( __FILE__ ) ); |
| 30 |
define( 'INS_LAYOUTS_URL', INS_URL.'inc/layouts' ); |
| 31 |
define( 'INS_ASSETS_URL', INS_URL.'assets' ); |
| 32 |
define( 'INS_ADMIN_URL', INS_URL.'admin' ); |
| 33 |
|
| 34 |
/** |
| 35 |
* Including Plugin file for security |
| 36 |
* Include_once |
| 37 |
* |
| 38 |
* @since 1.0.0 |
| 39 |
*/ |
| 40 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 41 |
|
| 42 |
/** |
| 43 |
* plugins_loaded |
| 44 |
* Fires once activated plugins have loaded. |
| 45 |
* Fires early |
| 46 |
*/ |
| 47 |
add_action('plugins_loaded', 'instantio_plugin_loaded_action', 10, 2); |
| 48 |
if ( !function_exists('instantio_plugin_loaded_action') ) { |
| 49 |
function instantio_plugin_loaded_action() { |
| 50 |
|
| 51 |
//Internationalization |
| 52 |
load_plugin_textdomain( 'instantio', false, dirname( plugin_basename(__FILE__) ) . '/lang/' ); |
| 53 |
|
| 54 |
//Redux Framework calling |
| 55 |
if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/admin/redux-core/framework.php' ) ) { |
| 56 |
require_once( dirname( __FILE__ ) . '/admin/redux-core/framework.php' ); |
| 57 |
} |
| 58 |
|
| 59 |
// Load the plugin options |
| 60 |
if ( file_exists( dirname( __FILE__ ) . '/admin/config.php' ) && !defined( 'INSTANTIO_PRO_CONFIG' ) ) { |
| 61 |
require_once dirname( __FILE__ ) . '/admin/config.php'; |
| 62 |
} elseif ( file_exists(plugin_dir_path( __DIR__ ) . 'wooinstant/admin/config.php') && defined( 'INSTANTIO_PRO_CONFIG' ) && defined( 'INSTANTIO_PRO' )) { |
| 63 |
require_once plugin_dir_path( __DIR__ ) . 'wooinstant/admin/config.php'; |
| 64 |
} |
| 65 |
|
| 66 |
//Instantio Functions |
| 67 |
if ( file_exists( dirname( __FILE__ ) . '/inc/functions.php' ) && !defined( 'INSTANTIO_PRO_FUNCTIONS' ) ) { |
| 68 |
require_once dirname( __FILE__ ) . '/inc/functions.php'; |
| 69 |
} |
| 70 |
|
| 71 |
//Instantio Styles & Scripts |
| 72 |
if ( file_exists( dirname( __FILE__ ) . '/inc/style-script.php' ) && !defined( 'INSTANTIO_PRO_SCRIPT' ) ) { |
| 73 |
require_once dirname( __FILE__ ) . '/inc/style-script.php'; |
| 74 |
} |
| 75 |
|
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Notice if WooCommerce is inactive |
| 81 |
*/ |
| 82 |
if ( !function_exists('instantio_is_woocommerce') ) { |
| 83 |
function instantio_is_woocommerce() { |
| 84 |
|
| 85 |
if ( !class_exists( 'WooCommerce' ) && file_exists( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' ) ) { ?> |
| 86 |
|
| 87 |
<div class="notice notice-error"> |
| 88 |
<p><strong><?php esc_attr_e( 'Instantio requires WooCommerce to be activated. ', 'instantio' ); ?> <a href="<?php echo esc_url( admin_url('/plugin-install.php?s=slug:woocommerce&tab=search&type=term') ); ?>"><?php esc_attr_e( 'Activate Now', 'instantio' ); ?></a></strong></p> |
| 89 |
</div> |
| 90 |
|
| 91 |
<?php } elseif ( !class_exists( 'WooCommerce' ) && !file_exists( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' ) ) { ?> |
| 92 |
|
| 93 |
<div class="notice notice-error"> |
| 94 |
<p><strong><?php esc_attr_e( 'Instantio requires WooCommerce to be installed & activated. ', 'instantio' ); ?> <a href="<?php echo esc_url( admin_url('/plugin-install.php?s=slug:woocommerce&tab=search&type=term') ); ?>"><?php esc_attr_e( 'Install Now', 'instantio' ); ?></a></strong></p> |
| 95 |
</div> |
| 96 |
|
| 97 |
<?php } |
| 98 |
|
| 99 |
} |
| 100 |
} |
| 101 |
add_action( 'admin_notices', 'instantio_is_woocommerce' ); |
| 102 |
|
| 103 |
/** |
| 104 |
* |
| 105 |
* Add Pro link in menu. |
| 106 |
* |
| 107 |
*/ |
| 108 |
if ( !is_plugin_active( 'wooinstant/wooinstant.php' ) ) { |
| 109 |
function add_pro_link_menu() { |
| 110 |
$prolink = 'https://wpinstant.io/pricing/?utm_source=plugin_dash&utm_medium=free_plugin&utm_campaign=get_pro'; |
| 111 |
$menuname = '<span style="color:#ffba00;">Upgrade to Pro</span>'; |
| 112 |
add_submenu_page( 'instantio_options', 'Upgrade to Pro', $menuname, |
| 113 |
'manage_options', $prolink); |
| 114 |
} |
| 115 |
add_action('admin_menu', 'add_pro_link_menu', 9999); |
| 116 |
} |
| 117 |
|
| 118 |
/** |
| 119 |
* Add plugin action links. |
| 120 |
* |
| 121 |
* @since 1.0.0 |
| 122 |
* @version 4.0.0 |
| 123 |
*/ |
| 124 |
function instantio_plugin_action_links( $links ) { |
| 125 |
|
| 126 |
$settings_link = array( |
| 127 |
'<a href="admin.php?page=instantio_options">' . esc_html__( 'Settings', 'instantio' ) . '</a>', |
| 128 |
); |
| 129 |
|
| 130 |
if ( !is_plugin_active( 'wooinstant/wooinstant.php' ) ) { |
| 131 |
$gopro_link = array( |
| 132 |
'<a href="https://wpinstant.io/pricing/?utm_source=plugin_dash&utm_medium=free_plugin&utm_campaign=get_pro" target="_blank" style="color:#cc0000;font-weight: bold;text-shadow: 0px 1px 1px hsl(0deg 0% 0% / 28%);">' . esc_html__( 'GO PRO', 'instantio' ) . '</a>', |
| 133 |
); |
| 134 |
} else { |
| 135 |
$gopro_link = array(''); |
| 136 |
} |
| 137 |
return array_merge( $settings_link, $links, $gopro_link ); |
| 138 |
} |
| 139 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'instantio_plugin_action_links' ); |
| 140 |
|
| 141 |
/** remove redux menu under the tools **/ |
| 142 |
add_action( 'admin_menu', 'remove_redux_menu', 12 ); |
| 143 |
function remove_redux_menu() { |
| 144 |
remove_submenu_page('tools.php','redux-framework'); |
| 145 |
} |
| 146 |
|
| 147 |
/** |
| 148 |
* Admin review notice |
| 149 |
*/ |
| 150 |
function ins_admin_rating_notice () { |
| 151 |
$display_status = get_option( 'ins-dismiss' ); |
| 152 |
if ($display_status) { |
| 153 |
?> |
| 154 |
<div id='ins-notice' class="ins-notice notice notice-info"> |
| 155 |
<style> |
| 156 |
.ins-notice { clear: both; overflow: hidden; transition: 0.5s; } |
| 157 |
.ins-notice .dashicons { height: unset; width: unset; font-size: 12px; vertical-align: middle; } |
| 158 |
.ins-notice a { margin-left: 10px; text-decoration: none; cursor: pointer; } |
| 159 |
</style> |
| 160 |
<p style="float: left;">If you like <strong>Instantio</strong> please leave a review</p> |
| 161 |
<p style="float: right;"> |
| 162 |
<a href="//wordpress.org/support/plugin/instantio/reviews/#new-post" target="_blank">Rate Us <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a> |
| 163 |
<a class="maybe-dis">Maybe later</a> |
| 164 |
<a class="done-dis">Already Rated <span class="dashicons dashicons-smiley"></span></a> |
| 165 |
</p> |
| 166 |
</div> |
| 167 |
|
| 168 |
<script> |
| 169 |
jQuery(document).ready(function($) { |
| 170 |
$(document).on('click', '#ins-notice .maybe-dis, #ins-notice .done-dis', function( event ) { |
| 171 |
jQuery('#ins-notice').css('display', 'none') |
| 172 |
data = { |
| 173 |
action : 'disable_ins_notice', |
| 174 |
}; |
| 175 |
|
| 176 |
$.post(ajaxurl, data, function (response) { |
| 177 |
}); |
| 178 |
}); |
| 179 |
}); |
| 180 |
</script> |
| 181 |
|
| 182 |
<?php } |
| 183 |
} |
| 184 |
add_action( 'admin_notices', 'ins_admin_rating_notice' ); |
| 185 |
|
| 186 |
function disable_ins_notice() { |
| 187 |
update_option( 'ins-dismiss', false ); |
| 188 |
wp_die(); |
| 189 |
} |
| 190 |
add_action( 'wp_ajax_disable_ins_notice', 'disable_ins_notice' ); |
| 191 |
|
| 192 |
function set_ins_dismiss() { |
| 193 |
update_option( 'ins-dismiss', true ); |
| 194 |
} |
| 195 |
register_activation_hook( plugin_dir_path( __FILE__ ) . 'instantio.php', 'set_ins_dismiss' ); |
| 196 |
?> |
| 197 |
|