PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 2.2.2
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v2.2.2
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/Login.php +6 -40 3.0.62.2.2 View file →
@@ -13,12 +13,8 @@
13 13 if ( '/templately/v1/login' === $_route ) {
14 14 return true;
15 15 }
16 16
17 - if ( '/templately/v1/pricing' === $_route ) {
18 - return true;
19 - }
20 -
21 17 return parent::permission_check( $request );
22 18 }
23 19
24 20 public function register_routes() {
@@ -24,29 +20,10 @@
24 20 public function register_routes() {
25 21 $this->post( 'login', [$this, 'login'] );
26 22 $this->post( 'logout', [$this, 'logout'] );
27 23 $this->get( 'is-signed', [$this, 'is_signed'] );
28 - $this->get( 'pricing', [$this, 'pricing'] );
29 24 }
30 25
31 - public function pricing(){
32 - $data = get_transient( "templately_subscriptions" );
33 -
34 - if( is_array( $data ) && ! empty( $data ) ) {
35 - return $data;
36 - }
37 -
38 - $query = 'id, price, name, discounted_price, type, sites';
39 - $response = $this->http()->query(
40 - 'subscriptionPlans',
41 - $query
42 - )->post();
43 -
44 - set_transient( "templately_subscriptions", $response, WEEK_IN_SECONDS );
45 -
46 - return $response;
47 - }
48 -
49 26 public function login() {
50 27 $errors = [];
51 28 $_ip = Helper::get_ip();
52 29 $_site_url = home_url( '/' );
@@ -84,9 +61,9 @@
84 61 if ( ! empty( $errors ) ) {
85 62 return $this->error( 'login_error', $errors, 'login', 400 );
86 63 }
87 64
88 - $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 } }';
65 + $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 }';
89 66
90 67 $response = $this->http()->mutation(
91 68 $viaAPI ? 'connectWithApiKey' : 'connect',
92 69 $query,
@@ -125,16 +102,8 @@
125 102 unset( $response['user']['favourites'] );
126 103 $meta['favourites'] = $_favourites;
127 104 }
128 105
129 - if ( ! empty( $response['user']['reviews'] ) ) {
130 - $_reviews = $this->utils( 'helper' )->normalizeReviews( $response['user']['reviews'] );
131 - $this->utils( 'options' )->set( 'reviews', $_reviews );
132 -
133 - unset( $response['user']['reviews'] );
134 - $meta['reviews'] = $_reviews;
135 - }
136 -
137 106 $this->utils( 'options' )->set( 'user', $response['user'] );
138 107 $response['user']['meta'] = $this->user_meta( $meta );
139 108
140 109 return $response;
@@ -176,16 +145,14 @@
176 145 public function delete(){
177 146 $this->utils( 'options' )
178 147 ->remove( 'user' )
179 148 ->remove( 'favourites' )
180 - ->remove( 'reviews' )
181 149 ->remove( 'cloud_activity' )
182 150 ->remove( 'api_key' )
183 151 ->remove( 'global_login' )
184 - ->remove( 'total_download_counts' )
185 152 ->remove( 'templates_in_clouds' );
186 153
187 - if ( $this->utils( 'options' )->who_am_i() === 'global' ) {
154 + if ( $this->utils( 'options' )->whoami() === 'global' ) {
188 155 $this->utils( 'options' )->remove_global_login();
189 156 }
190 157
191 158 $global_user_id = $this->utils( 'options' )->is_global();
@@ -201,9 +168,9 @@
201 168
202 169 return $global_user;
203 170 }
204 171
205 - public static function is_signed(): array {
172 + public static function is_signed() {
206 173 $_response = [
207 174 'status' => 'success'
208 175 ];
209 176
@@ -221,9 +188,9 @@
221 188
222 189 return $_response;
223 190 }
224 191
225 - public function user_meta( $meta = [] ): array {
192 + public function user_meta( $meta = [] ) {
226 193 $_meta = [
227 194 'link_account' => self::utils( 'options' )->link_account(),
228 195 'unlink_account' => self::utils( 'options' )->unlink_account(),
229 196 'is_globally_signed' => Login::is_globally_signed(),
@@ -228,9 +195,8 @@
228 195 'unlink_account' => self::utils( 'options' )->unlink_account(),
229 196 'is_globally_signed' => Login::is_globally_signed(),
230 197 'signed_as_global' => Login::signed_as_global(),
231 198 'starred' => self::utils( 'options' )->get( 'favourites' ),
232 - 'reviews' => self::utils( 'options' )->get( 'reviews' ),
233 199 'cloud_activity' => self::utils( 'options' )->get( 'cloud_activity' ),
234 200 'has_api' => rest_sanitize_boolean( self::utils( 'options' )->get( 'api_key' ) )
235 201 ];
236 202
@@ -236,12 +202,12 @@
236 202
237 203 return array_merge( $_meta, $meta );
238 204 }
239 205
240 - public static function is_globally_signed(): bool {
206 + public static function is_globally_signed() {
241 207 return rest_sanitize_boolean( ( new static )->utils( 'options' )->is_globally_signed() );
242 208 }
243 209
244 - public static function signed_as_global(): bool {
210 + public static function signed_as_global() {
245 211 return rest_sanitize_boolean( ( new static )->utils( 'options' )->signed_as_global() );
246 212 }
247 213 }