Changeset 3412263
- Timestamp:
- 12/05/2025 02:22:41 PM (4 months ago)
- Location:
- autoglot
- Files:
-
- 62 added
- 8 edited
-
tags/2.9.1 (added)
-
tags/2.9.1/admin (added)
-
tags/2.9.1/admin/autoglot_admin.php (added)
-
tags/2.9.1/admin/autoglot_editor.php (added)
-
tags/2.9.1/admin/autoglot_feedback.php (added)
-
tags/2.9.1/admin/css (added)
-
tags/2.9.1/admin/css/autoglot_flags.css (added)
-
tags/2.9.1/admin/css/autoglot_translation_admin.css (added)
-
tags/2.9.1/admin/index.php (added)
-
tags/2.9.1/admin/js (added)
-
tags/2.9.1/admin/js/autoglot_translation_admin.js (added)
-
tags/2.9.1/admin/js/autoglot_translation_admin_tabs.js (added)
-
tags/2.9.1/admin/js/autoglot_translation_editor.js (added)
-
tags/2.9.1/admin/partials (added)
-
tags/2.9.1/admin/partials/display_dashboard.php (added)
-
tags/2.9.1/admin/partials/display_editor.php (added)
-
tags/2.9.1/admin/partials/display_settings.php (added)
-
tags/2.9.1/admin/partials/display_setup.php (added)
-
tags/2.9.1/admin/partials/display_utilities.php (added)
-
tags/2.9.1/autoglot.php (added)
-
tags/2.9.1/front (added)
-
tags/2.9.1/front/css (added)
-
tags/2.9.1/front/css/autoglot.css (added)
-
tags/2.9.1/front/css/autoglot.min.css (added)
-
tags/2.9.1/front/img (added)
-
tags/2.9.1/front/img/flags_sprites.png (added)
-
tags/2.9.1/front/img/smallflags_sprites.png (added)
-
tags/2.9.1/front/index.php (added)
-
tags/2.9.1/front/js (added)
-
tags/2.9.1/front/js/autoglot.js (added)
-
tags/2.9.1/index.php (added)
-
tags/2.9.1/readme.txt (added)
-
tags/2.9.1/translation (added)
-
tags/2.9.1/translation/autoglot-de.mo (added)
-
tags/2.9.1/translation/autoglot-de.po (added)
-
tags/2.9.1/translation/autoglot-es_ES.mo (added)
-
tags/2.9.1/translation/autoglot-es_ES.po (added)
-
tags/2.9.1/translation/autoglot-fr_FR.mo (added)
-
tags/2.9.1/translation/autoglot-fr_FR.po (added)
-
tags/2.9.1/translation/autoglot-it.mo (added)
-
tags/2.9.1/translation/autoglot-it.po (added)
-
tags/2.9.1/translation/autoglot-pt.mo (added)
-
tags/2.9.1/translation/autoglot-pt.po (added)
-
tags/2.9.1/translation/autoglot-ru.mo (added)
-
tags/2.9.1/translation/autoglot-ru.po (added)
-
tags/2.9.1/translation/autoglot-ru_RU.mo (added)
-
tags/2.9.1/translation/autoglot-ru_RU.po (added)
-
tags/2.9.1/translation/autoglot.pot (added)
-
tags/2.9.1/translation/index.php (added)
-
tags/2.9.1/translation/ru.mo (added)
-
tags/2.9.1/translation/ru.po (added)
-
tags/2.9.1/utils (added)
-
tags/2.9.1/utils/autoglot_3rdparty.php (added)
-
tags/2.9.1/utils/autoglot_constants.php (added)
-
tags/2.9.1/utils/autoglot_curl.php (added)
-
tags/2.9.1/utils/autoglot_db.php (added)
-
tags/2.9.1/utils/autoglot_dom.php (added)
-
tags/2.9.1/utils/autoglot_menu.php (added)
-
tags/2.9.1/utils/autoglot_options.php (added)
-
tags/2.9.1/utils/autoglot_utils.php (added)
-
tags/2.9.1/utils/autoglot_widget.php (added)
-
tags/2.9.1/utils/index.php (added)
-
trunk/admin/autoglot_admin.php (modified) (1 diff)
-
trunk/autoglot.php (modified) (6 diffs)
-
trunk/front/css/autoglot.css (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/utils/autoglot_constants.php (modified) (2 diffs)
-
trunk/utils/autoglot_menu.php (modified) (6 diffs)
-
trunk/utils/autoglot_options.php (modified) (4 diffs)
-
trunk/utils/autoglot_widget.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
autoglot/trunk/admin/autoglot_admin.php
r3409735 r3412263 1173 1173 'supplemental' => __('Show language names in native languages, English, as ISO code, or combination.', 'autoglot'), 1174 1174 'type' => 'select', 1175 'options' => $this-> language_name_options,1175 'options' => $this->autoglot->options->get_language_name_options(), 1176 1176 'default' => array(autoglot_consts::LANGUAGE_NAME_TYPES[0]), 1177 1177 'sanitize_callback' => array($this, 'sanitize_language_names'), -
autoglot/trunk/autoglot.php
r3409735 r3412263 4 4 Plugin URI: https://autoglot.com/download/ 5 5 Description: Fully automatic SEO-friendly plugin for multilingual WordPress translation. Translate your website and boost your traffic in minutes! No coding, no subscription, no recurring payments, no hurdles! 6 Version: 2.9. 06 Version: 2.9.1 7 7 Text Domain: autoglot 8 8 Author: Autoglot WordPress Team … … 88 88 /** we need permalinks for Autoglot to function */ 89 89 public $using_permalinks = false; 90 90 91 91 /** shown moderation message? */ 92 92 public $shown_moderation = false; … … 178 178 } 179 179 if($this->options->floatbox_enable){ 180 add_action('wp_footer', array($this, 'add_autoglot_floatbox')); // add float box with language switcher popup 180 add_action('wp_footer', array($this, 'add_autoglot_floatbox')); // add float box for language switcher 181 add_action('wp_footer', array($this, 'add_autoglot_language_switcher_popup')); // add language switcher popup 182 }elseif($this->autoglot_database->check_meta_key_exists("_autoglot_menu_item")){ 183 add_action('wp_footer', array($this, 'add_autoglot_language_switcher_popup')); // add language switcher popup for menu 181 184 } 182 185 add_action('wp_print_styles', array(&$this, 'add_autoglot_css')); … … 380 383 } 381 384 } 382 383 /** 384 * Adds floating box with language switcher popup385 386 /** 387 * Adds floating box 385 388 */ 386 389 function add_autoglot_floatbox() { 387 if ( is_404() || is_search() ||!$this->options->floatbox_enable || (defined('REST_REQUEST') && REST_REQUEST)) {390 if (/*is_404() || is_search() || */!$this->options->floatbox_enable || (defined('REST_REQUEST') && REST_REQUEST)) { 388 391 return; 389 392 } … … 435 438 } 436 439 echo '</a></div>'; 437 440 } 441 } 442 443 /** 444 * Adds language switcher popup 445 */ 446 function add_autoglot_language_switcher_popup() { 447 448 if ($this->added_switcher_box/* || is_404() || is_search()*/ || (defined('REST_REQUEST') && REST_REQUEST)) { 449 return; 450 } 451 452 if(count($this->options->active_languages) && (!$this->options->translation_adminonly || $this->options->translation_adminonly && current_user_can('manage_options'))){ 453 438 454 echo ' <div id="boxes" class="'.esc_attr(AUTOGLOT_NOTRANSLATE_LANGUAGESWITCHER).'"> 439 455 <div id="ag_languageswitcher" class="ag_window" style="text-align:left">'; … … 457 473 } 458 474 } 459 475 460 476 /** 461 477 * Use autoglot CSS -
autoglot/trunk/front/css/autoglot.css
r3409735 r3412263 15 15 } 16 16 17 .ag_notranslateswitcher_menu ul { 18 overflow-y: scroll; 19 max-height: 400px; 20 scrollbar-width: thin; 21 scrollbar-color: #CCC transparent; 22 } 23 17 24 #ag_mask { 18 25 position:absolute; … … 99 106 .cssflag_small { 100 107 display: inline-block; 101 width: 23px !important;102 height: 15px !important;108 width: 23px !important; 109 height: 15px !important; 103 110 margin: 1px 2px !important; 104 111 background-image: url('../img/smallflags_sprites.png'); … … 106 113 107 114 .cssflag_menu { 108 margin-right: 5px !important;109 vertical-align: text-top;115 margin-right: 8px !important; 116 vertical-align: middle; 110 117 } 111 118 .cssflag-ad { -
autoglot/trunk/readme.txt
r3409735 r3412263 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.0 7 Stable tag: 2.9. 07 Stable tag: 2.9.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 319 319 == Upgrade Notice == 320 320 321 = 2.9. 0=322 Added language switcher tomenu321 = 2.9.1 = 322 Improved language switcher шт menu 323 323 324 324 = 2.8.3 = … … 361 361 == Changelog == 362 362 363 = 2.9.1 (05/12/2025) = 364 * Added a selector for the language switcher type in the menu: native dropdown or popup window 365 * The native dropdown displays child menu items as a regular menu 366 * The popup window opens a language switcher popup, similar to a floating box 367 * If there are more than 15 active languages, the dropdown menu becomes scrollable 368 * The language switcher now appears on 404 and search pages and links to the translated home pages 369 370 363 371 = 2.9.0 (03/12/2025) = 364 372 **Autoglot Introduces Language Switcher in Menu!** 365 373 366 374 * Added Autoglot Language Switcher option to built-in WordPress menus 367 * Users can add as many language switchers to different menus as they want368 * Each language switcher in menu can be customized anddisplay flags, language names, or both369 * T ype of language namescan also be customized: native name, English name, ISO code, or a combination370 * When displaying plugin health status, Autoglot will also check if language switcher is enabled inmenu375 * Users can add multiple language switchers to different menus 376 * Each language switcher can be customized to display flags, language names, or both 377 * The type of language name can also be customized: native name, English name, ISO code, or a combination 378 * When showing plugin health status, Autoglot now also checks if a language switcher is enabled in the menu 371 379 * Note: currently, only traditional themes support built-in WordPress menus 372 * Moved a few constants from admin to a separate file to make the re-usable380 * Moved several constants from admin to a separate file to make them reusable 373 381 * Confirmed compatibility with WordPress 6.9 374 382 -
autoglot/trunk/utils/autoglot_constants.php
r3409735 r3412263 250 250 ); 251 251 252 const LANGUAGE_SWITCHER_MENU_TYPES = array( 253 'languagedropdown',//default 254 'languagepopup', 255 ); 256 252 257 const INLINE_TAGS_EDITOR = array("b", "i", "small", "cite", "code", "em", "strong", "a", "br", "span", "sub", "sup", "h1", "h2", "h3", "h4", "h5", "h6"); 253 258 … … 256 261 257 262 //Define for autoglot plugin version 258 define('AUTOGLOT_PLUGIN_VER', '2.9. 0');263 define('AUTOGLOT_PLUGIN_VER', '2.9.1'); 259 264 260 265 //Define for autoglot plugin name -
autoglot/trunk/utils/autoglot_menu.php
r3409735 r3412263 94 94 95 95 $options = array(); 96 if(isset($_POST['autoglot-menu-meta-menu-type'][$menu_item_db_id]))$options['menu_type'] = $_POST['autoglot-menu-meta-menu-type'][$menu_item_db_id]; 96 97 if(isset($_POST['autoglot-menu-meta-type'][$menu_item_db_id]))$options['switcher_type'] = $_POST['autoglot-menu-meta-type'][$menu_item_db_id]; 97 98 if(isset($_POST['autoglot-menu-meta-language-names'][$menu_item_db_id])) $options['language_names'] = $_POST['autoglot-menu-meta-language-names'][$menu_item_db_id]; … … 111 112 ?> 112 113 <div class="field-autoglot_menu_meta description-wide" style="margin: 15px 0;"> 113 <p class="description description-wide"><strong><?php _e( "Autoglot Language Switcher Settings", 'autoglot' ); ?></strong></p>114 <p class="description description-wide"><strong><?php esc_html_e( "Autoglot Language Switcher Settings", 'autoglot' ); ?></strong></p> 114 115 115 116 <input type="hidden" name="autoglot-menu-meta[<?php echo $item_id ;?>]" value="<?php echo $item_id ;?>" /> 116 117 118 <p class="field-menu-type description description-wide"> 119 <label for="autoglot-menu-meta-menu-type-for-<?php echo $item_id ;?>"> 120 <?php esc_html_e( 'Type of Menu', 'autoglot'); ?></label> 121 <select class="widefat" id="autoglot-menu-meta-menu-type-for-<?php echo $item_id ;?>" name="autoglot-menu-meta-menu-type[<?php echo $item_id ;?>]"><?php 122 foreach ($this->autoglot->options->get_language_switcher_menu() as $lname_key => $lname_text) { 123 $selected = ($safe_autoglot_menu_meta['menu_type'] == $lname_key) ? 'selected' : ''; 124 echo '<option value="' . esc_attr($lname_key) . '" ' . $selected . '>' . esc_html($lname_text) . '</option>'; 125 } 126 ?> 127 </select> 128 <em><?php esc_html_e( '* Popup window uses the type of switcher from Autoglot Settings', 'autoglot'); ?></em> 129 </p> 130 117 131 <p class="field-show-flag description description-wide"> 118 132 <label for="autoglot-menu-meta-type-for-<?php echo $item_id ;?>"> 119 <?php _e( 'Type of Switcher', 'autoglot'); ?></label>133 <?php esc_html_e( 'Type of Switcher', 'autoglot'); ?></label> 120 134 <select class="widefat" id="autoglot-menu-meta-type-for-<?php echo $item_id ;?>" name="autoglot-menu-meta-type[<?php echo $item_id ;?>]"><?php 121 135 foreach ($this->autoglot->options->get_language_switcher_options() as $l_key => $l_text) { … … 125 139 ?> 126 140 </select> 127 <em><?php _e( '* Please note, some WP themes may fail to display flags properly', 'autoglot'); ?></em>141 <em><?php esc_html_e( '* Please note, some WP themes may fail to display flags properly', 'autoglot'); ?></em> 128 142 </p> 129 143 130 144 <p class="field-language-names description description-wide"> 131 145 <label for="autoglot-menu-meta-language-names-for-<?php echo $item_id ;?>"> 132 <?php _e( 'How to Display Language Names', 'autoglot'); ?></label>146 <?php esc_html_e( 'How to Display Language Names', 'autoglot'); ?></label> 133 147 <select class="widefat" id="autoglot-menu-meta-language-names-for-<?php echo $item_id ;?>" name="autoglot-menu-meta-language-names[<?php echo $item_id ;?>]"><?php 134 148 foreach ($this->autoglot->options->get_language_name_options() as $lname_key => $lname_text) { … … 160 174 foreach ($items as $item) { 161 175 if ($autoglot_menu_meta = get_post_meta($item->ID, '_autoglot_menu_item', true)) { 176 if (is_404() || is_search() || (defined('REST_REQUEST') && REST_REQUEST)) { 177 $current_url = $this->autoglot->homeURL; 178 } 179 162 180 $safe_autoglot_menu_meta = $this->autoglot->options->validate_menu_meta($autoglot_menu_meta); 163 181 … … 193 211 194 212 195 foreach ($this->autoglot->options->active_languages as $lcode) if($lcode!=$lang) { 196 $language_item = clone $item; 197 $language_item->ID = $item->ID . '_' . $lcode; 198 199 $item_title = $item_flag = $add_item_flag = ""; 200 $addsmallcss = ""; 201 switch($safe_autoglot_menu_meta["switcher_type"]){ 202 case "languageflagslist": 203 case "smallflagslist": 204 $addsmallcss = "_small"; 205 case "flagslist": 206 $lang_flag = isset($this->autoglot->options->language_flags[$lcode])?$this->autoglot->options->language_flags[$lcode]:autoglot_utils::get_language_flag($lcode); 207 $item_flag = '<span class="cssflag_menu cssflag'.$addsmallcss.' cssflag-'.esc_attr($lang_flag.$addsmallcss).'"></span>'; 208 break; 209 default: 210 break; 213 if($safe_autoglot_menu_meta["menu_type"] == "languagedropdown") { 214 foreach ($this->autoglot->options->active_languages as $lcode) if($lcode!=$lang) { 215 $language_item = clone $item; 216 $language_item->ID = $item->ID . '_' . $lcode; 217 218 $item_title = $item_flag = $add_item_flag = ""; 219 $addsmallcss = ""; 220 switch($safe_autoglot_menu_meta["switcher_type"]){ 221 case "languageflagslist": 222 case "smallflagslist": 223 $addsmallcss = "_small"; 224 case "flagslist": 225 $lang_flag = isset($this->autoglot->options->language_flags[$lcode])?$this->autoglot->options->language_flags[$lcode]:autoglot_utils::get_language_flag($lcode); 226 $item_flag = '<span class="cssflag_menu cssflag'.$addsmallcss.' cssflag-'.esc_attr($lang_flag.$addsmallcss).'"></span>'; 227 break; 228 default: 229 break; 230 } 231 switch($safe_autoglot_menu_meta["switcher_type"]){ 232 case "smallflagslist": 233 case "flagslist": 234 $item_title = $item_flag; 235 break; 236 case "languageflagslist": 237 $add_item_flag = $item_flag; 238 default: 239 $item_title = $add_item_flag.esc_html(autoglot_utils::get_full_name($lcode,$safe_autoglot_menu_meta["language_names"])); 240 break; 241 } 242 243 $language_item->title = $item_title; 244 //$language_item->attr_title = esc_html(autoglot_utils::get_full_name($lcode, "iso")); 245 // Build language menu URL 246 if ($lcode == $this->autoglot->options->default_language) { 247 $language_item->url = $current_url; 248 } else { 249 if ($this->autoglot->options->translate_urls) { 250 $language_item->url = autoglot_utils::add_language_to_url($this->autoglot->translate_url($current_url, $lcode), $this->autoglot->homeURL, $lcode); 251 } else { 252 $language_item->url = autoglot_utils::add_language_to_url($current_url, $this->autoglot->homeURL, $lcode); 253 } 254 } 255 $language_item->lang = $lcode; 256 $language_item->menu_item_parent = $item->ID; 257 $language_item->menu_order = $menu_order++; 258 $language_item->db_id = 0; 259 $updated_items[] = $language_item; 211 260 } 212 switch($safe_autoglot_menu_meta["switcher_type"]){ 213 case "smallflagslist": 214 case "flagslist": 215 $item_title = $item_flag; 216 break; 217 case "languageflagslist": 218 $add_item_flag = $item_flag; 219 default: 220 $item_title = $add_item_flag.esc_html(autoglot_utils::get_full_name($lcode,$safe_autoglot_menu_meta["language_names"])); 221 break; 222 } 223 224 $language_item->title = $item_title; 225 //$language_item->attr_title = esc_html(autoglot_utils::get_full_name($lcode, "iso")); 226 // Build language menu URL 227 if ($lcode == $this->autoglot->options->default_language) { 228 $language_item->url = $current_url; 229 } else { 230 if ($this->autoglot->options->translate_urls) { 231 $language_item->url = autoglot_utils::add_language_to_url($this->autoglot->translate_url($current_url, $lcode), $this->autoglot->homeURL, $lcode); 232 } else { 233 $language_item->url = autoglot_utils::add_language_to_url($current_url, $this->autoglot->homeURL, $lcode); 234 } 235 } 236 $language_item->lang = $lcode; 237 $language_item->menu_item_parent = $item->ID; 238 $language_item->menu_order = $menu_order++; 239 $language_item->db_id = 0; 240 $updated_items[] = $language_item; 241 } 261 }/* elseif($safe_autoglot_menu_meta["menu_type"] == "languagepopup") { 262 $this->autoglot->add_autoglot_language_switcher_popup(); 263 }*/ 264 242 265 $item->classes[] = AUTOGLOT_NOTRANSLATE_LANGUAGESWITCHER; 266 if(count($this->autoglot->options->active_languages)>15) $item->classes[] = AUTOGLOT_NOTRANSLATE_LANGUAGESWITCHER."_menu"; 243 267 $updated_items[] = $item; 244 268 } else { … … 258 282 if (get_post_meta($item->ID, '_autoglot_menu_item', true) || get_post_meta($item->menu_item_parent, '_autoglot_menu_item', true)) { 259 283 $attrs['data-type'] = 'languageswitcher'; 284 } 285 if (($autoglot_menu_meta = get_post_meta($item->ID, '_autoglot_menu_item', true)) && !get_post_meta($item->menu_item_parent, '_autoglot_menu_item', true)) { 286 $safe_autoglot_menu_meta = $this->autoglot->options->validate_menu_meta($autoglot_menu_meta); 287 if($safe_autoglot_menu_meta["menu_type"] == "languagepopup"){ 288 $attrs['name'] = 'ag_modal'; 289 $attrs['box'] = 'ag_languageswitcher'; 290 } 260 291 } 261 292 return $attrs; -
autoglot/trunk/utils/autoglot_options.php
r3409735 r3412263 53 53 private $language_switcher_positions; 54 54 private $language_name_options; 55 private $language_switcher_menu; 55 56 56 57 private function validate_checkbox($option, $default1 = 1, $max_value = 1){ … … 66 67 67 68 $validated_menu_meta = array(); 68 $default_options = array( 'switcher_type' => $this->popup_switcher, 'language_names' => $this->language_names ); // Default values 69 $default_options = array( 'menu_type' => "languagedropdown"/*TODO: array_key_first PHP 7 >= 7.3*/, 'switcher_type' => $this->popup_switcher, 'language_names' => $this->language_names ); // Default values 70 71 if(isset($autoglot_menu_meta["menu_type"]) && in_array($autoglot_menu_meta["menu_type"], autoglot_consts::LANGUAGE_SWITCHER_MENU_TYPES, true)){ 72 $validated_menu_meta["menu_type"] = $autoglot_menu_meta["menu_type"]; 73 } else { 74 $validated_menu_meta["menu_type"] = $default_options["menu_type"]; 75 } 69 76 70 77 if(isset($autoglot_menu_meta["switcher_type"]) && in_array($autoglot_menu_meta["switcher_type"], autoglot_consts::LANGUAGE_SWITCHER_TYPES, true)){ … … 210 217 ); 211 218 219 $this->language_switcher_menu = array( 220 'languagedropdown' => __( 'Dropdown Menu', 'autoglot' ), 221 'languagepopup' => __( 'Language Switcher Popup', 'autoglot' ), 222 ); 223 212 224 $this->language_switcher_options = array( 213 225 'languagelist' => __( 'Language Names', 'autoglot' ), … … 239 251 } 240 252 253 public function get_language_switcher_menu(): array { 254 return $this->language_switcher_menu; 255 } 256 241 257 public function get_language_switcher_options(): array { 242 258 return $this->language_switcher_options; -
autoglot/trunk/utils/autoglot_widget.php
r3344116 r3412263 158 158 $flagimage = ""; 159 159 160 $current_url = is_404()?$this->autoglot->homeURL:$this->autoglot->get_original_url(home_url( add_query_arg( array(), $wp->request ) ),$this->autoglot->homeURL,$this->autoglot->langURL, 0);160 $current_url = (is_404()||is_search())?$this->autoglot->homeURL:$this->autoglot->get_original_url(home_url( add_query_arg( array(), $wp->request ) ),$this->autoglot->homeURL,$this->autoglot->langURL, 0); 161 161 $current_link = $current_url;//str_replace($this->autoglot->homeURL, "", $current_url); 162 162 $widget_translate_urls = $this->autoglot->options->translate_urls;
Note: See TracChangeset
for help on using the changeset viewer.