Php FeedWriter Version 3.1 Update

September 12th, 2011
by Daniel Soutter

Php FeedWriter has been updated to fix some bugs noted by users of the package.  To download the updated version (3.1) of Php FeedWriter, please visit the downloads page.

Summary of the changes made in version 3.1:

1. Changed require_once() paths to use the current file path and path separator (Required for compatibility on both Unix and Windows platforms).

 

2. Incorporated character encoding for output of the feed when using htmlentities() to help control output.  Configurable via the FeedWriter class constructor.

Change #2 is a fix for this bug that was found in the class causing a feed to break when certain characters were no encoded properly.  The value of the $encode_as (6th) parameter passed to the FeedWriter constructor is now used in certain circumstances depending on the data type being outputted when writing the feed XML.

 

Manual Update / Installation:

If you are using a modified version of the Php FeedWriter package for your feed(s), you can apply the updates manually using the following instructions.  These instructions are also available in the “Manual Update_Change Log.txt” file included in this version of the package download.

To find the lines or blocks of code that have been changed in this version, line numbers for code that was modified from v3.0.2 have been included below.  Please refer to files the v3.0.2 package to help find the corresponding sections in your modified versions of each file.

1.1 __ FeedWriter.php

Line 32 (single line update):

require_once('FeedWriter/constants.php');

Change to:

require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'FeedWriter'.DIRECTORY_SEPARATOR.'constants.php');

 

1.2 __ FeedWriter.php

Line 283 (single line update):

		require_once('FeedWriter/FeedConstruct.php');

Change to:

		require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'FeedWriter'.DIRECTORY_SEPARATOR.'FeedConstruct.php');

 

1.3 __ FeedConstruct.php (in ‘FeedWriter’ directory)

Line 33 (single line update):

require_once('FeedWriter/constants.php');

Change to:

require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'constants.php');

 

2.1 __ FeedWriter.php

Lines 1702 to 1707 (block update [part of switch statement] some additional lines included to help find the lines to be updated):

					case $construct['type'] == 'string' && $this->feedSpecs['useCDATA']:
						$writer->writeCData(htmlentities($data));
						break;
					case $construct['type'] == 'string' && !$this->feedSpecs['useCDATA']:
						$writer->writeRaw(htmlentities($data));
						break;

Change to:

					case $construct['type'] == 'string' && $this->feedSpecs['useCDATA']:
					if($this->feedSpecs['xmlEncodeAs'] != null)
							$writer->writeCData(htmlentities($data, ENT_COMPAT, $this->feedSpecs['xmlEncodeAs']));
						else
							$writer->writeCData(htmlentities($data));
						break;
					case $construct['type'] == 'string' && !$this->feedSpecs['useCDATA']:
						if($this->feedSpecs['xmlEncodeAs'] != null)
							$writer->writeRaw(htmlentities($data, ENT_COMPAT, $this->feedSpecs['xmlEncodeAs']));
						else
							$writer->writeRaw(htmlentities($data));
						break;

Tags: ,
Posted in FeedWriter Class, writeConstruct(), __construct() | Comments (0)

  • Php FeedWriter (c) Copyright 2011 Daniel Soutter. Php FeedWriter and the information on this site has been designed to benefit website developers, owners and users, but may contain errors and is provided as is, with no warranty. Terms.