Skip to content

Commit

Permalink
MDL-67115 core: php74 params order for implode()/join()
Browse files Browse the repository at this point in the history
Passing parameters to implode() in reverse order is deprecated, use
implode($glue, $parts) instead of implode($parts, $glue).

This commit corresponds to phpunit and manual detections, core files.
  • Loading branch information
stronk7 committed Jan 19, 2020
1 parent fd12600 commit ee439d0
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions admin/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ protected function missing_dependencies(core_plugin_manager $pluginman) {
if ($unavailable or $unknown) {
$out .= $this->output->heading(get_string('misdepsunavail', 'core_plugin'));
if ($unknown) {
$out .= $this->output->notification(get_string('misdepsunknownlist', 'core_plugin', implode($unknown, ', ')));
$out .= $this->output->notification(get_string('misdepsunknownlist', 'core_plugin', implode(', ', $unknown)));
}
if ($unavailable) {
$unavailablelist = array();
Expand All @@ -1305,7 +1305,7 @@ protected function missing_dependencies(core_plugin_manager $pluginman) {
$unavailablelist[] = $unavailablelistitem;
}
$out .= $this->output->notification(get_string('misdepsunavaillist', 'core_plugin',
implode($unavailablelist, ', ')));
implode(', ', $unavailablelist)));
}
$out .= $this->output->container_start('plugins-check-dependencies-actions');
$out .= ' '.html_writer::link(new moodle_url('/admin/tool/installaddon/'),
Expand Down Expand Up @@ -1425,7 +1425,7 @@ protected function available_missing_dependencies_list(core_plugin_manager $plug
html_writer::div($plugin->name, 'name').' '.html_writer::div($plugin->component, 'component'),
$plugin->version->release,
$plugin->version->version,
implode($supportedmoodles, ' '),
implode(' ', $supportedmoodles),
$info
);
}
Expand Down Expand Up @@ -2037,7 +2037,7 @@ public function environment_check_table($result, $environment_results) {
if (empty($CFG->docroot) or $environment_result->plugin) {
$report = get_string($stringtouse, 'admin', $rec);
} else {
$report = $this->doc_link(join($linkparts, '/'), get_string($stringtouse, 'admin', $rec), true);
$report = $this->doc_link(join('/', $linkparts), get_string($stringtouse, 'admin', $rec), true);
}
// Enclose report text in div so feedback text will be displayed underneath it.
$report = html_writer::div($report);
Expand Down
2 changes: 1 addition & 1 deletion completion/criteria/completion_criteria_activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public function get_details($completion) {
}
}

$details['requirement'] = implode($details['requirement'], ', ');
$details['requirement'] = implode(', ', $details['requirement']);

$details['status'] = '';

Expand Down
2 changes: 1 addition & 1 deletion filter/tex/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function filter($text, array $options = array()) {
'\\\\\((.+?)\\\\\)',
'\\[tex\\](.+?)\\[\/tex\\]'
);
$megarule = '/' . implode($rules, '|') . '/is';
$megarule = '/' . implode('|', $rules) . '/is';
preg_match_all($megarule, $text, $matches);
for ($i=0; $i<count($matches[0]); $i++) {
$texexp = '';
Expand Down
2 changes: 1 addition & 1 deletion group/classes/output/user_groups_editable.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function export_for_template(\renderer_base $output) {
}

if (!empty($listofgroups)) {
$this->displayvalue = implode($listofgroups, ', ');
$this->displayvalue = implode(', ', $listofgroups);
} else {
$this->displayvalue = get_string('groupsnone');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/listlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ public function to_html($indent = 0, $extraargs = array()) {
} else {
$childrenhtml = '';
}
return $this->item_html($extraargs).'&nbsp;'.(join($this->icons, '')).(($childrenhtml !='')?("\n".$childrenhtml):'');
return $this->item_html($extraargs).'&nbsp;'.(join('', $this->icons)).(($childrenhtml !='')?("\n".$childrenhtml):'');
}

public function set_icon_html($first, $last, $lastitem) {
Expand Down
4 changes: 2 additions & 2 deletions lib/questionlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ function question_category_options($contexts, $top = false, $currentcat = 0,
foreach ($contexts as $context) {
$pcontexts[] = $context->id;
}
$contextslist = join($pcontexts, ', ');
$contextslist = join(', ', $pcontexts);

$categories = get_categories_for_contexts($contextslist, 'parent, sortorder, name ASC', $top);

Expand Down Expand Up @@ -2011,7 +2011,7 @@ public function require_cap($cap) {
*/
public function require_one_cap($caps) {
if (!$this->have_one_cap($caps)) {
$capsstring = join($caps, ', ');
$capsstring = join(', ', $caps);
print_error('nopermissions', '', '', $capsstring);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/behat/behat_navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ protected function select_node_in_navigation($nodetext, $parentnodes) {
// Throw exception if no node found.
if (!$nodetoclick) {
throw new ExpectationException('Navigation node "' . $nodetext . '" not found under "' .
implode($parentnodes, ' > ') . '"', $this->getSession());
implode(' > ', $parentnodes) . '"', $this->getSession());
}
$nodetoclick->click();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/other/pdflibtestpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
}
$list[] = $f;
}
$c .= implode($list, ', ');
$c .= implode(', ', $list);
$c .= '<p><i><small>Note: * Standard core fonts are not embedded in PDF files, PDF viewers are using local fonts.</small></i></p>';

$c .= '<h3>Installed languages and their alphabets</h3>';
Expand Down
4 changes: 2 additions & 2 deletions mod/glossary/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,13 @@ function glossary_print_recent_activity($course, $viewfullnames, $timestart) {

$joins = array(' FROM {glossary_entries} ge ');
$joins[] = 'JOIN {user} u ON u.id = ge.userid ';
$fromsql = implode($joins, "\n");
$fromsql = implode("\n", $joins);

$params['timestart'] = $timestart;
$clausesql = ' WHERE ge.timemodified > :timestart ';

if (count($approvals) > 0) {
$approvalsql = 'AND ('. implode($approvals, ' OR ') .') ';
$approvalsql = 'AND ('. implode(' OR ', $approvals) .') ';
} else {
$approvalsql = '';
}
Expand Down
2 changes: 1 addition & 1 deletion question/editlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ function question_build_edit_resources($edittab, $baseurl, $params) {
foreach ($contexts->having_one_edit_tab_cap($edittab) as $context){
$contextlistarr[] = "'{$context->id}'";
}
$contextlist = join($contextlistarr, ' ,');
$contextlist = join(' ,', $contextlistarr);
if (!empty($pagevars['cat'])){
$catparts = explode(',', $pagevars['cat']);
if (!$catparts[0] || (false !== array_search($catparts[1], $contextlistarr)) ||
Expand Down
2 changes: 1 addition & 1 deletion question/format/examview/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function readquestions($lines) {
$questions = array();
$currentquestion = array();

$text = implode($lines, ' ');
$text = implode(' ', $lines);
$text = $this->cleanunicode($text);

$xml = xmlize($text, 0);
Expand Down
2 changes: 1 addition & 1 deletion question/format/examview/tests/examviewformat_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function test_parse_matching_groups() {
$lines = $this->make_test_xml();

$importer = new qformat_examview();
$text = implode($lines, ' ');
$text = implode(' ', $lines);

$xml = xmlize($text, 0);
$importer->parse_matching_groups($xml['examview']['#']['matching-group']);
Expand Down
2 changes: 1 addition & 1 deletion user/classes/output/user_roles_editable.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function export_for_template(\renderer_base $output) {
}

if (!empty($listofroles)) {
$this->displayvalue = implode($listofroles, ', ');
$this->displayvalue = implode(', ', $listofroles);
} else if (!empty($roleids) && empty($viewableroleids)) {
$this->displayvalue = get_string('novisibleroles', 'role');
} else {
Expand Down

0 comments on commit ee439d0

Please sign in to comment.