init($params);
$this->sanitizer = new Sanitizer;
$this->json = new JSONLoader;
}
/**
* Initializes object.
* @param array $params
* @throws Exception
*/
public function init($params)
{
try {
isset($params['var']) ? $this->var = $params['var'] : false;
} catch(Exception $e) {}
}
/**
* Product Meta generation
* @return $string, html.
*/
public function getaproductmeta($productid)
{
$html = '';
$json = $this->json->load_json(self::INVENTORY);
if($json !== null) {
$c = count($json);
if($c >=1) {
for($i=0;$i<$c;$i++) {
if($json[$i]['product.id'] == $productid) {
$html .= '
'.$this->sanitizer->cleaninput($json[$i]['product.title']).'';
$html .= '';
$html .= '';
break;
}
}
}
}
return $html;
}
/**
* Meta generation
* @return $string, html.
*/
public function getmeta($json=self::INVENTORY_PATH . self::SITECONF,$product=false) {
$html = '';
$site = $this->json->load_json($json);
foreach($site as $row)
{
if($row['site.status'] == 'offline') {
header('Location: /offline/', true, 302);
exit;
}
if($row['site.status'] == 'closed') {
header('Location: /closed/', true, 301);
exit;
}
if(isset($row['site.cdn'])) {
$cdn = $this->sanitizer->cleaninput($row['site.cdn']);
}
if($product !=false) {
if($product >=1) {
$html .= $this->getaproductmeta($product);
$html .= '';
$html .= '';
}
} else {
$html .= ''.$this->sanitizer->cleaninput($row['site.title']).'';
$html .= '';
// $html .= '';
$html .= '';
$html .= '';
if(!empty($row['site.updated'])) {
$html .= '';
}
if(!empty($row['site.meta.name.1'])) {
$html .= '';
}
if(!empty($row['site.meta.name.2'])) {
$html .= '';
}
if(!empty($row['site.meta.name.3'])) {
$html .= '';
}
if(!empty($row['site.meta.name.4'])) {
$html .= '';
}
if(!empty($row['site.google.tags'])) {
$html .= '';
}
}
$html .= '';
$html .= '';
$html .= '';
if(!empty($row['site.stylesheet3'])) {
$html .= '';
}
if(!empty($row['site.ext.stylesheet'])) {
$html .= '';
}
$html .= '';
$html .= '';
if(!empty($row['site.ext.javascript'])) {
$html .= '';
}
if(!empty($row['site.logo'])) {
$html .= '
';
}
}
return $html;
}
}
?>