ster_font_collection( $slug ); } /** * Retrieves font uploads directory information. * * Same as wp_font_dir() but "light weight" as it doesn't attempt to create the font uploads directory. * Intended for use in themes, when only 'basedir' and 'baseurl' are needed, generally in all cases * when not uploading files. * * @since 6.5.0 * * @see wp_font_dir() * * @return array See wp_font_dir() for description. */ function wp_get_font_dir() { return wp_font_dir( false ); } /** * Returns an array containing the current fonts upload directory's path and URL. * * @since 6.5.0 * * @param bool $create_dir Optional. Whether to check and create the font uploads directory. Default true. * @return array { * Array of information about the font upload directory. * * @type string $path Base directory and subdirectory or full path to the fonts upload directory. * @type string $url Base URL and subdirectory or absolute URL to the fonts upload directory. * @type string $subdir Subdirectory * @type string $basedir Path without subdir. * @type string $baseurl URL path without subdir. * @type string|false $error False or error message. * } */ function wp_font_dir( $create_dir = true ) { /* * Allow extenders to manipulate the font directory consistently. * * Ensures the upload_dir filter is fired both when calling this function * directly and when the upload directory is filtered in the Font Face * REST API endpoint. */ add_filter( 'upload_dir', '_wp_filter_font_directory' ); $font_dir = wp_upload_dir( null, $create_dir, false ); remove_filter( 'upload_dir', '_wp_filter_font_directory' ); return $font_dir; } /** * A callback function for use in the {@see 'upload_dir'} filter. * * This function is intended for internal use only and should not be used by plugins and themes. * Use wp_get_font_dir() instead. * * @since 6.5.0 * @access private * * @param string $font_dir The font directory. * @return string The modified font directory. */ function _wp_filter_font_directory( $font_dir ) { if ( doing_filter( 'font_dir' ) ) { // Avoid an infinite loop. return $font_dir; } $font_dir = array( 'path' => untrailingslashit( $font_dir['basedir'] ) . '/fonts', 'url' => untrailingslashit( $font_dir['baseurl'] ) . '/fonts', 'subdir' => '', 'basedir' => untrailingslashit( $font_dir['basedir'] ) . '/fonts', 'baseurl' => untrailingslashit( $font_dir['baseurl'] ) . '/fonts', 'error' => false, ); /** * Filters the fonts directory data. * * This filter allows developers to modify the fonts directory data. * * @since 6.5.0 * * @param array $font_dir { * Array of information about the font upload directory. * * @type string $path Base directory and subdirectory or full path to the fonts upload directory. * @type string $url Base URL and subdirectory or absolute URL to the fonts upload directory. * @type string $subdir Subdirectory * @type string $basedir Path without subdir. * @type string $baseurl URL path without subdir. * @type string|false $error False or error message. * } */ return apply_filters( 'font_dir', $font_dir ); } /** * Deletes child font faces when a font family is deleted. * * @access private * @since 6.5.0 * * @param int $post_id Post ID. * @param WP_Post $post Post object. */ function _wp_after_delete_font_family( $post_id, $post ) { if ( 'wp_font_family' !== $post->post_type ) { return; } $font_faces = get_children( array( 'post_parent' => $post_id, 'post_type' => 'wp_font_face', ) ); foreach ( $font_faces as $font_face ) { wp_delete_post( $font_face->ID, true ); } } /** * Deletes associated font files when a font face is deleted. * * @access private * @since 6.5.0 * * @param int $post_id Post ID. * @param WP_Post $post Post object. */ function _wp_before_delete_font_face( $post_id, $post ) { if ( 'wp_font_face' !== $post->post_type ) { return; } $font_files = get_post_meta( $post_id, '_wp_font_face_file', false ); $font_dir = untrailingslashit( wp_get_font_dir()['basedir'] ); foreach ( $font_files as $font_file ) { wp_delete_file( $font_dir . '/' . $font_file ); } } /** * Register the default font collections. * * @access private * @since 6.5.0 */ function _wp_register_default_font_collections() { wp_register_font_collection( 'google-fonts', array( 'name' => _x( 'Google Fonts', 'font collection name' ), 'description' => __( 'Install from Google Fonts. Fonts are copied to and served from your site.' ), 'font_families' => 'https://s.w.org/images/fonts/wp-6.5/collections/google-fonts-with-preview.json', 'categories' => array( array( 'name' => _x( 'Sans Serif', 'font category' ), 'slug' => 'sans-serif', ), array( 'name' => _x( 'Display', 'font category' ), 'slug' => 'display', ), array( 'name' => _x( 'Serif', 'font category' ), 'slug' => 'serif', ), array( 'name' => _x( 'Handwriting', 'font category' ), 'slug' => 'handwriting', ), array( 'name' => _x( 'Monospace', 'font category' ), 'slug' => 'monospace', ), ), ) ); } e sitemap should be printed to the screen. * @param array $attributes The shortcode attributes. * @return string|void The HTML sitemap. */ public function output( $echo = true, $attributes = [] ) { $this->attributes = $attributes; if ( ! aioseo()->options->sitemap->html->enable ) { return; } aioseo()->sitemap->type = 'html'; if ( filter_var( $attributes['archives'], FILTER_VALIDATE_BOOLEAN ) ) { return ( new CompactArchive() )->output( $attributes, $echo ); } if ( ! empty( $attributes['default'] ) ) { $attributes = $this->getAttributes(); } $noResultsMessage = esc_html__( 'No posts/terms could be found.', 'all-in-one-seo-pack' ); if ( empty( $this->attributes['post_types'] ) && empty( $this->attributes['taxonomies'] ) ) { if ( $echo ) { echo $noResultsMessage; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } return $noResultsMessage; } // TODO: Consider moving all remaining HTML code below to a dedicated view instead of printing it in PHP. $sitemap = sprintf( '
', ! $this->attributes['show_label'] ? ' labels-hidden' : '' ); $sitemap .= ''; $hasPosts = false; $postTypes = $this->getIncludedObjects( $this->attributes['post_types'] ); foreach ( $postTypes as $postType ) { if ( 'attachment' === $postType ) { continue; } // Check if post type is still registered. if ( ! in_array( $postType, aioseo()->helpers->getPublicPostTypes( true ), true ) ) { continue; } $posts = $this->posts( $postType, $attributes ); if ( empty( $posts ) ) { continue; } $hasPosts = true; $postTypeObject = get_post_type_object( $postType ); $label = ! empty( $postTypeObject->label ) ? $postTypeObject->label : ucfirst( $postType ); $sitemap .= '
'; $sitemap .= $this->generateLabel( $label ); if ( is_post_type_hierarchical( $postType ) ) { $sitemap .= $this->generateHierarchicalList( $posts ) . '
'; if ( $this->attributes['show_label'] ) { $sitemap .= '
'; } continue; } $sitemap .= $this->generateList( $posts ); if ( $this->attributes['show_label'] ) { $sitemap .= '
'; } } $hasTerms = false; $taxonomies = $this->getIncludedObjects( $this->attributes['taxonomies'], false ); foreach ( $taxonomies as $taxonomy ) { // Check if post type is still registered. if ( ! in_array( $taxonomy, aioseo()->helpers->getPublicTaxonomies( true ), true ) ) { continue; } $terms = $this->terms( $taxonomy, $attributes ); if ( empty( $terms ) ) { continue; } $hasTerms = true; $taxonomyObject = get_taxonomy( $taxonomy ); $label = ! empty( $taxonomyObject->label ) ? $taxonomyObject->label : ucfirst( $taxonomy ); $sitemap .= '
'; $sitemap .= $this->generateLabel( $label ); if ( is_taxonomy_hierarchical( $taxonomy ) ) { $sitemap .= $this->generateHierarchicalList( $terms ) . '
'; if ( $this->attributes['show_label'] ) { $sitemap .= '
'; } continue; } $sitemap .= $this->generateList( $terms ); if ( $this->attributes['show_label'] ) { $sitemap .= '
'; } } $sitemap .= '
'; // Check if we actually were able to fetch any results. if ( ! $hasPosts && ! $hasTerms ) { $sitemap = $noResultsMessage; } if ( $echo ) { echo $sitemap; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } return $sitemap; } /** * Generates the label for a section of the sitemap. * * @since 4.1.3 * * @param string $label The label. * @return string The HTML code for the label. */ private function generateLabel( $label ) { $labelTag = ! empty( $this->attributes['label_tag'] ) ? $this->attributes['label_tag'] : 'h4'; return $this->attributes['show_label'] ? wp_kses_post( sprintf( '<%2$s>%1$s', $label, $labelTag ) ) : ''; } /** * Generates the HTML for a non-hierarchical list of objects. * * @since 4.1.3 * * @param array $objects The object. * @return string The HTML code. */ private function generateList( $objects ) { $list = ''; } /** * Generates a list item for an object (without the closing tag). * We cannot close it as the caller might need to generate a hierarchical structure inside the list item. * * @since 4.1.3 * * @param array $object The object. * @return string The HTML code. */ private function generateListItem( $object ) { $li = ''; if ( ! empty( $object['title'] ) ) { $li .= '
  • '; // add nofollow to the link. if ( filter_var( $this->attributes['nofollow_links'], FILTER_VALIDATE_BOOLEAN ) ) { $li .= sprintf( '', esc_url( $object['loc'] ), 'rel="nofollow"', $this->attributes['is_admin'] ? 'target="_blank"' : '' ); } else { $li .= sprintf( '', esc_url( $object['loc'] ), $this->attributes['is_admin'] ? 'target="_blank"' : '' ); } $li .= sprintf( '%s', esc_attr( $object['title'] ) ); // add publication date on the list item. if ( ! empty( $object['date'] ) && filter_var( $this->attributes['publication_date'], FILTER_VALIDATE_BOOLEAN ) ) { $li .= sprintf( ' (%s)', esc_attr( $object['date'] ) ); } $li .= ''; } return $li; } /** * Generates the HTML for a hierarchical list of objects. * * @since 4.1.3 * * @param array $objects The objects. * @return string The HTML of the hierarchical objects section. */ private function generateHierarchicalList( $objects ) { if ( empty( $objects ) ) { return ''; } $objects = $this->buildHierarchicalTree( $objects ); $list = ''; return $list; } /** * Recursive helper function for generateHierarchicalList(). * Generates hierarchical structure for objects with child objects. * * @since 4.1.3 * * @param array $object The object. * @return string The HTML code of the hierarchical tree. */ private function generateHierarchicalTree( $object ) { static $nestedLevel = 0; $tree = ''; return $tree; } /** * Builds the structure for hierarchical objects that have a parent. * * @since 4.1.3 * @version 4.2.8 * * @param array $objects The list of hierarchical objects. * @return array Multidimensional array with the hierarchical structure. */ private function buildHierarchicalTree( $objects ) { $topLevelIds = []; $objects = json_decode( wp_json_encode( $objects ) ); foreach ( $objects as $listItem ) { // Create an array of top level IDs for later reference. if ( empty( $listItem->parent ) ) { array_push( $topLevelIds, $listItem->id ); } // Create an array of children that belong to the current item. $children = array_filter( $objects, function( $child ) use ( $listItem ) { if ( ! empty( $child->parent ) ) { return absint( $child->parent ) === absint( $listItem->id ); } } ); if ( ! empty( $children ) ) { $listItem->children = $children; } } // Remove child objects from the root level since they've all been nested. $objects = array_filter( $objects, function ( $item ) use ( $topLevelIds ) { return in_array( $item->id, $topLevelIds, true ); } ); return array_values( json_decode( wp_json_encode( $objects ), true ) ); } /** * Returns the names of the included post types or taxonomies. * * @since 4.1.3 * * @param array|string $objects The included post types/taxonomies. * @param boolean $arePostTypes Whether the objects are post types. * @return array The names of the included post types/taxonomies. */ private function getIncludedObjects( $objects, $arePostTypes = true ) { if ( is_array( $objects ) ) { return $objects; } if ( empty( $objects ) ) { return []; } $exploded = explode( ',', $objects ); $objects = array_map( function( $object ) { return trim( $object ); }, $exploded ); $publicObjects = $arePostTypes ? aioseo()->helpers->getPublicPostTypes( true ) : aioseo()->helpers->getPublicTaxonomies( true ); $objects = array_filter( $objects, function( $object ) use ( $publicObjects ) { return in_array( $object, $publicObjects, true ); }); return $objects; } }
    Fatal error: Uncaught Error: Class "AIOSEO\Plugin\Common\Sitemap\Html\Frontend" not found in /htdocs/wp-content/plugins/all-in-one-seo-pack/app/Common/Sitemap/Html/Sitemap.php:55 Stack trace: #0 /htdocs/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(312): AIOSEO\Plugin\Common\Sitemap\Html\Sitemap->__construct() #1 /htdocs/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(97): AIOSEO\Plugin\AIOSEO->load() #2 /htdocs/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(76): AIOSEO\Plugin\AIOSEO->init() #3 /htdocs/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(414): AIOSEO\Plugin\AIOSEO::instance() #4 /htdocs/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php(96): aioseo() #5 /htdocs/wp-settings.php(522): include_once('/htdocs/wp-cont...') #6 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #7 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #8 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #9 /htdocs/index.php(17): require('/htdocs/wp-blog...') #10 {main} thrown in /htdocs/wp-content/plugins/all-in-one-seo-pack/app/Common/Sitemap/Html/Sitemap.php on line 55