uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } } uthor_meta( $user_id, $key ) { $value = \get_the_author_meta( $key, $user_id ); if ( \is_string( $value ) && $value === '' ) { return null; } return $value; } /** * Finds an alternative image for the social image. * * @param Indexable $indexable The indexable. * * @return array|bool False when not found, array with data when found. */ protected function find_alternative_image( Indexable $indexable ) { $gravatar_image = \get_avatar_url( $indexable->object_id, [ 'size' => 500, 'scheme' => 'https', ] ); if ( $gravatar_image ) { return [ 'image' => $gravatar_image, 'source' => 'gravatar-image', ]; } return false; } /** * Returns the timestamps for a given author. * * @param int $author_id The author ID. * * @return object An object with last_modified and published_at timestamps. */ protected function get_object_timestamps( $author_id ) { global $wpdb; $post_statuses = $this->post_helper->get_public_post_statuses(); $replacements = []; $replacements[] = 'post_modified_gmt'; $replacements[] = 'post_date_gmt'; $replacements[] = $wpdb->posts; $replacements[] = 'post_status'; $replacements = \array_merge( $replacements, $post_statuses ); $replacements[] = 'post_password'; $replacements[] = 'post_author'; $replacements[] = $author_id; //phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized. //phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. //phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. return $wpdb->get_row( $wpdb->prepare( ' SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at FROM %i AS p WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.%i = '' AND p.%i = %d ", $replacements ) ); //phpcs:enable } /** * Checks if the user should be indexed. * Returns an exception with an appropriate message if not. * * @param string $user_id The user id. * * @return Author_Not_Built_Exception|null The exception if it should not be indexed, or `null` if it should. */ protected function check_if_user_should_be_indexed( $user_id ) { $exception = null; if ( $this->author_archive->are_disabled() ) { $exception = Author_Not_Built_Exception::author_archives_are_disabled( $user_id ); } // We will check if the author has public posts the WP way, instead of the indexable way, to make sure we get proper results even if SEO optimization is not run. // In case the user has no public posts, we check if the user should be indexed anyway. elseif ( $this->options_helper->get( 'noindex-author-noposts-wpseo', false ) === true && $this->author_archive->author_has_public_posts_wp( $user_id ) === false ) { $exception = Author_Not_Built_Exception::author_archives_are_not_indexed_for_users_without_posts( $user_id ); } /** * Filter: Include or exclude a user from being build and saved as an indexable. * Return an `Author_Not_Built_Exception` when the indexable should not be build, with an appropriate message telling why it should not be built. * Return `null` if the indexable should be build. * * @param Author_Not_Built_Exception|null $exception An exception if the indexable is not being built, `null` if the indexable should be built. * @param string $user_id The ID of the user that should or should not be excluded. */ return \apply_filters( 'wpseo_should_build_and_save_user_indexable', $exception, $user_id ); } }
Fatal error: Uncaught Error: Class "Yoast\WP\SEO\Builders\Indexable_Author_Builder" not found in /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php:1520 Stack trace: #0 /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php(1534): Yoast\WP\SEO\Generated\Cached_Container->getIndexableAuthorBuilderService() #1 /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php(5513): Yoast\WP\SEO\Generated\Cached_Container->getIndexableBuilderService() #2 /htdocs/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php(212): Yoast\WP\SEO\Generated\Cached_Container->getIndexableRepositoryService() #3 /htdocs/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php(195): YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container->make('Yoast\\WP\\SEO\\Re...', 1) #4 /htdocs/wp-content/plugins/wordpress-seo/src/surfaces/classes-surface.php(38): YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container->get('Yoast\\WP\\SEO\\Re...') #5 /htdocs/wp-content/plugins/wordpress-seo/inc/class-wpseo-admin-bar-menu.php(134): Yoast\WP\SEO\Surfaces\Classes_Surface->get('Yoast\\WP\\SEO\\Re...') #6 /htdocs/wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php(20): WPSEO_Admin_Bar_Menu->__construct() #7 /htdocs/wp-includes/class-wp-hook.php(341): wpseo_initialize_admin_bar('') #8 /htdocs/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array) #9 /htdocs/wp-includes/plugin.php(522): WP_Hook->do_action(Array) #10 /htdocs/wp-settings.php(764): do_action('wp_loaded') #11 /htdocs/wp-config.php(105): require_once('/htdocs/wp-sett...') #12 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #13 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #14 /htdocs/index.php(41): require('/htdocs/wp-blog...') #15 {main} thrown in /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php on line 1520