Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions includes/help_dialog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<dialog id="help_dialog" style="max-width:560px;border:1px solid #aaa;border-radius:6px;padding:20px 24px;font-size:14px;line-height:1.6;">
<form method="dialog" style="text-align:right;margin:-10px -14px 8px 0;">
<button style="background:none;border:none;font-size:20px;cursor:pointer;padding:0 4px;">&times;</button>
</form>

<strong style="font-size:15px;">Magic comments</strong>
<p style="margin:6px 0 10px;">Add as the first line of your code to enable extra analysis modes:</p>
<table style="border-collapse:collapse;width:100%;font-size:13px;">
<tr style="border-bottom:1px solid #eee;">
<td style="padding:6px 8px 6px 0;vertical-align:top;"><code style="background:#eee;padding:2px 5px;border-radius:3px;white-space:nowrap;">&lt;?php // --taint-analysis</code></td>
<td style="padding:6px 0;">Enable <a href="https://psalm.dev/docs/security_analysis/" target="_blank">taint analysis</a> (security analysis for tracking user input through sinks)</td>
</tr>
<tr style="border-bottom:1px solid #eee;">
<td style="padding:6px 8px 6px 0;vertical-align:top;"><code style="background:#eee;padding:2px 5px;border-radius:3px;white-space:nowrap;">&lt;?php // checkTaintedInput</code></td>
<td style="padding:6px 0;">Alias for <code>--taint-analysis</code></td>
</tr>
<tr style="border-bottom:1px solid #eee;">
<td style="padding:6px 8px 6px 0;vertical-align:top;"><code style="background:#eee;padding:2px 5px;border-radius:3px;white-space:nowrap;">&lt;?php // trackTaints</code></td>
<td style="padding:6px 0;">Alias for <code>--taint-analysis</code></td>
</tr>
<tr>
<td style="padding:6px 8px 6px 0;vertical-align:top;"><code style="background:#eee;padding:2px 5px;border-radius:3px;white-space:nowrap;">&lt;?php // findUnusedCode</code></td>
<td style="padding:6px 0;">Detect unused classes, methods, properties, and variables (same as enabling both &ldquo;Detect unused&rdquo; checkboxes)</td>
</tr>
</table>

<strong style="font-size:15px;display:block;margin-top:16px;">URL parameters</strong>
<table style="border-collapse:collapse;width:100%;font-size:13px;margin-top:8px;">
<tr>
<td style="padding:6px 8px 6px 0;vertical-align:top;"><code style="background:#eee;padding:2px 5px;border-radius:3px;white-space:nowrap;">?php=8.1</code></td>
<td style="padding:6px 0;">Set PHP target version (supported: <code>5.6</code>, <code>7.0</code>&ndash;<code>7.4</code>, <code>8.0</code>&ndash;<code>8.4</code>)</td>
</tr>
</table>
</dialog>
6 changes: 6 additions & 0 deletions includes/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
'<div>' + input + ' <label for="' + key + '">' + settingsText[key] + '</label></div>'
);
});
settingsLines.push(
'<div style="margin-top: 8px;">'
+ '<button commandfor="help_dialog" command="show-modal" style="background:none;border:1px solid #999;border-radius:3px;padding:2px 8px;font-size:13px;cursor:pointer;">More options&hellip;</button>'
+ '</div>'
);

document.getElementById('settings_panel').innerHTML = settingsLines.join('\n');
};

Expand Down
1 change: 1 addition & 0 deletions views/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function takesAnInt(int $i) {
<button onclick="javascript:toggleSettings();" id="settings"><svg width="18" height="18" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18"><g fill="none" fill-rule="evenodd"><circle cx="9" cy="9" r="6.4" stroke="#000"/><path fill="#000" fill-rule="nonzero" d="M9 17.5l-1-2 4.1-.6v2l-3.1.6zm6-2.5L13.4 14l1.8-2.9 1.6 1.4L15 15zm2.5-6l-2 .8V9l-.6-2.6 2-.4.6 3zM15 3l-1 2-3-2.1 1.4-1.6L15 3zM9 .6l.8 2H9l-3 .6v-2l3-.6h.1zM3.1 3l2 .6L2.6 7 1.3 5.5l1.8-2.6zM.5 8.8l2.1-.6V9l.6 3H1L.5 9v-.2zm2.3 6l1-1.8L7 15l-1.5 1.7-2.6-1.9z"/><circle cx="9" cy="9" r="3.3" stroke="#000" transform="rotate(18 9 9)"/><path fill="#000" fill-rule="nonzero" d="M7.5 13.6l-.2-1.3 2.4.4-.4 1-1.8-.1zm3.7-.3l-.7-.9 1.5-1.2.6 1-1.4 1zm2.4-2.8h-1.3l.2-.4.1-1.5 1.2.1-.2 1.8zM13.3 7l-.9.8-1.2-1.6 1-.7L13.3 7zm-2.7-2.4v1.2l-.5-.2-1.7-.2.4-1.1 1.7.2zm-3.7.2l1 .7-2 1.4-.4-1 1.4-1.1zM4.5 7.4h1.2l-.2.5-.2 1.7-1.1-.4.2-1.7v-.1zm.2 3.6l.8-.7 1.3 1.6-1 .6L4.6 11z"/></g></svg> Settings</button>
<button onclick="javascript:getLink();" id="getlink"><svg width="28" height="15" xmlns="http://www.w3.org/2000/svg"><g fill-rule="evenodd"><path d="M17.3 2.5A5 5 0 0 0 13 0H5a5 5 0 0 0-5 5v1a5 5 0 0 0 5 5h8a5 5 0 0 0 4.8-3.5H16a4 4 0 0 1-3.5 2h-7a4 4 0 1 1 0-8h7c1 0 2 .4 2.6 1h2.2z"/><path d="M10.4 12.5a5 5 0 0 0 4.4 2.5h8a5 5 0 0 0 5-5V9a5 5 0 0 0-5-5h-8A5 5 0 0 0 10 7.5h1.8a4 4 0 0 1 3.5-2h7a4 4 0 1 1 0 8h-7c-1 0-2-.4-2.7-1h-2.2z"/></g></svg> Get link</button>
</div>
<?php require('../includes/help_dialog.php'); ?>
</div>
</div>
<script>
Expand Down
1 change: 1 addition & 0 deletions views/snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
<button onclick="javascript:toggleSettings();" id="settings"><svg width="18" height="18" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18"><g fill="none" fill-rule="evenodd"><circle cx="9" cy="9" r="6.4" stroke="#000"/><path fill="#000" fill-rule="nonzero" d="M9 17.5l-1-2 4.1-.6v2l-3.1.6zm6-2.5L13.4 14l1.8-2.9 1.6 1.4L15 15zm2.5-6l-2 .8V9l-.6-2.6 2-.4.6 3zM15 3l-1 2-3-2.1 1.4-1.6L15 3zM9 .6l.8 2H9l-3 .6v-2l3-.6h.1zM3.1 3l2 .6L2.6 7 1.3 5.5l1.8-2.6zM.5 8.8l2.1-.6V9l.6 3H1L.5 9v-.2zm2.3 6l1-1.8L7 15l-1.5 1.7-2.6-1.9z"/><circle cx="9" cy="9" r="3.3" stroke="#000" transform="rotate(18 9 9)"/><path fill="#000" fill-rule="nonzero" d="M7.5 13.6l-.2-1.3 2.4.4-.4 1-1.8-.1zm3.7-.3l-.7-.9 1.5-1.2.6 1-1.4 1zm2.4-2.8h-1.3l.2-.4.1-1.5 1.2.1-.2 1.8zM13.3 7l-.9.8-1.2-1.6 1-.7L13.3 7zm-2.7-2.4v1.2l-.5-.2-1.7-.2.4-1.1 1.7.2zm-3.7.2l1 .7-2 1.4-.4-1 1.4-1.1zM4.5 7.4h1.2l-.2.5-.2 1.7-1.1-.4.2-1.7v-.1zm.2 3.6l.8-.7 1.3 1.6-1 .6L4.6 11z"/></g></svg> Settings</button>
<button onclick="javascript:getLink();" id="getlink"><svg width="28" height="15" xmlns="http://www.w3.org/2000/svg"><g fill-rule="evenodd"><path d="M17.3 2.5A5 5 0 0 0 13 0H5a5 5 0 0 0-5 5v1a5 5 0 0 0 5 5h8a5 5 0 0 0 4.8-3.5H16a4 4 0 0 1-3.5 2h-7a4 4 0 1 1 0-8h7c1 0 2 .4 2.6 1h2.2z"/><path d="M10.4 12.5a5 5 0 0 0 4.4 2.5h8a5 5 0 0 0 5-5V9a5 5 0 0 0-5-5h-8A5 5 0 0 0 10 7.5h1.8a4 4 0 0 1 3.5-2h7a4 4 0 1 1 0 8h-7c-1 0-2-.4-2.7-1h-2.2z"/></g></svg> Get link</button>
</div>
<?php require('../includes/help_dialog.php'); ?>
</div>
</div>
<script>
Expand Down