Получил такой файл:
<?php
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.14.1</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.14.1</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
if ( ! defined( '_S_VERSION' ) ) {
define( '_S_VERSION', '1.0.0' );
}
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style( 'm1-style', get_stylesheet_uri(), [], _S_VERSION );
wp_style_add_data( 'm1-style', 'rtl', 'replace' );
//Adding css libs
wp_enqueue_style( 'css-lib-magnific-popup', get_template_directory_uri() . '/assets/libs/magnific-popup/magnific-popup.min.css' );
wp_enqueue_style( 'css-lib-swiper', get_template_directory_uri() . '/assets/libs/swiper/swiper-bundle.min.css' );
//Adding main theme styles
wp_enqueue_style( 'm1-styles', get_template_directory_uri() . '/assets/css/styles.css' );
//Adding js libs
wp_enqueue_script( 'js-lib-magnific-popup', get_template_directory_uri() . '/assets/libs/magnific-popup/jquery.magnific-popup.min.js', [ 'jquery' ], _S_VERSION, true );
wp_enqueue_script( 'js-lib-swiper', get_template_directory_uri() . '/assets/libs/swiper/swiper-bundle.min.js', [ 'jquery' ], _S_VERSION, true );
wp_enqueue_script( 'js-lib-2id', get_template_directory_uri() . '/assets/libs/2id/jquery.malihu.PageScroll2id.min.js', [ 'jquery' ], _S_VERSION, true );
wp_enqueue_script( 'js-lib-maskedinput', get_template_directory_uri() . '/assets/libs/maskedinput/jquery.maskedinput.min.js', [ 'jquery' ], _S_VERSION, true );
//Adding main theme scripts
wp_enqueue_script( 'm1-scripts', get_template_directory_uri() . '/assets/js/dist/scripts.min.js', [ 'jquery' ], _S_VERSION, true );
wp_localize_script( 'm1-scripts', 'Vars', [
'ajaxurl' => admin_url( 'admin-ajax.php' ),
] );
} );
add_action( 'after_setup_theme', 'theme_register_nav_menu' );
function theme_register_nav_menu() {
register_nav_menu( 'primary', 'Primary Menu' );
register_nav_menu( 'menu-footer', 'Footer Menu' );
}
include 'inc/MenuWalker.php';
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
));
}
add_theme_support( 'post-thumbnails' );
add_action( 'wp_ajax_m1_bitrix_add_lead', 'm1_bitrix_add_lead' );
add_action( 'wp_ajax_nopriv_m1_bitrix_add_lead', 'm1_bitrix_add_lead' );
function m1_bitrix_add_lead() {
$queryUrl = 'https://klininggru.bitrix24.ru/rest/414/fc5ip5mk55p307dt/crm.lead.add.json';
$queryData = http_build_query( array(
'fields' => array(
'TITLE' => 'Оставить заявку',
'NAME' => $_POST["name"],
'PHONE' => array(array("VALUE"=>$_POST["phone"], "VALUE_TYPE"=>"WORK" )),
'EMAIL' => array(array("VALUE"=>$_POST["email"], "VALUE_TYPE"=>"WORK" )),
'COMMENTS' => $_POST["comment"],
),
'params' => array( "REGISTER_SONET_EVENT" => "Y" )
) );
$curl = curl_init();
curl_setopt_array( $curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
) );
$result = curl_exec( $curl );
curl_close( $curl );
echo $result;
}
Соответственно постоянно выводилась ошибка из-за того что почему-то html код был в php файле в таком виде, может у кого есть догадки как до такого дошло.
Я первым делом решил убрать html код. И теперь выходит ошибка не syntax error, unexpected '>', а syntax error, unexpected ';' , хотя в первой строке нет ; , я убрал только html и комментарии.
В общем я вообще без понятия что происходило, поэтому нуждаюсь в помощи.
Код после того как убрал html код и комментарии
<?php
if ( ! defined( '_S_VERSION' ) ) {
define( '_S_VERSION', '1.0.0' );
}
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style( 'm1-style', get_stylesheet_uri(), [], _S_VERSION );
wp_style_add_data( 'm1-style', 'rtl', 'replace' );
//Adding css libs
wp_enqueue_style( 'css-lib-magnific-popup', get_template_directory_uri() . '/assets/libs/magnific-popup/magnific-popup.min.css' );
wp_enqueue_style( 'css-lib-swiper', get_template_directory_uri() . '/assets/libs/swiper/swiper-bundle.min.css' );
//Adding main theme styles
wp_enqueue_style( 'm1-styles', get_template_directory_uri() . '/assets/css/styles.css' );
//Adding js libs
wp_enqueue_script( 'js-lib-magnific-popup', get_template_directory_uri() . '/assets/libs/magnific-popup/jquery.magnific-popup.min.js', [ 'jquery' ], _S_VERSION, true );
wp_enqueue_script( 'js-lib-swiper', get_template_directory_uri() . '/assets/libs/swiper/swiper-bundle.min.js', [ 'jquery' ], _S_VERSION, true );
wp_enqueue_script( 'js-lib-2id', get_template_directory_uri() . '/assets/libs/2id/jquery.malihu.PageScroll2id.min.js', [ 'jquery' ], _S_VERSION, true );
wp_enqueue_script( 'js-lib-maskedinput', get_template_directory_uri() . '/assets/libs/maskedinput/jquery.maskedinput.min.js', [ 'jquery' ], _S_VERSION, true );
//Adding main theme scripts
wp_enqueue_script( 'm1-scripts', get_template_directory_uri() . '/assets/js/dist/scripts.min.js', [ 'jquery' ], _S_VERSION, true );
wp_localize_script( 'm1-scripts', 'Vars', [
'ajaxurl' => admin_url( 'admin-ajax.php' ),
] );
} );
add_action( 'after_setup_theme', 'theme_register_nav_menu' );
function theme_register_nav_menu() {
register_nav_menu( 'primary', 'Primary Menu' );
register_nav_menu( 'menu-footer', 'Footer Menu' );
}
include 'inc/MenuWalker.php';
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
));
}
add_theme_support( 'post-thumbnails' );
add_action( 'wp_ajax_m1_bitrix_add_lead', 'm1_bitrix_add_lead' );
add_action( 'wp_ajax_nopriv_m1_bitrix_add_lead', 'm1_bitrix_add_lead' );
function m1_bitrix_add_lead() {
$queryUrl = 'https://klininggru.bitrix24.ru/rest/414/fc5ip5mk55p307dt/crm.lead.add.json';
$queryData = http_build_query( array(
'fields' => array(
'TITLE' => 'Оставить заявку',
'NAME' => $_POST["name"],
'PHONE' => array(array("VALUE"=>$_POST["phone"], "VALUE_TYPE"=>"WORK" )),
'EMAIL' => array(array("VALUE"=>$_POST["email"], "VALUE_TYPE"=>"WORK" )),
'COMMENTS' => $_POST["comment"],
),
'params' => array( "REGISTER_SONET_EVENT" => "Y" )
) );
$curl = curl_init();
curl_setopt_array( $curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
) );
$result = curl_exec( $curl );
curl_close( $curl );
echo $result;
}
этот код выдает ошибку unexpected ';' in functions.php on line 1.