File: /storage/v4513/ivenusin/public_html/wp-content/themes/ivenus/page-exchange.php
<?php
/* Template Name: Cashify Exchange */
get_header();
$cashify_mode = get_option('cashify_mode');
global $post;
$page_title = $post->post_title;
$current_user;
?>
<main class="main">
<nav aria-label="breadcrumb" class="breadcrumb-nav">
<div class="container d-flex align-items-center">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<?php echo SITE_URL; ?>">Home</a></li>
<li class="breadcrumb-item active" aria-current="page"><?php echo $page_title; ?></li>
</ol>
</div><!-- End .container -->
</nav>
<section>
<div class="container">
<div class="clearfix"></div>
<div class="cms-section col-sm-12">
<?php
if($cashify_mode === "1"){
if( !is_user_logged_in() ){ ?>
<div class="alert alert-danger text-center">
Please <a href="<?php echo home_url('/'); ?>my-account/?exchange" class="alert-link">login/register</a> to access this feature.
</div>
<?php } else {
$current_user = wp_get_current_user(); ?>
<button id="buybackLeftButton" style="display:none;" type="button" class="btn btn-primary">Show Cashify Exchange</button>
<?php
}
} else { ?>
<div class="alert alert-info text-center">
This feature has been disabled. To know more <a href="<?php echo home_url('/'); ?>contact-us/" class="alert-link">contact us</a>.
</div>
<?php } ?>
</div>
</div>
</section>
</main>
<?php get_footer(); ?>
<?php if($cashify_mode === "1" && is_user_logged_in()){ ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
document._cashify = document._cashify || {
account : "434166a2ab8a18d4c557fec968ac8e32",
env : "prod",
debug : false,
draft : false,
legoCssLink : null,
onLoad : function(){
document.getElementById("buybackLeftButton").style.display = "block";
document.getElementById("buybackLeftButton").addEventListener("click", function (e) {
e.preventDefault();
CSH.showPopupFromLeft();
return false;
});
CSH.showPopupFromLeft();
},
onQuote : function(data){
var data = {
user_id: <?php echo $current_user->ID; ?>,
pid: data.pid,
pn: data.pn,
amount: data.amount,
uid: data.uid
};
$.post( "<?php echo SITE_URL; ?>/wp-admin/admin-ajax.php?action=cashify_exchange", data, function( res ) {
console.log( res );
if( res.status == 1 ){
}
}, "json");
},
onPaymentModeSelection : function(data){
},
onWidgetClose : function(){
},
onError : function(data){
}
};
(function(d, s, id){
var js, cshjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://s3n.cashify.in/lego/sdk/1.0.4/sdk.min.js";
cshjs.parentNode.insertBefore(js, cshjs);
console.log('cashify begins');
console.log('<?php echo $current_user->ID; ?>');
console.log('<?php echo $current_user->user_firstname; ?>');
}(document, 'script', 'csh-lego-jssdk'));
});
</script>
<?php } else if($cashify_mode === "1" && !is_user_logged_in()){ ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$(".dropdown-item").each(function(){
if($(this).text() == 'Sign In' || $(this).text() == 'Sign Up') {
var href = $(this).attr('href') + '?exchange';
$(this).attr('href', href);
}
});
});
</script>
<?php } ?>