Plugin Directory

Changeset 3408373


Ignore:
Timestamp:
12/02/2025 06:21:38 PM (6 weeks ago)
Author:
geotargetly
Message:

Deploy geo-translate to wordpress for tag 1.0.1

Location:
geo-targetly-geo-translate
Files:
24 added
8 edited

Legend:

Unmodified
Added
Removed
  • geo-targetly-geo-translate/trunk/geo-targetly-geo-translate.php

    r3375764 r3408373  
    33 * Plugin Name: Geo Targetly Geo Translate
    44 * Description: Auto-translate and localize your site by visitor location. Show language variants by country, region, or browser language.
    5  * Version: 1.0.0
     5 * Version: 1.0.1
    66 * Author: Geo Targetly
    77 * Author URI: https://geotargetly.com
     
    2424
    2525inject_script();
     26
     27register_wp_installation(__FILE__);
  • geo-targetly-geo-translate/trunk/php/shared/autoload.php

    r3375764 r3408373  
    66
    77require_once __DIR__ . '/identification.php';
     8require_once __DIR__ . '/plugins_api.php';
  • geo-targetly-geo-translate/trunk/php/shared/identification.php

    r3375764 r3408373  
    66  return 'geotargetly_geo_translate' . ($resource ? "_$resource" : '');
    77}
     8
     9function get_instance_id($siteId)
     10{
     11  $salt = get_unique_id('instance_id');
     12  return hash('sha512', $salt . '|' . $siteId);
     13}
  • geo-targetly-geo-translate/trunk/php/wordpress/admin_builder.php

    r3375764 r3408373  
    77 * @return void
    88 */
    9 function register_wp_menu($title, $renderDescriptionSection)
     9function register_wp_menu($title, $renderDescriptionSection, $id = null)
    1010{
    11   add_action('admin_menu', function () use ($title, $renderDescriptionSection) {
     11  add_action('admin_menu', function () use (
     12    $title,
     13    $renderDescriptionSection,
     14    $id
     15  ) {
    1216    add_menu_page(
    1317      "$title - Geo Targetly",
    1418      $title,
    1519      'manage_options',
    16       get_unique_id(),
     20      !empty($id) ? $id : get_unique_id(),
    1721      function () use ($title, $renderDescriptionSection) {
    1822        return require __DIR__ . '/html/settings_page.php';
     
    2327}
    2428
    25 function register_wp_settings()
     29function register_wp_settings($legacyOptionName = null, $legacyFieldName = null)
    2630{
    27   add_action('admin_init', function () {
     31  add_action('admin_init', function () use (
     32    $legacyOptionName,
     33    $legacyFieldName
     34  ) {
    2835    register_setting(get_unique_id('pluginPage'), get_settings_field_name(), [
    2936      'sanitize_callback' => function ($input) {
     
    4653      get_unique_id('ids'),
    4754      __('IDs (comma separated)', 'geo-targetly-geo-translate'),
    48       function () {
     55      function () use ($legacyOptionName, $legacyFieldName) {
    4956        $optionFieldName = get_settings_field_name();
    5057        $options = get_option($optionFieldName);
    5158        $arrayKey = get_unique_id('ids');
     59        $fieldName = $arrayKey;
     60        if (empty($options) && $legacyOptionName && $legacyFieldName) {
     61          $options = get_option($legacyOptionName);
     62          $fieldName = $legacyFieldName;
     63        }
    5264        $name = "{$optionFieldName}[$arrayKey]";
    53         $value = is_array($options) ? $options[get_unique_id('ids')] : '';
     65        $value = is_array($options) ? $options[$fieldName] : '';
    5466        return require __DIR__ . '/html/ids_input.php';
    5567      },
  • geo-targetly-geo-translate/trunk/php/wordpress/autoload.php

    r3375764 r3408373  
    88require_once __DIR__ . '/admin_builder.php';
    99require_once __DIR__ . '/script_injector.php';
     10require_once __DIR__ . '/analytics.php';
  • geo-targetly-geo-translate/trunk/php/wordpress/identification.php

    r3375764 r3408373  
    66  return get_unique_id('settings');
    77}
     8
     9function get_instance_field_name()
     10{
     11  return get_unique_id('instance');
     12}
     13
     14function get_wp_instance_id()
     15{
     16  return get_instance_id(get_site_url());
     17}
  • geo-targetly-geo-translate/trunk/php/wordpress/script_injector.php

    r3375764 r3408373  
    22namespace GeoTargetly\GeoTranslate;
    33
    4 function inject_script()
     4function inject_script($legacyOptionName = null, $legacyFieldName = null)
    55{
    6   add_action('init', function () {
     6  add_action('init', function () use ($legacyOptionName, $legacyFieldName) {
    77    $optionFieldName = get_settings_field_name();
    88    $options = get_option($optionFieldName);
    9     $value = is_array($options) ? $options[get_unique_id('ids')] : '';
     9    $fieldName = get_unique_id('ids');
     10    if (empty($options) && $legacyOptionName && $legacyFieldName) {
     11      $options = get_option($legacyOptionName);
     12      $fieldName = $legacyFieldName;
     13    }
     14    $value = is_array($options) ? $options[$fieldName] : '';
    1015    $ids = array_filter(
    1116      array_map(function ($value) {
  • geo-targetly-geo-translate/trunk/readme.txt

    r3375764 r3408373  
    55Requires at least: 3.0
    66Tested up to: 6.8
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4949== External services ==
    5050
    51 This plugin connects to an external endpoint via the domain https://g594253005.co to load and run a script that powers its core
    52 functionality, as outlined previously in the description.
     51This plugin connects to an external endpoint via the domain https://g594253005.co to load and run a script that powers its core functionality, as outlined previously in the description.
    5352
    54 It sends the user's location each time the plugin is loaded. This is necessary to determine and customize the plugin’s
    55 behavior based on the user's geographical context.
     53It sends the user's location each time the plugin is loaded. This is necessary to determine and customize the plugin’s behavior based on the user's geographical context.
    5654
    57 This service is provided by Geo Targetly – [Terms of Use](https://geotargetly.com/website-terms-of-use),
    58 [Privacy Policy](https://geotargetly.com/privacy-policy).
     55Additionally, this plugin connects to analytics endpoint https://g97676560.co/ to track plugin installation and usage over time.
     56
     57This service is provided by Geo Targetly – [Terms of Use](https://geotargetly.com/website-terms-of-use), [Privacy Policy](https://geotargetly.com/privacy-policy).
Note: See TracChangeset for help on using the changeset viewer.