PluginProbe
Caddy – WooCommerce Side Cart & Free Shipping Bar / 1.8
Caddy – WooCommerce Side Cart & Free Shipping Bar v1.8
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.8, at caddy.php

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