我们的网站打开错误(插件激活(:
出现错误的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((:编译失败:转义序列为字符类中的偏移量为18英寸时无效/home/clients/f9ab707fe4ac1215fe0f0a9c0b0ae21/www.live-karikaturen-ch/wp-content/plugins/creative-commons-configurator/1creative-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>[sR]*(<img [^>]+>)#';
$pattern_images_no_caption = '#<(?:p|h[d]+)>[sR]*(<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 ) {
有没有一种简单的方法来修复这个错误?
非常感谢您的回答&救命
THAAANK非常感谢你,你太棒了!:(我试过了,它很有效,至少不再有错误了。
FIRST我只是不确定应该采用哪种版本的更正代码。我想没有[],1号也可以。这意味着,正如托托在上面所写的,我用一个简单的\ s替换了[\s\R]。
编号。1.(没有[]
//$pattern_images_no_ccaption='#
\s*(<img[^>]+>(#';$pattern_images_no_caption='#<(?:p|h[\d]+(>\s*(<img[^>]+>(#';
编号。2.(与[]
//$pattern_images_no_caption = '#<p>[s]*(<img [^>]+>)#';
$pattern_images_no_caption = '#<(?:p|h[d]+)>[s]*(<img [^>]+>)#';
SECOND我搜索了整个creative-commons-configurator.php插件代码中的\R,并在第979行进一步找到了这个:
$parts = preg_split('#R#u', $attach`enter code here`ment_data);
这部分的所有行都是这样的:
// Attachment ID
// Unfortunately, WP does not provide enough information in order to determine the attachment ID
// So, first collect all the audio/video media file URLs in $attachments_urls
$attachments_data = get_post_meta( $post->ID, 'enclosure', false );
//var_dump($attachments_data);
$attachments_urls = array();
foreach ( $attachments_data as $attachment_data ) {
$parts = preg_split('#R#u', $attachment_data);
$attachments_urls[] = $parts[0];
}
//var_dump($attachments_urls);
// Then check which media file URL exists in the $atts array so as to
// determine which attachment we are processing currently.
$atts_values = array_values($atts);
//var_dump($atts_values);
// Find the URL of the attachment we are processing
$current_attachment_url = '';
foreach ( $attachments_urls as $attachment_url) {
if ( in_array($attachment_url, $atts_values) ) {
$current_attachment_url = $attachment_url;
break;
}
}
问题:目前我没有收到任何错误,但我想知道这是否会产生一个错误,我必须删除或替换";邪恶;\R?