Changeset 3111901
- Timestamp:
- 07/03/2024 07:19:28 PM (5 weeks ago)
- Location:
- redirect-txt
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
redirect-txt/tags/0.2.4/classes/class-redirects.php
r3092667 r3111901 140 140 if ( is_string( $rules ) && $rules ) { 141 141 142 // Remove comments. 143 $rules = preg_replace( '/#.*/', '', $rules ); 142 /** 143 * Remove comments, but keep hashes in links. 144 * 145 * This regex does two things: 146 * 1. ^[ \t]*#.*$: Removes lines that start with a hash (optionally preceded by whitespace). 147 * 2. (?<=\s)#.*$: Removes inline comments that start with a hash preceded by whitespace. 148 * 149 * Explanation of the new part: 150 * • (?<=\s): Positive lookbehind, ensures the hash is preceded by whitespace 151 * • #.*$: Matches the hash and everything after it until the end of the line 152 */ 153 $rules = preg_replace( '/^[ \t]*#.*$|(?<=\s)#.*$/m', '', $rules ); 144 154 145 155 // Split string by lines. … … 202 212 return $redirects; 203 213 } 204 205 /**206 * Get redirects from DB and prepare array.207 *208 * @param bool $allow_url_only_redirects - allow redirecting using URLs only.209 * @param bool $allow_post_from - allow redirecting from post IDs.210 *211 * @return array212 */213 public static function get_redirect_rules( $allow_url_only_redirects = true, $allow_post_from = false ) {214 $rules = get_option( 'redirect_txt_rules', '' );215 216 return self::parse_redirect_rules( $rules, $allow_url_only_redirects, $allow_post_from );217 }218 219 214 220 215 /** -
redirect-txt/tags/0.2.4/readme.txt
r3092667 r3111901 5 5 Tested up to: 6.5 6 6 Requires PHP: 7.2 7 Stable tag: 0.2. 37 Stable tag: 0.2. 8 8 License: GPL-2.0-or-later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 83 83 == Changelog == 84 84 85 86 87 88 85 89 = 0.2.3 - May 26, 2024 = 86 90 -
redirect-txt/tags/0.2.4/redirect-txt.php
r3092667 r3111901 5 5 * Requires at least: 6.2 6 6 * Requires PHP: 7.2 7 * Version: 0.2. 37 * Version: 0.2. 8 8 * Author: Redirect.txt Team 9 9 * License: GPLv2 or later … … 19 19 20 20 if ( ! defined( 'REDIRECT_TXT_VERSION' ) ) { 21 define( 'REDIRECT_TXT_VERSION', '0.2. 3' );21 define( 'REDIRECT_TXT_VERSION', '0.2.' ); 22 22 } 23 23 -
redirect-txt/trunk/classes/class-redirects.php
r3092667 r3111901 140 140 if ( is_string( $rules ) && $rules ) { 141 141 142 // Remove comments. 143 $rules = preg_replace( '/#.*/', '', $rules ); 142 /** 143 * Remove comments, but keep hashes in links. 144 * 145 * This regex does two things: 146 * 1. ^[ \t]*#.*$: Removes lines that start with a hash (optionally preceded by whitespace). 147 * 2. (?<=\s)#.*$: Removes inline comments that start with a hash preceded by whitespace. 148 * 149 * Explanation of the new part: 150 * • (?<=\s): Positive lookbehind, ensures the hash is preceded by whitespace 151 * • #.*$: Matches the hash and everything after it until the end of the line 152 */ 153 $rules = preg_replace( '/^[ \t]*#.*$|(?<=\s)#.*$/m', '', $rules ); 144 154 145 155 // Split string by lines. … … 202 212 return $redirects; 203 213 } 204 205 /**206 * Get redirects from DB and prepare array.207 *208 * @param bool $allow_url_only_redirects - allow redirecting using URLs only.209 * @param bool $allow_post_from - allow redirecting from post IDs.210 *211 * @return array212 */213 public static function get_redirect_rules( $allow_url_only_redirects = true, $allow_post_from = false ) {214 $rules = get_option( 'redirect_txt_rules', '' );215 216 return self::parse_redirect_rules( $rules, $allow_url_only_redirects, $allow_post_from );217 }218 219 214 220 215 /** -
redirect-txt/trunk/readme.txt
r3092667 r3111901 5 5 Tested up to: 6.5 6 6 Requires PHP: 7.2 7 Stable tag: 0.2. 37 Stable tag: 0.2. 8 8 License: GPL-2.0-or-later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 83 83 == Changelog == 84 84 85 86 87 88 85 89 = 0.2.3 - May 26, 2024 = 86 90 -
redirect-txt/trunk/redirect-txt.php
r3092667 r3111901 5 5 * Requires at least: 6.2 6 6 * Requires PHP: 7.2 7 * Version: 0.2. 37 * Version: 0.2. 8 8 * Author: Redirect.txt Team 9 9 * License: GPLv2 or later … … 19 19 20 20 if ( ! defined( 'REDIRECT_TXT_VERSION' ) ) { 21 define( 'REDIRECT_TXT_VERSION', '0.2. 3' );21 define( 'REDIRECT_TXT_VERSION', '0.2.' ); 22 22 } 23 23
Note: See TracChangeset
for help on using the changeset viewer.