CVS: phpweather/output pw_output.php,NONE,1.1 pw_images.php,1.7,1.8 p...
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2003-03-05 19:53:28
|
Update of /cvsroot/phpweather/phpweather/output In directory sc8-pr-cvs1:/tmp/cvs-serv16311 Modified Files: pw_images.php pw_text.php Added Files: pw_output.php Log Message: This should fix bug #613963 at SourceForge. The problem was, that pw_text_xx and pw_images always used the default settings, and refused to react to settings in the phpweather object they used. You can now control things by first setting defaults in defaults.php, second by giving the phpweather object an array with settings when it's created, and third by overriding the previous settings by giving pw_text_xx or pw_images an array with settings upon creation. --- NEW FILE --- <?php require_once(PHPWEATHER_BASE_DIR . '/base_object.php'); /** * Base class for other classes that produce output. * * This class is responsible for saving the phpweather object and for * initializing the properties from that object. * * @author Martin Geisler <gim...@gi...> * @version $Id: pw_output.php,v 1.1 2003/03/05 19:53:23 gimpster Exp $ */ class pw_output extends base_object { var $weather = null; function pw_output($weather, $input = array()) { $this->weather = $weather; $this->properties = $weather->properties; while (list($key, $value) = each($input)) { $this->properties[$key] = $value; } /* No need to call the constructor in base_object, as it will only * waste time by calling include() --- we've already gotten our * properties form the $weather object. */ } } ?> Index: pw_images.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/output/pw_images.php,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- pw_images.php 21 Jan 2003 22:27:28 -0000 1.7 +++ pw_images.php 5 Mar 2003 19:53:23 -0000 1.8 @@ -1,6 +1,6 @@ <?php -require_once(PHPWEATHER_BASE_DIR . '/base_object.php'); +require_once(PHPWEATHER_BASE_DIR . '/output/pw_output.php'); /* Copyright (c) 2002 Raymond van Beek <ra...@de...>. Licensed under the GPL, see the file COPYING. @@ -16,7 +16,7 @@ for updates and further instructions on how to use PHP Weather. */ -class pw_images extends base_object { +class pw_images extends pw_output { var $itime = ''; @@ -219,22 +219,15 @@ // ------------------------------------------------------------------------ /** - * This is where the object with the weather is stored. + * Constructs a new image output object. * - * @var phpweather $weather + * @param phpweather The object with the weather. + * @access public */ - var $weather = null; - - - function pw_images($w, $input = array()) { - - $this->weather = $w; - - /* We call the parent constructor. */ - $this->base_object($input); - + function pw_images($weather, $input = array()) { + /* We just call the parent constructor. */ + $this->pw_output($weather, $input); } - // The get_sky_image() function takes the processed metar data and Index: pw_text.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/output/pw_text.php,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- pw_text.php 20 Oct 2002 15:57:15 -0000 1.16 +++ pw_text.php 5 Mar 2003 19:53:24 -0000 1.17 @@ -1,6 +1,6 @@ <?php -require_once(PHPWEATHER_BASE_DIR . '/base_object.php'); +require_once(PHPWEATHER_BASE_DIR . '/output/pw_output.php'); /** * Provides all the function needed to generate text output. @@ -15,7 +15,7 @@ * @author Martin Geisler <gim...@gi...> * @version $Id$ */ -class pw_text extends base_object { +class pw_text extends pw_output { /** * The strings used in the translation are stored here. @@ -28,12 +28,6 @@ */ var $strings = array(); - /** - * This is where the object with the weather is stored. - * - * @var phpweather $weather - */ - var $weather = null; /** * Constructor. @@ -45,11 +39,9 @@ * @param phpweather The object with the weather. * @access public */ - function pw_text($w, $input = array()) { - $this->weather = $w; - - /* We call the parent constructor. */ - $this->base_object($input); + function pw_text($weather, $input = array()) { + /* We just call the parent constructor. */ + $this->pw_output($weather, $input); } /** |