-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclass-twicpics.php
More file actions
49 lines (43 loc) · 1.21 KB
/
class-twicpics.php
File metadata and controls
49 lines (43 loc) · 1.21 KB
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
<?php
/**
* TwicPics plugin core class
*
* @package TwicPics
*/
defined( 'ABSPATH' ) || die( 'ERROR !' );
/**
* The class for TwicPics plugin front-end
*/
class TwicPics {
/**
* Set required image optimization mode
*/
public function __construct() {
$options = get_option( 'twicpics_options' );
if ( ! isset( $options['user_domain'] ) || empty( $options['user_domain'] ) ) {
return;
}
if ( ! isset( $options['optimization_level'] ) ) {
$options['optimization_level'] = 'script';
}
if ( ! isset( $options['max_width'] ) || empty( $options['max_width'] ) ) {
$options['max_width'] = 2000;
}
if ( ! isset( $options['step'] ) || empty( $options['step'] ) ) {
$options['step'] = 10;
}
if ( ! isset( $options['placeholder_type'] ) ) {
$options['placeholder_type'] = 'blank';
}
if ( isset( $options['optimization_level'] ) ) {
if ( 'api' === $options['optimization_level'] ) {
include 'class-twicpics-api.php';
$twicpics_api = new TwicPicsApi( $options );
} else {
include 'class-twicpics-script.php';
$twicpics_script = new TwicPicsScript( $options );
}
}
load_plugin_textdomain( 'twicpics', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
}