Changeset 3098777
- Timestamp:
- 06/06/2024 03:00:14 PM (22 months ago)
- Location:
- easyling/trunk
- Files:
-
- 6 edited
-
assets/css/admin.css (modified) (1 diff)
-
assets/js/admin.js (modified) (3 diffs)
-
easyling.php (modified) (5 diffs)
-
inc/admin.php (modified) (8 diffs)
-
inc/frontend.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easyling/trunk/assets/css/admin.css
r2929607 r3098777 42 42 color: #b28203; 43 43 } 44 #EasylingCustomLocationWrapper:not(.active) { 45 display: none; 46 } 44 47 #EasylingDebugInfo { 45 48 display: none; -
easyling/trunk/assets/js/admin.js
r3039747 r3098777 4 4 $('#EasylingSettingsForm').on( 'change', '#EasylingLocation, #EasylingProjectCode', function( e ) { 5 5 updateLocationUrl(); 6 updateCustomLocationVisibility(); 7 } ); 8 $('#EasylingSettingsForm').on( 'input', '#EasylingCustomLocation', function( e ) { 9 updateLocationUrl(); 6 10 } ); 7 11 updateLocationUrl(); 12 updateCustomLocationVisibility(); 8 13 9 14 var $debugInfo = $('#EasylingDebugInfo'); … … 16 21 }); 17 22 23 function 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 18 33 function updateLocationUrl() { 34 var projectCode = $('#EasylingProjectCode').val(); 19 35 var locationHost = $('#EasylingLocation').val(); 20 var projectCode = $('#EasylingProjectCode').val(); 36 var customLocationHost = $('#EasylingCustomLocation').val(); 37 38 projectCode = $.trim( projectCode ); 21 39 locationHost = $.trim( locationHost ); 22 projectCode = $.trim( projectCode ); 40 customLocationHost = $.trim( customLocationHost ); 41 locationHost = locationHost === 'custom' ? customLocationHost : locationHost; 23 42 24 if ( ! locationHost ) {43 if ( ! locationHost || ! projectCode ) { 25 44 $('#EasylingLocationLogin').attr( 'href', '#' ); 26 45 $('#EasylingLocationLogin').attr( 'onclick', 'return false' ); … … 30 49 var url = 'https://' + locationHost; 31 50 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'; 39 52 $('#EasylingLocationLogin').attr( 'href', url ); 40 53 $('#EasylingLocationLogin').removeAttr( 'onclick' ); -
easyling/trunk/easyling.php
r3039747 r3098777 4 4 Plugin URI: https://www.easyling.com/ 5 5 Description: One-click website translation solution from Easyling. 6 Version: 1. 76 Version: 1.8 7 7 Author: Easyling 8 8 Copyright: Easyling … … 41 41 */ 42 42 private $default_user_config = array( 43 'status' => 'enabled', 43 44 'project_code' => '', 44 45 'location_host' => 'app.easyling.com', 46 'custom_location_host' => '', 45 47 'publishing_mode' => 'js', 46 48 'prerender_key' => '', … … 57 59 */ 58 60 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' ), 60 63 'publishing_mode' => array( 'js', 'proxy' ), 61 64 ); … … 75 78 private function __construct() { 76 79 $this->settings = array( 77 'version' => '1. 7',80 'version' => '1.8', 78 81 'path' => plugin_dir_path( __FILE__ ), 79 82 'url' => plugin_dir_url( __FILE__ ), … … 134 137 135 138 $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 ) : ''; 137 140 $subdirectory = $subdirectory ? $subdirectory : ''; 138 141 $subdirectory = trim( $subdirectory ); -
easyling/trunk/inc/admin.php
r3035871 r3098777 91 91 printf( 92 92 '<div class="notice notice-%s %s"><p>%s</p></div>', 93 $type,93 esc_attr( $type ), 94 94 $is_dismissible ? 'is-dismissible' : '', 95 $message95 esc_html( $message ) 96 96 ); 97 97 } … … 102 102 */ 103 103 public function page() { 104 $status_options = array( 105 'enabled' => __( 'Enabled', 'easyling' ), 106 'disabled' => __( 'Disabled', 'easyling' ), 107 ); 104 108 $publishing_mode_options = array( 105 109 'js' => __( 'JavaScript', 'easyling' ), … … 109 113 'app.easyling.com' => __( 'app.easyling.com', 'easyling' ), 110 114 'eu.easyling.com' => __( 'eu.easyling.com', 'easyling' ), 115 'custom' => __( 'Other', 'easyling' ), 111 116 ); 112 117 113 118 $should_save_user_config = ! empty( $_POST['easyling_nonce'] ) && wp_verify_nonce( $_POST['easyling_nonce'], 'easyling_save_settings' ); 114 119 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'] ) ); 115 122 easyling()->update_user_config( 'project_code', sanitize_text_field( $_POST['project_code'] ) ); 116 123 easyling()->update_user_config( 'prerender_key', sanitize_text_field( $_POST['prerender_key'] ) ); … … 138 145 if ( ! empty( $project_settings['languages'] ) ) { 139 146 foreach ( $project_settings['languages'] as $key => $item ) { 140 if ( empty( $item['deployPath ']) ) {147 if ( empty( $item['deployPath_'] ) && ( $config['deployed'] === 'on' ) ) { 141 148 $project_settings['languages'][$key]['status'] = 'error'; 142 149 $project_settings['languages'][$key]['status_tooltip'] = "Subdirectory is not set for the {$item['language']} [{$item['targetLanguage']}] language."; … … 161 168 <table class="form-table"> 162 169 <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> 163 181 <tr> 164 182 <th><?php esc_html_e( 'Easyling project code', 'easyling' ) ?></th> … … 228 246 <?php endforeach; ?> 229 247 </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> 230 251 <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> 231 252 </td> … … 253 274 </tr> 254 275 <tr> 255 <th><?php esc_html_e( ' Deployed', 'easyling' ) ?></th>276 <th><?php esc_html_e( 'Subdirectory publishing', 'easyling' ) ?></th> 256 277 <td> 257 278 <label> … … 307 328 <div id="EasylingDebugInfo"> 308 329 <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> 310 331 <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> 312 333 <h4>RAW STUB.JSON</h4> 313 334 <p><?php -
easyling/trunk/inc/frontend.php
r2937310 r3098777 47 47 return; 48 48 } 49 // Extracts: $ project_code, $location_host, $publishing_mode, $prerender_key, $redirect_system_pages, $translate_login_page, $deployed49 // Extracts: $status, $project_code, $location_host, $custom_location_host, $publishing_mode, $prerender_key, $redirect_system_pages, $translate_login_page, $deployed 50 50 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; 51 58 52 59 $project_settings = easyling()->get_project_settings(); … … 392 399 $this->request_url = array( 393 400 'raw' => $request_url, 394 'parsed' => parse_url( $request_url ),401 'parsed' => wp_parse_url( $request_url ), 395 402 ); 396 403 } -
easyling/trunk/readme.txt
r3039747 r3098777 4 4 Requires at least: 4.7 5 5 Tested up to: 6.4.1 6 Stable tag: 1. 76 Stable tag: 1.8 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 44 44 45 45 == Changelog == 46 = 1.8 = 47 Release Date: June 6th, 2024 48 49 Enhancements: 50 51 * Minor updates in the admin area 52 46 53 = 1.7 = 47 54 Release Date: February 22nd, 2024
Note: See TracChangeset
for help on using the changeset viewer.