Plugin Directory

Changeset 3272387


Ignore:
Timestamp:
04/14/2025 12:25:05 PM (11 months ago)
Author:
uapp
Message:

Tagging version 1.1.0

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

Legend:

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

    r3269769 r3272387  
    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";console.log(atfp.admin_url),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.1.0/auto-translator-for-polylang.php

    r3269769 r3272387  
    55 * Plugin Name: Auto Translator for Polylang
    66 * Description: Plugin to translate your pages and posts working with Polylang
    7  * Version: 1.0.6
     7 * Version: 1.1.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.0.6';
     28const ATFP_VERSION = '1.1.0';
    2929
    3030const ATFP_TEMPLATES = ATFP_PLUGIN_DIR . "/templates";
  • auto-translator-polylang/tags/1.1.0/includes/Api/Callbacks/ATFP_SettingsPageCallbacks.php

    r3115417 r3272387  
    77
    88
    9 if(!defined('ABSPATH')) {
    10     exit; // Don't access directly.
     9if (!defined('ABSPATH')) {
     10  exit; // Don't access directly.
    1111}
    1212
    1313class ATFP_SettingsPageCallbacks implements ATFP_Callbacks {
    14     public static function pageOptionGroup($input) {
    15         return $input;
    16     }
     14  public static function pageOptionGroup ($input) {
     15    return $input;
     16  }
    1717
    18     public static function pageSection() {
    19     }
     18  public static function pageSection () {
     19  }
    2020
    21     public static function pageField($options) {
    22         $output = '';
     21  public static function pageField($options) {
     22    $output = '';
    2323
    24         if($options['type'] == 'textarea') {
    25             $output .= "<textarea ";
    26         } else {
    27             $output .= "<input ";
    28             $output .= "type='{$options['type']}' ";
    29         }
     24    if ($options['type'] === 'textarea') {
     25      $output .= "<textarea ";
     26    } else {
     27      $output .= "<input ";
     28      $output .= "type='{$options['type']}' ";
     29    }
    3030
    31         if($options['name'] != '') {
    32             $output .= "name='{$options['name']}' ";
    33         }
     31    if (!empty($options['name'])) {
     32      $output .= "name='{$options['name']}' ";
     33    }
    3434
    35         if($options['id'] != '') {
    36             $output .= "id='{$options['id']}' ";
    37         }
     35    if (!empty($options['id'])) {
     36      $output .= "id='{$options['id']}' ";
     37    }
    3838
    39         if($options['class']) {
    40             $output .= "class='{$options['class']}' ";
    41         }
     39    if (!empty($options['class'])) {
     40      $output .= "class='{$options['class']}' ";
     41    }
    4242
    43         if($options['placeholder']) {
    44             $output .= "placeholder='{$options['placeholder']}' ";
    45         }
     43    if (!empty($options['placeholder'])) {
     44      $output .= "placeholder='{$options['placeholder']}' ";
     45    }
    4646
    47         if($options['value']) {
    48             $output .= "value='{$options['value']}' ";
    49         }
     47    if ($options['type'] === 'checkbox') {
     48      $option_value = get_option($options['name']);
     49      if ($option_value === 'on') {
     50        $output .= "checked ";
     51      }
     52      $output .= "value='on' ";
     53    } else {
     54      if (isset($options['value'])) {
     55        $output .= "value='{$options['value']}' ";
     56      }
     57    }
    5058
    51         if($options['type'] == 'textarea') {
    52             $output .= "></textarea>";
    53         } else {
    54             $output .= "> ";
    55         };
     59    if ($options['type'] === 'textarea') {
     60      $output .= "></textarea>";
     61    } else {
     62      $output .= "/> ";
     63    }
    5664
    57         echo wp_kses($output, [
    58             'input'    => [
    59                 'type'        => true,
    60                 'name'        => true,
    61                 'value'       => true,
    62                 'placeholder' => true,
    63                 'class'       => true,
    64                 'id'          => true,
    65             ],
    66             'textarea' => [
    67                 'type'        => true,
    68                 'name'        => true,
    69                 'value'       => true,
    70                 'placeholder' => true,
    71                 'class'       => true,
    72                 'id'          => true,
    73             ],
    74         ]);
    75     }
     65    echo wp_kses($output, [
     66      'input' => [
     67        'type'        => true,
     68        'name'        => true,
     69        'value'       => true,
     70        'placeholder' => true,
     71        'class'       => true,
     72        'id'          => true,
     73        'checked'     => true,
     74      ],
     75      'textarea' => [
     76        'type'        => true,
     77        'name'        => true,
     78        'value'       => true,
     79        'placeholder' => true,
     80        'class'       => true,
     81        'id'          => true,
     82      ],
     83    ]);
     84  }
    7685}
  • auto-translator-polylang/tags/1.1.0/includes/Api/Settings/ATFP_SettingsPageSettings.php

    r3115417 r3272387  
    2121        'args'         => '',
    2222      ],
     23      [
     24        'option_group' => 'pl_option_group',
     25        'option_name'  => 'atfp_translate_shortcodes',
     26        'args'         => '',
     27      ]
    2328    ];
    2429
     
    4651          'label_for'   => 'atfp_api_key',
    4752          'class'       => 'regular-text',
    48           'value'       => get_option("atfp_api_key") ?? "",
    49           'placeholder' => "Enter your API key",
     53          'value'       => get_option('atfp_api_key') ?? '',
     54          'placeholder' => 'Enter your API key',
    5055        ],
    5156      ],
     57      [
     58        'id'       => 'translate_shortcodes',
     59        'title'    => esc_html__('Translate shortcodes', 'auto-translator-polylang'),
     60        'callback' => [ATFP_SettingsPageCallbacks::class, 'pageField'],
     61        'page'     => 'auto-translator-for-polylang',
     62        'section'  => 'pl_admin_section',
     63        'args'     => [
     64          'type'        => 'checkbox',
     65          'name'        => 'atfp_translate_shortcodes',
     66          'id'          => 'atfp_translate_shortcodes',
     67          'label_for'   => 'atfp_translate_shortcodes',
     68          'class'       => 'regular-text',
     69          'value'       => get_option('atfp_translate_shortcodes'),
     70        ],
     71      ]
    5272    ];
    5373  }
  • auto-translator-polylang/tags/1.1.0/includes/Base/ATFP_Translation.php

    r3115417 r3272387  
    402402  }
    403403
    404 
    405404  public function add_custom_select_to_posts_page () {
    406405    $languages = pll_the_languages([
     
    421420  }
    422421
    423   private function get_text_from_html ($html, $target_language) {
     422  private function get_text_from_html($html, $target_language) {
    424423    include_once('simplehtmldom/simple_html_dom.php');
     424
     425    $translate_shortcodes = get_option('atfp_translate_shortcodes') === 'on';
     426
     427    $shortcodes = [];
     428
     429    if (!$translate_shortcodes) {
     430      $html = $this->replace_shortcodes_with_placeholders($html, $shortcodes);
     431    }
     432
    425433    $dom = new ATFP_simple_html_dom();
    426434    $dom->load(wp_kses_post($html));
     
    439447    }
    440448
    441     return $dom->save();
     449    $translated_html = $dom->save();
     450
     451    if (!$translate_shortcodes) {
     452      $translated_html = $this->restore_shortcodes_from_placeholders($translated_html, $shortcodes);
     453    }
     454
     455    return $translated_html;
    442456  }
    443457
     
    505519  }
    506520
     521  private function replace_shortcodes_with_placeholders ($content, &$shortcodes) {
     522    $index      = 0;
     523    $shortcodes = [];
     524
     525    return preg_replace_callback('/\[(\[?)([^\[\]]+)(\]?)\]/', function ($matches) use (&$shortcodes, &$index) {
     526      $placeholder              = '<!--SHORTCODE_' . $index . '-->';
     527      $shortcodes[$placeholder] = $matches[0]; // Store original shortcode
     528      $index++;
     529      return $placeholder;
     530    }, $content);
     531  }
     532
     533  private function restore_shortcodes_from_placeholders($content, $shortcodes) {
     534    return str_replace(array_keys($shortcodes), array_values($shortcodes), $content);
     535  }
     536
    507537  public function add_bulk_action ($bulk_actions) {
    508538    $bulk_actions['translate'] = 'Translate';
  • auto-translator-polylang/tags/1.1.0/readme.txt

    r3269769 r3272387  
    55Requires at least: 5.8
    66Tested up to: 6.7.2
    7 Stable tag: 1.0.6
     7Stable tag: 1.1.0
    88License: GPLv3
    99License URI: https://opensource.org/licenses/GPL-3.0
     
    5151== Changelog ==
    5252
     53= 1.1.0 =
     54- Feature: add shortcode translation option
     55
    5356= 1.0.6 =
    5457- Fix: Add activation check for PRO version
  • auto-translator-polylang/trunk/assets/js/tableFilters.min.js

    r3269769 r3272387  
    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";console.log(atfp.admin_url),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

    r3269769 r3272387  
    55 * Plugin Name: Auto Translator for Polylang
    66 * Description: Plugin to translate your pages and posts working with Polylang
    7  * Version: 1.0.6
     7 * Version: 1.1.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.0.6';
     28const ATFP_VERSION = '1.1.0';
    2929
    3030const ATFP_TEMPLATES = ATFP_PLUGIN_DIR . "/templates";
  • auto-translator-polylang/trunk/includes/Api/Callbacks/ATFP_SettingsPageCallbacks.php

    r3115417 r3272387  
    77
    88
    9 if(!defined('ABSPATH')) {
    10     exit; // Don't access directly.
     9if (!defined('ABSPATH')) {
     10  exit; // Don't access directly.
    1111}
    1212
    1313class ATFP_SettingsPageCallbacks implements ATFP_Callbacks {
    14     public static function pageOptionGroup($input) {
    15         return $input;
    16     }
     14  public static function pageOptionGroup ($input) {
     15    return $input;
     16  }
    1717
    18     public static function pageSection() {
    19     }
     18  public static function pageSection () {
     19  }
    2020
    21     public static function pageField($options) {
    22         $output = '';
     21  public static function pageField($options) {
     22    $output = '';
    2323
    24         if($options['type'] == 'textarea') {
    25             $output .= "<textarea ";
    26         } else {
    27             $output .= "<input ";
    28             $output .= "type='{$options['type']}' ";
    29         }
     24    if ($options['type'] === 'textarea') {
     25      $output .= "<textarea ";
     26    } else {
     27      $output .= "<input ";
     28      $output .= "type='{$options['type']}' ";
     29    }
    3030
    31         if($options['name'] != '') {
    32             $output .= "name='{$options['name']}' ";
    33         }
     31    if (!empty($options['name'])) {
     32      $output .= "name='{$options['name']}' ";
     33    }
    3434
    35         if($options['id'] != '') {
    36             $output .= "id='{$options['id']}' ";
    37         }
     35    if (!empty($options['id'])) {
     36      $output .= "id='{$options['id']}' ";
     37    }
    3838
    39         if($options['class']) {
    40             $output .= "class='{$options['class']}' ";
    41         }
     39    if (!empty($options['class'])) {
     40      $output .= "class='{$options['class']}' ";
     41    }
    4242
    43         if($options['placeholder']) {
    44             $output .= "placeholder='{$options['placeholder']}' ";
    45         }
     43    if (!empty($options['placeholder'])) {
     44      $output .= "placeholder='{$options['placeholder']}' ";
     45    }
    4646
    47         if($options['value']) {
    48             $output .= "value='{$options['value']}' ";
    49         }
     47    if ($options['type'] === 'checkbox') {
     48      $option_value = get_option($options['name']);
     49      if ($option_value === 'on') {
     50        $output .= "checked ";
     51      }
     52      $output .= "value='on' ";
     53    } else {
     54      if (isset($options['value'])) {
     55        $output .= "value='{$options['value']}' ";
     56      }
     57    }
    5058
    51         if($options['type'] == 'textarea') {
    52             $output .= "></textarea>";
    53         } else {
    54             $output .= "> ";
    55         };
     59    if ($options['type'] === 'textarea') {
     60      $output .= "></textarea>";
     61    } else {
     62      $output .= "/> ";
     63    }
    5664
    57         echo wp_kses($output, [
    58             'input'    => [
    59                 'type'        => true,
    60                 'name'        => true,
    61                 'value'       => true,
    62                 'placeholder' => true,
    63                 'class'       => true,
    64                 'id'          => true,
    65             ],
    66             'textarea' => [
    67                 'type'        => true,
    68                 'name'        => true,
    69                 'value'       => true,
    70                 'placeholder' => true,
    71                 'class'       => true,
    72                 'id'          => true,
    73             ],
    74         ]);
    75     }
     65    echo wp_kses($output, [
     66      'input' => [
     67        'type'        => true,
     68        'name'        => true,
     69        'value'       => true,
     70        'placeholder' => true,
     71        'class'       => true,
     72        'id'          => true,
     73        'checked'     => true,
     74      ],
     75      'textarea' => [
     76        'type'        => true,
     77        'name'        => true,
     78        'value'       => true,
     79        'placeholder' => true,
     80        'class'       => true,
     81        'id'          => true,
     82      ],
     83    ]);
     84  }
    7685}
  • auto-translator-polylang/trunk/includes/Api/Settings/ATFP_SettingsPageSettings.php

    r3115417 r3272387  
    2121        'args'         => '',
    2222      ],
     23      [
     24        'option_group' => 'pl_option_group',
     25        'option_name'  => 'atfp_translate_shortcodes',
     26        'args'         => '',
     27      ]
    2328    ];
    2429
     
    4651          'label_for'   => 'atfp_api_key',
    4752          'class'       => 'regular-text',
    48           'value'       => get_option("atfp_api_key") ?? "",
    49           'placeholder' => "Enter your API key",
     53          'value'       => get_option('atfp_api_key') ?? '',
     54          'placeholder' => 'Enter your API key',
    5055        ],
    5156      ],
     57      [
     58        'id'       => 'translate_shortcodes',
     59        'title'    => esc_html__('Translate shortcodes', 'auto-translator-polylang'),
     60        'callback' => [ATFP_SettingsPageCallbacks::class, 'pageField'],
     61        'page'     => 'auto-translator-for-polylang',
     62        'section'  => 'pl_admin_section',
     63        'args'     => [
     64          'type'        => 'checkbox',
     65          'name'        => 'atfp_translate_shortcodes',
     66          'id'          => 'atfp_translate_shortcodes',
     67          'label_for'   => 'atfp_translate_shortcodes',
     68          'class'       => 'regular-text',
     69          'value'       => get_option('atfp_translate_shortcodes'),
     70        ],
     71      ]
    5272    ];
    5373  }
  • auto-translator-polylang/trunk/includes/Base/ATFP_Translation.php

    r3115417 r3272387  
    402402  }
    403403
    404 
    405404  public function add_custom_select_to_posts_page () {
    406405    $languages = pll_the_languages([
     
    421420  }
    422421
    423   private function get_text_from_html ($html, $target_language) {
     422  private function get_text_from_html($html, $target_language) {
    424423    include_once('simplehtmldom/simple_html_dom.php');
     424
     425    $translate_shortcodes = get_option('atfp_translate_shortcodes') === 'on';
     426
     427    $shortcodes = [];
     428
     429    if (!$translate_shortcodes) {
     430      $html = $this->replace_shortcodes_with_placeholders($html, $shortcodes);
     431    }
     432
    425433    $dom = new ATFP_simple_html_dom();
    426434    $dom->load(wp_kses_post($html));
     
    439447    }
    440448
    441     return $dom->save();
     449    $translated_html = $dom->save();
     450
     451    if (!$translate_shortcodes) {
     452      $translated_html = $this->restore_shortcodes_from_placeholders($translated_html, $shortcodes);
     453    }
     454
     455    return $translated_html;
    442456  }
    443457
     
    505519  }
    506520
     521  private function replace_shortcodes_with_placeholders ($content, &$shortcodes) {
     522    $index      = 0;
     523    $shortcodes = [];
     524
     525    return preg_replace_callback('/\[(\[?)([^\[\]]+)(\]?)\]/', function ($matches) use (&$shortcodes, &$index) {
     526      $placeholder              = '<!--SHORTCODE_' . $index . '-->';
     527      $shortcodes[$placeholder] = $matches[0]; // Store original shortcode
     528      $index++;
     529      return $placeholder;
     530    }, $content);
     531  }
     532
     533  private function restore_shortcodes_from_placeholders($content, $shortcodes) {
     534    return str_replace(array_keys($shortcodes), array_values($shortcodes), $content);
     535  }
     536
    507537  public function add_bulk_action ($bulk_actions) {
    508538    $bulk_actions['translate'] = 'Translate';
  • auto-translator-polylang/trunk/readme.txt

    r3269769 r3272387  
    55Requires at least: 5.8
    66Tested up to: 6.7.2
    7 Stable tag: 1.0.6
     7Stable tag: 1.1.0
    88License: GPLv3
    99License URI: https://opensource.org/licenses/GPL-3.0
     
    5151== Changelog ==
    5252
     53= 1.1.0 =
     54- Feature: add shortcode translation option
     55
    5356= 1.0.6 =
    5457- Fix: Add activation check for PRO version
Note: See TracChangeset for help on using the changeset viewer.