| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: helper.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 6 * @license GNU/GPL, see LICENSE.php 7 * Joomla! is free software. This version may have been modified pursuant 8 * to the GNU General Public License, and as distributed it includes or 9 * is derivative of works licensed under the GNU General Public License or 10 * other free or open source software licenses. 11 * See COPYRIGHT.php for copyright notices and details. 12 */ 13 14 // no direct access 15 defined('_JEXEC') or die('Restricted access'); 16 17 require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_banners'.DS.'helpers'.DS.'banner.php'); 18 19 class modBannersHelper 20 { 21 function getList(&$params) 22 { 23 $model = modBannersHelper::getModel(); 24 25 // Model Variables 26 $vars['cid'] = (int) $params->get( 'cid' ); 27 $vars['catid'] = (int) $params->get( 'catid' ); 28 $vars['limit'] = (int) $params->get( 'count', 1 ); 29 $vars['ordering'] = $params->get( 'ordering' ); 30 31 if ($params->get( 'tag_search' )) 32 { 33 $document =& JFactory::getDocument(); 34 $keywords = $document->getMetaData( 'keywords' ); 35 36 $vars['tag_search'] = BannerHelper::getKeywords( $keywords ); 37 } 38 39 $banners = $model->getList( $vars ); 40 $model->impress( $banners ); 41 42 return $banners; 43 } 44 45 function getModel() 46 { 47 if (!class_exists( 'BannersModelBanner' )) 48 { 49 // Build the path to the model based upon a supplied base path 50 $path = JPATH_SITE.DS.'components'.DS.'com_banners'.DS.'models'.DS.'banner.php'; 51 $false = false; 52 53 // If the model file exists include it and try to instantiate the object 54 if (file_exists( $path )) { 55 require_once( $path ); 56 if (!class_exists( 'BannersModelBanner' )) { 57 JError::raiseWarning( 0, 'Model class BannersModelBanner not found in file.' ); 58 return $false; 59 } 60 } else { 61 JError::raiseWarning( 0, 'Model BannersModelBanner not supported. File not found.' ); 62 return $false; 63 } 64 } 65 66 $model = new BannersModelBanner(); 67 return $model; 68 } 69 70 function renderBanner($params, &$item) 71 { 72 $link = JRoute::_( 'index.php?option=com_banners&task=click&bid='. $item->bid ); 73 $baseurl = JURI::base(); 74 75 $html = ''; 76 if (trim($item->custombannercode)) 77 { 78 // template replacements 79 $html = str_replace( '{CLICKURL}', $link, $item->custombannercode ); 80 $html = str_replace( '{NAME}', $item->name, $html ); 81 } 82 else if (BannerHelper::isImage( $item->imageurl )) 83 { 84 $image = '<img src="'.$baseurl.'images/banners/'.$item->imageurl.'" alt="'.JText::_('Banner').'" />'; 85 if ($item->clickurl) 86 { 87 switch ($params->get( 'target', 1 )) 88 { 89 // cases are slightly different 90 case 1: 91 // open in a new window 92 $a = '<a href="'. $link .'" target="_blank">'; 93 break; 94 95 case 2: 96 // open in a popup window 97 $a = "<a href=\"javascript:void window.open('". $link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">"; 98 break; 99 100 default: // formerly case 2 101 // open in parent window 102 $a = '<a href="'. $link .'">'; 103 break; 104 } 105 106 $html = $a . $image . '</a>'; 107 } 108 else 109 { 110 $html = $image; 111 } 112 } 113 else if (BannerHelper::isFlash( $item->imageurl )) 114 { 115 //echo $item->params; 116 $banner_params = new JParameter( $item->params ); 117 $width = $banner_params->get( 'width'); 118 $height = $banner_params->get( 'height'); 119 120 $imageurl = $baseurl."images/banners/".$item->imageurl; 121 $html = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" border=\"0\" width=\"$width\" height=\"$height\"> 122 <param name=\"movie\" value=\"$imageurl\"><embed src=\"$imageurl\" loop=\"false\" pluginspage=\"http://www.macromedia.com/go/get/flashplayer\" type=\"application/x-shockwave-flash\" width=\"$width\" height=\"$height\"></embed> 123 </object>"; 124 } 125 126 return $html; 127 } 128 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |