git://git.onelab.eu
/
plewww.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1b2fa7f
)
lambdas and create_function
author
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Fri, 29 Apr 2022 11:14:06 +0000
(13:14 +0200)
committer
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Fri, 29 Apr 2022 11:14:06 +0000
(13:14 +0200)
planetlab/events/events.php
patch
|
blob
|
history
planetlab/includes/plc_functions.php
patch
|
blob
|
history
planetlab/includes/plc_visibletags2.php
patch
|
blob
|
history
planetlab/persons/register.php
patch
|
blob
|
history
planetlab/slices/slice.php
patch
|
blob
|
history
plekit/php/columns.php
patch
|
blob
|
history
diff --git
a/planetlab/events/events.php
b/planetlab/events/events.php
index
8d248d1
..
5156d2b
100644
(file)
--- a/
planetlab/events/events.php
+++ b/
planetlab/events/events.php
@@
-224,8
+224,8
@@
if ($type == 'Event') {
$event_objs = $api->GetEventObjects(array('object_id'=>$object_ids,'object_type'=>$object_type),array('event_id'));
// get set of event_ids
$event_objs = $api->GetEventObjects(array('object_id'=>$object_ids,'object_type'=>$object_type),array('event_id'));
// get set of event_ids
- $event_ids = array_map (
create_function ('$eo','return $eo["event_id"];')
, $event_objs);
-
+ $event_ids = array_map (
function ($eo) {return $eo["event_id"];}
, $event_objs);
+
$events = $api->GetEvents (array('event_id'=>$event_ids));
// see actual display of $title and $events below
$events = $api->GetEvents (array('event_id'=>$event_ids));
// see actual display of $title and $events below
diff --git
a/planetlab/includes/plc_functions.php
b/planetlab/includes/plc_functions.php
index
2de3085
..
87a8810
100644
(file)
--- a/
planetlab/includes/plc_functions.php
+++ b/
planetlab/includes/plc_functions.php
@@
-317,15
+317,18
@@
function plc_role_global_hash ($api) {
}
// because GetRoles does not correctly support filters, it's really painful to do this
}
// because GetRoles does not correctly support filters, it's really painful to do this
-function sort_roles ($r1, $r2) { return $r2['role_id'] - $r1['role_id']; }
function roles_except ($roles, $exception_ids) {
$result=array();
function roles_except ($roles, $exception_ids) {
$result=array();
- if ($roles) foreach ($roles as $role) {
+ if ($roles)
+ foreach ($roles as $role) {
if ( ! in_array ($role['role_id'],$exception_ids) ) {
$result[]=$role;
}
}
if ( ! in_array ($role['role_id'],$exception_ids) ) {
$result[]=$role;
}
}
- usort($result,sort_roles);
+
+ usort($result,
+ function ($r1, $r2) { return $r2['role_id'] - $r1['role_id']; }
+ );
return $result;
}
return $result;
}
diff --git
a/planetlab/includes/plc_visibletags2.php
b/planetlab/includes/plc_visibletags2.php
index
8cdc1d9
..
6120b36
100644
(file)
--- a/
planetlab/includes/plc_visibletags2.php
+++ b/
planetlab/includes/plc_visibletags2.php
@@
-45,7
+45,7
@@
class VisibleTags {
}
// sort upon 'rank'
}
// sort upon 'rank'
- usort ($columns,
create_function('$col1,$col2','return strcmp($col1["header"],$col2["header"]);')
);
+ usort ($columns,
function($col1, $col2) { return strcmp($col1["header"],$col2["header"]); }
);
# cache for next time
$this->columns=$columns;
# cache for next time
$this->columns=$columns;
@@
-56,7
+56,8
@@
class VisibleTags {
// extract tagname
function column_names () {
// extract tagname
function column_names () {
- return array_map(create_function('$tt','return $tt["tagname"];'),$this->columns());
+ return array_map(function($tt) {return $tt["tagname"];},
+ $this->columns());
}
// to add with array_merge to the headers part of the Plekit Table
}
// to add with array_merge to the headers part of the Plekit Table
diff --git
a/planetlab/persons/register.php
b/planetlab/persons/register.php
index
db2b44f
..
f5ab63e
100644
(file)
--- a/
planetlab/persons/register.php
+++ b/
planetlab/persons/register.php
@@
-101,8
+101,9
@@
foreach ($person_form as $name => $item) {
// Filter out "Select a site"
if (!empty($person['site_ids'])) {
// Filter out "Select a site"
if (!empty($person['site_ids'])) {
- $person['site_ids'] = array_filter($person['site_ids'],
- create_function('$site_id', 'return intval($site_id) > 0;'));
+ $person['site_ids'] = array_filter(
+ $person['site_ids'],
+ function($site_id, {return intval($site_id) > 0;}))
}
//////////////////// minimal checking
}
//////////////////// minimal checking
diff --git
a/planetlab/slices/slice.php
b/planetlab/slices/slice.php
index
3564a16
..
b194194
100644
(file)
--- a/
planetlab/slices/slice.php
+++ b/
planetlab/slices/slice.php
@@
-652,7
+652,7
@@
$toggle_nodes=new PlekitToggle('my-slice-nodes-configuration',
'info-visible'=>$show_layout_info));
$toggle_nodes->start();
'info-visible'=>$show_layout_info));
$toggle_nodes->start();
-//usort ($table_headers,
create_function('$col1,$col2','return strcmp($col1["header"],$col2["header"]);'
));
+//usort ($table_headers,
function($col1, $col2) {return strcmp($col1["header"],$col2["header"]);}
));
//print("<p>TABLE HEADERS<p>");
//print_r($table_headers);
//print("<p>TABLE HEADERS<p>");
//print_r($table_headers);
diff --git
a/plekit/php/columns.php
b/plekit/php/columns.php
index
736d09c
..
ac8e41f
100644
(file)
--- a/
plekit/php/columns.php
+++ b/
plekit/php/columns.php
@@
-78,7
+78,8
@@
else
$tmp_headers[$headerId]=array('header'=>$headerId,'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'],'visible'=>false, 'source'=>'myplc');
}
$tmp_headers[$headerId]=array('header'=>$headerId,'type'=>$column['type'],'tagname'=>$column['tagname'],'title'=>$column['title'], 'description'=>$column['title'], 'label'=>$column['header'],'visible'=>false, 'source'=>'myplc');
}
-usort ($tmp_headers, create_function('$col1,$col2','return strcmp($col1["label"],$col2["label"]);'));
+usort ($tmp_headers,
+ function($col1, $col2) {return strcmp($col1["label"], $col2["label"]);});
foreach ($tmp_headers as $t)
$this->all_headers[$t['header']] = $t;
foreach ($tmp_headers as $t)
$this->all_headers[$t['header']] = $t;