PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.0
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.0
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / values / robots / user-agent.php

user-agent.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.0, at src/values/robots/user-agent.php

91 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Values\Robots;
4
5 /**
6 * Class Directive
7 */
8 class User_Agent {
9
10 /**
11 * The user agent identifier.
12 *
13 * @var string
14 */
15 private $user_agent;
16
17 /**
18 * All directives that are allowed for this user agent.
19 *
20 * @var Directive
21 */
22 private $allow_directive;
23
24 /**
25 * All directives that are disallowed for this user agent.
26 *
27 * @var Directive
28 */
29 private $disallow_directive;
30
31 /**
32 * Constructor of the user agent value object.
33 *
34 * @param string $user_agent The user agent identifier.
35 */
36 public function __construct( $user_agent ) {
37 $this->user_agent = $user_agent;
38 $this->allow_directive = new Directive();
39 $this->disallow_directive = new Directive();
40 }
41
42 /**
43 * Gets the user agent identifier.
44 *
45 * @return string
46 */
47 public function get_user_agent() {
48 return $this->user_agent;
49 }
50
51 /**
52 * Adds a path to the directive object.
53 *
54 * @param string $path The path to add to the disallow directive.
55 *
56 * @return void
57 */
58 public function add_disallow_directive( $path ) {
59 $this->disallow_directive->add_path( $path );
60 }
61
62 /**
63 * Adds a path to the directive object.
64 *
65 * @param string $path The path to add to the allow directive.
66 *
67 * @return void
68 */
69 public function add_allow_directive( $path ) {
70 $this->allow_directive->add_path( $path );
71 }
72
73 /**
74 * Gets all disallow paths for this user agent.
75 *
76 * @return array
77 */
78 public function get_disallow_paths() {
79 return $this->disallow_directive->get_paths();
80 }
81
82 /**
83 * Gets all sallow paths for this user agent.
84 *
85 * @return array
86 */
87 public function get_allow_paths() {
88 return $this->allow_directive->get_paths();
89 }
90 }
91