label = $label; } public function mangle() { if (($i = strpos($this->title, '^')) !== false) { $this->hotkey = strtoupper($this->title[$i + 1]); $this->title = substr($this->title, 0, $i) . substr($this->title, $i + 1); } if (strpos($this->append, 'initrd=') !== false) { $parts = preg_split('/\s+/', $this->append); $this->append = ''; for ($i = 0; $i < count($parts); ++$i) { if (preg_match('/^initrd=(.*)$/', $parts[$i], $out)) { if (!empty($this->initrd)) { $this->initrd .= ','; } $this->initrd .= $out[1]; } else { $this->append .= ' ' . $parts[$i]; } } $this->append = trim($this->append); } if (is_string($this->initrd)) { $this->initrd = explode(',', $this->initrd); } elseif (!is_array($this->initrd)) { $this->initrd = []; } } /** * Does this appear to be an entry that triggers localboot? */ public function isLocalboot(): bool { return $this->localBoot !== false || preg_match('/chain\.c32$/i', $this->kernel); } /** * Is this (most likely) a separating entry only that cannot be selected? */ public function isTextOnly(): bool { return ($this->label === null || empty($this->kernel)) && !$this->isHidden && !empty($this->title); } }