Changeset 3331420
- Timestamp:
- 07/21/2025 11:35:16 AM (9 months ago)
- Location:
- siteimprove
- Files:
-
- 12 edited
- 1 copied
-
tags/2.1.0 (copied) (copied from siteimprove/trunk)
-
tags/2.1.0/admin/class-siteimprove-admin.php (modified) (1 diff)
-
tags/2.1.0/admin/partials/class-siteimprove-admin-settings.php (modified) (5 diffs)
-
tags/2.1.0/includes/class-siteimprove.php (modified) (1 diff)
-
tags/2.1.0/languages/siteimprove.pot (modified) (1 diff)
-
tags/2.1.0/readme.txt (modified) (2 diffs)
-
tags/2.1.0/siteimprove.php (modified) (1 diff)
-
trunk/admin/class-siteimprove-admin.php (modified) (1 diff)
-
trunk/admin/partials/class-siteimprove-admin-settings.php (modified) (5 diffs)
-
trunk/includes/class-siteimprove.php (modified) (1 diff)
-
trunk/languages/siteimprove.pot (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/siteimprove.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
siteimprove/tags/2.1.0/admin/class-siteimprove-admin.php
r3325770 r3331420 257 257 } 258 258 $public_url = get_option( 'siteimprove_public_url' ); 259 259 $ignore_segments = get_option( 'siteimprove_ignore_path_segments' ); 260 261 // Parse the URL to get its components. 262 $parsed_url = wp_parse_url( $url ); 263 $path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : ''; 264 265 // Apply path segment filtering if configured. 266 if ( ! empty( $ignore_segments ) && ! empty( $path ) ) { 267 // Split the ignore segments by comma and trim whitespace. 268 $segments_to_ignore = array_map( 'trim', explode( ',', $ignore_segments ) ); 269 270 // Split the path into segments. 271 $path_segments = array_filter( explode( '/', $path ) ); 272 273 // Remove segments that should be ignored. 274 $filtered_segments = array(); 275 foreach ( $path_segments as $segment ) { 276 if ( ! in_array( $segment, $segments_to_ignore, true ) ) { 277 $filtered_segments[] = $segment; 278 } 279 } 280 281 // Reconstruct the path. 282 $path = '/' . implode( '/', $filtered_segments ); 283 } 284 285 // Apply public URL transformation if configured. 260 286 if ( ! empty( $public_url ) ) { 261 $parsed_url = wp_parse_url( $url ); 262 $url = "$public_url$parsed_url[path]" . ( isset( $parsed_url['query'] ) ? "?$parsed_url[query]" : '' ); 287 $url = "$public_url$path" . ( isset( $parsed_url['query'] ) ? "?$parsed_url[query]" : '' ); 288 } else { 289 // If no public URL is set, reconstruct the URL with the filtered path. 290 $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] . '://' : ''; 291 $host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : ''; 292 $port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : ''; 293 $query = isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : ''; 294 $fragment = isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : ''; 295 296 $url = $scheme . $host . $port . $path . $query . $fragment; 263 297 } 264 298 -
siteimprove/tags/2.1.0/admin/partials/class-siteimprove-admin-settings.php
r3325770 r3331420 44 44 register_setting( 'siteimprove', 'siteimprove_disable_new_version', 'Siteimprove_Admin_Settings::validate_siteimprove_disable_new_version' ); 45 45 register_setting( 'siteimprove', 'siteimprove_public_url', 'Siteimprove_Admin_Settings::validate_public_url' ); 46 register_setting( 'siteimprove', 'siteimprove_ignore_path_segments', 'Siteimprove_Admin_Settings::validate_ignore_path_segments' ); 46 47 register_setting( 'siteimprove', 'siteimprove_api_username', 'Siteimprove_Admin_Settings::validate_api_username' ); 47 48 register_setting( 'siteimprove', 'siteimprove_api_key', 'Siteimprove_Admin_Settings::validate_api_key' ); … … 72 73 'Siteimprove_Admin_Settings::siteimprove_settings_section_title', 73 74 'siteimprove' 75 ); 76 77 // register a new field siteimprove_public_url_field, inside the siteimprove_token section of the settings page. 78 add_settings_field( 79 'siteimprove_public_url', 80 __( 'Public URL', 'siteimprove' ), 81 'Siteimprove_Admin_Settings::siteimprove_public_url_field', 82 'siteimprove', 83 'siteimprove_public_url' 84 ); 85 86 // register a new field siteimprove_ignore_path_segments_field, inside the siteimprove_public_url section of the settings page. 87 add_settings_field( 88 'siteimprove_ignore_path_segments', 89 __( 'Ignore Path Segments', 'siteimprove' ), 90 'Siteimprove_Admin_Settings::siteimprove_ignore_path_segments_field', 91 'siteimprove', 92 'siteimprove_public_url' 74 93 ); 75 94 … … 240 259 <p> 241 260 <?php 242 esc_html_e( 'Please provide the Public URL for the current site if for any reasons it\'s not the same as the Admin Panel URL. Otherwise you can leave this field empty.' ); 243 ?> 244 </p> 245 <p> 246 <?php 247 esc_html_e( 'Example: Website Admin Panel is hosted at: http://stg-thewebsite.com but the final Public URL will be http://thewebsite.com', 'siteimprove' ); 261 esc_html_e( 'Configure URL transformation settings. Public URL changes the domain/host of the URL. Ignore Path Segments removes specific path segments from the URL. These settings can be used independently or together.', 'siteimprove' ); 248 262 ?> 249 263 </p> … … 304 318 ?> 305 319 <input type="text" id="siteimprove_public_url_field" name="siteimprove_public_url" value="<?php echo esc_attr( get_option( 'siteimprove_public_url' ) ); ?>" size="50" /> 320 <p> 321 <?php 322 esc_html_e( '(Optional) Please provide the Public URL for the current site if for any reasons it\'s not the same as the Admin Panel URL. This changes the domain/host of the URL and works independently of the Ignore Path Segments setting.', 'siteimprove' ); 323 ?> 324 </p> 325 <p> 326 <?php 327 esc_html_e( 'Example: Website Admin Panel is hosted at: http://stg-thewebsite.com but the final Public URL will be http://thewebsite.com', 'siteimprove' ); 328 ?> 329 </p> 330 <?php 331 } 332 333 /** 334 * Form fields 335 * 336 * @param mixed $args Field Arguments. 337 * @return void 338 */ 339 public static function siteimprove_ignore_path_segments_field( $args ) { 340 ?> 341 <input type="text" id="siteimprove_ignore_path_segments_field" name="siteimprove_ignore_path_segments" value="<?php echo esc_attr( get_option( 'siteimprove_ignore_path_segments' ) ); ?>" size="50" /> 342 <p> 343 <?php 344 esc_html_e( '(Optional) Specify path segments to remove from the URL path. Use comma-separated values (e.g. "cms,staging"). This doe not remove anything from the Public URL set. This can be used to clean up path segments from the CMS URLs to better match the end published URLs scanned in the Siteimprove platform in the plugin requests.', 'siteimprove' ); 345 ?> 346 </p> 347 <p> 348 <?php 349 esc_html_e( 'Example: If your URL is https://staging.mysite.com/cms/blog/staging/mypost and you set the Ignore Path Segments to "cms,staging", the result will be https://staging.mysite.com/blog/mypost.', 'siteimprove' ); 350 ?> 351 </p> 306 352 <?php 307 353 } … … 514 560 515 561 /** 562 * Field Validation for Ignore Path Segments 563 * 564 * @param string $value Original value posted in settings page. 565 * @return string 566 */ 567 public static function validate_ignore_path_segments( $value ) { 568 if ( ! empty( $value ) ) { 569 $old_value = get_option( 'siteimprove_ignore_path_segments' ); 570 // Validate that the value contains only alphanumeric characters, hyphens, underscores, and commas. 571 if ( ! preg_match( '/^[a-zA-Z0-9\-\_,\s]+$/', $value ) ) { 572 add_settings_error( 'siteimprove_messages', 'siteimprove_ignore_path_segments_error', __( 'Invalid format for Ignore Path Segments field. Only alphanumeric characters, hyphens, underscores, and commas are allowed.', 'siteimprove' ) ); 573 return $old_value; 574 } 575 } 576 577 return sanitize_text_field( $value ); 578 } 579 580 /** 516 581 * Abstractor for any API requests made on the admin page 517 582 * -
siteimprove/tags/2.1.0/includes/class-siteimprove.php
r3325770 r3331420 61 61 62 62 $this->plugin_name = 'siteimprove'; 63 $this->version = '2. 0.8';63 $this->version = '2.1.0'; 64 64 65 65 $this->load_dependencies(); -
siteimprove/tags/2.1.0/languages/siteimprove.pot
r3064701 r3331420 124 124 msgid "Unable to check website domain. Please try again later" 125 125 msgstr "" 126 127 #: admin/partials/class-siteimprove-admin-settings.php:78 128 msgid "Ignore Path Segments" 129 msgstr "" 130 131 #: admin/partials/class-siteimprove-admin-settings.php:260 132 msgid "Configure URL transformation settings. Public URL changes the domain/host of the URL. Ignore Path Segments removes specific path segments from the URL. These settings can be used independently or together." 133 msgstr "" 134 135 #: admin/partials/class-siteimprove-admin-settings.php:320 136 msgid "(Optional) Please provide the Public URL for the current site if for any reasons it's not the same as the Admin Panel URL. This changes the domain/host of the URL and works independently of the Ignore Path Segments setting." 137 msgstr "" 138 139 #: admin/partials/class-siteimprove-admin-settings.php:325 140 msgid "Example: Website Admin Panel is hosted at: http://stg-thewebsite.com but the final Public URL will be http://thewebsite.com" 141 msgstr "" 142 143 #: admin/partials/class-siteimprove-admin-settings.php:340 144 msgid "(Optional) Specify path segments to remove from the URL path. Use comma-separated values (e.g. "cms,staging"). This doe not remove anything from the Public URL set. This can be used to clean up path segments from the CMS URLs to better match the end published URLs scanned in the Siteimprove platform in the plugin requests." 145 msgstr "" 146 147 #: admin/partials/class-siteimprove-admin-settings.php:345 148 msgid "Example: If your URL is https://staging.mysite.com/cms/blog/staging/mypost and you set the Ignore Path Segments to "cms,staging", the result will be https://staging.mysite.com/blog/mypost." 149 msgstr "" 150 151 #: admin/partials/class-siteimprove-admin-settings.php:558 152 msgid "Invalid format for Ignore Path Segments field. Only alphanumeric characters, hyphens, underscores, and commas are allowed." 153 msgstr "" -
siteimprove/tags/2.1.0/readme.txt
r3325773 r3331420 35 35 A new Siteimprove menu option will also appear on the left menu bar. Click on this menu option to continue configuring the plugin once you’ve logged in. 36 36 37 The token field is automatically filled and should not be changed unless a new token is required. In such cases, please click on “Request new token”to generate a new token.37 The token field is automatically filled and should not be changed unless a new token is required. In such cases, please click on "Request new token" to generate a new token. 38 38 39 39 Public URL is optional to fill in if, for any reason, your published pages are not on the same URL as your configuration panel. 40 41 Ignore Path Segments is optional and allows you to specify path segments that should be removed when building the public URL. This is useful when your admin panel has additional path segments that shouldn't be included in the public URL (e.g., "wp-admin,staging"). Use comma-separated values. 40 42 41 43 When you download the plugin, you automatically will be using the latest experience. If for some reason, you want to use the previous experience of the Siteimprove plugin, uncheck "Use latest experience" in the configuration panel. … … 86 88 87 89 == Changelog == 90 = 2.1.0 = 91 * Added - Ignore Path Segments setting to remove specific path segments when building public URLs 92 * Enhanced - Public URL functionality to handle complex URL transformations 93 88 94 = 2.0.8 = 89 95 * Updated - "Tested up to" -
siteimprove/tags/2.1.0/siteimprove.php
r3330388 r3331420 10 10 * Plugin URI: https://www.siteimprove.com/integrations/cms-plugin/wordpress/ 11 11 * Description: Integration with Siteimprove. 12 * Version: 2.0.812 * Version: v2.1.0 13 13 * Author: Siteimprove 14 14 * Author URI: http://www.siteimprove.com/ -
siteimprove/trunk/admin/class-siteimprove-admin.php
r3325770 r3331420 257 257 } 258 258 $public_url = get_option( 'siteimprove_public_url' ); 259 259 $ignore_segments = get_option( 'siteimprove_ignore_path_segments' ); 260 261 // Parse the URL to get its components. 262 $parsed_url = wp_parse_url( $url ); 263 $path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : ''; 264 265 // Apply path segment filtering if configured. 266 if ( ! empty( $ignore_segments ) && ! empty( $path ) ) { 267 // Split the ignore segments by comma and trim whitespace. 268 $segments_to_ignore = array_map( 'trim', explode( ',', $ignore_segments ) ); 269 270 // Split the path into segments. 271 $path_segments = array_filter( explode( '/', $path ) ); 272 273 // Remove segments that should be ignored. 274 $filtered_segments = array(); 275 foreach ( $path_segments as $segment ) { 276 if ( ! in_array( $segment, $segments_to_ignore, true ) ) { 277 $filtered_segments[] = $segment; 278 } 279 } 280 281 // Reconstruct the path. 282 $path = '/' . implode( '/', $filtered_segments ); 283 } 284 285 // Apply public URL transformation if configured. 260 286 if ( ! empty( $public_url ) ) { 261 $parsed_url = wp_parse_url( $url ); 262 $url = "$public_url$parsed_url[path]" . ( isset( $parsed_url['query'] ) ? "?$parsed_url[query]" : '' ); 287 $url = "$public_url$path" . ( isset( $parsed_url['query'] ) ? "?$parsed_url[query]" : '' ); 288 } else { 289 // If no public URL is set, reconstruct the URL with the filtered path. 290 $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] . '://' : ''; 291 $host = isset( $parsed_url['host'] ) ? $parsed_url['host'] : ''; 292 $port = isset( $parsed_url['port'] ) ? ':' . $parsed_url['port'] : ''; 293 $query = isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : ''; 294 $fragment = isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : ''; 295 296 $url = $scheme . $host . $port . $path . $query . $fragment; 263 297 } 264 298 -
siteimprove/trunk/admin/partials/class-siteimprove-admin-settings.php
r3325770 r3331420 44 44 register_setting( 'siteimprove', 'siteimprove_disable_new_version', 'Siteimprove_Admin_Settings::validate_siteimprove_disable_new_version' ); 45 45 register_setting( 'siteimprove', 'siteimprove_public_url', 'Siteimprove_Admin_Settings::validate_public_url' ); 46 register_setting( 'siteimprove', 'siteimprove_ignore_path_segments', 'Siteimprove_Admin_Settings::validate_ignore_path_segments' ); 46 47 register_setting( 'siteimprove', 'siteimprove_api_username', 'Siteimprove_Admin_Settings::validate_api_username' ); 47 48 register_setting( 'siteimprove', 'siteimprove_api_key', 'Siteimprove_Admin_Settings::validate_api_key' ); … … 72 73 'Siteimprove_Admin_Settings::siteimprove_settings_section_title', 73 74 'siteimprove' 75 ); 76 77 // register a new field siteimprove_public_url_field, inside the siteimprove_token section of the settings page. 78 add_settings_field( 79 'siteimprove_public_url', 80 __( 'Public URL', 'siteimprove' ), 81 'Siteimprove_Admin_Settings::siteimprove_public_url_field', 82 'siteimprove', 83 'siteimprove_public_url' 84 ); 85 86 // register a new field siteimprove_ignore_path_segments_field, inside the siteimprove_public_url section of the settings page. 87 add_settings_field( 88 'siteimprove_ignore_path_segments', 89 __( 'Ignore Path Segments', 'siteimprove' ), 90 'Siteimprove_Admin_Settings::siteimprove_ignore_path_segments_field', 91 'siteimprove', 92 'siteimprove_public_url' 74 93 ); 75 94 … … 240 259 <p> 241 260 <?php 242 esc_html_e( 'Please provide the Public URL for the current site if for any reasons it\'s not the same as the Admin Panel URL. Otherwise you can leave this field empty.' ); 243 ?> 244 </p> 245 <p> 246 <?php 247 esc_html_e( 'Example: Website Admin Panel is hosted at: http://stg-thewebsite.com but the final Public URL will be http://thewebsite.com', 'siteimprove' ); 261 esc_html_e( 'Configure URL transformation settings. Public URL changes the domain/host of the URL. Ignore Path Segments removes specific path segments from the URL. These settings can be used independently or together.', 'siteimprove' ); 248 262 ?> 249 263 </p> … … 304 318 ?> 305 319 <input type="text" id="siteimprove_public_url_field" name="siteimprove_public_url" value="<?php echo esc_attr( get_option( 'siteimprove_public_url' ) ); ?>" size="50" /> 320 <p> 321 <?php 322 esc_html_e( '(Optional) Please provide the Public URL for the current site if for any reasons it\'s not the same as the Admin Panel URL. This changes the domain/host of the URL and works independently of the Ignore Path Segments setting.', 'siteimprove' ); 323 ?> 324 </p> 325 <p> 326 <?php 327 esc_html_e( 'Example: Website Admin Panel is hosted at: http://stg-thewebsite.com but the final Public URL will be http://thewebsite.com', 'siteimprove' ); 328 ?> 329 </p> 330 <?php 331 } 332 333 /** 334 * Form fields 335 * 336 * @param mixed $args Field Arguments. 337 * @return void 338 */ 339 public static function siteimprove_ignore_path_segments_field( $args ) { 340 ?> 341 <input type="text" id="siteimprove_ignore_path_segments_field" name="siteimprove_ignore_path_segments" value="<?php echo esc_attr( get_option( 'siteimprove_ignore_path_segments' ) ); ?>" size="50" /> 342 <p> 343 <?php 344 esc_html_e( '(Optional) Specify path segments to remove from the URL path. Use comma-separated values (e.g. "cms,staging"). This doe not remove anything from the Public URL set. This can be used to clean up path segments from the CMS URLs to better match the end published URLs scanned in the Siteimprove platform in the plugin requests.', 'siteimprove' ); 345 ?> 346 </p> 347 <p> 348 <?php 349 esc_html_e( 'Example: If your URL is https://staging.mysite.com/cms/blog/staging/mypost and you set the Ignore Path Segments to "cms,staging", the result will be https://staging.mysite.com/blog/mypost.', 'siteimprove' ); 350 ?> 351 </p> 306 352 <?php 307 353 } … … 514 560 515 561 /** 562 * Field Validation for Ignore Path Segments 563 * 564 * @param string $value Original value posted in settings page. 565 * @return string 566 */ 567 public static function validate_ignore_path_segments( $value ) { 568 if ( ! empty( $value ) ) { 569 $old_value = get_option( 'siteimprove_ignore_path_segments' ); 570 // Validate that the value contains only alphanumeric characters, hyphens, underscores, and commas. 571 if ( ! preg_match( '/^[a-zA-Z0-9\-\_,\s]+$/', $value ) ) { 572 add_settings_error( 'siteimprove_messages', 'siteimprove_ignore_path_segments_error', __( 'Invalid format for Ignore Path Segments field. Only alphanumeric characters, hyphens, underscores, and commas are allowed.', 'siteimprove' ) ); 573 return $old_value; 574 } 575 } 576 577 return sanitize_text_field( $value ); 578 } 579 580 /** 516 581 * Abstractor for any API requests made on the admin page 517 582 * -
siteimprove/trunk/includes/class-siteimprove.php
r3325770 r3331420 61 61 62 62 $this->plugin_name = 'siteimprove'; 63 $this->version = '2. 0.8';63 $this->version = '2.1.0'; 64 64 65 65 $this->load_dependencies(); -
siteimprove/trunk/languages/siteimprove.pot
r3064701 r3331420 124 124 msgid "Unable to check website domain. Please try again later" 125 125 msgstr "" 126 127 #: admin/partials/class-siteimprove-admin-settings.php:78 128 msgid "Ignore Path Segments" 129 msgstr "" 130 131 #: admin/partials/class-siteimprove-admin-settings.php:260 132 msgid "Configure URL transformation settings. Public URL changes the domain/host of the URL. Ignore Path Segments removes specific path segments from the URL. These settings can be used independently or together." 133 msgstr "" 134 135 #: admin/partials/class-siteimprove-admin-settings.php:320 136 msgid "(Optional) Please provide the Public URL for the current site if for any reasons it's not the same as the Admin Panel URL. This changes the domain/host of the URL and works independently of the Ignore Path Segments setting." 137 msgstr "" 138 139 #: admin/partials/class-siteimprove-admin-settings.php:325 140 msgid "Example: Website Admin Panel is hosted at: http://stg-thewebsite.com but the final Public URL will be http://thewebsite.com" 141 msgstr "" 142 143 #: admin/partials/class-siteimprove-admin-settings.php:340 144 msgid "(Optional) Specify path segments to remove from the URL path. Use comma-separated values (e.g. "cms,staging"). This doe not remove anything from the Public URL set. This can be used to clean up path segments from the CMS URLs to better match the end published URLs scanned in the Siteimprove platform in the plugin requests." 145 msgstr "" 146 147 #: admin/partials/class-siteimprove-admin-settings.php:345 148 msgid "Example: If your URL is https://staging.mysite.com/cms/blog/staging/mypost and you set the Ignore Path Segments to "cms,staging", the result will be https://staging.mysite.com/blog/mypost." 149 msgstr "" 150 151 #: admin/partials/class-siteimprove-admin-settings.php:558 152 msgid "Invalid format for Ignore Path Segments field. Only alphanumeric characters, hyphens, underscores, and commas are allowed." 153 msgstr "" -
siteimprove/trunk/readme.txt
r3325773 r3331420 35 35 A new Siteimprove menu option will also appear on the left menu bar. Click on this menu option to continue configuring the plugin once you’ve logged in. 36 36 37 The token field is automatically filled and should not be changed unless a new token is required. In such cases, please click on “Request new token”to generate a new token.37 The token field is automatically filled and should not be changed unless a new token is required. In such cases, please click on "Request new token" to generate a new token. 38 38 39 39 Public URL is optional to fill in if, for any reason, your published pages are not on the same URL as your configuration panel. 40 41 Ignore Path Segments is optional and allows you to specify path segments that should be removed when building the public URL. This is useful when your admin panel has additional path segments that shouldn't be included in the public URL (e.g., "wp-admin,staging"). Use comma-separated values. 40 42 41 43 When you download the plugin, you automatically will be using the latest experience. If for some reason, you want to use the previous experience of the Siteimprove plugin, uncheck "Use latest experience" in the configuration panel. … … 86 88 87 89 == Changelog == 90 = 2.1.0 = 91 * Added - Ignore Path Segments setting to remove specific path segments when building public URLs 92 * Enhanced - Public URL functionality to handle complex URL transformations 93 88 94 = 2.0.8 = 89 95 * Updated - "Tested up to" -
siteimprove/trunk/siteimprove.php
r3330388 r3331420 10 10 * Plugin URI: https://www.siteimprove.com/integrations/cms-plugin/wordpress/ 11 11 * Description: Integration with Siteimprove. 12 * Version: 2.0.812 * Version: v2.1.0 13 13 * Author: Siteimprove 14 14 * Author URI: http://www.siteimprove.com/
Note: See TracChangeset
for help on using the changeset viewer.