|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Data-only class for nav menu item objects. |
| 4 | + * Created to help static analysis. |
| 5 | + * |
| 6 | + * @package WordPress |
| 7 | + * @see wp_setup_nav_menu_item() |
| 8 | + */ |
| 9 | + |
| 10 | +/** |
| 11 | + * Decorates a menu item (WP_Post) object with the shared navigation menu item properties. |
| 12 | + */ |
| 13 | +class WP_Nav_Menu_Item { |
| 14 | + |
| 15 | + /** |
| 16 | + * The term_id if the menu item represents a taxonomy term. |
| 17 | + * |
| 18 | + * @overrides WP_Post |
| 19 | + * @var int |
| 20 | + */ |
| 21 | + public $ID; |
| 22 | + |
| 23 | + /** |
| 24 | + * The title attribute of the link element for this menu item. |
| 25 | + * |
| 26 | + * @var string |
| 27 | + */ |
| 28 | + public $attr_title; |
| 29 | + |
| 30 | + /** |
| 31 | + * The array of class attribute values for the link element of this menu item. |
| 32 | + * |
| 33 | + * @var array |
| 34 | + */ |
| 35 | + public $classes; |
| 36 | + |
| 37 | + /** |
| 38 | + * The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn't exist). |
| 39 | + * |
| 40 | + * @var int |
| 41 | + */ |
| 42 | + public $db_id; |
| 43 | + |
| 44 | + /** |
| 45 | + * The description of this menu item. |
| 46 | + * |
| 47 | + * @var string |
| 48 | + */ |
| 49 | + public $description; |
| 50 | + |
| 51 | + /** |
| 52 | + * The DB ID of the nav_menu_item that is this item's menu parent, if any. 0 otherwise. |
| 53 | + * |
| 54 | + * @var int |
| 55 | + */ |
| 56 | + public $menu_item_parent; |
| 57 | + |
| 58 | + /** |
| 59 | + * The type of object originally represented, such as "category," "post", or "attachment." |
| 60 | + * |
| 61 | + * @var string |
| 62 | + */ |
| 63 | + public $object; |
| 64 | + |
| 65 | + /** |
| 66 | + * The DB ID of the original object this menu item represents, |
| 67 | + * e.g. ID for posts and term_id for categories. |
| 68 | + * |
| 69 | + * @var int |
| 70 | + */ |
| 71 | + public $object_id; |
| 72 | + |
| 73 | + /** |
| 74 | + * The DB ID of the original object's parent object, if any (0 otherwise). |
| 75 | + * |
| 76 | + * @overrides WP_Post |
| 77 | + * @var int |
| 78 | + */ |
| 79 | + public $post_parent; |
| 80 | + |
| 81 | + /** |
| 82 | + * A "no title" label if menu item represents a post that lacks a title. |
| 83 | + * |
| 84 | + * @overrides WP_Post |
| 85 | + * @var string |
| 86 | + */ |
| 87 | + public $post_title; |
| 88 | + |
| 89 | + /** |
| 90 | + * The target attribute of the link element for this menu item. |
| 91 | + * |
| 92 | + * @var string |
| 93 | + */ |
| 94 | + public $target; |
| 95 | + |
| 96 | + /** |
| 97 | + * The title of this menu item. |
| 98 | + * |
| 99 | + * @var string |
| 100 | + */ |
| 101 | + public $title; |
| 102 | + |
| 103 | + /** |
| 104 | + * The family of objects originally represented, such as "post_type" or "taxonomy." |
| 105 | + * |
| 106 | + * @var string |
| 107 | + */ |
| 108 | + public $type; |
| 109 | + |
| 110 | + /** |
| 111 | + * The singular label used to describe this type of menu item. |
| 112 | + * |
| 113 | + * @var string |
| 114 | + */ |
| 115 | + public $type_label; |
| 116 | + |
| 117 | + /** |
| 118 | + * The URL to which this menu item points. |
| 119 | + * |
| 120 | + * @var string |
| 121 | + */ |
| 122 | + public $url; |
| 123 | + |
| 124 | + /** |
| 125 | + * The XFN relationship expressed in the link of this menu item. |
| 126 | + * |
| 127 | + * @var string |
| 128 | + */ |
| 129 | + public $xfn; |
| 130 | + |
| 131 | + /** |
| 132 | + * Whether the menu item represents an object that no longer exists. |
| 133 | + * |
| 134 | + * @var bool |
| 135 | + */ |
| 136 | + public $_invalid; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore |
| 137 | + |
| 138 | + /* Copy of WP_Post */ |
| 139 | + |
| 140 | + /** |
| 141 | + * ID of post author. |
| 142 | + * |
| 143 | + * A numeric string, for compatibility reasons. |
| 144 | + * |
| 145 | + * @var string |
| 146 | + */ |
| 147 | + public $post_author = 0; |
| 148 | + |
| 149 | + /** |
| 150 | + * The post's local publication time. |
| 151 | + * |
| 152 | + * @var string |
| 153 | + */ |
| 154 | + public $post_date = '0000-00-00 00:00:00'; |
| 155 | + |
| 156 | + /** |
| 157 | + * The post's GMT publication time. |
| 158 | + * |
| 159 | + * @var string |
| 160 | + */ |
| 161 | + public $post_date_gmt = '0000-00-00 00:00:00'; |
| 162 | + |
| 163 | + /** |
| 164 | + * The post's content. |
| 165 | + * |
| 166 | + * @var string |
| 167 | + */ |
| 168 | + public $post_content = ''; |
| 169 | + |
| 170 | + /** |
| 171 | + * The post's excerpt. |
| 172 | + * |
| 173 | + * @var string |
| 174 | + */ |
| 175 | + public $post_excerpt = ''; |
| 176 | + |
| 177 | + /** |
| 178 | + * The post's status. |
| 179 | + * |
| 180 | + * @var string |
| 181 | + */ |
| 182 | + public $post_status = 'publish'; |
| 183 | + |
| 184 | + /** |
| 185 | + * Whether comments are allowed. |
| 186 | + * |
| 187 | + * @var string |
| 188 | + */ |
| 189 | + public $comment_status = 'open'; |
| 190 | + |
| 191 | + /** |
| 192 | + * Whether pings are allowed. |
| 193 | + * |
| 194 | + * @var string |
| 195 | + */ |
| 196 | + public $ping_status = 'open'; |
| 197 | + |
| 198 | + /** |
| 199 | + * The post's password in plain text. |
| 200 | + * |
| 201 | + * @var string |
| 202 | + */ |
| 203 | + public $post_password = ''; |
| 204 | + |
| 205 | + /** |
| 206 | + * The post's slug. |
| 207 | + * |
| 208 | + * @var string |
| 209 | + */ |
| 210 | + public $post_name = ''; |
| 211 | + |
| 212 | + /** |
| 213 | + * URLs queued to be pinged. |
| 214 | + * |
| 215 | + * @var string |
| 216 | + */ |
| 217 | + public $to_ping = ''; |
| 218 | + |
| 219 | + /** |
| 220 | + * URLs that have been pinged. |
| 221 | + * |
| 222 | + * @var string |
| 223 | + */ |
| 224 | + public $pinged = ''; |
| 225 | + |
| 226 | + /** |
| 227 | + * The post's local modified time. |
| 228 | + * |
| 229 | + * @var string |
| 230 | + */ |
| 231 | + public $post_modified = '0000-00-00 00:00:00'; |
| 232 | + |
| 233 | + /** |
| 234 | + * The post's GMT modified time. |
| 235 | + * |
| 236 | + * @var string |
| 237 | + */ |
| 238 | + public $post_modified_gmt = '0000-00-00 00:00:00'; |
| 239 | + |
| 240 | + /** |
| 241 | + * A utility DB field for post content. |
| 242 | + * |
| 243 | + * @var string |
| 244 | + */ |
| 245 | + public $post_content_filtered = ''; |
| 246 | + |
| 247 | + /** |
| 248 | + * The unique identifier for a post, not necessarily a URL, used as the feed GUID. |
| 249 | + * |
| 250 | + * @var string |
| 251 | + */ |
| 252 | + public $guid = ''; |
| 253 | + |
| 254 | + /** |
| 255 | + * A field used for ordering posts. |
| 256 | + * |
| 257 | + * @var int |
| 258 | + */ |
| 259 | + public $menu_order = 0; |
| 260 | + |
| 261 | + /** |
| 262 | + * The post's type, like post or page. |
| 263 | + * |
| 264 | + * @var string |
| 265 | + */ |
| 266 | + public $post_type = 'post'; |
| 267 | + |
| 268 | + /** |
| 269 | + * An attachment's mime type. |
| 270 | + * |
| 271 | + * @var string |
| 272 | + */ |
| 273 | + public $post_mime_type = ''; |
| 274 | + |
| 275 | + /** |
| 276 | + * Cached comment count. |
| 277 | + * |
| 278 | + * A numeric string, for compatibility reasons. |
| 279 | + * |
| 280 | + * @var string |
| 281 | + */ |
| 282 | + public $comment_count = 0; |
| 283 | + |
| 284 | + /** |
| 285 | + * Stores the post object's sanitization level. |
| 286 | + * |
| 287 | + * Does not correspond to a DB field. |
| 288 | + * |
| 289 | + * @var string |
| 290 | + */ |
| 291 | + public $filter; |
| 292 | +} |
0 commit comments