cvs: pear /HTML_CSS/examples CSS_Advanced.php CSS_DisplayOnline.php CSS_InHeader.php CSS_Inline.php CSS_Logger.php CSS_Stylesheet.php
CSS_grepStyles.php CSS_parseData.php css_error_custom.php css_error_ignore.php css_error_logger.php css_errorstack_custom.php
css_errorstack_logger.php

From: Date: Mon, 10 Dec 2007 10:48:34 +0000
Subject: cvs: pear /HTML_CSS/examples CSS_Advanced.php CSS_DisplayOnline.php CSS_InHeader.php CSS_Inline.php CSS_Logger.php CSS_Stylesheet.php
CSS_grepStyles.php CSS_parseData.php css_error_custom.php css_error_ignore.php css_error_logger.php css_errorstack_custom.php
css_errorstack_logger.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-49702@lists.php.net to get a copy of this message
farell Mon Dec 10 10:48:34 2007 UTC Modified files: /pear/HTML_CSS/examples CSS_Advanced.php CSS_DisplayOnline.php css_error_custom.php css_error_ignore.php css_error_logger.php css_errorstack_custom.php css_errorstack_logger.php CSS_grepStyles.php CSS_InHeader.php CSS_Inline.php CSS_Logger.php CSS_parseData.php CSS_Stylesheet.php Log: Respect as most as possible Coding Standard (fixes recommandation by PHPCS 1.0.0RC3)

http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/CSS_Advanced.php?r1=1.2&r2=1.3&diff_format=u Index: pear/HTML_CSS/examples/CSS_Advanced.php diff -u pear/HTML_CSS/examples/CSS_Advanced.php:1.2 pear/HTML_CSS/examples/CSS_Advanced.php:1.3 --- pear/HTML_CSS/examples/CSS_Advanced.php:1.2 Wed Jan 14 22:21:16 2004 +++ pear/HTML_CSS/examples/CSS_Advanced.php Mon Dec 10 10:48:33 2007 @@ -1,27 +1,22 @@ <?php -/* vim: set expandtab tabstop=4 shiftwidth=4: */ -// +----------------------------------------------------------------------+ -// | PHP Version 4 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997 - 2004 The PHP Group | -// +----------------------------------------------------------------------+ -// | This source file is subject to version 3.0 of the PHP license, | -// | that is bundled with this package in the file LICENSE, and is | -// | available at through the world-wide-web at | -// | http://www.php.net/license/3_0.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | license@php.net so we can mail you a copy immediately. | -// +----------------------------------------------------------------------+ -// | Author: Klaus Guenther <klaus@capitalfocus.org> | -// +----------------------------------------------------------------------+ -// -// $Id: CSS_Advanced.php,v 1.2 2004/01/14 22:21:16 thesaur Exp $ +/** + * Grouping selectors example + * + * PHP versions 4 and 5 + * + * @category HTML + * @package HTML_CSS + * @subpackage Examples + * @author Klaus Guenther <klaus@capitalfocus.org> + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: CSS_Advanced.php,v 1.3 2007/12/10 10:48:33 farell Exp $ + * @link http://pear.php.net/package/HTML_CSS + * @ignore + */ +require_once 'HTML/CSS.php'; -require_once 'HTML/CSS/Advanced.php'; - -$css = new HTML_CSS_Advanced(); +$css = new HTML_CSS(); // define styles $css->setStyle('p', 'text-align', 'center'); @@ -30,10 +25,9 @@ $css->setStyle('p', 'font', '16pt helvetica, arial, sans-serif'); $css->setStyle('p', 'font', '12pt helvetica, arial, sans-serif'); -$css->createGroup('p,a', 'myGroup'); +$css->createGroup('p, a', 'myGroup'); $css->setGroupStyle('myGroup', 'font', '12pt helvetica, arial, sans-serif'); // output the stylesheet directly to browser $css->display(); - -?> +?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/CSS_DisplayOnline.php?r1=1.2&r2=1.3&diff_format=u Index: pear/HTML_CSS/examples/CSS_DisplayOnline.php diff -u pear/HTML_CSS/examples/CSS_DisplayOnline.php:1.2 pear/HTML_CSS/examples/CSS_DisplayOnline.php:1.3 --- pear/HTML_CSS/examples/CSS_DisplayOnline.php:1.2 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/CSS_DisplayOnline.php Mon Dec 10 10:48:33 2007 @@ -2,14 +2,17 @@ /** * Example to produces an external stylesheet declarations to browser output * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2007 Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: CSS_DisplayOnline.php,v 1.2 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: CSS_DisplayOnline.php,v 1.3 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS + * @ignore */ require_once 'HTML/CSS.php'; http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/css_error_custom.php?r1=1.6&r2=1.7&diff_format=u Index: pear/HTML_CSS/examples/css_error_custom.php diff -u pear/HTML_CSS/examples/css_error_custom.php:1.6 pear/HTML_CSS/examples/css_error_custom.php:1.7 --- pear/HTML_CSS/examples/css_error_custom.php:1.6 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/css_error_custom.php Mon Dec 10 10:48:33 2007 @@ -2,21 +2,32 @@ /** * Customize error renderer with default PEAR_Error object. * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Klaus Guenther <klaus@capitalfocus.org> * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2005-2007 Klaus Guenther, Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: css_error_custom.php,v 1.6 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: css_error_custom.php,v 1.7 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS * @since File available since Release 1.0.0RC1 + * @ignore */ require_once 'HTML/CSS.php'; require_once 'PEAR.php'; +/** + * Determine whether to display or log an error. + * + * @param object $pb_error instance of HTML_CSS_Error + * + * @return void + * @ignore + */ function myErrorCallback($pb_error) { $keys = array('error_message_prefix', 'mode', 'level', 'code', 'message'); @@ -27,6 +38,18 @@ echo '<hr/>'; } +/** + * Replace default internal error handler. + * + * Print rather than dies if the error is an exception. + * + * @param int $code a numeric error code. + * Valid are HTML_CSS_ERROR_* constants + * @param string $level error level ('exception', 'error', 'warning', ...) + * + * @return integer + * @ignore + */ function myErrorHandler($code, $level) { if ($level == 'exception') { @@ -40,8 +63,8 @@ * Be sure that we will print and log error details. * @see HTML_CSS_Error::log() */ -ini_set('display_errors',1); -ini_set('log_errors',1); +ini_set('display_errors', 1); +ini_set('log_errors', 1); // Example A. --------------------------------------------- http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/css_error_ignore.php?r1=1.6&r2=1.7&diff_format=u Index: pear/HTML_CSS/examples/css_error_ignore.php diff -u pear/HTML_CSS/examples/css_error_ignore.php:1.6 pear/HTML_CSS/examples/css_error_ignore.php:1.7 --- pear/HTML_CSS/examples/css_error_ignore.php:1.6 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/css_error_ignore.php Mon Dec 10 10:48:33 2007 @@ -2,20 +2,31 @@ /** * Simply ignores html_css errors that occurs. * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Klaus Guenther <klaus@capitalfocus.org> * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2005-2007 Klaus Guenther, Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: css_error_ignore.php,v 1.6 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: css_error_ignore.php,v 1.7 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS * @since File available since Release 1.0.0RC1 + * @ignore */ require_once 'HTML/CSS.php'; +/** + * Replace default internal error handler. + * + * Ignore all errors + * + * @return null + * @ignore + */ function myErrorHandler() { return null; http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/css_error_logger.php?r1=1.6&r2=1.7&diff_format=u Index: pear/HTML_CSS/examples/css_error_logger.php diff -u pear/HTML_CSS/examples/css_error_logger.php:1.6 pear/HTML_CSS/examples/css_error_logger.php:1.7 --- pear/HTML_CSS/examples/css_error_logger.php:1.6 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/css_error_logger.php Mon Dec 10 10:48:33 2007 @@ -3,6 +3,8 @@ * Customize error renderer with default PEAR_Error object * and PEAR::Log (db handler, mysql driver). * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples @@ -10,19 +12,28 @@ * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2005-2007 Klaus Guenther, Laurent Laville * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: css_error_logger.php,v 1.6 2007/10/22 13:34:41 farell Exp $ + * @version CVS: $Id: css_error_logger.php,v 1.7 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS * @since File available since Release 1.0.0RC1 + * @ignore */ require_once 'HTML/CSS.php'; require_once 'PEAR.php'; require_once 'Log.php'; +/** + * Determine whether to display or log an error. + * + * @param object $css_error instance of HTML_CSS_Error + * + * @return void + * @ignore + */ function myErrorCallback($css_error) { $display_errors = ini_get('display_errors'); - $log_errors = ini_get('log_errors'); + $log_errors = ini_get('log_errors'); if ($display_errors) { printf('<b>HTML_CSS error :</b> %s<br/>', $css_error->getMessage()); @@ -31,13 +42,13 @@ if ($log_errors) { $userinfo = $css_error->getUserInfo(); - $lineFormat = '%1$s %2$s'; + $lineFormat = '%1$s %2$s'; $contextFormat = '(Function="%3$s" File="%1$s" Line="%2$s")'; - $options =& $userinfo['log']['sql']; + $options =& $userinfo['log']['sql']; $db_table =& $options['name']; - $ident =& $options['ident']; - $conf =& $options['conf']; + $ident =& $options['ident']; + $conf =& $options['conf']; if (isset($conf['lineFormat'])) { $lineFormat = $conf['lineFormat']; @@ -48,34 +59,42 @@ $logger = &Log::singleton('sql', $db_table, $ident, $conf); - $msg = $css_error->getMessage(); - $ctx = $css_error->sprintContextExec($contextFormat); + $msg = $css_error->getMessage(); + $ctx = $css_error->sprintContextExec($contextFormat); $message = sprintf($lineFormat, $msg, $ctx); switch ($userinfo['level']) { - case 'exception': - $logger->alert($message); - break; - case 'error': - $logger->err($message); - break; - case 'warning': - $logger->warning($message); - break; - default: - $logger->notice($message); + case 'exception': + $logger->alert($message); + break; + case 'error': + $logger->err($message); + break; + case 'warning': + $logger->warning($message); + break; + default: + $logger->notice($message); } } } +/** + * Replace default internal error handler. + * + * Always returns error, but do nothing + * + * @return null + * @ignore + */ function myErrorHandler() { // always returns error; do not halt script on exception return null; } -ini_set('display_errors',1); -ini_set('log_errors',1); +ini_set('display_errors', 1); +ini_set('log_errors', 1); // Example A. --------------------------------------------- @@ -99,7 +118,7 @@ * ); */ -$options = array( +$options = array( 'dsn' => "$dbms://$db_user:$db_pass@/$db_name", 'contextFormat' => '[File="%1$s" Line="%2$s"]' ); @@ -107,9 +126,9 @@ 'ident' => 'HTML_CSS', 'conf' => $options ); -$logConfig = array('sql' => $sql_handler); +$logConfig = array('sql' => $sql_handler); -$prefs = array( +$prefs = array( 'push_callback' => 'myErrorHandler', 'handler' => array('log' => $logConfig) ); @@ -128,7 +147,8 @@ $css1->setXhtmlCompliance('true'); $msg = "<br/><hr/>"; -$msg .= "Previous errors has been recorded in database '$db_name', table '$db_table'"; +$msg .= "Previous errors has been recorded in database '$db_name'," . + " table '$db_table'"; echo "$msg <br/><br/>"; print 'still alive !'; http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/css_errorstack_custom.php?r1=1.6&r2=1.7&diff_format=u Index: pear/HTML_CSS/examples/css_errorstack_custom.php diff -u pear/HTML_CSS/examples/css_errorstack_custom.php:1.6 pear/HTML_CSS/examples/css_errorstack_custom.php:1.7 --- pear/HTML_CSS/examples/css_errorstack_custom.php:1.6 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/css_errorstack_custom.php Mon Dec 10 10:48:33 2007 @@ -2,22 +2,30 @@ /** * Customize error renderer with PEAR_ErrorStack. * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Klaus Guenther <klaus@capitalfocus.org> * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2005-2007 Klaus Guenther, Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: css_errorstack_custom.php,v 1.6 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: css_errorstack_custom.php,v 1.7 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS * @since File available since Release 1.0.0RC1 + * @ignore */ require_once 'HTML/CSS.php'; require_once 'HTML/CSS/Error.php'; require_once 'PEAR/ErrorStack.php'; +/** + * This class creates a css error stack object with help of PEAR_ErrorStack + * + * @ignore + */ class HTML_CSS_ErrorStack { function HTML_CSS_ErrorStack() @@ -52,7 +60,7 @@ { global $prefs; - $lineFormat = '<b>%1$s:</b> %2$s<br/>[%3$s]<hr/>'."<br/>\n"; + $lineFormat = '<b>%1$s:</b> %2$s<br/>[%3$s]<hr/>'."<br/>\n"; $contextFormat = 'in <b>%1$s</b> on line <b>%2$s</b>'; if (isset($prefs['handler']['display']['lineFormat'])) { @@ -65,8 +73,8 @@ $context = $err['context']; if ($context) { - $file = $context['file']; - $line = $context['line']; + $file = $context['file']; + $line = $context['line']; $contextExec = sprintf($contextFormat, $file, $line); } else { @@ -100,7 +108,7 @@ $stack =& new HTML_CSS_ErrorStack(); $attribs = array(); -$prefs = array('error_handler' => array(&$stack, 'push')); +$prefs = array('error_handler' => array(&$stack, 'push')); // A1. Error $css1 = new HTML_CSS($attribs, $prefs); @@ -116,8 +124,8 @@ 'contextFormat' => '<b>File:</b> %1$s <br/>' . '<b>Line:</b> %2$s ' ); -$attribs = array(); -$prefs = array( +$attribs = array(); +$prefs = array( 'error_handler' => array(&$stack, 'push'), 'handler' => array('display' => $displayConfig) ); http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/css_errorstack_logger.php?r1=1.6&r2=1.7&diff_format=u Index: pear/HTML_CSS/examples/css_errorstack_logger.php diff -u pear/HTML_CSS/examples/css_errorstack_logger.php:1.6 pear/HTML_CSS/examples/css_errorstack_logger.php:1.7 --- pear/HTML_CSS/examples/css_errorstack_logger.php:1.6 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/css_errorstack_logger.php Mon Dec 10 10:48:33 2007 @@ -2,16 +2,19 @@ /** * Customize error renderer with PEAR_ErrorStack and PEAR::Log * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Klaus Guenther <klaus@capitalfocus.org> * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2005-2007 Klaus Guenther, Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: css_errorstack_logger.php,v 1.6 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: css_errorstack_logger.php,v 1.7 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS * @since File available since Release 1.0.0RC1 + * @ignore */ require_once 'HTML/CSS.php'; @@ -19,6 +22,11 @@ require_once 'PEAR/ErrorStack.php'; require_once 'Log.php'; +/** + * This class creates a css error stack object with help of PEAR_ErrorStack + * + * @ignore + */ class HTML_CSS_ErrorStack { function HTML_CSS_ErrorStack() @@ -30,12 +38,11 @@ $s->setContextCallback(array(&$this,'getBacktrace')); $ident = $_SERVER['REMOTE_ADDR']; - $conf = array('lineFormat' => '%1$s - %2$s [%3$s] %4$s'); - $file = &Log::singleton('file', 'html_css_err.log', $ident, $conf); + $conf = array('lineFormat' => '%1$s - %2$s [%3$s] %4$s'); + $file = &Log::singleton('file', 'html_css_err.log', $ident, $conf); - $conf = array('error_prepend' => '<font color="#ff0000"><tt>', - 'error_append' => '</tt></font>' - ); + $conf = array('error_prepend' => '<font color="#ff0000"><tt>', + 'error_append' => '</tt></font>'); $display = &Log::singleton('display', '', '', $conf); $composite = &Log::singleton('composite'); @@ -62,7 +69,7 @@ $message = $stack->getErrorMessage($stack, $err, $template); - $lineFormat = '%1$s %2$s [%3$s]'; + $lineFormat = '%1$s %2$s [%3$s]'; $contextFormat = 'in %1$s on line %2$s'; if (isset($prefs['handler']['display']['lineFormat'])) { @@ -77,8 +84,8 @@ $context = $err['context']; if ($context) { - $file = $context['file']; - $line = $context['line']; + $file = $context['file']; + $line = $context['line']; $contextExec = sprintf($contextFormat, $file, $line); } else { @@ -121,7 +128,7 @@ $stack =& new HTML_CSS_ErrorStack(); $attribs = array(); -$prefs = array('error_handler' => array(&$stack, 'push')); +$prefs = array('error_handler' => array(&$stack, 'push')); // A1. Error $css1 = new HTML_CSS($attribs, $prefs); @@ -137,8 +144,8 @@ 'contextFormat' => '<b>File:</b> %1$s <br/>' . '<b>Line:</b> %2$s ' ); -$attribs = array(); -$prefs = array( +$attribs = array(); +$prefs = array( 'error_handler' => array(&$stack, 'push'), 'handler' => array('display' => $displayConfig) ); http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/CSS_grepStyles.php?r1=1.3&r2=1.4&diff_format=u Index: pear/HTML_CSS/examples/CSS_grepStyles.php diff -u pear/HTML_CSS/examples/CSS_grepStyles.php:1.3 pear/HTML_CSS/examples/CSS_grepStyles.php:1.4 --- pear/HTML_CSS/examples/CSS_grepStyles.php:1.3 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/CSS_grepStyles.php Mon Dec 10 10:48:33 2007 @@ -3,19 +3,30 @@ * New feature of version 1.1.0 explained : * Ability to find if an element or property is already defined and where * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2006-2007 Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: CSS_grepStyles.php,v 1.3 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: CSS_grepStyles.php,v 1.4 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS * @since File available since Release 1.1.0 + * @ignore */ require_once 'HTML/CSS.php'; +/** + * HTML render for css grep results. + * + * @param array $styles HTML_CSS array output render + * + * @return void + * @ignore + */ function displayResults($styles) { if (count($styles) == 0) { @@ -99,7 +110,7 @@ echo '<h1>2. class selector pattern "#PB1"</h1>'; displayResults($styles); -// 3. is property "font-weight" already defined inside class selectors pattern "#PB1" ? +// 3. is property "font-weight" already defined inside class selectors pattern #PB1? $styles = $css->grepStyle('/^#PB1/', '/^font-weight$/'); echo '<h1>3. property "font-weight" inside class selector pattern "#PB1"</h1>'; displayResults($styles); http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/CSS_InHeader.php?r1=1.10&r2=1.11&diff_format=u Index: pear/HTML_CSS/examples/CSS_InHeader.php diff -u pear/HTML_CSS/examples/CSS_InHeader.php:1.10 pear/HTML_CSS/examples/CSS_InHeader.php:1.11 --- pear/HTML_CSS/examples/CSS_InHeader.php:1.10 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/CSS_InHeader.php Mon Dec 10 10:48:33 2007 @@ -2,15 +2,18 @@ /** * InHeader example * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Klaus Guenther <klaus@capitalfocus.org> * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2003-2007 Klaus Guenther, Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: CSS_InHeader.php,v 1.10 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: CSS_InHeader.php,v 1.11 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS + * @ignore */ require_once 'HTML/Page2.php'; http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/CSS_Inline.php?r1=1.9&r2=1.10&diff_format=u Index: pear/HTML_CSS/examples/CSS_Inline.php diff -u pear/HTML_CSS/examples/CSS_Inline.php:1.9 pear/HTML_CSS/examples/CSS_Inline.php:1.10 --- pear/HTML_CSS/examples/CSS_Inline.php:1.9 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/CSS_Inline.php Mon Dec 10 10:48:33 2007 @@ -2,15 +2,18 @@ /** * InLine example * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Klaus Guenther <klaus@capitalfocus.org> * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2003-2007 Klaus Guenther, Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: CSS_Inline.php,v 1.9 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: CSS_Inline.php,v 1.10 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS + * @ignore */ require_once 'HTML/CSS.php'; http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/CSS_Logger.php?r1=1.7&r2=1.8&diff_format=u Index: pear/HTML_CSS/examples/CSS_Logger.php diff -u pear/HTML_CSS/examples/CSS_Logger.php:1.7 pear/HTML_CSS/examples/CSS_Logger.php:1.8 --- pear/HTML_CSS/examples/CSS_Logger.php:1.7 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/CSS_Logger.php Mon Dec 10 10:48:33 2007 @@ -6,29 +6,36 @@ * as an error handler for HTML_CSS. * It used the new plug-in system introduces in version 1.0.0RC1 * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Klaus Guenther <klaus@capitalfocus.org> * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2005-2007 Klaus Guenther, Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: CSS_Logger.php,v 1.7 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: CSS_Logger.php,v 1.8 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS * @since File available since Release 1.0.0RC1 + * @ignore */ require_once 'HTML/CSS.php'; require_once 'PEAR.php'; -class myErrorHandler +/** + * @ignore + */ +class MyErrorHandler { var $_display; - function myErrorHandler($display = null) + function MyErrorHandler($display = null) { $default = array('lineFormat' => '<b>%1$s</b>: %2$s %3$s', - 'contextFormat' => ' in <b>%3$s</b> (file <b>%1$s</b> at line <b>%2$s</b>)', + 'contextFormat' => ' in <b>%3$s</b> ' . + '(file <b>%1$s</b> at line <b>%2$s</b>)', 'eol' => "\n" ); @@ -47,11 +54,11 @@ function errorCallback($err) { $display_errors = ini_get('display_errors'); - $log_errors = ini_get('log_errors'); + $log_errors = ini_get('log_errors'); - $info = $err->getUserInfo(); - $level = isset($info['errorLevel']) ? $info['errorLevel'] : 'notice'; - $message = $err->getMessage(); + $info = $err->getUserInfo(); + $level = isset($info['errorLevel']) ? $info['errorLevel'] : 'notice'; + $message = $err->getMessage(); $backtrace = $err->getBacktrace(); if ($display_errors) { @@ -73,8 +80,7 @@ strftime($log['timeFormat'], time()), $_SERVER['REMOTE_ADDR'], $level, - $message - ); + $message); error_log($msg, 3, 'htmlcss.log'); } @@ -96,24 +102,25 @@ } } - $lineFormat = $this->_display['lineFormat'] . $this->_display['eol']; + $lineFormat = $this->_display['lineFormat'] . $this->_display['eol']; $contextFormat = $this->_display['contextFormat']; - $contextExec = sprintf($contextFormat, $file, $line, $func); + $contextExec = sprintf($contextFormat, $file, $line, $func); printf($lineFormat, ucfirst($level), $message, $contextExec); } } -$myErrorHandler = new myErrorHandler(); -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$myErrorHandler, 'errorCallback')); +$myErrorHandler = new MyErrorHandler(); +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, + array(&$myErrorHandler, 'errorCallback')); ini_set('display_errors', 1); ini_set('log_errors', 1); -$includes = get_included_files(); +$includes = get_included_files(); $display_errors = ini_get('display_errors'); -$log_errors = ini_get('log_errors'); +$log_errors = ini_get('log_errors'); echo '<pre>'; print_r($includes); @@ -136,11 +143,13 @@ echo '<hr />'; $options = array('lineFormat' => '<b>%1$s :</b> %2$s <br />%3$s', - 'contextFormat' => '<b>Function :</b> %3$s <br/><b>File :</b> %1$s <br /><b>Line :</b> %2$s <br/>' + 'contextFormat' => '<b>Function :</b> %3$s <br/>'. + '<b>File :</b> %1$s <br /><b>Line :</b> %2$s <br/>' ); -$myErrorHandler = new myErrorHandler($options); -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(&$myErrorHandler, 'errorCallback')); +$myErrorHandler = new MyErrorHandler($options); +PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, + array(&$myErrorHandler, 'errorCallback')); $css->setXhtmlCompliance('true'); // generate an API exception http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/CSS_parseData.php?r1=1.5&r2=1.6&diff_format=u Index: pear/HTML_CSS/examples/CSS_parseData.php diff -u pear/HTML_CSS/examples/CSS_parseData.php:1.5 pear/HTML_CSS/examples/CSS_parseData.php:1.6 --- pear/HTML_CSS/examples/CSS_parseData.php:1.5 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/CSS_parseData.php Mon Dec 10 10:48:33 2007 @@ -3,19 +3,34 @@ * Tell whether a value return by HTML_CSS is an error. * Solution to use HTML_CSS::isError() method. * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2005-2007 Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: CSS_parseData.php,v 1.5 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: CSS_parseData.php,v 1.6 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS * @since File available since Release 1.0.0RC2 + * @ignore */ require_once 'HTML/CSS.php'; +/** + * Replace default internal error handler. + * + * Always print rather than dies if the error is an exception. + * + * @param int $code a numeric error code. + * Valid are HTML_CSS_ERROR_* constants + * @param string $level error level ('exception', 'error', 'warning', ...) + * + * @return integer + * @ignore + */ function myErrorHandler($code, $level) { return PEAR_ERROR_PRINT; // always print all error messages @@ -53,7 +68,7 @@ "default.css" ); -$prefs = array( +$prefs = array( 'push_callback' => 'myErrorHandler', ); $attribs = null; @@ -62,9 +77,10 @@ $res = $css->parseData($styles); if ($css->isError($res)) { - $line = __LINE__ - 1; + $line = __LINE__ - 1; $style = 'background-color:red; color:yellow; font-weight:bold; padding:0.4em;'; - echo '<p style="'.$style.'">Error message detected by isError() at line ' . $line . '</p>'; + echo '<p style="'.$style.'">Error message detected by isError() at line ' . + $line . '</p>'; } print 'Still alive !'; ?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/examples/CSS_Stylesheet.php?r1=1.8&r2=1.9&diff_format=u Index: pear/HTML_CSS/examples/CSS_Stylesheet.php diff -u pear/HTML_CSS/examples/CSS_Stylesheet.php:1.8 pear/HTML_CSS/examples/CSS_Stylesheet.php:1.9 --- pear/HTML_CSS/examples/CSS_Stylesheet.php:1.8 Mon Oct 22 13:34:41 2007 +++ pear/HTML_CSS/examples/CSS_Stylesheet.php Mon Dec 10 10:48:33 2007 @@ -2,20 +2,22 @@ /** * Example to produces an external stylesheet declarations * + * PHP versions 4 and 5 + * * @category HTML * @package HTML_CSS * @subpackage Examples * @author Klaus Guenther <klaus@capitalfocus.org> * @author Laurent Laville <pear@laurent-laville.org> * @copyright 2003-2007 Klaus Guenther, Laurent Laville - * @license http://www.opensource.org/licenses/bsd-license.php New BSD License - * @version CVS: $Id: CSS_Stylesheet.php,v 1.8 2007/10/22 13:34:41 farell Exp $ + * @license http://www.opensource.org/licenses/bsd-license.php BSD + * @version CVS: $Id: CSS_Stylesheet.php,v 1.9 2007/12/10 10:48:33 farell Exp $ * @link http://pear.php.net/package/HTML_CSS + * @ignore */ require_once 'HTML/CSS.php'; - $css = new HTML_CSS(); // define styles
« previous php.pear.cvs (#49702) next »