3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Mini-cart * * Contains the markup for the mini-cart, used by the cart widget. * * This template can be overridden by copying it to yourtheme/woocommerce/cart/mini-cart.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you * (the theme developer) will need to copy the new files to your theme to * maintain compatibility. We try to do this as little as possible, but it does * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates * @version 3.1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } do_action( 'woocommerce_before_mini_cart' ); ?> <?php if ( ! WC()->cart->is_empty() ) : ?> <ul class="woocommerce-mini-cart cart_list product_list_widget <?php echo esc_attr( $args['list_class'] ); ?>"> <?php do_action( 'woocommerce_before_mini_cart_contents' ); foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) ) { $product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ); $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key ); $product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key ); ?> <li class="woocommerce-mini-cart-item <?php echo esc_attr( apply_filters( 'woocommerce_mini_cart_item_class', 'mini_cart_item', $cart_item, $cart_item_key ) ); ?>"> <?php echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf( '<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">&times;</a>', esc_url( WC()->cart->get_remove_url( $cart_item_key ) ), __( 'Remove this item', 'woocommerce' ), esc_attr( $product_id ), esc_attr( $_product->get_sku() ) ), $cart_item_key ); ?> <?php if ( ! $_product->is_visible() ) : ?> <?php echo str_replace( array( 'http:', 'https:' ), '', $thumbnail ) . $product_name . '&nbsp;'; ?> <?php else : ?> <a href="<?php echo esc_url( $product_permalink ); ?>"> <?php echo str_replace( array( 'http:', 'https:' ), '', $thumbnail ) . $product_name . '&nbsp;'; ?> </a> <?php endif; ?> <?php echo WC()->cart->get_item_data( $cart_item ); ?> <?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s &times; %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ); ?> </li> <?php } } do_action( 'woocommerce_mini_cart_contents' ); ?> </ul> <p class="woocommerce-mini-cart__total total"><strong><?php _e( 'Subtotal', 'woocommerce' ); ?>:</strong> <?php echo WC()->cart->get_cart_subtotal(); ?></p> <?php do_action( 'woocommerce_widget_shopping_cart_before_buttons' ); ?> <p class="woocommerce-mini-cart__buttons buttons"><?php do_action( 'woocommerce_widget_shopping_cart_buttons' ); ?></p> <?php else : ?> <p class="woocommerce-mini-cart__empty-message"><?php _e( 'No products in the cart.', 'woocommerce' ); ?></p> <?php endif; ?> <?php do_action( 'woocommerce_after_mini_cart' ); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 245
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 219
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 219
Branch analysis from position: 33
2 jumps found. (Code = 46) Position 1 = 53, Position 2 = 56
Branch analysis from position: 53
2 jumps found. (Code = 46) Position 1 = 57, Position 2 = 60
Branch analysis from position: 57
2 jumps found. (Code = 46) Position 1 = 61, Position 2 = 68
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 218
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 105, Position 2 = 110
Branch analysis from position: 105
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
2 jumps found. (Code = 43) Position 1 = 167, Position 2 = 178
Branch analysis from position: 167
1 jumps found. (Code = 42) Position 1 = 193
Branch analysis from position: 193
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 178
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 110
2 jumps found. (Code = 43) Position 1 = 167, Position 2 = 178
Branch analysis from position: 167
Branch analysis from position: 178
Branch analysis from position: 218
Branch analysis from position: 68
Branch analysis from position: 60
Branch analysis from position: 56
Branch analysis from position: 219
1 jumps found. (Code = 42) Position 1 = 251
Branch analysis from position: 251
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 219
Branch analysis from position: 245
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2W90d
function name:  (null)
number of ops:  256
compiled vars:  !0 = $args, !1 = $cart_item, !2 = $cart_item_key, !3 = $_product, !4 = $product_id, !5 = $product_name, !6 = $thumbnail, !7 = $product_price, !8 = $product_permalink
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   DEFINED                                          ~9      'ABSPATH'
          1        BOOL_NOT                                         ~10     ~9
          2      > JMPZ                                                     ~10, ->4
   21     3    > > EXIT                                                     
   24     4    >   INIT_FCALL_BY_NAME                                       'do_action'
          5        SEND_VAL_EX                                              'woocommerce_before_mini_cart'
          6        DO_FCALL                                      0          
   25     7        ECHO                                                     '%0A'
   26     8        INIT_FCALL_BY_NAME                                       'WC'
          9        DO_FCALL                                      0  $12     
         10        FETCH_OBJ_R                                      ~13     $12, 'cart'
         11        INIT_METHOD_CALL                                         ~13, 'is_empty'
         12        DO_FCALL                                      0  $14     
         13        BOOL_NOT                                         ~15     $14
         14      > JMPZ                                                     ~15, ->245
   27    15    >   ECHO                                                     '%0A%09%3Cul+class%3D%22woocommerce-mini-cart+cart_list+product_list_widget+'
   28    16        INIT_FCALL_BY_NAME                                       'esc_attr'
         17        CHECK_FUNC_ARG                                           
         18        FETCH_DIM_FUNC_ARG                               $16     !0, 'list_class'
         19        SEND_FUNC_ARG                                            $16
         20        DO_FCALL                                      0  $17     
         21        ECHO                                                     $17
         22        ECHO                                                     '%22%3E%0A%09%09'
   30    23        INIT_FCALL_BY_NAME                                       'do_action'
         24        SEND_VAL_EX                                              'woocommerce_before_mini_cart_contents'
         25        DO_FCALL                                      0          
   32    26        INIT_FCALL_BY_NAME                                       'WC'
         27        DO_FCALL                                      0  $19     
         28        FETCH_OBJ_R                                      ~20     $19, 'cart'
         29        INIT_METHOD_CALL                                         ~20, 'get_cart'
         30        DO_FCALL                                      0  $21     
         31      > FE_RESET_R                                       $22     $21, ->219
         32    > > FE_FETCH_R                                       ~23     $22, !1, ->219
         33    >   ASSIGN                                                   !2, ~23
   33    34        INIT_FCALL_BY_NAME                                       'apply_filters'
         35        SEND_VAL_EX                                              'woocommerce_cart_item_product'
         36        CHECK_FUNC_ARG                                           
         37        FETCH_DIM_FUNC_ARG                               $25     !1, 'data'
         38        SEND_FUNC_ARG                                            $25
         39        SEND_VAR_EX                                              !1
         40        SEND_VAR_EX                                              !2
         41        DO_FCALL                                      0  $26     
         42        ASSIGN                                                   !3, $26
   34    43        INIT_FCALL_BY_NAME                                       'apply_filters'
         44        SEND_VAL_EX                                              'woocommerce_cart_item_product_id'
         45        CHECK_FUNC_ARG                                           
         46        FETCH_DIM_FUNC_ARG                               $28     !1, 'product_id'
         47        SEND_FUNC_ARG                                            $28
         48        SEND_VAR_EX                                              !1
         49        SEND_VAR_EX                                              !2
         50        DO_FCALL                                      0  $29     
         51        ASSIGN                                                   !4, $29
   36    52      > JMPZ_EX                                          ~31     !3, ->56
         53    >   INIT_METHOD_CALL                                         !3, 'exists'
         54        DO_FCALL                                      0  $32     
         55        BOOL                                             ~31     $32
         56    > > JMPZ_EX                                          ~31     ~31, ->60
         57    >   FETCH_DIM_R                                      ~33     !1, 'quantity'
         58        IS_SMALLER                                       ~34     0, ~33
         59        BOOL                                             ~31     ~34
         60    > > JMPZ_EX                                          ~31     ~31, ->68
         61    >   INIT_FCALL_BY_NAME                                       'apply_filters'
         62        SEND_VAL_EX                                              'woocommerce_widget_cart_item_visible'
         63        SEND_VAL_EX                                              <true>
         64        SEND_VAR_EX                                              !1
         65        SEND_VAR_EX                                              !2
         66        DO_FCALL                                      0  $35     
         67        BOOL                                             ~31     $35
         68    > > JMPZ                                                     ~31, ->218
   37    69    >   INIT_FCALL_BY_NAME                                       'apply_filters'
         70        SEND_VAL_EX                                              'woocommerce_cart_item_name'
         71        INIT_METHOD_CALL                                         !3, 'get_name'
         72        DO_FCALL                                      0  $36     
         73        SEND_VAR_NO_REF_EX                                       $36
         74        SEND_VAR_EX                                              !1
         75        SEND_VAR_EX                                              !2
         76        DO_FCALL                                      0  $37     
         77        ASSIGN                                                   !5, $37
   38    78        INIT_FCALL_BY_NAME                                       'apply_filters'
         79        SEND_VAL_EX                                              'woocommerce_cart_item_thumbnail'
         80        INIT_METHOD_CALL                                         !3, 'get_image'
         81        DO_FCALL                                      0  $39     
         82        SEND_VAR_NO_REF_EX                                       $39
         83        SEND_VAR_EX                                              !1
         84        SEND_VAR_EX                                              !2
         85        DO_FCALL                                      0  $40     
         86        ASSIGN                                                   !6, $40
   39    87        INIT_FCALL_BY_NAME                                       'apply_filters'
         88        SEND_VAL_EX                                              'woocommerce_cart_item_price'
         89        INIT_FCALL_BY_NAME                                       'WC'
         90        DO_FCALL                                      0  $42     
         91        FETCH_OBJ_R                                      ~43     $42, 'cart'
         92        INIT_METHOD_CALL                                         ~43, 'get_product_price'
         93        SEND_VAR_EX                                              !3
         94        DO_FCALL                                      0  $44     
         95        SEND_VAR_NO_REF_EX                                       $44
         96        SEND_VAR_EX                                              !1
         97        SEND_VAR_EX                                              !2
         98        DO_FCALL                                      0  $45     
         99        ASSIGN                                                   !7, $45
   40   100        INIT_FCALL_BY_NAME                                       'apply_filters'
        101        SEND_VAL_EX                                              'woocommerce_cart_item_permalink'
        102        INIT_METHOD_CALL                                         !3, 'is_visible'
        103        DO_FCALL                                      0  $47     
        104      > JMPZ                                                     $47, ->110
        105    >   INIT_METHOD_CALL                                         !3, 'get_permalink'
        106        SEND_VAR_EX                                              !1
        107        DO_FCALL                                      0  $48     
        108        QM_ASSIGN                                        ~49     $48
        109      > JMP                                                      ->111
        110    >   QM_ASSIGN                                        ~49     ''
        111    >   SEND_VAL_EX                                              ~49
        112        SEND_VAR_EX                                              !1
        113        SEND_VAR_EX                                              !2
        114        DO_FCALL                                      0  $50     
        115        ASSIGN                                                   !8, $50
   42   116        ECHO                                                     '%09%09%09%09%09%3Cli+class%3D%22woocommerce-mini-cart-item+'
        117        INIT_FCALL_BY_NAME                                       'esc_attr'
        118        INIT_FCALL_BY_NAME                                       'apply_filters'
        119        SEND_VAL_EX                                              'woocommerce_mini_cart_item_class'
        120        SEND_VAL_EX                                              'mini_cart_item'
        121        SEND_VAR_EX                                              !1
        122        SEND_VAR_EX                                              !2
        123        DO_FCALL                                      0  $52     
        124        SEND_VAR_NO_REF_EX                                       $52
        125        DO_FCALL                                      0  $53     
        126        ECHO                                                     $53
        127        ECHO                                                     '%22%3E%0A%09%09%09%09%09%09'
   44   128        INIT_FCALL_BY_NAME                                       'apply_filters'
        129        SEND_VAL_EX                                              'woocommerce_cart_item_remove_link'
        130        INIT_FCALL                                               'sprintf'
   45   131        SEND_VAL                                                 '%3Ca+href%3D%22%25s%22+class%3D%22remove%22+aria-label%3D%22%25s%22+data-product_id%3D%22%25s%22+data-product_sku%3D%22%25s%22%3E%26times%3B%3C%2Fa%3E'
   46   132        INIT_FCALL_BY_NAME                                       'esc_url'
        133        INIT_FCALL_BY_NAME                                       'WC'
        134        DO_FCALL                                      0  $54     
        135        FETCH_OBJ_R                                      ~55     $54, 'cart'
        136        INIT_METHOD_CALL                                         ~55, 'get_remove_url'
        137        SEND_VAR_EX                                              !2
        138        DO_FCALL                                      0  $56     
        139        SEND_VAR_NO_REF_EX                                       $56
        140        DO_FCALL                                      0  $57     
        141        SEND_VAR                                                 $57
   47   142        INIT_FCALL_BY_NAME                                       '__'
        143        SEND_VAL_EX                                              'Remove+this+item'
        144        SEND_VAL_EX                                              'woocommerce'
        145        DO_FCALL                                      0  $58     
        146        SEND_VAR                                                 $58
   48   147        INIT_FCALL_BY_NAME                                       'esc_attr'
        148        SEND_VAR_EX                                              !4
        149        DO_FCALL                                      0  $59     
        150        SEND_VAR                                                 $59
   49   151        INIT_FCALL_BY_NAME                                       'esc_attr'
        152        INIT_METHOD_CALL                                         !3, 'get_sku'
        153        DO_FCALL                                      0  $60     
        154        SEND_VAR_NO_REF_EX                                       $60
        155        DO_FCALL                                      0  $61     
        156        SEND_VAR                                                 $61
        157        DO_ICALL                                         $62     
        158        SEND_VAR_NO_REF_EX                                       $62
   44   159        SEND_VAR_EX                                              !2
        160        DO_FCALL                                      0  $63     
        161        ECHO                                                     $63
   52   162        ECHO                                                     '%09%09%09%09%09%09'
        163        INIT_METHOD_CALL                                         !3, 'is_visible'
        164        DO_FCALL                                      0  $64     
        165        BOOL_NOT                                         ~65     $64
        166      > JMPZ                                                     ~65, ->178
   53   167    >   ECHO                                                     '%09%09%09%09%09%09%09'
        168        INIT_FCALL                                               'str_replace'
        169        SEND_VAL                                                 <array>
        170        SEND_VAL                                                 ''
        171        SEND_VAR                                                 !6
        172        DO_ICALL                                         $66     
        173        CONCAT                                           ~67     $66, !5
        174        CONCAT                                           ~68     ~67, '%26nbsp%3B'
        175        ECHO                                                     ~68
   54   176        ECHO                                                     '%09%09%09%09%09%09'
        177      > JMP                                                      ->193
   55   178    >   ECHO                                                     '%09%09%09%09%09%09%09%3Ca+href%3D%22'
        179        INIT_FCALL_BY_NAME                                       'esc_url'
        180        SEND_VAR_EX                                              !8
        181        DO_FCALL                                      0  $69     
        182        ECHO                                                     $69
        183        ECHO                                                     '%22%3E%0A%09%09%09%09%09%09%09%09'
   56   184        INIT_FCALL                                               'str_replace'
        185        SEND_VAL                                                 <array>
        186        SEND_VAL                                                 ''
        187        SEND_VAR                                                 !6
        188        DO_ICALL                                         $70     
        189        CONCAT                                           ~71     $70, !5
        190        CONCAT                                           ~72     ~71, '%26nbsp%3B'
        191        ECHO                                                     ~72
   57   192        ECHO                                                     '%09%09%09%09%09%09%09%3C%2Fa%3E%0A%09%09%09%09%09%09'
   59   193    >   ECHO                                                     '%09%09%09%09%09%09'
        194        INIT_FCALL_BY_NAME                                       'WC'
        195        DO_FCALL                                      0  $73     
        196        FETCH_OBJ_R                                      ~74     $73, 'cart'
        197        INIT_METHOD_CALL                                         ~74, 'get_item_data'
        198        SEND_VAR_EX                                              !1
        199        DO_FCALL                                      0  $75     
        200        ECHO                                                     $75
   60   201        ECHO                                                     '%0A%09%09%09%09%09%09'
   61   202        INIT_FCALL_BY_NAME                                       'apply_filters'
        203        SEND_VAL_EX                                              'woocommerce_widget_cart_item_quantity'
        204        INIT_FCALL                                               'sprintf'
        205        SEND_VAL                                                 '%25s+%26times%3B+%25s'
        206        FETCH_DIM_R                                      ~76     !1, 'quantity'
        207        SEND_VAL                                                 ~76
        208        SEND_VAR                                                 !7
        209        DO_ICALL                                         $77     
        210        CONCAT                                           ~78     '%3Cspan+class%3D%22quantity%22%3E', $77
        211        CONCAT                                           ~79     ~78, '%3C%2Fspan%3E'
        212        SEND_VAL_EX                                              ~79
        213        SEND_VAR_EX                                              !1
        214        SEND_VAR_EX                                              !2
        215        DO_FCALL                                      0  $80     
        216        ECHO                                                     $80
   62   217        ECHO                                                     '%09%09%09%09%09%3C%2Fli%3E%0A%09%09%09%09%09'
   32   218    > > JMP                                                      ->32
        219    >   FE_FREE                                                  $22
   67   220        INIT_FCALL_BY_NAME                                       'do_action'
        221        SEND_VAL_EX                                              'woocommerce_mini_cart_contents'
        222        DO_FCALL                                      0          
   69   223        ECHO                                                     '%09%3C%2Ful%3E%0A%0A%09%3Cp+class%3D%22woocommerce-mini-cart__total+total%22%3E%3Cstrong%3E'
   71   224        INIT_FCALL_BY_NAME                                       '_e'
        225        SEND_VAL_EX                                              'Subtotal'
        226        SEND_VAL_EX                                              'woocommerce'
        227        DO_FCALL                                      0          
        228        ECHO                                                     '%3A%3C%2Fstrong%3E+'
        229        INIT_FCALL_BY_NAME                                       'WC'
        230        DO_FCALL                                      0  $83     
        231        FETCH_OBJ_R                                      ~84     $83, 'cart'
        232        INIT_METHOD_CALL                                         ~84, 'get_cart_subtotal'
        233        DO_FCALL                                      0  $85     
        234        ECHO                                                     $85
        235        ECHO                                                     '%3C%2Fp%3E%0A%0A%09'
   73   236        INIT_FCALL_BY_NAME                                       'do_action'
        237        SEND_VAL_EX                                              'woocommerce_widget_shopping_cart_before_buttons'
        238        DO_FCALL                                      0          
   74   239        ECHO                                                     '%0A%09%3Cp+class%3D%22woocommerce-mini-cart__buttons+buttons%22%3E'
   75   240        INIT_FCALL_BY_NAME                                       'do_action'
        241        SEND_VAL_EX                                              'woocommerce_widget_shopping_cart_buttons'
        242        DO_FCALL                                      0          
        243        ECHO                                                     '%3C%2Fp%3E%0A%0A'
        244      > JMP                                                      ->251
   78   245    >   ECHO                                                     '%0A%09%3Cp+class%3D%22woocommerce-mini-cart__empty-message%22%3E'
   79   246        INIT_FCALL_BY_NAME                                       '_e'
        247        SEND_VAL_EX                                              'No+products+in+the+cart.'
        248        SEND_VAL_EX                                              'woocommerce'
        249        DO_FCALL                                      0          
        250        ECHO                                                     '%3C%2Fp%3E%0A%0A'
   82   251    >   ECHO                                                     '%0A'
   83   252        INIT_FCALL_BY_NAME                                       'do_action'
        253        SEND_VAL_EX                                              'woocommerce_after_mini_cart'
        254        DO_FCALL                                      0          
        255      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.42 ms | 1420 KiB | 17 Q