sudar /
bulk-delete
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Code to enable compatibility with other plugins. |
||
| 4 | * |
||
| 5 | * @since 5.5 |
||
| 6 | * |
||
| 7 | * @author Sudar |
||
| 8 | * |
||
| 9 | * @package BulkDelete\Util\Compatibility |
||
| 10 | */ |
||
| 11 | defined( 'ABSPATH' ) || exit; // Exit if accessed directly |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Find out if Simple Login Log is installed or not. |
||
| 15 | * http://wordpress.org/plugins/simple-login-log/. |
||
| 16 | * |
||
| 17 | * @since 5.5 |
||
| 18 | * |
||
| 19 | * @return bool True if plugin is installed, False otherwise |
||
| 20 | */ |
||
| 21 | function bd_is_simple_login_log_present() { |
||
| 22 | global $wpdb; |
||
| 23 | $simple_login_log_table = 'simple_login_log'; |
||
|
0 ignored issues
–
show
|
|||
| 24 | |||
| 25 | return (bool) $wpdb->get_row( "SHOW TABLES LIKE '{$wpdb->prefix}{$simple_login_log_table}'" ); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Find the last login date/time of a user. |
||
| 30 | * |
||
| 31 | * @since 5.5 |
||
| 32 | * |
||
| 33 | * @param int $user_id |
||
| 34 | * |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | function bd_get_last_login( $user_id ) { |
||
| 38 | global $wpdb; |
||
| 39 | |||
| 40 | $simple_login_log_table = 'simple_login_log'; |
||
|
0 ignored issues
–
show
|
|||
| 41 | |||
| 42 | return $wpdb->get_var( $wpdb->prepare( "SELECT time FROM {$wpdb->prefix}{$simple_login_log_table} WHERE uid = %d ORDER BY time DESC LIMIT 1", $user_id ) ); |
||
| 43 | } |
||
| 44 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.