PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
jetpack / jetpack_vendor / automattic / jetpack-premium-analytics / src / dashboard-grammar.php

dashboard-grammar.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-beta, at jetpack_vendor/automattic/jetpack-premium-analytics/src/dashboard-grammar.php

38 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Dashboard identifier grammar shared across Premium Analytics dashboard APIs.
4 *
5 * These accessors are the single source of truth for the dashboard and section
6 * identifier grammar, shared between the REST route definitions and the
7 * registry validation so the two can never drift apart.
8 *
9 * @package automattic/jetpack-premium-analytics
10 */
11
12 namespace Automattic\Jetpack\PremiumAnalytics;
13
14 /**
15 * Dashboard identifier pattern used by REST routes and dashboard registries.
16 *
17 * Allows the `<plugin>_<page>` form produced by the wp-build pipeline, while
18 * also accepting simple dashboard names for consumers that do not use a page
19 * suffix.
20 *
21 * @return string Unanchored regular expression fragment.
22 */
23 function get_dashboard_name_pattern() {
24 return '[a-z][a-z0-9-]*(?:_[a-z0-9-]+)*';
25 }
26
27 /**
28 * Dashboard section identifier pattern.
29 *
30 * Mirrors WordPress block and Premium Analytics widget type names: a namespace
31 * prefix followed by a section slug.
32 *
33 * @return string Unanchored regular expression fragment.
34 */
35 function get_dashboard_section_id_pattern() {
36 return '[a-z0-9-]+\/[a-z0-9-]+';
37 }
38