<?php if ( ! defined( 'ABSPATH' ) ) exit(); /** * Log a variable in log file * @param mixed $variable Any variable that needs to be debugged * @param string $desc Desciption of the log * @return void */ function learndash_notifications_debug( $variable, $desc = '' ) { $file = WP_CONTENT_DIR . '/uploads/learndash/learndash-notifications.log'; $dirname = dirname( $file ); if ( ! is_dir( $dirname ) ) { wp_mkdir_p( $dirname ); } if ( is_bool( $variable ) ) { $variable = $variable ? 'true' : 'false'; } $date = date( 'Y-m-d H:i:s' ); $variable = print_r( $variable, true ); error_log( "[{$date}] {$desc}: {$variable}" . PHP_EOL, 3, $file ); } /** * Log a message in log file * @param string $message Log message * @return void */ function learndash_notifications_log_action( $message ) { $file = WP_CONTENT_DIR . '/uploads/learndash/learndash-notifications-actions.log'; $dirname = dirname( $file ); if ( ! is_dir( $dirname ) ) { wp_mkdir_p( $dirname ); } if ( file_exists( $file ) && filesize( $file ) > 51200 ) { $write_file = $dirname . 'learndash-notifications-log.temp'; $write = new SplFileObject( $write_file , 'w' ); $reading = new SplFileObject( $file, 'r' ); foreach ( new LimitIterator( $reading, 1 ) as $line ) { $write->fwrite( $line ); } $write = null; $reading = null; rename( $write_file, $file ); } $date = date( 'Y-m-d H:i:s' ); $message = preg_replace( '/(\r|\n|\r\n|\s{2,})/', ' ', $message ); error_log( "[{$date}]: {$message}" . PHP_EOL, 3, $file ); } function learndash_notifications_parse_variable( $var ) { if ( is_array( $var ) || is_object( $var ) ) { return json_encode( $var ); } else { return $var; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
admin | Folder | 0755 |
|
|
activation.php | File | 426 B | 0644 |
|
ajax.php | File | 4.34 KB | 0644 |
|
class-dependency-check.php | File | 240 B | 0644 |
|
cron.php | File | 2.6 KB | 0644 |
|
database.php | File | 10.61 KB | 0644 |
|
deactivation.php | File | 304 B | 0644 |
|
functions.php | File | 1.82 KB | 0644 |
|
logger.php | File | 2.05 KB | 0644 |
|
meta-box.php | File | 31.46 KB | 0644 |
|
notification.php | File | 79.16 KB | 0644 |
|
post-type.php | File | 12.03 KB | 0644 |
|
shortcode.php | File | 12.09 KB | 0644 |
|
subscription-manager.php | File | 4.69 KB | 0644 |
|
tools.php | File | 4.2 KB | 0644 |
|
update.php | File | 1.25 KB | 0644 |
|
user.php | File | 1.61 KB | 0644 |
|