| 1 |
<?php |
| 2 |
/** |
| 3 |
* Render the Debug Log setting |
| 4 |
* |
| 5 |
* @var bool $checked if the log file option is enabled. |
| 6 |
* @var bool $file_exists true if the log file exists. |
| 7 |
* @var string $log_file_url URL of the log file. |
| 8 |
*/ |
| 9 |
|
| 10 |
?> |
| 11 |
<label> |
| 12 |
<input type="checkbox" name="isc_options[enable_log]" value="1" <?php checked( $checked ); ?> id="isc-enable-log-checkbox"/> |
| 13 |
<?php |
| 14 |
$file_link = 'image-source-control.log'; |
| 15 |
|
| 16 |
if ( $file_exists ) { |
| 17 |
$file_link = '<a href="' . esc_url( $log_file_url ) . '" target="_blank">' . $file_link . '</a>'; |
| 18 |
} |
| 19 |
printf( |
| 20 |
// translators: %1$s is a file name, %2$s is a URL parameter. |
| 21 |
esc_html__( 'Writes image source activity to the %1$s file when %2$s is added to the URL of a page.', 'image-source-control-isc' ), |
| 22 |
// phpcs:ignore WordPress.Security.EscapeOutput |
| 23 |
$file_link, |
| 24 |
'<code>?isc-log</code>' |
| 25 |
); |
| 26 |
?> |
| 27 |
</label> |
| 28 |
<div id="isc-log-url-wrapper" style="margin-top: 10px; display: <?php echo $checked ? 'block' : 'none'; ?>;"> |
| 29 |
<input type="text" id="isc-log-url-field" value="<?php echo esc_attr( $log_file_url ); ?>" readonly style="width: 100%; max-width: 500px; height: 28px; line-height: 28px; padding: 0 8px; vertical-align: middle;" /> |
| 30 |
<button type="button" id="isc-copy-log-url-btn" class="button" style="height: 28px; line-height: 26px; padding: 0 10px; vertical-align: middle;"> |
| 31 |
<span class="dashicons dashicons-admin-page" style="line-height: 28px;"></span> |
| 32 |
</button> |
| 33 |
<?php if ( $file_exists ) : ?> |
| 34 |
<button type="button" id="isc-download-log-btn" class="button" style="height: 28px; line-height: 26px; padding: 0 10px; vertical-align: middle;"> |
| 35 |
<span class="dashicons dashicons-download" style="line-height: 28px;"></span> |
| 36 |
</button> |
| 37 |
<?php endif; ?> |
| 38 |
<span class="dashicons dashicons-yes" id="isc-copy-log-url-success" style="color: #46b450; line-height: 28px; vertical-align: middle; display: none;"></span> |
| 39 |
</div> |
| 40 |
|