]> _ Git - physioassist-wordpress.git/blob
6db9abad2c72fcb4ae8d436cbe0659c53b46c841
[physioassist-wordpress.git] /
1 <?php
2
3 class WPML_Slug_Translation_Factory implements IWPML_Frontend_Action_Loader, IWPML_Backend_Action_Loader, IWPML_AJAX_Action_Loader {
4
5         const POST = 'post';
6         const TAX  = 'taxonomy';
7
8         const INIT_PRIORITY = -1000;
9
10         public function create() {
11                 global $sitepress;
12
13                 $hooks = array();
14
15                 $records_factory  = new WPML_Slug_Translation_Records_Factory();
16                 $settings_factory = new WPML_ST_Slug_Translation_Settings_Factory();
17
18                 $post_records = $records_factory->create( self::POST );
19                 $tax_records  = $records_factory->create( self::TAX );
20
21                 $global_settings = $settings_factory->create();
22                 $post_settings   = $settings_factory->create( self::POST );
23                 $tax_settings    = $settings_factory->create( self::TAX );
24
25                 $term_link_filter = new WPML_ST_Term_Link_Filter( $tax_records, $sitepress, new WPML_WP_Cache_Factory() );
26
27                 $hooks['legacy_class'] = new WPML_Slug_Translation(
28                         $sitepress,
29                         $records_factory,
30                         WPML_Get_LS_Languages_Status::get_instance(),
31                         $term_link_filter,
32                         $global_settings
33                 );
34
35                 $hooks['rewrite_rules'] = ( new \WPML\ST\SlugTranslation\Hooks\HooksFactory() )->create();
36
37                 if ( is_admin() ) {
38                         $hooks['ui_save_post'] = new WPML_ST_Slug_Translation_UI_Save(
39                                 $post_settings,
40                                 $post_records,
41                                 $sitepress,
42                                 new WPML_WP_Post_Type(),
43                                 WPML_ST_Slug_Translation_UI_Save::ACTION_HOOK_FOR_POST
44                         );
45                         $hooks['ui_save_tax']  = new WPML_ST_Slug_Translation_UI_Save(
46                                 $tax_settings,
47                                 $tax_records,
48                                 $sitepress,
49                                 new WPML_WP_Taxonomy(),
50                                 WPML_ST_Slug_Translation_UI_Save::ACTION_HOOK_FOR_TAX
51                         );
52
53                         if ( $global_settings->is_enabled() ) {
54                                 $hooks['sync_strings'] = new WPML_ST_Slug_Translation_Strings_Sync(
55                                         $records_factory,
56                                         $settings_factory
57                                 );
58                         }
59                 }
60
61                 $hooks['public-api'] = new WPML_ST_Slug_Translation_API(
62                         $records_factory,
63                         $settings_factory,
64                         $sitepress,
65                         new WPML_WP_API()
66                 );
67
68                 return $hooks;
69         }
70 }