PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
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 13.8.3 All 506 releases
jetpack / jetpack_vendor / automattic / jetpack-search / src / class-stats.php

class-stats.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.5, at jetpack_vendor/automattic/jetpack-search/src/class-stats.php

42 lines 745 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Get search stats for use in the wp-admin dashboard.
4 *
5 * @package automattic/jetpack-search
6 */
7
8 namespace Automattic\Jetpack\Search;
9
10 use Automattic\Jetpack\Connection\Client;
11 use Jetpack_Options;
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit( 0 );
15 }
16
17 /**
18 * Search stats (e.g. post count, post type breakdown)
19 */
20 class Stats {
21 /**
22 * Get stats from the WordPress.com API for the current blog ID.
23 */
24 public function get_stats_from_wpcom() {
25 $blog_id = Jetpack_Options::get_option( 'id' );
26
27 if ( ! is_numeric( $blog_id ) ) {
28 return null;
29 }
30
31 $response = Client::wpcom_json_api_request_as_blog(
32 '/sites/' . (int) $blog_id . '/jetpack-search/stats',
33 '2',
34 array(),
35 null,
36 'wpcom'
37 );
38
39 return $response;
40 }
41 }
42