| 1 |
<?php |
| 2 |
// @codingStandardsIgnoreFile |
| 3 |
/** |
| 4 |
* Menu page for the s2Member plugin (Logs page). |
| 5 |
* |
| 6 |
* Copyright: © 2009-2011 |
| 7 |
* {@link http://websharks-inc.com/ WebSharks, Inc.} |
| 8 |
* (coded in the USA) |
| 9 |
* |
| 10 |
* Released under the terms of the GNU General Public License. |
| 11 |
* You should have received a copy of the GNU General Public License, |
| 12 |
* along with this software. In the main directory, see: /licensing/ |
| 13 |
* If not, see: {@link http://www.gnu.org/licenses/}. |
| 14 |
* |
| 15 |
* @package s2Member\Menu_Pages |
| 16 |
* @since 130210 |
| 17 |
*/ |
| 18 |
if(!defined('WPINC')) // MUST have WordPress. |
| 19 |
exit("Do not access this file directly."); |
| 20 |
|
| 21 |
if(!class_exists("c_ws_plugin__s2member_menu_page_logs")) |
| 22 |
{ |
| 23 |
/** |
| 24 |
* Menu page for the s2Member plugin (Integrations page). |
| 25 |
* |
| 26 |
* @package s2Member\Menu_Pages |
| 27 |
* @since 110531 |
| 28 |
*/ |
| 29 |
class c_ws_plugin__s2member_menu_page_logs |
| 30 |
{ |
| 31 |
public function __construct() |
| 32 |
{ |
| 33 |
echo '<div class="wrap ws-menu-page">'."\n"; |
| 34 |
|
| 35 |
echo '<div class="wp-header-end"></div>'."\n"; |
| 36 |
|
| 37 |
echo '<div class="ws-menu-page-toolbox">'."\n"; |
| 38 |
c_ws_plugin__s2member_menu_pages_tb::display(); |
| 39 |
echo '</div>'."\n"; |
| 40 |
|
| 41 |
echo '<h2>Log Files</h2>'."\n"; |
| 42 |
|
| 43 |
echo '<table class="ws-menu-page-table">'."\n"; |
| 44 |
echo '<tbody class="ws-menu-page-table-tbody">'."\n"; |
| 45 |
echo '<tr class="ws-menu-page-table-tr">'."\n"; |
| 46 |
echo '<td class="ws-menu-page-table-l">'."\n"; |
| 47 |
|
| 48 |
do_action("ws_plugin__s2member_during_logs_page_before_left_sections", get_defined_vars()); |
| 49 |
|
| 50 |
if(apply_filters("ws_plugin__s2member_during_logs_page_during_left_sections_display_log_settings", TRUE, get_defined_vars())) |
| 51 |
{ |
| 52 |
do_action("ws_plugin__s2member_during_logs_page_during_left_sections_before_log_settings", get_defined_vars()); |
| 53 |
|
| 54 |
echo '<div class="ws-menu-page-group" title="Logging Configuration">'."\n"; |
| 55 |
echo '<div class="ws-menu-page-section ws-plugin--s2member-log-settings-section">'."\n"; |
| 56 |
|
| 57 |
echo '<div class="">'."\n"; |
| 58 |
echo '<p>We highly recommend that you enable logging during your initial testing phase. Logs produce lots of useful details that can help in debugging. Logs can help you find issues in your configuration and/or problems that occur during processing. Enable logging here, and then view your log files below, in the s2Member Log Viewer.</p>'."\n"; |
| 59 |
echo '<p>However, it is recommended to disable logging once you go live. Log files may contain personally identifiable information, credit card numbers, API credentials, passwords and/or other sensitive information. We strongly suggest that logging be disabled on a live site (for security reasons) when not needed.</p>'."\n"; |
| 60 |
echo '<p>It is fine to enable logging on a live site for troubleshooting purposes. This is what the logs are meant for. Troubleshooting is not just done while building the site, they are sometimes needed after the site has been live a while and being used. Just remember to disable logging after you are done with it.</p>'."\n"; |
| 61 |
echo '<p></p>'."\n"; |
| 62 |
echo '</div>'."\n"; |
| 63 |
|
| 64 |
echo '<div class="warning" style="margin-bottom:0;">'."\n"; |
| 65 |
echo '<p style="margin:0;"><span>Regarding s2Member Security Badges. If debug logging is enabled, your site will not qualify for an s2Member Security Badge until you disable logging (and you must also download, and then delete any existing log files). For further details, please see KB Article: <a href="http://www.s2member.com/kb/security-badges/" target="_blank" rel="external">s2Member Security Badges</a>.</span></p>'."\n"; |
| 66 |
echo '</div>'."\n"; |
| 67 |
|
| 68 |
echo '<div class="ws-menu-page-hr"></div>'."\n"; |
| 69 |
|
| 70 |
do_action("ws_plugin__s2member_during_logs_page_during_left_sections_during_log_settings", get_defined_vars()); |
| 71 |
|
| 72 |
echo '<form method="post" name="ws_plugin__s2member_options_form" id="ws-plugin--s2member-options-form" autocomplete="off">'."\n"; |
| 73 |
echo '<input type="hidden" name="ws_plugin__s2member_options_save" id="ws-plugin--s2member-options-save" value="'.esc_attr(wp_create_nonce("ws-plugin--s2member-options-save")).'" />'."\n"; |
| 74 |
|
| 75 |
echo '<table class="form-table">'."\n"; |
| 76 |
echo '<tbody>'."\n"; |
| 77 |
echo '<tr>'."\n"; |
| 78 |
|
| 79 |
echo '<th>'."\n"; |
| 80 |
echo '<label for="ws-plugin--s2member-gateway-debug-logs">'."\n"; |
| 81 |
echo 'Enable Logging Routines?'."\n"; |
| 82 |
echo '</label>'."\n"; |
| 83 |
echo '</th>'."\n"; |
| 84 |
|
| 85 |
echo '</tr>'."\n"; |
| 86 |
echo '<tr>'."\n"; |
| 87 |
|
| 88 |
echo '<td>'."\n"; |
| 89 |
echo '<input type="radio" name="ws_plugin__s2member_gateway_debug_logs" id="ws-plugin--s2member-gateway-debug-logs-0" value="0"'.((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) ? ' checked="checked"' : '').' /> <label for="ws-plugin--s2member-gateway-debug-logs-0">No</label> <input type="radio" name="ws_plugin__s2member_gateway_debug_logs" id="ws-plugin--s2member-gateway-debug-logs-1" value="1"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) ? ' checked="checked"' : '').' /> <label for="ws-plugin--s2member-gateway-debug-logs-1">Yes, enable debugging w/ HTTP, API, IPN & Return Page logging (and List Server API logs too).</label><br />'."\n"; |
| 90 |
echo '<em>This enables logging overall. Includes s2Member HTTP, API, IPN and Return Page logging. Also logs any List Server integrations.</em><br />'."\n"; |
| 91 |
echo '<em>* Use only for debugging. This should NEVER be enabled on a live site.<br />* The log files are stored here: <code>'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])).'</code></em>'."\n"; |
| 92 |
echo '</td>'."\n"; |
| 93 |
|
| 94 |
echo '</tr>'."\n"; |
| 95 |
echo '<tr>'."\n"; |
| 96 |
|
| 97 |
echo '<th>'."\n"; |
| 98 |
echo '<label for="ws-plugin--s2member-gateway-debug-logs-extensive">'."\n"; |
| 99 |
echo 'Enable Additional Logging Routines?'."\n"; |
| 100 |
echo '</label>'."\n"; |
| 101 |
echo '</th>'."\n"; |
| 102 |
|
| 103 |
echo '</tr>'."\n"; |
| 104 |
echo '<tr>'."\n"; |
| 105 |
|
| 106 |
echo '<td>'."\n"; |
| 107 |
echo '<input type="radio" name="ws_plugin__s2member_gateway_debug_logs_extensive" id="ws-plugin--s2member-gateway-debug-logs-extensive-0" value="0"'.((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"]) ? ' checked="checked"' : '').' /> <label for="ws-plugin--s2member-gateway-debug-logs-extensive-0">No</label> <input type="radio" name="ws_plugin__s2member_gateway_debug_logs_extensive" id="ws-plugin--s2member-gateway-debug-logs-extensive-1" value="1"'.(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs_extensive"]) ? ' checked="checked"' : '').' /> <label for="ws-plugin--s2member-gateway-debug-logs-extensive-1">Yes, enable debugging w/ HTTP connection logging for ALL of WordPress.</label><br />'."\n"; |
| 108 |
echo '<em>This enables HTTP connection logging for ALL of WordPress (quite extensive).<br />* Use only for debugging. This should NEVER be enabled on a live site.<br />* Creates the additional log file: <code>wp-http-api-debug.log</code></em>'."\n"; |
| 109 |
echo '</td>'."\n"; |
| 110 |
|
| 111 |
echo '</tr>'."\n"; |
| 112 |
echo '</tbody>'."\n"; |
| 113 |
echo '</table>'."\n"; |
| 114 |
|
| 115 |
echo '<p class="submit">'."\n"; |
| 116 |
echo '<input type="submit" value="Update Logging Configuration" />'."\n"; |
| 117 |
echo '</p>'."\n"; |
| 118 |
|
| 119 |
echo '</form>'."\n"; |
| 120 |
|
| 121 |
echo '</div>'."\n"; |
| 122 |
echo '</div>'."\n"; |
| 123 |
|
| 124 |
do_action("ws_plugin__s2member_during_logs_page_during_left_sections_after_log_settings", get_defined_vars()); |
| 125 |
} |
| 126 |
if(apply_filters("ws_plugin__s2member_during_logs_page_during_left_sections_display_logs", TRUE, get_defined_vars())) |
| 127 |
{ |
| 128 |
do_action("ws_plugin__s2member_during_logs_page_during_left_sections_before_logs", get_defined_vars()); |
| 129 |
|
| 130 |
echo '<div class="ws-menu-page-group" title="Logs Viewer" default-state="open">'."\n"; |
| 131 |
|
| 132 |
echo '<div class="ws-menu-page-section ws-plugin--s2member-logs-section">'."\n"; |
| 133 |
echo '<h3>Debugging Tools/Tips & Other Important Details (<a href="#" onclick="jQuery(\'div#ws-plugin--s2member-debugging-tips-details\').toggle(); return false;" class="ws-dotted-link">click here to toggle</a>)</h3>'."\n"; |
| 134 |
|
| 135 |
echo '<div id="ws-plugin--s2member-debugging-tips-details" style="display:none;">'."\n"; |
| 136 |
|
| 137 |
echo '<div class="ws-menu-page-hr"></div>'."\n"; |
| 138 |
|
| 139 |
echo '<form method="post" onsubmit="if(!confirm(\'Archive all existing log files?\n\nAll of your current log files will be archived (i.e., they will simply be renamed with an ARCHIVED tag & date in their file name); and new log files will be created automatically the next time s2Member logs something on your installation.\n\nPlease click OK to confirm this action.\')) return false;" autocomplete="off">'."\n"; |
| 140 |
echo '<input type="hidden" name="ws_plugin__s2member_logs_archive_start_fresh" value="'.esc_attr(wp_create_nonce("ws-plugin--s2member-logs-archive-start-fresh")).'" />'."\n"; |
| 141 |
echo '<input type="submit" value="Archive All Current Log Files" class="ws-menu-page-right ws-plugin--s2member-archive-logs-start-fresh-button" style="font-size:110%; font-weight:normal; clear:right; min-width:300px;" />'."\n"; |
| 142 |
echo '</form>'."\n"; |
| 143 |
|
| 144 |
echo '<form method="post" onsubmit="if(!confirm(\'Delete all existing log files?\n\nThis will permanently delete ALL of your existing log files (including any archived log files).\n\nPlease click OK to confirm this action.\')) return false;" autocomplete="off">'."\n"; |
| 145 |
echo '<input type="hidden" name="ws_plugin__s2member_logs_delete_start_fresh" value="'.esc_attr(wp_create_nonce("ws-plugin--s2member-logs-delete-start-fresh")).'" />'."\n"; |
| 146 |
echo '<input type="submit" value="Permanently Delete All Log Files" class="ws-menu-page-right ws-plugin--s2member-delete-logs-start-fresh-button" style="font-size:110%; font-weight:normal; clear:right; min-width:300px;" />'."\n"; |
| 147 |
echo '</form>'."\n"; |
| 148 |
|
| 149 |
echo '<form method="post" autocomplete="off">'."\n"; |
| 150 |
echo '<input type="hidden" name="ws_plugin__s2member_logs_download_zip" value="'.esc_attr(wp_create_nonce("ws-plugin--s2member-logs-download-zip")).'" />'."\n"; |
| 151 |
echo '<input type="submit" value="Download All Log Files (Zip File)" class="ws-menu-page-right ws-plugin--s2member-logs-download-zip-button" style="font-size:110%; font-weight:normal; clear:right; min-width:300px;" />'."\n"; |
| 152 |
echo '</form>'."\n"; |
| 153 |
|
| 154 |
echo '<p><strong>Debugging Tips:</strong> It is normal to see a few errors in your log files. This is because s2Member logs <em>all</em> of its communication with Payment Gateways. Everything—not just successes. With that in mind, there will be some failures that s2Member expects (to a certain extent); and s2Member deals with these gracefully. What you\'re looking for here, are things that jump right out at you as being a major issue (e.g., when s2Member makes a point of providing details to you in a log entry about problems that should be corrected on your installation). Please read carefully.</p>'."\n"; |
| 155 |
echo '<p><strong>Test Transaction Tips:</strong> Generally speaking, it is best to run test transactions for yourself. Be sure to run your final test transactions against a live Payment Gateway that is <em>not</em> in Sandbox/Test Mode (<a href="#" onclick="alert(\'While some Payment Gateways make it possible for you to run test transactions in Sandbox/Test Mode, these are not a reliable way to test s2Member.\n\nOften times (particularly with PayPal) Sandbox/Test mode behaves somewhat differently—often with buggy behavior. This can really create frustration for site owners. Therefore, it is always a good idea to run low-dollar test transactions against a live Payment Gateway.\n\nAlso, please be sure that you are not logged in as an Administrator when running test transactions. For most test transactions, you will want to be completely logged-out of your site before completing checkout (just like a new Customer would be). If you are testing an upgrade or downgrade (where you do need to be logged-in), please do not attempt this under an Administrative account. s2Member will not upgrade/downgrade Administrative accounts—for security purposes.\'); return false;">click here for details</a>). After running test transactions, please review the log file entries pertaining to your transaction. Does s2Member report any major issues? If so, please read through any details that s2Member provides in the log file. If you need assistance, please <a href="https://s2member.com/r/s2member-kb/" target="_blank" rel="external">search s2Member.com</a> for answers to common questions.</p>'."\n"; |
| 156 |
echo '<p><strong>s2 Core Processors:</strong> It is normal to have a <code>gateway-core-ipn.log</code> and/or a <code>gateway-core-rtn.log</code> file at all times. Ultimately, all Payment Gateway integrations supported by s2Member pass through it\'s core post-processing handlers. If you\'re having trouble, and you don\'t find any errors in your Payment Gateway log files, please check the <code>gateway-core-ipn.log</code> and <code>gateway-core-rtn.log</code> files too. Regarding s2Member Pro-Forms... If you\'ve integrated s2Member Pro-Forms, you will not have a <code>gateway-core-rtn.log</code> file, because that particular processor is not used with Pro-Form integrations. However, you will have a <code>gateway-core-ipn.log</code> file, and you will need to make a point of inspecting this file to ensure there were no post-processing issues.</p>'."\n"; |
| 157 |
echo '<p><strong>s2 HTTP API Logs:</strong> If s2Member is not behaving as expected, and you cannot find errors anywhere in your Payment Gateway log files (or with any core processors), please review your <code>s2-http-api-debug.log</code> file too. Look for any HTTP connections where s2Member is getting <code>403</code>, <code>404</code>, <code>503</code> errors from your server. This can sometimes happen due to <a href="http://www.s2member.com/kb/mod-security-random-503-403-errors/" target="_blank" rel="external">paranoid Mod Security configurations</a>, and it may require you to contact your hosting company for assistance.</p>'."\n"; |
| 158 |
echo '<p style="font-style:italic;"><strong>Archived Log Files:</strong> All s2Member log files are stored here: <code>'.esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])).'</code>. Any log files that contain the word <code>ARCHIVED</code> in their name, are files that reached a size of more than 2MB; so s2Member archived them automatically to prevent any single log file from becoming too large. Archived log file names will also contain the date/time they were archived by s2Member. These archived log files typically contain much older (and possibly outdated) log entries.</p>'."\n"; |
| 159 |
|
| 160 |
echo '<div class="ws-menu-page-hr"></div>'."\n"; |
| 161 |
|
| 162 |
echo '<h3>s2Member Log File Descriptions (for <em>all</em> possible log file names)</h3>'."\n"; |
| 163 |
|
| 164 |
echo '<div class="ws-menu-page-hr"></div>'."\n"; |
| 165 |
|
| 166 |
echo '<ul class="ws-menu-page-li-margins">'."\n"; |
| 167 |
foreach(c_ws_plugin__s2member_utils_logs::$log_file_descriptions as $_k => $_v) |
| 168 |
echo '<li><code><strong>'.esc_html(preg_replace(array('/^\/|\/$/', '/\\\\+/'), '', $_k)).'.log</strong></code> '.esc_html($_v["long"]).'</li>'."\n"; |
| 169 |
unset($_k, $_v); // Housekeeping. |
| 170 |
echo '</ul>'."\n"; |
| 171 |
|
| 172 |
echo '<div class="ws-menu-page-hr"></div>'."\n"; |
| 173 |
|
| 174 |
echo '</div>'."\n"; |
| 175 |
|
| 176 |
do_action("ws_plugin__s2member_during_logs_page_during_left_sections_during_logs", get_defined_vars()); |
| 177 |
|
| 178 |
$log_file_options = ""; // Initialize to an empty string. |
| 179 |
$view_log_file = (!empty($_POST["ws_plugin__s2member_log_file"])) ? sanitize_file_name($_POST["ws_plugin__s2member_log_file"]) : ""; //250422 Sanitize log file name. |
| 180 |
$view_log_file = (preg_match('/\.log$/i', $view_log_file)) ? $view_log_file : ""; |
| 181 |
$logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]; |
| 182 |
|
| 183 |
if(is_dir($logs_dir)) // Do we have a logs directory on this installation? |
| 184 |
{ |
| 185 |
$log_files = scandir($logs_dir); |
| 186 |
sort($log_files, SORT_STRING); |
| 187 |
|
| 188 |
$log_file_options .= '<optgroup label="Current Log Files">'; |
| 189 |
foreach($log_files as $_log_file) // Build options for each current log file. |
| 190 |
{ |
| 191 |
$_log_file_description = array("short" => "No description available.", "long" => "No description available."); |
| 192 |
|
| 193 |
foreach(c_ws_plugin__s2member_utils_logs::$log_file_descriptions as $_k => $_v) |
| 194 |
if(preg_match($_k, $_log_file)) |
| 195 |
{ |
| 196 |
$_log_file_description = $_v; |
| 197 |
break; // Stop here. |
| 198 |
} |
| 199 |
unset($_k, $_v); // Housekeeping. |
| 200 |
|
| 201 |
if(preg_match("/\.log$/", $_log_file) && stripos($_log_file, "-ARCHIVED-") === FALSE) |
| 202 |
$log_file_options .= '<option data-type="current" title="'.esc_attr($_log_file_description["long"]).'" value="'.esc_attr($_log_file).'"'.(($view_log_file === $_log_file) ? ' style="font-weight:bold;" selected="selected"' : '').'>'.esc_html($_log_file).'—'.esc_html($_log_file_description["short"]).'</option>'; |
| 203 |
} |
| 204 |
unset($_log_file_description, $_log_file); // Housekeeping. |
| 205 |
$log_file_options .= '</optgroup>'; |
| 206 |
|
| 207 |
if(stripos($log_file_options, '<option data-type="current"') === FALSE) |
| 208 |
$log_file_options .= '<option value="" disabled="disabled">— No current log files yet. —</option>'; |
| 209 |
|
| 210 |
$log_file_options .= '<option value="" disabled="disabled"></option>'; |
| 211 |
|
| 212 |
$log_file_options .= '<optgroup label="Archived Log Files">'; |
| 213 |
foreach($log_files as $_log_file) // Build options for each ARCHIVED log file. |
| 214 |
{ |
| 215 |
if(preg_match("/\.log$/", $_log_file) && stripos($_log_file, "-ARCHIVED-") !== FALSE) |
| 216 |
$log_file_options .= '<option data-type="archived" value="'.esc_attr($_log_file).'"'.(($view_log_file === $_log_file) ? ' style="font-weight:bold;" selected="selected"' : '').'>'.esc_html($_log_file).'</option>'; |
| 217 |
} |
| 218 |
$log_file_options .= '</optgroup>'; |
| 219 |
|
| 220 |
if(stripos($log_file_options, '<option data-type="archived"') === FALSE) |
| 221 |
$log_file_options .= '<option value="" disabled="disabled">— No log files archived yet. —</option>'; |
| 222 |
} |
| 223 |
$log_file_options = '<option value="">— Choose a Log File to View —</option>'. |
| 224 |
'<option value="" disabled="disabled"></option>'. |
| 225 |
$log_file_options; |
| 226 |
|
| 227 |
echo '<form method="post" name="ws_plugin__s2member_log_viewer" id="ws-plugin--s2member-log-viewer" autocomplete="off">'."\n"; |
| 228 |
|
| 229 |
echo '<table class="form-table">'."\n"; |
| 230 |
echo '<tbody>'."\n"; |
| 231 |
echo '<tr>'."\n"; |
| 232 |
|
| 233 |
echo '<td style="width:80%;">'."\n"; |
| 234 |
echo '<select name="ws_plugin__s2member_log_file" id="ws-plugin--s2member-log-file">'."\n"; |
| 235 |
echo $log_file_options."\n"; |
| 236 |
echo '</select>'."\n"; |
| 237 |
echo '</td>'."\n"; |
| 238 |
|
| 239 |
echo '<td style="width:20%; padding-left:5px;">'."\n"; |
| 240 |
echo '<input type="submit" value="View" style="font-size:120%; font-weight:normal;" />'."\n"; |
| 241 |
echo '</td>'."\n"; |
| 242 |
|
| 243 |
echo '</tr>'."\n"; |
| 244 |
echo '</tbody>'."\n"; |
| 245 |
echo '</table>'."\n"; |
| 246 |
|
| 247 |
echo '<table class="form-table">'."\n"; |
| 248 |
echo '<tbody>'."\n"; |
| 249 |
echo '<tr>'."\n"; |
| 250 |
|
| 251 |
echo '<td>'."\n"; |
| 252 |
|
| 253 |
if($view_log_file && file_exists($logs_dir."/".$view_log_file) && filesize($logs_dir."/".$view_log_file)) |
| 254 |
{ |
| 255 |
$_log_file_description = array("short" => "", "long" => ""); |
| 256 |
|
| 257 |
foreach(c_ws_plugin__s2member_utils_logs::$log_file_descriptions as $_k => $_v) |
| 258 |
if(preg_match($_k, $view_log_file)) |
| 259 |
{ |
| 260 |
$_log_file_description = $_v; |
| 261 |
break; // Stop here. |
| 262 |
} |
| 263 |
unset($_k, $_v); // Housekeeping. |
| 264 |
|
| 265 |
if(!empty($_log_file_description["long"])) // Do we have a description that we can display here? |
| 266 |
echo '<p style="clear:both; width:80%; font-family:\'Georgia\', serif; font-style:italic;"><strong>Description for <a href="'.esc_attr(add_query_arg(array("ws_plugin__s2member_download_log_file" => $view_log_file, "ws_plugin__s2member_download_log_file_v" => wp_create_nonce("ws-plugin--s2member-download-log-file-v")))).'">'.esc_html($view_log_file).'</a></strong>: '.esc_html($_log_file_description["long"]).'</p>'."\n"; |
| 267 |
unset($_log_file_description); // Just a little housekeeping here. |
| 268 |
|
| 269 |
echo '<p style="float:left; text-align:left;"><strong>Viewing:</strong> <a href="'.esc_attr(add_query_arg(array("ws_plugin__s2member_download_log_file" => $view_log_file, "ws_plugin__s2member_download_log_file_v" => wp_create_nonce("ws-plugin--s2member-download-log-file-v")))).'">'.esc_html($view_log_file).'</a> (log entries oldest to newest)</p>'."\n"; |
| 270 |
echo '<p style="float:right; text-align:right;">[ <a href="'.esc_attr(add_query_arg(array("ws_plugin__s2member_download_log_file" => $view_log_file, "ws_plugin__s2member_download_log_file_v" => wp_create_nonce("ws-plugin--s2member-download-log-file-v")))).'"><strong>download file</strong></a> ]</p>'."\n"; |
| 271 |
echo '<p style="margin-right:10px; float:right; text-align:right;"><a href="#" class="ws-plugin--s2member-log-file-viewport-toggle" style="text-decoration:none;">⇓ expand viewport ⇓</a></p>'."\n"; |
| 272 |
|
| 273 |
echo '<textarea id="ws-plugin--s2member-log-file-viewer" rows="20" wrap="on" spellcheck="false" style="box-shadow:inset 0 0 5px rgba(0,0,0,0.5); background:#EEEEEE; color:#000000; overflow-y:scroll;">'.htmlspecialchars(file_get_contents($logs_dir."/".$view_log_file)).'</textarea>'."\n"; |
| 274 |
|
| 275 |
echo '<p style="float:left; text-align:left;"><strong>Viewing:</strong> <a href="'.esc_attr(add_query_arg(array("ws_plugin__s2member_download_log_file" => $view_log_file, "ws_plugin__s2member_download_log_file_v" => wp_create_nonce("ws-plugin--s2member-download-log-file-v")))).'">'.esc_html($view_log_file).'</a> (log entries oldest to newest)</p>'."\n"; |
| 276 |
echo '<p style="float:right; text-align:right;">[ <a href="'.esc_attr(add_query_arg(array("ws_plugin__s2member_download_log_file" => $view_log_file, "ws_plugin__s2member_download_log_file_v" => wp_create_nonce("ws-plugin--s2member-download-log-file-v")))).'"><strong>download file</strong></a> ]</p>'."\n"; |
| 277 |
echo '<p style="margin-right:10px; float:right; text-align:right;"><a href="#" class="ws-plugin--s2member-log-file-viewport-toggle" style="text-decoration:none;">⇓ expand viewport ⇓</a></p>'."\n"; |
| 278 |
} |
| 279 |
else if($view_log_file && file_exists($logs_dir."/".$view_log_file)) |
| 280 |
echo '<textarea id="ws-plugin--s2member-log-file-viewer" rows="20" wrap="on" spellcheck="false" style="box-shadow:inset 0 0 5px rgba(0,0,0,0.5); background:#EEEEEE; color:#000000; overflow-y:scroll; font-style:italic;">— Empty at this time —</textarea>'."\n"; |
| 281 |
|
| 282 |
else if($view_log_file && !file_exists($logs_dir."/".$view_log_file)) |
| 283 |
echo '<textarea id="ws-plugin--s2member-log-file-viewer" rows="20" wrap="on" spellcheck="false" style="box-shadow:inset 0 0 5px rgba(0,0,0,0.5); background:#EEEEEE; color:#000000; overflow-y:scroll; font-style:italic;">— File no longer exists —</textarea>'."\n"; |
| 284 |
|
| 285 |
else // Display an empty textarea in this default scenario. |
| 286 |
echo '<textarea id="ws-plugin--s2member-log-file-viewer" rows="20" wrap="on" spellcheck="false" style="box-shadow:inset 0 0 5px rgba(0,0,0,0.5); background:#EEEEEE; color:#000000; overflow-y:scroll; font-style:italic;"></textarea>'."\n"; |
| 287 |
|
| 288 |
echo '</td>'."\n"; |
| 289 |
|
| 290 |
echo '</tr>'."\n"; |
| 291 |
echo '</tbody>'."\n"; |
| 292 |
echo '</table>'."\n"; |
| 293 |
|
| 294 |
echo '</form>'."\n"; |
| 295 |
|
| 296 |
echo '</div>'."\n"; |
| 297 |
echo '</div>'."\n"; |
| 298 |
|
| 299 |
do_action("ws_plugin__s2member_during_logs_page_during_left_sections_after_logs", get_defined_vars()); |
| 300 |
} |
| 301 |
do_action("ws_plugin__s2member_during_logs_page_after_left_sections", get_defined_vars()); |
| 302 |
|
| 303 |
echo '</td>'."\n"; |
| 304 |
|
| 305 |
echo '<td class="ws-menu-page-table-r">'."\n"; |
| 306 |
c_ws_plugin__s2member_menu_pages_rs::display(); |
| 307 |
echo '</td>'."\n"; |
| 308 |
|
| 309 |
echo '</tr>'."\n"; |
| 310 |
echo '</tbody>'."\n"; |
| 311 |
echo '</table>'."\n"; |
| 312 |
|
| 313 |
echo '</div>'."\n"; |
| 314 |
} |
| 315 |
} |
| 316 |
} |
| 317 |
|
| 318 |
new c_ws_plugin__s2member_menu_page_logs(); |
| 319 |
|