Plugin Directory

Changeset 3098777


Ignore:
Timestamp:
06/06/2024 03:00:14 PM (22 months ago)
Author:
easyling
Message:

Updating plugin to version 1.8

Location:
easyling/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • easyling/trunk/assets/css/admin.css

    r2929607 r3098777  
    4242  color: #b28203;
    4343}
     44#EasylingCustomLocationWrapper:not(.active) {
     45    display: none;
     46}
    4447#EasylingDebugInfo {
    4548    display: none;
  • easyling/trunk/assets/js/admin.js

    r3039747 r3098777  
    44    $('#EasylingSettingsForm').on( 'change', '#EasylingLocation, #EasylingProjectCode', function( e ) {
    55        updateLocationUrl();
     6        updateCustomLocationVisibility();
     7    } );
     8    $('#EasylingSettingsForm').on( 'input', '#EasylingCustomLocation', function( e ) {
     9        updateLocationUrl();
    610    } );
    711    updateLocationUrl();
     12    updateCustomLocationVisibility();
    813
    914    var $debugInfo = $('#EasylingDebugInfo');
     
    1621});
    1722
     23function updateCustomLocationVisibility() {
     24    var locationHost = $('#EasylingLocation').val();
     25    locationHost = $.trim( locationHost );
     26    if (locationHost === 'custom') {
     27        $('#EasylingCustomLocationWrapper').addClass('active');
     28    } else {
     29        $('#EasylingCustomLocationWrapper').removeClass('active');
     30    }
     31}
     32
    1833function updateLocationUrl() {
     34    var projectCode = $('#EasylingProjectCode').val();
    1935    var locationHost = $('#EasylingLocation').val();
    20     var projectCode = $('#EasylingProjectCode').val();
     36    var customLocationHost = $('#EasylingCustomLocation').val();
     37
     38    projectCode = $.trim( projectCode );
    2139    locationHost = $.trim( locationHost );
    22     projectCode = $.trim( projectCode );
     40    customLocationHost = $.trim( customLocationHost );
     41    locationHost = locationHost === 'custom' ? customLocationHost : locationHost;
    2342   
    24     if ( ! locationHost ) {
     43    if ( ! locationHost || ! projectCode ) {
    2544        $('#EasylingLocationLogin').attr( 'href', '#' );
    2645        $('#EasylingLocationLogin').attr( 'onclick', 'return false' );
     
    3049    var url = 'https://' + locationHost;
    3150
    32     if ( ! projectCode ) {
    33         $('#EasylingLocationLogin').attr( 'href', url );
    34         $('#EasylingLocationLogin').removeAttr( 'onclick' );
    35         return;
    36     }
    37 
    38     url += '/_el/dashboard/project/' + projectCode + '/language-selector';
     51    url += '/_el/dashboard/project/' + projectCode + '/settings';
    3952    $('#EasylingLocationLogin').attr( 'href', url );
    4053    $('#EasylingLocationLogin').removeAttr( 'onclick' );
  • easyling/trunk/easyling.php

    r3039747 r3098777  
    44Plugin URI: https://www.easyling.com/
    55Description: One-click website translation solution from Easyling.
    6 Version: 1.7
     6Version: 1.8
    77Author: Easyling
    88Copyright: Easyling
     
    4141   */
    4242  private $default_user_config = array(
     43    'status'                => 'enabled',
    4344    'project_code'          => '',
    4445    'location_host'         => 'app.easyling.com',
     46    'custom_location_host'  => '',
    4547    'publishing_mode'       => 'js',
    4648    'prerender_key'         => '',
     
    5759   */
    5860  private $user_config_options = array(
    59     'location_host'   => array( 'app.easyling.com', 'eu.easyling.com' ),
     61    'status'          => array( 'enabled', 'disabled' ),
     62    'location_host'   => array( 'app.easyling.com', 'eu.easyling.com', 'custom' ),
    6063    'publishing_mode' => array( 'js', 'proxy' ),
    6164  );
     
    7578  private function __construct() {
    7679    $this->settings = array(
    77       'version'  => '1.7',
     80      'version'  => '1.8',
    7881      'path'     => plugin_dir_path( __FILE__ ),
    7982      'url'      => plugin_dir_url( __FILE__ ),
     
    134137     
    135138      $project_settings['subdir_locale_map'] = array_reduce( $project_settings['languages'], function( $acc, $item ) {
    136         $subdirectory = ! empty( $item['deployPath'] ) ? parse_url( $item['deployPath'], PHP_URL_PATH ) : '';
     139        $subdirectory = ! empty( $item['deployPath'] ) ? wp_parse_url( $item['deployPath'], PHP_URL_PATH ) : '';
    137140        $subdirectory = $subdirectory ? $subdirectory : '';
    138141        $subdirectory = trim( $subdirectory );
  • easyling/trunk/inc/admin.php

    r3035871 r3098777  
    9191    printf(
    9292      '<div class="notice notice-%s %s"><p>%s</p></div>',
    93       $type,
     93      esc_attr( $type ),
    9494      $is_dismissible ? 'is-dismissible' : '',
    95       $message
     95      esc_html( $message )
    9696    );
    9797  }
     
    102102   */
    103103  public function page() {
     104    $status_options = array(
     105      'enabled'  => __( 'Enabled', 'easyling' ),
     106      'disabled' => __( 'Disabled', 'easyling' ),
     107    );
    104108    $publishing_mode_options = array(
    105109      'js'    => __( 'JavaScript', 'easyling' ),
     
    109113      'app.easyling.com' => __( 'app.easyling.com', 'easyling' ),
    110114      'eu.easyling.com'  => __( 'eu.easyling.com', 'easyling' ),
     115      'custom'           => __( 'Other', 'easyling' ),
    111116    );
    112117
    113118    $should_save_user_config = ! empty( $_POST['easyling_nonce'] ) && wp_verify_nonce( $_POST['easyling_nonce'], 'easyling_save_settings' );
    114119    if ( $should_save_user_config ) {
     120      easyling()->update_user_config( 'status', sanitize_text_field( $_POST['status'] ) );
     121      easyling()->update_user_config( 'custom_location_host', sanitize_text_field( $_POST['custom_location_host'] ) );
    115122      easyling()->update_user_config( 'project_code', sanitize_text_field( $_POST['project_code'] ) );
    116123      easyling()->update_user_config( 'prerender_key', sanitize_text_field( $_POST['prerender_key'] ) );
     
    138145    if ( ! empty( $project_settings['languages'] ) ) {
    139146      foreach ( $project_settings['languages'] as $key => $item ) {
    140         if ( empty( $item['deployPath'] ) ) {
     147        if ( empty( $item['deployPath_'] ) && ( $config['deployed'] === 'on' ) ) {
    141148          $project_settings['languages'][$key]['status'] = 'error';
    142149          $project_settings['languages'][$key]['status_tooltip'] = "Subdirectory is not set for the {$item['language']} [{$item['targetLanguage']}] language.";
     
    161168        <table class="form-table">
    162169          <tbody>
     170            <tr>
     171              <th><?php esc_html_e( 'Status', 'easyling' ) ?></th>
     172              <td>
     173                <select name="status" id="EasylingStatus">
     174                  <?php foreach ( $status_options as $value => $name ) : ?>
     175                    <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $config['status'], $value ); ?>><?php echo esc_html( $name ) ?></option>
     176                  <?php endforeach; ?>
     177                </select>
     178                <p><?php esc_html_e( 'Quickly activate or deactivate translation features.', 'easyling' ) ?></p>
     179              </td>
     180            </tr>
    163181            <tr>
    164182              <th><?php esc_html_e( 'Easyling project code', 'easyling' ) ?></th>
     
    228246                  <?php endforeach; ?>
    229247                </select>
     248                <p id="EasylingCustomLocationWrapper">
     249                  <input type="text" name="custom_location_host" id="EasylingCustomLocation" class="regular-text" value="<?php echo esc_attr( $config['custom_location_host'] ) ?>" />
     250                </p>
    230251                <p><?php esc_html_e( 'Set location according to your Easyling account. You can choose your account to be on a US or EU based server.', 'easyling' ) ?> <a href="#" id="EasylingLocationLogin" target="wp-easyling-domainname"><?php esc_html_e( 'Login', 'easyling' ) ?><?php echo $new_tab_link_icon; ?></a></p>
    231252              </td>
     
    253274            </tr>
    254275            <tr>
    255               <th><?php esc_html_e( 'Deployed', 'easyling' ) ?></th>
     276              <th><?php esc_html_e( 'Subdirectory publishing', 'easyling' ) ?></th>
    256277              <td>
    257278                <label>
     
    307328      <div id="EasylingDebugInfo">
    308329        <h4>PROJECT SETTINGS</h4>
    309         <p><?php echo esc_html( json_encode( $project_settings, JSON_UNESCAPED_SLASHES ) ); ?></p>
     330        <p><?php echo esc_html( wp_json_encode( $project_settings ) ); ?></p>
    310331        <h4>PLUGIN SETTINGS</h4>
    311         <p><?php echo esc_html( json_encode( $config, JSON_UNESCAPED_SLASHES ) ); ?></p>
     332        <p><?php echo esc_html( wp_json_encode( $config ) ); ?></p>
    312333        <h4>RAW STUB.JSON</h4>
    313334        <p><?php
  • easyling/trunk/inc/frontend.php

    r2937310 r3098777  
    4747      return;
    4848    }
    49     // Extracts: $project_code, $location_host, $publishing_mode, $prerender_key, $redirect_system_pages, $translate_login_page, $deployed
     49    // Extracts: $status, $project_code, $location_host, $custom_location_host, $publishing_mode, $prerender_key, $redirect_system_pages, $translate_login_page, $deployed
    5050    extract( $user_config );
     51
     52    if ($status !== 'enabled') {
     53      // Don't process if user set to disabled status
     54      return;
     55    }
     56
     57    $location_host = $location_host === 'custom' ? $custom_location_host : $location_host;
    5158
    5259    $project_settings = easyling()->get_project_settings();
     
    392399      $this->request_url = array(
    393400        'raw'    => $request_url,
    394         'parsed' => parse_url( $request_url ),
     401        'parsed' => wp_parse_url( $request_url ),
    395402      );
    396403    }
  • easyling/trunk/readme.txt

    r3039747 r3098777  
    44Requires at least: 4.7
    55Tested up to: 6.4.1
    6 Stable tag: 1.7
     6Stable tag: 1.8
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    4444
    4545== Changelog ==
     46= 1.8 =
     47Release Date: June 6th, 2024
     48
     49Enhancements:
     50
     51* Minor updates in the admin area
     52
    4653= 1.7 =
    4754Release Date: February 22nd, 2024
Note: See TracChangeset for help on using the changeset viewer.