Changeset 3810567
- Timestamp:
- 11/19/2026 03:03:20 AM (less than one hour ago)
- Location:
- giftlight
- Files:
-
- 6 edited
- 1 copied
-
tags/1.1.21 (copied) (copied from giftlight/trunk )
-
tags/1.1.21/giftlight.php (modified) (2 diffs)
-
tags/1.1.21/readme.txt (modified) (1 diff)
-
tags/1.1.21/sold.php (modified) (6 diffs)
-
trunk/giftlight.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/sold.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
giftlight/tags/1.1.21/giftlight.php
r3809506 r3810567 4 4 * Plugin URI: https://giftlight.app/ 5 5 * Description: A gift guide and a gift finder quiz built from your own WooCommerce products: by who it's for, what to spend and what they're into. 6 * Version: 1.1.2 06 * Version: 1.1.21 7 7 * Requires at least: 6.3 8 8 * Requires PHP: 7.4 … … 21 21 } 22 22 23 define( 'GIFTLIGHT_VERSION', '1.1.2 0' );23 define( 'GIFTLIGHT_VERSION', '1.1.21' ); 24 24 define( 'GIFTLIGHT_FILE', __FILE__ ); 25 25 define( 'GIFTLIGHT_MAX_PRODUCTS', 300 ); -
giftlight/tags/1.1.21/readme.txt
r3809506 r3810567 6 6 Requires PHP: 7.4 7 7 Requires Plugins: woocommerce 8 Stable tag: 1.1.2 08 Stable tag: 1.1.21 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
giftlight/tags/1.1.21/sold.php
r3800841 r3810567 116 116 * 117 117 * @param string $from First included local calendar day. 118 * @return array 118 * @return array|null Null when the order results are incomplete or invalid. 119 119 */ 120 120 function giftlight_sold_orders( $from ) { … … 142 142 do { 143 143 $orders = wc_get_orders( $args ); 144 if ( ! is_array( $orders ) ) { 145 return null; 146 } 144 147 foreach ( $orders as $order ) { 148 if ( ! $order instanceof WC_Order ) { 149 return null; 150 } 145 151 $id = $order->get_id(); 146 152 if ( isset( $seen[ $id ] ) ) { … … 190 196 } 191 197 if ( '' !== get_option( 'giftlight_sold_on', '' ) ) { 192 $sum = array_merge( $sum, giftlight_sold_orders( $from ) ); 198 try { 199 $orders = giftlight_sold_orders( $from ); 200 } catch ( Throwable $error ) { 201 $orders = null; 202 } 203 if ( null === $orders ) { 204 $sum['orders_unavailable'] = true; 205 } else { 206 $sum = array_merge( $sum, $orders ); 207 } 193 208 } 194 209 return $sum; … … 420 435 function giftlight_sold_panel() { 421 436 $sum = giftlight_sold_summary( 30 ); 437 $unavailable = ! empty( $sum['orders_unavailable'] ); 422 438 echo '<h2>' . esc_html__( '4. What your guide sold', 'giftlight' ) . '</h2>'; 423 if ( 0 === $sum['opened'] && 0 === $sum['added'] && 0 === $sum['orders'] ) {439 if ( ! $unavailable && 0 === $sum['opened'] && 0 === $sum['added'] && 0 === $sum['orders'] ) { 424 440 $message = giftlight_sold_on() 425 441 ? __( 'Nothing yet. When a shopper opens a pick from your guide, this report starts counting.', 'giftlight' ) … … 429 445 return; 430 446 } 431 $values = array();432 ksort( $sum['totals'] );433 foreach ( $sum['totals'] ?: array( get_woocommerce_currency() => 0.0 ) as $currency => $amount ) {434 $values[] = esc_html( $currency ) . ' ' . wp_kses_post( wc_price( $amount, array( 'currency' => $currency ) ) );435 }436 447 $rows = array( 437 448 __( 'Picks opened', 'giftlight' ) => esc_html( number_format_i18n( $sum['opened'] ) ), 438 449 __( 'Added to the cart', 'giftlight' ) => esc_html( number_format_i18n( $sum['added'] ) ), 439 __( 'Orders with a pick', 'giftlight' ) => esc_html( number_format_i18n( $sum['orders'] ) ),440 __( 'Order value from picks', 'giftlight' ) => implode( '<br>', $values ),441 450 ); 451 if ( $unavailable ) { 452 echo '<p class="description" role="status">' . esc_html__( 'WooCommerce orders couldn’t be loaded. Reload this page to try again.', 'giftlight' ) . '</p>'; 453 } else { 454 $values = array(); 455 ksort( $sum['totals'] ); 456 foreach ( $sum['totals'] ?: array( get_woocommerce_currency() => 0.0 ) as $currency => $amount ) { 457 $values[] = esc_html( $currency ) . ' ' . wp_kses_post( wc_price( $amount, array( 'currency' => $currency ) ) ); 458 } 459 $rows[ __( 'Orders with a pick', 'giftlight' ) ] = esc_html( number_format_i18n( $sum['orders'] ) ); 460 $rows[ __( 'Order value from picks', 'giftlight' ) ] = implode( '<br>', $values ); 461 } 442 462 echo '<table class="widefat striped" style="max-width:420px"><tbody>'; 443 463 foreach ( $rows as $label => $value ) { … … 445 465 } 446 466 echo '</tbody></table>'; 447 echo '<p class="description" style="max-width:720px">' . esc_html__( 'The last 30 days. Orders use WooCommerce’s payment date, or the order date if it has none, and the current Processing or Completed status. Value comes from the picked items, before tax and shipping. Each currency is shown separately. Partial refunds stay in the displayed value.', 'giftlight' ) . '</p>'; 467 if ( ! $unavailable ) { 468 echo '<p class="description" style="max-width:720px">' . esc_html__( 'The last 30 days. Orders use WooCommerce’s payment date, or the order date if it has none, and the current Processing or Completed status. Value comes from the picked items, before tax and shipping. Each currency is shown separately. Partial refunds stay in the displayed value.', 'giftlight' ) . '</p>'; 469 } 448 470 giftlight_sold_switch(); 449 471 } -
giftlight/trunk/giftlight.php
r3809506 r3810567 4 4 * Plugin URI: https://giftlight.app/ 5 5 * Description: A gift guide and a gift finder quiz built from your own WooCommerce products: by who it's for, what to spend and what they're into. 6 * Version: 1.1.2 06 * Version: 1.1.21 7 7 * Requires at least: 6.3 8 8 * Requires PHP: 7.4 … … 21 21 } 22 22 23 define( 'GIFTLIGHT_VERSION', '1.1.2 0' );23 define( 'GIFTLIGHT_VERSION', '1.1.21' ); 24 24 define( 'GIFTLIGHT_FILE', __FILE__ ); 25 25 define( 'GIFTLIGHT_MAX_PRODUCTS', 300 ); -
giftlight/trunk/readme.txt
r3809506 r3810567 6 6 Requires PHP: 7.4 7 7 Requires Plugins: woocommerce 8 Stable tag: 1.1.2 08 Stable tag: 1.1.21 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
giftlight/trunk/sold.php
r3800841 r3810567 116 116 * 117 117 * @param string $from First included local calendar day. 118 * @return array 118 * @return array|null Null when the order results are incomplete or invalid. 119 119 */ 120 120 function giftlight_sold_orders( $from ) { … … 142 142 do { 143 143 $orders = wc_get_orders( $args ); 144 if ( ! is_array( $orders ) ) { 145 return null; 146 } 144 147 foreach ( $orders as $order ) { 148 if ( ! $order instanceof WC_Order ) { 149 return null; 150 } 145 151 $id = $order->get_id(); 146 152 if ( isset( $seen[ $id ] ) ) { … … 190 196 } 191 197 if ( '' !== get_option( 'giftlight_sold_on', '' ) ) { 192 $sum = array_merge( $sum, giftlight_sold_orders( $from ) ); 198 try { 199 $orders = giftlight_sold_orders( $from ); 200 } catch ( Throwable $error ) { 201 $orders = null; 202 } 203 if ( null === $orders ) { 204 $sum['orders_unavailable'] = true; 205 } else { 206 $sum = array_merge( $sum, $orders ); 207 } 193 208 } 194 209 return $sum; … … 420 435 function giftlight_sold_panel() { 421 436 $sum = giftlight_sold_summary( 30 ); 437 $unavailable = ! empty( $sum['orders_unavailable'] ); 422 438 echo '<h2>' . esc_html__( '4. What your guide sold', 'giftlight' ) . '</h2>'; 423 if ( 0 === $sum['opened'] && 0 === $sum['added'] && 0 === $sum['orders'] ) {439 if ( ! $unavailable && 0 === $sum['opened'] && 0 === $sum['added'] && 0 === $sum['orders'] ) { 424 440 $message = giftlight_sold_on() 425 441 ? __( 'Nothing yet. When a shopper opens a pick from your guide, this report starts counting.', 'giftlight' ) … … 429 445 return; 430 446 } 431 $values = array();432 ksort( $sum['totals'] );433 foreach ( $sum['totals'] ?: array( get_woocommerce_currency() => 0.0 ) as $currency => $amount ) {434 $values[] = esc_html( $currency ) . ' ' . wp_kses_post( wc_price( $amount, array( 'currency' => $currency ) ) );435 }436 447 $rows = array( 437 448 __( 'Picks opened', 'giftlight' ) => esc_html( number_format_i18n( $sum['opened'] ) ), 438 449 __( 'Added to the cart', 'giftlight' ) => esc_html( number_format_i18n( $sum['added'] ) ), 439 __( 'Orders with a pick', 'giftlight' ) => esc_html( number_format_i18n( $sum['orders'] ) ),440 __( 'Order value from picks', 'giftlight' ) => implode( '<br>', $values ),441 450 ); 451 if ( $unavailable ) { 452 echo '<p class="description" role="status">' . esc_html__( 'WooCommerce orders couldn’t be loaded. Reload this page to try again.', 'giftlight' ) . '</p>'; 453 } else { 454 $values = array(); 455 ksort( $sum['totals'] ); 456 foreach ( $sum['totals'] ?: array( get_woocommerce_currency() => 0.0 ) as $currency => $amount ) { 457 $values[] = esc_html( $currency ) . ' ' . wp_kses_post( wc_price( $amount, array( 'currency' => $currency ) ) ); 458 } 459 $rows[ __( 'Orders with a pick', 'giftlight' ) ] = esc_html( number_format_i18n( $sum['orders'] ) ); 460 $rows[ __( 'Order value from picks', 'giftlight' ) ] = implode( '<br>', $values ); 461 } 442 462 echo '<table class="widefat striped" style="max-width:420px"><tbody>'; 443 463 foreach ( $rows as $label => $value ) { … … 445 465 } 446 466 echo '</tbody></table>'; 447 echo '<p class="description" style="max-width:720px">' . esc_html__( 'The last 30 days. Orders use WooCommerce’s payment date, or the order date if it has none, and the current Processing or Completed status. Value comes from the picked items, before tax and shipping. Each currency is shown separately. Partial refunds stay in the displayed value.', 'giftlight' ) . '</p>'; 467 if ( ! $unavailable ) { 468 echo '<p class="description" style="max-width:720px">' . esc_html__( 'The last 30 days. Orders use WooCommerce’s payment date, or the order date if it has none, and the current Processing or Completed status. Value comes from the picked items, before tax and shipping. Each currency is shown separately. Partial refunds stay in the displayed value.', 'giftlight' ) . '</p>'; 469 } 448 470 giftlight_sold_switch(); 449 471 }
Note:
See TracChangeset
for help on using the changeset viewer.