diff --git a/classes/Admin/AdminBar.php b/classes/Admin/AdminBar.php index 6796d750..61ad60f9 100644 --- a/classes/Admin/AdminBar.php +++ b/classes/Admin/AdminBar.php @@ -169,7 +169,7 @@ public function get_admin_bar_profile_callback() { 'plan_label' => $this->user->plan_label, 'plan_with_quota' => $this->user->is_free() || $this->user->is_growth(), 'unconsumed_quota' => $unconsumed_quota, - 'user_quota' => $this->user->quota, + 'user_quota' => $this->user->get_quota(), 'next_update' => $this->user->next_date_update, 'text' => $text, 'button_text' => $button_text, diff --git a/classes/Admin/AdminSubscriber.php b/classes/Admin/AdminSubscriber.php index edc79b39..32dc7630 100644 --- a/classes/Admin/AdminSubscriber.php +++ b/classes/Admin/AdminSubscriber.php @@ -50,9 +50,9 @@ public static function get_subscribed_events() { * @return array */ public function plugin_action_links( $actions ) { - $text = 1 !== $this->user->plan_id ? __( 'Documentation', 'imagify' ) : __( 'Upgrade', 'imagify' ); - $url = 1 !== $this->user->plan_id ? 'documentation' : 'subscription'; - $class = 1 !== $this->user->plan_id ? '' : ' class="imagify-plugin-upgrade"'; + $text = 1 !== $this->user->get_plan_id() ? __( 'Documentation', 'imagify' ) : __( 'Upgrade', 'imagify' ); + $url = 1 !== $this->user->get_plan_id() ? 'documentation' : 'subscription'; + $class = 1 !== $this->user->get_plan_id() ? '' : ' class="imagify-plugin-upgrade"'; array_unshift( $actions, sprintf( '%s', esc_url( imagify_get_external_url( $url ) ), diff --git a/classes/User/User.php b/classes/User/User.php index 93339c67..59cd66a5 100755 --- a/classes/User/User.php +++ b/classes/User/User.php @@ -336,4 +336,26 @@ public function get_email() { return $this->email; } + + /** + * Get plan id. + * + * @return int + */ + public function get_plan_id() { + $this->init_user(); + + return $this->plan_id; + } + + /** + * Get user quota. + * + * @return int + */ + public function get_quota() { + $this->init_user(); + + return $this->quota; + } } diff --git a/inc/functions/admin.php b/inc/functions/admin.php index efe7c935..566b34e7 100755 --- a/inc/functions/admin.php +++ b/inc/functions/admin.php @@ -411,7 +411,7 @@ function imagify_cache_user() { } } - $data->quota_formatted = imagify_size_format( $user->quota * pow( 1024, 2 ) ); + $data->quota_formatted = imagify_size_format( $user->get_quota() * pow( 1024, 2 ) ); $data->next_date_update_formatted = date_i18n( get_option( 'date_format' ), strtotime( $user->next_date_update ) ); if ( imagify_is_active_for_network() ) {