class-wpml-st-admin-string.php
752 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
<?php
/**
* WPML_ST_Admin_String class
*/
class WPML_ST_Admin_String extends WPML_ST_String {
/**
* @var string $name
*/
private $name;
/**
* @var string $value
*/
private $value;
/**
* @param string $new_value
*/
public function update_value( $new_value ) {
$this->fetch_name_and_value();
if ( md5( $this->value ) !== $this->name ) {
$this->value = $new_value;
$this->set_property( 'value', $new_value );
$this->update_status();
}
}
private function fetch_name_and_value() {
if ( is_null( $this->name ) || is_null( $this->value ) ) {
$res = $this->wpdb->get_row(
'SELECT name, value ' . $this->from_where_snippet()
);
$this->name = $res->name;
$this->value = $res->value;
}
}
}