PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.0.1
Defender Security – Malware Scanner, Login Security & Firewall v6.0.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 6.0.1, at src/component/class-breadcrumbs.php

83 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 // Update value for the next feature.
29 return self::BREADCRUMBS_PREFIX_KEY
30 . \WP_Defender\Component\Fake_Bot_Detection::SCENARIO_FAKE_BOT . self::BREADCRUMBS_SUFFIX_KEY;
31 }
32
33 /**
34 * Get the previous feature's slug.
35 *
36 * @return string
37 */
38 private function get_previous_feature_slug(): string {
39 return self::BREADCRUMBS_PREFIX_KEY
40 . \WP_Defender\Component\Fake_Bot_Detection::SCENARIO_FAKE_BOT . self::BREADCRUMBS_SUFFIX_KEY;
41 }
42
43 /**
44 * Update the feature's meta key.
45 *
46 * @return void
47 */
48 public function update_meta_key(): void {
49 // Add value for the next feature.
50 }
51
52 /**
53 * Get the feature's meta key.
54 *
55 * @return bool
56 */
57 public function get_meta_key(): bool {
58 return (bool) get_user_meta( get_current_user_id(), $this->get_feature_slug(), true );
59 }
60
61 /**
62 * Delete the feature's meta key.
63 *
64 * @return void
65 */
66 public function delete_meta_key(): void {
67 global $wpdb;
68
69 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $this->get_feature_slug() ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery
70 }
71
72 /**
73 * Delete the previous feature's meta key.
74 *
75 * @return void
76 */
77 public function delete_previous_meta() {
78 global $wpdb;
79
80 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $this->get_previous_feature_slug() ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery
81 }
82 }
83