public function fdx_clear_log() { if (isset($_POST['fdx-clear-log'])) { $clear = fopen(self::$file_log, 'w'); fclose($clear); // Update self::$file_log self::$file_log = ini_get('error_log'); add_action('admin_notices', array($this, 'fdx_notice_clear_log')); } }
if (strpos(FDX_CLASS_P7::$current_log[$i], date('d-M-Y')) !== false) { preg_match_all($regex, FDX_CLASS_P7::$current_log[$i], $lines[$i]); $errors[] = $lines[$i][2][0]; } } foreach (array_count_values($errors) as $error => $num) { $html .= '<tr><td class="left-widget">' . $error . '</td><td class="right-widget">' . $num . '</td></tr>'; } $html .= '</tbody></table>'; $html .= '</pre>'; } $html .= '<div class="clear"></div>'; // end div.wpvl-widget echo $html; // buttons $numErrors = FDX_CLASS_P7::count_errors(); echo '<div class="button_submit"><p>'; echo submit_button(__('Clear Log', $this->hook) . ': ' . $numErrors, 'secondary', 'fdx-clear-log', false, array('id' => 'fdx-clear-log')); echo '</p></div>'; echo '</form>'; //form 1 ?> <?php $html = '<pre id="scrollable">'; if (is_array(FDX_CLASS_P7::$current_log) && !empty(FDX_CLASS_P7::$current_log)) { $html .= '<table class="table_log">'; $html .= '<tbody><tr><td>'; for ($i = 1; $i <= count(FDX_CLASS_P7::$current_log); $i++) { $html .= '<div>' . $i . '</div>'; }