Skip to content

Commit c5e1a1f

Browse files
committed
Update Astra theme from 4.11.13 to 4.11.14
1 parent 95d411b commit c5e1a1f

34 files changed

Lines changed: 292 additions & 435 deletions

wp-content/themes/astra/admin/assets/build/dashboard-app-rtl.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-element', 'wp-i18n'), 'version' => '8a87e30ed45b874265db');
1+
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-element', 'wp-i18n'), 'version' => '20437646b94d569f0d02');

wp-content/themes/astra/admin/assets/build/dashboard-app.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wp-content/themes/astra/admin/class-astra-bsf-analytics.php

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public function add_astra_analytics_data( $stats_data ) {
164164
'using_old_header_footer' => $is_hf_builder_active ? 'no' : 'yes',
165165
'loading_google_fonts_locally' => isset( $admin_dashboard_settings['self_hosted_gfonts'] ) && $admin_dashboard_settings['self_hosted_gfonts'] ? 'yes' : 'no',
166166
'preloading_local_fonts' => isset( $admin_dashboard_settings['preload_local_fonts'] ) && $admin_dashboard_settings['preload_local_fonts'] ? 'yes' : 'no',
167+
'hosting_provider' => self::get_hosting_provider(),
167168
);
168169

169170
// Add onboarding analytics data.
@@ -249,6 +250,74 @@ public static function add_astra_onboarding_analytics_data( &$astra_stats ) {
249250
}
250251
}
251252

253+
/**
254+
* Get the hosting provider (ASN Organization) for the current site.
255+
*
256+
* @param string $ip Optional. IP address to look up. Defaults to server IP.
257+
* @param string|null $token Optional. ipinfo.io API token for higher rate limits.
258+
*
259+
* @return string|null Hosting provider name (ASN org), or null if not detected.
260+
*/
261+
public static function get_hosting_provider( $ip = '', $token = null ) {
262+
if ( 'local' === wp_get_environment_type() ) {
263+
return null; // Skip on local environments.
264+
}
265+
266+
$transient_key = 'ast' . md5( 'hosting_provider' );
267+
// If no IP provided, try to get the current server IP.
268+
$is_current_server = false;
269+
if ( ! $ip ) {
270+
// Fetch from transient only for current server IP.
271+
$cached = get_transient( $transient_key );
272+
if ( $cached ) {
273+
return $cached;
274+
}
275+
276+
$is_current_server = true;
277+
$ip = $_SERVER['SERVER_ADDR'] ?? null;
278+
}
279+
280+
// Fallback: resolve server name.
281+
if ( ! $ip || $ip === '127.0.0.1' || $ip === '::1' ) {
282+
$hostname = $_SERVER['SERVER_NAME'] ?? 'localhost';
283+
$ip = gethostbyname( $hostname );
284+
}
285+
286+
// Optional: fallback to external service for public IP.
287+
if ( ! $ip || $ip === '127.0.0.1' || $ip === '::1' ) {
288+
$response = wp_remote_get( 'https://api.ipify.org' );
289+
if ( ! is_wp_error( $response ) ) {
290+
$ip = trim( wp_remote_retrieve_body( $response ) );
291+
}
292+
}
293+
294+
if ( ! $ip ) {
295+
return null; // Could not detect IP.
296+
}
297+
298+
// Query ipinfo.io.
299+
$url = "https://ipinfo.io/{$ip}/json" . ( $token ? "?token={$token}" : '' );
300+
$response = wp_remote_get( $url, array( 'timeout' => 5 ) );
301+
if ( is_wp_error( $response ) ) {
302+
return null;
303+
}
304+
305+
$data = json_decode( wp_remote_retrieve_body( $response ), true );
306+
if ( ! empty( $data['org'] ) ) {
307+
// Example: "AS13335 Cloudflare, Inc."
308+
$parts = explode( ' ', $data['org'], 2 );
309+
$hosting_provider = isset( $parts[1] ) ? $parts[1] : $data['org'];
310+
311+
// Cache the result for current server IP only.
312+
if ( $is_current_server ) {
313+
set_transient( $transient_key, $hosting_provider, defined( 'MONTH_IN_SECONDS' ) ? MONTH_IN_SECONDS : 30 * DAY_IN_SECONDS );
314+
}
315+
return $hosting_provider;
316+
}
317+
318+
return null;
319+
}
320+
252321
/**
253322
* Initiator.
254323
*

wp-content/themes/astra/assets/js/minified/add-to-cart-quantity-btn.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wp-content/themes/astra/assets/js/minified/customizer-google-fonts.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wp-content/themes/astra/assets/js/unminified/add-to-cart-quantity-btn.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ function astrawpWooQuantityButtons( $quantitySelector ) {
7272

7373
if ( $quantityBoxes && 'date' !== $quantityBoxes.getAttribute( 'type' ) && 'hidden' !== $quantityBoxes.getAttribute( 'type' ) ) {
7474

75+
// Skip adding buttons if max quantity is 1 (sold individually)
76+
var $maxQuantity = $quantityBoxes.getAttribute( 'max' );
77+
if ( $maxQuantity && parseFloat( $maxQuantity ) === 1 ) {
78+
continue;
79+
}
80+
7581
// Add plus and minus icons.
7682
$qty_parent = $quantityBoxes.parentElement;
7783

0 commit comments

Comments
 (0)