| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
class FrmTransLiteLog { |
| 7 |
|
| 8 |
/** |
| 9 |
* @since 6.12 The $is_error parameter was added. |
| 10 |
* |
| 11 |
* @param string $title |
| 12 |
* @param string $text |
| 13 |
* @param bool $is_error When this is false, the message will not be logged to the error log if the logging add-on is unavailable. |
| 14 |
* |
| 15 |
* @return void |
| 16 |
*/ |
| 17 |
public static function log_message( $title, $text, $is_error = true ) { |
| 18 |
if ( ! class_exists( 'FrmLog' ) ) { |
| 19 |
if ( $is_error ) { |
| 20 |
error_log( $title . ': ' . $text ); |
| 21 |
} |
| 22 |
return; |
| 23 |
} |
| 24 |
|
| 25 |
$log = new FrmLog(); |
| 26 |
$log->add( |
| 27 |
array( |
| 28 |
'title' => $title, |
| 29 |
'content' => $text, |
| 30 |
) |
| 31 |
); |
| 32 |
} |
| 33 |
} |
| 34 |
|