| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Social Share for WooCommerce |
| 4 |
* Plugin URI: https://wordpress.org/plugins/product-share/ |
| 5 |
* Description: Display social icons on the different spots of product pages to share your WooCommerce product on social media. |
| 6 |
* Author: WPXtension |
| 7 |
* Version: 1.2.23 |
| 8 |
* Domain Path: /languages |
| 9 |
* Requires at least: 5.5 |
| 10 |
* Tested up to: 7.0 |
| 11 |
* Requires PHP: 7.3 |
| 12 |
* WC requires at least: 5.5 |
| 13 |
* WC tested up to: 10.8.1 |
| 14 |
* Text Domain: product-share |
| 15 |
* Author URI: https://wpxtension.com |
| 16 |
* License: GPLv2 or later |
| 17 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 18 |
*/ |
| 19 |
|
| 20 |
defined( 'ABSPATH' ) or die( 'Keep Silent' ); |
| 21 |
|
| 22 |
if ( ! defined( 'PRODUCT_SHARE_PLUGIN_FILE' ) ) { |
| 23 |
define( 'PRODUCT_SHARE_PLUGIN_FILE', __FILE__ ); |
| 24 |
} |
| 25 |
|
| 26 |
// Include the main class. |
| 27 |
if ( ! class_exists( 'Product_Share', false ) ) { |
| 28 |
require_once dirname( __FILE__ ) . '/includes/class-product-share.php'; |
| 29 |
} |
| 30 |
|
| 31 |
// Require woocommerce admin message |
| 32 |
function product_share_wc_requirement_notice() { |
| 33 |
|
| 34 |
if ( ! class_exists( 'WooCommerce' ) ) { |
| 35 |
printf( '<div class="%1$s"><p>%2$s <a class="thickbox open-plugin-details-modal" href="%3$s"><strong>%4$s</strong></a></p></div>', |
| 36 |
'notice notice-error', |
| 37 |
wp_kses( __( "<strong>Social Share for WooCommerce</strong> is an add-on of ", 'product-share' ), array( 'strong' => array() ) ), |
| 38 |
esc_url( add_query_arg( array( |
| 39 |
'tab' => 'plugin-information', |
| 40 |
'plugin' => 'woocommerce', |
| 41 |
'TB_iframe' => 'true', |
| 42 |
'width' => '640', |
| 43 |
'height' => '500', |
| 44 |
), admin_url( 'plugin-install.php' ) ) ), |
| 45 |
esc_html__( 'WooCommerce', 'product-share' ) |
| 46 |
); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
add_action( 'admin_notices', 'product_share_wc_requirement_notice' ); |
| 51 |
|
| 52 |
|
| 53 |
/** |
| 54 |
* Returns the main instance. |
| 55 |
*/ |
| 56 |
|
| 57 |
function product_share() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid |
| 58 |
|
| 59 |
if ( ! class_exists( 'WooCommerce', false ) ) { |
| 60 |
return false; |
| 61 |
} |
| 62 |
|
| 63 |
if ( function_exists( 'product_share_pro' ) ) { |
| 64 |
return product_share_pro(); |
| 65 |
} |
| 66 |
|
| 67 |
return Product_Share::instance(); |
| 68 |
} |
| 69 |
|
| 70 |
add_action( 'plugins_loaded', 'product_share' ); |
| 71 |
|
| 72 |
// HPOS compatibility for Product Share |
| 73 |
function product_share_hpos_compatibility() { |
| 74 |
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { |
| 75 |
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
add_action( 'before_woocommerce_init', 'product_share_hpos_compatibility' ); |