Site information. */ protected function get_site_information_default() { return (object) [ 'url' => WPSEO_Utils::get_home_url(), 'subscriptions' => [], ]; } /** * Maps the plugin API response. * * @param object $site_information Site information as received from the API. * * @return stdClass Mapped site information. */ protected function map_site_information( $site_information ) { return (object) [ 'url' => $site_information->url, 'subscriptions' => array_map( [ $this, 'map_subscription' ], $site_information->subscriptions ), ]; } /** * Maps a plugin subscription. * * @param object $subscription Subscription information as received from the API. * * @return stdClass Mapped subscription. */ protected function map_subscription( $subscription ) { // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- Not our properties. return (object) [ 'renewal_url' => $subscription->renewalUrl, 'expiry_date' => $subscription->expiryDate, 'product' => (object) [ 'version' => $subscription->product->version, 'name' => $subscription->product->name, 'slug' => $subscription->product->slug, 'last_updated' => $subscription->product->lastUpdated, 'store_url' => $subscription->product->storeUrl, // Ternary operator is necessary because download can be undefined. 'download' => ( $subscription->product->download ?? null ), 'changelog' => $subscription->product->changelog, ], ]; // phpcs:enable } /** * Retrieves the site information. * * @return stdClass The site information. */ private function get_site_information() { if ( ! $this->has_installed_addons() ) { return $this->get_site_information_default(); } return $this->get_myyoast_site_information(); } /** * Retrieves the contents for the support section. * * @return string The support section content. */ protected function get_support_section() { return '
' /* translators: 1: expands to that refers to the help page, 2: closing tag. */ . sprintf( __( 'You can probably find an answer to your question in our %1$shelp center%2$s.', 'wordpress-seo' ), '', '' ) . ' ' /* translators: %s expands to a mailto support link. */ . sprintf( __( 'If you still need support and have an active subscription for this product, please email %s.', 'wordpress-seo' ), 'support@yoast.com' ) . '
'; } }