add frontend
This commit is contained in:
55
.gitignore
vendored
Normal file
55
.gitignore
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# Игнорировать папку frontend
|
||||
/frontend/
|
||||
|
||||
# Игнорировать системные файлы macOS
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Игнорировать файлы Windows
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# Игнорировать файлы редакторов
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
*.komodoproject
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Игнорировать файлы сборки и зависимостей
|
||||
/node_modules/
|
||||
/bower_components/
|
||||
|
||||
# Игнорировать файлы логов
|
||||
*.log
|
||||
|
||||
# Игнорировать файлы кэша
|
||||
*.cache
|
||||
|
||||
# Игнорировать временные файлы
|
||||
*.tmp
|
||||
*.temp
|
||||
|
||||
# Игнорировать файлы конфигурации
|
||||
wp-config.php
|
||||
|
||||
# Игнорировать загруженные файлы WordPress
|
||||
/uploads/
|
||||
|
||||
# Игнорировать компилированные файлы (если есть)
|
||||
*.min.css
|
||||
*.min.js
|
||||
|
||||
# Игнорировать файлы резервных копий
|
||||
*~
|
||||
*.bak
|
||||
|
||||
# Игнорировать файлы с секретами (если есть)
|
||||
.env
|
||||
|
||||
# Игнорировать файлы с настройками локальной разработки (если есть)
|
||||
local-config.php
|
||||
@@ -70,18 +70,7 @@ window.yaContextCb.push(()=>{
|
||||
<?php //include get_template_directory().'/blocks/archive.php';?>
|
||||
<?php //include VIJ_CACHE.'archive.html'?>
|
||||
|
||||
<div id="subscript_box">
|
||||
<div id="convert"></div>
|
||||
<div class="right_title"><?=vij_lang('email_title', LANG_VERSION);?></div>
|
||||
|
||||
<div id="subscript-mail">
|
||||
<form class="form-right" action="https://vetandlife.ru/subscript" method="post">
|
||||
<input сlass="frm_mail" type="email" required name="email" placeholder="<?=vij_lang('your_mail', LANG_VERSION);?>">
|
||||
<input type="hidden" name="sender" value="info@vetandlife.ru">
|
||||
<button class="frm_submit"><?=vij_lang('email_btn', LANG_VERSION);?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php get_template_part('partials/formsubscript'); ?>
|
||||
|
||||
<?if (LANG_VERSION == 'ru'):?>
|
||||
|
||||
@@ -322,11 +311,6 @@ document.write('<img src="'+pr+'?uid=18820&ref='+r+'&rd='+rd+'" width="88" heigh
|
||||
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/burger-menu.js?ver=20"></script>
|
||||
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/main-arrow.js?ver=1"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
19
footer.php
19
footer.php
@@ -76,19 +76,9 @@ window.yaContextCb.push(()=>{
|
||||
<?php include get_template_directory().'/blocks/archive.php';?>
|
||||
<?php //include VIJ_CACHE.'archive.html'?>
|
||||
|
||||
<div id="subscript_box">
|
||||
<div id="convert"></div>
|
||||
<div class="right_title"><?=vij_lang('email_title', LANG_VERSION);?></div>
|
||||
<?php get_template_part('partials/formsubscript'); ?>
|
||||
|
||||
|
||||
<div id="subscript-mail">
|
||||
<form class="form-right" action="https://vetandlife.ru/subscript" method="post">
|
||||
<input сlass="frm_mail" type="email" required name="email" placeholder="<?=vij_lang('your_mail', LANG_VERSION);?>">
|
||||
<input type="hidden" name="sender" value="info@vetandlife.ru">
|
||||
<button class="frm_submit"><?=vij_lang('email_btn', LANG_VERSION);?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?if (LANG_VERSION == 'ru'):?>
|
||||
|
||||
<?echo do_shortcode('[custom_ad slot_id="1"]');?>
|
||||
@@ -324,11 +314,6 @@ document.write('<img src="'+pr+'?uid=18820&ref='+r+'&rd='+rd+'" width="88" heigh
|
||||
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/burger-menu.js?ver=19"></script>
|
||||
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/main-arrow.js?ver=1"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
<?php
|
||||
|
||||
if (! defined( 'ABSPATH' )) {
|
||||
exit;
|
||||
}
|
||||
|
||||
ini_set('display_errors','off');
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
|
||||
require_once 'vite.config.php';
|
||||
|
||||
//add jquery
|
||||
function theme_enqueue_scripts() {
|
||||
wp_enqueue_script('jquery');
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'theme_enqueue_scripts', 1);
|
||||
|
||||
|
||||
//setlocale(LC_ALL, 'ru_RU', 'ru_RU.UTF-8', 'ru', 'russian');
|
||||
|
||||
define('IMGURL', 'http://img.vetandlife.ru/');
|
||||
@@ -10,6 +25,7 @@ define("COOK_VALUE", "7896");
|
||||
define('VIJ_CACHE', ABSPATH.'wp-content/themes/vij/cache/');
|
||||
define('BASE_VIJ', ABSPATH.'wp-content/themes/vij/');
|
||||
|
||||
|
||||
define('IMGSERVER', 'https://img.vetandlife.ru/');
|
||||
|
||||
require ABSPATH.'/vendor/autoload.php';
|
||||
@@ -957,3 +973,18 @@ remove_filter( 'the_posts', 'show_draft_post', null, 2 );
|
||||
return $query->_draft_post;
|
||||
}
|
||||
|
||||
function adddr_hash(){
|
||||
|
||||
$key = '378Hjkuhuzv';
|
||||
|
||||
if ( isset($_SERVER['REMOTE_ADDR']) ) {
|
||||
$user_api = $_SERVER['REMOTE_ADDR'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return md5($key.'-'.$user_api);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
14
header.php
14
header.php
@@ -7,16 +7,7 @@
|
||||
<meta name="yandex-verification" content="22f98955910722f8" />
|
||||
<meta name="zen-verification" content="9Ui9YzVJgKUB7bIgRNnAZqdHCNI8v9REm3TDpW0kciEicYyuD640moNznBDbFqcT" />
|
||||
<title><?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?></title>
|
||||
|
||||
<?if (defined('TESTMODE') and TESTMODE == 1):?>
|
||||
<link rel="stylesheet" href="<?php echo get_template_directory_uri();?>/style-test.css?ver=3">
|
||||
<?else:?>
|
||||
<link rel="stylesheet" href="<?php echo get_stylesheet_uri();?>?ver=411">
|
||||
<?endif?>
|
||||
<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet">
|
||||
<!--<link href="<?php echo get_stylesheet_directory_uri()?>/pub/fontawesome.css" rel="stylesheet">-->
|
||||
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/jquery-3.6.0.min.js"></script>
|
||||
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/golos.js"></script>
|
||||
<link href="<?php echo get_stylesheet_directory_uri()?>/pub/fontawesome.css" rel="stylesheet">
|
||||
<meta property="og:title" content="<?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?>" />
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
|
||||
@@ -74,8 +65,7 @@ _tmr.push({id: "3493038", type: "pageView", start: (new Date()).getTime()});
|
||||
</script>
|
||||
<noscript><div><img src="https://top-fwz1.mail.ru/counter?id=3493038;js=na" style="position:absolute;left:-9999px;" alt="Top.Mail.Ru" /></div></noscript>
|
||||
<!-- /Top.Mail.Ru counter -->
|
||||
|
||||
|
||||
<script async src="https://jsn.24smi.net/smi.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
get_header();?>
|
||||
|
||||
get_header();
|
||||
?>
|
||||
|
||||
<div id="content">
|
||||
|
||||
@@ -8,6 +8,7 @@ get_header();?>
|
||||
<div id="fulltext">
|
||||
|
||||
<? // режим подтверждение подписки
|
||||
|
||||
if (isset( $_GET['id'] )){
|
||||
|
||||
$sanitized_id = sanitize_text_field( $_GET['id'] );
|
||||
@@ -18,7 +19,20 @@ if (isset( $_GET['id'] )){
|
||||
echo '<p>Спасибо, мы включили Ваш e-mail!</p>
|
||||
<p>Наши письма могут оказаться в разделе "Рассылки" Вашего почтового приложения или сайта.</p>';
|
||||
|
||||
} elseif (isset($_POST['email'])) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
elseif ( !isset($_POST['subscription_nonce']) || !wp_verify_nonce($_POST['subscription_nonce'], 'subscription_form_nonce') ) {
|
||||
echo ('<p>Неверный запрос. Пожалуйста, повторите попытку.</p>');
|
||||
}
|
||||
|
||||
elseif( !isset($_POST['addrr']) || $_POST['addrr'] !== adddr_hash() ){
|
||||
echo '<p>Не можем опеределить ваши данные. Пожалуйста, повторите попытку.</p>';
|
||||
}
|
||||
|
||||
elseif (isset($_POST['email'])) {
|
||||
|
||||
|
||||
$email = strtolower(trim($_POST['email']));
|
||||
$email = sanitize_text_field($email);
|
||||
|
||||
16
partials/formsubscript.php
Executable file
16
partials/formsubscript.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<div id="subscript_box">
|
||||
<div id="convert"></div>
|
||||
<div class="right_title"><?=vij_lang('email_title', LANG_VERSION);?></div>
|
||||
<div id="subscript-mail">
|
||||
<form class="form-right" action="https://vetandlife.ru/subscript" method="post">
|
||||
<input сlass="frm_mail" type="email" required name="email" placeholder="<?=vij_lang('your_mail', LANG_VERSION);?>">
|
||||
<?php wp_nonce_field('subscription_form_nonce', 'subscription_nonce'); ?>
|
||||
<?$addr = adddr_hash();
|
||||
if ($addr !== null):?>
|
||||
<input type="hidden" name="addrr" value="<?=$addr?>">
|
||||
<?endif?>
|
||||
<input type="hidden" name="sender" value="info@vetandlife.ru">
|
||||
<button class="frm_submit"><?=vij_lang('email_btn', LANG_VERSION);?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
23
single.php
23
single.php
@@ -139,14 +139,25 @@ window.yaContextCb.push(()=>{
|
||||
})
|
||||
</script>
|
||||
|
||||
<?$random_adv = rand(0, 1);
|
||||
|
||||
if ($random_adv == 0):?>
|
||||
<div id="unit_102382"><a href="https://smi2.ru/" >Новости СМИ2</a></div>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
(function() {
|
||||
var sc = document.createElement('script'); sc.type = 'text/javascript'; sc.async = true;
|
||||
sc.src = '//smi2.ru/data/js/102382.js'; sc.charset = 'utf-8';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sc, s);
|
||||
}());
|
||||
</script>
|
||||
(function() {
|
||||
var sc = document.createElement('script'); sc.type = 'text/javascript'; sc.async = true;
|
||||
sc.src = '//smi2.ru/data/js/102382.js'; sc.charset = 'utf-8';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sc, s);
|
||||
}());
|
||||
</script>
|
||||
<?else:?>
|
||||
<div class="smi24__informer smi24__auto" data-smi-blockid="29761"></div>
|
||||
<script>(window.smiq = window.smiq || []).push({});</script>
|
||||
<div class="smi24__informer smi24__auto" data-smi-blockid="29760"></div>
|
||||
<script>(window.smiq = window.smiq || []).push({});</script>
|
||||
<?endif;?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php include get_template_directory().'/blocks/yets.php';?>
|
||||
|
||||
46
vite.config.php
Executable file
46
vite.config.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
#/usr/bin/chromium-browser --ignore-certificate-errors
|
||||
|
||||
if (! defined( 'ABSPATH' )) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// default server address, port, and entry point can be customized in vite.config.js
|
||||
define('VITE_SERVER', 'https://vetandlife.ru:5443'); //http://185.175.44.194:5173/src/main.js
|
||||
define('VITE_ENTRY_POINT', '/src/main.js');
|
||||
|
||||
// Define dist directory, base uri, and path
|
||||
define('DIST_DIR', 'dist');
|
||||
define('DIST_URI', get_template_directory_uri() . '/' . DIST_DIR);
|
||||
define('DIST_PATH', get_template_directory() . '/' . DIST_DIR);
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', function () {
|
||||
|
||||
if (defined('VITE_ENV') && VITE_ENV === 'dev') {
|
||||
function vite_head_module_hook() {
|
||||
echo '<script type="module" crossorigin src="'. VITE_SERVER .'/@vite/client"></script>';
|
||||
echo '<script type="module" crossorigin src="'. VITE_SERVER . VITE_ENTRY_POINT . '"></script>';
|
||||
}
|
||||
add_action( 'wp_head', 'vite_head_module_hook' );
|
||||
} else {
|
||||
|
||||
$fstyle = '/frontend/dist/assets/style.css';
|
||||
$fscript = '/frontend/dist/assets/main.js';
|
||||
|
||||
// Production version
|
||||
$style_ver = filemtime(get_template_directory() . $fstyle);
|
||||
$script_ver = filemtime(get_template_directory() . $fscript);
|
||||
|
||||
wp_enqueue_style('vij-style', get_template_directory_uri() . $fstyle, array(), $style_ver);
|
||||
wp_enqueue_script('vij-script', get_template_directory_uri() . $fscript, array(), $script_ver, 5);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user