-
Notifications
You must be signed in to change notification settings - Fork 13
/
uploadcare.php
84 lines (70 loc) · 2.5 KB
/
uploadcare.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
<?php /** @noinspection AutoloadingIssuesInspection */
/**
* @link https://uploadcare.com
* @since 3.0.0
* @package Uploadcare
*
* @wordpress-plugin
* Plugin Name: Uploadcare File Uploader and Adaptive Delivery
* Plugin URI: https://github.com/uploadcare/uploadcare-wordpress
* Description: Upload and store any file of any size from any device or cloud. No more slow downs when serving your images with automatic responsiviness and lazy loading. Improve your WP performance to boost Customer Experience and SEO.
* Version: 3.1.0
* Author: Uploadcare
* Author URI: https://uploadcare.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: uploadcare
* Domain Path: /languages
*/
class Uploadcare_Wordpress_Plugin {
public const UPLOADCARE_VERSION = '3.1.0';
public function __construct() {
if ( ! \defined( 'WPINC' ) ) {
exit();
}
if ( PHP_VERSION_ID < 70400 ) {
exit( "Uploadcare plugin requires PHP version <b>7.4.0+</b>, you've got <b>" . PHP_VERSION . '</b>' );
}
\defined( 'UPLOADCARE_VERSION' ) or \define( 'UPLOADCARE_VERSION', self::UPLOADCARE_VERSION );
$this->init();
$this->run_uploadcare();
}
public function activate_uploadcare(): void {
UcActivator::activate();
}
public function deactivate_uploadcare(): void {
UcDeactivator::deactivate();
}
public function run_uploadcare(): void {
$plugin = new UploadcareMain();
$plugin->run();
}
public function init(): void {
require_once __DIR__ . '/vendor/autoload.php';
\register_activation_hook( __FILE__, [ $this, 'activate_uploadcare' ] );
\register_deactivation_hook( __FILE__, [ $this, 'deactivate_uploadcare' ] );
}
}
/** @noinspection ForgottenDebugOutputInspection */
function ULog( ...$args ) {
if ( ! \is_array( $args ) || empty( $args ) ) {
return;
}
foreach ( $args as $arg ) {
$data = [
"\t[LOG::Ulog]",
"\n",
\var_export( $arg, true ),
"\n",
];
\error_log( \implode( '', $data ) );
}
}
function UploadcareUserAgent(): array {
global $wp_version;
return [
'Uploadcare-wordpress',
\sprintf( '%s,%s', $wp_version, Uploadcare_Wordpress_Plugin::UPLOADCARE_VERSION )
];
}
new Uploadcare_Wordpress_Plugin();