From f0fda226610166bcb313f6d1c6a963d9b9e1f94c Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 28 Apr 2022 10:10:54 +0200 Subject: [PATCH] constructors are named __construct for php8 --- planetlab/includes/plc_objects.php | 12 ++-- planetlab/includes/plc_peers.php | 6 +- planetlab/includes/plc_session.php | 2 +- planetlab/includes/plc_visibletags.php | 84 ------------------------- planetlab/includes/plc_visibletags2.php | 4 +- plekit/php/columns.php | 2 +- plekit/php/datepicker.php | 4 +- plekit/php/details.php | 2 +- plekit/php/form.php | 4 +- plekit/php/table.php | 2 +- plekit/php/table2.php | 2 +- plekit/php/toggle.php | 2 +- plekit/php/tophat_api.php | 2 +- 13 files changed, 22 insertions(+), 106 deletions(-) delete mode 100644 planetlab/includes/plc_visibletags.php diff --git a/planetlab/includes/plc_objects.php b/planetlab/includes/plc_objects.php index 27ca475..d726d5f 100644 --- a/planetlab/includes/plc_objects.php +++ b/planetlab/includes/plc_objects.php @@ -69,7 +69,7 @@ class Person { var $email; var $enabled; - function Person($person) { + function __construct($person) { $this->roles = $person['role_ids']; $this->person_id = $person['person_id']; $this->first_name = $person['first_name']; @@ -136,7 +136,7 @@ class Person { class PCU { var $data; - function PCU($pcu) { + function __construct($pcu) { $this->data = $pcu; } @@ -169,7 +169,7 @@ class PCU { class Address { var $data; - function Address($address) { + function __construct($address) { $this->data = $address; } @@ -204,7 +204,7 @@ class Node extends PlcObject { var $pcu_ids; var $data; - function Node($node) { + function __construct($node) { global $plc, $api, $adm; $this->data = $node; $this->node_type = $node['node_type']; @@ -318,7 +318,7 @@ class Node extends PlcObject { class Slice { var $data; - function Slice($val) { + function __construct($val) { $this->data = $val; } @@ -349,7 +349,7 @@ class Site extends PlcObject { var $site_id; var $data; - function Site($site_id) { + function __construct($site_id) { global $plc, $api, $adm; $site_info= $adm->GetSites( array( intval($site_id) ) ); $this->data = $site_info[0]; diff --git a/planetlab/includes/plc_peers.php b/planetlab/includes/plc_peers.php index 6fa26ca..a4a4dda 100644 --- a/planetlab/includes/plc_peers.php +++ b/planetlab/includes/plc_peers.php @@ -9,8 +9,8 @@ drupal_set_html_head(' PLC_NAME, @@ -110,7 +110,7 @@ class PeerScope { var $filter; var $label; - function PeerScope ($api, $peerscope) { + function __construct ($api, $peerscope) { switch ($peerscope) { case '': $this->filter=array(); diff --git a/planetlab/includes/plc_session.php b/planetlab/includes/plc_session.php index 4c42375..7850d86 100644 --- a/planetlab/includes/plc_session.php +++ b/planetlab/includes/plc_session.php @@ -48,7 +48,7 @@ class PLCSession var $alt_person; var $alt_auth; - function PLCSession($name = NULL, $pass = NULL) + function __construct($name = NULL, $pass = NULL) { $name= strtolower( $name ); // User API access diff --git a/planetlab/includes/plc_visibletags.php b/planetlab/includes/plc_visibletags.php deleted file mode 100644 index 0d45bb8..0000000 --- a/planetlab/includes/plc_visibletags.php +++ /dev/null @@ -1,84 +0,0 @@ -api=$api; - $this->type=$type; - $this->columns=NULL; - } - - // returns an ordered set of columns - compute only once - function columns () { - # if cached - if ($this->columns != NULL) - return $this->columns; - - // scan tag types to find relevant additional columns - $tag_types = $this->api->GetTagTypes(array('category'=>"$type*/ui*")); - - $columns = array(); - foreach ($tag_types as $tag_type) { - $tagname=$tag_type['tagname']; - $column=array(); - $column['tagname']=$tagname; - // defaults - $column['header']=$tagname; - $column['rank']=$tagname; - $column['type']='string'; - $column['description']=$tag_type['description']; - // split category and parse any setting - $category_tokens=explode('/',$tag_type['category']); - foreach ($category_tokens as $token) { - $assign=explode('=',$token); - if (count($assign)==2) - $column[$assign[0]]=$assign[1]; - } - $columns []= $column; - } - - // sort upon 'rank' - usort ($columns, create_function('$col1,$col2','return strcmp($col1["rank"],$col2["rank"]);')); - - # cache for next time - $this->columns=$columns; -// plc_debug('columns',$columns); - return $columns; - } - - // extract tagname - function column_names () { - return array_map(create_function('$tt','return $tt["tagname"];'),$this->columns()); - } - - // to add with array_merge to the headers part of the Plekit Table - function headers () { - $headers=array(); - $columns=$this->columns(); - foreach ($columns as $column) - if ($column['header'] == $column['tagname']) - $headers[$column['header']]=$column['type']; - else - $headers[$column['header']]=array('type'=>$column['type'],'title'=>$column['description']); - return $headers; - } - - // to add with array_merge to the notes part of the Plekit Table - function notes () { - $notes=array(); - $columns=$this->columns(); - foreach ($columns as $column) - if ($column['header'] != $column['tagname']) - $notes []= strtoupper($column['header']) . ' = ' . $column['description']; - return $notes; - } - -} -?> diff --git a/planetlab/includes/plc_visibletags2.php b/planetlab/includes/plc_visibletags2.php index e0aad8f..8bcdb81 100644 --- a/planetlab/includes/plc_visibletags2.php +++ b/planetlab/includes/plc_visibletags2.php @@ -8,8 +8,8 @@ class VisibleTags { var $api; var $type; - - function VisibleTags ($api,$type) { + + function __construct ($api,$type) { $this->api=$api; $this->type=$type; $this->columns=NULL; diff --git a/plekit/php/columns.php b/plekit/php/columns.php index 3cab960..e75e4b4 100644 --- a/plekit/php/columns.php +++ b/plekit/php/columns.php @@ -31,7 +31,7 @@ var $table_ids; var $HopCount = array(); var $RTT = array(); -function PlekitColumns ($column_configuration, $fix_columns, $tag_columns, $extra_columns=NULL, $this_table_headers=NULL) { +function __construct ($column_configuration, $fix_columns, $tag_columns, $extra_columns=NULL, $this_table_headers=NULL) { if ($column_configuration != NULL) { $this->fix_columns = $fix_columns; diff --git a/plekit/php/datepicker.php b/plekit/php/datepicker.php index 7a983f8..9460e8b 100644 --- a/plekit/php/datepicker.php +++ b/plekit/php/datepicker.php @@ -18,8 +18,8 @@ class PlekitDatepicker { var $id; - function PlekitDatepicker ($id,$display,$options=NULL) { - $datepicker_default_options = + function __construct ($id,$display,$options=NULL) { + $datepicker_default_options = array ('inline'=>true, 'format'=>'Y-sl-M-sl-d', 'value'=>''); diff --git a/plekit/php/details.php b/plekit/php/details.php index e9cbc39..72d1f6a 100644 --- a/plekit/php/details.php +++ b/plekit/php/details.php @@ -32,7 +32,7 @@ class PlekitDetails { var $height; var $input_type; - function PlekitDetails ($editable) { + function __construct ($editable) { $this->editable=$editable; $this->form=NULL; $this->width=""; diff --git a/plekit/php/form.php b/plekit/php/form.php index f56f02a..6436172 100644 --- a/plekit/php/form.php +++ b/plekit/php/form.php @@ -16,7 +16,7 @@ class PlekitForm { var $onSubmit; // can be set with options var $onReset; // can be set with options - function PlekitForm ($full_url, $values, $options=NULL) { + function __construct ($full_url, $values, $options=NULL) { // so we can use the various l_* functions: // we parse the url to extract var-values pairs, // and add them to the 'values' argument if any @@ -160,7 +160,7 @@ class PlekitFormButton extends PlekitForm { var $button_id; var $button_text; - function PlekitFormButton ($full_url, $button_id, $button_text, $method="POST") { + function __construct ($full_url, $button_id, $button_text, $method="POST") { $this->PlekitForm($full_url,array(),$method); $this->button_id=$button_id; $this->button_text=$button_text; diff --git a/plekit/php/table.php b/plekit/php/table.php index dc5bd8e..2e75dac 100644 --- a/plekit/php/table.php +++ b/plekit/php/table.php @@ -60,7 +60,7 @@ class PlekitTable { // internal var $has_tfoot; - function PlekitTable ($table_id,$headers,$sort_column,$options=NULL) { + function __construct ($table_id,$headers,$sort_column,$options=NULL) { $this->table_id = $table_id; $this->headers = $headers; $this->sort_column = $sort_column; diff --git a/plekit/php/table2.php b/plekit/php/table2.php index 094c3f2..d3b6849 100644 --- a/plekit/php/table2.php +++ b/plekit/php/table2.php @@ -61,7 +61,7 @@ class PlekitTable { // internal var $has_tfoot; - function PlekitTable ($table_id,$headers,$sort_column,$options=NULL) { + function __construct ($table_id,$headers,$sort_column,$options=NULL) { $this->table_id = $table_id; $this->headers = $headers; $this->sort_column = $sort_column; diff --git a/plekit/php/toggle.php b/plekit/php/toggle.php index b481195..014be9e 100644 --- a/plekit/php/toggle.php +++ b/plekit/php/toggle.php @@ -37,7 +37,7 @@ class PlekitToggle { var $id; var $nifty; - function PlekitToggle ($id,$trigger,$options=NULL) { + function __construct ($id,$trigger,$options=NULL) { $this->id = $id; $this->trigger=$trigger; if ( ! $options ) $options = array(); diff --git a/plekit/php/tophat_api.php b/plekit/php/tophat_api.php index 3ce485d..4e690c5 100644 --- a/plekit/php/tophat_api.php +++ b/plekit/php/tophat_api.php @@ -21,7 +21,7 @@ class TopHatAPI var $calls; var $multicall; - function TopHatAPI($auth = NULL, + function __construct($auth = NULL, $server = TOPHAT_API_HOST, $port = TOPHAT_API_PORT, $path = TOPHAT_API_PATH, -- 2.43.0