Skip to content

Commit 1c8fe71

Browse files
Sean MolenaarSean Molenaar
authored andcommitted
Fixing some issues introduced by multi responses
1 parent ff57770 commit 1c8fe71

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
/build/phar
77
/build/*.phar
88
/tests/statics/index.*
9+
src/Michelf/*
10+
src/.gitignore
911

1012
# JIRA plugin
1113
atlassian-ide-plugin.xml

src/PHPDraft/Out/HTML/default.phtml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ $base = $this->categories;
238238
Response <var
239239
class="<?= $this->get_response_status($response->statuscode) ?>"><?= $response->statuscode; ?></var>
240240
<span
241-
class="glyphicon indicator glyphicon-menu-down pull-right"></span>
241+
class="glyphicon
242+
indicator
243+
glyphicon-menu-<?php if ($key < 1): ?>down<?php else: ?>up<?php endif; ?>
244+
pull-right"></span>
242245
</h4>
243246
</div>
244247
<div
@@ -312,22 +315,22 @@ $base = $this->categories;
312315
</div>
313316
</div>
314317
</div>
315-
<?php $extras = array_filter($this->base_data, function ($value){
318+
<?php $extras = array_filter($this->base_data, function ($value) {
316319
return !in_array($value, ['HOST', 'TITLE', 'ALT_HOST', 'FORMAT', 'DESC']);
317320
}, ARRAY_FILTER_USE_KEY);
318321
if (!empty($extras)):
319-
$extras['host']=$this->base_data['HOST'];?>
322+
$extras['host'] = $this->base_data['HOST']; ?>
320323
<button
321324
type="button"
322325
class="btn btn-lg extra-info"
323326
data-toggle="popover"
324327
title="Extra info"
325328
data-placement="top"
326329
data-html="true"
327-
data-content="<?php foreach ($extras as $key=>$value): ?><p><?= $key;?>: <?= $value;?></p><?php endforeach;?>">
330+
data-content="<?php foreach ($extras as $key => $value): ?><p><?= $key; ?>: <?= $value; ?></p><?php endforeach; ?>">
328331
<span class="glyphicon glyphicon-question-sign"></span>
329332
</button>
330-
<?php endif;?>
333+
<?php endif; ?>
331334
<?php foreach ($this->js as $js): ?>
332335
<script src="<?= $js ?>"></script>
333336
<?php endforeach; ?>

src/PHPDraft/Out/TemplateGenerator.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ public function __construct($template, $image)
8585
public function get($object)
8686
{
8787
$include = null;
88+
if (stream_resolve_include_path('templates' . DIRECTORY_SEPARATOR . $this->template . DIRECTORY_SEPARATOR . $this->template . '.phtml')) {
89+
$include =
90+
'templates' . DIRECTORY_SEPARATOR . $this->template . DIRECTORY_SEPARATOR . $this->template . '.phtml';
91+
}
8892
if (stream_resolve_include_path($this->template . DIRECTORY_SEPARATOR . $this->template . '.phtml')) {
8993
$include = $this->template . DIRECTORY_SEPARATOR . $this->template . '.phtml';
9094
}
@@ -113,11 +117,13 @@ public function get($object)
113117
continue;
114118
}
115119

116-
$cat = new Category();
117-
$this->categories[] = $cat->parse($value);
120+
$cat = new Category();
121+
$cat = $cat->parse($value);
118122

119123
if ($value->meta->classes[0] === 'dataStructures') {
120124
$this->base_structures = array_merge($this->base_structures, $cat->structures);
125+
} else {
126+
$this->categories[] = $cat;
121127
}
122128
}
123129

@@ -127,12 +133,14 @@ public function get($object)
127133
ksort($this->base_structures);
128134
}
129135
if ($this->sorting === UI::$PHPD_SORT_OPT_ALL || $this->sorting === UI::$PHPD_SORT_OPT_WEBSERVICES) {
130-
usort($this->categories[0]->children, function ($a, $b) {
131-
return strcmp($a->title, $b->title);
132-
});
136+
foreach ($this->categories as &$category) {
137+
usort($category->children, function ($a, $b) {
138+
return strcmp($a->title, $b->title);
139+
});
140+
}
133141
}
134142

135-
include_once $include;
143+
require_once $include;
136144
}
137145

138146
/**

0 commit comments

Comments
 (0)