0
1
Fork 0
hedera-web-mindshore/pages/main/ui.php

73 lines
2.0 KiB
PHP
Raw Normal View History

2017-03-02 10:01:29 +00:00
<?php
$lang = Vn\Lib\Locale::get ();
$result = $db->query('SELECT name, content FROM metatag');
$wpConfig = json_decode (file_get_contents ('webpack.config.json'));
$buildDir = $wpConfig->buildDir;
$devServerPort = $wpConfig->devServerPort;
$host = $_SERVER['SERVER_NAME'];
$assets = new stdClass();
if (!_DEV_MODE)
{
$wpAssets = json_decode (file_get_contents ("$buildDir/webpack-assets.json"));
$manifestJs = $wpAssets->manifest->js;
$mainJs = $wpAssets->main->js;
unset ($wpAssets->manifest);
unset ($wpAssets->main);
foreach ($wpAssets as $name => $asset)
if (property_exists ($asset, 'js'))
$assets->$name = $asset->js;
}
else
{
$devServerPath = "http://$host:$devServerPort/$buildDir";
$manifestJs = "$devServerPath/manifest.js";
$mainJs = "$devServerPath/main.js";
2017-03-02 10:01:29 +00:00
unset ($wpConfig->entry->main);
foreach ($wpConfig->entry as $asset => $files)
$assets->$asset = "$devServerPath/$asset.js";
}
$jsFiles = [];
$jsFiles[] = $manifestJs;
foreach ($assets as $jsFile)
$jsFiles[] = $jsFile;
$jsFiles[] = $mainJs;
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
2015-12-10 23:24:14 +00:00
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no"/>
2016-10-30 22:48:18 +00:00
<meta name="mobile-web-app-capable" content="yes"/>
<link rel="shortcut icon" href="image/favicon/favicon.ico"/>
<link rel="apple-touch-icon" href="image/favicon/apple-touch-icon.png"/>
<link rel="icon" type="image/png" href="image/favicon/favicon.png"/>
<link rel="icon" type="image/svg+xml" href="image/icon.svg" sizes="any"/>
<link rel="manifest" href="manifest.json"/>
<meta name="theme-color" content="#009688"/>
2017-03-02 10:01:29 +00:00
<meta name="content-language" content="<?=$lang?>"/>
<?php while ($row = $result->fetch_object()): ?>
<meta name="<?=$row->name?>" content="<?=$row->content?>"/>
<?php endwhile ?>
<?php foreach ($jsFiles as $js): ?>
<script type="text/javascript" src="<?=$js?>"></script>
<?php endforeach ?>
<title>Verdnatura</title>
</head>
<body></body>
</html>