| @@ -36,26 +36,26 @@ | ||
| 36 | 36 | <table style="margin-top: 0;" class="form-table logtivity-table"> |
| 37 | 37 | <tbody> |
| 38 | 38 | <tr> |
| 39 | 39 | <th scope="row">Action</th> |
| 40 | - <td><?php echo sanitize_text_field($log->action) ?></td> | |
| 40 | + <td><?php echo esc_html($log->action) ?></td> | |
| 41 | 41 | </tr> |
| 42 | 42 | <?php if ($log->context): ?> |
| 43 | 43 | <tr> |
| 44 | 44 | <th scope="row">Context</th> |
| 45 | - <td><?php echo sanitize_text_field($log->context) ?></td> | |
| 45 | + <td><?php echo esc_html($log->context) ?></td> | |
| 46 | 46 | </tr> |
| 47 | 47 | <?php endif ?> |
| 48 | 48 | <?php if ($log->action_user_id): ?> |
| 49 | 49 | <tr> |
| 50 | 50 | <th scope="row">User ID</th> |
| 51 | - <td><?php echo sanitize_text_field($log->action_user_id) ?></td> | |
| 51 | + <td><?php echo esc_html($log->action_user_id) ?></td> | |
| 52 | 52 | </tr> |
| 53 | 53 | <?php endif ?> |
| 54 | 54 | <?php if ($log->action_username): ?> |
| 55 | 55 | <tr> |
| 56 | 56 | <th scope="row">Username</th> |
| 57 | - <td><?php echo sanitize_text_field($log->action_username) ?></td> | |
| 57 | + <td><?php echo esc_html($log->action_username) ?></td> | |
| 58 | 58 | </tr> |
| 59 | 59 | <?php |
| 60 | 60 | endif; |
| 61 | 61 | |
| @@ -62,25 +62,25 @@ | ||
| 62 | 62 | if ($log->action_user_meta) : |
| 63 | 63 | foreach (json_decode($log->action_user_meta) as $key => $value) : |
| 64 | 64 | ?> |
| 65 | 65 | <tr> |
| 66 | - <th scope="row"><?php echo sanitize_text_field(ucfirst(str_replace('_', ' ', $key))) ?></th> | |
| 66 | + <th scope="row"><?php echo esc_html(ucfirst(str_replace('_', ' ', $key))) ?></th> | |
| 67 | 67 | <td> |
| 68 | 68 | <?php |
| 69 | - if (is_array($value)) : | |
| 69 | + if (is_array($value) || is_object($value)) : | |
| 70 | 70 | ?> |
| 71 | - <pre class="mb-0"><?php var_export($value) ?></pre> | |
| 71 | + <pre class="mb-0"><?php echo esc_html(print_r($value, true)); ?></pre> | |
| 72 | 72 | <?php |
| 73 | - elseif (substr($value, 0, 4) === 'http') : | |
| 73 | + elseif (is_string($value) && substr($value, 0, 4) === 'http') : | |
| 74 | 74 | ?> |
| 75 | 75 | <a target="_blank" |
| 76 | 76 | rel="noopener noreferrer" |
| 77 | - href="<?php echo sanitize_text_field($value) ?>"> | |
| 78 | - <?php echo sanitize_text_field($value) ?> | |
| 77 | + href="<?php echo esc_url($value) ?>"> | |
| 78 | + <?php echo esc_html($value) ?> | |
| 79 | 79 | </a> |
| 80 | 80 | <?php |
| 81 | 81 | else : |
| 82 | - echo sanitize_text_field($value); | |
| 82 | + echo esc_html((string)$value); | |
| 83 | 83 | endif; |
| 84 | 84 | ?> |
| 85 | 85 | </td> |
| 86 | 86 | </tr> |
| @@ -90,15 +90,15 @@ | ||
| 90 | 90 | |
| 91 | 91 | if ($log->ip_address) : ?> |
| 92 | 92 | <tr> |
| 93 | 93 | <th scope="row">IP</th> |
| 94 | - <td><?php echo sanitize_text_field($log->ip_address) ?></td> | |
| 94 | + <td><?php echo esc_html($log->ip_address) ?></td> | |
| 95 | 95 | </tr> |
| 96 | 96 | <?php endif ?> |
| 97 | 97 | <tr> |
| 98 | 98 | <th scope="row">Date</th> |
| 99 | 99 | <td> |
| 100 | - <?php echo logtivity_datetime($log->occurred_at); ?> | |
| 100 | + <?php echo esc_html(logtivity_datetime($log->occurred_at)); ?> | |
| 101 | 101 | </td> |
| 102 | 102 | </tr> |
| 103 | 103 | </tbody> |
| 104 | 104 | </table> |
| @@ -118,11 +118,11 @@ | ||
| 118 | 118 | ?> |
| 119 | 119 | <tr> |
| 120 | 120 | <th scope="row"> |
| 121 | 121 | <?php if (isset($value['key'])) : ?> |
| 122 | - <strong><?php echo sanitize_text_field($value['key']) ?></strong> | |
| 122 | + <strong><?php echo esc_html($value['key']) ?></strong> | |
| 123 | 123 | <?php else : ?> |
| 124 | - <strong><?php echo sanitize_text_field($key) ?></strong> | |
| 124 | + <strong><?php echo esc_html($key) ?></strong> | |
| 125 | 125 | <?php endif ?> |
| 126 | 126 | </th> |
| 127 | 127 | |
| 128 | 128 | <td> |
| @@ -130,21 +130,21 @@ | ||
| 130 | 130 | $value = (isset($value['key']) && !isset($value['value'])) ? '' : ($value['value'] ?? ''); |
| 131 | 131 | |
| 132 | 132 | if (is_array($value) || is_object($value)) : |
| 133 | 133 | ?> |
| 134 | - <pre><?php var_export($value) ?></pre> | |
| 134 | + <pre><?php echo esc_html(print_r($value, true)); ?></pre> | |
| 135 | 135 | <?php |
| 136 | - elseif (preg_match('#^https?://#', ltrim($value))) : | |
| 136 | + elseif (is_string($value) && preg_match('#^https?://#', ltrim($value))) : | |
| 137 | 137 | ?> |
| 138 | 138 | <a target="_blank" |
| 139 | 139 | rel="noopener noreferrer" |
| 140 | - href="<?php echo sanitize_text_field($value) ?>"> | |
| 140 | + href="<?php echo esc_url($value) ?>"> | |
| 141 | 141 | Visit Link |
| 142 | 142 | <i class="ml-1 small fas fa-external-link-alt"></i> |
| 143 | 143 | </a> |
| 144 | 144 | <?php |
| 145 | 145 | else : |
| 146 | - echo sanitize_text_field($value); | |
| 146 | + echo esc_html((string)$value); | |
| 147 | 147 | endif; |
| 148 | 148 | ?> |
| 149 | 149 | </td> |
| 150 | 150 | </tr> |