Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




extract_from_markers [ WordPress Function ]

extract_from_markers ( $filename, $marker )
Parameters:
  • (unknown_type) $filename
  • (unknown_type) $marker
Returns:
  • (array) An array of strings from a file (.htaccess ) from between BEGIN and END markers.
Defined at:



{@internal Missing Short Description}}

Source


<?php
function extract_from_markers$filename$marker ) {
    
$result = array ();

    if (!
file_exists$filename ) ) {
        return 
$result;
    }

    if ( 
$markerdata explode"\n"implode''file$filename ) ) ));
    {
        
$state false;
        foreach ( 
$markerdata as $markerline ) {
            if (
strpos($markerline'# END ' $marker) !== false)
                
$state false;
            if ( 
$state )
                
$result[] = $markerline;
            if (
strpos($markerline'# BEGIN ' $marker) !== false)
                
$state true;
        }
    }

    return 
$result;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics