PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
wpml-string-translation
/
classes
/
slug-translation
<?php class WPML_ST_Slug_Translation_Strings_Sync implements IWPML_Action { /** @var WPML_Slug_Translation_Records_Factory $slug_records_factory */ private $slug_records_factory; /** @var WPML_ST_Slug_Translation_Settings_Factory $slug_settings_factory */ private $slug_settings_factory; public function __construct( WPML_Slug_Translation_Records_Factory $slug_records_factory, WPML_ST_Slug_Translation_Settings_Factory $slug_settings_factory ) { $this->slug_records_factory = $slug_records_factory; $this->slug_settings_factory = $slug_settings_factory; } public function add_hooks() { add_action( 'registered_taxonomy', array( $this, 'run_taxonomy_sync' ), 10, 3 ); add_action( 'registered_post_type', array( $this, 'run_post_type_sync' ), 10, 2 ); } /** * @param string $taxonomy * @param string|array $object_type * @param array $taxonomy_array */ public function run_taxonomy_sync( $taxonomy, $object_type, $taxonomy_array ) { if ( isset( $taxonomy_array['rewrite']['slug'] ) && $taxonomy_array['rewrite']['slug'] ) { $this->sync_element_slug( $taxonomy_array['rewrite']['slug'], $taxonomy, WPML_Slug_Translation_Factory::TAX ); } } /** * @param string $post_type * @param WP_Post_Type $post_type_object */ public function run_post_type_sync( $post_type, $post_type_object ) { if ( isset( $post_type_object->rewrite['slug'] ) && $post_type_object->rewrite['slug'] ) { $this->sync_element_slug( trim( $post_type_object->rewrite['slug'], '/' ), $post_type, WPML_Slug_Translation_Factory::POST ); } } /** * @param string $rewrite_slug * @param string $type * @param string $element_type */ public function sync_element_slug( $rewrite_slug, $type, $element_type ) { $settings = $this->slug_settings_factory->create( $element_type ); if ( ! $settings->is_translated( $type ) ) { return; } $records = $this->slug_records_factory->create( $element_type ); $slug = $records->get_slug( $type ); if ( $slug->get_original_value() !== $rewrite_slug ) { $records->update_original_slug( $type, $rewrite_slug ); } } }
[+]
RewriteRules
[-] CheckRedirect.php
[edit]
[-] wpml-st-slug-translation-settings-factory.php
[edit]
[-] wpml-st-slug-translation-ui-save.php
[edit]
[-] class-wpml-slug-translation-records.php
[edit]
[+]
post
[-] iwpml-st-rewrite-rule-filter.php
[edit]
[-] class-wpml-rewrite-rule-filter.php
[edit]
[+]
custom-types
[+]
taxonomy
[-] wpml-st-slug-translation-strings-sync.php
[edit]
[-] wpml-st-slug-translation-settings.php
[edit]
[-] wpml-slug-translation-records-factory.php
[edit]
[-] wpml-st-slug-translation-api.php
[edit]
[+]
new-match-finder
[-] class-wpml-slug-translation.php
[edit]
[-] wpml-st-slug-translation-ui-factory.php
[edit]
[-] wpml-rewrite-rule-filter-factory.php
[edit]
[-] wpml-st-element-slug-translation-ui-model.php
[edit]
[-] wpml-st-element-slug-translation-ui.php
[edit]
[+]
..
[-] wpml-st-slug.php
[edit]
[-] wpml-slug-translation-factory.php
[edit]