Plugin Directory

Changeset 3236567


Ignore:
Timestamp:
02/07/2025 12:20:31 PM (14 months ago)
Author:
easyling
Message:

Updating plugin to version 2.3

Location:
easyling
Files:
1 deleted
5 edited
12 copied

Legend:

Unmodified
Added
Removed
  • easyling/tags/2.3/assets/js/admin.js

    r3098777 r3236567  
    1919        $debugInfoBtn.toggleClass('active');
    2020    } );
     21
     22    $('#EasylingTestConnectionBtn').on( 'click', function( e ) {
     23        e.preventDefault();
     24        testConnection();
     25    } );
    2126});
     27
     28function testConnection() {
     29    $('#EasylingTestConnectionBtn').attr('disabled', 'disabled');
     30
     31    $.ajax({
     32      'type': 'post',
     33      'dataType': 'json',
     34      'url': Easyling.ajaxUrl,
     35      'data': {
     36        'action': Easyling.testConnectionAction,
     37        'nonce': Easyling.testConnectionNonce,
     38      }
     39    })
     40      .done(function onDone( data ) {
     41        console.log('onDone', { data });
     42        if (data.status) {
     43            $('#EasylingConnectionStatus').removeClass('notice-error').addClass('notice-success');
     44        } else {
     45            $('#EasylingConnectionStatus').removeClass('notice-success').addClass('notice-error');
     46        }
     47        $('#EasylingConnectionStatus').show().html( data.message );
     48      })
     49      .fail(function onFail() {
     50        console.log('onFail');
     51        $('#EasylingConnectionStatus').removeClass('notice-success').addClass('notice-error');
     52        $('#EasylingConnectionStatus').show().html( 'Unknown error occurred' );
     53      })
     54      .always(function onFail() {
     55        $('#EasylingTestConnectionBtn').removeAttr('disabled');
     56      })
     57    ;
     58}
    2259
    2360function updateCustomLocationVisibility() {
  • easyling/tags/2.3/easyling.php

    r3235653 r3236567  
    44Plugin URI: https://www.easyling.com/
    55Description: One-click website translation solution from Easyling.
    6 Version: 2.2
     6Version: 2.3
    77Author: Easyling
    88Copyright: Easyling
     
    8080  private function __construct() {
    8181    $this->settings = array(
    82       'version'  => '2.1',
     82      'version'  => '2.3',
    8383      'path'     => plugin_dir_path( __FILE__ ),
    8484      'url'      => plugin_dir_url( __FILE__ ),
     
    184184
    185185  /**
     186   *  Performs request to the app server
     187   */
     188  public function app_request( $params ) {
     189    extract( $params ); // publishing_mode, locale, project_code, location_host, request_method, request_body, request_uri
     190
     191    $timeout = 180;
     192
     193    if ( 'js' === $publishing_mode ) {
     194      $proxy_host = "{$locale}-{$project_code}-j.app.easyling.com";
     195    } else {
     196      // Proxy mode
     197      $proxy_host = "{$locale}-{$project_code}.{$location_host}";
     198    }
     199
     200    // Prepare headers
     201    $http_host = sanitize_text_field( $_SERVER['HTTP_HOST'] );
     202    $headers['Origin'] = $http_host;
     203    $headers['Host'] = $proxy_host;
     204    $headers['X-TranslationProxy-Cache-Info'] = 'disable';
     205    $headers['X-TranslationProxy-EnableDeepRoot'] = 'true';
     206    $headers['X-TranslationProxy-AllowRobots'] = 'true';
     207    $headers['X-TranslationProxy-ServingDomain'] = $http_host;
     208
     209    // Prepare request args
     210    $proxy_request_args = array(
     211      'method'      => $request_method,
     212      'headers'     => $headers,
     213      'timeout'     => $timeout,
     214      'redirection' => 0,
     215    );
     216
     217    if ( ! empty( $request_body ) ) {
     218      $proxy_request_args['body'] = $request_body;
     219    }
     220
     221    $request_scheme = ! empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ? strtolower( sanitize_text_field( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) : strtolower( sanitize_text_field( $_SERVER['REQUEST_SCHEME'] ) );
     222    $request_scheme = in_array( $request_scheme, array( 'http', 'https' ) ) ? $request_scheme : 'https';
     223    $proxy_url = "{$request_scheme}://{$proxy_host}{$request_uri}";
     224
     225    // Proxy request
     226    set_time_limit( $timeout + 10 );
     227
     228    return array(
     229      'proxy_url'          => $proxy_url,
     230      'proxy_request_args' => $proxy_request_args,
     231      'response'           => wp_remote_request( $proxy_url, $proxy_request_args ),
     232    );
     233  }
     234
     235
     236  /**
    186237   *  Initialize plugin
    187238   */
  • easyling/tags/2.3/inc/admin.php

    r3188801 r3236567  
    3232      add_action( 'admin_menu', array( $this, 'setup_menu' ) );
    3333      add_filter( 'plugin_action_links_' . easyling()->get_setting('basename'), array( $this, 'plugin_actions' ) );
     34    }
     35
     36    if ( is_admin() ) {
     37      add_action( 'wp_ajax_easyling_test_connection', array( $this, 'ajax_test_connection' ) );
    3438    }
    3539  }
     
    170174    }
    171175
     176    $is_configured = ! empty( $project_settings['languages'] ) && ! empty( $config['project_code'] );
    172177
    173178    $new_tab_link_icon = '<i aria-hidden="true" class="dashicons dashicons-external" style="text-decoration:none;"></i>';
     
    274279            </tr>
    275280            <tr>
     281              <th><?php esc_html_e( 'Connection testing', 'easyling' ) ?></th>
     282              <td>
     283                <a id="EasylingTestConnectionBtn" href="#" class="button button-primary"<?php echo $is_configured ? '' : ' disabled' ?>><?php esc_html_e( 'Test connection', 'easyling' ) ?></a>
     284                <?php if ( ! $is_configured ) : ?>
     285                  <p><?php esc_html_e( 'Configure and save settings first before you can test your connection.', 'easyling' ) ?></p>
     286                <?php else : ?>
     287                  <p id="EasylingConnectionStatus" class="notice" style="display: none;"></p>
     288                  <p><?php esc_html_e( 'Click to check if your connection works fine.', 'easyling' ) ?></p>
     289                <?php endif; ?>
     290              </td>
     291            </tr>
     292            <tr>
    276293              <th><?php esc_html_e( 'Floating language selector', 'easyling' ) ?></th>
    277294              <td>
     
    370387      wp_enqueue_style( 'easyling-admin', easyling()->get_setting('url') . 'assets/css/admin.css', array(), easyling()->get_setting('version'), 'all' );
    371388      wp_enqueue_script( 'easyling-admin', easyling()->get_setting('url') . 'assets/js/admin.js', array( 'jquery' ), easyling()->get_setting('version'), true );
    372     }
     389      wp_localize_script(
     390        'easyling-admin',
     391        'Easyling',
     392        array(
     393          'ajaxUrl'              => admin_url( 'admin-ajax.php' ),
     394          'testConnectionNonce'  => wp_create_nonce( 'easyling_test_connection' ),
     395          'testConnectionAction' => 'easyling_test_connection',
     396        )
     397      );
     398    }
     399  }
     400
     401
     402  /**
     403   *  Test connection of the configured project
     404   */
     405  public function ajax_test_connection() {
     406    try {
     407      check_ajax_referer( 'easyling_test_connection', 'nonce' );
     408
     409      $user_config = easyling()->get_user_config();
     410
     411      $project_settings = easyling()->get_project_settings();
     412      if ( empty( $project_settings ) ) {
     413        throw new Exception( __( 'Project settings are not saved yet', 'easyling' ), 1);
     414      }
     415
     416      $subdir_locale_map = ! empty( $project_settings['subdir_locale_map'] ) ? $project_settings['subdir_locale_map'] : array();
     417      if ( empty( $subdir_locale_map ) ) {
     418        throw new Exception( __( 'Languages are not configured', 'easyling' ), 1);
     419      }
     420
     421      $location_host = $user_config['location_host'] === 'custom' ? $user_config['custom_location_host'] : $user_config['location_host'];
     422      $location_host = ! empty( $location_host ) ? trim( $location_host ) : $location_host;
     423      if ( empty( $location_host ) ) {
     424        throw new Exception( __( 'Easyling location is invalid', 'easyling' ), 1);
     425      }
     426      $locale_prefix = array_key_first( $subdir_locale_map );
     427      $locale = $subdir_locale_map[ $locale_prefix ];
     428
     429      $result = easyling()->app_request( array(
     430        'publishing_mode' => $user_config['publishing_mode'],
     431        'locale'          => $locale,
     432        'project_code'    => $user_config['project_code'],
     433        'location_host'   => $location_host,
     434        'request_method'  => 'GET',
     435        'request_body'    => null,
     436        'request_uri'     => "/{$locale_prefix}/",
     437      ) );
     438      $response = $result['response'];
     439
     440      if ( is_wp_error( $response ) ) {
     441        $error = sprintf(
     442          __( 'Failed fetching %s, error: %s', 'easyling' ),
     443          $result['proxy_url'],
     444          $response->get_error_message()
     445        );
     446        throw new Exception( $error, 1 );
     447      }
     448
     449      echo json_encode( array(
     450        'result' => $result,
     451        'status' => true,
     452        'message' => sprintf(
     453          __( 'Successfully fetched %s, response code %s', 'easyling' ),
     454          $result['proxy_url'],
     455          $response['response']['code']
     456        ),
     457      ) );
     458    } catch (Exception $e) {
     459      echo json_encode( array(
     460        'status' => false,
     461        'message' => $e->getMessage(),
     462      ) );
     463    }
     464
     465    die();
    373466  }
    374467
  • easyling/tags/2.3/inc/frontend.php

    r3235653 r3236567  
    8686    $has_language_prefix = ! empty( $language_subdirectories ) && preg_match( "#^/($language_subdirectories)(/|\?|$)#i", $server_request_uri, $language_subdirectory_matches );
    8787    $language_subdirectory = $has_language_prefix && ! empty( $language_subdirectory_matches[1] ) ? $language_subdirectory_matches[1] : null;
    88     $locale = ! empty( $project_settings['subdir_locale_map'][ $language_subdirectory ] ) ? strtolower( $project_settings['subdir_locale_map'][ $language_subdirectory ] ) : '';
     88    $locale = ! empty( $subdir_locale_map[ $language_subdirectory ] ) ? strtolower( $subdir_locale_map[ $language_subdirectory ] ) : '';
    8989
    9090    if ( ! empty( $has_language_prefix ) && preg_match( "#/{$language_subdirectory}/wp-admin#i", $server_request_uri ) ) {
     
    246246    // Non-bot request processing
    247247
    248     if ( 'js' === $publishing_mode ) {
    249       $proxy_host = "{$locale}-{$project_code}-j.app.easyling.com";
    250     } else {
    251       // Proxy mode
    252       $proxy_host = "{$locale}-{$project_code}.{$location_host}";
    253     }
    254 
    255 
    256     // Prepare headers
    257     $http_host = sanitize_text_field( $_SERVER['HTTP_HOST'] );
    258     $headers['Origin'] = $http_host;
    259     $headers['Host'] = $proxy_host;
    260     $headers['X-TranslationProxy-Cache-Info'] = 'disable';
    261     $headers['X-TranslationProxy-EnableDeepRoot'] = 'true';
    262     $headers['X-TranslationProxy-AllowRobots'] = 'true';
    263     $headers['X-TranslationProxy-ServingDomain'] = $http_host;
    264 
    265     // Prepare request args
    266     $proxy_request_args = array(
    267       'method'      => $request_method,
    268       'headers'     => $headers,
    269       'timeout'     => 180,
    270       'redirection' => 0,
    271     );
    272 
    273     if ( ! empty( $request_body ) ) {
    274       $proxy_request_args['body'] = $request_body;
    275     }
    276 
    277     $request_scheme = ! empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ? strtolower( sanitize_text_field( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) : strtolower( sanitize_text_field( $_SERVER['REQUEST_SCHEME'] ) );
    278     $request_scheme = in_array( $request_scheme, array( 'http', 'https' ) ) ? $request_scheme : 'https';
    279     $proxy_url = "{$request_scheme}://{$proxy_host}{$server_request_uri}";
    280 
    281     // Proxy request
    282     $response = wp_remote_request( $proxy_url, $proxy_request_args );
     248    $result = easyling()->app_request( array(
     249      'publishing_mode' => $publishing_mode,
     250      'locale'          => $locale,
     251      'project_code'    => $project_code,
     252      'location_host'   => $location_host,
     253      'request_method'  => $request_method,
     254      'request_body'    => $request_body,
     255      'request_uri'     => $server_request_uri,
     256    ) );
     257    $response = $result['response'];
    283258    $response_body = ! is_wp_error( $response ) ? wp_remote_retrieve_body( $response ) : '';
    284259    $response_body = is_wp_error( $response_body ) ? '' : $response_body;
  • easyling/tags/2.3/readme.txt

    r3235653 r3236567  
    44Requires at least: 4.7
    55Tested up to: 6.7
    6 Stable tag: 2.2
     6Stable tag: 2.3
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    4444
    4545== Changelog ==
     46= 2.3 =
     47Release Date: February 7th, 2025
     48
     49Enhancements:
     50
     51* Connection testing feature
     52
    4653= 2.2 =
    4754Release Date: February 5th, 2025
  • easyling/trunk/assets/js/admin.js

    r3098777 r3236567  
    1919        $debugInfoBtn.toggleClass('active');
    2020    } );
     21
     22    $('#EasylingTestConnectionBtn').on( 'click', function( e ) {
     23        e.preventDefault();
     24        testConnection();
     25    } );
    2126});
     27
     28function testConnection() {
     29    $('#EasylingTestConnectionBtn').attr('disabled', 'disabled');
     30
     31    $.ajax({
     32      'type': 'post',
     33      'dataType': 'json',
     34      'url': Easyling.ajaxUrl,
     35      'data': {
     36        'action': Easyling.testConnectionAction,
     37        'nonce': Easyling.testConnectionNonce,
     38      }
     39    })
     40      .done(function onDone( data ) {
     41        console.log('onDone', { data });
     42        if (data.status) {
     43            $('#EasylingConnectionStatus').removeClass('notice-error').addClass('notice-success');
     44        } else {
     45            $('#EasylingConnectionStatus').removeClass('notice-success').addClass('notice-error');
     46        }
     47        $('#EasylingConnectionStatus').show().html( data.message );
     48      })
     49      .fail(function onFail() {
     50        console.log('onFail');
     51        $('#EasylingConnectionStatus').removeClass('notice-success').addClass('notice-error');
     52        $('#EasylingConnectionStatus').show().html( 'Unknown error occurred' );
     53      })
     54      .always(function onFail() {
     55        $('#EasylingTestConnectionBtn').removeAttr('disabled');
     56      })
     57    ;
     58}
    2259
    2360function updateCustomLocationVisibility() {
  • easyling/trunk/easyling.php

    r3235653 r3236567  
    44Plugin URI: https://www.easyling.com/
    55Description: One-click website translation solution from Easyling.
    6 Version: 2.2
     6Version: 2.3
    77Author: Easyling
    88Copyright: Easyling
     
    8080  private function __construct() {
    8181    $this->settings = array(
    82       'version'  => '2.1',
     82      'version'  => '2.3',
    8383      'path'     => plugin_dir_path( __FILE__ ),
    8484      'url'      => plugin_dir_url( __FILE__ ),
     
    184184
    185185  /**
     186   *  Performs request to the app server
     187   */
     188  public function app_request( $params ) {
     189    extract( $params ); // publishing_mode, locale, project_code, location_host, request_method, request_body, request_uri
     190
     191    $timeout = 180;
     192
     193    if ( 'js' === $publishing_mode ) {
     194      $proxy_host = "{$locale}-{$project_code}-j.app.easyling.com";
     195    } else {
     196      // Proxy mode
     197      $proxy_host = "{$locale}-{$project_code}.{$location_host}";
     198    }
     199
     200    // Prepare headers
     201    $http_host = sanitize_text_field( $_SERVER['HTTP_HOST'] );
     202    $headers['Origin'] = $http_host;
     203    $headers['Host'] = $proxy_host;
     204    $headers['X-TranslationProxy-Cache-Info'] = 'disable';
     205    $headers['X-TranslationProxy-EnableDeepRoot'] = 'true';
     206    $headers['X-TranslationProxy-AllowRobots'] = 'true';
     207    $headers['X-TranslationProxy-ServingDomain'] = $http_host;
     208
     209    // Prepare request args
     210    $proxy_request_args = array(
     211      'method'      => $request_method,
     212      'headers'     => $headers,
     213      'timeout'     => $timeout,
     214      'redirection' => 0,
     215    );
     216
     217    if ( ! empty( $request_body ) ) {
     218      $proxy_request_args['body'] = $request_body;
     219    }
     220
     221    $request_scheme = ! empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ? strtolower( sanitize_text_field( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) : strtolower( sanitize_text_field( $_SERVER['REQUEST_SCHEME'] ) );
     222    $request_scheme = in_array( $request_scheme, array( 'http', 'https' ) ) ? $request_scheme : 'https';
     223    $proxy_url = "{$request_scheme}://{$proxy_host}{$request_uri}";
     224
     225    // Proxy request
     226    set_time_limit( $timeout + 10 );
     227
     228    return array(
     229      'proxy_url'          => $proxy_url,
     230      'proxy_request_args' => $proxy_request_args,
     231      'response'           => wp_remote_request( $proxy_url, $proxy_request_args ),
     232    );
     233  }
     234
     235
     236  /**
    186237   *  Initialize plugin
    187238   */
  • easyling/trunk/inc/admin.php

    r3188801 r3236567  
    3232      add_action( 'admin_menu', array( $this, 'setup_menu' ) );
    3333      add_filter( 'plugin_action_links_' . easyling()->get_setting('basename'), array( $this, 'plugin_actions' ) );
     34    }
     35
     36    if ( is_admin() ) {
     37      add_action( 'wp_ajax_easyling_test_connection', array( $this, 'ajax_test_connection' ) );
    3438    }
    3539  }
     
    170174    }
    171175
     176    $is_configured = ! empty( $project_settings['languages'] ) && ! empty( $config['project_code'] );
    172177
    173178    $new_tab_link_icon = '<i aria-hidden="true" class="dashicons dashicons-external" style="text-decoration:none;"></i>';
     
    274279            </tr>
    275280            <tr>
     281              <th><?php esc_html_e( 'Connection testing', 'easyling' ) ?></th>
     282              <td>
     283                <a id="EasylingTestConnectionBtn" href="#" class="button button-primary"<?php echo $is_configured ? '' : ' disabled' ?>><?php esc_html_e( 'Test connection', 'easyling' ) ?></a>
     284                <?php if ( ! $is_configured ) : ?>
     285                  <p><?php esc_html_e( 'Configure and save settings first before you can test your connection.', 'easyling' ) ?></p>
     286                <?php else : ?>
     287                  <p id="EasylingConnectionStatus" class="notice" style="display: none;"></p>
     288                  <p><?php esc_html_e( 'Click to check if your connection works fine.', 'easyling' ) ?></p>
     289                <?php endif; ?>
     290              </td>
     291            </tr>
     292            <tr>
    276293              <th><?php esc_html_e( 'Floating language selector', 'easyling' ) ?></th>
    277294              <td>
     
    370387      wp_enqueue_style( 'easyling-admin', easyling()->get_setting('url') . 'assets/css/admin.css', array(), easyling()->get_setting('version'), 'all' );
    371388      wp_enqueue_script( 'easyling-admin', easyling()->get_setting('url') . 'assets/js/admin.js', array( 'jquery' ), easyling()->get_setting('version'), true );
    372     }
     389      wp_localize_script(
     390        'easyling-admin',
     391        'Easyling',
     392        array(
     393          'ajaxUrl'              => admin_url( 'admin-ajax.php' ),
     394          'testConnectionNonce'  => wp_create_nonce( 'easyling_test_connection' ),
     395          'testConnectionAction' => 'easyling_test_connection',
     396        )
     397      );
     398    }
     399  }
     400
     401
     402  /**
     403   *  Test connection of the configured project
     404   */
     405  public function ajax_test_connection() {
     406    try {
     407      check_ajax_referer( 'easyling_test_connection', 'nonce' );
     408
     409      $user_config = easyling()->get_user_config();
     410
     411      $project_settings = easyling()->get_project_settings();
     412      if ( empty( $project_settings ) ) {
     413        throw new Exception( __( 'Project settings are not saved yet', 'easyling' ), 1);
     414      }
     415
     416      $subdir_locale_map = ! empty( $project_settings['subdir_locale_map'] ) ? $project_settings['subdir_locale_map'] : array();
     417      if ( empty( $subdir_locale_map ) ) {
     418        throw new Exception( __( 'Languages are not configured', 'easyling' ), 1);
     419      }
     420
     421      $location_host = $user_config['location_host'] === 'custom' ? $user_config['custom_location_host'] : $user_config['location_host'];
     422      $location_host = ! empty( $location_host ) ? trim( $location_host ) : $location_host;
     423      if ( empty( $location_host ) ) {
     424        throw new Exception( __( 'Easyling location is invalid', 'easyling' ), 1);
     425      }
     426      $locale_prefix = array_key_first( $subdir_locale_map );
     427      $locale = $subdir_locale_map[ $locale_prefix ];
     428
     429      $result = easyling()->app_request( array(
     430        'publishing_mode' => $user_config['publishing_mode'],
     431        'locale'          => $locale,
     432        'project_code'    => $user_config['project_code'],
     433        'location_host'   => $location_host,
     434        'request_method'  => 'GET',
     435        'request_body'    => null,
     436        'request_uri'     => "/{$locale_prefix}/",
     437      ) );
     438      $response = $result['response'];
     439
     440      if ( is_wp_error( $response ) ) {
     441        $error = sprintf(
     442          __( 'Failed fetching %s, error: %s', 'easyling' ),
     443          $result['proxy_url'],
     444          $response->get_error_message()
     445        );
     446        throw new Exception( $error, 1 );
     447      }
     448
     449      echo json_encode( array(
     450        'result' => $result,
     451        'status' => true,
     452        'message' => sprintf(
     453          __( 'Successfully fetched %s, response code %s', 'easyling' ),
     454          $result['proxy_url'],
     455          $response['response']['code']
     456        ),
     457      ) );
     458    } catch (Exception $e) {
     459      echo json_encode( array(
     460        'status' => false,
     461        'message' => $e->getMessage(),
     462      ) );
     463    }
     464
     465    die();
    373466  }
    374467
  • easyling/trunk/inc/frontend.php

    r3235653 r3236567  
    8686    $has_language_prefix = ! empty( $language_subdirectories ) && preg_match( "#^/($language_subdirectories)(/|\?|$)#i", $server_request_uri, $language_subdirectory_matches );
    8787    $language_subdirectory = $has_language_prefix && ! empty( $language_subdirectory_matches[1] ) ? $language_subdirectory_matches[1] : null;
    88     $locale = ! empty( $project_settings['subdir_locale_map'][ $language_subdirectory ] ) ? strtolower( $project_settings['subdir_locale_map'][ $language_subdirectory ] ) : '';
     88    $locale = ! empty( $subdir_locale_map[ $language_subdirectory ] ) ? strtolower( $subdir_locale_map[ $language_subdirectory ] ) : '';
    8989
    9090    if ( ! empty( $has_language_prefix ) && preg_match( "#/{$language_subdirectory}/wp-admin#i", $server_request_uri ) ) {
     
    246246    // Non-bot request processing
    247247
    248     if ( 'js' === $publishing_mode ) {
    249       $proxy_host = "{$locale}-{$project_code}-j.app.easyling.com";
    250     } else {
    251       // Proxy mode
    252       $proxy_host = "{$locale}-{$project_code}.{$location_host}";
    253     }
    254 
    255 
    256     // Prepare headers
    257     $http_host = sanitize_text_field( $_SERVER['HTTP_HOST'] );
    258     $headers['Origin'] = $http_host;
    259     $headers['Host'] = $proxy_host;
    260     $headers['X-TranslationProxy-Cache-Info'] = 'disable';
    261     $headers['X-TranslationProxy-EnableDeepRoot'] = 'true';
    262     $headers['X-TranslationProxy-AllowRobots'] = 'true';
    263     $headers['X-TranslationProxy-ServingDomain'] = $http_host;
    264 
    265     // Prepare request args
    266     $proxy_request_args = array(
    267       'method'      => $request_method,
    268       'headers'     => $headers,
    269       'timeout'     => 180,
    270       'redirection' => 0,
    271     );
    272 
    273     if ( ! empty( $request_body ) ) {
    274       $proxy_request_args['body'] = $request_body;
    275     }
    276 
    277     $request_scheme = ! empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ? strtolower( sanitize_text_field( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) : strtolower( sanitize_text_field( $_SERVER['REQUEST_SCHEME'] ) );
    278     $request_scheme = in_array( $request_scheme, array( 'http', 'https' ) ) ? $request_scheme : 'https';
    279     $proxy_url = "{$request_scheme}://{$proxy_host}{$server_request_uri}";
    280 
    281     // Proxy request
    282     $response = wp_remote_request( $proxy_url, $proxy_request_args );
     248    $result = easyling()->app_request( array(
     249      'publishing_mode' => $publishing_mode,
     250      'locale'          => $locale,
     251      'project_code'    => $project_code,
     252      'location_host'   => $location_host,
     253      'request_method'  => $request_method,
     254      'request_body'    => $request_body,
     255      'request_uri'     => $server_request_uri,
     256    ) );
     257    $response = $result['response'];
    283258    $response_body = ! is_wp_error( $response ) ? wp_remote_retrieve_body( $response ) : '';
    284259    $response_body = is_wp_error( $response_body ) ? '' : $response_body;
  • easyling/trunk/readme.txt

    r3235653 r3236567  
    44Requires at least: 4.7
    55Tested up to: 6.7
    6 Stable tag: 2.2
     6Stable tag: 2.3
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    4444
    4545== Changelog ==
     46= 2.3 =
     47Release Date: February 7th, 2025
     48
     49Enhancements:
     50
     51* Connection testing feature
     52
    4653= 2.2 =
    4754Release Date: February 5th, 2025
Note: See TracChangeset for help on using the changeset viewer.