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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
<?php
class LS_Config {
public static $config = array(); public static $forced = array(); public static $forcedBy = array();
private function __construct() {}
public static function init() {
self::$config = array( 'theme_bundle' => false, 'autoupdate' => true, 'notices' => true, 'promotions' => true, 'purchase_url' => get_option('ls-p-url', 'https://kreaturamedia.com/cart/ls-wp/') ); }
public static function has( $feature ) { return isset( self::$config[ $feature ] ); }
public static function get( $feature ) {
if( isset( self::$config[ $feature ] ) ) { return self::$config[ $feature ]; }
return null; }
public static function set( $keys, $value = null ) {
if( is_string( $keys ) ) { $keys = array( "$keys" => $value ); }
if( is_array( $keys ) ) { foreach( $keys as $key => $val ) { self::$config[ $key ] = $val; } } }
public static function setAsTheme() {
self::set( array( 'theme_bundle' => true, 'autoupdate' => false, 'notices' => false ) ); }
public static function checkCompatibility() {
if( isset( $GLOBALS['lsAutoUpdateBox'] ) && $GLOBALS['lsAutoUpdateBox'] === false ) { self::set('autoupdate', false); } }
public static function forceSettings( $name = 'Unknown', $keys, $value = null ) {
if( is_string( $keys ) ) { $keys = array( "$keys" => $value ); }
if( is_array( $keys) ) { foreach( $keys as $key => $val ) {
if( get_option( 'ls_'.$key ) != $val ) { update_option( 'ls_'.$key, $val ); }
self::$forced[ $key ] = $val; self::$forcedBy[ $key ] = $name; } } }
public static function isActivatedSite() {
$activated = get_option( 'layerslider-authorized-site', false ); $code = trim( get_option( 'layerslider-purchase-code', '' ) );
if( empty( $code ) || ! $activated ) { return false; }
if( get_option( 'layerslider-activated_by_the7', false ) ) { delete_option( 'layerslider-authorized-site' ); delete_option( 'layerslider-purchase-code' ); return false; }
// Test for code length if( strlen( $code ) < 36 ) { return false; }
// Test for pattern preg_match( '/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/', $code, $matches ); if( empty( $matches ) ) { return false; }
return true; } }
|