Permalink
Browse files

Replace create_function

Replace all uses of create_function with anonymouse function
  • Loading branch information...
tim-pearce committed Dec 28, 2017
1 parent 3926d3e commit 97b9bda8ef00806a63b5cf3c1153620878ebcd59
@@ -47,7 +47,7 @@ protected static function _getFields()
'default' => $GLOBALS['user_system']->getCurrentUser('id'),
'note' => 'Choose the user responsible for acting on this note',
'allow_empty' => true,
'filter' => create_function('$x', 'return $x->getValue("active") && (($x->getValue("permissions") & PERM_EDITNOTE) == PERM_EDITNOTE);'),
'filter' => function($x) {return $x->getValue("active") && (($x->getValue("permissions") & PERM_EDITNOTE) == PERM_EDITNOTE);},
),
'assignee_last_changed' => Array(
'type' => 'datetime',
@@ -755,7 +755,7 @@ static public function printCohortChooserRow($selectedValue)
$congregations = $GLOBALS['system']->getDBObjectData('congregation', Array('!attendance_recording_days' => 0), 'OR', 'meeting_time');
$groups = $GLOBALS['system']->getDBObjectData('person_group', Array('!attendance_recording_days' => 0, 'is_archived' => 0), 'AND', 'category, name');
// need to preserve category too
uasort($groups, create_function('$x,$y', '$r = strnatcmp($x["category"], $y["category"]); if ($r == 0) $r = strnatcmp($x["name"], $y["name"]); return $r;')); // to ensure natural sorting
uasort($groups, function($x,$y) {$r = strnatcmp($x["category"], $y["category"]); if ($r == 0) $r = strnatcmp($x["name"], $y["name"]); return $r;}); // to ensure natural sorting
}
$lastCategory = -1;
?>
@@ -31,7 +31,7 @@ protected static function _getFields()
'show_id' => FALSE,
'order_by' => 'meeting_time',
'allow_empty' => TRUE,
'filter' => create_function('$x', '$y = $x->getValue("meeting_time"); return !empty($y);'),
'filter' => function($x) {$y = $x->getValue("meeting_time"); return !empty($y);},
'note' => 'Congregations must have a "code name" set to be available here',
),
'title' => Array(
View
@@ -639,7 +639,7 @@ function hl_tag2(&$e, &$a, $t=1){
function hl_tidy($t, $w, $p){
// Tidy/compact HTM
if(strpos(' pre,script,textarea', "$p,")){return $t;}
$t = str_replace(' </', '</', preg_replace(array('`(<\w[^>]*(?<!/)>)\s+`', '`\s+`', '`(<\w[^>]*(?<!/)>) `'), array(' $1', ' ', '$1'), preg_replace_callback(array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea).*?>)(.+?)(</\2>)`sm'), create_function('$m', 'return $m[1]. str_replace(array("<", ">", "\n", "\r", "\t", " "), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), $m[3]). $m[4];'), $t)));
$t = str_replace(' </', '</', preg_replace(array('`(<\w[^>]*(?<!/)>)\s+`', '`\s+`', '`(<\w[^>]*(?<!/)>) `'), array(' $1', ' ', '$1'), preg_replace_callback(array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea).*?>)(.+?)(</\2>)`sm'), function($m) {return $m[1]. str_replace(array("<", ">", "\n", "\r", "\t", " "), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), $m[3]). $m[4];}, $t)));
if(($w = strtolower($w)) == -1){
return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t);
}
@@ -52,7 +52,7 @@ function printView()
'references' => 'staff_member',
'allow_empty' => true,
'empty_text' => 'Anyone',
'filter' => create_function('$x', 'return $x->getValue("active") && (($x->getValue("permissions") & PERM_EDITNOTE) == PERM_EDITNOTE);'),
'filter' => function($x) {return $x->getValue("active") && (($x->getValue("permissions") & PERM_EDITNOTE) == PERM_EDITNOTE);},
),
array_get($_REQUEST, 'assignee')
);
@@ -135,7 +135,7 @@ public function printView()
'order_by' => 'meeting_time',
'allow_empty' => false,
'allow_multiple' => true,
'filter' => create_function('$x', '$y = $x->getValue("meeting_time"); return !empty($y);'),
'filter' => function($x) {$y = $x->getValue("meeting_time"); return !empty($y);},
), Array());
?>
</div>
@@ -57,7 +57,7 @@ function processView()
uasort($this->fields, create_function('$x,$y', 'return (int)$x->getValue("rank") > (int)$y->getValue("rank");'));
uasort($this->fields, function($x,$y) {return (int)$x->getValue("rank") > (int)$y->getValue("rank");});
if ($i > 0) {
add_message("Custom fields updated", 'success');

0 comments on commit 97b9bda

Please sign in to comment.