Plugin Directory

Changeset 3300741


Ignore:
Timestamp:
05/26/2025 01:16:46 PM (10 months ago)
Author:
uapp
Message:

Tagging version 1.2.0

Location:
auto-translator-polylang
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • auto-translator-polylang/tags/1.2.0/assets/js/tableFilters.min.js

    r3272387 r3300741  
    1 "use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,r):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}window.addEventListener("DOMContentLoaded",function(){var i=document.querySelector("#filter");i.addEventListener("submit",function(e){e.preventDefault();var e=i.querySelector("#post-type").value,r=i.querySelector("#language").value,t=i.querySelector("#status").value,a=_toConsumableArray(i.querySelectorAll('input[name="element[]"]:checked')),n=(null==(n=i.querySelector("#bulk-action-selector-top"))?void 0:n.value)||"",o=(null==(o=i.querySelector("#search_id-search-input"))?void 0:o.value)||"",l=a.map(function(e){return"element[]="+e.value}).join("&"),u=atfp.admin_url+"/admin.php?page=auto-translated-for-polylang";e&&(u+="&post-type="+e),r&&(u+="&language="+r),t&&(u+="&status="+t),o&&(u+="&s="+o),a.length&&"-1"!==n&&(u+="&action="+n+"&"+l),window.location.href=u})});
     1"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,r):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}window.addEventListener("DOMContentLoaded",function(){var i=document.querySelector("#filter");i.addEventListener("submit",function(e){e.preventDefault();var e=i.querySelector("#post-type").value,r=i.querySelector("#language").value,t=i.querySelector("#status").value,a=_toConsumableArray(i.querySelectorAll('input[name="element[]"]:checked')),n=(null==(n=i.querySelector("#bulk-action-selector-top"))?void 0:n.value)||"",o=(null==(o=i.querySelector("#search_id-search-input"))?void 0:o.value)||"",l=a.map(function(e){return"element[]="+e.value}).join("&"),u=atfp.admin_url+"admin.php?page=auto-translated-for-polylang";e&&(u+="&post-type="+e),r&&(u+="&language="+r),t&&(u+="&status="+t),o&&(u+="&s="+o),a.length&&"-1"!==n&&(u+="&action="+n+"&"+l),window.location.href=u})});
  • auto-translator-polylang/tags/1.2.0/auto-translator-for-polylang.php

    r3288431 r3300741  
    55 * Plugin Name: Auto Translator for Polylang
    66 * Description: Plugin to translate your pages and posts working with Polylang
    7  * Version: 1.1.2
     7 * Version: 1.2.0
    88 * Author: UAPP GROUP
    99 * Author URI: https://uapp.group/
     
    2626define('ATFP_PLUGIN_NAME', trim(dirname(ATFP_PLUGIN_BASENAME), '/'));
    2727
    28 const ATFP_VERSION = '1.1.2';
     28const ATFP_VERSION = '1.2.0';
    2929
    3030const ATFP_TEMPLATES = ATFP_PLUGIN_DIR . "/templates";
  • auto-translator-polylang/tags/1.2.0/includes/Base/ATFP_Translation.php

    r3288431 r3300741  
    113113    if (is_plugin_active('wordpress-seo/wp-seo.php')) {
    114114      $this->translate_yoast_fields($post_id, $new_post_id, $target_language);
     115    }
     116    if (is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php')) {
     117      $this->translate_aioseo_fields($post_id, $new_post_id, $target_language);
    115118    }
    116119  }
     
    259262      );
    260263    }
     264  }
     265
     266  private function translate_aioseo_fields ($post_id, $new_post_id, $target_language) {
     267    global $wpdb;
     268
     269    if (!is_numeric($post_id) || !is_numeric($new_post_id) || empty($target_language)) {
     270      return;
     271    }
     272
     273    $pref  = $wpdb->prefix;
     274    $table = "{$pref}aioseo_posts";
     275
     276    $original_fields = $wpdb->get_row(
     277      $wpdb->prepare("SELECT * FROM $table WHERE post_id = %d", $post_id),
     278      ARRAY_A
     279    );
     280
     281    if (empty($original_fields)) {
     282      return;
     283    }
     284
     285    unset($original_fields['id']);
     286
     287    $original_fields['post_id'] = (int)$new_post_id;
     288
     289    $translatable_fields = [
     290      'title',
     291      'description',
     292      'og_title',
     293      'og_description',
     294      'twitter_title',
     295      'twitter_description',
     296      'facebook_title',
     297      'facebook_description',
     298      'seo_title',
     299    ];
     300
     301    $replace_placeholders = static function ($string) {
     302      $pattern = '/#\w+/';
     303      $matches = [];
     304
     305      $callback = function ($match) use (&$matches) {
     306        $matches[] = $match[0];
     307        return '@@@';
     308      };
     309
     310      $safe_string = preg_replace_callback($pattern, $callback, $string);
     311      return [$safe_string, $matches];
     312    };
     313
     314    $restore_placeholders = static function ($string, $placeholders) {
     315      $index = 0;
     316
     317      return preg_replace_callback('/@@@/', function () use (&$placeholders, &$index) {
     318        return $placeholders[$index++] ?? '@@@';
     319      }, $string);
     320    };
     321
     322    foreach ($translatable_fields as $field) {
     323      if (!empty($original_fields[$field])) {
     324        [$safe_string, $placeholders] = $replace_placeholders($original_fields[$field]);
     325        $translated              = $this->translate_text($safe_string, $target_language);
     326        $original_fields[$field] = $restore_placeholders($translated, $placeholders);
     327      }
     328    }
     329
     330    $wpdb->insert($table, $original_fields);
    261331  }
    262332
     
    420490  }
    421491
    422   private function get_text_from_html($html, $target_language) {
     492  private function get_text_from_html ($html, $target_language) {
    423493    include_once('simplehtmldom/simple_html_dom.php');
    424494
     
    438508    foreach ($dom->find('p, div, span, li') as $block) {
    439509      if (!empty(trim($block->innertext))) {
    440         list($text_with_placeholders, $tag_map) = $this->replace_inline_tags_with_placeholders($block->innertext);
     510        [$text_with_placeholders, $tag_map] = $this->replace_inline_tags_with_placeholders($block->innertext);
    441511
    442512        $translated = $this->translate_text($text_with_placeholders, $target_language);
    443513
    444514        if ($translated) {
    445           $restored = $this->restore_placeholders_with_tags($translated, $tag_map);
     515          $restored         = $this->restore_placeholders_with_tags($translated, $tag_map);
    446516          $block->innertext = $restored;
    447517        }
     
    460530  }
    461531
    462   private function translate_text($text, $targetLanguage) {
    463     $api_key = get_option('atfp_api_key');
    464     $url = 'https://translation.googleapis.com/language/translate/v2';
     532  private function translate_text ($text, $targetLanguage) {
     533    $api_key      = get_option('atfp_api_key');
     534    $url          = 'https://translation.googleapis.com/language/translate/v2';
    465535    $query_params = "?q=" . esc_html(urlencode($text)) . "&target=" . esc_html($targetLanguage) . "&format=html&key=" . esc_html($api_key);
    466536
     
    523593  }
    524594
    525   private function replace_shortcodes_with_placeholders($content, &$shortcodes) {
    526     $index = 0;
     595  private function replace_shortcodes_with_placeholders ($content, &$shortcodes) {
     596    $index      = 0;
    527597    $shortcodes = [];
    528598
    529599    $content = preg_replace_callback('/\[(html_block|raw)](.*?)\[\/\1]/is', function ($matches) use (&$shortcodes, &$index) {
    530       $placeholder = "<!--RAWHTML_{$index}-->";
     600      $placeholder              = "<!--RAWHTML_{$index}-->";
    531601      $shortcodes[$placeholder] = $matches[0];
    532602      $index++;
     
    541611      }
    542612
    543       $placeholder = "<!--SHORTCODE_{$index}-->";
     613      $placeholder              = "<!--SHORTCODE_{$index}-->";
    544614      $shortcodes[$placeholder] = $full_shortcode;
    545615      $index++;
     
    548618  }
    549619
    550   private function restore_shortcodes_from_placeholders($content, $shortcodes) {
     620  private function restore_shortcodes_from_placeholders ($content, $shortcodes) {
    551621    return str_replace(array_keys($shortcodes), array_values($shortcodes), $content);
    552622  }
    553623
    554   private function replace_inline_tags_with_placeholders($html) {
     624  private function replace_inline_tags_with_placeholders ($html) {
    555625    $dom = new ATFP_simple_html_dom();
    556626    $dom->load($html);
    557627
    558     $index = 0;
     628    $index   = 0;
    559629    $tag_map = [];
    560630
     
    562632      if (in_array($node->tag, ['a', 'strong', 'em', 'b', 'i', 'u', 'span'])) {
    563633        $placeholder_start = "[tag{$index}]";
    564         $placeholder_end = "[/tag{$index}]";
     634        $placeholder_end   = "[/tag{$index}]";
    565635
    566636        $tag_map["tag{$index}"] = $node->outertext;
    567         $inner = $node->innertext;
     637        $inner                  = $node->innertext;
    568638
    569639        $node->outertext = $placeholder_start . $inner . $placeholder_end;
     
    576646  }
    577647
    578   private function restore_placeholders_with_tags($text, $tag_map) {
     648  private function restore_placeholders_with_tags ($text, $tag_map) {
    579649    foreach ($tag_map as $key => $original_html) {
    580650      if (preg_match('/^<([a-z0-9]+)([^>]*)>(.*?)<\/\1>$/is', $original_html, $parts)) {
    581651        $tag_name = $parts[1];
    582         $attrs = $parts[2];
     652        $attrs    = $parts[2];
    583653
    584654        $pattern = "/\\[{$key}\\](.*?)\\[\\/{$key}\\]/s";
    585655
    586         $text = preg_replace_callback($pattern, function($match) use ($tag_name, $attrs) {
     656        $text = preg_replace_callback($pattern, function ($match) use ($tag_name, $attrs) {
    587657          $translated_inner = $match[1];
    588658          return "<{$tag_name}{$attrs}>{$translated_inner}</{$tag_name}>";
     
    594664  }
    595665
    596   private function replace_br_tags_with_placeholders($html) {
     666  private function replace_br_tags_with_placeholders ($html) {
    597667    $index = 0;
    598     return preg_replace_callback('/<br\s*\/?>/i', function() use (&$index) {
     668    return preg_replace_callback('/<br\s*\/?>/i', function () use (&$index) {
    599669      $placeholder = "<!--BR_{$index}-->";
    600670      $index++;
     
    603673  }
    604674
    605   private function restore_br_tags_from_placeholders($text) {
    606     return preg_replace_callback('/<!--BR_(\d+)-->/', function($matches) {
     675  private function restore_br_tags_from_placeholders ($text) {
     676    return preg_replace_callback('/<!--BR_(\d+)-->/', function ($matches) {
    607677      return '<br />';
    608678    }, $text);
  • auto-translator-polylang/tags/1.2.0/readme.txt

    r3288431 r3300741  
    55Requires at least: 5.8
    66Tested up to: 6.8.1
    7 Stable tag: 1.1.2
     7Stable tag: 1.2.0
    88License: GPLv3
    99License URI: https://opensource.org/licenses/GPL-3.0
     
    5151== Changelog ==
    5252
     53= 1.2.0 =
     54- Feature: Add translation support for All in One SEO Pack plugin
     55
    5356= 1.1.2 =
    5457- Fix: Fixed inline tags handling
  • auto-translator-polylang/trunk/assets/js/tableFilters.min.js

    r3272387 r3300741  
    1 "use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,r):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}window.addEventListener("DOMContentLoaded",function(){var i=document.querySelector("#filter");i.addEventListener("submit",function(e){e.preventDefault();var e=i.querySelector("#post-type").value,r=i.querySelector("#language").value,t=i.querySelector("#status").value,a=_toConsumableArray(i.querySelectorAll('input[name="element[]"]:checked')),n=(null==(n=i.querySelector("#bulk-action-selector-top"))?void 0:n.value)||"",o=(null==(o=i.querySelector("#search_id-search-input"))?void 0:o.value)||"",l=a.map(function(e){return"element[]="+e.value}).join("&"),u=atfp.admin_url+"/admin.php?page=auto-translated-for-polylang";e&&(u+="&post-type="+e),r&&(u+="&language="+r),t&&(u+="&status="+t),o&&(u+="&s="+o),a.length&&"-1"!==n&&(u+="&action="+n+"&"+l),window.location.href=u})});
     1"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,r):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}window.addEventListener("DOMContentLoaded",function(){var i=document.querySelector("#filter");i.addEventListener("submit",function(e){e.preventDefault();var e=i.querySelector("#post-type").value,r=i.querySelector("#language").value,t=i.querySelector("#status").value,a=_toConsumableArray(i.querySelectorAll('input[name="element[]"]:checked')),n=(null==(n=i.querySelector("#bulk-action-selector-top"))?void 0:n.value)||"",o=(null==(o=i.querySelector("#search_id-search-input"))?void 0:o.value)||"",l=a.map(function(e){return"element[]="+e.value}).join("&"),u=atfp.admin_url+"admin.php?page=auto-translated-for-polylang";e&&(u+="&post-type="+e),r&&(u+="&language="+r),t&&(u+="&status="+t),o&&(u+="&s="+o),a.length&&"-1"!==n&&(u+="&action="+n+"&"+l),window.location.href=u})});
  • auto-translator-polylang/trunk/auto-translator-for-polylang.php

    r3288431 r3300741  
    55 * Plugin Name: Auto Translator for Polylang
    66 * Description: Plugin to translate your pages and posts working with Polylang
    7  * Version: 1.1.2
     7 * Version: 1.2.0
    88 * Author: UAPP GROUP
    99 * Author URI: https://uapp.group/
     
    2626define('ATFP_PLUGIN_NAME', trim(dirname(ATFP_PLUGIN_BASENAME), '/'));
    2727
    28 const ATFP_VERSION = '1.1.2';
     28const ATFP_VERSION = '1.2.0';
    2929
    3030const ATFP_TEMPLATES = ATFP_PLUGIN_DIR . "/templates";
  • auto-translator-polylang/trunk/includes/Base/ATFP_Translation.php

    r3288431 r3300741  
    113113    if (is_plugin_active('wordpress-seo/wp-seo.php')) {
    114114      $this->translate_yoast_fields($post_id, $new_post_id, $target_language);
     115    }
     116    if (is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php')) {
     117      $this->translate_aioseo_fields($post_id, $new_post_id, $target_language);
    115118    }
    116119  }
     
    259262      );
    260263    }
     264  }
     265
     266  private function translate_aioseo_fields ($post_id, $new_post_id, $target_language) {
     267    global $wpdb;
     268
     269    if (!is_numeric($post_id) || !is_numeric($new_post_id) || empty($target_language)) {
     270      return;
     271    }
     272
     273    $pref  = $wpdb->prefix;
     274    $table = "{$pref}aioseo_posts";
     275
     276    $original_fields = $wpdb->get_row(
     277      $wpdb->prepare("SELECT * FROM $table WHERE post_id = %d", $post_id),
     278      ARRAY_A
     279    );
     280
     281    if (empty($original_fields)) {
     282      return;
     283    }
     284
     285    unset($original_fields['id']);
     286
     287    $original_fields['post_id'] = (int)$new_post_id;
     288
     289    $translatable_fields = [
     290      'title',
     291      'description',
     292      'og_title',
     293      'og_description',
     294      'twitter_title',
     295      'twitter_description',
     296      'facebook_title',
     297      'facebook_description',
     298      'seo_title',
     299    ];
     300
     301    $replace_placeholders = static function ($string) {
     302      $pattern = '/#\w+/';
     303      $matches = [];
     304
     305      $callback = function ($match) use (&$matches) {
     306        $matches[] = $match[0];
     307        return '@@@';
     308      };
     309
     310      $safe_string = preg_replace_callback($pattern, $callback, $string);
     311      return [$safe_string, $matches];
     312    };
     313
     314    $restore_placeholders = static function ($string, $placeholders) {
     315      $index = 0;
     316
     317      return preg_replace_callback('/@@@/', function () use (&$placeholders, &$index) {
     318        return $placeholders[$index++] ?? '@@@';
     319      }, $string);
     320    };
     321
     322    foreach ($translatable_fields as $field) {
     323      if (!empty($original_fields[$field])) {
     324        [$safe_string, $placeholders] = $replace_placeholders($original_fields[$field]);
     325        $translated              = $this->translate_text($safe_string, $target_language);
     326        $original_fields[$field] = $restore_placeholders($translated, $placeholders);
     327      }
     328    }
     329
     330    $wpdb->insert($table, $original_fields);
    261331  }
    262332
     
    420490  }
    421491
    422   private function get_text_from_html($html, $target_language) {
     492  private function get_text_from_html ($html, $target_language) {
    423493    include_once('simplehtmldom/simple_html_dom.php');
    424494
     
    438508    foreach ($dom->find('p, div, span, li') as $block) {
    439509      if (!empty(trim($block->innertext))) {
    440         list($text_with_placeholders, $tag_map) = $this->replace_inline_tags_with_placeholders($block->innertext);
     510        [$text_with_placeholders, $tag_map] = $this->replace_inline_tags_with_placeholders($block->innertext);
    441511
    442512        $translated = $this->translate_text($text_with_placeholders, $target_language);
    443513
    444514        if ($translated) {
    445           $restored = $this->restore_placeholders_with_tags($translated, $tag_map);
     515          $restored         = $this->restore_placeholders_with_tags($translated, $tag_map);
    446516          $block->innertext = $restored;
    447517        }
     
    460530  }
    461531
    462   private function translate_text($text, $targetLanguage) {
    463     $api_key = get_option('atfp_api_key');
    464     $url = 'https://translation.googleapis.com/language/translate/v2';
     532  private function translate_text ($text, $targetLanguage) {
     533    $api_key      = get_option('atfp_api_key');
     534    $url          = 'https://translation.googleapis.com/language/translate/v2';
    465535    $query_params = "?q=" . esc_html(urlencode($text)) . "&target=" . esc_html($targetLanguage) . "&format=html&key=" . esc_html($api_key);
    466536
     
    523593  }
    524594
    525   private function replace_shortcodes_with_placeholders($content, &$shortcodes) {
    526     $index = 0;
     595  private function replace_shortcodes_with_placeholders ($content, &$shortcodes) {
     596    $index      = 0;
    527597    $shortcodes = [];
    528598
    529599    $content = preg_replace_callback('/\[(html_block|raw)](.*?)\[\/\1]/is', function ($matches) use (&$shortcodes, &$index) {
    530       $placeholder = "<!--RAWHTML_{$index}-->";
     600      $placeholder              = "<!--RAWHTML_{$index}-->";
    531601      $shortcodes[$placeholder] = $matches[0];
    532602      $index++;
     
    541611      }
    542612
    543       $placeholder = "<!--SHORTCODE_{$index}-->";
     613      $placeholder              = "<!--SHORTCODE_{$index}-->";
    544614      $shortcodes[$placeholder] = $full_shortcode;
    545615      $index++;
     
    548618  }
    549619
    550   private function restore_shortcodes_from_placeholders($content, $shortcodes) {
     620  private function restore_shortcodes_from_placeholders ($content, $shortcodes) {
    551621    return str_replace(array_keys($shortcodes), array_values($shortcodes), $content);
    552622  }
    553623
    554   private function replace_inline_tags_with_placeholders($html) {
     624  private function replace_inline_tags_with_placeholders ($html) {
    555625    $dom = new ATFP_simple_html_dom();
    556626    $dom->load($html);
    557627
    558     $index = 0;
     628    $index   = 0;
    559629    $tag_map = [];
    560630
     
    562632      if (in_array($node->tag, ['a', 'strong', 'em', 'b', 'i', 'u', 'span'])) {
    563633        $placeholder_start = "[tag{$index}]";
    564         $placeholder_end = "[/tag{$index}]";
     634        $placeholder_end   = "[/tag{$index}]";
    565635
    566636        $tag_map["tag{$index}"] = $node->outertext;
    567         $inner = $node->innertext;
     637        $inner                  = $node->innertext;
    568638
    569639        $node->outertext = $placeholder_start . $inner . $placeholder_end;
     
    576646  }
    577647
    578   private function restore_placeholders_with_tags($text, $tag_map) {
     648  private function restore_placeholders_with_tags ($text, $tag_map) {
    579649    foreach ($tag_map as $key => $original_html) {
    580650      if (preg_match('/^<([a-z0-9]+)([^>]*)>(.*?)<\/\1>$/is', $original_html, $parts)) {
    581651        $tag_name = $parts[1];
    582         $attrs = $parts[2];
     652        $attrs    = $parts[2];
    583653
    584654        $pattern = "/\\[{$key}\\](.*?)\\[\\/{$key}\\]/s";
    585655
    586         $text = preg_replace_callback($pattern, function($match) use ($tag_name, $attrs) {
     656        $text = preg_replace_callback($pattern, function ($match) use ($tag_name, $attrs) {
    587657          $translated_inner = $match[1];
    588658          return "<{$tag_name}{$attrs}>{$translated_inner}</{$tag_name}>";
     
    594664  }
    595665
    596   private function replace_br_tags_with_placeholders($html) {
     666  private function replace_br_tags_with_placeholders ($html) {
    597667    $index = 0;
    598     return preg_replace_callback('/<br\s*\/?>/i', function() use (&$index) {
     668    return preg_replace_callback('/<br\s*\/?>/i', function () use (&$index) {
    599669      $placeholder = "<!--BR_{$index}-->";
    600670      $index++;
     
    603673  }
    604674
    605   private function restore_br_tags_from_placeholders($text) {
    606     return preg_replace_callback('/<!--BR_(\d+)-->/', function($matches) {
     675  private function restore_br_tags_from_placeholders ($text) {
     676    return preg_replace_callback('/<!--BR_(\d+)-->/', function ($matches) {
    607677      return '<br />';
    608678    }, $text);
  • auto-translator-polylang/trunk/readme.txt

    r3288431 r3300741  
    55Requires at least: 5.8
    66Tested up to: 6.8.1
    7 Stable tag: 1.1.2
     7Stable tag: 1.2.0
    88License: GPLv3
    99License URI: https://opensource.org/licenses/GPL-3.0
     
    5151== Changelog ==
    5252
     53= 1.2.0 =
     54- Feature: Add translation support for All in One SEO Pack plugin
     55
    5356= 1.1.2 =
    5457- Fix: Fixed inline tags handling
Note: See TracChangeset for help on using the changeset viewer.