find( 'body' ) as $element ) { if ( ! empty( $element->class ) ) { $element->class = $element->class . ' wplingua-list'; } else { $element->class = 'wplingua-list'; } } /** * Add list assets */ $asset_url = add_query_arg( 'ver', WPLNG_PLUGIN_VERSION, plugins_url() . '/wplingua/assets/css/list.css' ); $asset = 'find( 'head' ) as $element ) { $element->innertext = $element->innertext . $asset; } /** * Switcher */ $language_website = wplng_get_language_by_id( $args['language_source'] ); $language_current_id = $args['language_target']; $languages_target = wplng_get_languages_target(); if ( empty( $languages_target ) ) { return $dom; } $class = wplng_get_switcher_class( array( 'theme' => 'grey-simple-smooth', 'style' => 'dropdown', 'flags' => 'rectangular', 'title' => 'name', ) ); // Create the switcher HTML $html_switcher = '
'; $html_switcher .= '
'; $html_switcher .= '
'; $html_switcher .= '
'; // Create link for each target languages foreach ( $languages_target as $language_target ) { $url = wplng_get_url_current_for_language( $language_target['id'] ); if ( $language_target['id'] === $language_current_id ) { continue; } $html_switcher .= 'find( 'title' ) as $element ) { $seo_title = wplng_text_esc( $element->innertext ); break; } foreach ( $dom->find( 'meta[name="description"]' ) as $element ) { if ( isset( $element->attr['content'] ) ) { $seo_description = wplng_text_esc( $element->attr['content'] ); break; } } foreach ( $translations as $key => $translation ) { if ( empty( $translation['post_id'] ) || empty( $translation['source'] ) || empty( $translation['translation'] ) ) { continue; } if ( $seo_title === $translation['translation'] ) { $translation_seo_title = $translation; $translation_seo_title['tag'] = __( 'SEO - Title:', 'wplingua' ); unset( $translations[ $key ] ); } elseif ( $seo_description === $translation['translation'] ) { $translation_seo_description = $translation; $translation_seo_description['tag'] = __( 'SEO - Description:', 'wplingua' ); unset( $translations[ $key ] ); } } if ( ! empty( $translation_seo_description ) ) { $translations = array_merge( array( $translation_seo_description ), $translations ); } if ( ! empty( $translation_seo_title ) ) { $translations = array_merge( array( $translation_seo_title ), $translations ); } /** * Make the Modal items */ $html .= '
'; $html .= ''; // End #wplng-modal-no-item-found foreach ( $translations as $key => $translation ) { if ( empty( $translation['post_id'] ) || empty( $translation['source'] ) || empty( $translation['translation'] ) ) { continue; } $class = 'wplng-modal-item'; if ( ! empty( $translation['review'] ) ) { $class .= ' wplng-is-review'; } $html .= '
find( 'body' ) as $body ) { $body->innertext = $body->innertext . $html; } return $dom; }