g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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 ); } } g( $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 ) { $post_statuses = $this->post_helper->get_public_post_statuses(); $sql = " SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at FROM {$this->wpdb->posts} AS p WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ") AND p.post_password = '' AND p.post_author = %d "; $replacements = \array_merge( $post_statuses, [ $author_id ] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare. return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $replacements ) ); } /** * 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. if ( $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:1465 Stack trace: #0 /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php(1479): Yoast\WP\SEO\Generated\Cached_Container->getIndexableAuthorBuilderService() #1 /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php(5166): Yoast\WP\SEO\Generated\Cached_Container->getIndexableBuilderService() #2 /htdocs/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php(271): Yoast\WP\SEO\Generated\Cached_Container->getIndexableRepositoryService() #3 /htdocs/wp-content/plugins/wordpress-seo/src/surfaces/classes-surface.php(38): YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container->get('Yoast\\WP\\SEO\\Re...') #4 /htdocs/wp-content/plugins/wordpress-seo/inc/class-wpseo-admin-bar-menu.php(131): Yoast\WP\SEO\Surfaces\Classes_Surface->get('Yoast\\WP\\SEO\\Re...') #5 /htdocs/wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php(20): WPSEO_Admin_Bar_Menu->__construct() #6 /htdocs/wp-includes/class-wp-hook.php(308): wpseo_initialize_admin_bar('') #7 /htdocs/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #8 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #9 /htdocs/wp-settings.php(639): do_action('wp_loaded') #10 /htdocs/wp-config.php(86): require_once('/htdocs/wp-sett...') #11 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #12 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #13 /htdocs/index.php(17): require('/htdocs/wp-blog...') #14 {main} thrown in /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php on line 1465