wpseek.com
				Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
			extract_from_markers › WordPress Function
Seit1.5.0
Veraltetn/v
› extract_from_markers ( $filename, $marker )
| Parameter: (2) | 
 | 
| Gibt zurück: | 
 | 
| Definiert in: | 
 | 
| Codex: | 
Extracts strings from between the BEGIN and END markers in the .htaccess file.
Ähnliche Funktionen: insert_with_markers, get_date_from_gmt, get_gmt_from_date, wp_extract_urls, get_bookmarks
	Quellcode
function extract_from_markers( $filename, $marker ) {
	$result = array();
	if ( ! file_exists( $filename ) ) {
		return $result;
	}
	$markerdata = explode( "\n", implode( '', file( $filename ) ) );
	$state = false;
	foreach ( $markerdata as $markerline ) {
		if ( str_contains( $markerline, '# END ' . $marker ) ) {
			$state = false;
		}
		if ( $state ) {
			if ( str_starts_with( $markerline, '#' ) ) {
				continue;
			}
			$result[] = $markerline;
		}
		if ( str_contains( $markerline, '# BEGIN ' . $marker ) ) {
			$state = true;
		}
	}
	return $result;
}