PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.6.1
Defender Security – Malware Scanner, Login Security & Firewall v5.6.1
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / src / component / class-breadcrumbs.php

class-breadcrumbs.php in Defender Security – Malware Scanner, Login Security & Firewall 5.6.1, at src/component/class-breadcrumbs.php

82 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Manages the display of Breadcrumbs.
4 *
5 * @package WP_Defender\Component
6 */
7
8 namespace WP_Defender\Component;
9
10 use WP_Defender\Component;
11
12 /**
13 * Use Breadcrumbs on different plugin pages.
14 *
15 * @since 5.2.0
16 */
17 class Breadcrumbs extends Component {
18
19 private const BREADCRUMBS_PREFIX_KEY = 'wd_';
20 private const BREADCRUMBS_SUFFIX_KEY = '_breadcrumbs';
21
22 /**
23 * Get the feature's slug.
24 *
25 * @return string
26 */
27 private function get_feature_slug(): string {
28 return self::BREADCRUMBS_PREFIX_KEY
29 . \WP_Defender\Component\Fake_Bot_Detection::SCENARIO_FAKE_BOT . self::BREADCRUMBS_SUFFIX_KEY;
30 }
31
32 /**
33 * Get the previous feature's slug.
34 *
35 * @return string
36 */
37 private function get_previous_feature_slug(): string {
38 return self::BREADCRUMBS_PREFIX_KEY
39 . \WP_Defender\Model\Scan_Item::TYPE_PLUGIN_OUTDATED . self::BREADCRUMBS_SUFFIX_KEY;
40 }
41
42 /**
43 * Update the feature's meta key.
44 *
45 * @return void
46 */
47 public function update_meta_key(): void {
48 update_user_meta( get_current_user_id(), $this->get_feature_slug(), 1 );
49 }
50
51 /**
52 * Get the feature's meta key.
53 *
54 * @return bool
55 */
56 public function get_meta_key(): bool {
57 return (bool) get_user_meta( get_current_user_id(), $this->get_feature_slug(), true );
58 }
59
60 /**
61 * Delete the feature's meta key.
62 *
63 * @return void
64 */
65 public function delete_meta_key(): void {
66 global $wpdb;
67
68 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $this->get_feature_slug() ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery
69 }
70
71 /**
72 * Delete the previous feature's meta key.
73 *
74 * @return void
75 */
76 public function delete_previous_meta() {
77 global $wpdb;
78
79 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $this->get_previous_feature_slug() ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery
80 }
81 }
82