HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/test.creativefellows.nl/tekenmappen/classes/EntryController.php
<?php
	
	class EntryController extends BaseController{

		function __construct($uid_entry, $fields, $entry_data, $form,$section_arr)
		{	
			
			//d($uid_entry);
			$this->uid 			= $entry_data["unique_id"];
			$this->position 	= $entry_data["position"];
			$this->status		= $entry_data["status"];
			$this->last_edit	= $entry_data["last_edit"];
			$this->template 	= $uid_entry["template_id"];
						
			$this->date_created	= $uid_entry["created"];
			$this->form_id		= isset($entry_data["form_id"]) ? $entry_data["form_id"] : 0;
			$this->meta_title	= $entry_data["meta_title"];	
			$this->meta_desc	= $entry_data["meta_desc"];
			$this->redirect		= $entry_data["page_redirect"];
			$this->first_field	= $fields[0]["field_naam"];			
			
			$this->page_canvas		= $entry_data["stramien_id"] == 0 ? $section_arr["naam"] : $uid_entry["view"];
			$this->section_name		= $section_arr["section_name"];			
			$this->pagination_view	= $section_arr["section_view"] ? $section_arr["section_view"] : null;
			
			
			$this->entry_link	= $this->vl($this->section_name) ."/". $uid_entry["url"];			
			$this->form			= $form;
			

			foreach($fields as $i=> $f)
			{	
				$field_user 		= preg_replace("/[^0-9a-zA-Z]/","_",strtolower($f["field_naam"]));
				$this->$field_user 	= $f["html"];
				
				if($i == 0 && $this->meta_title == "") $this->meta_title = $this->$field_user;
				
			}
			
			$first_field_value =  $fields[0]["field_naam"];
			$this->entry_link_label = $this->$first_field_value;
				
		
		}
		
		public function getProperty($name,$type=null,$optional=null){
			
			switch($type)
			{
				default:
					return $type==null ? $this->$name : "<$type>". $this->$name ."</$type>";
				break;
				
				case "taglist":
				
					$r = '<ul class="'.$optional.'">';
					foreach($this->$name as $tag){
						$r .= '<li><a href="" class="label">'. $tag .'</a></li>';
					
					}
					$r .= '</ul>';
					return $r;
						
				break;
				
				case "file":
					return $this->$name[0][0];
				break;
				
				case "price":
					return "&euro; ". $this->$name ;
				break;
				
				case "url":
					return preg_replace("/(http|https):\/\//","",$this->$name);
				break;
				
				case "iframe":
					
					$html = "";
					foreach($this->$name as $pdf_frame){
						$html .= '<div class="responsive-embed '.$optional.'"><iframe src="'. $pdf_frame[0] .'" class="pdf-frame" frameborder="0" allowfullscreen></iframe></div>';						
					}
					return $html;
					
				break;
				
				case "phonelink":
					return $optional. ltrim(preg_replace("/[^0-9]/i","",$this->$name), '0');
				break;
				
				case "img":
				case "image":
					$opt = "";
					foreach((array) $optional as $key => $val){
						$opt .= $key.'="'. $val .'"';
					}
					return '<img src="'. $this->$name[0] .'"'.$opt.'/>';
				break;
				
				case "single_image":
					return $this->$name[$optional];
				break;
				
				case "timestamp":
					if($optional == null) return strftime("%d %B %Y",strtotime($this->$name));
					else  return strftime($optional,strtotime($this->$name));
				break;
				
				case "links":
					return $this->$name[0];
				break;
			}
			
		}
		
		public function getMetaTitle()
		{
			return $this->meta_title;
		}
		
		public function getMetaDesc()
		{
			return $this->meta_desc;
		}
		
		public function getForm()
		{
			return $this->form;
		}
		
		public function getLink($link_label=null)
		{
			$link = $this->getRedirectUrl() ? $this->getRedirectUrl() : $this->entry_link;
			return '<a href="'. $link .'">'. ($link_label == null ? $this->entry_link_label : $link_label) .'</a>';
		}
		
		private function getRedirectUrl()
		{	
			return $this->redirect;
		}
		
		public function getIntroduction($field,$length=200,$paragraph_tags=true)
		{	
			return $this->makeIntro($this->$field,$length,$paragraph_tags);
		}
		
		public function getUrl(){
			return $this->entry_link;
		}
		
		
		public function getTagsAsList($router_tag_url,$tags)
		{
			
			$html = '<ul class="no-bullet link-as-tag">';
				foreach($tags as $tag)
				{
					$html .= '<li><a href="'. $router_tag_url . $this->vl($tag) .'" class="label">'. $tag .'</a></li>';
				}
			$html .= '</ul>';
			
			return $html;
		}
		
		public function getFilesAsList($files)
		{
			
			$html = '<ul class="">';
				foreach($files as $file)
				{
					$html .= '<li><a href="'. $file[0] .'" >'. $file[1] .'</a></li>';
				}
			$html .= '</ul>';
			
			return $html;
		}
									
				
	
		
	}
	
?>