class-wpml-page-builder-settings.php
996 Bytes
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
<?php
class WPML_Page_Builder_Settings {
const OPTION_KEY = 'wpml_page_builders_options';
private $settings;
/** @return bool */
public function is_raw_html_translatable() {
return (bool) $this->get_setting( 'translate_raw_html', true );
}
/** @param bool $is_enabled */
public function set_raw_html_translatable( $is_enabled ) {
$this->set_setting( 'translate_raw_html', $is_enabled );
}
/**
* @param string $key
* @param mixed $value
*/
private function set_setting( $key, $value ) {
$this->settings[ $key ] = $value;
}
/**
* @param string $key
* @param mixed $default
*
* @return mixed
*/
private function get_setting( $key, $default = null ) {
if ( null === $this->settings ) {
$this->settings = get_option( self::OPTION_KEY, array() );
}
if ( array_key_exists( $key, $this->settings ) ) {
return $this->settings[ $key ];
}
return $default;
}
public function save() {
update_option( self::OPTION_KEY, $this->settings );
}
}