HEX
Server: LiteSpeed
System: Linux php-prod-3.spaceapp.ru 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: sarli3128 (1010)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/retile.ru/public_html/catalog/controller/extension/module/uni_banner_in_category.php
<?php  
class ControllerExtensionModuleUniBannerInCategory extends Controller {
	public function index($category_id = 0) {
		
		$data['banners'] = [];
		
		if($category_id && $this->config->get('module_uni_banner_in_category_status')) {
			$this->load->model('extension/module/uni_banner_in_category');
			
			$this->document->addStyle('catalog/view/theme/unishop2/stylesheet/banner-in-category.css');
			
			$category_id = (int)$category_id;
			$language_id = (int)$this->config->get('config_language_id');
			$store_id = (int)$this->config->get('config_store_id');
			
			$cache_name = 'unishop.banner.in.category_.'.$category_id.'.'.$language_id.'.'.$store_id;
			
			$data['banners'] = $this->cache->get($cache_name);
			
			if(!$data['banners']) {
				$banners = $this->model_extension_module_uni_banner_in_category->getBanners((int)$category_id);
		
				foreach($banners as $banner) {	
					//$image = $banner['image'] ? $this->model_tool_image->resize($banner['image'], $banner['width'], $banner['height']) : '';
			
					if (is_file(DIR_IMAGE . $banner['image'])) {
						$size = getimagesize(DIR_IMAGE . $banner['image']);
						$image = $this->model_tool_image->resize($banner['image'], $size[0], $size[1]);
					} else {
						$image = '';
					}
			
					$description = ($banner['description'] != '<p><br></p>') && ($banner['description'] != '&lt;p&gt;&lt;br&gt;&lt;/p&gt;') ? html_entity_decode(trim($banner['description']), ENT_QUOTES, 'UTF-8') : '';
						
					$data['banners'][] = [
						'banner_id'   => $banner['banner_id'],
						'name' 		  => $banner['name'],
						'image' 	  => $image,
						'description' => preg_replace('/\r\n|\r|\n/u', '', $description),
						'description' => trim(str_replace(["\r\n", "\r", "\n", "'", '&nbsp;'], ' ',  $description)),
						'button' 	  => $banner['button'],
						'href' 		  => $banner['link'],
						'type' 	  	  => $banner['type'],
						'height'	  => $banner['height'],
						'position' 	  => $banner['position'],
						'position2'   => $banner['position2']
					];
				}
				
				if($data['banners']) {
					$this->cache->set($cache_name, $data['banners']);
				}
			}
		}

		return $this->load->view('extension/module/uni_banner_in_category', $data);
  	}
}
?>