PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 11.5
Jetpack – WP Security, Backup, Speed, & Growth v11.5
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 14.3.1 All 501 releases
jetpack / sal / class.json-api-post-jetpack.php

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

91 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 * Base class for Jetpack_Post.
13 */
14 class Jetpack_Post extends SAL_Post {
15 /**
16 * Defines a default value for the like counts on a post, if this hasn't been defined yet.
17 *
18 * @return int Returns 0.
19 **/
20 public function get_like_count() {
21 return 0;
22 }
23
24 /**
25 * Defines a default value for whether or not the current user likes this post, if this hasn't been defined yet.
26 *
27 * @return bool Returns false
28 **/
29 public function is_liked() {
30 return false;
31 }
32
33 /**
34 * Defines a default value for whether or not the current user reblogged this post, if this hasn't been defined yet.
35 *
36 * @return bool Returns false
37 **/
38 public function is_reblogged() {
39 return false;
40 }
41
42 /**
43 * Defines a default value for whether or not the current user is following this blog, if this hasn't been defined yet.
44 *
45 * @return bool Returns false
46 **/
47 public function is_following() {
48 return false;
49 }
50
51 /**
52 * Defines the unique WordPress.com-wide representation of a post, if this hasn't been defined yet.
53 *
54 * @return string Returns an empty string
55 **/
56 public function get_global_id() {
57 return '';
58 }
59
60 /**
61 * Defines a default value for whether or not there is gelocation data for this post, if this hasn't been defined yet.
62 *
63 * @return bool Returns false
64 **/
65 public function get_geo() {
66 return false;
67 }
68
69 /**
70 * Returns the avatar URL for a user, or an empty string if there isn't a valid avatar.
71 *
72 * @param string $email The user's email.
73 * @param int $avatar_size The size of the avatar in pixels.
74 *
75 * @return string
76 */
77 protected function get_avatar_url( $email, $avatar_size = 96 ) {
78 $avatar_url = get_avatar_url(
79 $email,
80 array(
81 'size' => $avatar_size,
82 )
83 );
84
85 if ( ! $avatar_url || is_wp_error( $avatar_url ) ) {
86 return '';
87 }
88 return $avatar_url;
89 }
90 }
91