<?php
/**
 * @Package: WordPress Plugin
 * @Subpackage: Ultra Portfolio
 * @Since: Ultra Portfolio 1.0
 * @Current Version: Ultra Portfolio 3.1
 * @WordPress Version: 3.5 or above
 * This file is part of Ultra Portofolio WordPress Plugin.
 */
wp_register_style('effect-g2-common-css', plugins_url('/../templates/effect-g2-common.min.css', __FILE__));
wp_enqueue_style('effect-g2-common-css');
wp_register_script('effect-g2-modernizr', plugins_url('/../templates/effect-g2-modernizr.custom.js', __FILE__));
wp_enqueue_script('effect-g2-modernizr');
wp_register_script('effect-g2-toucheffects', plugins_url('/../templates/effect-g2-toucheffects.js', __FILE__));
wp_enqueue_script('effect-g2-toucheffects');

if (isset($requesttype) && $requesttype == "ajax") {
    echo '<link rel="stylesheet" id="effect-g2-common-css-css" href="' . plugins_url('/../templates/effect-g2-common.min.css', __FILE__) . '" type="text/css" media="all">';
    echo '<script type="text/javascript" src="' . plugins_url('/../templates/effect-g2-modernizr.custom.js', __FILE__) . '"></script>';
    echo '<script type="text/javascript" src="' . plugins_url('/../templates/effect-g2-toucheffects.js', __FILE__) . '"></script>';
}

if (!isset($classstr)) {
    $classstr = "";
}
$classstr .= " " . $subeffcss . " ";

if ($effcss == "effect11") {
    // - , v1, v2, v3
    $classstr .= " uport-cs-style-1 ";
}
if ($effcss == "effect12") {
    // - , v1
    $classstr .= " uport-cs-style-2 ";
}
if ($effcss == "effect13") {
    // - , v1
    $classstr .= " uport-cs-style-3 ";
}
if ($effcss == "effect14") {
    // - , v1
    $classstr .= " uport-cs-style-4 ";
}
if ($effcss == "effect15") {
    // no variation
    $classstr .= " uport-cs-style-5 ";
}
if ($effcss == "effect16") {
    // no variation
    $classstr .= " uport-cs-style-6 ";
}
if ($effcss == "effect17") {
    // no variation
    $classstr .= " uport-cs-style-7";
}
?>

<?php
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'responsive');
?>



<style type='text/css'>

</style>

<?php
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'item');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'border');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'shadow');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'maskbg');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'outbg');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'title');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'slug');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'desc');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'but');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'buthover');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'catul');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'catli');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'catlihover');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'price');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2', 'above');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2','wrapper');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2','wrappercatul');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2','area');
echo uport_common_css($pid, $val2arr, $val3arr, '1', 'g2','portbg');
?>


<style type="text/css">
    .uport-view-<?php echo $pid; ?> {text-align: center;}

    .uport-grid-<?php echo $pid; ?> figure img {
        width:100%;min-width:100%;max-width:100%;height:auto;
    }
    .uport-cats-<?php echo $pid; ?> a.filter{float:none!important;}

    <?php
    if ($effcss == "effect17") {
        $z = sizeof($allitem);
        $x = 1;
        //foreach($allitem as $y){ echo ".uport-cs-style-7 li:nth-child(".$x.") { z-index: ".$z."; }"; $x++; $z--;}
    }
    ?>

    .uport-cs-style-7 .uport-view-<?php echo $pid; ?> figure:hover figcaption{
        -webkit-box-shadow: 0 0 0 <?php echo trim($val3arr['borderwidth']); ?>px <?php echo trim($val3arr['bordercolor']); ?>;
        -moz-box-shadow: 0 0 0 <?php echo trim($val3arr['borderwidth']); ?>px <?php echo trim($val3arr['bordercolor']); ?>;
        -o-box-shadow: 0 0 0 <?php echo trim($val3arr['borderwidth']); ?>px <?php echo trim($val3arr['bordercolor']); ?>;
        -ms-box-shadow: 0 0 0 <?php echo trim($val3arr['borderwidth']); ?>px <?php echo trim($val3arr['bordercolor']); ?>;
        box-shadow: 0 0 0 <?php echo trim($val3arr['borderwidth']); ?>px <?php echo trim($val3arr['bordercolor']); ?>;
    }
    .uport-cs-style-7 .uport-view-<?php echo $pid; ?>{border:0px!important;} 

    .uport-grid-<?php echo $pid; ?> .mix{
        display: none;
        opacity: 0;
        vertical-align: top;
    }


</style>

<?php include("uport-g-script.php"); ?>

<div class="uport-wrapout uport-wrapout-<?php echo $pid; ?> uport-wrapout-mainid-<?php echo $id; ?>">
    <div class="uport-wrapper uport-wrapper-<?php echo $pid; ?>">

    <?php echo uport_filter_category($pid,$catfilterstr,$val2arr); ?>

    <!-- GRID -->
    <ul class="main uport-grid uport-grid-<?php echo $pid; ?>  <?php echo $classstr; ?>  <?php
        if ($loadscript == 'iso') {
            echo 'iso_' . $isoeffect;
        }
        ?> ">

        <?php
        $disp = "";
        if (sizeof($allitem) > 0 && is_array($allitem)) {

            $itemcount = 0;
            foreach ($allitem as $detarr) {

                $newimgurl = uport_imageurl($detarr, $val2arr, $val3arr);

                if ($effcss == "effect11" || $effcss == "effect12" || $effcss == "effect13" || $effcss == "effect14" || $effcss == "effect15" || $effcss == "effect16" || $effcss == "effect17") {
                    $cat = "1";
                    $disp .= '<li class="' . $scriptclass . ' ' . $detarr['catclass'] . ' uport-view-' . $pid . ' " ><div class="item-wrapper">';
                    $disp .= uport_display_elements('above', $pid, $showthis, $showthissub, $detarr, $effcss, $gtype, $val2arr, $val3arr,$sctype);

                    $disp .= '<figure class="'.$outmaskclass.'">';
                    if ($effcss == "effect14") {
                        $disp .= '<div>';
                    }
                    if (in_array('image', $showthis)) {
                        $disp .= '<img src="' . $newimgurl . '" >';
                    }
                    if ($effcss == "effect14") {
                        $disp .= '</div>';
                    }
                    $disp .= '<figcaption>';

                    $disp .= uport_display_elements('over', $pid, $showthis, $showthissub, $detarr, $effcss, $gtype, $val2arr, $val3arr,$sctype);

                    $disp .= '</figcaption>
							</figure>';

                    $disp .= uport_display_elements('out', $pid, $showthis, $showthissub, $detarr, $effcss, $gtype, $val2arr, $val3arr,$sctype);

                    $disp .= '</div></li>';
                    include("uport-lightboxele.php");
                }

                $itemcount++;
                if(uport_max_items_limit($val1arr,$itemcount) == "break"){
                    break;
                }


            }
        }
        echo $disp;
        ?>
    </ul>
</div>
</div>