Resident234
@Resident234
Back-End . PHP . Bitrix

Ошибка Parse error: syntax error, unexpected end of file in, что делать?

Доброго дня.
Ловлю ошибку
Parse error: syntax error, unexpected end of file in /public_html/personal/includes/head.php on line 188

листинг файла head.php :
<?php
/**
 * Created by PhpStorm.
 * User: GSU
 * Date: 25.06.2017
 * Time: 0:50
 */

$templateDirectory =  str_replace($_SERVER['DOCUMENT_ROOT'], "", get_template_directory());


if($_GET["mode"] == "private"){

    $_SESSION["mode"] = "private";
    header('Location: /');

}else{
    if(!isset($_SESSION["mode"])) {
        $_SESSION["mode"] = "public";
    }
}

$categoryId = PORTFOLIO_WP_CATEGORY_PROJECTS_ID;
global $wpdb;
$wpdb->set_prefix('portfolio_');

unset($arProjectsIDs);

$args = array(
    'numberposts' => 1000,
    'category' => $categoryId,
    'orderby' => 'meta_value_num',//meta_value_ORDER
    'order' => 'ASC',
    'include' => array(),
    'exclude' => array(),
    'meta_key' => 'ORDER',
    'meta_value' => '',
    'post_type' => 'post',
    'suppress_filters' => true
);

$posts = get_posts($args);
unset($arAllProjectsMockups);
foreach ($posts as $post) {

    $private = get_post_meta($post->ID, 'PRIVATE');

    //?mode=private
    if((!isset($_SESSION["mode"]) || ($_SESSION["mode"] != "private")) &&
        ($private[0] == "1")) continue;

    setup_postdata($post);

    $arProjectsIDs[] = $post->ID;

    //$arAllProjectsMockups[]

    $gal = get_post_gallery($post->ID, false);
    $arIDs = explode(',', $gal['ids']);

    foreach ($arIDs as $keyImageID => $itemImageID) {

        $arMetaImage = wp_get_attachment_metadata($itemImageID);

        $thumb_img = get_post($itemImageID);

        if ($thumb_img->post_excerpt == "PERSONAL_MOCKUP") {

            $arAllProjectsMockups[] = PORTFOLIO_WP_UPLOAD_DIR_URL . "" . $arMetaImage["file"];

        }




    }




}

wp_reset_postdata();

require_once ABSPATH . 'wp-admin/includes/file.php';

unset($arDetailTemplates);
$files = list_files( ABSPATH . "detail/" );
foreach($files as $file){
    $arFile = explode("/", $file);
    $fileName = $arFile[count($arFile) - 1];
    //$filetype = wp_check_filetype($fileName);
    //$fileName = str_replace($filetype['ext'], "", $fileName);
    $arDetailTemplates[] = $fileName;
}

$categoryId = PORTFOLIO_WP_TEXT_1_ID;

$args = array(
    'numberposts' => 50,
    'category' => $categoryId,
    'orderby' => 'rand',
    'order' => 'ASC',
    'include' => array(),
    'exclude' => array(),
    'meta_key' => '',
    'meta_value' => '',
    'post_type' => 'post',
    'suppress_filters' => true,
    // подавление работы фильтров изменения SQL запроса
);

$posts = get_posts($args);

unset($currentDetailTitle);
unset($currentDetailDescription);
foreach ($posts as $post) {
    setup_postdata($post);


    $currentDetailTitle[] = $post->post_title;
    $currentDetailDescription[] = $post->post_content;

}



$categoryId = PORTFOLIO_WP_STOCK_FOTOS_ID;

$args = array(
    'numberposts' => 20,
    'category' => $categoryId,
    'orderby' => 'rand',
    'order' => 'ASC',
    'include' => array(),
    'exclude' => array(),
    'meta_key' => '',
    'meta_value' => '',
    'post_type' => 'post',
    'suppress_filters' => true,
    // подавление работы фильтров изменения SQL запроса
);

$posts = get_posts($args);

//unset($arSkills);
foreach ($posts as $post) {
    setup_postdata($post);

    $currentBackgroundImage[] = $post->post_title;

}


wp_reset_postdata();


$categoryId = PORTFOLIO_WP_STOCK_FOTOS_DARK_ID;

$args = array(
    'numberposts' => 20,
    'category' => $categoryId,
    'orderby' => 'rand',
    'order' => 'ASC',
    'include' => array(),
    'exclude' => array(),
    'meta_key' => '',
    'meta_value' => '',
    'post_type' => 'post',
    'suppress_filters' => true,
    // подавление работы фильтров изменения SQL запроса
);

$posts = get_posts($args);

//unset($arSkills);
foreach ($posts as $post) {
    setup_postdata($post);

    $currentBackgroundDarkImage[] = $post->post_title;

}


wp_reset_postdata();


include $_SERVER['DOCUMENT_ROOT'] . '/includes/head_functions.php'; //проблемная строка 188


- т.е. ругается на инклуд в конце файл, если его закомментировать, то всё ок
  • Вопрос задан
  • 1440 просмотров
Пригласить эксперта
Ответы на вопрос 2
@AndreyBLG
Очевидно вопрос неактуален, но может кому-то пригодится.
Поищите в файле с ошибкой (либо подключаемом файле, как у автора вопроса) открывающий тег php - "<?" и замените его на полный - "<?php"
Ответ написан
Комментировать
HectorPrima
@HectorPrima
программист
Перевод строки в конце добавить или закрывающая фигурная скобка где-то забыта в head_functions.php
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы