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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 / vendor / otgs / installer / loader.php
woocommerce-multilingual / vendor / otgs / installer Last commit date
dist 1 year ago includes 4 weeks ago locale 2 months ago res 1 year ago src 4 weeks ago templates 4 weeks ago vendor-bin 3 years ago Makefile 5 years ago README.md 5 years ago installer.php 4 weeks ago loader.php 4 weeks ago phpcs.compatibility.xml 1 year ago phpcs.xml 5 years ago phpunit.xml 10 months ago repositories.xml 3 years ago webpack.config.js 1 year ago
loader.php
231 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if ( ! function_exists( 'otgs_is_rest_request' ) ) {
8 function otgs_is_rest_request() {
9 $rest_url_prefix = 'wp-json';
10
11 if ( function_exists( 'rest_get_url_prefix' ) ) {
12 $rest_url_prefix = rest_get_url_prefix();
13 }
14
15 return array_key_exists( 'rest_route', $_REQUEST ) || false !== strpos( $_SERVER['REQUEST_URI'], $rest_url_prefix ) || ( defined( 'REST_REQUEST' ) && REST_REQUEST );
16 }
17 }
18
19 if ( file_exists( __DIR__ . '/../../otgs/icons/loader.php' ) ) {
20 $vendor_root_url = plugins_url( '/', __FILE__ ) . '../..';
21 require_once __DIR__ . '/../../otgs/icons/loader.php';
22 }
23
24 global $otgs_installer_version;
25 $otgs_installer_version = '3.1.14';
26
27 if ( ! function_exists( 'wpml_installer_force_load' ) ) {
28 function wpml_installer_force_load() {
29 if ( function_exists( 'OTGS_Installer' ) ) {
30 return \OTGS_Installer();
31 }
32
33 global $otgs_installer_version;
34 $delegate = [ 'version' => $otgs_installer_version, 'bootfile' => dirname( __FILE__ ) . '/installer.php' ];
35
36 include_once $delegate['bootfile'];
37 include_once dirname( __FILE__ ) . '/includes/functions-core.php';
38
39 return \OTGS_Installer();
40 }
41 }
42
43 $is_cron_request = defined( 'DOING_CRON' ) && DOING_CRON;
44 $is_wp_cli_request = defined( 'WP_CLI' ) && WP_CLI;
45
46 if ( ! $is_cron_request && ! $is_wp_cli_request && ! is_admin() && ! otgs_is_rest_request() ) {
47 if ( ! function_exists( 'WP_Installer_Setup' ) ) {
48 function WP_Installer_Setup( $wp_installer_instance, $args = [] ) {
49 if ( isset( $args['site_key_nags'][0]['repository_id'] ) ) {
50 require_once __DIR__ . '/includes/class-otgs-installer-settings.php';
51 require_once __DIR__ . '/includes/class-otgs-installer-subscription.php';
52
53 $settings = OTGS\Installer\Settings::load_subscriptions();
54
55 $repository_id = $args['site_key_nags'][0]['repository_id'];
56
57 $getSiteKey = function () use ( $repository_id, $settings ) {
58 if ( in_array( $repository_id, [ 'wpml', 'toolset' ] )
59 && isset( $settings['repositories'][ $repository_id ]['subscription']['key'] )
60 ) {
61 return $settings['repositories'][ $repository_id ]['subscription']['key'];
62 }
63
64 return null;
65 };
66
67 add_filter( 'otgs_installer_get_sitekey_'.$repository_id, $getSiteKey );
68
69 if ( in_array( $repository_id, [ 'wpml', 'toolset' ] )
70 && isset( $settings['repositories'][ $repository_id ]['subscription']['key_type'] )
71 && $settings['repositories'][ $repository_id ]['subscription']['key_type'] === OTGS_Installer_Subscription::SITE_KEY_TYPE_DEVELOPMENT
72 ) {
73
74 $showFrontendBanner = function () use ( $repository_id ) {
75 $removeFrontendBannerLink = 'https://wpml.org/faq/how-to-remove-the-this-site-is-registered-on-wpml-org-as-a-development-site-notice/?utm_source=plugin&utm_medium=gui&utm_campaign=wpml-core&utm_term=footer-notice';
76 $wpmlText = sprintf(
77 __( 'This site is registered on %s as a development site. Switch to a production site key to %s.', 'installer' ),
78 '<a href="https://wpml.org">wpml.org</a>', '<a href="' . $removeFrontendBannerLink . '">remove this banner</a>'
79 );
80 $message = $repository_id === 'wpml'
81 ? $wpmlText
82 : __( 'This site is registered on Toolset.com as a development site.', 'installer' );
83
84 ?>
85 <style>
86 .otgs-development-site-front-end a { color: white; }
87 .otgs-development-site-front-end .icon {
88 background: url(<?php echo plugins_url( '/', __FILE__ ) . '/res/img/icon-wpml-info-white.svg'; ?>) no-repeat;
89 width: 20px;
90 height: 20px;
91 display: inline-block;
92 position: absolute;
93 margin-left: -23px;
94 }
95 .otgs-development-site-front-end {
96 background-size: 32px;
97 padding: 22px 0px;
98 font-size: 12px;
99 font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
100 line-height: 18px;
101 text-align: center;
102 color: white;
103 background-color: #0369a1;
104 }
105 </style>
106 <?php
107 echo '<div class="otgs-development-site-front-end"><span class="icon"></span>' . $message . '</div >';
108 };
109
110 add_action( 'wp_footer', $showFrontendBanner, 999 );
111 }
112 }
113 }
114 }
115 $wp_installer_instance = null;
116
117 return;
118 }
119
120 $wp_installer_instance = dirname( __FILE__ ) . '/installer.php';
121
122 global $wp_installer_instances;
123 $wp_installer_instances[ $wp_installer_instance ] = [
124 'bootfile' => $wp_installer_instance,
125 'version' => $otgs_installer_version,
126 ];
127
128 if ( defined( 'ICL_SITEPRESS_VERSION' ) && version_compare( ICL_SITEPRESS_VERSION, '3.2', '<' ) ) {
129 foreach ( $wp_installer_instances as $key => $instance ) {
130 if ( isset( $instance['args']['site_key_nags'] ) ) {
131 $wp_installer_instances[ $key ]['version'] = '9.9';
132 } else {
133 $wp_installer_instances[ $key ]['version'] = '0';
134 }
135 }
136 }
137
138 if ( defined( 'ICL_SITEPRESS_VERSION' ) && version_compare( ICL_SITEPRESS_VERSION, '3.3.1', '<' ) ) {
139
140 $installer_171_plus_on = false;
141 foreach ( $wp_installer_instances as $key => $instance ) {
142 if ( version_compare( $instance['version'], '1.7.1', '>=' ) ) {
143 $installer_171_plus_on = true;
144 break;
145 }
146 }
147
148 if ( $installer_171_plus_on ) {
149 foreach ( $wp_installer_instances as $key => $instance ) {
150
151 if ( version_compare( $instance['version'], '1.7.0', '<' ) ) {
152 unset( $wp_installer_instances[ $key ] );
153 }
154 }
155 }
156 }
157
158 if ( isset( $_POST['installer_instance'] ) && isset( $wp_installer_instances[ $_POST['installer_instance'] ] ) ) {
159 $wp_installer_instances[ $_POST['installer_instance'] ]['version'] = '999';
160 }
161
162 remove_action( 'after_setup_theme', 'wpml_installer_instance_delegator', 1 );
163 add_action( 'after_setup_theme', 'wpml_installer_instance_delegator', 1 );
164
165 if ( ! function_exists( 'wpml_installer_instance_delegator' ) ) {
166 function wpml_installer_instance_delegator() {
167 global $wp_installer_instances;
168
169 $delegated_instance_key = null;
170 foreach ( $wp_installer_instances as $instance_key => $instance ) {
171 $wp_installer_instances[ $instance_key ]['delegated'] = false;
172
173 if ( ! isset( $delegate ) || version_compare( $instance['version'], $delegate['version'], '>' ) ) {
174 $delegate = $instance;
175 $delegated_instance_key = $instance_key;
176 }
177 }
178
179 $wp_installer_instances[ $delegated_instance_key ]['delegated'] = true;
180
181 $highest_priority = null;
182 foreach ( $wp_installer_instances as $instance ) {
183 if ( isset( $instance['args']['high_priority'] ) ) {
184 if ( is_null( $highest_priority ) || $instance['args']['high_priority'] <= $highest_priority ) {
185 $highest_priority = $instance['args']['high_priority'];
186 $delegate = $instance;
187 }
188 }
189 }
190
191 if ( defined( 'ICL_SITEPRESS_VERSION' ) && version_compare( ICL_SITEPRESS_VERSION, '3.2', '<' ) ) {
192 foreach ( $wp_installer_instances as $key => $instance ) {
193 if ( isset( $instance['args']['site_key_nags'] ) ) {
194 $delegate = $instance;
195 $wp_installer_instances = array( $key => $delegate );
196 break;
197 }
198 }
199 }
200
201 include_once $delegate['bootfile'];
202
203 require_once dirname( __FILE__ ) . '/includes/loader/Config.php';
204 $delegate = OTGS\Installer\Loader\Config::merge( $delegate, $wp_installer_instances );
205
206 $template_path = realpath( get_template_directory() );
207 if ( $template_path && strpos( (string) realpath( $delegate['bootfile'] ), (string) $template_path ) === 0 ) {
208 $filepath = str_replace( (string) realpath( get_template_directory() ), '', (string) realpath( $delegate['bootfile'] ) );
209 $delegate['args']['in_theme_folder'] = dirname( ltrim( $filepath, '\\/' ) );
210 }
211
212 if ( isset( $delegate['args'] ) && is_array( $delegate['args'] ) ) {
213 foreach ( $delegate['args'] as $key => $value ) {
214 WP_Installer()->set_config( $key, $value );
215 }
216 }
217
218 }
219 }
220
221 if ( ! function_exists( 'WP_Installer_Setup' ) ) {
222
223 function WP_Installer_Setup( $wp_installer_instance, $args = array() ) {
224 global $wp_installer_instances;
225
226 if ( $wp_installer_instance ) {
227 $wp_installer_instances[ $wp_installer_instance ]['args'] = $args;
228 }
229 }
230 }
231