mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-18 13:10:08 -07:00
Fix loading of keywords
This commit is contained in:
parent
b712678a2c
commit
fb0a26901d
@ -58,7 +58,7 @@ class LDModelParser
|
|||||||
if (!$firstLine) {
|
if (!$firstLine) {
|
||||||
$array = explode(' ', ltrim(trim($line, 2), '=_~'));
|
$array = explode(' ', ltrim(trim($line, 2), '=_~'));
|
||||||
$model['category'] = isset($array[0]) ? $array[0] : '';
|
$model['category'] = isset($array[0]) ? $array[0] : '';
|
||||||
$model['name'] = preg_replace('/ {2,}/', ' ', ltrim($line, '=_'));
|
$model['name'] = preg_replace('/ {2,}/', ' ', ltrim($line, '_'));
|
||||||
|
|
||||||
$firstLine = true;
|
$firstLine = true;
|
||||||
}
|
}
|
||||||
@ -68,7 +68,13 @@ class LDModelParser
|
|||||||
}
|
}
|
||||||
// 0 !KEYWORDS <first keyword>, <second keyword>, ..., <last keyword>
|
// 0 !KEYWORDS <first keyword>, <second keyword>, ..., <last keyword>
|
||||||
elseif (strpos($line, '!KEYWORDS ') === 0) {
|
elseif (strpos($line, '!KEYWORDS ') === 0) {
|
||||||
$model['keywords'] = explode(', ', preg_replace('/^!KEYWORDS /', '', $line));
|
$keywords = explode(',', preg_replace('/^!KEYWORDS /', '', $line));
|
||||||
|
foreach ($keywords as $keyword) {
|
||||||
|
$keyword = trim($keyword);
|
||||||
|
if($keyword) {
|
||||||
|
$model['keywords'][] = $keyword;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 0 Name: <Filename>.dat
|
// 0 Name: <Filename>.dat
|
||||||
elseif (strpos($line, 'Name: ') === 0 && !isset($header['id'])) {
|
elseif (strpos($line, 'Name: ') === 0 && !isset($header['id'])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user