PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 2.2.10
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v2.2.10
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | includes/API/Profile.php +6 -34 3.7.22.2.10 View file →
@@ -14,9 +14,9 @@
14 14 $this->get( 'profile/purchased-items', [ $this, 'get_my_purchased_items' ] );
15 15 }
16 16
17 17 public function sync() {
18 - $query = 'status, message, user{ id, name, first_name, last_name, display_name, email, profile_photo, joined, is_verified, api_key, plan, plan_expire_at, my_cloud{ limit, usages, last_pushed }, favourites{ id, type }, show_notice, reviews{ type, type_id, rating } }';
18 + $query = 'status, message, user{ id, name, first_name, last_name, display_name, email, profile_photo, joined, is_verified, api_key, plan, plan_expire_at, my_cloud{ limit, usages, last_pushed }, favourites{ id, type }, show_notice }';
19 19
20 20 $funcArgs = [
21 21 'api_key' => $this->api_key,
22 22 'site_url' => home_url( '/' ),
@@ -48,36 +48,8 @@
48 48 unset( $response['user']['favourites'] );
49 49 $meta['favourites'] = $_favourites;
50 50 }
51 51
52 - if ( ! empty( $response['user']['reviews'] ) ) {
53 - $_reviews = $this->utils( 'helper' )->normalizeReviews( $response['user']['reviews'] );
54 - $this->utils( 'options' )->set( 'reviews', $_reviews );
55 -
56 - unset( $response['user']['reviews'] );
57 - $meta['reviews'] = $_reviews;
58 - }
59 -
60 - if ( ! empty( $response['user']['reviews'] ) ) {
61 - $_reviews = $this->utils( 'helper' )->normalizeReviews( $response['user']['reviews'] );
62 - $this->utils( 'options' )->set( 'reviews', $_reviews );
63 -
64 - unset( $response['user']['reviews'] );
65 - $meta['reviews'] = $_reviews;
66 - }
67 -
68 - if ( ! empty( $response['user'] ) && is_array( $response['user'] ) ) {
69 - /**
70 - * The cloud API key must never be persisted here or sent to the client.
71 - * Under a global login this key belongs to the admin, while any user with
72 - * `delete_posts` can reach this endpoint. Login and SignUp already drop it.
73 - */
74 - unset( $response['user']['api_key'] );
75 -
76 - $response['user']['site_url'] = base64_encode( home_url( '/' ) );
77 - $response['user']['ip'] = Helper::get_ip();
78 - }
79 -
80 52 $this->utils( 'options' )->set( 'user', $response['user'] );
81 53 $response['user']['meta'] = Login::get_instance()->user_meta( $meta );
82 54
83 55 return $this->success( $response );
@@ -89,9 +61,9 @@
89 61 ];
90 62
91 63 $response = $this->http()->query( 'isVerifiedUser', '', $funcArgs )->post();
92 64
93 - if ( $response && !is_wp_error( $response ) ) {
65 + if ( $response ) {
94 66 $user = $this->utils( 'options' )->get( 'user' );
95 67
96 68 $user['is_verified'] = true;
97 69 $this->utils( 'options' )->set( 'user', $user );
@@ -110,9 +82,9 @@
110 82 "page" => $page
111 83 ] )->post();
112 84
113 85 if ( is_wp_error( $response ) ) {
114 - return $this->error( 'invalid_download_history_response', __( $response->get_error_message(), 'templately' ), 'profile/download-history' );
86 + return $this->error( 'invalid_download_history_response', __( $response->get_error_message(), 'templately' ), 'profile/download-history', $response->get_error_code() );
115 87 }
116 88
117 89 if ( isset( $response['total'] ) ) {
118 90 $this->utils( 'options' )->set( 'total_download_counts', $response['total'] );
@@ -141,9 +113,9 @@
141 113
142 114 $response = $this->http()->mutation( 'myFavouriteItem', 'total_page, current_page, data { id, name, rating, type, slug, favourite_count, thumbnail, thumbnail2, thumbnail3, price, author{ display_name, name, joined }, dependencies{ id, name, icon, plugin_file, plugin_original_slug, is_pro, link } }', $funcArgs )->post();
143 115
144 116 if ( is_wp_error( $response ) ) {
145 - return $this->error( 'invalid_my_favourites_response', __( $response->get_error_message(), 'templately' ), 'profile/my-favourites' );
117 + return $this->error( 'invalid_my_favourites_response', __( $response->get_error_message(), 'templately' ), 'profile/my-favourites', $response->get_error_code() );
146 118 }
147 119
148 120 return $response;
149 121 }
@@ -151,13 +123,11 @@
151 123 public function get_my_purchased_items() {
152 124 $page = $this->get_param( 'page', 1, 'intval' );
153 125 $per_page = $this->get_param( 'per_page', 10, 'intval' );
154 126 $_all = $this->get_param( 'all', false );
155 - $platform = $this->get_param( 'platform', 'elementor' );
156 127
157 128 $funcArgs = [
158 129 'api_key' => $this->api_key,
159 - 'platform' => $platform,
160 130 'page' => $page,
161 131 'per_page' => $per_page
162 132 ];
163 133
@@ -168,8 +138,10 @@
168 138 $funcArgs['per_page'] = -1;
169 139 }
170 140
171 141 $response = $this->http()->query( 'myItems', $query, $funcArgs )->post();
142 +
143 + // dlog( $response );
172 144
173 145 if ( $response ) {
174 146 // $user = $this->utils('options')->get('user');
175 147