Last active
April 10, 2018 15:01
-
-
Save iamrobert/b7753eaf9177c8d7804d5e24bde529ad to your computer and use it in GitHub Desktop.
slider module for FLEXIcontent Universal Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php // no direct access | |
| /* iamrobert.com | TAIWAN ------------------------------------------------- | |
| _ __ __ | |
| (_)__ ___ _ _______ / / ___ ____/ /_ | |
| / / _ `/ ' \/ __/ _ \/ _ \/ -_) __/ __/ | |
| /_/\_,_/_/_/_/_/ \___/_.__/\__/_/ \__/ | |
| ===================================================== DIGITAL DESIGN STUDIO | |
| # author Robert Stark | |
| # copyright Copyright © 2017 iamrobert.com All rights reserved. | |
| # Website http://www.iamrobert.com | |
| -------------------------------------------------------------------------*/ | |
| defined('_JEXEC') or die('Restricted access'); | |
| ?> | |
| <?php if (isset($list[$ord]['featured'])) : ?> | |
| <!-- BOF featured items --> | |
| <div class="onload-hide" id="bannerload"> | |
| <div class="grid-x"> | |
| <div class="cell"> | |
| <?php foreach ($list[$ord]['featured'] as $item) : ?> | |
| <?php if ($use_fields_feat && @$item->fields && $fields_feat) : ?> | |
| <?php foreach ($item->fields as $k => $field) : ?> | |
| <?php if ( $hide_label_onempty_feat && !strlen($field->display) ) continue; ?> | |
| <!--SLIDER--> | |
| <?php /*?> | |
| ############################################ | |
| + BANNER | |
| ############################################ | |
| <?php */?> | |
| <?php | |
| $bws = FlexicontentFields::getFieldDisplay($item,'topbanner'); | |
| //print_r($bws); die; | |
| $bannertitle = FlexicontentFields::getFieldDisplay($item, 'banner_image_title'); | |
| $tpath = JURI::base(true).'/templates/'.$app->getTemplate(); | |
| $bws_array1 = explode('[br]',$bws); | |
| array_pop ( $bws_array1 ); | |
| foreach($bws_array1 as $array){ | |
| $bws_final[] = explode(";",str_replace("amp;","",$array)); | |
| //print_r($array); | |
| } | |
| //print_r($bws_array1); | |
| //Does Custom Block Exist? | |
| $customhtml_test_result = false; | |
| foreach($bws_final as $customhtml_test){ | |
| if(strip_tags($customhtml_test[0]) == "Custom"){ | |
| $customhtml_test_result = true; | |
| } | |
| } | |
| if(isset($bws_final)){ | |
| //IF CUSTOM BLOCK DOESN'T EXIST THEN EXPLODE IMAGES | |
| if(!$customhtml_test_result) { | |
| foreach($bws_final as $key=>$val){ | |
| foreach($val as $val2 => $key2){ | |
| preg_match_all('/(href|src)=("[^"]*")/i', $key2, $match ); | |
| if($match[0]){ | |
| $bws_final[$key][$val2] = $match[0]; | |
| } | |
| } | |
| } | |
| // | |
| } | |
| //print_r($bws_final); | |
| // print_r(array_values($bws_final)); | |
| ?> | |
| <?php | |
| //print_r($bws_final); | |
| $video_test_result = false; | |
| foreach($bws_final as $video_test){ | |
| if(strip_tags($video_test[0]) == "Video"){ | |
| $video_test_result = true; | |
| } | |
| } | |
| ?> | |
| <?php | |
| $count = 0; | |
| if ($customhtml_test_result) { | |
| echo '<div class="banner"> | |
| <div class="no-carousel">' ; | |
| } | |
| elseif($video_test_result){ | |
| echo '<div class="banner"> | |
| <div class="owl-carousel videostyle" id="mainslider">' ; | |
| }else{ | |
| echo '<div class="banner"> | |
| <div class="owl-carousel without-video" id="mainslider">' ; | |
| } | |
| foreach($bws_final as $row){ | |
| //print_r($row); | |
| ?> | |
| <?php /*?> | |
| ############################################ | |
| CUSTOM BLOCK | |
| ############################################ | |
| <?php */?> | |
| <?php if(strip_tags($row[0]) == 'Custom'): ?> | |
| <?php if($row[10] != NULL): ?> | |
| <?php echo ($row[10]);?> | |
| <div class="hidemain"></div> | |
| <?php endif;?> | |
| <?php endif;?> | |
| <?php /*?> | |
| ############################################ | |
| IMAGE BLOCK | |
| ############################################ | |
| <?php */?> | |
| <?php if (!$customhtml_test_result):?> | |
| <?php /*?> | |
| * ======================================================================= | |
| + HALF-WIDTH IMAGE | |
| * ======================================================================= | |
| <?php */?> | |
| <?php if(strip_tags($row[0]) == 'Half Width Image'): ?> | |
| <?php if($row[1] != NULL): ?> | |
| <div class="itemx halfw-banner"> | |
| <div class="grid-x align-stretch"> | |
| <div class="cell small-12 medium-auto small-order-2 medium-order-1 header-box align-vc"> | |
| <?php if($row[2] != NULL): ?> | |
| <?php if(isset($row [4][0])){ echo '<a '.strip_tags($row [4][0]).' class="slide-left-ani">'; } ?> | |
| <?php if($row[2]) echo '<h3 class="h2">'.strip_tags($row[2]).'</h3>'; ?> | |
| <?php if($row[3]) echo '<p>'.$row[3].'</p>'; ?> | |
| <?php if(isset($row [4][0])){ echo '<i class="icon-arrow-right"></i></a>'; } ?> | |
| <?php endif;?> | |
| </div> | |
| <div class="cell small-12 medium-auto small-order-1 medium-order-2"> | |
| <?php | |
| /* creating small, medium and large */ | |
| if (preg_match('/"([^"]+)"/', $row[1][0], $h)) { | |
| $row[1][0] = 'data-lazy="['.$h[1].', small], ['.str_replace("/s_","/m_",$h[1]).', medium], ['.str_replace("/s_","/l_",$h[1]).', large]"'; | |
| ; | |
| } | |
| ?> | |
| <?php if($row[1][0]) echo '<img data-src="'.$tpath.'/images/transparent.gif" src="'.$tpath.'/images/transparent.gif" '.$row[1][0].' alt="'.strip_tags($row[0]).'">'; ?> | |
| </div> | |
| </div> | |
| </div> | |
| <?php endif;?> <?php endif;?> | |
| <!-- | |
| /* | |
| * ======================================================================= | |
| + FULL WIDTH | |
| * ======================================================================= | |
| */ | |
| --> | |
| <?php if(strip_tags($row[0]) == 'Full Width Image'): ?> | |
| <div class="itemx fullw-banner"> | |
| <?php if($row[5] != NULL): ?> | |
| <?php if(isset($row[8][0])){ | |
| echo '<a '.strip_tags($row[8][0]).'>'; } ?> | |
| <div class="relative"> | |
| <?php | |
| /* creating small, medium and large */ | |
| if (preg_match('/"([^"]+)"/', $row[5][0], $m)) { | |
| $row[5][0] = 'data-lazy="['.$m[1].', small], ['.str_replace("/s_","/m_",$m[1]).', medium], ['.str_replace("/s_","/l_",$m[1]).', large]"'; | |
| ; | |
| } | |
| ?> | |
| <?php if($row[5][0]) echo '<img data-src="'.$tpath.'/images/transparent.gif" src="'.$tpath.'/images/transparent.gif" '.$row[5][0].' alt="'.strip_tags($row[0]).'" class="w100">'; ?> | |
| <?php if($row[6] != NULL): ?> | |
| <div class="abs-box"><div class="wordblock"> | |
| <?php if($row[6]) echo '<h3>'.strip_tags($row[6]); ?> | |
| <?php if(isset($row[8][0])){ echo '<i class="icon-arrow-right"></i>'; } ?> | |
| <?php if($row[6]) echo '</h3>'; ?> | |
| <?php if($row[7]) echo '<p>'.$row[7].'</p>'; ?> | |
| </div></div> | |
| <?php endif;?> | |
| </div> | |
| <?php if(isset($row[8][0])){ | |
| echo '</a>'; } ?> | |
| <?php endif;?> | |
| </div> | |
| <?php endif;?> | |
| <!-- | |
| /* | |
| * ======================================================================= | |
| + VIDEO | |
| * ======================================================================= | |
| */ | |
| --> | |
| <?php if(strip_tags($row[0]) == 'Video'): ?> | |
| <?php if($row[9] != NULL) :?> | |
| <?php | |
| $datavideo = strip_tags($row[9][0]); | |
| $datavideo = str_replace("href=","", $datavideo); | |
| $datavideo = preg_replace('/\s+/', '', $datavideo); | |
| $datavideo = preg_replace('/\"/', '', $datavideo); | |
| //$datavideo = preg_replace('\"', '', $datavideo); | |
| if (preg_match('/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/', $datavideo, $match)) { | |
| $datavideo = $match[1]; | |
| // echo '<div class="itemx">';class="" | |
| echo '<div class="itemx item-video video-slide"><div class="grid-container video"> | |
| <div class="cell"> | |
| <div class="shadowx gv"><div class="maxh"><div data-type="youtube" data-video-id="'.$datavideo.'" class="js-player"></div></div></div> </div> | |
| </div> | |
| </div>'; | |
| //echo '<div data-type="youtube" data-video-id="dZTZyX5D7Qg" class="js-player"></div>'; | |
| // echo '</div>'; | |
| } | |
| ?> | |
| <?php endif;?> | |
| <?php endif;?> | |
| <?php endif;?> | |
| <!--END IF custom block doesn't exist--> | |
| <?php | |
| $count++; | |
| } | |
| echo '</div></div>'; | |
| } | |
| ?> | |
| <?php endforeach; ?> | |
| <?php endif; ?> | |
| <div class="invisible hide"><?php echo $item->title; ?></div> | |
| <!-- EOF current item --> | |
| <?php endforeach; ?> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- EOF featured items --> | |
| <?php endif; ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment