PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
← All changes | includes/libraries/wp-session/class-wp-session-utils.php +16 -15 1.6.8 → 1.8.13 View file →
@@ -4,9 +4,9 @@
4 4 * Utility class for sesion utilities
5 5 *
6 6 * THIS CLASS SHOULD NEVER BE INSTANTIATED
7 7 */
8 -class WP_Session_Utils {
8 +class WP_Session_Utils { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- This is a bundled library class. Changing it would break existing functionality.
9 9 /**
10 10 * Count the total sessions in the database.
11 11 *
12 12 * @global wpdb $wpdb
@@ -22,11 +22,12 @@
22 22 * Filter the query in case tables are non-standard.
23 23 *
24 24 * @param string $query Database count query
25 25 */
26 - $query = apply_filters( 'wp_session_count_query', $query );
26 + $query = apply_filters( 'wp_session_count_query', $query ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- 'wp_session_count_query' is a third-party hook from the WP Session library.
27 27
28 - $sessions = $wpdb->get_var( $query );
28 + // phpcs:ignore PluginCheck.Security.DirectDB.UnescapedDBParameter -- Filtered query allows customization for non-standard table setups. Filter should be used responsibly.
29 + $sessions = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared,PluginCheck.Security.DirectDB.UnescapedDBParameter
29 30
30 31 return absint( $sessions );
31 32 }
32 33
@@ -42,20 +43,20 @@
42 43
43 44 if ( false === $time ) {
44 45 $date = null;
45 46 } else {
46 - $expires = date( 'U', strtotime( $date ) );
47 + $expires = date( 'U', strtotime( $date ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
47 48 }
48 49 }
49 50
50 51 // If null was passed, or if the string parsing failed, fall back on a default
51 52 if ( null === $date ) {
52 - /**
53 - * Filter the expiration of the session in the database
54 - *
55 - * @param int
56 - */
57 - $expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
53 + /**
54 + * Filter the expiration of the session in the database
55 + *
56 + * @param int
57 + */
58 + $expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- 'wp_session_expiration' is a third-party hook from the WP Session library.
58 59 }
59 60
60 61 $session_id = self::generate_id();
61 62
@@ -76,9 +77,9 @@
76 77 public static function delete_old_sessions( $limit = 1000 ) {
77 78 global $wpdb;
78 79
79 80 $limit = absint( $limit );
80 - $keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%' ORDER BY option_value ASC LIMIT 0, {$limit}" );
81 + $keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%' ORDER BY option_value ASC LIMIT 0, {$limit}" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.InterpolatedNotPrepared
81 82
82 83 $now = time();
83 84 $expired = array();
84 85 $count = 0;
@@ -102,10 +103,10 @@
102 103 $placeholders = array_fill( 0, count( $expired ), '%s' );
103 104 $format = implode( ', ', $placeholders );
104 105 $query = "DELETE FROM $wpdb->options WHERE option_name IN ($format)";
105 106
106 - $prepared = $wpdb->prepare( $query, $expired );
107 - $wpdb->query( $prepared );
107 + $prepared = $wpdb->prepare( $query, $expired ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
108 + $wpdb->query( $prepared ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.NotPrepared
108 109 }
109 110
110 111 return $count;
111 112 }
@@ -119,9 +120,9 @@
119 120 */
120 121 public static function delete_all_sessions() {
121 122 global $wpdb;
122 123
123 - $count = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'" );
124 + $count = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
124 125
125 126 return (int) ( $count / 2 );
126 127 }
127 128
@@ -135,5 +136,5 @@
135 136 $hash = new PasswordHash( 8, false );
136 137
137 138 return md5( $hash->get_random_bytes( 32 ) );
138 139 }
139 -}
140 +}