-
Notifications
You must be signed in to change notification settings - Fork 7
/
Woocommerce_Catalog_Enquiry.php
executable file
·72 lines (66 loc) · 3.58 KB
/
Woocommerce_Catalog_Enquiry.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Plugin Name: WC Catalog Enquiry
* Plugin URI: https://multivendorx.com/
* Description: Convert your WooCommerce store into a catalog website in a click
* Author: MultiVendorX
* Version: 4.0.9
* Author URI: https://multivendorx.com/
* WC requires at least: 4.2
* WC tested up to: 7.1.0
* Text Domain: woocommerce-catalog-enquiry
* Domain Path: /languages/
*/
if ( ! class_exists( 'Woocommerce_Catalog_Enquiry_Dependencies' ) )
require_once trailingslashit(dirname(__FILE__)).'includes/class-woocommerce-catalog-enquiry-dependencies.php';
require_once trailingslashit(dirname(__FILE__)).'includes/woocommerce-catalog-enquiry-core-functions.php';
require_once trailingslashit(dirname(__FILE__)).'woocommerce-catalog-enquiry-config.php';
if(!defined('ABSPATH')) exit; // Exit if accessed directly
if(!defined('WOOCOMMERCE_CATALOG_ENQUIRY_PLUGIN_TOKEN')) exit;
if(!defined('WOOCOMMERCE_CATALOG_ENQUIRY_TEXT_DOMAIN')) exit;
if(!Woocommerce_Catalog_Enquiry_Dependencies::woocommerce_active_check()) {
add_action( 'admin_notices', 'woocommerce_catalog_enquiry_alert_notice' );
}
// Migration at activation hook
register_activation_hook(__FILE__, 'woocommerce_catalog_enquiry_option_migration_3_to_4');
// Update time migration
add_action( 'upgrader_process_complete', 'woocommerce_catalog_enquiry_option_migration_3_to_4' );
/**
* Plugin page links
*/
function woocommerce_catalog_enquiry_plugin_links( $links ) {
$plugin_links = array(
'<a href="' . admin_url( 'admin.php?page=woo-catalog' ) . '">' . __( 'Settings', WOOCOMMERCE_CATALOG_ENQUIRY_TEXT_DOMAIN ) . '</a>',
'<a href="https://multivendorx.com/support-forum/forum/wcmp-catalog-enquiry/">' . __( 'Support', WOOCOMMERCE_CATALOG_ENQUIRY_TEXT_DOMAIN ) . '</a>',
);
$links = array_merge( $plugin_links, $links );
if ( apply_filters( 'woocommerce_catalog_enquiry_free_active', true ) ) {
$links[] = '<a href="https://multivendorx.com/product/woocommerce-catalog-enquiry-pro/" target="_blank">' . __( 'Upgrade to Pro', WOOCOMMERCE_CATALOG_ENQUIRY_TEXT_DOMAIN ) . '</a>';
}
return $links;
}
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'woocommerce_catalog_enquiry_plugin_links' );
add_filter( 'plugin_row_meta', 'plugin_row_meta', 10, 2 );
function plugin_row_meta( $links, $file ) {
if($file == 'woocommerce-catalog-enquiry/Woocommerce_Catalog_Enquiry.php' && apply_filters( 'woocommerce_catalog_enquiry_free_active', true )){
$row_meta = array(
'pro' => '<a href="https://multivendorx.com/product/woocommerce-catalog-enquiry-pro/" title="' . esc_attr( __( 'Upgrade to Pro', WOOCOMMERCE_CATALOG_ENQUIRY_TEXT_DOMAIN ) ) . '">' . __( 'Upgrade to Pro', WOOCOMMERCE_CATALOG_ENQUIRY_TEXT_DOMAIN ) . '</a>'
);
return array_merge( $links, $row_meta );
}else{
return $links;
}
}
/*if(!Woocommerce_Catalog_Enquiry_Dependencies::woocommerce_catalog_enquiry_pro_active_check()) {*/
if(!class_exists('Woocommerce_Catalog_Enquiry')) {
require_once( trailingslashit(dirname(__FILE__)).'classes/class-woocommerce-catalog-enquiry.php' );
global $Woocommerce_Catalog_Enquiry;
$Woocommerce_Catalog_Enquiry = new Woocommerce_Catalog_Enquiry( __FILE__ );
$GLOBALS['Woocommerce_Catalog_Enquiry'] = $Woocommerce_Catalog_Enquiry;
}
//}
add_action ( 'before_woocommerce_init', function () {
if ( class_exists ( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility ( 'custom_order_tables', WP_CONTENT_DIR.'/plugins/woocommerce-catalog-enquiry/Woocommerce_Catalog_Enquiry.php', true );
}
});