Changeset 5366 for branches/2.5/includes/admin/functions.php
- Timestamp:
- 06/05/2014 08:44:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/includes/admin/functions.php
r5133 r5366 136 136 // Return post link 137 137 return $post_link; 138 } 139 140 /** 141 * Sanitize permalink slugs when saving the settings page. 142 * 143 * @since bbPress (r5364) 144 * 145 * @param string $slug 146 * @return string 147 */ 148 function bbp_sanitize_slug( $slug = '' ) { 149 150 // Don't allow multiple slashes in a row 151 $value = preg_replace( '#/+#', '/', str_replace( '#', '', $slug ) ); 152 153 // Strip out unsafe or unusable chars 154 $value = esc_url_raw( $value ); 155 156 // esc_url_raw() adds a scheme via esc_url(), so let's remove it 157 $value = str_replace( 'http://', '', $value ); 158 159 // Trim off first and last slashes. 160 // 161 // We already prevent double slashing elsewhere, but let's prevent 162 // accidental poisoning of options values where we can. 163 $value = ltrim( $value, '/' ); 164 $value = rtrim( $value, '/' ); 165 166 // Filter the result and return 167 return apply_filters( 'bbp_sanitize_slug', $value, $slug ); 138 168 } 139 169
Note: See TracChangeset
for help on using the changeset viewer.