web/lib/Zend/View/Helper/HeadStyle.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_View
    16  * @package    Zend_View
    17  * @subpackage Helper
    17  * @subpackage Helper
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @version    $Id: HeadStyle.php 20104 2010-01-06 21:26:01Z matthew $
    19  * @version    $Id: HeadStyle.php 24593 2012-01-05 20:35:02Z matthew $
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    21  */
    21  */
    22 
    22 
    23 /** Zend_View_Helper_Placeholder_Container_Standalone */
    23 /** Zend_View_Helper_Placeholder_Container_Standalone */
    24 require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php';
    24 require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php';
    27  * Helper for setting and retrieving stylesheets
    27  * Helper for setting and retrieving stylesheets
    28  *
    28  *
    29  * @uses       Zend_View_Helper_Placeholder_Container_Standalone
    29  * @uses       Zend_View_Helper_Placeholder_Container_Standalone
    30  * @package    Zend_View
    30  * @package    Zend_View
    31  * @subpackage Helper
    31  * @subpackage Helper
    32  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    32  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    33  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    33  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    34  */
    34  */
    35 class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_Standalone
    35 class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_Standalone
    36 {
    36 {
    37     /**
    37     /**
   353                 }
   353                 }
   354                 $attrString .= sprintf(' %s="%s"', $key, htmlspecialchars($value, ENT_COMPAT, $enc));
   354                 $attrString .= sprintf(' %s="%s"', $key, htmlspecialchars($value, ENT_COMPAT, $enc));
   355             }
   355             }
   356         }
   356         }
   357 
   357 
   358         $html = '<style type="text/css"' . $attrString . '>' . PHP_EOL
   358         $escapeStart = $indent . '<!--'. PHP_EOL;
   359               . $indent . '<!--' . PHP_EOL . $indent . $item->content . PHP_EOL . $indent . '-->' . PHP_EOL
   359         $escapeEnd = $indent . '-->'. PHP_EOL;
   360               . '</style>';
       
   361 
       
   362         if (isset($item->attributes['conditional'])
   360         if (isset($item->attributes['conditional'])
   363             && !empty($item->attributes['conditional'])
   361             && !empty($item->attributes['conditional'])
   364             && is_string($item->attributes['conditional']))
   362             && is_string($item->attributes['conditional'])
   365         {
   363         ) {
       
   364             $escapeStart = null;
       
   365             $escapeEnd = null;
       
   366         }
       
   367 
       
   368         $html = '<style type="text/css"' . $attrString . '>' . PHP_EOL
       
   369               . $escapeStart . $indent . $item->content . PHP_EOL . $escapeEnd
       
   370               . '</style>';
       
   371 
       
   372         if (null == $escapeStart && null == $escapeEnd) {
   366             $html = '<!--[if ' . $item->attributes['conditional'] . ']> ' . $html . '<![endif]-->';
   373             $html = '<!--[if ' . $item->attributes['conditional'] . ']> ' . $html . '<![endif]-->';
   367         }
   374         }
   368 
   375 
   369         return $html;
   376         return $html;
   370     }
   377     }