pi-woocommerce-order-date-time-and-type
Last commit date
admin
1 year ago
block
1 year ago
include
1 year ago
public
1 year ago
pi-woocommerce-order-date-time-and-type.php
1 year ago
pisol-dtt.pot
1 year ago
readme.txt
1 year ago
wpml-config.xml
1 year ago
pi-woocommerce-order-date-time-and-type.php
115 lines
| 1 | <?php |
| 2 | /* |
| 3 | Plugin Name: Order date, Order pickup, Order date time, Pickup Location, delivery date for WooCommerce |
| 4 | Plugin URI: https://woo-restaurant.com/ |
| 5 | Description: Set order delivery date, time and type for WooCommerce |
| 6 | Version: 3.0.49.43 |
| 7 | Author: PI Websolution |
| 8 | Author URI: piwebsolution.com |
| 9 | Text Domain: pisol-dtt |
| 10 | WC tested up to: 9.8.5 |
| 11 | */ |
| 12 | defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
| 13 | |
| 14 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 15 | |
| 16 | if(is_plugin_active( 'pi-woocommerce-order-date-time-and-type-pro/pi-woocommerce-order-date-time-and-type-pro.php')){ |
| 17 | |
| 18 | function pisol_dtt_pro_error_notice() { |
| 19 | ?> |
| 20 | <div class="error notice"> |
| 21 | <p><?php esc_html_e( 'You have the pro version of PI WooCommerce order date time and type', 'pisol-dtt' ); ?></p> |
| 22 | </div> |
| 23 | <?php |
| 24 | } |
| 25 | add_action( 'admin_notices', 'pisol_dtt_pro_error_notice' ); |
| 26 | deactivate_plugins(plugin_basename(__FILE__)); |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | /* |
| 31 | Making sure WooCommerce is there |
| 32 | */ |
| 33 | if(!is_plugin_active( 'woocommerce/woocommerce.php')){ |
| 34 | function pisol_dtt_woocommerce_error_notice() { |
| 35 | ?> |
| 36 | <div class="error notice"> |
| 37 | <p><?php esc_html_e( 'Please Install and Activate WooCommerce plugin, without that this plugin cant work', 'pisol-dtt' ); ?></p> |
| 38 | </div> |
| 39 | <?php |
| 40 | } |
| 41 | add_action( 'admin_notices', 'pisol_dtt_woocommerce_error_notice' ); |
| 42 | deactivate_plugins(plugin_basename(__FILE__)); |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Declare compatible with HPOS new order table |
| 48 | */ |
| 49 | add_action( 'before_woocommerce_init', function() { |
| 50 | if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { |
| 51 | \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); |
| 52 | } |
| 53 | } ); |
| 54 | |
| 55 | define('PISOL_DTT_PLUGIN_VERSION', '3.0.49.43'); |
| 56 | define('PISOL_DTT_FREE_RESET_SETTING', false); |
| 57 | define('PISOL_DTT_URL', plugin_dir_url(__FILE__)); |
| 58 | define('PISOL_DTT_PATH', plugin_dir_path( __FILE__ )); |
| 59 | define('PISOL_DTT_BASE', plugin_basename(__FILE__)); |
| 60 | define('PISOL_DTT_PRICE', '$34 Only'); |
| 61 | define('PISOL_DTT_BUY_URL', 'https://www.piwebsolution.com/checkout/?add-to-cart=621&variation_id=679&utm_campaign=data-time&utm_source=website&utm_medium=direct-buy'); |
| 62 | |
| 63 | function pisol_dtt_plugin_link( $links ) { |
| 64 | $links = array_merge( array( |
| 65 | '<a href="' . esc_url( admin_url( '/admin.php?page=pisol-dtt' ) ) . '">' . __( 'Settings', 'pisol-dtt' ) . '</a>', |
| 66 | '<a style="color:#0a9a3e; font-weight:bold;" target="_blank" href="' . esc_url(PISOL_DTT_BUY_URL) . '">' . __( 'Buy PRO Version', 'pisol-dtt' ) . '</a>' |
| 67 | ), $links ); |
| 68 | return $links; |
| 69 | } |
| 70 | add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'pisol_dtt_plugin_link' ); |
| 71 | |
| 72 | /** |
| 73 | * Activation function to redirect to setting page |
| 74 | * |
| 75 | * */ |
| 76 | register_activation_hook( __FILE__, 'pi_free_order_date_time_activation' ); |
| 77 | |
| 78 | function pi_free_order_date_time_activation(){ |
| 79 | add_option('pi_dtt_do_activation_redirect', true); |
| 80 | } |
| 81 | |
| 82 | add_action('admin_init', 'pi_free_order_date_time_redirect'); |
| 83 | function pi_free_order_date_time_redirect(){ |
| 84 | if (get_option('pi_dtt_do_activation_redirect', false)) { |
| 85 | delete_option('pi_dtt_do_activation_redirect'); |
| 86 | if(!isset($_GET['activate-multi'])) |
| 87 | { |
| 88 | wp_redirect("admin.php?page=pisol-dtt"); |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | if ( ! function_exists( 'pisol_dtt_plugins_loaded' ) ) { |
| 94 | function pisol_dtt_plugins_loaded() { |
| 95 | load_plugin_textdomain( 'pisol-dtt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 96 | } |
| 97 | add_action( 'plugins_loaded', 'pisol_dtt_plugins_loaded', 0 ); |
| 98 | } |
| 99 | |
| 100 | |
| 101 | |
| 102 | /** |
| 103 | * Checking Pro version |
| 104 | */ |
| 105 | function pi_dtt_pro_check(){ |
| 106 | return false; |
| 107 | } |
| 108 | |
| 109 | |
| 110 | /* This adds menu link */ |
| 111 | require_once plugin_dir_path( __FILE__ ).'include/includes.php'; |
| 112 | |
| 113 | |
| 114 | |
| 115 |