Skip to content

Commit 496b489

Browse files
committed
Fix disabling 3rd party links
Closes #49
1 parent 0c4b9b7 commit 496b489

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/PHPDraft/Out/HTML/default.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ use Enjoy\HttpStatusCode\Statuscodes;
153153
data-content="<textarea rows='8' cols='75'><?= $transition->get_curl_command($this->base_data['HOST']); ?></textarea>">
154154
<span class="glyphicon glyphicon-copy"></span>
155155
</a>
156-
<?php if (defined('THIRD_PARTY_ALLOWED') && THIRD_PARTY_ALLOWED): ?>
156+
<?php if (THIRD_PARTY_ALLOWED): ?>
157157
<a class="btn btn-default hurl"
158158
role="button"
159159
title="Try request"

src/PHPDraft/Out/HTML/material.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ use Enjoy\HttpStatusCode\Statuscodes;
192192
</div>
193193
</div>
194194
<div class="mdl-card__menu">
195-
<?php if (defined('THIRD_PARTY_ALLOWED') && THIRD_PARTY_ALLOWED): ?>
195+
<?php if (THIRD_PARTY_ALLOWED): ?>
196196
<a href="<?= $transition->get_hurl_link($this->base_data['HOST']); ?>" target="_blank" role="button" class="mdl-button mdl-button mdl-button--icon mdl-js-button mdl-js-ripple-effect">
197197
<i class="material-icons">play_arrow</i>
198198
</a>

src/PHPDraft/Out/UI.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class UI
4343
* @param array $argv Arguments passed
4444
*
4545
* @return array results of the invocation
46+
* @throws \PHPDraft\Parse\ExecutionException When something failed in execution
4647
*/
4748
public static function main($argv = [])
4849
{
@@ -84,10 +85,10 @@ public static function main($argv = [])
8485
} else {
8586
$file = $argv[1];
8687
}
87-
if (isset($options['y']) || isset($options['o'])) {
88+
define('THIRD_PARTY_ALLOWED', getenv('PHPDRAFT_THIRD_PARTY') !== '0');
89+
if ((isset($options['y']) || isset($options['o'])) && THIRD_PARTY_ALLOWED) {
8890
define('DRAFTER_ONLINE_MODE', 1);
8991
}
90-
define('THIRD_PARTY_ALLOWED', !getenv('PHPDRAFT_THIRD_PARTY'));
9192

9293
$template = (new self())->var_or_default($options['t'], 'default');
9394
$image = (new self())->var_or_default($options['i']);

src/PHPDraft/Parse/JsonToHTML.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function __toString()
5959
* @param string|null $js JS to load
6060
*
6161
* @return TemplateGenerator HTML template to display
62+
* @throws \PHPDraft\Parse\ExecutionException As a runtime exception
6263
*/
6364
public function get_html($template = 'default', $image = NULL, $css = NULL, $js = NULL)
6465
{

0 commit comments

Comments
 (0)