build_data(); } /** * Builds all the required data for the context object. */ private function build_data() { $this->breadcrumbs_enabled = current_theme_supports( 'yoast-seo-breadcrumbs' ); if ( ! $this->breadcrumbs_enabled ) { $this->breadcrumbs_enabled = WPSEO_Options::get( 'breadcrumbs-enable', false ); } $front = WPSEO_Frontend::get_instance(); $this->canonical = $front->canonical( false ); $this->title = $front->title( '' ); $this->description = $front->metadesc( false ); $this->site_name = $this->set_site_name(); $this->site_represents = WPSEO_Options::get( 'company_or_person', '' ); $this->site_url = trailingslashit( WPSEO_Utils::home_url() ); if ( $this->site_represents === 'company' ) { $this->company_name = WPSEO_Options::get( 'company_name' ); } if ( $this->site_represents === 'person' ) { $this->site_user_id = WPSEO_Options::get( 'company_or_person_user_id', false ); } $this->id = get_queried_object_id(); } /** * Retrieves the site's name from settings. * * @return string */ private function set_site_name() { if ( '' !== WPSEO_Options::get( 'website_name', '' ) ) { return WPSEO_Options::get( 'website_name' ); } return get_bloginfo( 'name' ); } }