Как убрать эту ошибку?

vanek64

Участники
Сообщения
1
Реакции
0
Баллы
28
Запрещено публиковать текст ошибок в виде изображений.
Снимок экрана (995).png
помогите паже, скачал всё с этого форума xenforo.info
 
Запрещено публиковать текст ошибок в виде изображений.
vanek64, покажите содержимое файла с ошибки, ради интереса. И ошибки публикуются текстом, ещё раз напоминаю.
 
Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /var/www/wh21606/data/www/forum.wh21606.web3.maze-tech.ru/src/XF/Template/Compiler/Tag/Macro.php on line 3
сам код файла macro.php

[/B] <?php namespace XF\Template\Compiler\Tag; use XF\Template\Compiler\Syntax\Tag; use XF\Template\Compiler; class Macro extends AbstractTag { public function compile(Tag $tag, Compiler $compiler, array $context, $inlineExpected) { $attributes = $tag->attributes; $rawContext = $context; $rawContext['escape'] = false; $argumentContext = $context; $argumentContext['forceEscapePhrase'] = true; $tag->assertAttribute('name'); $arguments = []; foreach ($attributes AS $attribute => $value) { if (preg_match('#^arg-([a-zA-Z0-9_-]+)$#', $attribute, $match)) { if (strpos($match[1], '-') !== false) { throw $tag->exception(\XF::phrase('macro_argument_names_may_only_contain_alphanumeric_underscore')); } $arguments[$match[1]] = $value; } } if ($tag->children) { // defining a macro if (!($attributes['name'] instanceof Compiler\Syntax\Str)) { throw $tag->exception(\XF::phrase('macro_names_must_be_literal_strings')); } $name = $attributes['name']->content; if (!preg_match('#^[a-z0-9_]+$#i', $name)) { // We only enforce this with development on and outside of the install/upgrade system because this // constraint was bugged prior to 2.2. This should avoid end users running into it or upgrades being // blocked because of it. if (\XF::$developmentMode && !(\XF::app() instanceof \XF\Install\App)) { throw $tag->exception(\XF::phrase('macro_name_x_may_only_contain_alphanumeric_underscore', ['name' => $name])); } } $codeParts = []; if (isset($attributes['extends'])) { if (!($attributes['extends'] instanceof Compiler\Syntax\Str)) { throw $tag->exception(\XF::phrase('extension_names_must_be_literal_strings')); } $extends = $attributes['extends']->content; $codeParts[] = "'extends' => " . $compiler->getStringCode($extends); } $globalScope = $compiler->getCodeScope(); $macroScope = new Compiler\CodeScope($compiler->finalVarName, $compiler); $compiler->setCodeScope($macroScope); $currentMacro = $compiler->getCurrentMacro(); $tag->extensions = []; $compiler->setCurrentMacro($tag); if ($arguments) { $arguments = $this->compileAttributesAsArray($arguments, $compiler, $argumentContext); $indent = $compiler->indent(); $argumentsCode = "array(" . implode('', $arguments) . "\n$indent)"; $codeParts[] = "'arguments' => function({$compiler->templaterVariable}, array {$compiler->variableContainer}) { return $argumentsCode; }"; } $compiler->traverseBlockChildren($tag->children, $context); if (!empty($tag->attributes['global'])) { // the presence of this attribute is now treated as the macro being global $codeParts[] = "'global' => true"; } $macroCode = "function({$compiler->templaterVariable}, array {$compiler->variableContainer}, {$compiler->extensionsVariable} = null) { {$compiler->finalVarName} = ''; " . implode("\n", $compiler->getOutput()) . " return {$compiler->finalVarName}; }"; $compiler->setCodeScope($globalScope); $compiler->setCurrentMacro($currentMacro); if ($tag->extensions) { $codeParts[] = "'extensions' => array(" . implode(",\n", $tag->extensions) . ")"; } $codeParts[] = "'code' => $macroCode"; $finalMacroCode = "array(\n" . implode(",\n", $codeParts) . "\n)"; $compiler->defineMacro($name, $finalMacroCode); return ''; } else { // accessing a macro if ($arguments) { $arguments = $this->compileAttributesAsArray($arguments, $compiler, $argumentContext); $indent = $compiler->indent(); $argumentsCode = "array(" . implode('', $arguments) . "\n$indent)"; } else { $argumentsCode = 'array()'; } if (!empty($attributes['args'])) { $argsArrayCode = $compiler->compileForcedExpression($attributes['args'], $argumentContext); $argumentsCode = "{$compiler->templaterVariable}->combineMacroArgumentAttributes({$argsArrayCode}, {$argumentsCode})"; } $name = $attributes['name']->compile($compiler, $rawContext, true); if (empty($attributes['template'])) { $template = 'null'; } else { $template = $attributes['template']->compile($compiler, $rawContext, true); } return "{$compiler->templaterVariable}->callMacro({$template}, {$name}, {$argumentsCode}, {$compiler->variableContainer})"; } } } [B]
 
Последнее редактирование:
Ура я починил, я с другого стиля скинул XF и всё заработало <3
Спасибо за помощь
 
С какого другого стиля? Куда скинули XF?
 
Современный облачный хостинг провайдер | Aéza
Назад
Сверху Снизу