$likes[] = $DB->sql_like($prefix.'filename', ':filename'.$cnt, false);
$params['filename'.$cnt] = '%'.$ext;
}
- $sql .= ' AND ('.join(' OR ', $likes).')';
+ $sql .= ' AND (' . join(' OR ', $likes) . ')';
}
return array($sql, $params);
}
} else {
$filename = $fileinfo->get_visible_name();
$extension = textlib::strtolower(pathinfo($filename, PATHINFO_EXTENSION));
- if (!empty($extension) && in_array('.'.$extension, $extensions)) {
+ if (!empty($extension) && in_array('.' . $extension, $extensions)) {
$nonemptylist[] = $fileinfo;
}
}
if ($extensions !== '*') {
$filename = $fileinfo->get_visible_name();
$extension = textlib::strtolower(pathinfo($filename, PATHINFO_EXTENSION));
- if (empty($extension) || !in_array('.'.$extension, $extensions)) {
+ if (empty($extension) || !in_array('.' . $extension, $extensions)) {
continue;
}
}
public function get_params_rawencoded() {
$params = $this->get_params();
$encoded = array();
- $encoded[] = 'contextid='.$params['contextid'];
- $encoded[] = 'component='.$params['component'];
- $encoded[] = 'filearea='.$params['filearea'];
- $encoded[] = 'itemid='.(is_null($params['itemid']) ? -1 : $params['itemid']);
- $encoded[] = 'filepath='.(is_null($params['filepath']) ? '' : rawurlencode($params['filepath']));
- $encoded[] = 'filename='.((is_null($params['filename']) or $params['filename'] === '.') ? '' : rawurlencode($params['filename']));
+ $encoded[] = 'contextid=' . $params['contextid'];
+ $encoded[] = 'component=' . $params['component'];
+ $encoded[] = 'filearea=' . $params['filearea'];
+ $encoded[] = 'itemid=' . (is_null($params['itemid']) ? -1 : $params['itemid']);
+ $encoded[] = 'filepath=' . (is_null($params['filepath']) ? '' : rawurlencode($params['filepath']));
+ $encoded[] = 'filename=' . ((is_null($params['filename']) or $params['filename'] === '.') ? '' : rawurlencode($params['filename']));
return $encoded;
}
if ($child = $this->get_file_info($area[0], $area[1], 0, '/', '.')) {
if ($returnemptyfolders || $child->count_non_empty_children($extensions)) {
$children[] = $child;
- if (($countonly !== false) && count($children)>=$countonly) {
+ if (($countonly !== false) && count($children) >= $countonly) {
return $countonly;
}
}
if ($child = $this->browser->get_file_info($modcontext)) {
if ($returnemptyfolders || $child->count_non_empty_children($extensions)) {
$children[] = $child;
- if (($countonly !== false) && count($children)>=$countonly) {
+ if (($countonly !== false) && count($children) >= $countonly) {
return $countonly;
}
}