<?php
// v2.1
//http://wurfl.sourceforge.net/php_index.php
//header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
//header('Content-Type: text/html; charset=utf-8');
require_once('localization.php');
$start = (float) array_sum(explode(' ',microtime()));
$common_path = '../../../inflooenzmedia/'; if( $_SERVER['REMOTE_ADDR'] == '127.0.0.1' || $_SERVER['REMOTE_ADDR'] == '::1' ){ $common_path = '../../inflooenzmedia/';}
error_reporting(0);

$fireAlternateAds = false;
//if (time()%2 == 1){$fireAlternateAds = true;}

// FB TRAP
function handle_lock($lockfile) {
    flock(fopen($lockfile, 'w'), LOCK_EX);
}

$ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : false;
$isfb = false;
if ($ua && strpos($ua, 'facebookexternalhit') !== false) {
	$isfb = true;
	$FACEBOOK_REQUESTS_JAR = __DIR__ . '/.fb_requests';
    handle_lock(__DIR__ . '/.fb_requests.lock');

    $jar = @file($FACEBOOK_REQUESTS_JAR);
    $currentTime = time();
    $timestamp = isset($jar[0]) ? $jar[0] : time();
    $count = isset($jar[1]) ? $jar[1] : 0;

    if ($timestamp == $currentTime) {
        $count++;
    } else {
        $count = 0;
    }

    file_put_contents($FACEBOOK_REQUESTS_JAR, "$currentTime\n$count");

    if ($count >= 3) {
        header("HTTP/1.1 429 Too Many Requests", true, 429);
        header("Retry-After: 60");
        die;
    }

}

// END FB TRAP

// Functions
require_once($common_path.'functions.php');

// End Functions //
$artist = false;
if(isset($_GET['artist']))
{

$artist = stripslashes(strip_tags($_GET['artist']));
$artist_encoded = urlencode(remove_accents($artist)); 

//$artist_info = get_json('http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=' . $_GET['artist'] . '&autocorrect=1&api_key=' . env('LASTFM_API_KEY') . '&format=json');
// TODO Beyoncé bug
// Self-heal: refresh the stored token just before Spotify's 1h token expiry, and
// again if the search comes back empty. get_json() uses CURLOPT_FAILONERROR, so
// an expired token surfaces as a null result, not as an error object.
require_once('spotify-functions.php');
$spotify_access_token_file = $common_path.'spotify-access-token';
$spotify_refresh_token_file = $common_path.'spotify-refresh-token';
$GLOBALS['spotify_access_token_file'] = $spotify_access_token_file;
$GLOBALS['spotify_refresh_token_file'] = $spotify_refresh_token_file;
$GLOBALS['credentials'] = env('SPOTIFY_CLIENT_ID') . ':' . env('SPOTIFY_CLIENT_SECRET');
$GLOBALS['refresh_token'] = is_file($spotify_refresh_token_file) ? trim(file_get_contents($spotify_refresh_token_file)) : '';
$spotify_bearer = is_file($spotify_access_token_file) ? trim(file_get_contents($spotify_access_token_file)) : '';
if( $spotify_bearer == '' || ( is_file($spotify_access_token_file) && ( time() - filemtime($spotify_access_token_file) ) > 3000 ) ){
	if( refreshAccessToken() ){ $spotify_bearer = trim(file_get_contents($spotify_access_token_file)); }
}
$spotify_info_test = get_json('https://api.spotify.com/v1/search?q='.$artist_encoded.'&type=artist',null,null,null,$spotify_bearer);
if( is_null($spotify_info_test) && refreshAccessToken() ){
	$spotify_bearer = trim(file_get_contents($spotify_access_token_file));
	$spotify_info_test = get_json('https://api.spotify.com/v1/search?q='.$artist_encoded.'&type=artist',null,null,null,$spotify_bearer);
}
$spotify_info['image'] = $spotify_info_test->artists->items[0]->images[1]->url;
$spotify_info['artist_id'] = $spotify_info_test->artists->items[0]->id;
if( $spotify_info_test != null){ $artist = $spotify_info_test->artists->items[0]->name; }
//echo '<!--';
//echo '-->'; 


/* Disable for performance, relying on spotify
 Going to check LastFM only if artist is not in DB yet or has not MBID yet
$artist_db = getArtist($artist);
if(!$artist_db || $artist_db[0]['mbid']==''){

	$artist_info = get_json('http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=' . utf8_encode($artist) . '&autocorrect=1&api_key=' . env('LASTFM_API_KEY') . '&format=json');
	if ( !$artist_info )
		{ $artist = null; }
		else {
		$artist = $artist_info->artist->name;
		$mbid = $artist_info->artist->mbid; if($mbid){addArtist($artist,false,null,$mbid);}
		} 
} else {
		$artist = $artist_db[0]['name'];
} */
$artist_utf8_decoded = utf8_decode($artist);
$artist_encoded = urlencode(remove_accents($artist));
$artist_image = $spotify_info['image'];
/*
if( isset( $artist_info->artist->bandmembers ) ) { $members = $artist_info->artist->bandmembers; } else { $members = false; }
if( isset( $artist_info->artist->placeformed ) ) { $place = $artist_info->artist->bio->placeformed; } else { $place = false; }
if( isset( $artist_info->artist->yearformed ) ) { $fromyear = $artist_info->artist->bio->yearformed; } else { $fromyear = false; }
$toyear = false;
*/

$apiKey = env('ROVI_API_KEY'); $apiKey1 = env('ROVI_API_KEY_2');
$secretKey = env('ROVI_SECRET');$secretKey1 = env('ROVI_SECRET_2');

function getSig() {
global $apiKey, $secretKey;
$unixtime = time();
$sig = $apiKey . $secretKey . $unixtime;
return md5($sig);
}
}
if ( $locale == 'es_ES.UTF-8' ){$lang='es';} else {$lang='en';}
if ( $locale != 'es_ES.UTF-8' ) { if ( substr($artist, -1) == 's'  ) { $possesive = "'"; } else { $possesive = "'s"; } } else { $possesive = ''; }
	
if($artist){
	// Prepare content and check profanity
	$cache_file = 'cache/'.strtolower($artist_encoded).'-rovi-cache';
	//if ( file_exists($cache_file) && ( time() - filemtime($cache_file) ) < 15552000 ) { echo '<!-- msg: file cache-->';
	$influences_call = getInfluences($artist_utf8_decoded,'both');
	if( $influences_call ){
	//if( getInfluences($artist) ){
		$xml = '';
		$xml['name']['influencers'] = $influences_call['influencers'];
		$xml['name']['followers'] = $influences_call['followers']; echo '<!-- msg: db-->';
	} else if ( file_exists($cache_file) ) { //echo '<!-- msg: file cache-->';
		$xml = json_decode(file_get_contents($cache_file), true);
		// Bad cache correction
		if( $xml == false || $xml['name']['influencers'] == null ){ //echo '<!-- msg: bad cache correction-->';
		$url = 'http://api.rovicorp.com/data/v1/name/info?apikey=' . $apiKey . '&sig=' . getSig() .  '&name=' . $artist_encoded . '&include=musicstyles,discography,followers,influencers&format=json&callback=?';
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_FAILONERROR, 1);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_TIMEOUT, 15);
		$returned = curl_exec($ch); //echo '<!-- msg: rovi response -->';var_dump($returned);echo '<!-- msg: end rovi response -->';
		curl_close($ch);
		if ( $returned ){
			file_put_contents($cache_file, $returned);
			$xml = json_decode($returned, true);
			}
		}
	}
	else { echo '<!-- msg: file no cache -->';
		$url = 'http://api.rovicorp.com/data/v1/name/info?apikey=' . $apiKey . '&sig=' . getSig() .  '&name=' . $artist_encoded . '&include=musicstyles,discography,followers,influencers&format=json&callback=?';
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_FAILONERROR, 1);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_TIMEOUT, 15);
		$returned = curl_exec($ch);
		curl_close($ch);
		if ( $returned ){
			file_put_contents($cache_file, $returned);
			$xml = json_decode($returned, true);
		}
	}
	
	if( isset( $artist_info->artist->bandmembers ) ) { $members = $artist_info->artist->bandmembers; } else { $members = false; }
	if( isset( $xml['name']['birth']['place'] ) ) { $place = $xml['name']['birth']['place']; } else { $place = false; }
	if( isset( $artist_info->artist->yearformed ) ) { $fromyear = $artist_info->artist->bio->yearformed; } else { $fromyear = false; }

	
	$is_profanity = false;
	$artist_lastfm_encoded = str_replace('.', '', $artist);
	//$lastfm_similar_artists_json = get_json('http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist='  . utf8_encode($artist_lastfm_encoded)  . '&limit=15&api_key=' . env('LASTFM_API_KEY') . '&format=json');
	$spotify_similar_artists_json = get_json('https://api.spotify.com/v1/artists/'.$spotify_info['artist_id'].'/related-artists',null,null,null,$spotify_bearer);
	$spotify_genres_json = get_json('https://api.spotify.com/v1/artists/'.$spotify_info['artist_id'],null,null,null,$spotify_bearer);
	
	$acoustic = false;
	$words = array("folk", "songwriter", "acoustic", "neo mellow");
	foreach ( $spotify_genres_json->genres as $genre => $value){
		foreach ($words as $word) {
                if (strpos($value, $word) !== false) {
                    $acoustic = true;
					break;
                }
            }
	}
	echo '<!--';
	//var_dump($spotify_similar_artists_json);
	echo 'genres';var_dump($spotify_genres_json);
	var_dump( $acoustic );
	echo '-->';
	$the_similar_artists = array(); 
	// Build similar from LastFM deprecated
/*	if ($lastfm_similar_artists_json) {
		foreach ($lastfm_similar_artists_json->similarartists->artist as $key => $similar_artist) { 
			if ( strpos($similar_artist->name, $artist) === false ) { $the_similar_artists[] = $similar_artist; }	
		}
		$top_similar_artists = array_slice($the_similar_artists,0,9);
		foreach( $top_similar_artists as $similar ) { 
			if(check_profanity($similar->name)){ $is_profanity = true; $profanity_term = check_profanity($similar->name);}
		}
	}*/
	
	if ($spotify_similar_artists_json) {
		foreach ($spotify_similar_artists_json->artists as $key => $similar_artist) { 
			if ( strpos($similar_artist->name, $artist) === false ) { $the_similar_artists[] = $similar_artist; }	
		}
		$top_similar_artists = array_slice($the_similar_artists,0,9);
		$terms_to_check = array();
		foreach( $top_similar_artists as $similar ) { 
			$terms_to_check[] = $similar->name;
			/* Disabling slow shit
			if(check_profanity($similar->name)){ $is_profanity = true; $profanity_term = check_profanity($similar->name);} */
		}
	}
	/* Disabling slow shit
	if(check_profanity($artist)){ $is_profanity = true; $profanity_term = 'artist: '.check_profanity($artist); }*/
	$terms_to_check[] = $artist;
	if (is_array($xml['name']['influencers'])) { foreach( $xml['name']['influencers'] as $influencer ) {
			$terms_to_check[] = $influencer['name'];
			/* Disabling slow shit
			if(check_profanity($influencer['name'])){ $is_profanity = true; $profanity_term = 'influencer '.check_profanity($influencer['name']); }
			*/
		}
	}
	if (is_array($xml['name']['followers'])) { foreach( $xml['name']['followers'] as $follower ) { 
			$terms_to_check[] = $follower['name'];
			/* Disabling slow shit
			if(check_profanity($follower['name'])){ $is_profanity = true; $profanity_term = 'follower '.check_profanity($follower['name']) . $follower['name'] ; }*/
		}
	}
	if(!$fireAlternateAds) {
		if(check_profanity($terms_to_check)){$is_profanity = true; echo '<!-- profanity'; echo check_profanity($terms_to_check); echo '-->';}
		echo '<!-- terms';
		//var_dump($terms_to_check);
		echo '-->';
	} 
}
echo '<!-- is profanity? ';
	var_dump($is_profanity);
	echo '-->';
?>
<!DOCTYPE html>
<html lang="en"><!--<?php /*echo $profanity_term;*/ var_dump($is_profanity); ?>-->
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><?php if($artist) { $ucartist = ucwords($artist); echo sprintf(_('%s%s Biggest Music Influences'), $ucartist, $possesive); if(isset($_GET['influencer'])) { $influencer = strip_tags($_GET['influencer']); echo ': ' . ucwords(urldecode($influencer));}; if(isset($_GET['follower'])) { $follower = strip_tags($_GET['follower']); echo ': ' . ucwords(urldecode($follower));} } else { echo _('Inflooenz, a path to musical influences discovery'); } ?></title>
<meta name="description" content="<?php if(isset($_GET['influencer'])) { $influencer = ucwords(urldecode(strip_tags($_GET['influencer']))); echo sprintf(_('%1$s influenced %2$s. Listen to other bands and musicians that also influenced %2$s.'), $influencer, $artist); } else { echo _('Discover the bands and musicians that influenced'); echo ' '; if($artist){echo ucwords($artist);} else { echo _('your favorite artists'); } }?>." />
<meta property="fb:app_id" content="232304663523405" />
<meta property="og:title" content="<?php if($artist) { echo _('Discover who influenced') . ' ' . ucwords($artist); } else { echo _('Discover who influenced your favorite artists.'); }; ?>"/>
<meta property="og:image" content="<?php if($artist) { echo $artist_image; } else { echo 'https://inflooenz.com/img/inflooenz.png'; } ?>"/>
<meta property="og:description" content="<?php if($artist){echo _('Do you know who influenced') . ' ' . ucwords($artist) . '?' ;} else { echo _('...and share the info!');}; ?> "/>
<?php if($isfb){ die(); } ?>
<!--<meta name="viewport" content="width=device-width, initial-scale=1.0" />-->
<!--[if lte IE 9]><link rel="stylesheet" href="css/ie.css" type="text/css" media="screen" /><![endif]-->
<!--<link rel="stylesheet" href="css/jquery-ui.css" type="text/css" media="screen, projection" />-->
<link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" />
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="js/inflooenz.functions.js"></script>
<link rel="icon" type="image/ico" href="favicon.ico">
<link href='//fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700|Material+Icons' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="canonical" href="https://<?php if ( $locale == 'es_ES.UTF-8' ){ echo 'es.'; } ?>inflooenz.com<?php if ( $artist_encoded ){ echo '/?artist='.$artist_encoded; } ?>" />
<link rel="alternate" href="https://inflooenz.com<?php if ( $artist_encoded ){ echo '/?artist='.$artist_encoded; } ?>" hreflang="en" />
<link rel="alternate" href="https://es.inflooenz.com<?php if ( $artist_encoded ){ echo '/?artist='.$artist_encoded; } ?>" hreflang="es" />
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-4936183-19', 'auto');
  ga('send', 'pageview');

</script>
<?php if(!$fireAlternateAds) { ?>
<?php if(!$is_profanity) { ?>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5389855754409879" crossorigin="anonymous"></script>
<?php } else { /*$fireAlternateAds = true;*/ } ?>
<?php } ?>
<meta name="flattr:id" content="73qe5z">
</head>
<?php flush(); ?>
<body<?php if(!$artist) { echo ' class="home"'; } ?>>
<header><div class="fullrow" id="header"><?php if(!$artist) { echo '<script>setHomeHeader();</script>'; } else { echo '<script>setFixedHeader();</script>'; }?>
<div class="col-12" <?php if(!$artist) { echo 'style="text-align:center;"'; } ?>>
	<dl<?php if(!$artist) { echo ' style=""'; } ?>>
	<dt><a href="https://<?php if ( $locale == 'es_ES.UTF-8' ){ echo 'es.'; } ?>inflooenz.com">Inflooenz</a></dt>
	<dd><p id="site-description"><?php echo _('The music lineage guide'); ?></p>
	<p><?php echo _('Discover who influenced your favorite artists'); ?></p></dd>
	</dl><form name="search" action="" method="get" id="search" <?php if(!$artist) { echo 'style=""'; } ?>>  
		<div id="index-input"<?php if(!$artist) { echo ' style="float:none"'; } ?>>
		<div id="search-box">
			<input type="text" id="search-input" name="artist" required="required" <?php if(!$artist) { echo 'autofocus';}?> value="<?php // echo _('Your favorite artist here...'); ?>" class="clearMeFocus" />
			<input id="buscar-btn" type="submit" name="submit" value="<?php echo _('Search');?>" />
			<i class="material-icons">search</i>
			<?php if (isset($_GET['user'])) echo '<input id="user" name="user" hidden="hidden" value="'.$_GET['user'].'"/>'; ?>
		</div>
		</div>
	</form>
	<a href="https://<?php if ( $locale == 'es_ES.UTF-8' ){ echo 'es.'; } ?>inflooenz.com" title="<?php echo _('Search influences'); ?>"><i class="material-icons" id="collapsed-search"><?php echo _('search'); ?></i></a>
</div>
</div>
<?php if( 1==2 ) { ?>
	<?php if($artist) { ?>
	<?php if(!$fireAlternateAds) { ?>
	<?php if(!$is_profanity){ ?>
	<div class="fullrow adsense" style=""><div class="col-12">
	<!-- Inflooenz-Leaderboard-Resp -->
	<ins class="adsbygoogle"
	     style="display:block"
	     data-ad-client="ca-pub-5389855754409879"
	     data-ad-slot="3482725974"
	     data-ad-format="auto"></ins>
	<script>
	(adsbygoogle = window.adsbygoogle || []).push({});
	</script>
	</div></div>
	<?php } else { 	$fireAlternateAds = true; ?>
	<?php } ?>
	<?php } ?>
	<?php } ?>
<?php } ?>

</header>

<?php if($artist){ ?>
<!-- Pre Header Inflooenz -->
<!--<div style="text-align:center;padding:1em 0">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-5389855754409879"
     data-ad-slot="4527735541"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></div>-->
<?php } ?>

<?php if ($artist) { ?>
<img src="img/loading.gif" alt="Loading..." id="loading" class="centered">
<div id="sidebar">
  <div class="widget">
    <!--<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Finflooenz.com&send=false&layout=box_count&width=120&show_faces=false&font&colorscheme=light&action=like&height=90&appId=232304663523405" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:90px;" allowtransparency="true"></iframe>-->
  </div>
  <div id="share-bar" style="display:none;"></div>
</div>
<?php } ?>
<div <?php
if($artist){ echo 'id="content"'; } else { echo 'id="content-home"'; }; ?> class="fullrow">

<div id="nav" class="fullrow">
<?php if($artist && $artist != '' )
{?>

<div id="artist-header" class="fullrow" itemscope itemtype="http://schema.org/MusicGroup">
	<div class="col-12 main">
	<?php // if($artist && isset($_GET['user']) && $_GET['user'] == 'fixion') { foreach($xml['name']['musicStyles'] as $item){ if(in_array('Heavy Metal',$item)) { echo '<div class="message">{Fixion : Heavy Artist}</div>'; break;} if(in_array('Hard Rock',$item)) { echo '<div class="message">{Fixion : Heavy Artist}</div>'; break;} } ; }?>
	<?php
		echo '<img src="'.$artist_image.'" alt="'.$artist.'" class="main">';
	?>
	<h1><span class="artist" itemprop="name"><?php echo $artist; ?></span><span style="display:none" id="summary-button" class="header-nav"><?php echo _('Summary'); ?></span><span id="influences-button" class="header-nav"><?php echo _('Influences'); ?></span><span id="hits-button"  class="header-nav" style="display:none"><?php echo _('Hits'); ?></span><!--<span id="discuss-button" class="header-nav" style="border-bottom: .2em solid #99ffea;"><a href="#discuss" style="color:#ededed"><?php echo _('Discuss'); ?></a></span>-->
	<div style="line-height:0.9em;margin-left:0.5em" class="fb-like" data-href="http://inflooenz.com" data-layout="button" data-action="like" data-show-faces="true" data-share="false"></div>
	</h1>

	</div>
	
	<div id="artist-summary" class="col-12" style="display:none">
	<h2><?php echo _('Summary'); ?></h2>
	<?php if( $place ) { echo '<span itemprop="location">'.$place.'</span>'; } ?>
	<?php if( $fromyear ) { echo '<span itemprop="foundingDate">'.$fromyear.'</span>'; } ?>
	<?php if( $toyear ) { echo '<span itemprop="dissolutionDate">'.$toyear.'</span>'; } ?>
	<?php if( $members ) { foreach ( $members->member as $member )
		echo '<span itemprop="musicGroupMember">'.$member->name.'</span>';
	} ?>
	</div>
	
</div>
<?php // end artist header ?>

<?php if(!$is_profanity && !$fireAlternateAds){ ?>
<!-- reemplazo para no aplicar dimensiones dinámicas a la clase adsense <div class="fullrow adsense col-43"><div class="col-12" id="ad-slot-1" style="padding:1rem 0;text-align:left;">-->
<div class="fullrow col-43" style="padding:0"><div class="col-12" id="ad-slot-1">

	<!-- Inflooenz-Leaderboard-Resp -->
	<!--<ins class="adsbygoogle"
		 style="display:block"
		 data-ad-client="ca-pub-5389855754409879"
		 data-ad-slot="3482725974"
		 data-ad-format="auto"></ins>
	<script>
	(adsbygoogle = window.adsbygoogle || []).push({});
	</script>-->
	<!-- Pre Header Inflooenz -->
	<!-- Inflooenz - Top Full -->
	<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-5389855754409879"
     data-ad-slot="4527735541"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
	<script>
		 (adsbygoogle = window.adsbygoogle || []).push({});
	</script>
</div></div>
<?php } else if($lang!='es') {
	$shareasaleTop[0] = array(
	'href' => 'https://shareasale.com/r.cfm?b=506245&amp;u=2130074&amp;m=21395&amp;urllink=&amp;afftrack=',
	'src' => 'https://static.shareasale.com/image/21395/rb-music-affiliate-1.jpg'
	);
	$shareasaleTop[1] = array(
	'href' => 'https://shareasale.com/r.cfm?b=1555385&amp;u=2130074&amp;m=21395&amp;urllink=&amp;afftrack=',
	'src' => 'https://static.shareasale.com/image/21395/RBJUNENL1.png'
	);
	$shareasaleTop[2] = array(
	'href' => 'https://shareasale.com/r.cfm?b=1524029&amp;u=2130074&amp;m=21395&amp;urllink=&amp;afftrack=',
	'src' => 'https://static.shareasale.com/image/21395/Redbubble002_00.JPG'
	);
	$shareasaleTop[3] = array(
	'href' => 'https://shareasale.com/r.cfm?b=1540101&amp;u=2130074&amp;m=21395&amp;urllink=&amp;afftrack=',
	'src' => 'https://static.shareasale.com/image/21395/RedbubbleMay-500x180.png'
	);
	//shuffle($shareasaleTop);
	?>
<!-- <div class="fullrow col-43"><div class="col-12" style="text-align:left;">
<a target="_blank" href="<?php echo $shareasaleTop[0]['href']; ?>"><img src="<?php echo $shareasaleTop[0]['src']; ?>" border="0" style="max-width: 100%;" /></a>
</div></div>-->
<? } ?>

<div id="nav-influences" style="position:relative">
<div class="fullrow odd influences-list-container">
<div class="col-12">
<?php if( $xml !== false && $xml['name']['influencers'] !== null) { ?>
<h3 class="bottom followMeBar<?php if( count($xml['name']['influencers']) > 5 ) { echo ' rotate';}?>"><?php echo _('Influencers') ?></h3>
<ul id="influencers-list" class="influences-list"><?php //echo "<script>ga('set', 'metric1', ".count($xml['name']['influencers']).");</script>";
foreach ($xml['name']['influencers'] as $item) {
	$sanitized_name = strtolower(urlencode($item['name']));
	$sanitized_name = str_replace(array(".","%2c",",","%27","%21"), "", $sanitized_name);
	$css_id_name = str_replace(array("+", "%26"), "", $sanitized_name);
	echo '<li class="item"><a href="?artist=' . $artist_encoded . '&amp;influencer=' . $sanitized_name . ( ($locale != 'en_US')  ? '&locale='.$locale : '' ) . '" id="' . $css_id_name . '" title="' . sprintf(_('Discover the top songs and albums from %1$s that influenced %2$s.'), $item['name'], ucwords($artist)) . '" class="weight-'.$item['weight'].'">' . urldecode(urlencode($item['name'])) . '</a></li>';
} ?><li style=""><div class="spotify-playlist-button"><a href="#" data-call="spotify-connect.php?artist=<?php echo $artist_encoded; ?>&amp;relationship=influencers"><?php echo _("Play the complete artist's influences playlist!"); ?></a></div></li>
</ul>
<?php } else { 
//echo '<h3 class="empty">'. _('Influencers'). '</h3><p class="influences-list">' . sprintf(_('Either this artist is the beginning of a lineage, or we don\'t know exactly who influenced his work.<br>Don\'t feel bad. While you meditate your next search, you can hear some of %s \'s most famous songs.'), $artist) . '</p>';
echo '<h3 class="empty">'. _('Bad News'). '</h3><p class="influences-list">' . sprintf(_('We recently had an issue with our database provider.<br>We are rebuilding influences. Would you help with your suggestions?<span style="cursor:pointer;padding:1em;margin:1em auto;display:block;color:#006699;background:#F7CA18;box-shadow: -3px 3px 6px rgba(50, 50, 50, 0.5);border-radius: 3px;text-align:center;font-size:1.4em;" id="suggest-influences">Do your suggestion</span>'), $artist) . '</p>';
} ?>
</div>
</div>
<?php // end influences ?> 
<?php if(!$is_profanity && !$fireAlternateAds && count($xml['name']['influencers']) > 9 ){ ?>
<div class="fullrow adsense col-43"><div class="col-12" id="ad-slot-1" style="padding:1rem 0;text-align:left;">
<!-- Inflooenz-Leaderboard-Resp -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-5389855754409879"
     data-ad-slot="3482725974"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div></div>
<?php } ?>

<div class="fullrow influences-list-container">
<div class="col-12">
<?php if( $xml !== false && $xml['name']['followers'] !== null) { //var_dump($xml);?>
<h3 class="rotate"><?php echo _('Followers'); ?></h3>
<ul id="followers-list" class="influences-list"><?php
foreach ($xml['name']['followers'] as $item) {
	$sanitized_name = strtolower(urlencode($item['name']));
	$sanitized_name = str_replace(array(".","%2c",",","%27","%21"), "", $sanitized_name);
	$css_id_name = str_replace(array("+", "%26"), "", $sanitized_name);
	echo '<li class="item"><a href="?artist=' . $artist_encoded . '&amp;follower=' . $sanitized_name .'" id="' . $css_id_name . '" title="' . sprintf(_('Discover the top songs and albums from %1$s influenced by %2$s.'),$item['name'], ucwords($artist) ) . '" class="weight-'.$item['weight'].'">' . urldecode(urlencode($item['name'])) . '</a></li>';
} ?><li style="display:block;"></li><li style="background:#66CC99;box-shadow: 0px 1px 2px;"><a style="color:#FFF;padding-right:1.5em" href="https://www.patreon.com/bePatron?c=335589&rid=1325999" target="_blank" id="sponsor-a-follower"><?php echo sprintf(_("Are you a follower of %s? Get featured here!"),$artist); ?></a></li>
</ul>
<?php } else { //echo '<h3 class="empty">' . _('Followers') . '</h3><p class="influences-list">' . _('Either this artist is new, or we don\'t know exactly who was influenced by his work.').'</p>';
} ?>
</div>
</div>
<div id="profile"></div>
</div>

</div>

<!-- old position with scroll <div id="profile"></div> -->

<?php } else { ?>
<div class="col-12"><p class="intro"><?php if(isset($_GET['artist'])){ echo '<em>' . _('Sorry, our squirrels couldn\'t find that artist.').'</em> ';}; ?><?php
	$lastfm_api = 'http://ws.audioscrobbler.com/2.0/?method=chart.gettopartists&api_key=' . env('LASTFM_API_KEY') . '&format=json';
	$lastfm_top_artists_response = get_json($lastfm_api); //$lastfm_top_artists_response = iconv("UTF-8", "WINDOWS-1252", $lastfm_top_artists_response);
	$lastfm_top_artists_arr = array();
	//print_r($lastfm_top_artists_xml->artists->artist);
	if ($lastfm_top_artists_response) {
	foreach ($lastfm_top_artists_response->artists->artist as $item) {
	$name = $item->name;
	$name = iconv("UTF-8", "WINDOWS-1252", $name);
	array_push($lastfm_top_artists_arr, $name); }; //$lastfm_top_artists_arr = array('Beyoncé');
	$random_artist = $lastfm_top_artists_arr[array_rand(array_slice($lastfm_top_artists_arr,0,10))];
	echo _('What about') . ' <a href="?artist=' . urlencode($random_artist) . '" title=" ' . _('Who influenced') . ' ' . $random_artist . '?">' . $random_artist . '</a>?';
	} else { echo _('What about') . ' <a href="?artist=U2" title="' . _('Discover the musicians that influenced U2') . '">U2</a>?';}
 ?></p></div>

<?php }; ?>

</div>

<?php if($artist) { ?>
<footer class="fullrow">
<?php if(!$is_profanity && !$fireAlternateAds && (count($xml['name']['followers']) > 3 || count($xml['name']['followers']) + count($xml['name']['influencers']) > 5 )){ ?>
<!-- <div class="fullrow adsense" style="background:#FFF">
	<div class="col-12" style="padding-left:0;padding-right:0"> -->
		<!-- Inflooenz-Footer-Resp -->
		<!-- <ins class="adsbygoogle"
			 style="display:block"
			 data-ad-client="ca-pub-5389855754409879"
			 data-ad-slot="6436192375"
			 data-ad-format="auto"></ins>
		<script>
		(adsbygoogle = window.adsbygoogle || []).push({});
		</script>
	</div>
</div>-->
<?php } else if($lang!='es') {
	/*$shareasaleTop = array();
	$shareasaleTop[0] = array(
	'href' => 'https://shareasale.com/r.cfm?b=482523&amp;u=2130074&amp;m=21395&amp;urllink=&amp;afftrack=',
	'src' => 'https://static.shareasale.com/image/21395/rb-pop-affiliate-3.jpg'
	);
	$shareasaleTop[1] = array(
	'href' => 'https://shareasale.com/r.cfm?b=1555385&amp;u=2130074&amp;m=21395&amp;urllink=&amp;afftrack=',
	'src' => 'https://static.shareasale.com/image/21395/RBJUNENL1.png'
	);
	$shareasaleTop[2] = array(
	'href' => 'https://shareasale.com/r.cfm?b=1524029&amp;u=2130074&amp;m=21395&amp;urllink=&amp;afftrack=',
	'src' => 'https://static.shareasale.com/image/21395/Redbubble002_00.JPG'
	);
	$shareasaleTop[3] = array(
	'href' => 'https://shareasale.com/r.cfm?b=1517943&amp;u=2130074&amp;m=21395&amp;urllink=&amp;afftrack=',
	'src' => 'https://static.shareasale.com/image/21395/dolphin.png'
	);
	shuffle($shareasaleTop);*/
	?>
<!--<div class="fullrow adsense" style="background:#FFF"><div class="col-12"><a target="_blank" href="<?php echo $shareasaleTop[0]['href']; ?>"><img src="<?php echo $shareasaleTop[0]['src']; ?>" border="0" style="max-width: 100%;" /></a></div></div>
-->
<?php } ?>
<?php $ccode = getCountryCode($_SERVER['REMOTE_ADDR']);
if( $ccode == 'GB' || $ccode == 'DE' || $ccode == 'FR' || $ccode == 'ES' ){
?>
<!-- Amazon country -->
<div class="fullrow content-<?php echo strtolower($ccode); ?>" id="a-shop">
<div class="">
<?php if( $ccode == 'GB'){echo '<h3>Shop '.$artist.' Music and Merch</h3>';} elseif( $ccode == 'DE' ){echo '<h3>Jetzt einkaufen</h3>';} elseif( $ccode == 'FR' ){echo '<h3>Achetez CD & Vinyles</h3>';} elseif( $ccode == 'ES' ){echo '<h3>Comprar discos y merchandising</h3>';} ?>
<?php render_amazon($artist,'Fashion',true,5,$ccode); ?>
<style>
#a-shop{background:#FFF;border-top:1px solid #CCC;}
.a-offer{display:inline-block;vertical-align:top;margin-top:1em}
.offer-title{margin: 1em 0;max-height:2.5em;overflow:hidden}
.a-button{background:#f0c14b;display:inline-block;padding:.3em;border-radius:3px;position:absolute;bottom:1.5em}
.a-icon-shop-now {left: 2px;top: 2px;height: 25px;width: 25px;background: 0;display: inline-block;vertical-align:middle;}
.a-button-text{color:#333;padding:.2em .2em .2em .1em;vertical-align:middle;}
.price{display:none;}
@media handheld, only screen and (min-width:450px){.a-offer{width:50%}}
@media handheld, only screen and (min-width:650px){.a-offer{width:20%}}
</style>
</div></div>
<?php } ?>
<!--<a name="discuss"></a>
<div class="fullrow col-12" id="disqus" style="text-align:left;background:#e8e8e8;">
<div class="footer-widget">
<h2><?php echo _('Discuss '.$ucartist.' influences'); ?></h2>
<div id="commento"></div>
<script defer src="https://cdn.commento.io/js/commento.js" data-page-id="https://<?php if ( $locale == 'es_ES.UTF-8' ){ echo 'es.'; } ?>inflooenz.com<?php if ( $artist_encoded ){ echo '/?artist='.$artist_encoded; } ?>"></script>
</div>
</div>-->

<?php $rb_products = array( 
array(
	'href' => 'https://shareasale.com/r.cfm?b=166090&u=2130074&m=21395&urllink=www%2Eredbubble%2Ecom%2Fpeople%2Fmadeintype%2Fworks%2F38880475%2Ddon%2Dt%2Dstop%2Dme%2Dnow%3Fp%3Dt%2Dshirt%26style%3Dtank&afftrack=',
	'title' => "Don't stop me now shirt",
	'img' => 'https://ih1.redbubble.net/image.821287508.0475/ra,tank,x1750,fafafa:ca443f4786,front-c,110,25,828,898-bg,f8f8f8.u1.jpg' ),
array( 
	'href' => 'https://shareasale.com/r.cfm?b=166090&u=2130074&m=21395&urllink=www%2Eredbubble%2Ecom%2Fpeople%2Fmadeintype%2Fworks%2F38880475%2Ddon%2Dt%2Dstop%2Dme%2Dnow%3Fp%3Diphone%2Dcase%26type%3Diphone%5Fxs%5Fsoft&afftrack=',
	'title' => "Don't stop me now iPhone case",
	'img' => 'https://ih0.redbubble.net/image.821286020.0475/mwo,720x720,iphone_xs_soft-pad,828x898,f8f8f8.u1.jpg' ),
array(
	'href' => 'https://shareasale.com/r.cfm?b=166090&u=2130074&m=21395&urllink=www%2Eredbubble%2Ecom%2Fpeople%2Fmadeintype%2Fworks%2F21737269%2Dever%2Dtried%2Dever%2Dfailed%2Dno%2Dmatter%3Fp%3Dhardcover%2Djournal&afftrack=',
	'title' => "Hardcover journal: No matter, try again",
	'img' => 'https://ih0.redbubble.net/image.710589376.7269/hj,x1000-bg,f8f8f8.u1.jpg' ),
array(
	'href' => 'https://shareasale.com/r.cfm?b=166090&u=2130074&m=21395&urllink=www%2Eredbubble%2Ecom%2Fpeople%2Fmadeintype%2Fworks%2F35922217%2Dtake%2Da%2Dsad%2Dsong%2Dand%2Dmake%2Dit%2Dbetter%3Fp%3Dwomens%2Dpremium%2Dt%2Dshirt&afftrack=',
	'title' => "T-Shirt: Take a sad song and make it better (Let It Be)",
	'img' => 'https://ih0.redbubble.net/image.710582245.2217/rco,womens_premium_t_shirt,womens,x1450,fafafa:ca443f4786,front-c,135,0,828,898-bg,f8f8f8.u1.jpg' ),
array(
	'href' => 'https://shareasale.com/r.cfm?b=166090&u=2130074&m=21395&urllink=www%2Eredbubble%2Ecom%2Fpeople%2Fmadeintype%2Fworks%2F35922217%2Dtake%2Da%2Dsad%2Dsong%2Dand%2Dmake%2Dit%2Dbetter%3Fp%3Dframed%2Dprint&afftrack=',
	'title' => "Framed Print: Take a sad song and make it better (Let It Be)",
	'img' => 'https://ih0.redbubble.net/image.710579043.2217/fp,750x750,black,off_white,box20,s,f8f8f8-pad,828x898,f8f8f8.u1.jpg' ),
array(
	'href' => 'https://shareasale.com/r.cfm?b=166090&u=2130074&m=21395&urllink=www%2Eredbubble%2Ecom%2Fen%2Fpeople%2Fmadeintype%2Fworks%2F35921119%2Dnecesita%2Dm%2Ds%2Dletras%2Dde%2Dcaf%3Fp%3Dtravel%2Dmug&afftrack=',
	'title' => "Need more Coffee lettering Travel Mug",
	'img' => 'https://ih1.redbubble.net/image.710541591.1119/mug,travel,x720,right-pad,828x898,f8f8f8.u1.jpg' ),
 ); ?>
<?php

?>
<!--<div class="redbubble"><div class="col-12" style="text-align:left"><h2 style="padding-top: 1em;padding-bottom: 1em;"><?php echo _('Shop Some Merch From Independent Designers'); ?></h2></div>
<?php 
/*$rb_products = get_affiliate_links($artist);
$sliced_rb_products = array_slice($rb_products,-5); shuffle($sliced_rb_products); foreach ( $sliced_rb_products as $item ){
	$item['href'] = $item['url']; $item['title'] = $item['name']; $item['img'] = $item['thumbnail']; 
	echo '<a href="'.$item['href'].'" title="'.$item['title'].'" target="_blank"><img class="lazy" data-original="'.$item['img'].'" data-id="'.$item['id'].'"><span class="buy-button">Buy now</span></a>' ; }*/ ?></div>
<style>
.redbubble{background: #FFF;}
.redbubble a {position:relative;display:block;}
.redbubble img{max-width:100%;display:block !important;border: 1px solid #D7D7D7;box-sizing: border-box;}
.redbubble .buy-button {position:absolute;left:0;right:0;bottom:2em;background:#ffff00db;margin:3em;padding:1em;color:#111;border:1px solid #d2b200;}
@media (min-width:600px){
	.redbubble img{max-width:20%;vertical-align: bottom;display:inline-block !important;}
	.redbubble a {display: inline;}
}
</style>-->

<div class="fullrow" id="footer-more">

<div class="footer-widget fourcol">
<h2><?php echo _('More'); ?></h2>
<?php if ( $locale == 'es_ES.UTF-8' ) { $target_hits_url = 'mejorescanciones.es/'; } else { $target_hits_url = 'hits.inflooenz.com/?artist='; } ?>
<h3><a href="<?php echo 'http://' . $target_hits_url ; echo ( $locale != 'es_ES.UTF-8' ) ? $artist_encoded : str_replace('+','-',$artist_encoded) ; ?>" title="<?php echo sprintf(_('Listen to %s greatest songs online'), $artist); ?>">» <?php echo ucwords(sprintf(_('%s Greatest Hits'), $artist)); ?></a></h3>
<?php if(strtolower($artist)=="the cure") {?><h3><a href="https://www.youtube.com/watch?v=jJwTSTlpsak&list=PLupk25CXb9ll7Tlqj99e3qmOsb1gVBwdQ" title="The Cure Acoustic Covers Playlist on YouTube" onclick="ga('send','event','UI','Open YT playlist');">» The Cure acoustic covers on YouTube</a> or <a href="https://open.spotify.com/playlist/79USDfPPa6ZAzNfygxNgJn?si=c78b171c4382457c" title="The Cure Acoustic Covers Playlist on Spotify" onclick="ga('send','event','UI','Open Spotify playlist');">Spotify</a></h3><?php } ?>
<?php if($acoustic) {?><h3><a href="https://open.spotify.com/playlist/585gDq9lNMGtEQ3xT07PlV?si=4508b50d43af4736" title="Best Acoustic Covers Playlist on Spotify" onclick="ga('send','event','UI','Open Spotify playlist');">» Best acoustic covers</a></h3><?php } ?>
<?php 
$lyrics_artists = array('Harry Styles','Frank Ocean','The Strokes','Kanye West','Billie Eilish','Lady Gaga');
if(in_array($artist,$lyrics_artists)){ echo '<h3><a href="//lyrics.inflooenz.com/?artist='.urlencode(strtolower($artist)).'" target="_blank">» Play the <span style="background:#db0a5b;color:#f0ff00;padding:.2em .5em;font-style:italic"><?php echo $artist; ?> Lyrics Trivia</span></a></h3>';}?><h3><a href="//htmllotron.inflooenz.com" title="The HTMLlotron" target="_blank">» Play a free online Mellotron piano</a></h3>
<!--<a href="//lyrics.inflooenz.com/"><img class="lazy" data-original="/img/lyrics - trivia.png" style="display:block"></a><a href="//lyrics.inflooenz.com/"><img class="lazy" data-original="/img/lyrics - play now.png" style="display:block"></a>-->
</div>
<div class="footer-widget eightcol">
<?php if(strtolower($artist)=="jack johnson"||strtolower($artist)=="ben harper"||strtolower($artist)=="bob marley"){ $chivo = '-ukxrpic2yA'; }
else if(strtolower($artist)=="the cure"){ $chivo = 'RXN1gQkt_Po';}
else if(strtolower($artist)=="bon iver"||strtolower($artist)=="ed sheeran"||strtolower($artist)=="fleet foxes"||strtolower($artist)=="the lumineers"||strtolower($artist)=="radiohead"||strtolower($artist)=="u2"||strtolower($artist)=="elton john"||strtolower($artist)=="nick cave"||strtolower($artist)=="arcade fire"){ $chivo = 'RYxdiv0y2Pw';}
else if(strtolower($artist)=="oasis"||strtolower($artist)=="the beatles"){ $chivo = '6Azrva7BHf8';}
else if(strtolower($artist)=="soda stereo"||strtolower($artist)=="gustavo cerati"){ $chivo = 'aG5Bp-gUIrM';}
else if(strtolower($artist)=="nick drake"||strtolower($artist)=="brooks jefferson"||strtolower($artist)=="jeff buckley"){ $chivo = 'm2Z5Lh85HPc';}
 else {?>
<?php } ?>
<?php unset($chivo); if(isset($chivo)){ ?>
<h2>Some independent music here...</h2><iframe style="max-width:100%;padding-top:1em;" width="560" height="315" src="https://www.youtube.com/embed/<?php echo $chivo; ?>?rel=0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<? } ?>
</div>
<div id="ad-more-widget">
<?php
$zzads[0] = '<a href="https://www.zzounds.com/a--3960333/lp/fender-american-buying-guide/188"><img src="https://c3.zzounds.com/media/slide1-1b1919d65c2c261457316d1dfc9a98d2.jpg" title="Buy Fender Guitars online" target="_blank"></a>';
$zzads[1] = '<a href="https://www.zzounds.com/a--3960333/lp/gibson-guitars-and-basses/478"><img src="https://c3.zzounds.com/layout/zzounds/landingpages/478/main.jpg" title="Buy Gibson Guitars and Basses Online" target="_blank"></a>';
//echo $zzads[array_rand($zzads)];
?>
<?php if(!$is_profanity){ ?>
	<!-- Inflooenz-Middle-Resp -->
	<!--<ins class="adsbygoogle"
	style="display:block"
	data-ad-client="ca-pub-5389855754409879"
	data-ad-slot="4025262429"
	data-ad-format="auto"></ins>
	<script>
	(adsbygoogle = window.adsbygoogle || []).push({});
	</script>-->
	<?php } ?>
</div>
<?php
$bc_caminos = '<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=1880105047/size=small/bgcol=ffffff/linkcol=0687f5/track=362551755/transparent=true/" seamless><a href="//donzoilo.bandcamp.com/album/demos-ii-2003-2006">Demos II (2003 - 2006) by donzoilo</a></iframe>';
$bc_marayer = '<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=356527528/size=small/bgcol=ffffff/linkcol=0687f5/track=4277567919/transparent=true/" seamless><a href="//donzoilo.bandcamp.com/album/demos-i-2001-2002">Demos I (2001 - 2002) by donzoilo</a></iframe>';
$bc_sefue = '<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=356527528/size=small/bgcol=ffffff/linkcol=0687f5/track=4277567919/transparent=true/" seamless><a href="//donzoilo.bandcamp.com/album/demos-i-2001-2002">Demos I (2001 - 2002) by donzoilo</a></iframe>';
$bc_porque = '<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=1880105047/size=small/bgcol=ffffff/linkcol=0687f5/track=2788406274/transparent=true/" seamless><a href="//donzoilo.bandcamp.com/album/demos-ii-2003-2006">Demos II (2003 - 2006) by donzoilo</a></iframe>';
$bc_estejuego = '<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=1880105047/size=small/bgcol=ffffff/linkcol=0687f5/track=1925297261/transparent=true/" seamless><a href="//donzoilo.bandcamp.com/album/demos-ii-2003-2006">Demos II (2003 - 2006) by donzoilo</a></iframe>';
$bc_silencio = '<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=1880105047/size=small/bgcol=ffffff/linkcol=0687f5/track=2272299967/transparent=true/" seamless><a href="//donzoilo.bandcamp.com/album/demos-ii-2003-2006">Demos II (2003 - 2006) by donzoilo</a></iframe>';
$bandcamp_arr = array(
'radiohead' => $bc_caminos,
'beach house' => $bc_marayer,
'yo la tengo' => $bc_marayer,
'cocteau twins' => $bc_marayer,
'the smiths' => $bc_sefue,
'coldplay' => $bc_estejuego,
'u2' => $bc_silencio,
'pixies' => $bc_porque
);
?>
<?php if( array_key_exists( strtolower($artist) , $bandcamp_arr ) ) {?>
<!--<div class="fullrow" style="clear:both;">
<h2><?php echo _('Discover Indie Artists'); ?></h2>
<div class="fourcol" style="margin-top:1rem">
<?php echo $bandcamp_arr[strtolower($artist)]; ?>
</div>
</div>-->
<?php } ?>

<div class="footer-widget fullrow" id="similar-artists">
<?php

	if ( $top_similar_artists ) { echo '<h2>'._('Discover Other Artist\'s Influences').'</h2><div class="fourcol">';
	$i = 1;
	foreach ( $top_similar_artists as $similar_artist ){
		if ( $i == 5 && $is_profanity == false && !$fireAlternateAds ){
			 ?>			 
			<div style="width:100%;height:auto;display:block;">
			<!-- Inflooenz-Footer-Resp -->
			<ins class="adsbygoogle"
				 style="display:block"
				 data-ad-client="ca-pub-5389855754409879"
				 data-ad-slot="6436192375"
				 data-ad-format="auto"
				 data-full-width-responsive="true"></ins>
			<script>
				 (adsbygoogle = window.adsbygoogle || []).push({});
			</script>
			</div>
		<?php
		} else {
		$similar_artist_encoded = $similar_artist->name;
		//$similar_artist_encoded = remove_accents( $similar_artist->name );
		$similar_artist_encoded = urlencode($similar_artist_encoded);
		if( is_array($similar_artist->images) ) { $similar_image = $similar_artist->images[1]->url;}
		?><a class="similar" href="https://<?php if ( $locale == 'es_ES.UTF-8' ){ echo 'es.'; } ?>inflooenz.com/?artist=<?php echo $similar_artist_encoded ; ?>" title="<?php echo _('Influences of') . ' ' . $similar_artist->name; ?>"><span class="wrap"><img class="lazy" loading="lazy" src="<?php echo $similar_image; ?>" alt="<?php echo _('Picture of') . ' ' . $similar_artist->name ?>"></span><span id="similar-name"><?php echo ucwords($similar_artist->name); ?></span></a>
		<?php }
		if ( $i % 3 == 0) { echo '</div><div class="fourcol">';}
		$i++;
	}
	echo '</div>';
	}

?>
</div>
</div>
<!--<h2>Do you really like this site?</h2>
<p id="subscription-explained" style="margin-bottom:2.5em;">Support Inflooenz with a small recurring donation</p>
<span class="button"><a href="https://www.patreon.com/inflooenz" target="_blank">Become a Supporter <small>(Powered by Patreon)</small></a></span>
--><!--<h2>Do you know the HTMLlotron?</h2>
<p>It is our homage to the legendary <strong>Melltotron</strong> featured in Strawberry Fields Forever.</p>
<a href="//htmllotron.inflooenz.com" target="_blank"><img src="https://pbs.twimg.com/media/Dn5T_ENXcAAYnQK.jpg:large" style="width:25%;display:block;margin:1em auto;border: 1px solid #111;"></a>
<span class="button"><a href="//htmllotron.inflooenz.com" target="_blank">Try it!</a></span>-->

<!--<div class="col-12" id="subscription" style="padding-top:2rem;padding-bottom:2rem;">
</div>-->

<?php if(!$is_profanity){ ?>
<!--<div class="fullrow adsense"><div class="col-12">-->
<!-- Inflooenz-Footer-Resp -->
<!--<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-5389855754409879"
     data-ad-slot="6436192375"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div></div>--><?php } ?><?php if( isset($_GET['experiment'] ) ) { ?><style>div.adsense{background:#F5D76E;padding-bottom:1.2rem !important;}</style><?php }?>
<div class="col-12" style="text-align:left;">
<small><?php echo get_footer($lang); ?><?php echo sprintf(_('Powered by APIs from Rovi, Last.fm, Spotify and YouTube | Available in <a href="//es.inflooenz.com/?artist=%s">Spanish</a> | Feel free to <span class="report">report any bugs or make suggestions</span>. Loading GIF by <a href="http://pixelbuddha.net/" title="Amazing free and premium resources for professional community" target="_blank">PixelBuddha</a>.'),$artist_encoded); ?></small>
</div>
<!--<div class="col-12">
<div class="fb-like" data-href="http://inflooenz.com" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true" style="float:right"></div>
<a href="//twitter.com/inflooenz" title="@inflooenz on Twitter" target="_blank" style="vertical-align:top;float:right;padding-right:8px;margin:2px 8px;border-right:1px solid #434343;"><img src="https://twitter.com/favicon.ico" alt=""></a>
</div>-->
<div class="col-12" style="background:#222;margin-top:1em;">
<small>This site is kindly supported by<a href="https://couchpop.com"><img src="https://couchpop.com/wp-content/uploads/2018/05/couchpp-3.png" alt="Couchpop" style="height:14px;vertical-align:middle;"></a>a <a href="https://couchpop.com">legal streaming movie database</a>.</small>
</div>

</footer>
<?php } ?>
</body>

<?php if($artist) { ?>
<script src="js/jquery.tools.min.js"></script>
<!--<script type="text/javascript" src="js/jquery.lazyload.min.js"></script>-->
<?php }; ?>

<script type="text/javascript">

<?php
if($artist)
{?>

/*window.fbAsyncInit = function() {
    FB.init({
      appId      : '232304663523405',
      xfbml      : true,
      version    : 'v2.8'
    });
    FB.AppEvents.logPageView();
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
$(window).load(function(){
	FB.Event.subscribe('edge.create', function() {
	ga('send', 'social', 'facebook', 'like');
	});
});*/

$(document).ready(function() {
	$(':input:visible:enabled:first').focus();
	//$("img.lazy").lazyload({threshold:200,effect:'fadeIn'});
	$.ajaxSetup({
	  cache: true
	});
	if( $('#profile').css('left') == '105%' ){ $('#profile').addClass('mobile'); $.getScript("js/inflooenz.functions.mobile.js"); }
	//$('#subscription .button').click(function(){ga('send','event','UX','Become Supporter');})
	$('#sponsor-a-follower').click(function(){ga('send','event','UX','Become Supporter (Sponsored Follower)');})
	$('.spotify-playlist-button').show();
	
	$.getScript("https://www.youtube.com/iframe_api");
	
	<?php
	// Influences API failed
	if($xml === false || $xml['name']['influencers'] == null  ) {
	?>
	if ( !$('#profile').hasClass('mobile') ) {
	var first = 'artist-profile.php?ref=<?php echo $artist_encoded; ?>&artist=<?php echo $artist_encoded; ?>'<?php if ( $locale != 'en_US' ) {echo "+'&locale=".$locale."'";} ?>;
	/*loadProfile(first, function() {});*/
	}
	$('#loading').hide();
	<?php
	} else { ?>
	onYouTubeIframeAPIReady = function() {	
	<?php
	if( isset($_GET['influencer']) || isset($_GET['follower']) )
	{
		if( isset($_GET['influencer']) ){ $influencer = $influencer; } else { $influencer = $follower; }
		$sanitized_name = strtolower(urlencode($influencer));
		$sanitized_name = str_replace(array("+",".",",","%27","%21","%26"), "", $sanitized_name);
	?>
	var target = encodeURI($('.influences-list li a#<?php echo urlencode($sanitized_name); ?>').text()).replace('&','%26');
	var first = 'artist-profile.php?ref=<?php echo $artist_encoded; ?>&artist='+target<?php if ( $locale != 'en_US' ) {echo "+'&locale=".$locale."'";} ?>;
	$('.influences-list li a#<?php echo urlencode($sanitized_name); ?>').parent().addClass('selected');
	loadProfile(first, function() {
				if ( $('#profile h2').text() != 'Sorry' ) {}
			});
			
	<?php } else { ?>
	if ( !$('#profile').hasClass('mobile') ) { 
	var target = encodeURI($('#influencers-list li a:first').text()).replace('&','%26');
	var first = 'artist-profile.php?ref=<?php echo $artist_encoded; ?>&artist='+target<?php if ( $locale != 'en_US' ) {echo "+'&locale=".$locale."'";} ?>;
	$('#influencers-list li a:first').parent().addClass('selected');
	loadProfile(first, function() {
				if ( $('#profile h2').text() != 'Sorry' ) {};
			});
	} else { console.log('mobile');
		$('#loading').hide();	
	}
	<?php }; ?>
	/* End loading */
	//});
	}
	
	$('.influences-list li.item a').each(function() {
		$(this).click(function (e) {
			if ( !$(this).parent().hasClass('selected') ) {
			$('.influences-list li a').parent().removeClass('selected');
			$(this).parent().addClass('selected');
			var influencer_encoded = $(this).text();
			influencer_encoded = encodeURI(influencer_encoded).replace('&','%26').replace("'","\'").replace('"',"\"");
			var url = 'artist-profile.php?ref=<?php echo $artist_encoded; ?>&artist='+influencer_encoded<?php if ( $locale != 'en_US' ) {echo "+'&locale=".$locale."'";} ?>;
			if( $(this).parent().parent().attr('id') == '#influencers-list' ){
				var cannonicalUrl = '?artist=<?php echo $artist_encoded; ?>&influencer='+influencer_encoded;
				} else {
				var cannonicalUrl = '?artist=<?php echo $artist_encoded; ?>&follower='+influencer_encoded;
				}
			loadProfile(url,function() {
				//if ( $('#profile h2').text() != 'Sorry' ) {};
				ga('send','pageview',{'page':cannonicalUrl});
			});
			}
			e.preventDefault();
			});
	});
	$('.influences-list li .spotify-playlist-button a').each(function(){
		$(this).click(function (e) {
			$('#loading').show();
			var link = $(this).attr('data-call');
			$.get( link, function( data ) { 
				window.location.href = data;
				$('#loading').hide();
				ga('send','event','UI','Spotify playlist');
				});
			e.preventDefault();
		});
	});
	<?php }; ?>
	

	//reorderLi('#influencers-list li');
	//reorderLi('#followers-list li');
	
	$.getScript("js/jquery.simplemodal.js", function() {
		<?php if($acoustic){?>
		var acousticPlaylistBanner="<div id='contact-form-box' style='position:relative;z-index:999999999999;background:#FFF;padding:1em;border-radius:5px;border:1px solid #CCC;background-shadow:0px 3px 5px #333;'><span class='simplemodal-close' style='position:absolute;top:1em;right:1em;color:#FFF;background:#000;padding:.3em;cursor:pointer;font-size:0.9em;'>[close]</span><a onclick='ga(\"send\",\"event\",\"UI\",\"Open Spotify playlist banner\")' target='_blank' href='https://open.spotify.com/playlist/585gDq9lNMGtEQ3xT07PlV?si=31ac768d7c0e42b6'><img src='/img/banners/playlist_acoustic_banner.webp' width='350' height='350' alt='Acoustic covers playlist on Spotify'></a></div>";
		$.modal(acousticPlaylistBanner, {close:true,overlayClose:true,overlayCss:{'background-color':'#000000'},opacity:90,});
		<?php } ?>
		$.getScript("https://www.google.com/recaptcha/api.js", function() {
			$('.report').click(function(){
				var _0xf006=["\x3C\x64\x69\x76\x20\x69\x64\x3D\x22\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D\x2D\x62\x6F\x78\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x70\x6F\x73\x69\x74\x69\x6F\x6E\x3A\x72\x65\x6C\x61\x74\x69\x76\x65\x3B\x7A\x2D\x69\x6E\x64\x65\x78\x3A\x39\x39\x39\x39\x39\x39\x39\x39\x39\x39\x39\x39\x39\x39\x3B\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x3A\x23\x46\x46\x46\x3B\x70\x61\x64\x64\x69\x6E\x67\x3A\x31\x65\x6D\x3B\x62\x6F\x72\x64\x65\x72\x2D\x72\x61\x64\x69\x75\x73\x3A\x35\x70\x78\x3B\x62\x6F\x72\x64\x65\x72\x3A\x31\x70\x78\x20\x73\x6F\x6C\x69\x64\x20\x23\x43\x43\x43\x3B\x62\x6F\x78\x2D\x73\x68\x61\x64\x6F\x77\x3A\x30\x70\x78\x20\x33\x70\x78\x20\x35\x70\x78\x20\x23\x33\x33\x33\x3B\x22\x3E\x3C\x73\x70\x61\x6E\x20\x63\x6C\x61\x73\x73\x3D\x22\x73\x69\x6D\x70\x6C\x65\x6D\x6F\x64\x61\x6C\x2D\x63\x6C\x6F\x73\x65\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x70\x6F\x73\x69\x74\x69\x6F\x6E\x3A\x61\x62\x73\x6F\x6C\x75\x74\x65\x3B\x74\x6F\x70\x3A\x31\x65\x6D\x3B\x72\x69\x67\x68\x74\x3A\x31\x65\x6D\x3B\x63\x6F\x6C\x6F\x72\x3A\x23\x33\x33\x33\x3B\x63\x75\x72\x73\x6F\x72\x3A\x70\x6F\x69\x6E\x74\x65\x72\x3B\x66\x6F\x6E\x74\x2D\x73\x69\x7A\x65\x3A\x30\x2E\x38\x65\x6D\x3B\x22\x3E\x5B\x63\x6C\x6F\x73\x65\x5D\x3C\x2F\x73\x70\x61\x6E\x3E\x3C\x68\x32\x3E\x57\x72\x69\x74\x65\x20\x75\x73\x21\x3C\x2F\x68\x32\x3E\x3C\x70\x3E\x44\x6F\x20\x79\x6F\x75\x20\x68\x61\x76\x65\x20\x61\x6E\x79\x20\x73\x75\x67\x67\x65\x73\x74\x69\x6F\x6E\x73\x3F\x20\x57\x65\x20\x72\x65\x61\x6C\x6C\x79\x20\x77\x6F\x75\x6C\x64\x20\x6C\x69\x6B\x65\x20\x74\x6F\x20\x68\x65\x61\x72\x20\x66\x72\x6F\x6D\x20\x79\x6F\x75\x21\x3C\x66\x6F\x72\x6D\x20\x69\x64\x3D\x22\x63\x6F\x6E\x74\x61\x63\x74\x2D\x66\x6F\x72\x6D\x22\x20\x61\x63\x74\x69\x6F\x6E\x3D\x22\x63\x6F\x6E\x74\x61\x63\x74\x2E\x70\x68\x70\x3F\x61\x72\x74\x69\x73\x74\x3D\x3C\x3F\x70\x68\x70\x20\x65\x63\x68\x6F\x20\x24\x61\x72\x74\x69\x73\x74\x5F\x65\x6E\x63\x6F\x64\x65\x64\x3B\x20\x3F\x3E\x22\x20\x6D\x65\x74\x68\x6F\x64\x3D\x22\x70\x6F\x73\x74\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x6D\x61\x72\x67\x69\x6E\x2D\x74\x6F\x70\x3A\x31\x65\x6D\x3B\x22\x3E\x3C\x74\x65\x78\x74\x61\x72\x65\x61\x20\x6E\x61\x6D\x65\x3D\x22\x6D\x65\x73\x73\x61\x67\x65\x22\x20\x69\x64\x3D\x22\x6D\x65\x73\x73\x61\x67\x65\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x77\x69\x64\x74\x68\x3A\x39\x39\x25\x3B\x68\x65\x69\x67\x68\x74\x3A\x32\x30\x30\x70\x78\x3B\x62\x6F\x72\x64\x65\x72\x2D\x72\x61\x64\x69\x75\x73\x3A\x33\x70\x78\x3B\x62\x6F\x72\x64\x65\x72\x3A\x31\x70\x78\x20\x73\x6F\x6C\x69\x64\x20\x23\x43\x43\x43\x3B\x22\x3E\x3C\x2F\x74\x65\x78\x74\x61\x72\x65\x61\x3E\x3C\x69\x6E\x70\x75\x74\x20\x74\x79\x70\x65\x3D\x22\x73\x75\x62\x6D\x69\x74\x22\x20\x76\x61\x6C\x75\x65\x3D\x22\x53\x65\x6E\x64\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x66\x6C\x6F\x61\x74\x3A\x72\x69\x67\x68\x74\x3B\x6D\x61\x72\x67\x69\x6E\x2D\x74\x6F\x70\x3A\x31\x65\x6D\x3B\x22\x20\x2F\x3E\x3C\x64\x69\x76\x20\x73\x74\x79\x6C\x65\x3D\x22\x63\x6C\x65\x61\x72\x3A\x62\x6F\x74\x68\x22\x3E\x3C\x2F\x64\x69\x76\x3E\x3C\x2F\x66\x6F\x72\x6D\x3E\x3C\x2F\x64\x69\x76\x3E"];
				$.modal(_0xf006[0], {close:true,overlayClose:true,overlayCss:{'background-color':'#000000'},opacity:90,});
				$('#contact-form').submit( submitForm );
				function submitForm() {
				var contactForm = $('#contact-form');
				$.ajax( {
				      url: contactForm.attr( 'action' ) + "?ajax=true",
				      type: contactForm.attr( 'method' ),
				      data: contactForm.serialize(),
				      success: function(){$('#contact-form-box').empty().text('Thanks for your message!').fadeOut('slow');
				      $.modal.close();
				      },
				    } );
				return false;
				};
				}
			);
		})
	$('#suggest-influences').click(function(){
					/*$.getScript( "js/jquery.auto-complete.min.js", function() {
					var _0xf006=['<div id="contact-form-box" style="position:relative;z-index:99999999999999;background:#FFF;padding:1em;border-radius:5px;border:1px solid #CCC;box-shadow:0px 3px 5px #333;"><span class="simplemodal-close" style="position:absolute;top:1em;right:1em;color:#333;cursor:pointer;font-size:0.8em;">[close]</span><form id="contact-form" action="contact.php?artist=<?php echo $artist_encoded; ?>" method="post" style="margin-top:1em;"><h3>Suggest influencers</h3><input name="influencers" id="influencer-suggestion" style="width:99%;height:100px;border-radius:3px;border:1px solid #CCC;" /><h3>Suggest followers</h3><textarea name="followers" id="follower-suggestion" style="width:99%;height:100px;border-radius:3px;border:1px solid #CCC;"></textarea><input name="artist" value="<?php echo $artist_encoded; ?>" hidden><input type="submit" value="Send" style="float:right;margin-top:1em;" /><div style="clear:both"></div></form></div>'];
					$.modal(_0xf006[0], {close:true,overlayClose:true,overlayCss:{'background-color':'#000000'},opacity:90,});
						    //var availableTags = ['alfa','beta'];$( "#search-input" ).autocomplete({source: availableTags});
						    $('#influencer-suggestion').autoComplete();
					$('#contact-form').submit( submitForm );
					function submitForm() {
					var contactForm = $('#contact-form');
					$.ajax( {
					      url: contactForm.attr( 'action' ) + "?ajax=true",
					      type: contactForm.attr( 'method' ),
					      data: contactForm.serialize(),
					      success: function(){$('#contact-form-box').empty().text('Thanks for your message!').fadeOut('slow');
					      $.modal.close();
					      },
					    } );
					return false;
					};
			
				});*/
				
				}
			);
			
	});
	$('html, body').animate({
       // scrollTop: $("#influencers-list").parent().offset().top - $('header div.adsense').outerHeight()
	}, 500);
	
	$('.redbubble a').click(function(){ga('send', 'event', 'Ads', 'Click', 'RedBubble - '+$(this).attr('title'))});
		
} );

// This code loads the IFrame Player API code asynchronously.
// var tag = document.createElement('script');tag.src = "https://www.youtube.com/iframe_api";var firstScriptTag = document.getElementsByTagName('script')[0];firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
if(typeof adsbygoogle !== 'undefined') {
    window.addEventListener('load', function() {
        if(typeof adsbygoogle.loaded === 'undefined' && typeof ga !== 'undefined') {
	ga('set', 'dimension2', 'Blocked');
	var fm = document.createElement('script');
	fm.setAttribute('src','https://fundingchoicesmessages.google.com/i/pub-5389855754409879?ers=1');
	fm.setAttribute('nonce','IGae7qymjoUNbiBFV1rLzw');
	document.head.appendChild(fm);
	function signalGooglefcPresent() {if (!window.frames['googlefcPresent']) {if (document.body) {const iframe = document.createElement('iframe'); iframe.style = 'width: 0; height: 0; border: none; z-index: -1000; left: -1000px; top: -1000px;'; iframe.style.display = 'none'; iframe.name = 'googlefcPresent'; document.body.appendChild(iframe);} else {setTimeout(signalGooglefcPresent, 0);}}}signalGooglefcPresent();
	}
}, false);}
<?php }; ?>
</script>
<script>
<?php include($common_path.'js/konami.min.js'); ?>
var easter_egg = new Konami('//htmllotron.inflooenz.com/');
</script>
<?php if($fireAlternateAds){ /*Monetag Inflooenz.com - Interstitial*/ ?><script async="async" data-cfasync="false" src="//thubanoa.com/1?z=6946205"></script><?php }?>
</html>
<?php $end = (float) array_sum(explode(' ',microtime()));
$processTime = "Processing time: ". sprintf("%.4f", ($end-$start))." seconds";
echo "<!-- ".$processTime." -->";?>