dev-php/PEAR-HTML_TreeMenu: Add modern-syntax patch

Package-Manager: Portage-2.3.6, Repoman-2.3.3
This commit is contained in:
Brian Evans
2017-08-04 15:38:22 -04:00
parent 09e29b80aa
commit 174d3e8bf4
2 changed files with 146 additions and 0 deletions
@@ -11,6 +11,8 @@ SLOT="0"
KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
IUSE=""
PATCHES=( "${FILESDIR}/modern-syntax.patch" )
src_install() {
php-pear-r2_src_install
docinto html
@@ -0,0 +1,144 @@
diff -aurN a/HTML/TreeMenu.php b/HTML/TreeMenu.php
--- a/HTML/TreeMenu.php 2010-10-25 05:10:46.000000000 -0400
+++ b/HTML/TreeMenu.php 2017-08-04 15:25:16.730007135 -0400
@@ -83,6 +83,9 @@
*
* @access public
*/
+ function __construct()
+ {
+ }
function HTML_TreeMenu()
{
// Not much to do here :(
@@ -206,7 +209,7 @@
case 'heyes_array':
// Need to create a HTML_TreeMenu object ?
if (!isset($params['treeMenu'])) {
- $treeMenu = &new HTML_TreeMenu();
+ $treeMenu = new HTML_TreeMenu();
$parentID = 0;
} else {
$treeMenu = &$params['treeMenu'];
@@ -240,7 +243,7 @@
default:
// Need to create a HTML_TreeMenu object ?
if (!isset($params['treeMenu'])) {
- $treeMenu = &new HTML_TreeMenu();
+ $treeMenu = new HTML_TreeMenu();
} else {
$treeMenu = &$params['treeMenu'];
}
@@ -312,7 +315,7 @@
if (is_string($xml)) {
// Supplied $xml is a string
include_once 'XML/Tree.php';
- $xmlTree = &new XML_Tree();
+ $xmlTree = new XML_Tree();
$xmlTree->getTreeFromString($xml);
} else {
// Supplied $xml is an XML_Tree object
@@ -469,7 +472,7 @@
*
* @access public
*/
- function HTML_TreeNode($options = array(), $events = array())
+ function __construct($options = array(), $events = array())
{
$this->text = '';
$this->link = '';
@@ -488,7 +491,10 @@
$this->$option = $value;
}
}
-
+ function HTML_TreeNode($options = array(), $events = array())
+ {
+ self::__construct($options, $events);
+ }
/**
* Allows setting of various parameters after the initial constructor call
*
@@ -585,11 +591,14 @@
*
* @param HTML_TreeMenu &$structure The menu structure
*/
- function HTML_TreeMenu_Presentation(&$structure)
+ function __construct(&$structure)
{
$this->menu = &$structure;
}
-
+ function HTML_TreeMenu_Presentation(&$structure)
+ {
+ self::__construct($structure);
+ }
/**
* Prints the HTML generated by the toHTML() method.
* toHTML() must therefore be defined by the derived
@@ -715,7 +724,7 @@
*
* @access public
*/
- function HTML_TreeMenu_DHTML(&$structure, $options = array(), $isDynamic = true)
+ function __construct(&$structure, $options = array(), $isDynamic = true)
{
$this->HTML_TreeMenu_Presentation($structure);
$this->isDynamic = $isDynamic;
@@ -733,7 +742,10 @@
$this->$option = $value;
}
}
-
+ function HTML_TreeMenu_DHTML(&$structure, $options = array(), $isDynamic = true)
+ {
+ self::__construct($structure, $options, $isDynamic);
+ }
/**
* Returns the HTML for the menu.
*
@@ -920,7 +932,7 @@
*
* @access public
*/
- function HTML_TreeMenu_Listbox($structure, $options = array())
+ function __construct($structure, $options = array())
{
$this->HTML_TreeMenu_Presentation($structure);
@@ -934,7 +946,10 @@
$this->$option = $value;
}
}
-
+ function HTML_TreeMenu_Listbox($structure, $options = array())
+ {
+ self::__construct($structure, $options);
+ }
/**
* Returns the HTML generated
*
diff -aurN a/tests/testBug_9750.phpt b/tests/testBug_9750.phpt
--- a/tests/testBug_9750.phpt 2010-10-25 05:10:46.000000000 -0400
+++ b/tests/testBug_9750.phpt 2017-08-04 15:27:53.691108758 -0400
@@ -44,17 +44,17 @@
'nodeOptions' => $nodeOptions
);
-$menu = &HTML_TreeMenu::createFromStructure($options);
+$menu = HTML_TreeMenu::createFromStructure($options);
// Chose a generator. You can generate DHTML or a Listbox
-$dhtml = &new HTML_TreeMenu_DHTML(
+$dhtml = new HTML_TreeMenu_DHTML(
$menu,
array(
'images' => 'images',
'defaultClass' => 'treeMenuDefault'
)
);
-$listbox = &new HTML_TreeMenu_ListBox(
+$listbox = new HTML_TreeMenu_ListBox(
$menu,
array(
'images' => 'images',