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 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.9.0 4.9.1 5.0.1 5.0.2 5.1.1 5.1.2 5.1.3 5.2.0 5.2.1 5.3.2 5.3.3.1 5.3.4 5.3.5 5.3.6 5.3.7
woocommerce-multilingual / classes / Utilities / AdminUrl.php
woocommerce-multilingual / classes / Utilities Last commit date
Suspend 1 week ago ActionScheduler.php 1 week ago AdminPages.php 1 week ago AdminUrl.php 1 week ago DB.php 1 week ago Post.php 1 week ago Resources.php 1 week ago SyncHash.php 1 week ago WCTaxonomies.php 1 week ago WcAdminPages.php 1 week ago WpAdminPages.php 1 week ago
AdminUrl.php
188 lines
1 <?php
2
3 namespace WCML\Utilities;
4
5 use function WCML\functions\isStandAlone;
6
7 class AdminUrl {
8 const PAGE_WPML_WCML = \WCML_Admin_Menus::SLUG;
9
10 const PAGE_WOO_SETTINGS = 'wc-settings';
11
12 const TAB_PRODUCTS = 'products';
13 const TAB_MULTILINGUAL = AdminPages::TAB_MULTILINGUAL;
14 const TAB_MULTILINGUAL_STANDALONE = AdminPages::TAB_MULTILINGUAL_STANDALONE;
15 const TAB_MULTICURRENCY = AdminPages::TAB_MULTICURRENCY;
16 const TAB_TROUBLESHOOTING = 'troubleshooting';
17 const TAB_STORE_URL = 'slugs';
18 const TAB_STATUS = 'status';
19
20 const TAB_SETTINGS = 'settings';
21 const SRC_SETUP_LATER = 'setup_later';
22
23 const DASHBOARD_PARAM_SECTIONS = 'sections';
24 const DASHBOARD_SECTION_PRODUCT = 'post/product';
25 const DASHBOARD_SECTION_STRING = 'string';
26 const DASHBOARD_PARAM_STRING_DOMAIN = 'predefinedStringDomain';
27
28 private static function getAdminUrl( array $getParams ) : string {
29 return add_query_arg(
30 $getParams,
31 admin_url( 'admin.php' )
32 );
33 }
34
35 public static function getTab( $taxonomy ) : string {
36 return self::getAdminUrl( [
37 'page' => self::PAGE_WPML_WCML,
38 'tab' => $taxonomy,
39 ] );
40 }
41
42 public static function getMultilingualTab() : string {
43 return self::getAdminUrl( [
44 'page' => self::PAGE_WPML_WCML,
45 'tab' => isStandAlone() ? self::TAB_MULTILINGUAL_STANDALONE : self::TAB_MULTILINGUAL,
46 ] );
47 }
48
49 public static function getMultiCurrencyTab( string $anchor = '' ) : string {
50 $url = self::getAdminUrl( [
51 'page' => self::PAGE_WPML_WCML,
52 'tab' => self::TAB_MULTICURRENCY,
53 ] );
54
55 if ( ! empty( $anchor ) ) {
56 $url .= '#' . $anchor;
57 }
58
59 return $url;
60 }
61
62 public static function getStoreURLTab() : string {
63 return self::getAdminUrl( [
64 'page' => self::PAGE_WPML_WCML,
65 'tab' => self::TAB_STORE_URL,
66 ] );
67 }
68
69 public static function getStatusTab() : string {
70 return self::getAdminUrl( [
71 'page' => self::PAGE_WPML_WCML,
72 'tab' => self::TAB_STATUS,
73 ] );
74 }
75
76 public static function getSettingsTab() : string {
77 return self::getAdminUrl( [
78 'page' => self::PAGE_WPML_WCML,
79 'tab' => self::TAB_SETTINGS,
80 ] );
81 }
82
83 public static function getTroubleshootingTab() : string {
84 return self::getAdminUrl( [
85 'page' => self::PAGE_WPML_WCML,
86 'tab' => self::TAB_TROUBLESHOOTING,
87 ] );
88 }
89
90 public static function getSetupLater() : string {
91 return self::getAdminUrl( [
92 'page' => self::PAGE_WPML_WCML,
93 'src' => self::SRC_SETUP_LATER,
94 ] );
95 }
96
97 public static function getSetup( $step = null ) : string {
98 $args = [];
99 $args['page'] = \WCML_Setup_UI::SLUG;
100 if ( ! is_null( $step ) ) {
101 $args['step'] = $step;
102 }
103
104 return self::getAdminUrl( $args );
105 }
106
107 public static function getWPMLTMDashboard( array $sections = [], string $stringDomain = '' ) : string {
108 $dashboardUrl = admin_url( \WPML\UIPage::getTMDashboard() );
109 if ( empty( $sections ) ) {
110 return $dashboardUrl;
111 }
112
113 $dashboardUrl = add_query_arg(
114 [ self::DASHBOARD_PARAM_SECTIONS => implode( ',', $sections ) ],
115 $dashboardUrl
116 );
117
118 if ( in_array( self::DASHBOARD_SECTION_STRING, $sections, true ) && $stringDomain ) {
119 $dashboardUrl = add_query_arg(
120 [ self::DASHBOARD_PARAM_STRING_DOMAIN => $stringDomain ],
121 $dashboardUrl
122 );
123 }
124
125 return $dashboardUrl;
126 }
127
128 public static function getWPMLTMDashboardStringDomain( string $domain ) : string {
129 return self::getWPMLTMDashboard(
130 [ self::DASHBOARD_SECTION_STRING ],
131 $domain
132 );
133 }
134
135 public static function getWPMLTMDashboardProducts() : string {
136 return self::getWPMLTMDashboard( [ self::DASHBOARD_SECTION_PRODUCT ] );
137 }
138
139 public static function getWPMLTaxonomyTranslation( $taxonomy = null ) : string {
140 $args = [
141 'page' => WPML_PLUGIN_FOLDER . '/menu/taxonomy-translation.php',
142 'taxonomy' => $taxonomy,
143 ];
144
145 return self::getAdminUrl( $args );
146 }
147
148 public static function getWPMLStringTranslation( array $args = [] ) : string {
149 $args = array_merge(
150 [
151 'page' => WPML_ST_FOLDER . '/menu/string-translation.php',
152 ],
153 $args
154 );
155
156 return self::getAdminUrl( $args );
157 }
158
159 public static function getWooProductAll() : string {
160 $args = [
161 'post_type' => 'product',
162 ];
163
164 return add_query_arg(
165 $args,
166 admin_url( 'edit.php' )
167 );
168 }
169
170 public static function getWooSettings( $tab = null ) : string {
171 $args = [
172 'page' => self::PAGE_WOO_SETTINGS,
173 'tab' => $tab,
174 ];
175
176 return self::getAdminUrl( $args );
177 }
178
179 public static function getWooStatus( $tab = null ) : string {
180 $args = [
181 'page' => 'wc-status',
182 'tab' => $tab,
183 ];
184
185 return self::getAdminUrl( $args );
186 }
187 }
188