render_navigation();
?>
render_navigation();
?>
render_navigation();
$changelog = AUTOMOBILE_RENTAL_THEME_PATH . '/readme.txt';
$changelog_content = '';
if ( ! file_exists( $changelog ) ) {
$changelog_content = esc_html__( 'Changelog file not found.', 'automobile-rental' );
} elseif ( ! is_readable( $changelog ) ) {
$changelog_content = esc_html__( 'Changelog file not readable.', 'automobile-rental' );
} else {
global $wp_filesystem;
// Check if the the global filesystem isn't setup yet.
if ( is_null( $wp_filesystem ) ) {
WP_Filesystem();
}
$content = $wp_filesystem->get_contents( $changelog );
// Extract changelog section
if(preg_match('/== Changelog ==(.*?)(==|$)/s', $content, $matches)) {
$changelog_content = trim($matches[1]);
} else {
$changelog_content = esc_html__('No changelog found in readme.txt', 'automobile-rental');
}
}
?>
get_navigation_items();
?>
get_current_page();
// Display menu items.
foreach ( $menu_items as $item ) {
// Check if we're on a current item.
$current = false !== strpos( $base, $item['id'] ) ? 'current-item' : '';
?>
-
array(
'id' => 'dashboard',
'name' => esc_html__( 'About', 'automobile-rental' ),
'icon' => '',
'url' => menu_page_url( 'automobile-rental-dashboard', false ),
),
'plugins' => array(
'id' => 'plugins',
'name' => esc_html__( 'Demo Importer', 'automobile-rental' ),
'icon' => '',
'url' => menu_page_url( 'automobile-rental-plugins', false ),
),
'changelog' => array(
'id' => 'changelog',
'name' => esc_html__( 'Changelog', 'automobile-rental' ),
'icon' => '',
'url' => menu_page_url( 'automobile-rental-changelog', false ),
),
);
return apply_filters( 'automobile_rental_dashboard_navigation_items', $items );
}
/**
* Highlight dashboard page for plugins page.
*
* @since 1.0.0
* @param string $submenu_file The submenu file.
*/
public function highlight_submenu( $submenu_file ) {
global $pagenow;
// Check if we're on changelog page.
if ( 'themes.php' === $pagenow ) {
if ( isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( 'automobile-rental-plugins' === $_GET['page'] || 'automobile-rental-changelog' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$submenu_file = 'automobile-rental-dashboard';
}
}
}
return $submenu_file;
}
}
endif;
/**
* The function which returns the one Automobile_Rental_Dashboard instance.
*
* Use this function like you would a global variable, except without needing
* to declare the global.
*
* Example:
*
* @since 1.0.0
* @return object
*/
function automobile_rental_dashboard() {
return Automobile_Rental_Dashboard::instance();
}
automobile_rental_dashboard();