-
Notifications
You must be signed in to change notification settings - Fork 0
/
wc_trustpilot.php
executable file
·90 lines (78 loc) · 2.72 KB
/
wc_trustpilot.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/**
* Trustpilot-reviews
*
* @package Trustpilot-reviews
* @link https://trustpilot.com
*
* @wordpress-plugin
* Plugin Name: Trustpilot-reviews
* Description: Trustpilot-reviews helps Woocommerce store owners generate a ton of reviews for their products.
* Version: 2.5.914
* Author: Trustpilot
* Author URI: https://trustpilot.com
* Text Domain: Trustpilot-reviews
* License: AFL-3.0
* License URI: https://www.afl.org/licenses/afl-3.0.txt
* WC requires at least: 3.0
* WC tested up to: 4.0
*/
namespace Trustpilot\Review;
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
include( plugin_dir_path( __FILE__ ) . './config.php' );
include( plugin_dir_path( __FILE__ ) . './review/api/TrustpilotPluginStatus.php' );
include( plugin_dir_path( __FILE__ ) . './review/api/TrustpilotHttpClient.php' );
include( plugin_dir_path( __FILE__ ) . './review/util/TrustpilotLogger.php' );
include( plugin_dir_path( __FILE__ ) . './helper.php' );
include( plugin_dir_path( __FILE__ ) . './legacy.php' );
define( 'TRUSTPILOT_REVIEWS_VERSION', TRUSTPILOT_PLUGIN_VERSION );
/**
* Autoloader
*
* @param string $class The fully-qualified class name.
*/
spl_autoload_register(
function ( $class ) {
// project-specific namespace prefix
$prefix = __NAMESPACE__;
// base directory for the namespace prefix
$base_dir = __DIR__ . '/review/';
// does the class use the namespace prefix?
$len = strlen( $prefix );
if ( strncmp( $prefix, $class, $len ) !== 0 ) {
// no, move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr( $class, $len );
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';
// if the file exists, require it
if ( file_exists( $file ) ) {
require $file;
}
}
);
/**
* Initialize Plugin
*/
function init() {
$Review = Plugin::get_instance();
$Review_admin = Admin::get_instance();
$Review_orders = Orders::get_instance();
$Review_pastorders = PastOrders::get_instance();
$Review_trustbox = TrustBox::get_instance();
}
add_action( 'plugins_loaded', 'Trustpilot\\Review\\init' );
/**
* Register activation and deactivation hooks
*/
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( 'trustpilot\\review\\Plugin', 'settings_link' ) );
register_activation_hook( __FILE__, array( 'trustpilot\\review\\Plugin', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'trustpilot\\review\\Plugin', 'deactivate' ) );
init();