Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-php/PEAR-HTML_Template_IT/, dev-php/PEAR-HTML_Template_IT/files/
Date: Tue, 01 Aug 2017 20:49:58
Message-Id: 1501620516.6ccd06e762e337e48fc2c39e235c9f1238f95bd7.grknight@gentoo
1 commit: 6ccd06e762e337e48fc2c39e235c9f1238f95bd7
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 1 20:48:05 2017 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 1 20:48:36 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ccd06e7
7
8 dev-php/PEAR-HTML_Template_IT: Revbump to add modern patches
9
10 Replace /e in preg_replace with preg_replace_callback
11 Use PHP5 constructors
12
13 Package-Manager: Portage-2.3.6, Repoman-2.3.3
14
15 .../PEAR-HTML_Template_IT-1.3.0-r1.ebuild | 32 +++++++++++
16 .../PEAR-HTML_Template_IT/files/constructor.patch | 62 ++++++++++++++++++++++
17 .../files/preg-callback.patch | 17 ++++++
18 3 files changed, 111 insertions(+)
19
20 diff --git a/dev-php/PEAR-HTML_Template_IT/PEAR-HTML_Template_IT-1.3.0-r1.ebuild b/dev-php/PEAR-HTML_Template_IT/PEAR-HTML_Template_IT-1.3.0-r1.ebuild
21 new file mode 100644
22 index 00000000000..c60b49c2ffd
23 --- /dev/null
24 +++ b/dev-php/PEAR-HTML_Template_IT/PEAR-HTML_Template_IT-1.3.0-r1.ebuild
25 @@ -0,0 +1,32 @@
26 +# Copyright 1999-2017 Gentoo Foundation
27 +# Distributed under the terms of the GNU General Public License v2
28 +
29 +EAPI=6
30 +
31 +inherit php-pear-r2
32 +
33 +DESCRIPTION="Integrated Templates"
34 +LICENSE="BSD"
35 +SLOT="0"
36 +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~x86"
37 +IUSE="examples test"
38 +DEPEND="test? ( dev-php/phpunit ${RDEPEND} )"
39 +
40 +src_prepare() {
41 + eapply "${FILESDIR}/preg-callback.patch" \
42 + "${FILESDIR}/constructor.patch"
43 + eapply_user
44 +}
45 +
46 +src_install() {
47 + use examples && HTML_DOCS=(
48 + examples/sample_it.php
49 + examples/sample_itx_addblockfile.php
50 + examples/templates/
51 + )
52 + php-pear-r2_src_install
53 +}
54 +
55 +src_test() {
56 + phpunit tests/AllTests.php || die
57 +}
58
59 diff --git a/dev-php/PEAR-HTML_Template_IT/files/constructor.patch b/dev-php/PEAR-HTML_Template_IT/files/constructor.patch
60 new file mode 100644
61 index 00000000000..61d54eab4e2
62 --- /dev/null
63 +++ b/dev-php/PEAR-HTML_Template_IT/files/constructor.patch
64 @@ -0,0 +1,62 @@
65 +diff -aurN a/HTML/Template/IT_Error.php b/HTML/Template/IT_Error.php
66 +--- a/HTML/Template/IT_Error.php 2010-03-10 03:08:10.000000000 -0500
67 ++++ b/HTML/Template/IT_Error.php 2017-08-01 16:44:31.257269180 -0400
68 +@@ -58,8 +58,11 @@
69 + */
70 + function IT_Error($msg, $file = __FILE__, $line = __LINE__)
71 + {
72 ++ $this->__construct($msg, $file, $line);
73 ++ }
74 ++ function __construct($msg, $file = __FILE__, $line = __LINE__)
75 ++ {
76 + $this->PEAR_Error(sprintf("%s [%s on line %d].", $msg, $file, $line));
77 + } // end func IT_Error
78 +
79 + } // end class IT_Error
80 +-?>
81 +diff -aurN a/HTML/Template/IT.php b/HTML/Template/IT.php
82 +--- a/HTML/Template/IT.php 2017-08-01 16:40:29.822907534 -0400
83 ++++ b/HTML/Template/IT.php 2017-08-01 16:44:46.515860952 -0400
84 +@@ -409,6 +409,10 @@
85 + */
86 + function HTML_Template_IT($root = '', $options = null)
87 + {
88 ++ $this->__construct($root, $options);
89 ++ }
90 ++ function __construct($root = '', $options = null)
91 ++ {
92 + if (!is_null($options)) {
93 + $this->setOptions($options);
94 + }
95 +@@ -1184,4 +1188,3 @@
96 + $errorMessages[$value] : $errorMessages[IT_ERROR];
97 + }
98 + } // end class IntegratedTemplate
99 +-?>
100 +diff -aurN a/HTML/Template/ITX.php b/HTML/Template/ITX.php
101 +--- a/HTML/Template/ITX.php 2010-03-10 03:08:10.000000000 -0500
102 ++++ b/HTML/Template/ITX.php 2017-08-01 16:44:41.185654236 -0400
103 +@@ -138,13 +138,17 @@
104 + */
105 + function HTML_Template_ITX($root = '')
106 + {
107 ++ $this->__construct($root);
108 ++ }
109 ++ function __construct($root = '')
110 ++ {
111 +
112 + $this->checkblocknameRegExp = '@' . $this->blocknameRegExp . '@';
113 +
114 + $this->functionRegExp = '@' . $this->functionPrefix . '(' .
115 + $this->functionnameRegExp . ')\s*\(@sm';
116 +
117 +- $this->HTML_Template_IT($root);
118 ++ parent::__construct($root);
119 + } // end func constructor
120 +
121 + /**
122 +@@ -886,4 +890,3 @@
123 + } // end func warning
124 +
125 + } // end class HTML_Template_ITX
126 +-?>
127
128 diff --git a/dev-php/PEAR-HTML_Template_IT/files/preg-callback.patch b/dev-php/PEAR-HTML_Template_IT/files/preg-callback.patch
129 new file mode 100644
130 index 00000000000..60ae20af189
131 --- /dev/null
132 +++ b/dev-php/PEAR-HTML_Template_IT/files/preg-callback.patch
133 @@ -0,0 +1,17 @@
134 +diff -aurN a/HTML/Template/IT.php b/HTML/Template/IT.php
135 +--- a/HTML/Template/IT.php 2010-03-10 03:08:10.000000000 -0500
136 ++++ b/HTML/Template/IT.php 2017-08-01 15:12:31.161235223 -0400
137 +@@ -1088,9 +1088,10 @@
138 + $content = fread($fh, $fsize);
139 + fclose($fh);
140 +
141 +- return preg_replace(
142 +- "#<!-- INCLUDE (.*) -->#ime",
143 +- "\$this->getFile('\\1')",
144 ++ return preg_replace_callback(
145 ++ "#<!-- INCLUDE (.*) -->#im",
146 ++ function($matches) {
147 ++ return $this->getFile($matches[1]); },
148 + $content
149 + );
150 + } // end func getFile