classicpress_dev_version_info()
Prints information about the ClassicPress development version, if any.
Source
File: wp-admin/includes/misc.php
function classicpress_dev_version_info() {
if ( ! classicpress_is_dev_install() ) {
return;
}
$git_head = ABSPATH . '../.git/HEAD';
$git_commit = null;
if ( @is_file( $git_head ) ) {
$git_head = trim( file_get_contents( $git_head ) );
if ( preg_match( '#^ref: (refs/.*)$#', $git_head, $matches ) ) {
// on a branch
$git_head = ABSPATH . '../.git/' . $matches[1];
if ( @is_file( $git_head ) ) {
$git_commit = trim( file_get_contents( $git_head ) );
}
} else {
// detached HEAD
$git_commit = $git_head;
}
}
if ( ! $git_commit ) {
return;
}
echo '<span class="dev-version-info">';
/* translators: current development commit on GitHub */
printf(
__( 'commit %s' ),
substr( $git_commit, 0, 8 )
);
echo '</a>';
echo '</span>';
}
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |