PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.2
Jetpack – WP Security, Backup, Speed, & Growth v16.2
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 13.9.2 14.0.1 14.1.1 14.2.2 All 502 releases
jetpack / sal / class.json-api-post-jetpack.php

class.json-api-post-jetpack.php in Jetpack – WP Security, Backup, Speed, & Growth 16.2, at sal/class.json-api-post-jetpack.php

96 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 /**
3 * This class extends the SAL_Post class, providing the implementation for
4 * functions that were declared in that SAL_Post class.
5 *
6 * @see WPCOM_JSON_API_Post_v1_1_Endpoint in class.wpcom-json-api-post-v1-1-endpoint.php for more context on
7 * the functions implemented here.
8 *
9 * @package automattic/jetpack
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit( 0 );
14 }
15
16 /**
17 * Base class for Jetpack_Post.
18 */
19 class Jetpack_Post extends SAL_Post {
20 /**
21 * Defines a default value for the like counts on a post, if this hasn't been defined yet.
22 *
23 * @return int Returns 0.
24 **/
25 public function get_like_count() {
26 return 0;
27 }
28
29 /**
30 * Defines a default value for whether or not the current user likes this post, if this hasn't been defined yet.
31 *
32 * @return bool Returns false
33 **/
34 public function is_liked() {
35 return false;
36 }
37
38 /**
39 * Defines a default value for whether or not the current user reblogged this post, if this hasn't been defined yet.
40 *
41 * @return bool Returns false
42 **/
43 public function is_reblogged() {
44 return false;
45 }
46
47 /**
48 * Defines a default value for whether or not the current user is following this blog, if this hasn't been defined yet.
49 *
50 * @return bool Returns false
51 **/
52 public function is_following() {
53 return false;
54 }
55
56 /**
57 * Defines the unique WordPress.com-wide representation of a post, if this hasn't been defined yet.
58 *
59 * @return string Returns an empty string
60 **/
61 public function get_global_id() {
62 return '';
63 }
64
65 /**
66 * Defines a default value for whether or not there is gelocation data for this post, if this hasn't been defined yet.
67 *
68 * @return bool Returns false
69 **/
70 public function get_geo() {
71 return false;
72 }
73
74 /**
75 * Returns the avatar URL for a user, or an empty string if there isn't a valid avatar.
76 *
77 * @param string $email The user's email.
78 * @param int $avatar_size The size of the avatar in pixels.
79 *
80 * @return string
81 */
82 protected function get_avatar_url( $email, $avatar_size = 96 ) {
83 $avatar_url = get_avatar_url(
84 $email,
85 array(
86 'size' => $avatar_size,
87 )
88 );
89
90 if ( ! $avatar_url || is_wp_error( $avatar_url ) ) {
91 return '';
92 }
93 return $avatar_url;
94 }
95 }
96