- סטטוס
- נפתר
- דווח עבור
- WPML Multilingual CMS 4.6.13
- נפתר בגרסה
- WPML 4.7.2
- תוסף/ערכת עיצוב קשורים
- Elementor
- תגיות נושא
- ATE, Compatibility
סקירה כללית של התקלה
בעת תרגום עמודים שנוצרו באמצעות Elementor בעזרת עורך התרגום המתקדם (ATE) של WPML, תווים כגון < (קטן מ) או > (גדול מ) מושמטים או מפורשים באופן שגוי כתגיות HTML.
פתרון עוקף
ודא שיש לך גיבוי מלא של האתר לפני שתמשיך.
- פתח את הקובץ …/wp-content/plugins/sitepress-multilingual-cms/classes/xliff/class-wpml-tm-xliff-writer.php.
- חפש את שורה 407.
- החלף את:
private function remove_line_breaks_inside_tags( $string ) { return preg_replace_callback( '/(<[^>]*>)/m', array( $this, 'remove_line_breaks_inside_tag_callback' ), $string ); } /** * @param array $matches * * @return string */ private function remove_line_breaks_inside_tag_callback( array $matches ) { $tag_string = preg_replace( '/([\nr\t ]+)/', ' ', $matches[0] ); $tag_string = preg_replace( '/(<[\s]+)/', '<', $tag_string ); return preg_replace( '/([\s]+>)/', '>', $tag_string ); } - בטקסט הבא:
private function remove_line_breaks_inside_tags( $string ) { // Match only valid HTML tags (opening, closing, or self-closing) return preg_replace_callback( '/(<\/?[a-zA-Z][^<>]*>)/m', array( $this, 'remove_line_breaks_inside_tag_callback' ), $string ); } /** * @param array $matches * * @return string */ private function remove_line_breaks_inside_tag_callback( array $matches ) { // Remove unnecessary spaces and line breaks inside valid HTML tags $tag_string = preg_replace( '/([\nr\t ]+)/', ' ', $matches[0] ); $tag_string = preg_replace( '/(<[\s]+)/', '<', $tag_string ); return preg_replace( '/([\s]+>)/', '>', $tag_string ); }