Changeset 3484878
- Timestamp:
- 03/17/2026 03:09:36 PM (3 weeks ago)
- Location:
- autoglot
- Files:
-
- 66 added
- 9 edited
-
tags/2.11.0 (added)
-
tags/2.11.0/admin (added)
-
tags/2.11.0/admin/autoglot_admin.php (added)
-
tags/2.11.0/admin/autoglot_editor.php (added)
-
tags/2.11.0/admin/autoglot_feedback.php (added)
-
tags/2.11.0/admin/css (added)
-
tags/2.11.0/admin/css/autoglot_translation_admin.css (added)
-
tags/2.11.0/admin/index.php (added)
-
tags/2.11.0/admin/js (added)
-
tags/2.11.0/admin/js/autoglot_translation_admin.js (added)
-
tags/2.11.0/admin/js/autoglot_translation_admin_tabs.js (added)
-
tags/2.11.0/admin/js/autoglot_translation_block_menu.js (added)
-
tags/2.11.0/admin/js/autoglot_translation_block_switcher.js (added)
-
tags/2.11.0/admin/js/autoglot_translation_editor.js (added)
-
tags/2.11.0/admin/partials (added)
-
tags/2.11.0/admin/partials/display_dashboard.php (added)
-
tags/2.11.0/admin/partials/display_editor.php (added)
-
tags/2.11.0/admin/partials/display_settings.php (added)
-
tags/2.11.0/admin/partials/display_setup.php (added)
-
tags/2.11.0/admin/partials/display_utilities.php (added)
-
tags/2.11.0/autoglot.php (added)
-
tags/2.11.0/front (added)
-
tags/2.11.0/front/css (added)
-
tags/2.11.0/front/css/autoglot.css (added)
-
tags/2.11.0/front/css/autoglot.min.css (added)
-
tags/2.11.0/front/img (added)
-
tags/2.11.0/front/img/flags_sprites.png (added)
-
tags/2.11.0/front/img/smallflags_sprites.png (added)
-
tags/2.11.0/front/index.php (added)
-
tags/2.11.0/front/js (added)
-
tags/2.11.0/front/js/autoglot.js (added)
-
tags/2.11.0/index.php (added)
-
tags/2.11.0/readme.txt (added)
-
tags/2.11.0/security.txt (added)
-
tags/2.11.0/translation (added)
-
tags/2.11.0/translation/autoglot-de.mo (added)
-
tags/2.11.0/translation/autoglot-de.po (added)
-
tags/2.11.0/translation/autoglot-es_ES.mo (added)
-
tags/2.11.0/translation/autoglot-es_ES.po (added)
-
tags/2.11.0/translation/autoglot-fr_FR.mo (added)
-
tags/2.11.0/translation/autoglot-fr_FR.po (added)
-
tags/2.11.0/translation/autoglot-it.mo (added)
-
tags/2.11.0/translation/autoglot-it.po (added)
-
tags/2.11.0/translation/autoglot-pt.mo (added)
-
tags/2.11.0/translation/autoglot-pt.po (added)
-
tags/2.11.0/translation/autoglot-ru.mo (added)
-
tags/2.11.0/translation/autoglot-ru.po (added)
-
tags/2.11.0/translation/autoglot-ru_RU.mo (added)
-
tags/2.11.0/translation/autoglot-ru_RU.po (added)
-
tags/2.11.0/translation/autoglot.pot (added)
-
tags/2.11.0/translation/index.php (added)
-
tags/2.11.0/translation/ru.mo (added)
-
tags/2.11.0/translation/ru.po (added)
-
tags/2.11.0/utils (added)
-
tags/2.11.0/utils/autoglot_3rdparty.php (added)
-
tags/2.11.0/utils/autoglot_block_menu.php (added)
-
tags/2.11.0/utils/autoglot_block_switcher.php (added)
-
tags/2.11.0/utils/autoglot_constants.php (added)
-
tags/2.11.0/utils/autoglot_curl.php (added)
-
tags/2.11.0/utils/autoglot_db.php (added)
-
tags/2.11.0/utils/autoglot_dom.php (added)
-
tags/2.11.0/utils/autoglot_menu.php (added)
-
tags/2.11.0/utils/autoglot_options.php (added)
-
tags/2.11.0/utils/autoglot_utils.php (added)
-
tags/2.11.0/utils/autoglot_widget.php (added)
-
tags/2.11.0/utils/index.php (added)
-
trunk/admin/autoglot_admin.php (modified) (10 diffs)
-
trunk/admin/css/autoglot_translation_admin.css (modified) (3 diffs)
-
trunk/autoglot.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/utils/autoglot_constants.php (modified) (3 diffs)
-
trunk/utils/autoglot_db.php (modified) (1 diff)
-
trunk/utils/autoglot_dom.php (modified) (1 diff)
-
trunk/utils/autoglot_options.php (modified) (5 diffs)
-
trunk/utils/autoglot_utils.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
autoglot/trunk/admin/autoglot_admin.php
r3475723 r3484878 673 673 add_settings_section( 'section_adv_out', __('Output Settings', 'autoglot'), array($this, 'section_callback'), 'autoglot_translation_advanced'); 674 674 add_settings_section( 'section_adv_search', __('Search Settings', 'autoglot'), array($this, 'section_callback'), 'autoglot_translation_advanced'); 675 add_settings_section( 'section_adv_exclusion', __('Exclusion Filters', 'autoglot'), array($this, 'section_callback'), 'autoglot_translation_advanced'); 675 676 add_settings_section( 'section_linksmod', __('Language Code Insertion', 'autoglot'), array($this, 'section_callback'), 'autoglot_translation_linksmod'); 676 677 add_settings_section( 'section_utilities', __('Useful Plugin Utilities', 'autoglot'), array($this, 'section_callback'), 'autoglot_translation_utilities' ); … … 1073 1074 case 'section_adv_search': 1074 1075 echo '<p>' . esc_html__('These are advanced search settings. Please use with caution!', 'autoglot') . '</p>'; 1076 break; 1077 1078 case 'section_adv_exclusion': 1079 echo '<p>' . esc_html__('Use these exclusion filters to prevent certain pages from being translated. Excluded pages will display translated content only if a translation already exists. New translations will not be generated. All links will still lead to the translated version of the site.', 'autoglot') . '</p>'; 1075 1080 break; 1076 1081 … … 1587 1592 'sanitize_callback' => array($this, 'sanitize_radio'), 1588 1593 ), 1594 array( 1595 'uid' => 'autoglot_translation_exclusion_urls', 1596 'label' => __('Exclude these URLs from translation', 'autoglot'), 1597 'section' => 'section_adv_exclusion', 1598 'page' => 'autoglot_translation_advanced', 1599 'placeholder' => __('Exclude these pages from translation', 'autoglot'), 1600 'helper' => '', 1601 'supplemental' => __('You can prevent specific pages from being translated by adding URL filters. Any page that matches a filter in this box will not be translated.', 'autoglot'). "<br /><br />" .__('Wildcards are allowed. Use relative paths without domain names. Examples:', 'autoglot')."<br /><ul><li>". 1602 /* translators: 1: <code>/blog/*</code>, 2: <code>/blog/</code>, 3: <code>/about-us/</code>, 4: <code>*\/contact/*</code>, 5: <code>/contact/</code> */ 1603 sprintf(__('%1$s - Exclude all URLs starting with %2$s', 'autoglot') . "</li><li>" . 1604 __('%3$s - Exclude this exact URL %3$s', 'autoglot'). "</li><li>" . 1605 __('%4$s - Exclude all URLs containing %5$s', 'autoglot'), '<code>/blog/*</code>', '<code>/blog/...</code>', '<code>/about-us/</code>', '<code>*/contact/*</code>', '<code>.../contact/...</code>') . "</li></ul>" 1606 , 1607 'type' => 'textarea', 1608 'default' => "", 1609 'sanitize_callback' => array($this, 'sanitize_exclusion_urls'), 1610 ), 1611 array( 1612 'uid' => 'autoglot_translation_exclusion_archives', 1613 'label' => __('Choose archives to be excluded', 'autoglot'), 1614 'section' => 'section_adv_exclusion', 1615 'page' => 'autoglot_translation_advanced', 1616 'supplemental' => __('You can prevent specific page types from being translated. This will exclude pages such as search results and attachment pages, as well as archive pages like category archives, date archives, etc.', 'autoglot') 1617 , 1618 'type' => 'checkbox', 1619 'checkboxcolor' => 'red', 1620 'options' => $this->autoglot->options->get_archives(), 1621 'default' => array(), 1622 'sanitize_callback' => array($this, 'sanitize_exclusion_archives'), 1623 ), 1624 array( 1625 'uid' => 'autoglot_translation_exclusion_noindex', 1626 'label' => __('No-index excluded pages', 'autoglot'), 1627 'section' => 'section_adv_exclusion', 1628 'page' => 'autoglot_translation_advanced', 1629 'type' => 'radio', 1630 /* translators: element #ID */ 1631 'supplemental' => sprintf(__('Modify %s tag and set it to noindex to prevent search engines from indexing the content of excluded pages.', 'autoglot'), "<code><meta name='robots' content='noindex'... /></code>"), 1632 'options' => array( 1633 1 => __('Set meta robots tag to noindex', 'autoglot'), 1634 0 => __('Do not modify meta robots tag', 'autoglot'), 1635 ), 1636 'default' => array(AUTOGLOT_DEFAULT_EXCLUSION_NOINDEX), 1637 'sanitize_callback' => array($this, 'sanitize_radio'), 1638 ), 1589 1639 array( 1590 1640 'uid' => 'autoglot_translation_add_lngcode', … … 1799 1849 $value = $arguments['default']; 1800 1850 } 1851 $checkboxred = ""; 1801 1852 // Lets do some setup based ont he type of element we are trying to display. 1802 1853 switch( $arguments['type'] ){ … … 1832 1883 } 1833 1884 break; 1885 case 'checkbox': 1834 1886 case 'radio': 1835 case 'checkbox':1836 1887 if( ! empty ( $arguments['options'] ) && is_array( $arguments['options'] ) ){ 1888 if(isset($arguments['checkboxcolor'])) $checkboxred = " checkbox".$arguments['checkboxcolor']; 1837 1889 $options_markup = ''; 1838 1890 $iterator = 0; … … 1847 1899 } 1848 1900 // Lets build out the checkbox 1849 $options_markup .= sprintf( '<label for="%1$s_%6$s" class="checkboxlabel"><input id="%1$s_%6$s" name="%1$s[]" type="%2$s" value="%3$s" %4$s class="checkboxinput " /> <span class="checkboxtext">%5$s</span></label><br/>', $arguments['uid'], $arguments['type'], $key, $is_checked, $label, $iterator)."\r\n";1901 $options_markup .= sprintf( '<label for="%1$s_%6$s" class="checkboxlabel"><input id="%1$s_%6$s" name="%1$s[]" type="%2$s" value="%3$s" %4$s class="checkboxinput%7$s" /> <span class="checkboxtext">%5$s</span></label><br/>', $arguments['uid'], $arguments['type'], $key, $is_checked, $label, $iterator, $checkboxred)."\r\n"; 1850 1902 } 1851 1903 printf( '<fieldset id="%s">%s</fieldset>', (/*count($arguments['options'])>10*/$arguments['type']=="checkbox"?"autoglot_tgs":""), wp_kses($options_markup, autoglot_consts::ADMIN_ALLOWED_TAGS) ); 1852 if(count($arguments['options'])>10) {1904 /*if(count($arguments['options'])>10) { 1853 1905 echo '<br /><span><a href="#" id="autoglot_checkon">' . esc_html__('Check all', 'autoglot') . '</a></span> | <span><a href="#" id="autoglot_checkoff">' . esc_html__('Uncheck all', 'autoglot') . '</a></span>'; 1854 } 1906 }*/ 1855 1907 } 1856 1908 break; … … 1959 2011 $newinput = array(); 1960 2012 if(is_array($input) && count($input))foreach($input as $ln) { 1961 if(in_array($ln, array_keys(autoglot_utils::get_all_language_names()) )){2013 if(in_array($ln, array_keys(autoglot_utils::get_all_language_names()), true)){ 1962 2014 $newinput[] = $ln; 1963 2015 } … … 1965 2017 return $newinput; 1966 2018 } 1967 2019 2020 public function sanitize_exclusion_archives ($input){ 2021 $newinput = array(); 2022 if(is_array($input) && count($input))foreach($input as $ln) { 2023 if(in_array($ln, array_keys($this->autoglot->options->get_archives()), true)){ 2024 $newinput[] = $ln; 2025 } 2026 } 2027 return $newinput; 2028 } 2029 2030 public function sanitize_exclusion_urls( $input ) { 2031 $sanitized_paths = array(); 2032 $paths = explode("\r\n", trim( $input )); 2033 2034 foreach($paths as $path){ 2035 $path = preg_replace( '/[^\p{L}\p{N}\/\-_\.\*]/u', '', $path ); 2036 $path = preg_replace( '/\/\/+/', '/', $path ); 2037 if(strlen($path))$sanitized_paths[] = $path; 2038 } 2039 2040 return implode("\r\n", $sanitized_paths); 2041 } 1968 2042 1969 2043 /** … … 2107 2181 delete_transient( 'text_replacement_settings_errors' ); 2108 2182 remove_action( 'admin_notices', 'text_replacement_admin_notices' ); 2109 }2183 } 2110 2184 function text_replacement_custom_box_html($post){ 2111 2185 $alllangs = autoglot_utils::get_all_language_names(1); … … 2118 2192 foreach($alllangs as $lng => $nm){ 2119 2193 if(in_array($lng,$this->autoglot->options->active_languages, true) && $lng!=$this->autoglot->options->default_language) echo "<tr><td><strong style=\"color:#007cba\">".esc_html($nm)."</strong></td><td><strong style=\"color:#007cba\">".esc_html($lng)."</strong></td><td>"; else echo "<tr><td>".esc_html($nm)."</td><td>".esc_html($lng)."</td><td>"; 2120 printf( '<textarea '.($lng==$this->autoglot->options->default_language?" disabled":"").' name="autoglot_text_replacement_content['.esc_attr($lng).']" id="autoglot_text_replacement_content_'.esc_attr($lng).'" rows="2" cols="50">%1$s</textarea>', esc_textarea($meta_value[$lng]) ); 2194 if($lng==$this->autoglot->options->default_language) echo '<div style="height:40px;background:#CCC;width:auto;"><input type="hidden" name="autoglot_text_replacement_content['.esc_attr($lng).']" id="autoglot_text_replacement_content_'.esc_attr($lng).'" value="'.esc_attr($meta_value[$lng]).'" /></div>'; 2195 else printf( '<textarea name="autoglot_text_replacement_content['.esc_attr($lng).']" id="autoglot_text_replacement_content_'.esc_attr($lng).'" rows="2" cols="50">%1$s</textarea>', esc_textarea($meta_value[$lng]) ); 2121 2196 echo "</td></tr>"; 2122 2197 } -
autoglot/trunk/admin/css/autoglot_translation_admin.css
r3455513 r3484878 60 60 padding-right: 2em; 61 61 } 62 #autoglot_tgs .checkboxred:checked ~ .checkboxtext { 63 background: #c72138 !important; 64 } 62 65 63 66 #autoglot_tgs .checkboxinput:checked ~ .checkboxtext:before { … … 71 74 color: #007cba; 72 75 font-weight:bold; 76 } 77 #autoglot_tgs .checkboxred:checked ~ .checkboxtext:after { 78 content: '\2717'; 79 color: #c72138; 73 80 } 74 81 … … 82 89 cursor: default; 83 90 } 84 91 #autoglot_tgs .checkboxred:disabled ~ .checkboxtext { 92 border: 2px solid #c72138; 93 color: #c72138; 94 } 85 95 #autoglot_tgs .checkboxinput:disabled ~ .checkboxtext:after { 86 96 content: none; -
autoglot/trunk/autoglot.php
r3475813 r3484878 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.1 0.106 Version: 2.11.0 7 7 Text Domain: autoglot 8 8 Author: Autoglot WordPress Team … … 102 102 /** for a language menu block */ 103 103 public $block_menu; 104 105 /** translation of the current page is excluded */ 106 public $translation_excluded = false; 104 107 105 108 function __construct() { … … 572 575 /** 573 576 * Main WP funciton. 577 * Check if archive page is excluded from translation 574 578 */ 575 579 576 580 function wp_main() 577 581 { 582 if(count($this->options->exclusion_archives)){ 583 if( (is_category() && in_array("category", $this->options->exclusion_archives, true)) || 584 (is_tag() && in_array("post_tag", $this->options->exclusion_archives, true)) || 585 (is_search() && in_array("default_search", $this->options->exclusion_archives, true)) || 586 (is_404() && in_array("default_404", $this->options->exclusion_archives, true)) || 587 (is_attachment() && in_array("default_attachment", $this->options->exclusion_archives, true)) || 588 (is_author() && in_array("default_author", $this->options->exclusion_archives, true)) || 589 (is_date() && in_array("default_date", $this->options->exclusion_archives, true)) ) $this->translation_excluded = true; 590 elseif(is_tax()) { 591 foreach($this->options->exclusion_archives as $ea){ 592 if(is_tax($ea)) $this->translation_excluded = true; 593 } 594 } 595 596 if($this->translation_excluded){ 597 $this->options->translation_enable = 0; 598 add_action( 'admin_bar_menu', array($this, 'notranslation_admin_bar_menu'), 999 ); 599 } 600 } 578 601 579 602 } … … 581 604 /** 582 605 * Start buffering after init 583 * Register widgets584 * Add filters to 3rd party SEO plugins585 606 */ 586 607 … … 618 639 619 640 if(strlen($home_url) && strpos($href, $home_url)!==false) $href = substr($href, strlen($home_url)); 641 620 642 $url = stripslashes(urldecode($href)); 621 643 $params = ($pos = strpos($url, '?')) ? substr($url, $pos) : ''; … … 717 739 if (strlen($langURL)) { 718 740 remove_filter( 'request', array($this, 'autoglot_request_filter')); 741 742 if(autoglot_utils::url_excluded($add_home.$this->get_original_url($saveuri, '', $langURL, 0), $this->options->exclusion_urls)) {//check if translated URL is excluded 743 $this->translation_excluded = true; 744 $this->options->translation_enable = 0; 745 add_action( 'admin_bar_menu', array($this, 'notranslation_admin_bar_menu'), 999 ); 746 } 747 719 748 $_SERVER['REQUEST_URI'] = $add_home.$this->get_original_url($saveuri, '', $langURL); 749 750 if(autoglot_utils::url_excluded($_SERVER['REQUEST_URI'], $this->options->exclusion_urls)) {//check if original URL is excluded 751 $this->translation_excluded = true; 752 $this->options->translation_enable = 0; 753 add_action( 'admin_bar_menu', array($this, 'notranslation_admin_bar_menu'), 999 ); 754 } 755 720 756 global $wp; 721 757 $savemr = $wp->matched_rule;//save, remove, then $wp->matched_rule - otherwise warnings on translated index pages … … 728 764 return $query_vars; 729 765 } 730 766 767 function notranslation_admin_bar_menu( $wp_admin_bar ) { 768 769 $wp_admin_bar->add_node( array( 770 'id' => 'autoglot-translation-disabled', 771 'title' => __('Translation disabled', 'autoglot') . ' <span class="ab-icon dashicons dashicons-translation" style="top:3px"></span>', 772 'href' => admin_url('admin.php?page=autoglot_translation_advanced'), 773 ) ); 774 } 775 731 776 /** 732 777 * Process page after end of buffer … … 734 779 735 780 function process_page($buffer) { 781 736 782 //file_put_contents(__DIR__."/debug.txt", $_SERVER['REQUEST_URI']."\r\n".$buffer."\r\n\r\n", FILE_APPEND); 737 783 $this->response_content_type = autoglot_utils::get_response_content_type(); -
autoglot/trunk/readme.txt
r3475813 r3484878 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.0 7 Stable tag: 2.1 0.107 Stable tag: 2.11.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 408 408 == Upgrade Notice == 409 409 410 = 2.11.0 = 411 Added translation exclusion filters 412 410 413 = 2.10.10 = 411 414 Improved HTML formatting … … 465 468 == Changelog == 466 469 470 = 2.11.0 (17/03/2026) = 471 ** Autoglot Adds Translation Exclusion Filters!** 472 473 * Added Exclusion Filters section to the Advanced Plugin Settings page 474 * Exclusion filters allow administrators to prevent specific pages from being translated 475 * Excluded pages display translated content only if a translation already exists; Autoglot will not generate new translations 476 * All links will still lead to the translated version of the site 477 * URL filters can exclude specific pages from translation using wildcard patterns 478 * Page type filters can exclude search results, attachment pages, and archive pages such as category or date archives 479 * Additionally, 'meta robots' tag can be set to 'noindex' to prevent search engines from indexing the content of excluded pages 480 * Minor optimization in the search function 481 * Minor bug fixes in the Text Replacement module 482 467 483 = 2.10.10 (05/03/2026) = 468 484 * Added an option to format HTML and force adding closing slashes to self-closing tags such as "br" or "meta" 485 * Minor fixes 469 486 470 487 = 2.10.9 (05/03/2026) = -
autoglot/trunk/utils/autoglot_constants.php
r3475813 r3484878 192 192 * Default keys for URLs in inline JS+JSON objects 193 193 */ 194 const JSON_KEYS_URL = array('url', 'urlTemplate' );194 const JSON_KEYS_URL = array('url', 'urlTemplate', '@id'); 195 195 196 196 const ADMIN_ALLOWED_TAGS = array( … … 317 317 318 318 //Define for autoglot plugin version 319 define('AUTOGLOT_PLUGIN_VER', '2.1 0.10');319 define('AUTOGLOT_PLUGIN_VER', '2.11.0'); 320 320 321 321 //Define for autoglot plugin name … … 434 434 //use advanced search 435 435 define('AUTOGLOT_DEFAULT_ADVANCED_SEARCH', 1);//2.7.0 436 437 //no-index excluded pages 438 define('AUTOGLOT_DEFAULT_EXCLUSION_NOINDEX', 0);//2.11.0 436 439 437 440 /*********************** folders settings *********************/ -
autoglot/trunk/utils/autoglot_db.php
r3469237 r3484878 486 486 return $return; 487 487 } else { 488 return false;488 return array(); 489 489 } 490 490 } -
autoglot/trunk/utils/autoglot_dom.php
r3475723 r3484878 546 546 } 547 547 $node->setAttribute("content", $og_locale); 548 } 549 550 if($this->autoglot->translation_excluded && $this->autoglot->options->exclusion_noindex) { 551 $robotstags = $xpath->query("//meta[@name=\"robots\"]"); 552 if ($robotstags->length){ 553 foreach ($robotstags as $node) { 554 $content = $node->getAttribute("content"); 555 $parts = array_map('trim', explode(',', $content)); 556 $lowerParts = array_map('strtolower', $parts); 557 558 if (in_array('index', $lowerParts)) { 559 foreach ($parts as $key => $value) { 560 if (strtolower($value) === 'index') $parts[$key] = 'noindex'; 561 } 562 } elseif (!in_array('noindex', $lowerParts)) { 563 $parts[] = 'noindex'; 564 } 565 566 $node->setAttribute("content", implode(', ', $parts)); 567 } 568 } else { 569 $head = $xpath->query("//head")->item(0); 570 if ($head) { 571 $newRobots = $head->ownerDocument->createElement('meta'); 572 $newRobots->setAttribute('name', 'robots'); 573 $newRobots->setAttribute('content', 'noindex'); 574 $head->appendChild($newRobots); 575 } 576 } 548 577 } 549 578 -
autoglot/trunk/utils/autoglot_options.php
r3475723 r3484878 49 49 public $editors_edit; 50 50 public $advanced_search; 51 public $exclusion_urls; 52 public $exclusion_archives; 53 public $exclusion_noindex; 51 54 52 55 private $translate_delays; … … 55 58 private $language_name_options; 56 59 private $language_switcher_menu; 60 61 private $default_archives; 57 62 58 63 private function validate_checkbox($option, $default1 = 1, $max_value = 1){ … … 179 184 $this->manual_strings = stripslashes($option); 180 185 186 $option = get_option('autoglot_translation_exclusion_urls'); 187 $vldt_eu = explode("\r\n", trim( stripslashes($option))); 188 $this->exclusion_urls = array(); 189 foreach($vldt_eu as $path){ 190 $path = preg_replace( '/[^\p{L}\p{N}\/\-_\.\*]/u', '', $path ); 191 $path = preg_replace( '/\/\/+/', '/', $path ); 192 if(strlen($path))$this->exclusion_urls[] = $path; 193 } 194 195 $option = get_option('autoglot_translation_exclusion_archives', array()); 196 $this->exclusion_archives = array(); 197 foreach($option as $ln) { 198 if(is_string($ln) && preg_match('/^[a-z0-9_]+$/i', $ln)){//can't check real values because they have not been generated yet 199 $this->exclusion_archives[] = $ln; 200 } 201 } 202 203 $option = get_option('autoglot_translation_exclusion_noindex', array(AUTOGLOT_DEFAULT_EXCLUSION_NOINDEX)); 204 $this->exclusion_noindex = $this->validate_checkbox($option[0], AUTOGLOT_DEFAULT_EXCLUSION_NOINDEX); 205 181 206 $option = get_option('autoglot_translation_add_lngcode'); 182 207 if(is_array($option)) { … … 255 280 'nativeiso' => __( 'Native name (2-letter ISO code)', 'autoglot' ), 256 281 ); 282 283 $this->default_archives = array( 284 'default_author' => __('Author Archives', 'autoglot' ), 285 'default_date' => __('Date Archives', 'autoglot' ), 286 'default_search' => __('Search Results', 'autoglot' ), 287 'default_attachment' => __('Attachment Pages', 'autoglot' ), 288 'default_404' => __('404 Not Found Page', 'autoglot' ), 289 ); 290 257 291 } 258 292 … … 276 310 return $this->language_name_options; 277 311 } 312 313 public function get_archives(): array { 314 $archives = array(); 315 $taxes = get_taxonomies(array( 'public' => true ), "object"); 316 foreach($taxes as $tx){ 317 if(is_object($tx) && isset($tx->name) && isset($tx->label)) 318 $archives[$tx->name] = $tx->label; 319 } 320 $archives = array_merge($this->default_archives, $archives); 321 322 return $archives; 323 } 278 324 } 279 325 -
autoglot/trunk/utils/autoglot_utils.php
r3475813 r3484878 313 313 $tagsList = implode('|', $selfClosingTags); 314 314 315 /** 316 * Regex Breakdown: 315 /* 317 316 * <($tagsList) -> Match the opening bracket and the tag name 318 317 * ([^>]*?) -> Capture any attributes (non-greedy) … … 326 325 327 326 return $html; 327 } 328 329 /** 330 * Check if URL is in array of excluded filters with wildcards 331 */ 332 333 public static function url_excluded($url, array $filters) { 334 foreach ($filters as $filter) { 335 336 $quotedFilter = preg_quote($filter, '#'); 337 338 $pattern = str_replace('\*', '.*', $quotedFilter); 339 340 if (preg_match('#^' . $pattern . '$#iu', $url)) { 341 return true;//URL matches this filter and should be excluded 342 } 343 } 344 return false; 328 345 } 329 346 … … 571 588 return $array; 572 589 } 590 573 591 /** 574 592 * Return capabilities for translation editors … … 579 597 } 580 598 599 581 600 /** 582 601 * Removes outer <p> tags, used in a few files
Note: See TracChangeset
for help on using the changeset viewer.