Files
@ 51a566e6db62
Branch filter:
Location: hot67beta/libraries/joomla/html/html.php - annotation
51a566e6db62
8.7 KiB
text/x-php
header kill
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 | <?php
/**
* @version $Id: html.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla.Framework
* @subpackage HTML
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
/**
* Utility class for all HTML drawing classes
*
* @static
* @package Joomla.Framework
* @subpackage HTML
* @since 1.5
*/
class JHTML
{
/**
* Class loader method
*
* Additional arguments may be supplied and are passed to the sub-class.
* Additional include paths are also able to be specified for third-party use
*
* @param string The name of helper method to load, (prefix).(class).function
* prefix and class are optional and can be used to load custom
* html helpers.
*/
function _( $type )
{
//Initialise variables
$prefix = 'JHTML';
$file = '';
$func = $type;
// Check to see if we need to load a helper file
$parts = explode('.', $type);
switch(count($parts))
{
case 3 :
{
$prefix = preg_replace( '#[^A-Z0-9_]#i', '', $parts[0] );
$file = preg_replace( '#[^A-Z0-9_]#i', '', $parts[1] );
$func = preg_replace( '#[^A-Z0-9_]#i', '', $parts[2] );
} break;
case 2 :
{
$file = preg_replace( '#[^A-Z0-9_]#i', '', $parts[0] );
$func = preg_replace( '#[^A-Z0-9_]#i', '', $parts[1] );
} break;
}
$className = $prefix.ucfirst($file);
if (!class_exists( $className ))
{
jimport('joomla.filesystem.path');
if ($path = JPath::find(JHTML::addIncludePath(), strtolower($file).'.php'))
{
require_once $path;
if (!class_exists( $className ))
{
JError::raiseWarning( 0, $className.'::' .$func. ' not found in file.' );
return false;
}
}
else
{
JError::raiseWarning( 0, $prefix.$file . ' not supported. File not found.' );
return false;
}
}
if (is_callable( array( $className, $func ) ))
{
$args = func_get_args();
array_shift( $args );
return call_user_func_array( array( $className, $func ), $args );
}
else
{
JError::raiseWarning( 0, $className.'::'.$func.' not supported.' );
return false;
}
}
/**
* Write a <a></a> element
*
* @access public
* @param string The relative URL to use for the href attribute
* @param string The target attribute to use
* @param array An associative array of attributes to add
* @since 1.5
*/
function link($url, $text, $attribs = null)
{
if (is_array( $attribs )) {
$attribs = JArrayHelper::toString( $attribs );
}
return '<a href="'.$url.'" '.$attribs.'>'.$text.'</a>';
}
/**
* Write a <img></amg> element
*
* @access public
* @param string The relative or absoluete URL to use for the src attribute
* @param string The target attribute to use
* @param array An associative array of attributes to add
* @since 1.5
*/
function image($url, $alt, $attribs = null)
{
if (is_array($attribs)) {
$attribs = JArrayHelper::toString( $attribs );
}
if(strpos($url, 'http') !== 0) {
$url = JURI::root(true).'/'.$url;
};
return '<img src="'.$url.'" alt="'.$alt.'" '.$attribs.' />';
}
/**
* Write a <iframe></iframe> element
*
* @access public
* @param string The relative URL to use for the src attribute
* @param string The target attribute to use
* @param array An associative array of attributes to add
* @param string The message to display if the iframe tag is not supported
* @since 1.5
*/
function iframe( $url, $name, $attribs = null, $noFrames = '' )
{
if (is_array( $attribs )) {
$attribs = JArrayHelper::toString( $attribs );
}
return '<iframe src="'.$url.'" '.$attribs.' name="'.$name.'">'.$noFrames.'</iframe>';
}
/**
* Write a <script></script> element
*
* @access public
* @param string The name of the script file
* * @param string The relative or absolute path of the script file
* @param boolean If true, the mootools library will be loaded
* @since 1.5
*/
function script($filename, $path = 'media/system/js/', $mootools = true)
{
// Include mootools framework
if($mootools) {
JHTML::_('behavior.mootools');
}
if(strpos($path, 'http') !== 0) {
$path = JURI::root(true).'/'.$path;
};
$document = &JFactory::getDocument();
$document->addScript( $path.$filename );
return;
}
/**
* Write a <link rel="stylesheet" style="text/css" /> element
*
* @access public
* @param string The relative URL to use for the href attribute
* @since 1.5
*/
function stylesheet($filename, $path = 'media/system/css/', $attribs = array())
{
if(strpos($path, 'http') !== 0) {
$path = JURI::root(true).'/'.$path;
};
$document = &JFactory::getDocument();
$document->addStylesheet( $path.$filename, 'text/css', null, $attribs );
return;
}
/**
* Returns formated date according to current local and adds time offset
*
* @access public
* @param string date in an US English date format
* @param string format optional format for strftime
* @returns string formated date
* @see strftime
* @since 1.5
*/
function date($date, $format = null, $offset = NULL)
{
if ( ! $format ) {
$format = JText::_('DATE_FORMAT_LC1');
}
if(is_null($offset))
{
$config =& JFactory::getConfig();
$offset = $config->getValue('config.offset');
}
$instance =& JFactory::getDate($date);
$instance->setOffset($offset);
return $instance->toFormat($format);
}
/**
* Creates a tooltip with an image as button
*
* @access public
* @param string $tooltip The tip string
* @param string $title The title of the tooltip
* @param string $image The image for the tip, if no text is provided
* @param string $text The text for the tip
* @param string $href An URL that will be used to create the link
* @param boolean depreciated
* @return string
* @since 1.5
*/
function tooltip($tooltip, $title='', $image='tooltip.png', $text='', $href='', $link=1)
{
$tooltip = addslashes(htmlspecialchars($tooltip));
$title = addslashes(htmlspecialchars($title));
if ( !$text ) {
$image = JURI::root(true).'/includes/js/ThemeOffice/'. $image;
$text = '<img src="'. $image .'" border="0" alt="'. JText::_( 'Tooltip' ) .'"/>';
} else {
$text = JText::_( $text, true );
}
if($title) {
$title = $title.'::';
}
$style = 'style="text-decoration: none; color: #333;"';
if ( $href ) {
$href = JRoute::_( $href );
$style = '';
$tip = '<span class="editlinktip hasTip" title="'.$title.$tooltip.'" '. $style .'><a href="'. $href .'">'. $text .'</a></span>';
} else {
$tip = '<span class="editlinktip hasTip" title="'.$title.$tooltip.'" '. $style .'>'. $text .'</span>';
}
return $tip;
}
/**
* Displays a calendar control field
*
* @param string The date value
* @param string The name of the text field
* @param string The id of the text field
* @param string The date format
* @param array Additional html attributes
*/
function calendar($value, $name, $id, $format = '%Y-%m-%d', $attribs = null)
{
JHTML::_('behavior.calendar'); //load the calendar behavior
if (is_array($attribs)) {
$attribs = JArrayHelper::toString( $attribs );
}
$document =& JFactory::getDocument();
$document->addScriptDeclaration('window.addEvent(\'domready\', function() {Calendar.setup({
inputField : "'.$id.'", // id of the input field
ifFormat : "'.$format.'", // format of the input field
button : "'.$id.'_img", // trigger for the calendar (button ID)
align : "Tl", // alignment (defaults to "Bl")
singleClick : true
});});');
return '<input type="text" name="'.$name.'" id="'.$id.'" value="'.htmlspecialchars($value, ENT_COMPAT, 'UTF-8').'" '.$attribs.' />'.
'<img class="calendar" src="'.JURI::root(true).'/templates/system/images/calendar.png" alt="calendar" id="'.$id.'_img" />';
}
/**
* Add a directory where JHTML should search for helpers. You may
* either pass a string or an array of directories.
*
* @access public
* @param string A path to search.
* @return array An array with directory elements
* @since 1.5
*/
function addIncludePath( $path='' )
{
static $paths;
if (!isset($paths)) {
$paths = array( JPATH_LIBRARIES.DS.'joomla'.DS.'html'.DS.'html' );
}
// force path to array
settype($path, 'array');
// loop through the path directories
foreach ($path as $dir)
{
if (!empty($dir) && !in_array($dir, $paths)) {
array_unshift($paths, JPath::clean( $dir ));
}
}
return $paths;
}
}
|