Item.php
1.7 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
class PRG_Ship_Item {
private $userData;
public function __construct() {
}
public function getMandant() {
global $wpdb;
$sqlUserData = $wpdb->prepare("SELECT * FROM `{$wpdb->prefix}b2s_user_contact` WHERE `blog_user_id` = %d", B2S_PLUGIN_BLOG_USER_ID);
$this->userData = $wpdb->get_row($sqlUserData);
return $this->userData;
}
public function getCountryHtml() {
$countries = simplexml_load_string(PRG_Api_Get::get(B2S_PLUGIN_PRG_API_ENDPOINT . 'get.php?action=getCountry'));
$prgKeyName = 'titel_' . substr(B2S_LANGUAGE, 0, 2);
$content = '';
foreach ($countries as $val) {
$content .= '<option value="' . esc_attr($val->tag) . '"';
if (isset($this->userData->land_presse) && !empty($this->userData->land_presse)) {
if ($val->tag == $this->userData->land_presse) {
$content .= ' selected="selected"';
}
} else {
//default
if ($val->tag == "US") {
$content .= ' selected="selected"';
}
}
$content .= '>' . esc_html($val->$prgKeyName) . '</option>' . PHP_EOL;
}
return $content;
}
public function getCategoryHtml() {
$cats = simplexml_load_string(PRG_Api_Get::get(B2S_PLUGIN_PRG_API_ENDPOINT . 'get.php?action=getCategory'));
$prgKeyName = 'titel_' . substr(B2S_LANGUAGE, 0, 2);
$content = '';
foreach ($cats as $val) {
$content .= '<option value="' . esc_attr($val->id) . '">' . esc_html($val->$prgKeyName) . '</option>' . PHP_EOL;
}
return $content;
}
}