PluginProbe
Caddy – WooCommerce Side Cart & Free Shipping Bar / 1.9
Caddy – WooCommerce Side Cart & Free Shipping Bar v1.9
3.2.0 3.1.1 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8 1.8.1 1.8.2 1.9 1.9.2 1.9.3 All 46 releases
caddy / caddy.php

caddy.php in Caddy – WooCommerce Side Cart & Free Shipping Bar 1.9, at caddy.php

141 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Caddy - Smart Side Cart for WooCommerce
4 * Plugin URI: https://usecaddy.com
5 * Description: A high performance, conversion-boosting side cart for your WooCommerce store that improves the shopping experience & helps grow your sales.
6 * Version: 1.9
7 * Author: Tribe Interactive
8 * Author URI: https://www.madebytribe.com
9 * License: GPL-2.0+
10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11 * Text Domain: caddy
12 * Domain Path: /languages
13 *
14 * WC requires at least: 3.0
15 * WC tested up to: 5.6.0
16 */
17
18 // If this file is called directly, abort.
19 if ( ! defined( 'WPINC' ) ) {
20 die;
21 }
22
23 /*
24 * Define all constants for the plugin
25 */
26 if ( ! defined( 'CADDY_VERSION' ) ) {
27 define( 'CADDY_VERSION', '1.9' );
28 }
29 if ( ! defined( 'CADDY_PLUGIN_FILE' ) ) {
30 define( 'CADDY_PLUGIN_FILE', __FILE__ );
31 }
32 if ( ! defined( 'CADDY_DIR_URL' ) ) {
33 define( 'CADDY_DIR_URL', untrailingslashit( plugins_url( '/', CADDY_PLUGIN_FILE ) ) );
34 }
35
36 $wc_plugin_flag = false;
37 if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
38 require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
39 }
40
41 if ( is_multisite() ) {
42 // this plugin is network activated - WC must be network activated
43 if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
44 $wc_plugin_flag = is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ? false : true;
45 // this plugin is locally activated - WC can be network or locally activated
46 } else {
47 $wc_plugin_flag = is_plugin_active( 'woocommerce/woocommerce.php' ) ? false : true;
48 }
49 } else { // this plugin runs on a single site
50 $wc_plugin_flag = is_plugin_active( 'woocommerce/woocommerce.php' ) ? false : true;
51 }
52
53 if ( $wc_plugin_flag === true ) {
54 add_action( 'admin_notices', 'caddy_wc_requirements_error' );
55
56 return;
57 }
58
59 /**
60 * If WC requirements are not match
61 */
62 function caddy_wc_requirements_error() {
63 ?>
64 <div class="error notice"><p>
65 <strong><?php _e( 'The WooCommerce plugin needs to be installed and activated in order for Caddy to work properly.', 'caddy' ); ?></strong> <?php _e( 'Please activate WooCommerce to enable Caddy.', 'caddy' ); ?>
66 </p></div>
67 <?php
68 }
69
70 /**
71 * The code that runs during plugin activation.
72 * This action is documented in includes/class-caddy-activator.php
73 */
74 function activate_caddy() {
75 require_once plugin_dir_path( __FILE__ ) . 'includes/class-caddy-activator.php';
76 Caddy_Activator::activate();
77 }
78
79 /**
80 * The code that runs during plugin deactivation.
81 * This action is documented in includes/class-caddy-deactivator.php
82 */
83 function deactivate_caddy() {
84 require_once plugin_dir_path( __FILE__ ) . 'includes/class-caddy-deactivator.php';
85 Caddy_Deactivator::deactivate();
86 }
87
88 register_activation_hook( __FILE__, 'activate_caddy' );
89 register_deactivation_hook( __FILE__, 'deactivate_caddy' );
90
91 /**
92 * The core plugin class that is used to define internationalization,
93 * admin-specific hooks, and public-facing site hooks.
94 */
95 require plugin_dir_path( __FILE__ ) . 'includes/class-caddy.php';
96
97 /**
98 * The plugin class that is used to register and load the cart widget.
99 */
100 require plugin_dir_path( __FILE__ ) . 'includes/class-caddy-cart-widget.php';
101
102 /**
103 * The plugin class that is used to register and load the saved items widget.
104 */
105 require plugin_dir_path( __FILE__ ) . 'includes/class-caddy-saved-items-widget.php';
106
107 /**
108 * Begins execution of the plugin.
109 *
110 * Since everything within the plugin is registered via hooks,
111 * then kicking off the plugin from this point in the file does
112 * not affect the page life cycle.
113 *
114 * @since 1.0.0
115 */
116 function run_caddy() {
117
118 $plugin = new Caddy();
119 $plugin->run();
120
121 }
122
123 run_caddy();
124
125 /**
126 * Add plugin settings link.
127 *
128 * @param $caddy_links
129 *
130 * @return mixed
131 */
132 function caddy_add_settings_link( $caddy_links ) {
133
134 $caddy_links = array_merge( array( '<a href="' . esc_url( admin_url( '/admin.php?page=caddy&amp;tab=settings' ) ) . '">' . __( 'Settings', 'caddy' ) . '</a>' ), $caddy_links );
135
136 return $caddy_links;
137 }
138
139 $caddy_plugin = plugin_basename( __FILE__ );
140 add_filter( "plugin_action_links_$caddy_plugin", 'caddy_add_settings_link' );
141