wp/wp-content/plugins/codecanyon-3027163-content-timeline-responsive-wordpress-plugin/pages/backup/content_timeline_frontend.php
changeset 14 00ac8f60d73f
parent 13 d255fe9cd479
child 15 3d4e9c994f10
equal deleted inserted replaced
13:d255fe9cd479 14:00ac8f60d73f
     1 <?php 
       
     2 
       
     3 $title = '';
       
     4 $settings = array( 
       
     5 	'scroll-speed' => '500',
       
     6 	'easing' => 'easeOutSine',
       
     7 	'hide-years' => false,
       
     8 	'cat-type' => 'months',
       
     9 	'number-of-posts' => '30',
       
    10 	
       
    11 	// style
       
    12 	'line-width' => '920',
       
    13 	'item-width' => '240',
       
    14 	'item-open-width' => '490',
       
    15 	'item-margin' => '20',
       
    16 	'item-height' => '360',
       
    17 	'read-more' => 'button',
       
    18 	'close-text' => 'Close',
       
    19 	'hide-line' => false,
       
    20 	'line-style' => 'light',
       
    21 	'hide-nav' => false,
       
    22 	'nav-style' => 'light',
       
    23 	'shdow' => 'show',
       
    24 	'item-back-color' => '#ffffff',
       
    25 	'item-background' => '',
       
    26 	'item-open-back-color' => '#ffffff',
       
    27 	'item-open-background' => '',
       
    28 	
       
    29 	'button-hover-color' => '#1986ac',
       
    30 	'item-image-height' => '150',
       
    31 	'item-image-border-width' => '5',
       
    32 	'item-image-border-color' => '#1986ac',
       
    33 	'item-open-image-height' => '150',
       
    34 	'item-open-content-padding' => '10',
       
    35 	'item-open-image-border-width' => '5',
       
    36 	'item-open-image-border-color' => '#1986ac'
       
    37 	
       
    38 );
       
    39 global $wpdb;
       
    40 if($id) {
       
    41 	global $wpdb;
       
    42 	$timeline = $wpdb->get_results('SELECT * FROM ' . $wpdb->base_prefix . 'ctimelines WHERE id='.$id);
       
    43 	$timeline = $timeline[0];
       
    44 }
       
    45 $title = $timeline->name;
       
    46 $cats = "[";
       
    47 $catArray = array();
       
    48 $ccNumbers = array();
       
    49 $catNumber = 0;
       
    50 
       
    51 foreach(explode('||',$timeline->settings) as $val) {
       
    52 	$expl = explode('::',$val);
       
    53 	if(substr($expl[0], 0, 8) == 'cat-name') {
       
    54 		if($cats != "[") $cats .= ",";
       
    55 		$cc = get_cat_name(intval(substr($expl[0], 9)));
       
    56 		$cats .= "'".$cc."'";
       
    57 		array_push ($catArray,$cc);
       
    58 		array_push ($ccNumbers, 0);
       
    59 		$catNumber++;
       
    60 	}
       
    61 	else {
       
    62 		$settings[$expl[0]] = $expl[1];
       
    63 	}
       
    64 	
       
    65 }
       
    66 $cats .= "]";
       
    67 
       
    68 $frontHtml = '
       
    69 <style type="text/css">
       
    70 #tl'. $id. ' .timeline_line,
       
    71 #content #tl'. $id. ' .timeline_line{
       
    72  	width: '.$settings['line-width'].'px;
       
    73 } 
       
    74 
       
    75 #tl'.$id.' .t_line_view,
       
    76 #content #tl'.$id.' .t_line_view {
       
    77  	width: '.$settings['line-width'].'px;
       
    78 } 
       
    79  
       
    80 #tl'.$id.' .t_line_m,
       
    81 #content #tl'.$id.' .t_line_m {
       
    82 	width: '. (((int)$settings['line-width'])/2-2).'px;
       
    83 }
       
    84  
       
    85 #tl'. $id.' .t_line_m.right,
       
    86 #content #tl'. $id.' .t_line_m.right {
       
    87 	left: '. (((int)$settings['line-width'])/2-1).'px;
       
    88 	width: '. (((int)$settings['line-width'])/2-1).'px;
       
    89 }
       
    90  
       
    91 #tl'. $id.' .item,
       
    92 #content #tl'. $id.' .item {
       
    93  	width: '. $settings['item-width'].'px;
       
    94 	height: '. $settings['item-height'].'px;
       
    95 	background:'. $settings['item-back-color'].' url('. $settings['item-background'].') repeat;';
       
    96 	
       
    97 if($settings['shadow'] == 'show') {
       
    98 	$frontHtml.= '
       
    99 	-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.5);
       
   100 	-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.5);
       
   101 	box-shadow: 0px 0px 6px rgba(0,0,0,0.5);
       
   102 	
       
   103 	zoom: 1;
       
   104 	filter: progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=0, Direction=0),
       
   105 		progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=5, Direction=90),
       
   106 		progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=5, Direction=180),
       
   107 		progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=0, Direction=270);
       
   108 	
       
   109 	';
       
   110 	}
       
   111 else {
       
   112 	$frontHtml.= '
       
   113 	-moz-box-shadow: 0 0 0 #000000;
       
   114 	-webkit-box-shadow: 0 0 0 #000000;
       
   115 	box-shadow: 0 0 0 #000000;';
       
   116 }
       
   117 $frontHtml.=' 
       
   118 }';
       
   119 if($settings['shadow'] == 'on-hover') {
       
   120 	$frontHtml.= '
       
   121 #tl'. $id . ' .item:hover,
       
   122 #content #tl'. $id . ' .item:hover {
       
   123 	-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.5);
       
   124 	-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.5);
       
   125 	box-shadow: 0px 0px 6px rgba(0,0,0,0.5);
       
   126 	
       
   127 	zoom: 1;
       
   128 	filter: progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=0, Direction=0),
       
   129 		progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=5, Direction=90),
       
   130 		progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=5, Direction=180),
       
   131 		progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=0, Direction=270);
       
   132 	
       
   133 	
       
   134 }';
       
   135 }
       
   136 
       
   137 $frontHtml.= '
       
   138 #tl'. $id .' .item_open,
       
   139 #content #tl'. $id .' .item_open{
       
   140  	width: '. $settings['item-open-width'].'px;
       
   141 	height: '. $settings['item-height'].'px;
       
   142 	background:'. $settings['item-open-back-color'].' url('. $settings['item-open-background'].') repeat; ';
       
   143  	
       
   144 	
       
   145 if($settings['shadow'] == 'show' || $settings['shadow'] == 'on-hover') {
       
   146 	$frontHtml.= '
       
   147 	-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.5);
       
   148 	-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.5);
       
   149 	box-shadow: 0px 0px 6px rgba(0,0,0,0.5);
       
   150 	
       
   151 	zoom: 1;
       
   152 	filter: progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=0, Direction=0),
       
   153 		progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=5, Direction=90),
       
   154 		progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=5, Direction=180),
       
   155 		progid:DXImageTransform.Microsoft.Shadow(Color=#888888, Strength=0, Direction=270);
       
   156 	
       
   157 	';
       
   158 	}
       
   159 	else {
       
   160 	$frontHtml.= '
       
   161 	-moz-box-shadow: 0 0 0 #000000;
       
   162 	-webkit-box-shadow: 0 0 0 #000000;
       
   163 	box-shadow: 0 0 0 #000000;';
       
   164 	} 
       
   165 $frontHtml.= '
       
   166  }'. '
       
   167  
       
   168 #tl'. $id.' .item .con_borderImage,
       
   169 #content #tl'. $id.' .item .con_borderImage {
       
   170  	border:0px;
       
   171  	border-bottom: '. $settings['item-image-border-width'].'px solid '. $settings['item-image-border-color'].' ; 
       
   172 }
       
   173  
       
   174 #tl'. $id.' .item_open .con_borderImage,
       
   175 #content #tl'. $id.' .item_open .con_borderImage {
       
   176  	border-bottom: '. $settings['item-open-image-border-width'].'px solid '. $settings['item-open-image-border-color'].' ; 
       
   177 }
       
   178 
       
   179 #tl'. $id.' .item_open_cwrapper,
       
   180 #content #tl'. $id.' .item_open .con_borderImage {
       
   181  	width: '. $settings['item-open-width'].'px;
       
   182 }
       
   183 
       
   184 #tl'. $id.' .item_open .t_close:hover,
       
   185 #content #tl'. $id.' .item_open .t_close:hover{
       
   186 	background:'. $settings['button-hover-color'].';
       
   187 }
       
   188 
       
   189 #tl'. $id.' .item .read_more:hover,
       
   190 #content #tl'. $id.' .item .read_more:hover{
       
   191 	background:'. $settings['button-hover-color'].';
       
   192 }
       
   193 
       
   194 
       
   195 #tl'. $id.' .item .read_more,
       
   196 #content #tl'. $id.' .item .read_more,
       
   197 #tl'. $id.' .item_open .t_close,
       
   198 #content #tl'. $id.' .item_open .t_close {
       
   199 
       
   200 	/* transparent background */
       
   201 	filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=\'#44000000\', endColorstr=\'#44000000\'); 
       
   202 }
       
   203 
       
   204 #tl'. $id.' .t_node_desc,
       
   205 #content #tl'. $id.' .t_node_desc,
       
   206  {
       
   207 
       
   208 	/* IE transparent background */
       
   209 	filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=\'#cc1a86ac\', endColorstr=\'#cc1a86ac\'); 
       
   210 }
       
   211 
       
   212 
       
   213 
       
   214 #tl'. $id.' .timeline_open_content,
       
   215 #content #tl'. $id.' .timeline_open_content {
       
   216 	padding:'. $settings['item-open-content-padding'].'px;
       
   217 }
       
   218 
       
   219 
       
   220 
       
   221 </style>
       
   222 ';
       
   223 
       
   224 if($settings['read-more'] == 'whole-item') {
       
   225 	$read_more = "'.item'";
       
   226 	$swipeOn = 'false';
       
   227 }
       
   228 else if ($settings['read-more'] == 'button') {
       
   229 	$read_more = "'.read_more'";
       
   230 	$swipeOn = 'true';
       
   231 }
       
   232 else {
       
   233 	$read_more = "'none'";
       
   234 	$swipeOn = 'true';
       
   235 }
       
   236 
       
   237 if($settings['cat-type'] == 'categories') {
       
   238 	$cats = ',
       
   239 		categories : '.$cats . ', 
       
   240 		numberOfSegments : [';
       
   241 	$cats .= $settings['number-of-posts'];
       
   242 	for ($i = 1; $i < $catNumber; $i++) {
       
   243 		$cats .= ', '. $settings['number-of-posts'];
       
   244 	}
       
   245 	$cats .= ']';
       
   246 }
       
   247 else {
       
   248 	$cats = '';
       
   249 }
       
   250 
       
   251 $frontHtml .='
       
   252 
       
   253 <!-- BEGIN TIMELINE -->
       
   254 <div id="tl'. $id.'" class="timeline'. ($settings['line-style'] == 'dark' ? ' darkLine' : ''). ($settings['nav-style'] == 'dark' ? ' darkNav' : '').'">';
       
   255 
       
   256 if ($timeline->items != '') {
       
   257 	$explode = explode('||',$timeline->items);
       
   258 	$open_content_height = intval($settings['item-height']) - intval($settings['item-open-image-height']) - 2*intval($settings['item-open-content-padding']) -intval($settings['item-open-image-border-width']) - 6;
       
   259 	
       
   260 	$itemsArray = array();
       
   261 	foreach ($explode as $it) {
       
   262 		$ex2 = explode('::', $it);
       
   263 		$key = substr($ex2[0],0,strpos($ex2[0],'-'));
       
   264 		$subkey = substr($ex2[0],strpos($ex2[0],'-')+1);
       
   265 		$itemsArray[$key][$subkey] = $ex2[1];
       
   266 	}
       
   267 	foreach ($itemsArray as $key => $arr) {
       
   268 		$num = substr($key,4);
       
   269 		
       
   270 		if($settings['cat-type'] == 'categories') {
       
   271 			$index = array_search($arr['categoryid'],$catArray);
       
   272 			$ccNumbers[$index]++;
       
   273 			$arr['dataid'] = ($ccNumbers[$index] < 10 ? '0'.$ccNumbers[$index] : $ccNumbers[$index]).'/'.$arr['categoryid'];
       
   274 		}
       
   275 		if($arr['start-item']) {
       
   276 			$start_item = $arr['dataid'];
       
   277 			
       
   278 		}
       
   279 	
       
   280 
       
   281 
       
   282 $frontHtml .='
       
   283 
       
   284 		<div class="item" data-id="'. $arr['dataid'].'" data-description="'. substr($arr['item-title'],0,30).'">
       
   285 			<img class="con_borderImage" src="'. $this->url . 'timthumb/timthumb.php?src=' . $arr['item-image'] . '&w='.((int)$settings['item-width']-10).'&h='.((int)$settings['item-image-height']-10).'" alt=""/>
       
   286 			<h2>'.$arr['item-title'].'</h2>
       
   287 			<span>'.$arr['item-content'].'</span>
       
   288 			'.(($settings['read-more'] == 'button') ? '<div class="read_more" data-id="'.$arr['dataid'].'">Read more</div>' : '').'
       
   289 		</div>
       
   290 		<div class="item_open" data-id="'.$arr['dataid'].'">';
       
   291 		
       
   292 		if ($arr['item-open-image'] != '') {
       
   293 			$frontHtml .= '
       
   294 			<img class="con_borderImage" src="'. $this->url . 'timthumb/timthumb.php?src=' . $arr['item-open-image'] . '&w='.((int)$settings['item-open-width']-10).'&h='.((int)$settings['item-open-image-height']-10).'" alt=""/>
       
   295 			<div class="timeline_open_content'.(!$arr['desable-scroll'] ? ' scrollable-content' : '').'" style="height: '. $open_content_height.'px">';
       
   296 			
       
   297 		} 
       
   298 		else { 
       
   299 			$frontHtml .= '
       
   300 			<div class="timeline_open_content'.(!$arr['desable-scroll'] ? ' scrollable-content' : '').'" style="height: '. (intval($settings['item-height']) - 2*intval($settings['item-open-content-padding'])).'px">';
       
   301 		}
       
   302 			
       
   303 		if ($arr['item-open-title'] != '') { 
       
   304 			$frontHtml .= '
       
   305 				<h2>'.$arr['item-open-title'].'</h2>';
       
   306 		
       
   307 		} 
       
   308 			$frontHtml .= '
       
   309 				' . $arr['item-open-content'].'
       
   310 			</div>
       
   311 		</div>';
       
   312 		
       
   313 
       
   314 	}
       
   315 }
       
   316 $frontHtml .= '
       
   317 </div> <!-- END TIMELINE -->
       
   318 
       
   319 
       
   320 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js?ver=3.4.2"></script>
       
   321 <script type="text/javascript" src="' . $this->url . 'js/frontend/jquery.easing.1.3.js?ver=3.4.2"></script>
       
   322 <script type="text/javascript" src="' . $this->url . 'js/frontend/jquery.timeline.js?ver=3.4.2"></script>
       
   323 <script type="text/javascript" src="' . $this->url . 'js/frontend/jquery.mousewheel.min.js?ver=3.4.2"></script>
       
   324 <script type="text/javascript" src="' . $this->url . 'js/frontend/jquery.mCustomScrollbar.min.js?ver=3.4.2"></script>
       
   325 <script type="text/javascript">
       
   326 (function($){
       
   327 $(window).load(function() {
       
   328 	$(".scrollable-content").mCustomScrollbar();
       
   329 	
       
   330 	$("#tl'.$id.'").timeline({
       
   331 		itemMargin : '. $settings['item-margin'].',
       
   332 		scrollSpeed : '.$settings['scroll-speed'].',
       
   333 		easing : "'.$settings['easing'].'",
       
   334 		openTriggerClass : '.$read_more.',
       
   335 		swipeOn : '.$swipeOn.',
       
   336 		startItem : "'. $start_item . '",
       
   337 		yearsOn : '.(($settings['hide-years'] || $settings['cat-type'] == 'categories') ? 'false' :  'true').',
       
   338 		hideTimeline : '.($settings['hide-line'] ? 'true' : 'false').',
       
   339 		hideControles : '.($settings['hide-nav'] ? 'true' : 'false').
       
   340 		$cats.'
       
   341 	});
       
   342 	
       
   343 });	
       
   344 })(jQuery);
       
   345 </script>';
       
   346 ?>