È/¢FÄ >=25 <=27 @¢FÄ ×jf-®Øwƒ signature x@¢FÄ ç“‚±æËÛ translations (@¢FÄ Lä++Äwƒ changelog P@¢FÄ ·ÿ{±ëµƒ signatureDigest @¢FÄ /ˆÕÞùñ phpExtensions È@¢FÄ ÍvÂ2Åwƒ databases ð@¢FÄ Îû©Cû4· shellCommands A¢FÄ ~f¥Ý± phpVersionSpec @A¢FÄ O±Ö5jñqò minIntSize hA¢FÄ ÝQ„Cöæ€ download A¢FÄ ›l¨Cç€ licenses ¸A¢FÄ :CÈæÕÕ lastModified àA¢FÄ ‘hK?Ìwƒ isNightly B¢FÄ >=24 <=24 0B¢FÄ ×jf-®Øwƒ signature ¨B¢FÄ ç“‚±æËÛ translations XB¢FÄ Lä++Äwƒ changelog €B¢FÄ ·ÿ{±ëµƒ signatureDigest ÐB¢FÄ /ˆÕÞùñ phpExtensions øB¢FÄ ÍvÂ2Åwƒ databases C¢FÄ Îû©Cû4· shellCommands HC¢FÄ ~f¥Ý± phpVersionSpec pC¢FÄ O±Ö5jñqò minIntSize ˜C¢FÄ ÝQ„Cöæ€ download ÀC¢FÄ ›l¨Cç€ licenses èC¢FÄ :CÈæÕÕ lastModified D¢FÄ ‘hK?Ìwƒ isNightly 8D¢FÄ >=25 <=26 `D¢FÄ ×jf-®Øwƒ signature ØD¢FÄ ç“‚±æËÛ translations ˆD¢FÄ Lä++Äwƒ changelog °D¢FÄ ·ÿ{±ëµƒ signatureDigest E¢FÄ /ˆÕÞùñ phpExtensions (E¢FÄ ÍvÂ2Åwƒ databases PE¢FÄ Îû©Cû4· shellCommands xE¢FÄ ~f¥Ý± phpVersionSpec E¢FÄ O±Ö5jñqò minIntSize ÈE¢FÄ ÝQ„Cöæ€ download ðE¢FÄ ›l¨Cç€ licenses F¢FÄ :CÈæÕÕ lastModified @F¢FÄ ‘hK?Ìwƒ isNightly hF¢FÄ >=25 <=26 F¢FÄ ×jf-®Øwƒ signature G¢FÄ ç“‚±æËÛ translations ¸F¢FÄ Lä++Äwƒ changelog àF¢FÄ ·ÿ{±ëµƒ signatureDigest 0G¢FÄ /ˆÕÞùñ phpExtensions XG¢FÄ ÍvÂ2Åwƒ databases €G¢FÄ Îû©Cû4· shellCommands ¨G¢FÄ ~f¥Ý± phpVersionSpec ÐG¢FÄ O±Ö5jñqò minIntSize øG¢FÄ ÝQ„Cöæ€ download H¢FÄ ›l¨Cç€ licenses HH¢FÄ :CÈæÕÕ lastModified pH¢FÄ ‘hK?Ìwƒ isNightly ˜H¢FÄ >=25 <=26 ÀH¢FÄ ×jf-®Øwƒ signature 8I¢FÄ ç“‚±æËÛ translations èH¢FÄ Lä++Äwƒ changelog I¢FÄ ·ÿ{±ëµƒ signatureDigest `I¢FÄ /ˆÕÞùñ phpExtensions ˆI¢FÄ ÍvÂ2Åwƒ databases °I¢FÄ Îû©Cû4· shellCommands ØI¢FÄ ~f¥Ý± phpVersionSpec J¢FÄ O±Ö5jñqò minIntSize (J¢FÄ ÝQ„Cöæ€ download PJ¢FÄ ›l¨Cç€ licenses xJ¢FÄ :CÈæÕÕ lastModified J¢FÄ ‘hK?Ìwƒ isNightly ÈJ¢FÄ >=25 <=25 ðJ¢FÄ ×jf-®Øwƒ signature hK¢FÄ ç“‚±æËÛ translations K¢FÄ Lä++Äwƒ changelog @K¢FÄ ·ÿ{±ëµƒ signatureDigest K¢FÄ /ˆÕÞùñ phpExtensions ¸K¢FÄ ÍvÂ2Åwƒ databases àK¢FÄ Îû©Cû4· shellCommands L¢FÄ ~f¥Ý± phpVersionSpec 0L¢FÄ O±Ö5jñqò minIntSize XL¢FÄ ÝQ„Cöæ€ download €L¢FÄ ›l¨Cç€ licenses ¨L¢FÄ :CÈæÕÕ lastModified ÐL¢FÄ ‘hK?Ìwƒ isNightly øL¢FÄ >=25 <=25 M¢FÄ ×jf-®Øwƒ signature ˜M¢FÄ ç“‚±æËÛ translations HM¢FÄ Lä++Äwƒ changelog pM¢FÄ ·ÿ{±ëµƒ signatureDigest ÀM¢FÄ /ˆÕÞùñ phpExtensions èM¢FÄ ÍvÂ2Åwƒ databases N¢FÄ Îû©Cû4· shellCommands 8N¢FÄ ~f¥Ý± phpVersionSpec `N¢FÄ O±Ö5jñqò minIntSize ˆN¢FÄ ÝQ„Cöæ€ download °N¢FÄ ›l¨Cç€ licenses ØN¢FÄ :CÈæÕÕ lastModified O¢FÄ ‘hK?Ìwƒ isNightly (O¢FÄ >=25 <=25 PO¢FÄ ×jf-®Øwƒ signature ÈO¢FÄ ç“‚±æËÛ translations xO¢FÄ Lä++Äwƒ changelog ( $post_type ); if ( ! $indexable ) { return false; } return $this->build_meta( $this->context_memoizer->get( $indexable, 'Post_Type_Archive' ) ); } /** * Returns the meta tags context for the search result page. * * @return Meta|false The meta values. False if none could be found. */ public function for_search_result() { $indexable = $this->repository->find_for_system_page( 'search-result' ); if ( ! $indexable ) { return false; } return $this->build_meta( $this->context_memoizer->get( $indexable, 'Search_Result_Page' ) ); } /** * Returns the meta tags context for the search result page. * * @return Meta|false The meta values. False if none could be found. */ public function for_404() { $indexable = $this->repository->find_for_system_page( '404' ); if ( ! $indexable ) { return false; } return $this->build_meta( $this->context_memoizer->get( $indexable, 'Error_Page' ) ); } /** * Returns the meta tags context for a post. * * @param int $id The ID of the post. * * @return Meta|false The meta values. False if none could be found. */ public function for_post( $id ) { $indexable = $this->repository->find_by_id_and_type( $id, 'post' ); if ( ! $indexable ) { return false; } return $this->build_meta( $this->context_memoizer->get( $indexable, 'Post_Type' ) ); } /** * Returns the meta tags context for a number of posts. * * @param int[] $ids The IDs of the posts. * * @return Meta[]|false The meta values. False if none could be found. */ public function for_posts( $ids ) { $indexables = $this->repository->find_by_multiple_ids_and_type( $ids, 'post' ); if ( empty( $indexables ) ) { return false; } // Remove all false values. $indexables = \array_filter( $indexables ); return \array_map( function( $indexable ) { return $this->build_meta( $this->context_memoizer->get( $indexable, 'Post_Type' ) ); }, $indexables ); } /** * Returns the meta tags context for a term. * * @param int $id The ID of the term. * * @return Meta|false The meta values. False if none could be found. */ public function for_term( $id ) { $indexable = $this->repository->find_by_id_and_type( $id, 'term' ); if ( ! $indexable ) { return false; } return $this->build_meta( $this->context_memoizer->get( $indexable, 'Term_Archive' ) ); } /** * Returns the meta tags context for an author. * * @param int $id The ID of the author. * * @return Meta|false The meta values. False if none could be found. */ public function for_author( $id ) { $indexable = $this->repository->find_by_id_and_type( $id, 'user' ); if ( ! $indexable ) { return false; } return $this->build_meta( $this->context_memoizer->get( $indexable, 'Author_Archive' ) ); } /** * Returns the meta for an indexable. * * @param Indexable $indexable The indexable. * @param string|null $page_type Optional. The page type if already known. * * @return Meta|false The meta values. False if none could be found. */ public function for_indexable( $indexable, $page_type = null ) { if ( ! \is_a( $indexable, Indexable::class ) ) { return false; } if ( \is_null( $page_type ) ) { $page_type = $this->indexable_helper->get_page_type_for_indexable( $indexable ); } return $this->build_meta( $this->context_memoizer->get( $indexable, $page_type ) ); } /** * Returns the meta for an indexable. * * @param Indexable[] $indexables The indexables. * @param string|null $page_type Optional. The page type if already known. * * @return Meta|false The meta values. False if none could be found. */ public function for_indexables( $indexables, $page_type = null ) { $closure = function( $indexable ) use ( $page_type ) { $this_page_type = $page_type; if ( \is_null( $this_page_type ) ) { $this_page_type = $this->indexable_helper->get_page_type_for_indexable( $indexable ); } return $this->build_meta( $this->context_memoizer->get( $indexable, $this_page_type ) ); }; return \array_map( $closure, $indexables ); } /** * Returns the meta tags context for a url. * * @param string $url The url of the page. Required to be relative to the site url. * * @return Meta|false The meta values. False if none could be found. */ public function for_url( $url ) { $url_parts = \wp_parse_url( $url ); $site_parts = \wp_parse_url( \site_url() ); if ( ( ! \is_array( $url_parts ) || ! \is_array( $site_parts ) ) || ! isset( $url_parts['host'], $url_parts['path'], $site_parts['host'], $site_parts['scheme'] ) ) { return false; } if ( $url_parts['host'] !== $site_parts['host'] ) { return false; } // Ensure the scheme is consistent with values in the DB. $url = $site_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path']; if ( $this->is_date_archive_url( $url ) ) { $indexable = $this->repository->find_for_date_archive(); } else { $indexable = $this->repository->find_by_permalink( $url ); } // If we still don't have an indexable abort, the WP globals could be anything so we can't use the unknown indexable. if ( ! $indexable ) { return false; } $page_type = $this->indexable_helper->get_page_type_for_indexable( $indexable ); if ( $page_type === false ) { return false; } return $this->build_meta( $this->context_memoizer->get( $indexable, $page_type ) ); } /** * Checks if a given URL is a date archive URL. * * @param string $url The url. * * @return bool */ protected function is_date_archive_url( $url ) { $path = \wp_parse_url( $url, \PHP_URL_PATH ); if ( $path === null ) { return false; } $path = \ltrim( $path, '/' ); $wp_rewrite = $this->wp_rewrite_wrapper->get(); $date_rewrite = $wp_rewrite->generate_rewrite_rules( $wp_rewrite->get_date_permastruct(), \EP_DATE ); $date_rewrite = \apply_filters( 'date_rewrite_rules', $date_rewrite ); foreach ( (array) $date_rewrite as $match => $query ) { if ( \preg_match( "#^$match#", $path ) ) { return true; } } return false; } /** * Creates a new meta value object * * @param Meta_Tags_Context $context The meta tags context. * * @return Meta The meta value */ protected function build_meta( Meta_Tags_Context $context ) { return new Meta( $context, $this->container ); } }