addons-settings-page.php
6 years ago
advanced-settings-page.php
6 years ago
error-manager-page.php
6 years ago
language-switcher-shortcode.php
6 years ago
license-settings-page.php
6 years ago
machine-translation-settings-page.php
6 years ago
main-settings-language-selector.php
6 years ago
main-settings-page.php
6 years ago
settings-navigation-tabs.php
6 years ago
test-api-settings-page.php
6 years ago
translation-manager.php
6 years ago
trp-remove-duplicate-rows.php
6 years ago
trp-update-database.php
6 years ago
language-switcher-shortcode.php
44 lines
| 1 | <?php |
| 2 | $current_language_preference = $this->add_shortcode_preferences($shortcode_settings, $current_language['code'], $current_language['name']); |
| 3 | |
| 4 | ?> |
| 5 | <div class="trp-language-switcher trp-language-switcher-container" data-no-translation <?php echo ( isset( $_GET['trp-edit-translation'] ) && $_GET['trp-edit-translation'] == 'preview' ) ? 'data-trp-unpreviewable="trp-unpreviewable"' : '' ?>> |
| 6 | <div class="trp-ls-shortcode-current-language"> |
| 7 | <a href="javascript:void(0)" class="trp-ls-shortcode-disabled-language trp-ls-disabled-language" title="<?php echo esc_attr( $current_language['name'] ); ?>"> |
| 8 | <?php echo $current_language_preference; // WPCS: ok. ?> |
| 9 | </a> |
| 10 | </div> |
| 11 | <div class="trp-ls-shortcode-language"> |
| 12 | <?php if ( apply_filters('trp_ls_shortcode_show_disabled_language', true, $current_language, $current_language_preference, $this->settings ) ){ ?> |
| 13 | <a href="javascript:void(0)" class="trp-ls-shortcode-disabled-language trp-ls-disabled-language" title="<?php echo esc_attr( $current_language['name'] ); ?>"> |
| 14 | <?php echo $current_language_preference; // WPCS: ok. ?> |
| 15 | </a> |
| 16 | <?php } ?> |
| 17 | <?php foreach ( $other_languages as $code => $name ){ |
| 18 | |
| 19 | $language_preference = $this->add_shortcode_preferences($shortcode_settings, $code, $name); |
| 20 | ?> |
| 21 | <a href="<?php echo esc_url( $this->url_converter->get_url_for_language($code, false) ); ?>" title="<?php echo esc_attr( $name ); ?>"> |
| 22 | <?php echo $language_preference; // WPCS: ok. ?> |
| 23 | </a> |
| 24 | |
| 25 | <?php } ?> |
| 26 | </div> |
| 27 | <script type="application/javascript"> |
| 28 | // need to have the same with set from JS on both divs. Otherwise it can push stuff around in HTML |
| 29 | var trp_ls_shortcodes = document.querySelectorAll('.trp-language-switcher'); |
| 30 | if ( trp_ls_shortcodes.length > 0) { |
| 31 | // get the last language switcher added |
| 32 | var trp_el = trp_ls_shortcodes[trp_ls_shortcodes.length - 1]; |
| 33 | var trp_shortcode_language_item = trp_el.querySelector('.trp-ls-shortcode-language') |
| 34 | |
| 35 | // set width |
| 36 | var trp_ls_shortcode_width = trp_shortcode_language_item.offsetWidth + 5; |
| 37 | trp_shortcode_language_item.style.width = trp_ls_shortcode_width + 'px'; |
| 38 | trp_el.querySelector('.trp-ls-shortcode-current-language').style.width = trp_ls_shortcode_width + 'px'; |
| 39 | |
| 40 | // We're putting this on display: none after we have its width. |
| 41 | trp_shortcode_language_item.style.display = 'none'; |
| 42 | } |
| 43 | </script> |
| 44 | </div> |