Re: cvs: pear /Spreadsheet_Excel_Writer/Writer Worksheet.php
| From: | Helgi Þormar | Date: | Sat, 12 Nov 2005 04:50:14 +0000 |
| Subject: | Re: cvs: pear /Spreadsheet_Excel_Writer/Writer Worksheet.php | ||
| References: | 1 | Groups: | php.pear.cvs |
| Request: | Send a blank email to pear-cvs+get-36226@lists.php.net to get a copy of this message | ||
Hi,
I'm not sure what to say, more of the CS breakage here ... I know you have
some personal style, as we all do, but we try our best to follow the PEAR
one when we are working on PEAR projects and it would be nice if you could
follow us in that ... I saw you made a tiny revert so I see you are ready
to comply to the standard just you haven't reverted the rest and you still
commit code that isn't in pair with the CS.
Anyway good job and keep up with the bug fixing :)
On Sat, 12 Nov 2005 03:33:54 +0000, Xavier Noguer Gallego wrote:
> xnoguer Fri Nov 11 22:33:54 2005 EDT
>
> Modified files:
> /pear/Spreadsheet_Excel_Writer/Writer Worksheet.php
> Log:
> fixing bugs #5698 and #2823 for method writeUrl(). Cell ranges still
> don't work tough
>
>
>
> http://cvs.php.net/diff.php/pear/Spreadsheet_Excel_Writer/Writer/Worksheet.php?r1=1.34&r2=1.35&ty=u
> Index: pear/Spreadsheet_Excel_Writer/Writer/Worksheet.php diff -u
> pear/Spreadsheet_Excel_Writer/Writer/Worksheet.php:1.34
> pear/Spreadsheet_Excel_Writer/Writer/Worksheet.php:1.35 ---
> pear/Spreadsheet_Excel_Writer/Writer/Worksheet.php:1.34 Mon Nov 7
> 21:58:43 2005 +++ pear/Spreadsheet_Excel_Writer/Writer/Worksheet.php Fri
> Nov 11 22:33:54 2005 @@ -1935,7 +1935,7 @@
> }
>
> // Strip URL type
> - $url = preg_replace('[^internal:]', '', $url); + $url =
> preg_replace('/^internal:/', '', $url);
>
> // Write the visible label
> if ($str == '') {
> @@ -1998,82 +1998,94 @@
> if (preg_match('[^external:\\\\]', $url)) {
> return; //($this->_writeUrlExternal_net($row1, $col1,
> $row2, $col2, $url, $str, $format));
> }
> -
> +
> $record = 0x01B8; // Record
> identifier $length = 0x00000; //
> Bytes to follow
> -
> +
> if ($format == 0) {
> $format = $this->_url_format;
> }
> -
> +
> // Strip URL type and change Unix dir separator to Dos style
> (if needed) //
> - $url = preg_replace('[^external:]', '', $url); - $url =
> preg_replace('[/]', "\\", $url); -
> + $url = preg_replace('/^external:/', '', $url); + $url =
> preg_replace('/\//', "\\", $url); +
> // Write the visible label
> if ($str == '') {
> - $str = preg_replace('[\#]', ' - ', $url); + $str
> = preg_replace('/\#/', ' - ', $url);
> }
> $str_error = $this->writeString($row1, $col1, $str, $format);
> - if (($str_error == -2) || ($str_error == -3)) { + if
> (($str_error == -2) or ($str_error == -3)) {
> return $str_error;
> }
> -
> +
> // Determine if the link is relative or absolute: // relative
> if link contains no dir separator, "somefile.xls" // relative
> if link starts with up-dir, "..\..\somefile.xls" //
> otherwise, absolute
> -
> +
> $absolute = 0x02; // Bit mask
> - if (!preg_match('[\\]', $url)) { + if
> (!preg_match("/\\\/", $url)) {
> $absolute = 0x00;
> }
> - if (preg_match('[^\.\.\\]', $url)) { + if
> (preg_match("/^\.\.\\\/", $url)) {
> $absolute = 0x00;
> }
> -
> + $link_type = 0x01 | $absolute; +
> // Determine if the link contains a sheet reference and change
> some of the // parameters accordingly.
> // Split the dir name and sheet name (if it exists)
> - list($dir_long , $sheet) = split('/\#/', $url); -
> $link_type = 0x01 | $absolute; -
> + /*if (preg_match("/\#/", $url)) { + list($dir_long,
> $sheet) = split("\#", $url); + }
> + else {
> + $dir_long = $url;
> + }
> +
> if (isset($sheet)) {
> $link_type |= 0x08;
> $sheet_len = pack("V", strlen($sheet) + 0x01); $sheet
> = join("\0", split('', $sheet)); $sheet .=
> "\0\0\0";
> - } else {
> + }
> + else {
> $sheet_len = '';
> $sheet = '';
> + }*/
> + $dir_long = $url;
> + if (preg_match("/\#/", $url)) { + $link_type |=
> 0x08;
> }
>
> +
> +
> // Pack the link type
> $link_type = pack("V", $link_type);
> -
> +
> // Calculate the up-level dir count e.g.. (..\..\..\ == 3)
> - $up_count = preg_match_all("/\.\.\\/", $dir_long, $useless);
> + $up_count = preg_match_all("/\.\.\\\/", $dir_long,
> $useless);
> $up_count = pack("v", $up_count);
> -
> +
> // Store the short dos dir name (null terminated)
> - $dir_short = preg_replace('/\.\.\\/', '', $dir_long) .
> "\0";
> -
> + $dir_short = preg_replace("/\.\.\\\/", '', $dir_long) .
> "\0";
> +
> // Store the long dir name as a wchar string (non-null
> terminated)
> - $dir_long = join("\0", split('', $dir_long)); +
> //$dir_long = join("\0", split('', $dir_long));
> $dir_long = $dir_long . "\0";
> -
> +
> // Pack the lengths of the dir strings $dir_short_len =
> pack("V", strlen($dir_short) ); $dir_long_len = pack("V",
> strlen($dir_long) );
> - $stream_len = pack("V", strlen($dir_long) + 0x06); -
> + $stream_len = pack("V", 0);//strlen($dir_long) + 0x06); +
> // Pack the undocumented parts of the hyperlink stream
> $unknown1 =
> pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000' );
> $unknown2 = pack("H*",'0303000000000000C000000000000046'
> ); $unknown3 =
> pack("H*",'FFFFADDE000000000000000000000000000000000000000');
> $unknown4 = pack("v", 0x03
> );
> -
> +
> // Pack the main data stream
> $data = pack("vvvv", $row1, $row2, $col1, $col2) .
> $unknown1 .
> @@ -2083,17 +2095,17 @@
> $dir_short_len.
> $dir_short .
> $unknown3 .
> - $stream_len . +
> $stream_len ;/*.
> $dir_long_len .
> $unknown4 .
> $dir_long .
> $sheet_len .
> - $sheet ; -
> + $sheet ;*/ +
> // Pack the header data
> $length = strlen($data);
> $header = pack("vv", $record, $length);
> -
> +
> // Write the packed data
> $this->_append($header. $data);
> return($str_error);