| @@ -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,9 +145,8 @@ | ||
| 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 | 152 | ->remove( 'templates_in_clouds' ); |
| @@ -227,9 +195,8 @@ | ||
| 227 | 195 | 'unlink_account' => self::utils( 'options' )->unlink_account(), |
| 228 | 196 | 'is_globally_signed' => Login::is_globally_signed(), |
| 229 | 197 | 'signed_as_global' => Login::signed_as_global(), |
| 230 | 198 | 'starred' => self::utils( 'options' )->get( 'favourites' ), |
| 231 | - 'reviews' => self::utils( 'options' )->get( 'reviews' ), | |
| 232 | 199 | 'cloud_activity' => self::utils( 'options' )->get( 'cloud_activity' ), |
| 233 | 200 | 'has_api' => rest_sanitize_boolean( self::utils( 'options' )->get( 'api_key' ) ) |
| 234 | 201 | ]; |
| 235 | 202 | |