__( '301 Redirect (SEO)', '404-to-301' ), 302 => __( '302 Redirect', '404-to-301' ), 307 => __( '307 Redirect', '404-to-301' ), ); /** * Filter for allowed status codes. * * If you want to add additional HTTP status codes * for redirect, please use this filter and add to * the statuses array. * DO NOT remove default values (301, 302 and 307) from * the array. * * @since 3.0.0 */ return (array) apply_filters( 'jj4t3_redirect_statuses', $statuses ); } /** * Available columns in error logs table. * * This columns are being used few times. Use this to avoid * unwanted names. * Registering filter - "jj4t3_redirect_statuses". * * @since 3.0.0 * @access private * * @return array Allowed HTTP status codes. */ function jj4t3_log_columns() { $columns = array( 'date' => __( 'Date', '404-to-301' ), 'url' => __( '404 Path', '404-to-301' ), 'ref' => __( 'From', '404-to-301' ), 'ip' => __( 'IP Address', '404-to-301' ), 'ua' => __( 'User Agent', '404-to-301' ), 'redirect' => __( 'Redirect', '404-to-301' ), ); /** * Filter for available columns. * * These are the availble column names in 404 * error logs. * Registering filter - "jj4t3_log_columns". * * @param array columns name and slug. * * @since 3.0.0 */ return (array) apply_filters( 'jj4t3_log_columns', $columns ); } /** * Retrive value from $_REQUEST. * * Helper function to retrive data from $_REQUEST * We can use this function to get values from request * and get a default value if the current key does not exist * or empty. * Output will be trimmed. * * @param string $key Key to get from request. * @param mixed $default Default value. * * @since 3.0.0 * @access public * * @return array|string */ function jj4t3_from_request( $key = '', $default = '' ) { // Return default value if key is not given. if ( empty( $key ) || ! is_string( $key ) ) { return $default; } // Return default value if key not set. if ( ! isset( $_REQUEST[ $key ] ) ) { return $default; } // Trim output. if ( is_string( $_REQUEST[ $key ] ) ) { return trim( $_REQUEST[ $key ] ); } elseif ( is_array( $_REQUEST[ $key ] ) ) { return array_map( 'trim', $_REQUEST[ $key ] ); } return $default; }