/home/techb158/balacoffee.com/wp-content/plugins/polylang/src
NameSizeModeActions
admin/-0755rm
Capabilities/-0755rm
frontend/-0755rm
install/-0755rm
integrations/-0755rm
Model/-0755rm
modules/-0755rm
Options/-0755rm
settings/-0755rm
api.php222910644editdlrm
base.php62590644editdlrm
cache.php24540644editdlrm
class-polylang.php85370644editdlrm
constant-functions.php18530644editdlrm
cookie.php31040644editdlrm
crud-posts.php131290644editdlrm
crud-terms.php89620644editdlrm
default-term.php65950644editdlrm
filter-rest-routes.php51000644editdlrm
filters-links.php57800644editdlrm
filters-sanitization.php33110644editdlrm
filters-widgets-options.php26970644editdlrm
filters.php132480644editdlrm
format-util.php31140644editdlrm
functions.php52640644editdlrm
language-deprecated.php72960644editdlrm
language-factory.php96300644editdlrm
language.php183270644editdlrm
license.php96200644editdlrm
links-abstract-domain.php32400644editdlrm
links-default.php31000644editdlrm
links-directory.php97260644editdlrm
links-domain.php29800644editdlrm
links-model.php66780644editdlrm
links-permalinks.php57530644editdlrm
links-subdomain.php22090644editdlrm
links.php14150644editdlrm
mo.php35040644editdlrm
model.php235080644editdlrm
nav-menu.php46090644editdlrm
olt-manager.php30560644editdlrm
query.php79130644editdlrm
rest-request.php43250644editdlrm
static-pages.php64180644editdlrm
switcher.php112370644editdlrm
term-slug.php50120644editdlrm
translatable-object-with-types-interface.php10550644editdlrm
translatable-object-with-types-trait.php20050644editdlrm
translatable-object.php180420644editdlrm
translatable-objects.php37990644editdlrm
translate-option.php134170644editdlrm
translated-object.php193880644editdlrm
translated-post.php175860644editdlrm
translated-term.php151710644editdlrm
walker-dropdown.php38570644editdlrm
walker-list.php26020644editdlrm
walker.php24340644editdlrm
widget-calendar.php118580644editdlrm
widget-languages.php54660644editdlrm
Edit: /home/techb158/balacoffee.com/wp-content/plugins/polylang/src/term-slug.php (5012B)
model = $model; $this->slug = $slug; $this->taxonomy = $taxonomy; $this->name = $name; $this->term_id = $term_id; } /** * Tells if the suffix can be added or not. * * @since 3.7 * * @return bool True if the suffix can be added, false otherwise. */ private function can_add_suffix() { /** * Filters the subsequently inserted term language. * * @since 3.3 * * @param PLL_Language|null $lang Found language object, null otherwise. * @param string $taxonomy Term taxonomy. * @param string $slug Term slug. */ $lang = apply_filters( 'pll_inserted_term_language', null, $this->taxonomy, $this->slug ); if ( ! $lang instanceof PLL_Language ) { return false; } $this->lang = $lang; $this->parent = 0; if ( is_taxonomy_hierarchical( $this->taxonomy ) ) { /** * Filters the subsequently inserted term parent. * * @since 3.3 * * @param int $parent Parent term ID, 0 if none. * @param string $taxonomy Term taxonomy. * @param string $slug Term slug. */ $this->parent = apply_filters( 'pll_inserted_term_parent', 0, $this->taxonomy, $this->slug ); $this->slug .= $this->maybe_get_parent_suffix(); } if ( ! $this->slug ) { if ( $this->model->term_exists( $this->name, $this->taxonomy, $this->parent, $this->lang ) ) { // Returns the current empty slug if the term exists with the same name and an empty slug. // Same as WP does when providing a term with a name that already exists and no slug. return false; } else { $this->slug = sanitize_title( $this->name ); } } // Check if the slug exists globally, excluding the current term if we're editing. $args = array( 'slug' => $this->slug, 'taxonomy' => $this->taxonomy, 'hide_empty' => false, 'fields' => 'ids', 'lang' => '', // Disable Polylang language filter. 'update_term_meta_cache' => false, // Don't need term meta. ); $terms = get_terms( $args ); // Return true if the slug is already used by another term (excluding the term being edited). return is_array( $terms ) && ! empty( array_diff( $terms, array( $this->term_id ) ) ); } /** * Returns the parent suffix for the slug only if parent slug is the same as the given one. * Recursively appends the parents slugs like WordPress does. * * @since 3.3 * @since 3.7 Moved from `PLL_Share_Term_Slug` to `PLL_Term_Slug`. * * @return string Parents slugs if they are the same as the child slug, empty string otherwise. */ private function maybe_get_parent_suffix() { $parent_suffix = ''; $the_parent = get_term( $this->parent, $this->taxonomy ); if ( ! $the_parent instanceof WP_Term || $the_parent->slug !== $this->slug ) { return $parent_suffix; } /** * Mostly copied from {@see wp_unique_term_slug()}. */ while ( ! empty( $the_parent ) ) { $parent_term = get_term( $the_parent, $this->taxonomy ); if ( ! $parent_term instanceof WP_Term ) { break; } $parent_suffix .= '-' . $parent_term->slug; if ( ! term_exists( $this->slug . $parent_suffix ) ) { break; } $the_parent = $parent_term->parent; } return $parent_suffix; } /** * Returns the term slug, suffixed or not. * * @since 3.7 * * @param string $separator The separator for the slug suffix. * @return string The slug with or without suffix. */ public function get_suffixed_slug( string $separator ): string { if ( ! $this->can_add_suffix() ) { return $this->slug; } $term_id = (int) $this->model->term_exists_by_slug( $this->slug, $this->lang, $this->taxonomy, $this->parent ); // If no term exists in the given language with that slug, it can be created, or if we are editing the existing term. if ( ! $term_id || $this->term_id === $term_id ) { return $this->slug . $separator . $this->lang->slug; } // Different term exists in same language: no suffix, WordPress will handle uniqueness. return $this->slug; } }