1 redirect.module redirect_status_code_options($code = NULL, $all_types = TRUE)

Return either a status code or array of possible status codes.

Parameters

int $code: Optional numeric code, if present as key of $codes value string is returned.

bool $all_types: Include the less-common redirect types. If set to FALSE, only the 301 and 302 types are returned.

Return value

string|string[]: If $code is passed and present then return is string value of key $code, otherwise the array of possible codes $codes is returned.

File

core/modules/redirect/redirect.module, line 1245

Code

function redirect_status_code_options($code = NULL, $all_types = TRUE) {
  if ($all_types) {
    $codes = array(
      300 => t('300 - Multiple Choices'),
      301 => t('301 - Moved Permanently'),
      302 => t('302 - Found'),
      303 => t('303 - See Other'),
      304 => t('304 - Not Modified'),
      305 => t('305 - Use Proxy'),
      307 => t('307 - Temporary Redirect'),
    );
  }
  else {
    $codes = array(
      301 => t('301 - Moved Permanently'),
      302 => t('302 - Moved Temporarily'),
    );
  }
  return isset($codes[$code]) ? $codes[$code] : $codes;
}