Татьяна5 писал(а): 19.12.2023 13:08
Можно тем же total commander'ом во всех сразу расширениях поискать эту строку
Пользуюсь FileZilla Client. Но там нет удалённой проверки содержимого на прямую на сервере. Придётся скачать все расширения на ПК и проверять локально где это событие.
Отправлено спустя 18 минут 47 секунд:
И так результат:
Код: Выделить всё
Поиск "core.viewtopic_modify_post_data" (найдено 5 совпадений в 5 файлах из 4867)
D:\Файлы\ext\alfredoramos\seometadata\event\listener.php (совпадений: 1)
Строка 42: 'core.viewtopic_modify_post_data' => 'viewtopic'
D:\Файлы\ext\bb3mobi\seodesc\event\listener.php (совпадений: 1)
Строка 36: 'core.viewtopic_modify_post_data' => 'viewtopic_description',
D:\Файлы\ext\canidev\reactions\event\listener.php (совпадений: 1)
Строка 89: 'core.viewtopic_modify_post_data' => 'viewtopic_modify_data',
D:\Файлы\ext\ppk\bb3hide\event\listener.php (совпадений: 1)
Строка 100: 'core.viewtopic_modify_post_data' => 'bb3hide_get_posts_data',
D:\Файлы\ext\ppk\phpbb3fixes\event\listener.php (совпадений: 1)
Строка 89: 'core.viewtopic_modify_post_data' => 'display_topic_views',
Отправлено спустя 54 минуты 9 секунд:
Ошибку вызывает расширение seometadata.
Исправленный файл listener.php
Код: Выделить всё
<?php
/**
* SEO Metadata extension for phpBB.
* @author Alfredo Ramos <alfredo.ramos@yandex.com>
* @copyright 2018 Alfredo Ramos
* @license GPL-2.0-only
*/
namespace alfredoramos\seometadata\event;
use alfredoramos\seometadata\includes\helper;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class listener implements EventSubscriberInterface
{
/** @var helper */
protected $helper;
/**
* Listener constructor.
*
* @param helper $helper
*
* @return void
*/
public function __construct(helper $helper)
{
$this->helper = $helper;
}
/**
* Assign functions defined in this class to event listeners in the core.
*
* @return array
*/
static public function getSubscribedEvents()
{
return [
'core.page_header_after' => 'page_header',
'core.viewforum_modify_page_title' => 'viewforum',
'core.viewtopic_modify_post_data' => 'viewtopic'
];
}
/**
* Assign default template variables.
*
* @param object $event
*
* @return void
*/
public function page_header($event)
{
$this->helper->set_metadata([
'title' => $event['page_title']
]);
$this->helper->metadata_template_vars();
}
/**
* Assign forum template variables.
*
* @param object $event
*
* @return void
*/
public function viewforum($event)
{
// Meta data helper
$data = [
'description' => $event['forum_data']['forum_desc'],
'image' => $this->helper->forum_image(
$event['forum_data']['forum_image'],
$event['forum_data']['forum_id']
)
];
$this->helper->set_metadata($data);
}
/**
* Assign topic template variables.
*
* @param object $event
*
* @return void
*/
public function viewtopic($event)
{
// Meta data helper
$data = [];
// Helpers
$first_post_id = $event['topic_data']['topic_first_post_id'];
$post_id = $first_post_id;
$data['title'] = $event['topic_data']['topic_title'];
$data['author'] = $event['topic_data']['topic_first_poster_name'];
$data['published_time'] = (int) $event['topic_data']['topic_time'];
$data['section'] = $event['topic_data']['forum_name'];
// Extract description
if ($this->helper->check_replies() && $this->helper->is_reply($event['post_list'], $first_post_id, $post_id))
{
$data['description'] = $this->helper->extract_description($post_id);
}
else if ((int) $event['start'] > 0)
{
$data['description'] = $this->helper->extract_description(array_keys($event['rowset'])[0]);
}
else
{
if (isset($event['rowset'][$first_post_id])) {
$data['description'] = $event['rowset'][$first_post_id]['post_text'];
} else {
// Handle the case where the key does not exist
$data['description'] = 'Default description or other logic';
}
}
// Extract image
$data['image'] = $this->helper->extract_image(
$data['description'],
$post_id,
$event['topic_data']['forum_id']
);
$this->helper->set_metadata($data);
}
}
Теперь всё работает. Спасибо за помощь.
