* @param \WP_Term $category the category instance.
* @return string A list of category parents.
*/
private function getCategoryParents( $category ) {
if (
$category->parent === $category->term_id ||
absint( $category->parent ) < 1
) {
return '';
}
$parents = get_category_parents( $category->parent, false, '/', true );
return is_wp_error( $parents ) ? '' : $parents;
}
/**
* Walks through category nicename and convert encoded parts
* into uppercase using $this->encode_to_upper().
*
* @since 4.2.0
*
* @param string $nicename The encoded category string.
* @return string The converted category string.
*/
private function convertEncodedToUppercase( $nicename ) {
// Checks if name has any encoding in it.
if ( false === strpos( $nicename, '%' ) ) {
return $nicename;
}
$nicenames = explode( '/', $nicename );
$nicenames = array_map( [ $this, 'convertToUppercase' ], $nicenames );
return implode( '/', $nicenames );
}
/**
* Converts the encoded URI string to uppercase.
*
* @since 4.2.0
*
* @param string $encoded The encoded category string.
* @return string The converted category string.
*/
private function convertToUppercase( $encoded ) {
if ( false === strpos( $encoded, '%' ) ) {
return $encoded;
}
return strtoupper( $encoded );
}
/**
* Adds the required category rewrites rules.
*
* @since 4.2.0
*
* @param array $categoryRewrite The current set of rules.
* @param string $categoryNicename The category nicename.
* @param string $blogPrefix Multisite blog prefix.
* @param string $paginationBase WP_Query pagination base.
* @return array The added set of rules.
*/
private function addCategoryRewrites( $categoryRewrite, $categoryNicename, $blogPrefix, $paginationBase ) {
$categoryRewrite[ $blogPrefix . '(' . $categoryNicename . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$' ] = 'index.php?category_name=$matches[1]&feed=$matches[2]';
$categoryRewrite[ $blogPrefix . '(' . $categoryNicename . ')/' . $paginationBase . '/?([0-9]{1,})/?$' ] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
$categoryRewrite[ $blogPrefix . '(' . $categoryNicename . ')/?$' ] = 'index.php?category_name=$matches[1]';
return $categoryRewrite;
}
/**
* Remove the category base from the category link.
*
* @since 4.2.0
*
* @param string $link Term link.
* @param object $term The current Term Object.
* @param string $taxonomy The current Taxonomy.
* @return string The modified term link.
*/
public function modifyTermLink( $link, $term = null, $taxonomy = '' ) {
if ( 'category' !== $taxonomy ) {
return $link;
}
$categoryBase = get_option( 'category_base' );
if ( empty( $categoryBase ) ) {
global $wp_rewrite; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
$categoryStructure = $wp_rewrite->get_category_permastruct(); // phpcs:ignore Squiz.NamingConventions.ValidVariableName
$categoryBase = trim( str_replace( '%category%', '', $categoryStructure ), '/' );
}
// Remove initial slash, if there is one (we remove the trailing slash in the regex replacement and don't want to end up short a slash).
if ( '/' === substr( $categoryBase, 0, 1 ) ) {
$categoryBase = substr( $categoryBase, 1 );
}
$categoryBase .= '/';
return preg_replace( '`' . preg_quote( (string) $categoryBase, '`' ) . '`u', '', (string) $link, 1 );
}
/**
* Flush the rewrite rules.
*
* @since 4.2.0
*
* @return void
*/
public function scheduleFlushRewrite() {
aioseo()->options->flushRewriteRules();
}
}
Fatal error: Uncaught Error: Class 'AIOSEO\Plugin\Common\Main\CategoryBase' not found in /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php:323
Stack trace:
#0 /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(106): AIOSEO\Plugin\AIOSEO->load()
#1 /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(85): AIOSEO\Plugin\AIOSEO->init()
#2 /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php(397): AIOSEO\Plugin\AIOSEO::instance()
#3 /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php(98): aioseo()
#4 /home/kordian1/domains/ostrabrama.pl/public_html/wp-settings.php(545): include_once('/home/kordian1/...')
#5 /home/kordian1/domains/ostrabrama.pl/public_html/wp-config.php(81): require_once('/home/kordian1/...')
#6 /home/kordian1/domains/ostrabrama.pl/public_html/wp-loa in /home/kordian1/domains/ostrabrama.pl/public_html/wp-content/plugins/all-in-one-seo-pack/app/AIOSEO.php on line 323