<?php
/**
 * Magiccart 
 * @category    Magiccart 
 * @copyright   Copyright (c) 2014 Magiccart (http://www.magiccart.net/) 
 * @license     http://www.magiccart.net/license-agreement.html
 * @Author: Magiccart<team.magiccart@gmail.com>
 * @@Create Date: 2014-07-18 20:49:45
 * @@Modify Date: 2018-03-15 00:19:47
 * @@Function:
 */
?>
<?php
if(!$this->_sysCfg->general['enabled']) return;
$socialnetwork = $this->getData('socialnetwork');
$socialCfg  = $this->_sysCfg->{$socialnetwork};
$socials    = array('instagram', 'pinterest', 'flickr', 'picasa');
$selector   = 'socical-' . uniqid();
$socialfeed = $socialnetwork . '-feed';
$username   = isset($socialCfg["username"]) ? $socialCfg["username"] : '';
if(!$username) return;
$accessToken   = isset($socialCfg["accessToken"]) ? $socialCfg['accessToken'] : '';
if($accessToken) $accessToken = "accessToken: '$accessToken'";
$limit      = isset($socialCfg["limit"])    ? $socialCfg["limit"] : 10;
?>
<article class="social-feed clearfix <?php /* @escapeNotVerified */ echo $selector ?> <?php /* @escapeNotVerified */ echo $socialfeed ?>">
    <section class="section-title">
        <h4><?php /* @escapeNotVerified */ echo $socialnetwork ?></h4>
    </section>
</article>

<script type="text/javascript">
    require([
        'jquery',
        'magiccart/socialstream',
        ], function($, socialstream){
            $('.<?php echo $selector?>').socialstream({
                socialnetwork: '<?php echo $socialnetwork?>',
                limit: <?php echo $limit ?>,
                username: '<?php echo $username ?>',
                <?php echo $accessToken ?>
            }) 
    });
</script>
