yith-woocommerce-wishlist
Last commit date
assets
7 years ago
includes
7 years ago
languages
7 years ago
plugin-fw
7 years ago
plugin-options
7 years ago
templates
7 years ago
README.txt
7 years ago
init.php
7 years ago
screenshot-1.png
7 years ago
screenshot-2.png
7 years ago
screenshot-3.png
7 years ago
screenshot-4.png
7 years ago
uninstall.php
7 years ago
wpml-config.xml
7 years ago
init.php
144 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: YITH WooCommerce Wishlist |
| 4 | * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-wishlist/ |
| 5 | * Description: <code><strong>YITH WooCommerce Wishlist</strong></code> gives your users the possibility to create, fill, manage and share their wishlists allowing you to analyze their interests and needs to improve your marketing strategies. |
| 6 | * Version: 2.2.4 |
| 7 | * Author: YITH |
| 8 | * Author URI: https://yithemes.com/ |
| 9 | * Text Domain: yith-woocommerce-wishlist |
| 10 | * Domain Path: /languages/ |
| 11 | * WC requires at least: 2.5.0 |
| 12 | * WC tested up to: 3.5.0 |
| 13 | * |
| 14 | * @author YITHEMES |
| 15 | * @package YITH WooCommerce Wishlist |
| 16 | * @version 2.0.0 |
| 17 | */ |
| 18 | |
| 19 | /* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com) |
| 20 | |
| 21 | This program is free software; you can redistribute it and/or modify |
| 22 | it under the terms of the GNU General Public License, version 2, as |
| 23 | published by the Free Software Foundation. |
| 24 | |
| 25 | This program is distributed in the hope that it will be useful, |
| 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 | GNU General Public License for more details. |
| 29 | |
| 30 | You should have received a copy of the GNU General Public License |
| 31 | along with this program; if not, write to the Free Software |
| 32 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 33 | */ |
| 34 | |
| 35 | if ( ! defined( 'ABSPATH' ) ) { |
| 36 | exit; |
| 37 | } // Exit if accessed directly |
| 38 | |
| 39 | if ( ! function_exists( 'yith_plugin_registration_hook' ) ) { |
| 40 | require_once 'plugin-fw/yit-plugin-registration-hook.php'; |
| 41 | } |
| 42 | register_activation_hook( __FILE__, 'yith_plugin_registration_hook' ); |
| 43 | |
| 44 | if ( ! defined( 'YITH_WCWL' ) ) { |
| 45 | define( 'YITH_WCWL', true ); |
| 46 | } |
| 47 | |
| 48 | if ( ! defined( 'YITH_WCWL_URL' ) ) { |
| 49 | define( 'YITH_WCWL_URL', plugin_dir_url( __FILE__ ) ); |
| 50 | } |
| 51 | |
| 52 | if ( ! defined( 'YITH_WCWL_DIR' ) ) { |
| 53 | define( 'YITH_WCWL_DIR', plugin_dir_path( __FILE__ ) ); |
| 54 | } |
| 55 | |
| 56 | if ( ! defined( 'YITH_WCWL_INC' ) ) { |
| 57 | define( 'YITH_WCWL_INC', YITH_WCWL_DIR . 'includes/' ); |
| 58 | } |
| 59 | |
| 60 | if ( ! defined( 'YITH_WCWL_INIT' ) ) { |
| 61 | define( 'YITH_WCWL_INIT', plugin_basename( __FILE__ ) ); |
| 62 | } |
| 63 | |
| 64 | if ( ! defined( 'YITH_WCWL_FREE_INIT' ) ) { |
| 65 | define( 'YITH_WCWL_FREE_INIT', plugin_basename( __FILE__ ) ); |
| 66 | } |
| 67 | |
| 68 | /* Plugin Framework Version Check */ |
| 69 | if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WCWL_DIR . 'plugin-fw/init.php' ) ) { |
| 70 | require_once( YITH_WCWL_DIR . 'plugin-fw/init.php' ); |
| 71 | } |
| 72 | yit_maybe_plugin_fw_loader( YITH_WCWL_DIR ); |
| 73 | |
| 74 | if( ! function_exists( 'yith_wishlist_constructor' ) ) { |
| 75 | function yith_wishlist_constructor() { |
| 76 | |
| 77 | load_plugin_textdomain( 'yith-woocommerce-wishlist', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 78 | |
| 79 | // Load required classes and functions |
| 80 | require_once( YITH_WCWL_INC . 'functions.yith-wcwl.php' ); |
| 81 | require_once( YITH_WCWL_INC . 'class.yith-wcwl.php' ); |
| 82 | require_once( YITH_WCWL_INC . 'class.yith-wcwl-init.php' ); |
| 83 | require_once( YITH_WCWL_INC . 'class.yith-wcwl-install.php' ); |
| 84 | |
| 85 | if ( is_admin() ) { |
| 86 | require_once( YITH_WCWL_INC . 'class.yith-wcwl-admin-init.php' ); |
| 87 | } |
| 88 | |
| 89 | if ( get_option( 'yith_wcwl_enabled' ) == 'yes' ) { |
| 90 | require_once( YITH_WCWL_INC . 'class.yith-wcwl-ui.php' ); |
| 91 | require_once( YITH_WCWL_INC . 'class.yith-wcwl-shortcode.php' ); |
| 92 | } |
| 93 | |
| 94 | // Let's start the game! |
| 95 | |
| 96 | /** |
| 97 | * @deprecated |
| 98 | */ |
| 99 | global $yith_wcwl; |
| 100 | $yith_wcwl = YITH_WCWL(); |
| 101 | } |
| 102 | } |
| 103 | add_action( 'yith_wcwl_init', 'yith_wishlist_constructor' ); |
| 104 | |
| 105 | if( ! function_exists( 'yith_wishlist_install' ) ) { |
| 106 | function yith_wishlist_install() { |
| 107 | |
| 108 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 109 | require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 110 | } |
| 111 | |
| 112 | if ( ! function_exists( 'WC' ) ) { |
| 113 | add_action( 'admin_notices', 'yith_wcwl_install_woocommerce_admin_notice' ); |
| 114 | } |
| 115 | elseif( defined( 'YITH_WCWL_PREMIUM' ) ) { |
| 116 | add_action( 'admin_notices', 'yith_wcwl_install_free_admin_notice' ); |
| 117 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 118 | } |
| 119 | else { |
| 120 | do_action( 'yith_wcwl_init' ); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | add_action( 'plugins_loaded', 'yith_wishlist_install', 11 ); |
| 125 | |
| 126 | if( ! function_exists( 'yith_wcwl_install_woocommerce_admin_notice' ) ) { |
| 127 | function yith_wcwl_install_woocommerce_admin_notice() { |
| 128 | ?> |
| 129 | <div class="error"> |
| 130 | <p><?php _e( 'YITH WooCommerce Wishlist is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-wishlist' ); ?></p> |
| 131 | </div> |
| 132 | <?php |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | if( ! function_exists( 'yith_wcwl_install_free_admin_notice' ) ){ |
| 137 | function yith_wcwl_install_free_admin_notice() { |
| 138 | ?> |
| 139 | <div class="error"> |
| 140 | <p><?php echo __( 'You can\'t activate the free version of', 'yith-woocommerce-wishlist' ) . 'YITH WooCommerce Wishlist' . __( 'while you are using the premium one.', 'yith-woocommerce-wishlist' ); ?></p> |
| 141 | </div> |
| 142 | <?php |
| 143 | } |
| 144 | } |