Project

General

Profile

Feature #22872 ยป class.t3lib_iconworks.php.0014711.diff

Administrator Admin, 2010-06-13 12:46

View differences:

t3lib/class.t3lib_iconworks.php (working copy)
* @package TYPO3
* @subpackage t3lib
*/
final class t3lib_iconWorks {
class t3lib_iconWorks {
public static $fileSpriteIconNames = array(
public $fileSpriteIconNames = array(
'htm' => 'mimetypes-text-html',
'html' => 'mimetypes-text-html',
'css' => 'mimetypes-text-css',
......
* @return string <img>-tag
* @see getIcon()
*/
public static function getIconImage($table, $row = array(), $backPath, $params = '', $shaded = FALSE) {
public function getIconImage($table, $row = array(), $backPath, $params = '', $shaded = FALSE) {
$str = '<img'.t3lib_iconWorks::skinImg($backPath, t3lib_iconWorks::getIcon($table, $row, $shaded), 'width="18" height="16"').(trim($params)?' '.trim($params):'');
if (!stristr($str, 'alt="')) {
$str.=' alt=""';
......
* @return string Icon filename
* @see getIconImage()
*/
public static function getIcon($table, $row = array(), $shaded = FALSE) {
public function getIcon($table, $row = array(), $shaded = FALSE) {
global $TCA, $PAGES_TYPES, $ICON_TYPES;
// Flags:
......
* @return string Returns ' src="[backPath][src]" [wHattribs]'
* @see skinImgFile()
*/
public static function skinImg($backPath, $src, $wHattribs = '', $outputMode = 0) {
public function skinImg($backPath, $src, $wHattribs = '', $outputMode = 0) {
static $cachedSkinImages = array();
$cachedSkinImages = array();
$imageId = md5($backPath . $src . $wHattribs . $outputMode);
......
* @return string Filename relative to PATH_typo3
* @access private
*/
public static function makeIcon($iconfile, $mode, $user, $protectSection, $absFile, $iconFileName_stateTagged) {
public function makeIcon($iconfile, $mode, $user, $protectSection, $absFile, $iconFileName_stateTagged) {
$iconFileName = 'icon_'.t3lib_div::shortMD5($iconfile.'|'.$mode.'|-'.$user.'|'.$protectSection).'_'.$iconFileName_stateTagged.'.'.($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png']?'png':'gif');
$mainpath = '../typo3temp/'.$iconFileName;
$path = PATH_site.'typo3temp/'.$iconFileName;
......
* @return void
* @access private
*/
public static function imagecopyresized(&$im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h) {
public function imagecopyresized(&$im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h) {
imagecopyresized($im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h);
}
......
* @access private
* @see t3lib_div::read_png_gif
*/
public static function imagecreatefrom($file) {
public function imagecreatefrom($file) {
$file = t3lib_div::read_png_gif($file, $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png']);
if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png']) {
return $file ? imagecreatefrompng($file) : -1;
......
* @return void
* @access private
*/
public static function imagemake($im, $path) {
public function imagemake($im, $path) {
if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png']) {
@ImagePng($im, $path);
} else {
......
* @return string the full HTML tag (usually a <span>)
* @access public
*/
public static function getSpriteIcon($iconName, $options = array(), $overlays = array()) {
public function getSpriteIcon($iconName, $options = array(), $overlays = array()) {
$innerHtml = (isset($options['html']) ? $options['html'] : '');
$tagName = (isset($options['tagName']) ? $options['tagName'] : 'span');
......
* @return string the full HTML tag (usually a <span>)
* @access public
*/
public static function getSpriteIconForFile($fileExtension, $options = array()) {
public function getSpriteIconForFile($fileExtension, $options = array()) {
$innerHtml = (isset($options['html']) ? $options['html'] : '');
$tagName = (isset($options['tagName']) ? $options['tagName'] : 'span');
......
* @param string fileExtension can be jpg, gif etc, but also be 'mount' or 'folder', but can also be a full path which will be resolved then
* @return string the string of the CSS class, see t3lib_iconworks::$fileSpriteIconNames
*/
public static function mapFileExtensionToSpriteIconClass($fileExtension) {
public function mapFileExtensionToSpriteIconClass($fileExtension) {
// if the file is a whole file with name etc (mainly, if it has a "." or a "/"),
// then it is checked whether it is a valid directory
......
* @return string the full HTML tag (usually a <span>)
* @access public
*/
public static function getSpriteIconForRecord($table, $row, $options = array()) {
public function getSpriteIconForRecord($table, $row, $options = array()) {
$innerHtml = (isset($options['html']) ? $options['html'] : '');
$tagName = (isset($options['tagName']) ? $options['tagName'] : 'span');
......
* @return string the CSS class for the sprite icon of that DB record
* @access private
**/
protected static function mapRecordTypeToSpriteIconClass($table, $row) {
protected function mapRecordTypeToSpriteIconClass($table, $row) {
$iconName = '';
if (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_column'])) {
$column = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
......
* @return string the CSS class for the sprite icon of that DB record
* @access private
*/
protected static function mapRecordOverlayToSpriteIconName($table, $row) {
protected function mapRecordOverlayToSpriteIconName($table, $row) {
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
// Calculate for a given record the actual visibility at the moment
......
* @return string a list of all CSS classes needed for the HTML tag
* @access public
*/
public static function getSpriteIconClasses($iconName) {
public function getSpriteIconClasses($iconName) {
$cssClasses = $baseCssClass = 't3-icon';
$parts = explode('-', $iconName);
......
* @param string $innerHtml (optional) the content within the tag, a "&nbsp;" by default
* @param string $tagName (optional) the name of the HTML element that should be used (span by default)
*/
protected static function buildSpriteHtmlIconTag($tagAttributes, $innerHtml = '&nbsp;', $tagName = 'span') {
protected function buildSpriteHtmlIconTag($tagAttributes, $innerHtml = '&nbsp;', $tagName = 'span') {
$attributes = '';
foreach ($tagAttributes as $attribute => $value) {
$attributes .= ' ' . htmlspecialchars($attribute) . '="' . htmlspecialchars($value) . '"';
......
}
?>
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_iconworks.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_iconworks.php']);
}
?>
    (1-1/1)