Sindbad~EG File Manager

Current Path : /var/www/html/wordpress_alg24news/wp-content/themes/newsbt/amp/helper/
Upload File :
Current File : /var/www/html/wordpress_alg24news/wp-content/themes/newsbt/amp/helper/navigation.php

<?php 
/*
 * Security 	: blocking direct access
 * Source		: http://codex.wordpress.org/Theme_Development#Template_Files
*/
defined('ABSPATH') or die("Access Restricted");

/*
 * Register the amp-sidebar component script with WP AMP.
 * source : https://gist.github.com/johnregan3/a791b3322aa2a409283d1b860208a388
 *
*/
function mwp_amp_sidebar_component_script( $data ) {
	$data['amp_component_scripts']['amp-sidebar'] = 'https://cdn.ampproject.org/v0/amp-sidebar-0.1.js';
	return $data;
}
add_filter( 'amp_post_template_data', 'mwp_amp_sidebar_component_script' );

/*
 * Render a menu with clean markup.
 * 
 * Helper function that strips out unwanted code 
 * to create a simple link/text menu items.
 * 
 * This goes in your amp.php
 *
 * @param string $location The desired Menu Location.
 *
 * @return string
 * source : https://gist.github.com/johnregan3/a791b3322aa2a409283d1b860208a388
 * 
*/
function mwp_clean_nav_menu_items( $location ) {
	$locations = get_nav_menu_locations();
	if ( empty( $locations[ $location ] ) ) {
		return '';
	}
	$menu = wp_get_nav_menu_object( $locations[ $location ] );
	$menu_items = wp_get_nav_menu_items( $menu->term_id );
	if ( empty( $menu_items ) || ! is_array( $menu_items ) ) {
		return '';
	}
	ob_start();
	foreach ( $menu_items as $key => $menu_item ) : 
		?><li><a href="<?php echo esc_url( $menu_item->url ); ?>"><?php echo esc_html( $menu_item->title ); ?></a></li><?php 
	endforeach;
	return ob_get_clean();
}

function mwp_amp_scrolltop_component_script( $data ) {
	$data['amp_component_scripts']['amp-position-observer'] = 'https://cdn.ampproject.org/v0/amp-position-observer-0.1.js';
	$data['amp_component_scripts']['amp-animation'] = 'https://cdn.ampproject.org/v0/amp-animation-0.1.js';
	return $data;
}
add_filter( 'amp_post_template_data', 'mwp_amp_scrolltop_component_script' );

/*
 * Slideout Menu AMP
 *
*/
function mwp_amp_menu_scroll() { 
	?><amp-sidebar id="site-menu" layout="nodisplay">
		<div class="menu-section-list">
			<button on="tap:site-menu.close" class="amp-close-image"><amp-img src="<?php echo get_template_directory_uri(); ?>/amp/images/close.svg" alt="Menu" width="21px" height="21px"></amp-img></button>
			<ul><?php echo wp_kses_post( mwp_clean_nav_menu_items( 'primary' ) ); ?></ul>
		</div>
	</amp-sidebar>
	<button id="scrollToTopButton" on="tap:top-page.scrollTo(duration=200)" class="scrollToTop"><amp-img src="<?php echo get_template_directory_uri(); ?>/amp/images/angle-up.svg" alt="Menu" width="21px" height="21px"></amp-img></button>
	<?php
}
add_action('amp_post_template_footer','mwp_amp_menu_scroll');

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists