Location: PHPKode > projects > ZZ/OSS Installer > zic-1.1.0dev1/installer/lib/ZZOSS_Browser/Browser.php
<?php   
    /*
    Copyright (C) 2001-2004 ZZOSS GbR, http://www.zzoss.com

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */
    
/**
* Methods for enhancing browser compatibility.
*
* @version $Id: Browser.php,v 1.1 2004/01/21 09:16:27 ordnas Exp $
* @copyright Copyright &copy; 2001-2004 ZZ/OSS GbR, http://www.zzoss.com
* @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
*/
class ZZOSS_Browser
{
    /*
    * Handle PNG images in MSIE 5+
    *
    * Ensures that PNG-24 transparencies are displayed correctly as described at
    * http://www.msdn.microsoft.com/library/default.asp?url=/workshop/author/filter/reference/filters/alphaimageloader.asp
    *
    * @param  $str  HTML content with src tags.
    * @param $spacer Location of the 1x1 pixel transparent GIF.
    * @result Returns the modified string.
    */
    function png($str, $spacer){
        include_once 'Net/UserAgent/Detect.php';
        // Make sure that we only deal with MSIE5+ and not with masqueraded Opera.
        if(!isset($_SERVER['HTTP_USER_AGENT']) ||
            !Net_UserAgent_Detect::isBrowser('ie5up') ||
            Net_UserAgent_Detect::isBrowser('opera')){
            return $str;
        }
        
        $pattern = "/src=\"([^\"]+\.png)\"/i";
        $replacement = 'src="'.$spacer.'" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'\\1\')"';
        $str = preg_replace($pattern, $replacement, $str);
        return $str;
    }
}
?>
Return current item: ZZ/OSS Installer