我们的网站打开错误(插件激活):
有错误的示例 URL: https ://www.live-karikaturen.ch/downloads/1-august-fahnen-schwingen-nationalfeiertag-schweiz/ https://www.live-karikaturen.ch/webshop-gratisbilder-free-cartoon -comic-images/ https://www.live-karikaturen.ch/downloads/auto-suv-autofan-abgase-umweltverschmutzung/
更新不兼容:我从一个非常旧的 PHP 版本更新到 7.4
我使用这个非常重要的插件,它已经过时了(最近更新 4 年): https ://wordpress.org/support/plugin/creative-commons-configurator-1/
现在我收到这个错误,我认为它可能很容易解决,但我对 PHP 几乎一无所知,但我尝试学习一下,所以提前非常感谢你。
错误: *
警告:preg_match_all():编译失败:转义序列在 /home/clients/f9abb707fe4ac1215fe0f0a9c0b0ae21/www.live-karikaturen-ch/wp-content/plugins/creative-commons-configurator-1/creative 中偏移 18 处的字符类中无效-commons-configurator-1.php 在第 821 行
我在这里从 .php 文件中复制代码
代码:这是第 821 行:
if ( ! preg_match_all( $pattern_images_no_caption, $post_content, $matches ) ) {
return $post_content;
}
代码从第 803 - 828 行(不知道复制行号的人):
function bccl_separate_licensing_on_images_without_caption( $post_content ) {
// Plugin options
$options = get_option('cc_settings');
if ( $options === false || $options['cc_enable_individual_media_licensing'] == '0' ) {
return $post_content;
}
$post = get_queried_object();
if ( apply_filters('bccl_exclude_license', false, $post) ) {
return $post_content;
}
// Pattern that matches images without caption
//$pattern_images_no_caption = '#<p>[\s\R]*(<img [^>]+>)#';
$pattern_images_no_caption = '#<(?:p|h[\d]+)>[\s\R]*(<img [^>]+>)#';
$pattern_images_no_caption = apply_filters('bccl_pattern_match_images_without_caption' , $pattern_images_no_caption);
**if ( ! preg_match_all( $pattern_images_no_caption, $post_content, $matches ) ) {
return $post_content;
}**
//var_dump($matches[1]);
// Iterate over the found images and add licensing metadata
foreach ( $matches[1] as $image_html ) {
有没有一种简单的方法来解决这个错误?
非常感谢您的回答和帮助!