Plugin Directory

Changeset 3466081


Ignore:
Timestamp:
02/20/2026 08:39:56 PM (5 weeks ago)
Author:
phppoet
Message:

Update codebase of 3.8.1

Location:
customize-my-account-for-woocommerce
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • customize-my-account-for-woocommerce/tags/3.8.1/customize-my-account-for-woocommerce.php

    r3465865 r3466081  
    44    Plugin URI: https://sysbasics.com
    55    Description: Customize My account page. Add/Edit/Remove Endpoints.
    6     Version: 3.8.0
     6    Version: 3.8.1
    77    Author: SysBasics
    88    Author URI: https://sysbasics.com
  • customize-my-account-for-woocommerce/tags/3.8.1/include/admin/wrap/endpoints-content.php

    r3464708 r3466081  
    145145
    146146</tr>
    147 <?php if (isset($third_party)) { ?>
    148     <tr>
    149         <td>
    150             <label class=" wcmamtx_accordion_label">
    151                 <?php echo esc_html__('Content Before','customize-my-account-for-woocommerce'); ?>
    152                 <?php echo $key; ?>   
    153                 <?php echo esc_html__('Content','customize-my-account-for-woocommerce'); ?>
    154             </label>
    155         </td>
    156         <td>
    157             <?php wcmamtx_show_disabled_toggle_image(); ?>
    158 
    159         </td>
    160     </tr>
    161     <tr>
    162         <td>
    163             <label class=" wcmamtx_accordion_label">
    164                 <?php echo esc_html__('Content After','customize-my-account-for-woocommerce'); ?>
    165                 <?php echo $key; ?>   
    166                 <?php echo esc_html__('Content','customize-my-account-for-woocommerce'); ?>
    167             </label>
    168         </td>
    169         <td>
    170             <?php wcmamtx_show_disabled_toggle_image(); ?>
    171 
    172         </td>
    173     </tr>
    174 <?php } ?>
    175 
    176 
    177 
    178 
    179 
    180147<tr>
    181148    <td>
  • customize-my-account-for-woocommerce/tags/3.8.1/include/admin/wrap/subwrap/countof-settings.php

    r3465865 r3466081  
    7474                $hide_sidebar = isset($value['hide_sidebar']) && ($value['hide_sidebar'] == "01") ? "yes" : "no";
    7575               
     76            break;
     77
     78            case "wishlist":
     79                $wishlist_mode = "none";
     80
     81                $wishlist_mode = wcmamtx_detect_wishlist_mode();
     82
     83                echo $wishlist_mode;
     84
     85                if ($wishlist_mode == "none") {
     86                    $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     87                } else {
     88
     89                    if (is_array($value) ) {
     90
     91                        if (!isset($value['count_bubble'])) {
     92                            $value['count_bubble'] = "01";
     93                        } else {
     94                            $value['count_bubble'] = $value['count_bubble'];
     95                        }
     96
     97                    }
     98
     99                    $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     100
     101                }
     102
     103               
     104         
     105                $hide_empty = isset($value['hide_empty']) && ($value['hide_empty'] == "01") ? "yes" : "no";
     106
     107                $section_style = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "display:block;" : "display:none;";
     108
     109
     110
     111                $count_of = isset($value['count_of']) ? $value['count_of'] : $wishlist_mode;
     112
     113
     114               
     115
     116
     117                $section_style_cpt = isset($count_of) && ($count_of == "cpt_count") ? "display:block;" : "display:none;";
     118
     119                $section_style_usermeta = isset($count_of) && ($count_of == "usermeta_count") ? "display:block;" : "display:none;";
     120
     121
     122                $hide_sidebar = isset($value['hide_sidebar']) && ($value['hide_sidebar'] == "01") ? "yes" : "no";
     123
     124
    76125            break;
    77126
  • customize-my-account-for-woocommerce/tags/3.8.1/include/wcmamtx_countof_functions.php

    r3465865 r3466081  
    1111
    1212        $count_of = 'none';
     13
     14
    1315
    1416         switch($key) {
     
    3840            break;
    3941
     42             case "wishlist":
     43
     44               
     45
     46                $wishlist_mode = "none";
     47
     48                $wishlist_mode = wcmamtx_detect_wishlist_mode();
     49
     50
     51
     52                if ($wishlist_mode == "none") {
     53                    $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     54                } else {
     55
     56                    if (is_array($value) ) {
     57
     58                        if (!isset($value['count_bubble'])) {
     59                            $value['count_bubble'] = "01";
     60                        } else {
     61                            $value['count_bubble'] = $value['count_bubble'];
     62                        }
     63
     64                    }
     65
     66                    $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     67
     68                }
     69         
     70                $hide_empty = isset($value['hide_empty']) && ($value['hide_empty'] == "01") ? "yes" : "no";
     71
     72
     73                $count_of = isset($value['count_of']) ? $value['count_of'] : $wishlist_mode;
     74
     75
     76                wcmamtx_countof_conditional_switch($count_of,$value,$sidebar);
     77
     78               
     79
     80
     81            break;
     82
    4083            case "woo-wallet":
    4184                if (is_array($value) ) {
     
    115158                if (isset($count_of) && ($count_of != null)) {
    116159
    117                     if (($key != "orders") || ($key != "downloads")) {
    118 
    119 
    120 
    121                         switch($count_of) {
    122 
    123                             case "order_count":
    124                             wcmamtx_render_order_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    125                             break;
    126 
    127                             case "downloads_count":
    128                             wcmamtx_render_download_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    129                             break;
    130 
    131                             case "cpt_count":
    132                             wcmamtx_render_cpt_count_bubble_html($count_bubble,$hide_empty,$value,$sidebar);
    133                             break;
    134 
    135                             case "yith_wishlist":
    136                             if (function_exists('wcmamtx_render_yith_wishlist_count_bubble_html')) {
    137                                 if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
    138                                     wcmamtx_render_yith_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    139                                 }
    140                                
    141                             }
    142                             break;
    143 
    144                             case "wpc_wishlist":
    145 
    146                             if ( is_plugin_active( 'woo-smart-wishlist/wpc-smart-wishlist.php' ) || is_plugin_active( 'woo-smart-wishlist-premium/wpc-smart-wishlist.php' )) {
    147 
    148                                 if ( class_exists( 'WPCleverWoosw' ) ) {
    149                                     wcmamtx_render_wpc_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    150                                 }
    151                             }
    152                             break;
    153 
    154                            
    155                             case "woodmart_wishlist":
    156 
    157                             if ( is_plugin_active( 'woodmart-core/woodmart-core.php' ) && function_exists('woodmart_get_wishlist_count')) {
    158 
    159                                 $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
    160 
    161                                 $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
    162 
    163                                 $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
    164 
    165                                 if ($woodmart_wishlist_on == "yes") {
    166                                     wcmamtx_render_woodmart_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    167                                 }
    168 
    169 
    170                             }
    171 
    172                             break;
    173                            
    174 
    175                             case "none":
    176                             break;
    177 
    178                         }
     160                    if (($key != "orders") || ($key != "downloads") || ($key != "wishlist")) {
     161
     162
     163                       wcmamtx_countof_conditional_switch($count_of,$value,$sidebar);
     164
    179165
    180166                    }
     
    191177    }
    192178
     179}
     180
     181
     182if (!function_exists('wcmamtx_countof_conditional_switch')) {
     183
     184    function wcmamtx_countof_conditional_switch($count_of,$value,$sidebar = null) {
     185
     186        $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     187
     188
     189        $hide_empty = isset($value['hide_empty']) && ($value['hide_empty'] == "01") ? "yes" : "no";
     190
     191
     192        switch($count_of) {
     193
     194            case "order_count":
     195            wcmamtx_render_order_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     196            break;
     197
     198            case "downloads_count":
     199            wcmamtx_render_download_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     200            break;
     201
     202            case "cpt_count":
     203            wcmamtx_render_cpt_count_bubble_html($count_bubble,$hide_empty,$value,$sidebar);
     204            break;
     205
     206            case "yith_wishlist":
     207
     208            if (function_exists('wcmamtx_render_yith_wishlist_count_bubble_html')) {
     209                if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
     210
     211                    wcmamtx_render_yith_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     212                }
     213
     214            }
     215            break;
     216
     217            case "wpc_wishlist":
     218
     219            if ( is_plugin_active( 'woo-smart-wishlist/wpc-smart-wishlist.php' ) || is_plugin_active( 'woo-smart-wishlist-premium/wpc-smart-wishlist.php' )) {
     220
     221                if ( class_exists( 'WPCleverWoosw' ) ) {
     222                    wcmamtx_render_wpc_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     223                }
     224            }
     225            break;
     226
     227
     228            case "woodmart_wishlist":
     229
     230            if ( is_plugin_active( 'woodmart-core/woodmart-core.php' ) && function_exists('woodmart_get_wishlist_count')) {
     231
     232                $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
     233
     234                $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
     235
     236                $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
     237
     238                if ($woodmart_wishlist_on == "yes") {
     239                    wcmamtx_render_woodmart_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     240                }
     241
     242
     243            }
     244
     245            break;
     246
     247
     248            case "none":
     249            break;
     250
     251        }
     252
     253        do_action('wcmamtx_after_countof_wrapper');
     254    }
    193255}
    194256
     
    228290
    229291
     292if (!function_exists('wcmamtx_detect_wishlist_mode')) {
     293
     294    function wcmamtx_detect_wishlist_mode() {
     295
     296        $wishlist_mode = "none";
     297       
     298
     299        if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
     300            $wishlist_mode = "yith_wishlist";
     301
     302            return $wishlist_mode;
     303        }
     304
     305
     306        if ( is_plugin_active( 'woo-smart-wishlist/wpc-smart-wishlist.php' ) || is_plugin_active( 'woo-smart-wishlist-premium/wpc-smart-wishlist.php' )) {
     307            $wishlist_mode = "wpc_wishlist";
     308
     309            return $wishlist_mode;
     310        }
     311
     312        if ( is_plugin_active( 'woodmart-core/woodmart-core.php' ) && function_exists('woodmart_get_wishlist_count')) {
     313
     314            $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
     315
     316            $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
     317
     318            $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
     319
     320            if ($woodmart_wishlist_on == "yes") {
     321                $wishlist_mode = "woodmart_wishlist";
     322
     323                return $wishlist_mode;
     324            }
     325
     326
     327        }
     328
     329        return $wishlist_mode;
     330
     331       
     332    }
     333
     334}
     335
     336
    230337if (!function_exists('wcmamtx_get_total_wpswings_points_count')) {
    231338
     
    264371            }
    265372            return $wallet_balance;
     373
     374       
     375    }
     376
     377}
     378
     379
     380
     381
     382
     383
     384
     385
     386if (!function_exists('wcmamtx_get_user_post_type_count')) {
     387
     388    function wcmamtx_get_user_post_type_count($post_type,$status) {
     389
     390        $user_id = get_current_user_id();
     391        $args['author'] = $user_id;
     392        $args['post_type'] = $post_type;
     393        $args['post_status'] = $status;
     394        $ps = get_posts($args);
     395        return count($ps);
    266396
    267397       
     
    279409 */
    280410
    281 if (!function_exists('wcmamtx_get_total_downloads_count')) {
    282 
    283     function wcmamtx_get_total_downloads_count() {
     411if (!function_exists('wcmamtx_render_cpt_count_bubble_html')) {
     412
     413    function wcmamtx_render_cpt_count_bubble_html($count_bubble,$hide_empty,$value,$sidebar = null) {
    284414
    285415       
    286         // Check if a user is logged in and WooCommerce is active
    287         if ( ! is_user_logged_in() || ! function_exists( 'wc_get_customer_available_downloads' ) ) {
    288             return 0;
    289         }
    290 
    291         $current_user_id = get_current_user_id();
    292         $available_downloads = wc_get_customer_available_downloads( $current_user_id );
    293 
    294     // Return the total count of unique downloadable files available
    295         return count( $available_downloads );
    296 
    297     }
    298 
     416
     417
     418
     419        $custom_post_type = isset($value['count_post_type']) ? isset($value['count_post_type']) : "";
     420
     421        $cpt_status = isset($value['cpt_status']) ? isset($value['cpt_status']) : "publish";
     422
     423
     424
     425        $empty_goahead = 'yes';
     426
     427        $get_count = wcmamtx_get_user_post_type_count($custom_post_type,$cpt_status);
     428
     429        if ($hide_empty == "yes") {
     430
     431
     432            if ($get_count == 0) {
     433                $empty_goahead = 'no';
     434            } else {
     435                $empty_goahead = 'yes';
     436            }
     437
     438        }
     439
     440        if (($count_bubble == "yes") && ($custom_post_type != "") && ($empty_goahead == 'yes') && ($count_of == "post_type") && (is_numeric($get_count))) {
     441            ?>
     442            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> <?php if ($get_count == 0) { echo 'empty'; } ?>">         
     443                <?php echo wcmamtx_get_user_post_type_count($custom_post_type,$cpt_status); ?>
     444            </span>
     445            <?php
     446        }
     447
     448
     449    }
     450
     451}
     452
     453
     454
     455
     456
     457if (!function_exists('wcmamtx_render_wpswings_points_count_bubble_html')) {
     458
     459    function wcmamtx_render_wpswings_points_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     460
     461        $empty_goahead = 'yes';
     462
     463        $get_count = wcmamtx_get_total_wpswings_points_count();
     464
     465        if ($hide_empty == "yes") {
     466           
     467
     468            if ($get_count == 0) {
     469                $empty_goahead = 'no';
     470            } else {
     471                $empty_goahead = 'yes';
     472            }
     473
     474        }
     475
     476        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
     477            ?>
     478            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> <?php if ($get_count == 0) { echo 'empty'; } ?>">
     479                <?php echo wcmamtx_get_total_wpswings_points_count(); ?>
     480
     481            </span>
     482            <?php
     483        }
     484
     485
     486    }
    299487
    300488}
     
    308496 */
    309497
    310 if (!function_exists('wcmamtx_get_user_post_type_count')) {
    311 
    312     function wcmamtx_get_user_post_type_count($post_type,$status) {
    313 
    314         $user_id = get_current_user_id();
    315         $args['author'] = $user_id;
    316         $args['post_type'] = $post_type;
    317         $args['post_status'] = $status;
    318         $ps = get_posts($args);
    319         return count($ps);
    320 
    321        
    322     }
    323 
    324 }
    325 
    326 
    327 /**
    328  * Get account li html.
    329  *
    330  * @since 1.0.0
    331  * @param string $endpoint Endpoint.
    332  * @return string
    333  */
    334 
    335 if (!function_exists('wcmamtx_render_cpt_count_bubble_html')) {
    336 
    337     function wcmamtx_render_cpt_count_bubble_html($count_bubble,$hide_empty,$value,$sidebar = null) {
    338 
    339        
    340 
    341 
    342 
    343         $custom_post_type = isset($value['count_post_type']) ? isset($value['count_post_type']) : "";
    344 
    345         $cpt_status = isset($value['cpt_status']) ? isset($value['cpt_status']) : "publish";
    346 
    347 
     498if (!function_exists('wcmamtx_render_woo_wallet_count_bubble_html')) {
     499
     500    function wcmamtx_render_woo_wallet_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    348501
    349502        $empty_goahead = 'yes';
    350503
    351         $get_count = wcmamtx_get_user_post_type_count($custom_post_type,$cpt_status);
     504        $get_count = wcmamtx_get_total_woowallet_count();
    352505
    353506        if ($hide_empty == "yes") {
    354 
     507           
    355508
    356509            if ($get_count == 0) {
     
    362515        }
    363516
    364         if (($count_bubble == "yes") && ($custom_post_type != "") && ($empty_goahead == 'yes') && ($count_of == "post_type") && (is_numeric($get_count))) {
     517        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    365518            ?>
    366             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?>">         
    367                 <?php echo wcmamtx_get_user_post_type_count($custom_post_type,$cpt_status); ?>
     519            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> amount <?php if ($get_count == 0) { echo 'empty'; } ?>">
     520                <?php echo wc_price(wcmamtx_get_total_woowallet_count()); ?>
     521
    368522            </span>
    369523            <?php
     
    379533
    380534
    381 if (!function_exists('wcmamtx_render_wpswings_points_count_bubble_html')) {
    382 
    383     function wcmamtx_render_wpswings_points_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     535
     536
     537if (!function_exists('wcmamtx_render_order_count_bubble_html')) {
     538
     539    function wcmamtx_render_order_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    384540
    385541        $empty_goahead = 'yes';
    386542
     543        $get_count = wcmamtx_get_total_orderid_count();
     544
    387545        if ($hide_empty == "yes") {
    388             $get_count = wcmamtx_get_total_wpswings_points_count();
     546           
    389547
    390548            if ($get_count == 0) {
     
    398556        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    399557            ?>
    400             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?>">
    401                 <?php echo wcmamtx_get_total_wpswings_points_count(); ?>
     558            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> <?php if ($get_count == 0) { echo 'empty'; } ?>">
     559                <?php echo wcmamtx_get_total_orderid_count(); ?>
    402560
    403561            </span>
     
    410568}
    411569
    412 /**
    413  * Get account li html.
    414  *
    415  * @since 1.0.0
    416  * @param string $endpoint Endpoint.
    417  * @return string
    418  */
    419 
    420 if (!function_exists('wcmamtx_render_woo_wallet_count_bubble_html')) {
    421 
    422     function wcmamtx_render_woo_wallet_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     570
     571
     572
     573if (!function_exists('wcmamtx_render_download_count_bubble_html')) {
     574
     575    function wcmamtx_render_download_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    423576
    424577        $empty_goahead = 'yes';
    425578
     579        $get_count = wcmamtx_get_total_downloads_count();
     580
    426581        if ($hide_empty == "yes") {
    427             $get_count = wcmamtx_get_total_woowallet_count();
     582           
    428583
    429584            if ($get_count == 0) {
     
    435590        }
    436591
    437         if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
     592        if (($count_bubble == "yes") && ($empty_goahead == 'yes')) {
    438593            ?>
    439             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> amount">
    440                 <?php echo wc_price(wcmamtx_get_total_woowallet_count()); ?>
     594            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> <?php if ($get_count == 0) { echo 'empty'; } ?>">
     595                <?php echo wcmamtx_get_total_downloads_count(); ?>
    441596
    442597            </span>
     
    449604}
    450605
    451 
    452 
    453 
    454 
    455 /**
    456  * Get account li html.
    457  *
    458  * @since 1.0.0
    459  * @param string $endpoint Endpoint.
    460  * @return string
    461  */
    462 
    463 if (!function_exists('wcmamtx_render_order_count_bubble_html')) {
    464 
    465     function wcmamtx_render_order_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     606if (!function_exists('wcmamtx_get_total_downloads_count')) {
     607
     608    function wcmamtx_get_total_downloads_count() {
     609
     610       
     611        // Check if a user is logged in and WooCommerce is active
     612        if ( ! is_user_logged_in() || ! function_exists( 'wc_get_customer_available_downloads' ) ) {
     613            return 0;
     614        }
     615
     616        $current_user_id = get_current_user_id();
     617        $available_downloads = wc_get_customer_available_downloads( $current_user_id );
     618
     619    // Return the total count of unique downloadable files available
     620        return count( $available_downloads );
     621       
     622
     623    }
     624
     625
     626}
     627
     628
     629
     630
     631
     632if (!function_exists('wcmamtx_render_yith_wishlist_count_bubble_html')) {
     633
     634    function wcmamtx_render_yith_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    466635
    467636        $empty_goahead = 'yes';
    468637
     638        $get_count = wcmamtx_get_total_yith_wishlist_count();
     639
    469640        if ($hide_empty == "yes") {
    470             $get_count = wcmamtx_get_total_orderid_count();
     641           
    471642
    472643            if ($get_count == 0) {
     
    478649        }
    479650
     651       
     652
    480653        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    481654            ?>
    482             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?>">
    483                 <?php echo wcmamtx_get_total_orderid_count(); ?>
     655            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist yith_wishlist <?php if ($get_count == 0) { echo 'empty'; } ?>">
     656                <?php echo wcmamtx_get_total_yith_wishlist_count(); ?>
    484657
    485658            </span>
     
    492665}
    493666
    494 
    495 /**
    496  * Get account li html.
    497  *
    498  * @since 1.0.0
    499  * @param string $endpoint Endpoint.
    500  * @return string
    501  */
    502 
    503 if (!function_exists('wcmamtx_render_download_count_bubble_html')) {
    504 
    505     function wcmamtx_render_download_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     667if (!function_exists('wcmamtx_get_total_yith_wishlist_count')) {
     668
     669    function wcmamtx_get_total_yith_wishlist_count() {
     670
     671        $user_id = get_current_user_id();
     672
     673        if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
     674
     675            $wishlist_count = YITH_WCWL_Wishlists()->count_items_in_wishlist( $user_id );
     676           
     677
     678            return $wishlist_count;
     679        }
     680
     681       
     682       
     683    }
     684
     685}
     686
     687
     688if (!function_exists('wcmamtx_render_woodmart_wishlist_count_bubble_html')) {
     689
     690    function wcmamtx_render_woodmart_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    506691
    507692        $empty_goahead = 'yes';
    508693
     694        $get_count = wcmamtx_get_total_woodmart_wishlist_count();
     695
    509696        if ($hide_empty == "yes") {
    510             $get_count = wcmamtx_get_total_downloads_count();
     697           
    511698
    512699            if ($get_count == 0) {
     
    518705        }
    519706
    520         if (($count_bubble == "yes") && ($empty_goahead == 'yes')) {
     707        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    521708            ?>
    522             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?>">
    523                 <?php echo wcmamtx_get_total_downloads_count(); ?>
     709            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist woodmart_wishlist <?php if ($get_count == 0) { echo 'empty'; } ?>">
     710                <?php echo wcmamtx_get_total_woodmart_wishlist_count(); ?>
    524711
    525712            </span>
     
    532719}
    533720
    534 
    535 
    536 
    537 
    538 if (!function_exists('wcmamtx_render_yith_wishlist_count_bubble_html')) {
    539 
    540     function wcmamtx_render_yith_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     721if (!function_exists('wcmamtx_get_total_woodmart_wishlist_count')) {
     722
     723    function wcmamtx_get_total_woodmart_wishlist_count() {
     724
     725        $user_id = get_current_user_id();
     726
     727
     728        $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
     729
     730        $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
     731
     732        $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
     733
     734        if (($woodmart_wishlist_on == "yes") && function_exists('woodmart_get_wishlist_count')) {
     735           
     736
     737            $wishlist_count = woodmart_get_wishlist_count();
     738
     739            return $wishlist_count;
     740        }
     741
     742       
     743       
     744    }
     745
     746}
     747
     748if (!function_exists('wcmamtx_render_wpc_wishlist_count_bubble_html')) {
     749
     750    function wcmamtx_render_wpc_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    541751
    542752        $empty_goahead = 'yes';
    543753
     754        $get_count = wcmamtx_get_total_wpc_wishlist_count();
     755
    544756        if ($hide_empty == "yes") {
    545             $get_count = wcmamtx_get_total_yith_wishlist_count();
     757           
    546758
    547759            if ($get_count == 0) {
     
    555767        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    556768            ?>
    557             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist">
    558                 <?php echo wcmamtx_get_total_yith_wishlist_count(); ?>
     769            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist wpc_wishlist <?php if ($get_count == 0) { echo 'empty'; } ?>">
     770                <?php echo wcmamtx_get_total_wpc_wishlist_count(); ?>
    559771
    560772            </span>
     
    567779}
    568780
    569 if (!function_exists('wcmamtx_get_total_yith_wishlist_count')) {
    570 
    571     function wcmamtx_get_total_yith_wishlist_count() {
     781if (!function_exists('wcmamtx_get_total_wpc_wishlist_count')) {
     782
     783    function wcmamtx_get_total_wpc_wishlist_count() {
    572784
    573785        $user_id = get_current_user_id();
    574786
    575         if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
    576 
    577             $wishlist_count = YITH_WCWL()->count_products( $user_id );
    578 
    579             return $wishlist_count;
     787       
     788        $wishlist_count = 0;
     789
     790        if ( class_exists( 'WPCleverWoosw' ) ) {
     791       
     792          $wishlist_count = esc_html( WPCleverWoosw::get_count() );
     793       
    580794        }
    581795
     796
     797        return $wishlist_count;
     798       
     799
    582800       
    583801       
     
    585803
    586804}
    587 
    588 
    589 if (!function_exists('wcmamtx_render_woodmart_wishlist_count_bubble_html')) {
    590 
    591     function wcmamtx_render_woodmart_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    592 
    593         $empty_goahead = 'yes';
    594 
    595         if ($hide_empty == "yes") {
    596             $get_count = wcmamtx_get_total_woodmart_wishlist_count();
    597 
    598             if ($get_count == 0) {
    599                 $empty_goahead = 'no';
    600             } else {
    601                 $empty_goahead = 'yes';
    602             }
    603 
    604         }
    605 
    606         if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    607             ?>
    608             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist">
    609                 <?php echo wcmamtx_get_total_woodmart_wishlist_count(); ?>
    610 
    611             </span>
    612             <?php
    613         }
    614 
    615 
    616     }
    617 
    618 }
    619 
    620 if (!function_exists('wcmamtx_get_total_woodmart_wishlist_count')) {
    621 
    622     function wcmamtx_get_total_woodmart_wishlist_count() {
    623 
    624         $user_id = get_current_user_id();
    625 
    626 
    627         $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
    628 
    629         $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
    630 
    631         $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
    632 
    633         if (($woodmart_wishlist_on == "yes") && function_exists('woodmart_get_wishlist_count')) {
    634            
    635 
    636             $wishlist_count = woodmart_get_wishlist_count();
    637 
    638             return $wishlist_count;
    639         }
    640 
    641        
    642        
    643     }
    644 
    645 }
    646 
    647 if (!function_exists('wcmamtx_render_wpc_wishlist_count_bubble_html')) {
    648 
    649     function wcmamtx_render_wpc_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    650 
    651         $empty_goahead = 'yes';
    652 
    653         if ($hide_empty == "yes") {
    654             $get_count = wcmamtx_get_total_wpc_wishlist_count();
    655 
    656             if ($get_count == 0) {
    657                 $empty_goahead = 'no';
    658             } else {
    659                 $empty_goahead = 'yes';
    660             }
    661 
    662         }
    663 
    664         if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    665             ?>
    666             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist">
    667                 <?php echo wcmamtx_get_total_wpc_wishlist_count(); ?>
    668 
    669             </span>
    670             <?php
    671         }
    672 
    673 
    674     }
    675 
    676 }
    677 
    678 if (!function_exists('wcmamtx_get_total_wpc_wishlist_count')) {
    679 
    680     function wcmamtx_get_total_wpc_wishlist_count() {
    681 
    682         $user_id = get_current_user_id();
    683 
    684        
    685         $wishlist_count = 0;
    686 
    687         if ( class_exists( 'WPCleverWoosw' ) ) {
    688        
    689           $wishlist_count = esc_html( WPCleverWoosw::get_count() );
    690        
    691         }
    692 
    693 
    694         return $wishlist_count;
    695        
    696 
    697        
    698        
    699     }
    700 
    701 }
  • customize-my-account-for-woocommerce/tags/3.8.1/readme.txt

    r3465865 r3466081  
    77WC Requires at least: 4.0
    88Requires PHP: 5.2
    9 Stable tag: 3.8.0
     9Stable tag: 3.8.1
    1010Requires Plugins: woocommerce
    1111License: GPLv2 or later
  • customize-my-account-for-woocommerce/trunk/customize-my-account-for-woocommerce.php

    r3465865 r3466081  
    44    Plugin URI: https://sysbasics.com
    55    Description: Customize My account page. Add/Edit/Remove Endpoints.
    6     Version: 3.8.0
     6    Version: 3.8.1
    77    Author: SysBasics
    88    Author URI: https://sysbasics.com
  • customize-my-account-for-woocommerce/trunk/include/admin/wrap/endpoints-content.php

    r3464708 r3466081  
    145145
    146146</tr>
    147 <?php if (isset($third_party)) { ?>
    148     <tr>
    149         <td>
    150             <label class=" wcmamtx_accordion_label">
    151                 <?php echo esc_html__('Content Before','customize-my-account-for-woocommerce'); ?>
    152                 <?php echo $key; ?>   
    153                 <?php echo esc_html__('Content','customize-my-account-for-woocommerce'); ?>
    154             </label>
    155         </td>
    156         <td>
    157             <?php wcmamtx_show_disabled_toggle_image(); ?>
    158 
    159         </td>
    160     </tr>
    161     <tr>
    162         <td>
    163             <label class=" wcmamtx_accordion_label">
    164                 <?php echo esc_html__('Content After','customize-my-account-for-woocommerce'); ?>
    165                 <?php echo $key; ?>   
    166                 <?php echo esc_html__('Content','customize-my-account-for-woocommerce'); ?>
    167             </label>
    168         </td>
    169         <td>
    170             <?php wcmamtx_show_disabled_toggle_image(); ?>
    171 
    172         </td>
    173     </tr>
    174 <?php } ?>
    175 
    176 
    177 
    178 
    179 
    180147<tr>
    181148    <td>
  • customize-my-account-for-woocommerce/trunk/include/admin/wrap/subwrap/countof-settings.php

    r3465865 r3466081  
    7474                $hide_sidebar = isset($value['hide_sidebar']) && ($value['hide_sidebar'] == "01") ? "yes" : "no";
    7575               
     76            break;
     77
     78            case "wishlist":
     79                $wishlist_mode = "none";
     80
     81                $wishlist_mode = wcmamtx_detect_wishlist_mode();
     82
     83                echo $wishlist_mode;
     84
     85                if ($wishlist_mode == "none") {
     86                    $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     87                } else {
     88
     89                    if (is_array($value) ) {
     90
     91                        if (!isset($value['count_bubble'])) {
     92                            $value['count_bubble'] = "01";
     93                        } else {
     94                            $value['count_bubble'] = $value['count_bubble'];
     95                        }
     96
     97                    }
     98
     99                    $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     100
     101                }
     102
     103               
     104         
     105                $hide_empty = isset($value['hide_empty']) && ($value['hide_empty'] == "01") ? "yes" : "no";
     106
     107                $section_style = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "display:block;" : "display:none;";
     108
     109
     110
     111                $count_of = isset($value['count_of']) ? $value['count_of'] : $wishlist_mode;
     112
     113
     114               
     115
     116
     117                $section_style_cpt = isset($count_of) && ($count_of == "cpt_count") ? "display:block;" : "display:none;";
     118
     119                $section_style_usermeta = isset($count_of) && ($count_of == "usermeta_count") ? "display:block;" : "display:none;";
     120
     121
     122                $hide_sidebar = isset($value['hide_sidebar']) && ($value['hide_sidebar'] == "01") ? "yes" : "no";
     123
     124
    76125            break;
    77126
  • customize-my-account-for-woocommerce/trunk/include/wcmamtx_countof_functions.php

    r3465865 r3466081  
    1111
    1212        $count_of = 'none';
     13
     14
    1315
    1416         switch($key) {
     
    3840            break;
    3941
     42             case "wishlist":
     43
     44               
     45
     46                $wishlist_mode = "none";
     47
     48                $wishlist_mode = wcmamtx_detect_wishlist_mode();
     49
     50
     51
     52                if ($wishlist_mode == "none") {
     53                    $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     54                } else {
     55
     56                    if (is_array($value) ) {
     57
     58                        if (!isset($value['count_bubble'])) {
     59                            $value['count_bubble'] = "01";
     60                        } else {
     61                            $value['count_bubble'] = $value['count_bubble'];
     62                        }
     63
     64                    }
     65
     66                    $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     67
     68                }
     69         
     70                $hide_empty = isset($value['hide_empty']) && ($value['hide_empty'] == "01") ? "yes" : "no";
     71
     72
     73                $count_of = isset($value['count_of']) ? $value['count_of'] : $wishlist_mode;
     74
     75
     76                wcmamtx_countof_conditional_switch($count_of,$value,$sidebar);
     77
     78               
     79
     80
     81            break;
     82
    4083            case "woo-wallet":
    4184                if (is_array($value) ) {
     
    115158                if (isset($count_of) && ($count_of != null)) {
    116159
    117                     if (($key != "orders") || ($key != "downloads")) {
    118 
    119 
    120 
    121                         switch($count_of) {
    122 
    123                             case "order_count":
    124                             wcmamtx_render_order_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    125                             break;
    126 
    127                             case "downloads_count":
    128                             wcmamtx_render_download_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    129                             break;
    130 
    131                             case "cpt_count":
    132                             wcmamtx_render_cpt_count_bubble_html($count_bubble,$hide_empty,$value,$sidebar);
    133                             break;
    134 
    135                             case "yith_wishlist":
    136                             if (function_exists('wcmamtx_render_yith_wishlist_count_bubble_html')) {
    137                                 if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
    138                                     wcmamtx_render_yith_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    139                                 }
    140                                
    141                             }
    142                             break;
    143 
    144                             case "wpc_wishlist":
    145 
    146                             if ( is_plugin_active( 'woo-smart-wishlist/wpc-smart-wishlist.php' ) || is_plugin_active( 'woo-smart-wishlist-premium/wpc-smart-wishlist.php' )) {
    147 
    148                                 if ( class_exists( 'WPCleverWoosw' ) ) {
    149                                     wcmamtx_render_wpc_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    150                                 }
    151                             }
    152                             break;
    153 
    154                            
    155                             case "woodmart_wishlist":
    156 
    157                             if ( is_plugin_active( 'woodmart-core/woodmart-core.php' ) && function_exists('woodmart_get_wishlist_count')) {
    158 
    159                                 $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
    160 
    161                                 $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
    162 
    163                                 $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
    164 
    165                                 if ($woodmart_wishlist_on == "yes") {
    166                                     wcmamtx_render_woodmart_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
    167                                 }
    168 
    169 
    170                             }
    171 
    172                             break;
    173                            
    174 
    175                             case "none":
    176                             break;
    177 
    178                         }
     160                    if (($key != "orders") || ($key != "downloads") || ($key != "wishlist")) {
     161
     162
     163                       wcmamtx_countof_conditional_switch($count_of,$value,$sidebar);
     164
    179165
    180166                    }
     
    191177    }
    192178
     179}
     180
     181
     182if (!function_exists('wcmamtx_countof_conditional_switch')) {
     183
     184    function wcmamtx_countof_conditional_switch($count_of,$value,$sidebar = null) {
     185
     186        $count_bubble = isset($value['count_bubble']) && ($value['count_bubble'] == "01") ? "yes" : "no";
     187
     188
     189        $hide_empty = isset($value['hide_empty']) && ($value['hide_empty'] == "01") ? "yes" : "no";
     190
     191
     192        switch($count_of) {
     193
     194            case "order_count":
     195            wcmamtx_render_order_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     196            break;
     197
     198            case "downloads_count":
     199            wcmamtx_render_download_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     200            break;
     201
     202            case "cpt_count":
     203            wcmamtx_render_cpt_count_bubble_html($count_bubble,$hide_empty,$value,$sidebar);
     204            break;
     205
     206            case "yith_wishlist":
     207
     208            if (function_exists('wcmamtx_render_yith_wishlist_count_bubble_html')) {
     209                if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
     210
     211                    wcmamtx_render_yith_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     212                }
     213
     214            }
     215            break;
     216
     217            case "wpc_wishlist":
     218
     219            if ( is_plugin_active( 'woo-smart-wishlist/wpc-smart-wishlist.php' ) || is_plugin_active( 'woo-smart-wishlist-premium/wpc-smart-wishlist.php' )) {
     220
     221                if ( class_exists( 'WPCleverWoosw' ) ) {
     222                    wcmamtx_render_wpc_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     223                }
     224            }
     225            break;
     226
     227
     228            case "woodmart_wishlist":
     229
     230            if ( is_plugin_active( 'woodmart-core/woodmart-core.php' ) && function_exists('woodmart_get_wishlist_count')) {
     231
     232                $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
     233
     234                $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
     235
     236                $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
     237
     238                if ($woodmart_wishlist_on == "yes") {
     239                    wcmamtx_render_woodmart_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar);
     240                }
     241
     242
     243            }
     244
     245            break;
     246
     247
     248            case "none":
     249            break;
     250
     251        }
     252
     253        do_action('wcmamtx_after_countof_wrapper');
     254    }
    193255}
    194256
     
    228290
    229291
     292if (!function_exists('wcmamtx_detect_wishlist_mode')) {
     293
     294    function wcmamtx_detect_wishlist_mode() {
     295
     296        $wishlist_mode = "none";
     297       
     298
     299        if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
     300            $wishlist_mode = "yith_wishlist";
     301
     302            return $wishlist_mode;
     303        }
     304
     305
     306        if ( is_plugin_active( 'woo-smart-wishlist/wpc-smart-wishlist.php' ) || is_plugin_active( 'woo-smart-wishlist-premium/wpc-smart-wishlist.php' )) {
     307            $wishlist_mode = "wpc_wishlist";
     308
     309            return $wishlist_mode;
     310        }
     311
     312        if ( is_plugin_active( 'woodmart-core/woodmart-core.php' ) && function_exists('woodmart_get_wishlist_count')) {
     313
     314            $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
     315
     316            $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
     317
     318            $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
     319
     320            if ($woodmart_wishlist_on == "yes") {
     321                $wishlist_mode = "woodmart_wishlist";
     322
     323                return $wishlist_mode;
     324            }
     325
     326
     327        }
     328
     329        return $wishlist_mode;
     330
     331       
     332    }
     333
     334}
     335
     336
    230337if (!function_exists('wcmamtx_get_total_wpswings_points_count')) {
    231338
     
    264371            }
    265372            return $wallet_balance;
     373
     374       
     375    }
     376
     377}
     378
     379
     380
     381
     382
     383
     384
     385
     386if (!function_exists('wcmamtx_get_user_post_type_count')) {
     387
     388    function wcmamtx_get_user_post_type_count($post_type,$status) {
     389
     390        $user_id = get_current_user_id();
     391        $args['author'] = $user_id;
     392        $args['post_type'] = $post_type;
     393        $args['post_status'] = $status;
     394        $ps = get_posts($args);
     395        return count($ps);
    266396
    267397       
     
    279409 */
    280410
    281 if (!function_exists('wcmamtx_get_total_downloads_count')) {
    282 
    283     function wcmamtx_get_total_downloads_count() {
     411if (!function_exists('wcmamtx_render_cpt_count_bubble_html')) {
     412
     413    function wcmamtx_render_cpt_count_bubble_html($count_bubble,$hide_empty,$value,$sidebar = null) {
    284414
    285415       
    286         // Check if a user is logged in and WooCommerce is active
    287         if ( ! is_user_logged_in() || ! function_exists( 'wc_get_customer_available_downloads' ) ) {
    288             return 0;
    289         }
    290 
    291         $current_user_id = get_current_user_id();
    292         $available_downloads = wc_get_customer_available_downloads( $current_user_id );
    293 
    294     // Return the total count of unique downloadable files available
    295         return count( $available_downloads );
    296 
    297     }
    298 
     416
     417
     418
     419        $custom_post_type = isset($value['count_post_type']) ? isset($value['count_post_type']) : "";
     420
     421        $cpt_status = isset($value['cpt_status']) ? isset($value['cpt_status']) : "publish";
     422
     423
     424
     425        $empty_goahead = 'yes';
     426
     427        $get_count = wcmamtx_get_user_post_type_count($custom_post_type,$cpt_status);
     428
     429        if ($hide_empty == "yes") {
     430
     431
     432            if ($get_count == 0) {
     433                $empty_goahead = 'no';
     434            } else {
     435                $empty_goahead = 'yes';
     436            }
     437
     438        }
     439
     440        if (($count_bubble == "yes") && ($custom_post_type != "") && ($empty_goahead == 'yes') && ($count_of == "post_type") && (is_numeric($get_count))) {
     441            ?>
     442            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> <?php if ($get_count == 0) { echo 'empty'; } ?>">         
     443                <?php echo wcmamtx_get_user_post_type_count($custom_post_type,$cpt_status); ?>
     444            </span>
     445            <?php
     446        }
     447
     448
     449    }
     450
     451}
     452
     453
     454
     455
     456
     457if (!function_exists('wcmamtx_render_wpswings_points_count_bubble_html')) {
     458
     459    function wcmamtx_render_wpswings_points_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     460
     461        $empty_goahead = 'yes';
     462
     463        $get_count = wcmamtx_get_total_wpswings_points_count();
     464
     465        if ($hide_empty == "yes") {
     466           
     467
     468            if ($get_count == 0) {
     469                $empty_goahead = 'no';
     470            } else {
     471                $empty_goahead = 'yes';
     472            }
     473
     474        }
     475
     476        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
     477            ?>
     478            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> <?php if ($get_count == 0) { echo 'empty'; } ?>">
     479                <?php echo wcmamtx_get_total_wpswings_points_count(); ?>
     480
     481            </span>
     482            <?php
     483        }
     484
     485
     486    }
    299487
    300488}
     
    308496 */
    309497
    310 if (!function_exists('wcmamtx_get_user_post_type_count')) {
    311 
    312     function wcmamtx_get_user_post_type_count($post_type,$status) {
    313 
    314         $user_id = get_current_user_id();
    315         $args['author'] = $user_id;
    316         $args['post_type'] = $post_type;
    317         $args['post_status'] = $status;
    318         $ps = get_posts($args);
    319         return count($ps);
    320 
    321        
    322     }
    323 
    324 }
    325 
    326 
    327 /**
    328  * Get account li html.
    329  *
    330  * @since 1.0.0
    331  * @param string $endpoint Endpoint.
    332  * @return string
    333  */
    334 
    335 if (!function_exists('wcmamtx_render_cpt_count_bubble_html')) {
    336 
    337     function wcmamtx_render_cpt_count_bubble_html($count_bubble,$hide_empty,$value,$sidebar = null) {
    338 
    339        
    340 
    341 
    342 
    343         $custom_post_type = isset($value['count_post_type']) ? isset($value['count_post_type']) : "";
    344 
    345         $cpt_status = isset($value['cpt_status']) ? isset($value['cpt_status']) : "publish";
    346 
    347 
     498if (!function_exists('wcmamtx_render_woo_wallet_count_bubble_html')) {
     499
     500    function wcmamtx_render_woo_wallet_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    348501
    349502        $empty_goahead = 'yes';
    350503
    351         $get_count = wcmamtx_get_user_post_type_count($custom_post_type,$cpt_status);
     504        $get_count = wcmamtx_get_total_woowallet_count();
    352505
    353506        if ($hide_empty == "yes") {
    354 
     507           
    355508
    356509            if ($get_count == 0) {
     
    362515        }
    363516
    364         if (($count_bubble == "yes") && ($custom_post_type != "") && ($empty_goahead == 'yes') && ($count_of == "post_type") && (is_numeric($get_count))) {
     517        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    365518            ?>
    366             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?>">         
    367                 <?php echo wcmamtx_get_user_post_type_count($custom_post_type,$cpt_status); ?>
     519            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> amount <?php if ($get_count == 0) { echo 'empty'; } ?>">
     520                <?php echo wc_price(wcmamtx_get_total_woowallet_count()); ?>
     521
    368522            </span>
    369523            <?php
     
    379533
    380534
    381 if (!function_exists('wcmamtx_render_wpswings_points_count_bubble_html')) {
    382 
    383     function wcmamtx_render_wpswings_points_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     535
     536
     537if (!function_exists('wcmamtx_render_order_count_bubble_html')) {
     538
     539    function wcmamtx_render_order_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    384540
    385541        $empty_goahead = 'yes';
    386542
     543        $get_count = wcmamtx_get_total_orderid_count();
     544
    387545        if ($hide_empty == "yes") {
    388             $get_count = wcmamtx_get_total_wpswings_points_count();
     546           
    389547
    390548            if ($get_count == 0) {
     
    398556        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    399557            ?>
    400             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?>">
    401                 <?php echo wcmamtx_get_total_wpswings_points_count(); ?>
     558            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> <?php if ($get_count == 0) { echo 'empty'; } ?>">
     559                <?php echo wcmamtx_get_total_orderid_count(); ?>
    402560
    403561            </span>
     
    410568}
    411569
    412 /**
    413  * Get account li html.
    414  *
    415  * @since 1.0.0
    416  * @param string $endpoint Endpoint.
    417  * @return string
    418  */
    419 
    420 if (!function_exists('wcmamtx_render_woo_wallet_count_bubble_html')) {
    421 
    422     function wcmamtx_render_woo_wallet_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     570
     571
     572
     573if (!function_exists('wcmamtx_render_download_count_bubble_html')) {
     574
     575    function wcmamtx_render_download_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    423576
    424577        $empty_goahead = 'yes';
    425578
     579        $get_count = wcmamtx_get_total_downloads_count();
     580
    426581        if ($hide_empty == "yes") {
    427             $get_count = wcmamtx_get_total_woowallet_count();
     582           
    428583
    429584            if ($get_count == 0) {
     
    435590        }
    436591
    437         if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
     592        if (($count_bubble == "yes") && ($empty_goahead == 'yes')) {
    438593            ?>
    439             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> amount">
    440                 <?php echo wc_price(wcmamtx_get_total_woowallet_count()); ?>
     594            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> <?php if ($get_count == 0) { echo 'empty'; } ?>">
     595                <?php echo wcmamtx_get_total_downloads_count(); ?>
    441596
    442597            </span>
     
    449604}
    450605
    451 
    452 
    453 
    454 
    455 /**
    456  * Get account li html.
    457  *
    458  * @since 1.0.0
    459  * @param string $endpoint Endpoint.
    460  * @return string
    461  */
    462 
    463 if (!function_exists('wcmamtx_render_order_count_bubble_html')) {
    464 
    465     function wcmamtx_render_order_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     606if (!function_exists('wcmamtx_get_total_downloads_count')) {
     607
     608    function wcmamtx_get_total_downloads_count() {
     609
     610       
     611        // Check if a user is logged in and WooCommerce is active
     612        if ( ! is_user_logged_in() || ! function_exists( 'wc_get_customer_available_downloads' ) ) {
     613            return 0;
     614        }
     615
     616        $current_user_id = get_current_user_id();
     617        $available_downloads = wc_get_customer_available_downloads( $current_user_id );
     618
     619    // Return the total count of unique downloadable files available
     620        return count( $available_downloads );
     621       
     622
     623    }
     624
     625
     626}
     627
     628
     629
     630
     631
     632if (!function_exists('wcmamtx_render_yith_wishlist_count_bubble_html')) {
     633
     634    function wcmamtx_render_yith_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    466635
    467636        $empty_goahead = 'yes';
    468637
     638        $get_count = wcmamtx_get_total_yith_wishlist_count();
     639
    469640        if ($hide_empty == "yes") {
    470             $get_count = wcmamtx_get_total_orderid_count();
     641           
    471642
    472643            if ($get_count == 0) {
     
    478649        }
    479650
     651       
     652
    480653        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    481654            ?>
    482             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?>">
    483                 <?php echo wcmamtx_get_total_orderid_count(); ?>
     655            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist yith_wishlist <?php if ($get_count == 0) { echo 'empty'; } ?>">
     656                <?php echo wcmamtx_get_total_yith_wishlist_count(); ?>
    484657
    485658            </span>
     
    492665}
    493666
    494 
    495 /**
    496  * Get account li html.
    497  *
    498  * @since 1.0.0
    499  * @param string $endpoint Endpoint.
    500  * @return string
    501  */
    502 
    503 if (!function_exists('wcmamtx_render_download_count_bubble_html')) {
    504 
    505     function wcmamtx_render_download_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     667if (!function_exists('wcmamtx_get_total_yith_wishlist_count')) {
     668
     669    function wcmamtx_get_total_yith_wishlist_count() {
     670
     671        $user_id = get_current_user_id();
     672
     673        if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
     674
     675            $wishlist_count = YITH_WCWL_Wishlists()->count_items_in_wishlist( $user_id );
     676           
     677
     678            return $wishlist_count;
     679        }
     680
     681       
     682       
     683    }
     684
     685}
     686
     687
     688if (!function_exists('wcmamtx_render_woodmart_wishlist_count_bubble_html')) {
     689
     690    function wcmamtx_render_woodmart_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    506691
    507692        $empty_goahead = 'yes';
    508693
     694        $get_count = wcmamtx_get_total_woodmart_wishlist_count();
     695
    509696        if ($hide_empty == "yes") {
    510             $get_count = wcmamtx_get_total_downloads_count();
     697           
    511698
    512699            if ($get_count == 0) {
     
    518705        }
    519706
    520         if (($count_bubble == "yes") && ($empty_goahead == 'yes')) {
     707        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    521708            ?>
    522             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?>">
    523                 <?php echo wcmamtx_get_total_downloads_count(); ?>
     709            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist woodmart_wishlist <?php if ($get_count == 0) { echo 'empty'; } ?>">
     710                <?php echo wcmamtx_get_total_woodmart_wishlist_count(); ?>
    524711
    525712            </span>
     
    532719}
    533720
    534 
    535 
    536 
    537 
    538 if (!function_exists('wcmamtx_render_yith_wishlist_count_bubble_html')) {
    539 
    540     function wcmamtx_render_yith_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
     721if (!function_exists('wcmamtx_get_total_woodmart_wishlist_count')) {
     722
     723    function wcmamtx_get_total_woodmart_wishlist_count() {
     724
     725        $user_id = get_current_user_id();
     726
     727
     728        $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
     729
     730        $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
     731
     732        $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
     733
     734        if (($woodmart_wishlist_on == "yes") && function_exists('woodmart_get_wishlist_count')) {
     735           
     736
     737            $wishlist_count = woodmart_get_wishlist_count();
     738
     739            return $wishlist_count;
     740        }
     741
     742       
     743       
     744    }
     745
     746}
     747
     748if (!function_exists('wcmamtx_render_wpc_wishlist_count_bubble_html')) {
     749
     750    function wcmamtx_render_wpc_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    541751
    542752        $empty_goahead = 'yes';
    543753
     754        $get_count = wcmamtx_get_total_wpc_wishlist_count();
     755
    544756        if ($hide_empty == "yes") {
    545             $get_count = wcmamtx_get_total_yith_wishlist_count();
     757           
    546758
    547759            if ($get_count == 0) {
     
    555767        if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    556768            ?>
    557             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist">
    558                 <?php echo wcmamtx_get_total_yith_wishlist_count(); ?>
     769            <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist wpc_wishlist <?php if ($get_count == 0) { echo 'empty'; } ?>">
     770                <?php echo wcmamtx_get_total_wpc_wishlist_count(); ?>
    559771
    560772            </span>
     
    567779}
    568780
    569 if (!function_exists('wcmamtx_get_total_yith_wishlist_count')) {
    570 
    571     function wcmamtx_get_total_yith_wishlist_count() {
     781if (!function_exists('wcmamtx_get_total_wpc_wishlist_count')) {
     782
     783    function wcmamtx_get_total_wpc_wishlist_count() {
    572784
    573785        $user_id = get_current_user_id();
    574786
    575         if ( is_plugin_active( 'yith-woocommerce-wishlist/init.php' ) || is_plugin_active( 'yith-woocommerce-wishlist-premium/init.php' )) {
    576 
    577             $wishlist_count = YITH_WCWL()->count_products( $user_id );
    578 
    579             return $wishlist_count;
     787       
     788        $wishlist_count = 0;
     789
     790        if ( class_exists( 'WPCleverWoosw' ) ) {
     791       
     792          $wishlist_count = esc_html( WPCleverWoosw::get_count() );
     793       
    580794        }
    581795
     796
     797        return $wishlist_count;
     798       
     799
    582800       
    583801       
     
    585803
    586804}
    587 
    588 
    589 if (!function_exists('wcmamtx_render_woodmart_wishlist_count_bubble_html')) {
    590 
    591     function wcmamtx_render_woodmart_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    592 
    593         $empty_goahead = 'yes';
    594 
    595         if ($hide_empty == "yes") {
    596             $get_count = wcmamtx_get_total_woodmart_wishlist_count();
    597 
    598             if ($get_count == 0) {
    599                 $empty_goahead = 'no';
    600             } else {
    601                 $empty_goahead = 'yes';
    602             }
    603 
    604         }
    605 
    606         if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    607             ?>
    608             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist">
    609                 <?php echo wcmamtx_get_total_woodmart_wishlist_count(); ?>
    610 
    611             </span>
    612             <?php
    613         }
    614 
    615 
    616     }
    617 
    618 }
    619 
    620 if (!function_exists('wcmamtx_get_total_woodmart_wishlist_count')) {
    621 
    622     function wcmamtx_get_total_woodmart_wishlist_count() {
    623 
    624         $user_id = get_current_user_id();
    625 
    626 
    627         $woodmart_wishlist_on = (array) get_option("xts-woodmart-options");
    628 
    629         $woodmart_wishlist_on = $woodmart_wishlist_on['wishlist'];
    630 
    631         $woodmart_wishlist_on = isset($woodmart_wishlist_on) && ($woodmart_wishlist_on == 1) ? "yes" : "no";
    632 
    633         if (($woodmart_wishlist_on == "yes") && function_exists('woodmart_get_wishlist_count')) {
    634            
    635 
    636             $wishlist_count = woodmart_get_wishlist_count();
    637 
    638             return $wishlist_count;
    639         }
    640 
    641        
    642        
    643     }
    644 
    645 }
    646 
    647 if (!function_exists('wcmamtx_render_wpc_wishlist_count_bubble_html')) {
    648 
    649     function wcmamtx_render_wpc_wishlist_count_bubble_html($count_bubble,$hide_empty,$sidebar = null) {
    650 
    651         $empty_goahead = 'yes';
    652 
    653         if ($hide_empty == "yes") {
    654             $get_count = wcmamtx_get_total_wpc_wishlist_count();
    655 
    656             if ($get_count == 0) {
    657                 $empty_goahead = 'no';
    658             } else {
    659                 $empty_goahead = 'yes';
    660             }
    661 
    662         }
    663 
    664         if (($count_bubble == "yes") &&  ($empty_goahead == 'yes')) {
    665             ?>
    666             <span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?> wcmamtx_wishlist">
    667                 <?php echo wcmamtx_get_total_wpc_wishlist_count(); ?>
    668 
    669             </span>
    670             <?php
    671         }
    672 
    673 
    674     }
    675 
    676 }
    677 
    678 if (!function_exists('wcmamtx_get_total_wpc_wishlist_count')) {
    679 
    680     function wcmamtx_get_total_wpc_wishlist_count() {
    681 
    682         $user_id = get_current_user_id();
    683 
    684        
    685         $wishlist_count = 0;
    686 
    687         if ( class_exists( 'WPCleverWoosw' ) ) {
    688        
    689           $wishlist_count = esc_html( WPCleverWoosw::get_count() );
    690        
    691         }
    692 
    693 
    694         return $wishlist_count;
    695        
    696 
    697        
    698        
    699     }
    700 
    701 }
  • customize-my-account-for-woocommerce/trunk/readme.txt

    r3465865 r3466081  
    77WC Requires at least: 4.0
    88Requires PHP: 5.2
    9 Stable tag: 3.8.0
     9Stable tag: 3.8.1
    1010Requires Plugins: woocommerce
    1111License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.