Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add status code labels to the dropdown menu. #47

Merged
merged 1 commit into from

2 participants

@foofy

Hello. Just a minor tweak, but I thought it would be useful to have the status code labels shown in the dropdown menu. Thanks!

@tlovett1 tlovett1 merged commit 3c33f15 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 18, 2013
  1. @foofy
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 1 deletion.
  1. +10 −1 safe-redirect-manager.php
View
11 safe-redirect-manager.php
@@ -42,6 +42,15 @@ class SRM_Safe_Redirect_Manager {
public $cache_key_redirects = '_srm_redirects';
public $valid_status_codes = array( 301, 302, 303, 307, 403, 404 );
+
+ public $status_code_labels = array(
+ 301 => 'Moved Permanently',
+ 302 => 'Found',
+ 303 => 'See Other',
+ 307 => 'Temporary Redirect',
+ 403 => 'Forbidden',
+ 404 => 'Not Found',
+ );
private $whitelist_hosts = array();
@@ -644,7 +653,7 @@ public function redirect_rule_metabox( $post ) {
<label for="srm<?php echo $this->meta_key_redirect_status_code; ?>"><?php _e( 'HTTP Status Code:', 'safe-redirect-manager' ); ?></label>
<select name="srm<?php echo $this->meta_key_redirect_status_code; ?>" id="srm<?php echo $this->meta_key_redirect_status_code; ?>">
<?php foreach ( $this->valid_status_codes as $code ) : ?>
- <option <?php selected( $status_code, $code ); ?>><?php echo $code; ?></option>
+ <option value="<?php echo esc_attr( $code ); ?>" <?php selected( $status_code, $code ); ?>><?php echo esc_html( $code . ' ' . $this->status_code_labels[$code] ); ?></option>
<?php endforeach; ?>
</select>
<em><?php _e( "If you don't know what this is, leave it as is.", 'safe-redirect-manager' ); ?></em>
Something went wrong with that request. Please try again.