├── tests
├── _data
│ └── .gitkeep
├── _support
│ ├── .gitkeep
│ ├── _generated
│ │ └── .gitignore
│ ├── Helper
│ │ ├── Unit.php
│ │ ├── Acceptance.php
│ │ └── Functional.php
│ ├── Page
│ │ ├── AdminPageTabProfiledSync.php
│ │ └── AdminPage.php
│ ├── UnitTester.php
│ ├── FunctionalTester.php
│ └── AcceptanceTester.php
├── _output
│ └── .gitignore
├── unit.suite.yml
├── acceptance
│ ├── checkProfessionalCest.php
│ ├── checkStoreStatusCest.php
│ └── checkStoreUrlCest.php
├── functional.suite.yml
└── acceptance.suite.yml
├── .semver
├── class
├── includes
│ └── freemius
│ │ ├── templates
│ │ ├── partials
│ │ │ └── index.php
│ │ ├── index.php
│ │ ├── js
│ │ │ ├── index.php
│ │ │ ├── open-license-activation.php
│ │ │ ├── jquery.content-change.php
│ │ │ └── style-premium-theme.php
│ │ ├── account
│ │ │ ├── index.php
│ │ │ ├── partials
│ │ │ │ ├── index.php
│ │ │ │ ├── deactivate-license-button.php
│ │ │ │ └── activate-license-button.php
│ │ │ └── payments.php
│ │ ├── connect
│ │ │ ├── index.php
│ │ │ ├── permission.php
│ │ │ └── permissions-group.php
│ │ ├── debug
│ │ │ ├── index.php
│ │ │ ├── logger.php
│ │ │ └── plugins-themes-sync.php
│ │ ├── forms
│ │ │ ├── index.php
│ │ │ ├── deactivation
│ │ │ │ ├── index.php
│ │ │ │ ├── contact.php
│ │ │ │ └── retry-skip.php
│ │ │ └── premium-versions-upgrade-metadata.php
│ │ ├── plugin-info
│ │ │ ├── index.php
│ │ │ ├── screenshots.php
│ │ │ └── description.php
│ │ ├── ajax-loader.php
│ │ ├── plugin-icon.php
│ │ ├── add-trial-to-pricing.php
│ │ ├── secure-https-header.php
│ │ ├── email.php
│ │ ├── sticky-admin-notice-js.php
│ │ ├── tabs-capture-js.php
│ │ ├── powered-by.php
│ │ ├── firewall-issues-js.php
│ │ ├── gdpr-optin-js.php
│ │ └── admin-notice.php
│ │ ├── index.php
│ │ ├── assets
│ │ ├── index.php
│ │ ├── js
│ │ │ ├── index.php
│ │ │ └── nojquery.ba-postmessage.min.js
│ │ ├── css
│ │ │ ├── admin
│ │ │ │ ├── checkout.css
│ │ │ │ ├── index.php
│ │ │ │ ├── gdpr-optin-notice.css
│ │ │ │ ├── plugins.css
│ │ │ │ ├── debug.css
│ │ │ │ ├── clone-resolution.css
│ │ │ │ └── affiliation.css
│ │ │ ├── index.php
│ │ │ └── customizer.css
│ │ └── img
│ │ │ ├── index.php
│ │ │ ├── plugin-icon.png
│ │ │ └── theme-icon.png
│ │ ├── includes
│ │ ├── index.php
│ │ ├── debug
│ │ │ ├── index.php
│ │ │ ├── debug-bar-start.php
│ │ │ └── class-fs-debug-bar-panel.php
│ │ ├── sdk
│ │ │ ├── index.php
│ │ │ └── Exceptions
│ │ │ │ ├── index.php
│ │ │ │ ├── InvalidArgumentException.php
│ │ │ │ ├── EmptyArgumentException.php
│ │ │ │ ├── ArgumentNotExistException.php
│ │ │ │ ├── OAuthException.php
│ │ │ │ └── Exception.php
│ │ ├── customizer
│ │ │ ├── index.php
│ │ │ └── class-fs-customizer-support-section.php
│ │ ├── entities
│ │ │ ├── index.php
│ │ │ ├── class-fs-scope-entity.php
│ │ │ ├── class-fs-plugin-info.php
│ │ │ ├── class-fs-plugin-tag.php
│ │ │ ├── class-fs-user.php
│ │ │ ├── class-fs-billing.php
│ │ │ └── class-fs-affiliate.php
│ │ ├── managers
│ │ │ ├── index.php
│ │ │ └── class-fs-license-manager.php
│ │ ├── supplements
│ │ │ ├── index.php
│ │ │ ├── fs-migration-2.5.1.php
│ │ │ ├── fs-essential-functions-1.1.7.1.php
│ │ │ └── fs-essential-functions-2.2.1.php
│ │ ├── l10n.php
│ │ ├── class-fs-security.php
│ │ ├── class-fs-user-lock.php
│ │ └── class-fs-lock.php
│ │ ├── languages
│ │ ├── index.php
│ │ ├── freemius-en.mo
│ │ ├── freemius-ja.mo
│ │ ├── freemius-ta.mo
│ │ ├── freemius-cs_CZ.mo
│ │ ├── freemius-da_DK.mo
│ │ ├── freemius-de_DE.mo
│ │ ├── freemius-es_ES.mo
│ │ ├── freemius-fr_FR.mo
│ │ ├── freemius-he_IL.mo
│ │ ├── freemius-hu_HU.mo
│ │ ├── freemius-it_IT.mo
│ │ ├── freemius-nl_NL.mo
│ │ ├── freemius-ru_RU.mo
│ │ └── freemius-zh_CN.mo
│ │ └── require.php
├── core
│ ├── wc4bp-deprecated.php
│ └── wc4bp-conditionals.php
├── wc4bp-required-php.php
├── wc4bp-myaccount-private.php
├── wc4bp-exception-handler.php
└── wc4bp-upgrade.php
├── admin
├── images
│ └── giphy.gif
├── css
│ ├── loading-spiner.min.css
│ ├── loading-spiner.css
│ ├── admin.min.css
│ └── admin.css
├── views
│ ├── html_admin_screen.php
│ ├── delete
│ │ └── html_admin_delete_all_settings.php
│ ├── html_admin_delete_screen.php
│ ├── html_admin_pages_screen_pages.php
│ ├── html_admin_notifications_screen.php
│ ├── notifications
│ │ ├── html_admin_notifications_settings.php
│ │ └── html_admin_notifications_select_order.php
│ ├── main
│ │ ├── html_admin_profile_sync.php
│ │ ├── html_thank_you_page.php
│ │ ├── html_admin_shop_home.php
│ │ ├── html_admin_my_account_tabs.php
│ │ └── html_admin_shop_disable.php
│ ├── sync
│ │ ├── html_admin_sync_change_xprofile.php
│ │ ├── html_admin_sync_change_xprofile_visibility.php
│ │ ├── html_admin_sync_change_xprofile_allow_custom.php
│ │ ├── html_admin_sync_shop_profile_sync_ajax.php
│ │ └── html_admin_sync_shop_profile.php
│ ├── pages
│ │ ├── html_admin_pages_shop_pages_rename.php
│ │ ├── html_admin_pages_thickbox.php
│ │ └── html_admin_pages_edit_entry.php
│ ├── html_admin_screen_sync.php
│ ├── html_admin_revision.php
│ └── html_admin_header.php
├── js
│ ├── wc4bp-revision.min.js
│ ├── wc4bp-xprofield.min.js
│ ├── wc4bp-cart-page-reload.js
│ ├── wc4bp-xprofield.js
│ └── wc4bp-revision.js
├── admin-delete.php
├── admin-notifications.php
└── wc4bp-revision.php
├── languages
├── wc4bp-en.mo
├── wc4bp-en_US.mo
├── wc4bp-es_ES.mo
├── wc4bp-fa_IR.mo
├── wc4bp-fr_FR.mo
├── wc4bp-nb_NO.mo
└── wc4bp-pt_BR.mo
├── .gitmodules
├── .eslintrc.json
├── tk.sh
├── phpcs.ruleset.xml
├── phpunit.xml.dist
├── templates
└── shop
│ └── member
│ ├── orders.php
│ ├── downloads.php
│ ├── edit-account.php
│ ├── edit-address.php
│ ├── payment-methods.php
│ ├── checkout.php
│ ├── extra-content.php
│ ├── track.php
│ ├── cart.php
│ ├── view-order.php
│ ├── my-account.php
│ ├── bb
│ ├── my-account.php
│ └── dashboard.php
│ ├── home.php
│ └── dashboard.php
├── codeception.yml
├── .env.example
├── composer.json
├── RoboFile.php
├── package.json
├── php-git-hooks.yml
├── readme.md
└── patch
└── 3.0.14.php
/tests/_data/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/_support/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/_output/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/tests/_support/_generated/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/.semver:
--------------------------------------------------------------------------------
1 | ---
2 | :major: 3
3 | :minor: 4
4 | :patch: 12
5 | :special: ''
6 | :metadata: ''
--------------------------------------------------------------------------------
/class/includes/freemius/templates/partials/index.php:
--------------------------------------------------------------------------------
1 |
6 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/templates/shop/member/checkout.php:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/entities/class-fs-scope-entity.php:
--------------------------------------------------------------------------------
1 | p");p.text()!==wc4bp_admin_xprofield.shipping_text_identification&&p.text()!==wc4bp_admin_xprofield.billing_text_identification||(jQuery("a[href='users.php?page=bp-profile-setup&group_id="+i+"&mode=add_field']").attr("href","admin.php?page=wc4bp-options-page&tab=generic").text("WC4BP Settings"),jQuery("a[href='users.php?page=bp-profile-setup&mode=edit_group&group_id="+i+"']").remove(),p.text(t))})}});
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "themekraft/wc4bp",
3 | "description": "WooCommerce for BuddyPress - Shop solution for your BuddyPress community. Integrates a WooCommerce installation with a BuddyPress social network.",
4 | "keywords": [
5 | "buddypress",
6 | "social networking",
7 | "woocommerce",
8 | "e-commerce"
9 | ],
10 | "homepage": "http://www.themekraft.com",
11 | "type": "wordpress-plugin",
12 | "license": "GPL-2.0+",
13 | "authors": [
14 | {
15 | "name": "Sven Lehnert",
16 | "email": "svenl@themekraft.com"
17 | },
18 | {
19 | "name": "Guillermo Figueroa Mesa",
20 | "email": "gfirem@gmail.com"
21 | }
22 | ],
23 | "minimum-stability": "dev",
24 | "require-dev": {
25 | "consolidation/robo": "^1.0.0"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/admin/views/main/html_admin_profile_sync.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 | disable_class_tag( 'p' ) ); ?>>
10 | disable_input_tag( 'checkbox' ) ); ?> name='wc4bp_options[tab_sync_disabled]' type='checkbox' value='1' />
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/templates/shop/member/extra-content.php:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/templates/shop/member/track.php:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/templates/shop/member/cart.php:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/admin/views/sync/html_admin_sync_change_xprofile.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | select_visibility_levels( 'field_visibility_options' ); ?>
16 |
17 |
--------------------------------------------------------------------------------
/admin/views/pages/html_admin_pages_shop_pages_rename.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 | submit_button();
10 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/entities/class-fs-plugin-info.php:
--------------------------------------------------------------------------------
1 | get_slug();
18 |
19 | echo fs_text_inline( 'Sorry for the inconvenience and we are here to help if you give us a chance.', 'contact-support-before-deactivation', $slug )
20 | . sprintf(" %s ",
21 | $fs->contact_url( 'technical_support' ),
22 | fs_text_inline( 'Contact Support', 'contact-support', $slug )
23 | );
24 |
--------------------------------------------------------------------------------
/admin/views/html_admin_screen_sync.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/add-trial-to-pricing.php:
--------------------------------------------------------------------------------
1 |
21 |
--------------------------------------------------------------------------------
/admin/js/wc4bp-cart-page-reload.js:
--------------------------------------------------------------------------------
1 | jQuery( document ).ready(function() {
2 | jQuery(document.body).on('wc_cart_emptied', function() {
3 | window.location.reload();
4 | });
5 |
6 | var myAccountUrl = window.location.origin + '/my-account';
7 | jQuery('#wc4bp-hidden-content').load(myAccountUrl, function() {
8 | jQuery('#extra-content-tab').html(jQuery('#wc4bp-hidden-content .entry-content').html());
9 | jQuery("#extra-content-tab").on( "click", "a", function( event ) {
10 | event.preventDefault();
11 | var myAccountContentPage = jQuery(this).attr('href');
12 | jQuery('#extra-content-complement').load(myAccountContentPage, function() {
13 | jQuery('#extra-content-tab').html(jQuery('#extra-content-complement .entry-content').html());
14 | jQuery("#wc4bp-hidden-content, #extra-content-complement").empty();
15 | });
16 | return false;
17 | });
18 | });
19 | })
--------------------------------------------------------------------------------
/admin/views/pages/html_admin_pages_thickbox.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
disable_class_tag( 'p', wc4bp_base::$starter_plan_id ) ); ?> style="margin: 0 0 20px 0;">
6 | disable_input_tag( 'button', wc4bp_base::$starter_plan_id ) ); ?> alt="#TB_inline?height=300&width=400&inlineId=add_page" title="" class="button button-secondary cptfbp_thickbox cptfbp_thickbox_add " type="button" value=""/>
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/admin/js/wc4bp-xprofield.js:
--------------------------------------------------------------------------------
1 | jQuery(document).ready(function () {
2 | var groups = [];
3 | if (wc4bp_admin_xprofield && wc4bp_admin_xprofield.billing && wc4bp_admin_xprofield.shipping) {
4 | groups.push(wc4bp_admin_xprofield.billing);
5 | groups.push(wc4bp_admin_xprofield.shipping);
6 | var text = 'WC4BP auto-generated';
7 | if (wc4bp_admin_xprofield.autogenerated_text) {
8 | text = wc4bp_admin_xprofield.autogenerated_text;
9 | }
10 | jQuery.each(groups, function (index, value) {
11 | var tab = jQuery("#tabs-" + value + ">p");
12 | if (tab.text() === wc4bp_admin_xprofield.shipping_text_identification || tab.text() === wc4bp_admin_xprofield.billing_text_identification) {
13 | jQuery("a[href='users.php?page=bp-profile-setup&group_id=" + value + "&mode=add_field']")
14 | .attr('href', 'admin.php?page=wc4bp-options-page&tab=generic')
15 | .text('WC4BP Settings');
16 | jQuery("a[href='users.php?page=bp-profile-setup&mode=edit_group&group_id=" + value + "']").remove();
17 | tab.text(text);
18 | }
19 | });
20 | }
21 | });
22 |
--------------------------------------------------------------------------------
/class/includes/freemius/assets/css/admin/debug.css:
--------------------------------------------------------------------------------
1 | label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.fs-switch-label{font-size:20px;line-height:31px;margin:0 5px}#fs_log_book table{font-family:Consolas,Monaco,monospace;font-size:12px}#fs_log_book table th{color:#ccc}#fs_log_book table tr{background:#232525}#fs_log_book table tr.alternate{background:#2b2b2b}#fs_log_book table tr td.fs-col--logger{color:#5a7435}#fs_log_book table tr td.fs-col--type{color:#ffc861}#fs_log_book table tr td.fs-col--function{color:#a7b7b1;font-weight:bold}#fs_log_book table tr td.fs-col--message,#fs_log_book table tr td.fs-col--message a{color:#9a73ac !important}#fs_log_book table tr td.fs-col--file{color:#d07922}#fs_log_book table tr td.fs-col--timestamp{color:#6596be}
2 |
--------------------------------------------------------------------------------
/admin/views/main/html_thank_you_page.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | disable_class_tag( 'p', wc4bp_base::$professional_plan_id ) ); ?>>
8 | disable_input_tag( 'checkbox', wc4bp_base::$professional_plan_id ) ); ?> name='wc4bp_options[thank_you_page]'>
9 | 0 ) {
11 | foreach ( $wc4bp_pages_options['selected_pages'] as $key => $attached_page ) {
12 | echo '' . esc_html( $attached_page['tab_name'] ) . ' ';
13 | }
14 | }
15 | ?>
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/plugin-info/screenshots.php:
--------------------------------------------------------------------------------
1 |
22 |
23 | $url ) : ?>
25 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/templates/shop/member/view-order.php:
--------------------------------------------------------------------------------
1 | post_name = 'view-order';
13 | $post->post_title = __( 'Order Details', 'wc4bp' );
14 | $bp_action_variables = $bp->action_variables;
15 | if ( ! empty( $bp_action_variables ) ) {
16 | if ( isset( $bp_action_variables[0] ) && ! empty( $bp_action_variables[1] ) && 'view-order' === $bp_action_variables[0] && is_numeric( $bp_action_variables[1] ) ) {
17 | $order_id = absint( $bp_action_variables[1] );
18 | echo '';
19 | woocommerce_account_view_order( $order_id );
20 | echo '
';
21 | }
22 | } else {
23 | echo esc_attr( sprintf( '%s
', __( 'Please enter a valid order ID', 'wc4bp' ) ) );
24 | }
25 |
--------------------------------------------------------------------------------
/templates/shop/member/my-account.php:
--------------------------------------------------------------------------------
1 |
26 |
27 |
28 |
36 |
37 |
--------------------------------------------------------------------------------
/class/wc4bp-required-php.php:
--------------------------------------------------------------------------------
1 | minimumVersion = '5.3.0';
27 | array_push( $requirements, $requirement );
28 | $requirement = new WP_WordPress_Requirement();
29 | $requirement->minimumVersion = '4.6.2';
30 | array_push( $requirements, $requirement );
31 |
32 | return $requirements;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/supplements/fs-migration-2.5.1.php:
--------------------------------------------------------------------------------
1 | $install ) {
21 | if ( true === $install->is_disconnected ) {
22 | $permission_manager->update_site_tracking(
23 | false,
24 | ( 0 == $blog_id ) ? null : $blog_id,
25 | // Update only if permissions are not yet set.
26 | true
27 | );
28 | }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/class/includes/freemius/templates/secure-https-header.php:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
get_text_inline( 'Secure HTTPS %s page, running from an external domain', 'secure-x-page-header' ),
29 | $VARS['page']
30 | ) ) .
31 | ' - ' .
32 | sprintf(
33 | '%s ',
34 | 'https://www.mcafeesecure.com/verify?host=' . WP_FS__ROOT_DOMAIN_PRODUCTION,
35 | 'Freemius Inc. [US]'
36 | );
37 | }
38 | ?>
39 |
--------------------------------------------------------------------------------
/admin/views/main/html_admin_shop_home.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | disable_class_tag( 'p', wc4bp_base::$starter_plan_id ) ); ?>>
8 | disable_input_tag( 'checkbox', wc4bp_base::$starter_plan_id ) ); ?> name='wc4bp_options[tab_shop_default]'>
9 | 0 ) {
11 | foreach ( $wc4bp_pages_options['selected_pages'] as $key => $attached_page ) {
12 | echo '' . esc_html( $attached_page['tab_name'] ) . ' ';
13 | }
14 | } else {
15 | $wc4bp_options['tab_activity_disabled'] = 1;
16 | echo '' . esc_html__( 'You need at least one Page added to Member Profiles!', 'wc4bp' ) . ' ';
17 | }
18 | ?>
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/email.php:
--------------------------------------------------------------------------------
1 |
18 |
19 | $section ) {
21 | ?>
22 |
23 |
24 |
25 |
26 | $row ) {
28 | $col_count = count( $row );
29 | ?>
30 |
31 |
33 |
34 |
36 | :
37 |
38 |
41 |
42 |
45 |
46 |
49 |
--------------------------------------------------------------------------------
/RoboFile.php:
--------------------------------------------------------------------------------
1 | 'assets/css' ) );
43 | }
44 |
45 | /**
46 | * @return string Relative paths from the root folder of the plugin
47 | */
48 | public function sassLibraryDirectory() {
49 | return 'scss/library';
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/forms/deactivation/retry-skip.php:
--------------------------------------------------------------------------------
1 | get_slug();
18 |
19 | $skip_url = fs_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $fs->get_unique_affix() . '_skip_activation' ) ), $fs->get_unique_affix() . '_skip_activation' );
20 | $skip_text = strtolower( fs_text_x_inline( 'Skip', 'verb', 'skip', $slug ) );
21 | $use_plugin_anonymously_text = fs_text_inline( 'Click here to use the plugin anonymously', 'click-here-to-use-plugin-anonymously', $slug );
22 |
23 | echo sprintf( fs_text_inline( "You might have missed it, but you don't have to share any data and can just %s the opt-in.", 'dont-have-to-share-any-data', $slug ), "{$skip_text} " )
24 | . " {$use_plugin_anonymously_text} ";
--------------------------------------------------------------------------------
/class/includes/freemius/templates/js/open-license-activation.php:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/l10n.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/class/includes/freemius/assets/js/nojquery.ba-postmessage.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | * nojquery-postmessage by Jeff Lee
3 | * a non-jQuery fork of:
4 | *
5 | * jQuery postMessage - v0.5 - 9/11/2009
6 | * http://benalman.com/projects/jquery-postmessage-plugin/
7 | *
8 | * Copyright (c) 2009 "Cowboy" Ben Alman
9 | * Dual licensed under the MIT and GPL licenses.
10 | * http://benalman.com/about/license/
11 | */
12 | function NoJQueryPostMessageMixin(g,a){var b,h,e,d,f,c=1;if(window.postMessage){if(window.addEventListener){b=function(i){window.addEventListener("message",i,false)};h=function(i){window.removeEventListener("message",i,false)}}else{b=function(i){window.attachEvent("onmessage",i)};h=function(i){window.detachEvent("onmessage",i)}}this[g]=function(i,k,j){if(!k){return}j.postMessage(i,k.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))};this[a]=function(k,j,i){if(e){h(e);e=null}if(!k){return false}e=b(function(l){switch(Object.prototype.toString.call(j)){case"[object String]":if(j!==l.origin){return false}break;case"[object Function]":if(j(l.origin)){return false}break}k(l)})}}else{this[g]=function(i,k,j){if(!k){return}j.location=k.replace(/#.*$/,"")+"#"+(+new Date)+(c++)+"&"+i};this[a]=function(k,j,i){if(d){clearInterval(d);d=null}if(k){i=typeof j==="number"?j:typeof i==="number"?i:100;d=setInterval(function(){var m=document.location.hash,l=/^#?\d+&/;if(m!==f&&l.test(m)){f=m;k({data:m.replace(l,"")})}},i)}}}return this};
--------------------------------------------------------------------------------
/admin/js/wc4bp-revision.js:
--------------------------------------------------------------------------------
1 | function wc4bp_revision() {
2 | function call_for_revision(action, container) {
3 | if (action === 'review') {
4 | window.open('https://wordpress.org/support/plugin/wc4bp/reviews/', '_blank');
5 | }
6 | container.hide();
7 | jQuery.ajax({
8 | type: 'POST', url: wc4bp_admin_revision_js.ajaxurl,
9 | data: {
10 | action: 'wc4bp_revision_' + action,
11 | nonce: wc4bp_admin_revision_js.nonce,
12 | trigger: action
13 | }
14 | });
15 | }
16 | return {
17 | init: function () {
18 | if (jQuery('#wc4bp-ask-revision').length > 0 && jQuery('button.review-notice-dismiss').length > 0) {
19 | this.attachEvents();
20 | }
21 | },
22 | attachEvents: function () {
23 | jQuery('button.review-notice-dismiss').each(function () {
24 | var button = jQuery(this);
25 | button.click(function () {
26 | var item = jQuery(this);
27 | call_for_revision(item.data('action'), jQuery('#wc4bp-ask-revision'));
28 | });
29 | });
30 | }
31 | }
32 | }
33 |
34 | var wc4bp_revision_action = wc4bp_revision();
35 | jQuery(document).ready(function () {
36 | wc4bp_revision_action.init();
37 | });
38 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "wc4bp",
3 | "description": "WooCommerce for BuddyPress - Shop solution for your BuddyPress community. Integrates a WooCommerce installation with a BuddyPress social network.",
4 | "author": "ThemeKraft Team.",
5 | "license": "GPL-2.0+",
6 | "homepage": "http://www.themekraft.com",
7 | "version": "3.1.5",
8 | "main": "gulpfile.js",
9 | "dependencies": {},
10 | "scripts": {
11 | "test": "echo \"Error: no test specified\" && exit 1",
12 | "prune": "rimraf .codeclimate.yml .git .github .gitignore .travis.yml gulpfile.js composer.json"
13 | },
14 | "repository": "Themekraft/wc4bp.git",
15 | "devDependencies": {
16 | "google-translate": "^2.2.0",
17 | "dotenv": "^6.2.0",
18 | "css-mqpacker": "^6.0.2",
19 | "cssnano": "^3.10.0",
20 | "eslint-config-loopback": "^10.0.0",
21 | "gulp": "^3.9.1",
22 | "gulp-clean": "^0.4.0",
23 | "gulp-concat": "^2.6.1",
24 | "gulp-deporder": "^1.1.0",
25 | "gulp-eslint": "^4.0.2",
26 | "gulp-gettext": "^0.3.0",
27 | "gulp-imagemin": "^4.1.0",
28 | "gulp-notify": "^3.2.0",
29 | "gulp-plumber": "^1.2.0",
30 | "gulp-pofill": "^1.0.0",
31 | "gulp-strip-debug": "^3.0.0",
32 | "gulp-uglify": "^3.0.0",
33 | "gulp-uglifycss": "^1.1.0",
34 | "gulp-util": "^3.0.8",
35 | "gulp-wp-pot": "^2.3.1",
36 | "install": "^0.12.0",
37 | "npm": "^6.1.0"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/class/wc4bp-myaccount-private.php:
--------------------------------------------------------------------------------
1 | $end_point_value ) {
20 | if ( is_page( $end_point_key ) && ! is_user_logged_in() ) {
21 | add_filter( 'the_content', array( $this, 'restrict_content' ), 999 );
22 | }
23 | }
24 | } catch ( Exception $exception ) {
25 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
26 | }
27 | }
28 |
29 | public function restrict_content() {
30 | /**
31 | * Restrict content String.
32 | *
33 | * String used to print if somebody with no permission try to access to one of the endpoint enable.
34 | *
35 | * @param string The localize message to show.
36 | */
37 | return apply_filters( 'wc4bp_restrict_message', __( 'Sorry this page is only for logging users!', 'wc4bp' ) );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/tests/functional.suite.yml:
--------------------------------------------------------------------------------
1 | # Codeception Test Suite Configuration
2 | #
3 | # Suite for functional tests
4 | # Emulate web requests and make WordPress process them
5 |
6 | actor: FunctionalTester
7 | modules:
8 | enabled:
9 | - WPDb
10 | - WPBrowser
11 | # - WPFilesystem
12 | - Asserts
13 | - \Helper\Functional
14 | config:
15 | WPDb:
16 | dsn: 'mysql:host=%TEST_SITE_DB_HOST%;dbname=%TEST_SITE_DB_NAME%'
17 | user: '%TEST_SITE_DB_USER%'
18 | password: '%TEST_SITE_DB_PASSWORD%'
19 | dump: 'tests/_data/dump.sql'
20 | populate: true
21 | cleanup: true
22 | waitlock: 10
23 | url: '%TEST_SITE_WP_URL%'
24 | urlReplacement: true
25 | tablePrefix: '%TEST_SITE_TABLE_PREFIX%'
26 | WPBrowser:
27 | url: '%TEST_SITE_WP_URL%'
28 | adminUsername: '%TEST_SITE_ADMIN_USERNAME%'
29 | adminPassword: '%TEST_SITE_ADMIN_PASSWORD%'
30 | adminPath: '%TEST_SITE_WP_ADMIN_PATH%'
31 | headers:
32 | X_TEST_REQUEST: 1
33 | X_WPBROWSER_REQUEST: 1
34 |
35 | WPFilesystem:
36 | wpRootFolder: '%WP_ROOT_FOLDER%'
37 | plugins: '/wp-content/plugins'
38 | mu-plugins: '/wp-content/mu-plugins'
39 | themes: '/wp-content/themes'
40 | uploads: '/wp-content/uploads'
--------------------------------------------------------------------------------
/class/includes/freemius/templates/sticky-admin-notice-js.php:
--------------------------------------------------------------------------------
1 |
16 |
41 |
--------------------------------------------------------------------------------
/class/core/wc4bp-conditionals.php:
--------------------------------------------------------------------------------
1 | $data ) {
35 | if ( 0 === strpos( $file_real_path, fs_normalize_path( dirname( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) ) . '/' ) ) ) {
36 | if ( '.' !== dirname( trailingslashit( $relative_path ) ) ) {
37 | return $relative_path;
38 | }
39 | }
40 | }
41 |
42 | return null;
43 | }
44 |
--------------------------------------------------------------------------------
/admin/views/main/html_admin_my_account_tabs.php:
--------------------------------------------------------------------------------
1 |
4 | By default all related WooCommerce Account Tabs are included into the BuddyPress member profiles. When you Turn off one of the next, the Tab(s) will disappear. Also is possible to change the order for the tabs.
' );
6 | /** @var wc4bp_admin $this */
7 | foreach ( $tabs_array as $end_point_key => $end_point_name ) {
8 | $tab_select = $end_point_name['enable'];
9 | $position = $end_point_name['position'];
10 | $user_label = ( isset( $end_point_name['user_label'] ) ) ? $end_point_name['user_label'] : $end_point_name['label'];
11 | $text = sprintf( __( 'Turn off %s tab.', 'wc4bp' ), $end_point_name['label'] );
12 | echo 'disable_class_tag( 'p' ) ) . '>' .
13 | ' ' .
14 | ' disable_input_tag( 'checkbox' ) ) . " name='" . esc_attr( $end_point_name['name'] ) . "' type='checkbox' value='1' " . checked( $tab_select, 1, false ) . ' />' .
15 | "" . esc_html( $text ) . ' ' .
16 | " Or set tab's name disable_input_tag( 'text' ) ) . " type='text' name='" . esc_attr( $end_point_name['name_label'] ) . "' value='" . esc_attr__( $user_label ) . "'>
";
17 | }
18 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/account/partials/deactivate-license-button.php:
--------------------------------------------------------------------------------
1 |
30 |
--------------------------------------------------------------------------------
/php-git-hooks.yml:
--------------------------------------------------------------------------------
1 | pre-commit:
2 | enabled: true
3 | execute:
4 | composer: false
5 | jsonlint: false
6 | phplint: false
7 | phpmd:
8 | enabled: false
9 | options: null
10 | phpcs:
11 | enabled: false
12 | standard: WordPress-VIP
13 | ignore: ''
14 | php-cs-fixer:
15 | enabled: false
16 | levels:
17 | psr0: true
18 | psr1: true
19 | psr2: true
20 | symfony: true
21 | options: null
22 | phpunit:
23 | enabled: false
24 | random-mode: false
25 | options: '--debug'
26 | strict-coverage:
27 | enabled: false
28 | minimum: null
29 | guard-coverage:
30 | enabled: false
31 | message: null
32 | message:
33 | right-message: 'HEY, GOOD JOB!!'
34 | error-message: 'FIX YOUR FUCKING CODE!!'
35 | commit-msg:
36 | enabled: false
37 | regular-expression: null
38 | pre-push:
39 | enabled: false
40 | execute:
41 | phpunit:
42 | enabled: false
43 | random-mode: false
44 | options: null
45 | strict-coverage:
46 | enabled: false
47 | minimum: null
48 | guard-coverage:
49 | enabled: false
50 | message: null
51 | message:
52 | right-message: ''
53 | error-message: ''
54 |
--------------------------------------------------------------------------------
/templates/shop/member/bb/my-account.php:
--------------------------------------------------------------------------------
1 | request );
31 |
32 | // If in My account dashboard page
33 | if ( ( end( $request ) == 'my-account' && is_account_page() ) ) {
34 | $dashBoardClass = 'bsMyAccount--dashboard';
35 | } else {
36 | $dashBoardClass = 'bsMyAccount--dashboard-inner';
37 | }
38 | ?>
39 |
40 |
41 |
44 |
45 |
46 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/debug/debug-bar-start.php:
--------------------------------------------------------------------------------
1 | release_mode );
63 | }
64 | }
--------------------------------------------------------------------------------
/admin/views/notifications/html_admin_notifications_select_order.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | disable_class_tag( 'p', wc4bp_base::$starter_plan_id ) ); ?>>
8 | disable_input_tag( 'select', wc4bp_base::$starter_plan_id ) ); ?> name='wc4bp_options_notifications[notifications_order_status]'>
9 |
14 | >Processing
15 |
20 | >Pending Payment
21 |
26 | >Completed
27 |
32 | >On Hold
33 |
34 |
35 |
36 |
37 |
4 |
5 |
6 |
7 |
8 | />
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | ';
27 | }
28 | ?>
29 | ;
30 | ;
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/class/includes/freemius/assets/css/admin/clone-resolution.css:
--------------------------------------------------------------------------------
1 | .fs-notice[data-id^=clone_resolution_options_notice]{padding:0;color:inherit !important}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-body{padding:0;margin-bottom:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-header{padding:5px 10px}.fs-notice[data-id^=clone_resolution_options_notice] ol{margin-top:0;margin-bottom:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{display:flex;flex-direction:row;padding:0 10px 10px}@media(max-width: 750px){.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{flex-direction:column}}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option{border:1px solid #ccc;padding:10px 10px 15px 10px;flex:auto;margin:5px}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:first-child{margin-left:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:last-child{margin-right:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option strong{font-size:1.2em;padding:2px;line-height:1.5em}.fs-notice[data-id^=clone_resolution_options_notice] a{text-decoration:none}.fs-notice[data-id^=clone_resolution_options_notice] .button{margin-right:10px}.rtl .fs-notice[data-id^=clone_resolution_options_notice] .button{margin-right:0;margin-left:10px}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-documentation-container{padding:0 10px 15px}.fs-notice[data-id=temporary_duplicate_notice] #fs_clone_resolution_error_message{border:1px solid #d3135a;background:#fee;color:#d3135a;padding:10px}.fs-notice[data-id=temporary_duplicate_notice] ol{margin-top:0}
2 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/entities/class-fs-user.php:
--------------------------------------------------------------------------------
1 | first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
53 | }
54 |
55 | function is_verified() {
56 | return ( isset( $this->is_verified ) && true === $this->is_verified );
57 | }
58 |
59 | /**
60 | * @author Leo Fajardo (@leorw)
61 | * @since 2.4.2
62 | *
63 | * @return bool
64 | */
65 | function is_beta() {
66 | // Return `false` since this is just for backward compatibility.
67 | return false;
68 | }
69 |
70 | static function get_type() {
71 | return 'user';
72 | }
73 | }
--------------------------------------------------------------------------------
/tests/_support/AcceptanceTester.php:
--------------------------------------------------------------------------------
1 | amOnPage( '/wp-login.php' );
29 | $I->fillField( '#user_login', 'admin' );
30 | $I->fillField( '#user_pass', 'admin' );
31 | $I->click( 'Log In' );
32 | $I->see( 'Dashboard' );
33 | }
34 |
35 | public function checkBuddyFormsIsActive() {
36 | $I = $this;
37 | $I->amGoingTo( 'Check if BuddyForms is enabled and have forms in the list' );
38 | $I->amOnPage( '/wp-admin/edit.php?post_type=buddyforms' );
39 | $I->see( 'BuddyForms' );
40 | $I->see( 'If you like BuddyForms please leave us' );
41 | }
42 |
43 | public function goToBuddyFormsPage( $page = 'forms' ) {
44 | $I = $this;
45 | $I->amGoingTo( 'go to a BuddyForms Page: ' . $page );
46 | switch ( $page ) {
47 | case 'forms':
48 | $I->amOnAdminPage( '/edit.php?post_type=buddyforms' );
49 | $I->see( 'BuddyForms' );
50 | $I->see( 'If you like BuddyForms please leave us' );
51 | break;
52 | case 'submissions':
53 |
54 | break;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/forms/premium-versions-upgrade-metadata.php:
--------------------------------------------------------------------------------
1 | _get_license();
19 |
20 | if ( ! is_object( $license ) ) {
21 | $purchase_url = $fs->pricing_url();
22 | } else {
23 | $subscription = $fs->_get_subscription( $license->id );
24 |
25 | $purchase_url = $fs->checkout_url(
26 | is_object( $subscription ) ?
27 | ( 1 == $subscription->billing_cycle ? WP_FS__PERIOD_MONTHLY : WP_FS__PERIOD_ANNUALLY ) :
28 | WP_FS__PERIOD_LIFETIME,
29 | false,
30 | array( 'licenses' => $license->quota )
31 | );
32 | }
33 |
34 | $plugin_data = $fs->get_plugin_data();
35 | ?>
36 |
--------------------------------------------------------------------------------
/admin/views/sync/html_admin_sync_change_xprofile_visibility.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | select_visibility_levels( 'default_visibility' ); ?>
8 |
9 | array(
14 | 'class' => array(),
15 | 'id' => array(),
16 | ),
17 | 'li' => array(
18 | 'class' => array(),
19 | 'id' => array(),
20 | ),
21 | );
22 | echo '';
23 | foreach ( $billing as $key => $field_id ) {
24 | bp_xprofile_update_field_meta( $field_id, 'default_visibility', $wc4bp_options_sync['default_visibility'] );
25 | echo wp_kses( sprintf( __( 'billing_%1$s default visibility changed to %2$s ', 'wc4bp' ), $key, $wc4bp_options_sync['default_visibility'] ), $allowed );
26 | }
27 | echo ' ';
28 | echo '';
29 | foreach ( $shipping as $key => $field_id ) {
30 | bp_xprofile_update_field_meta( $field_id, 'default_visibility', $wc4bp_options_sync['default_visibility'] );
31 | echo wp_kses( sprintf( __( 'shipping_%1$s default visibility changed to %2$s ', 'wc4bp' ), $key, $wc4bp_options_sync['default_visibility'] ), $allowed );
32 |
33 | }
34 | echo ' ';
35 | esc_html_e( 'All Done! ', 'wc4bp' );
36 | unset( $wc4bp_options_sync['change_xprofile_visibility_field_default'] );
37 | update_option( 'wc4bp_options_sync', $wc4bp_options_sync );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/templates/shop/member/home.php:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/debug/class-fs-debug-bar-panel.php:
--------------------------------------------------------------------------------
1 | title( 'Freemius' );
24 | }
25 |
26 | static function requests_count() {
27 | if ( class_exists( 'Freemius_Api_WordPress' ) ) {
28 | $logger = Freemius_Api_WordPress::GetLogger();
29 | } else {
30 | $logger = array();
31 | }
32 |
33 | return number_format( count( $logger ) );
34 | }
35 |
36 | static function total_time() {
37 | if ( class_exists( 'Freemius_Api_WordPress' ) ) {
38 | $logger = Freemius_Api_WordPress::GetLogger();
39 | } else {
40 | $logger = array();
41 | }
42 |
43 | $total_time = .0;
44 | foreach ( $logger as $l ) {
45 | $total_time += $l['total'];
46 | }
47 |
48 | return number_format( 100 * $total_time, 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' );
49 | }
50 |
51 | function render() {
52 | ?>
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
12 |
--------------------------------------------------------------------------------
/admin/views/html_admin_header.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | needs_upgrade() ) : ?>
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/js/style-premium-theme.php:
--------------------------------------------------------------------------------
1 | get_slug();
21 |
22 | ?>
23 |
--------------------------------------------------------------------------------
/admin/admin-delete.php:
--------------------------------------------------------------------------------
1 | wc4bp_register_admin_settings_delete();
25 | include_once WC4BP_ABSPATH_ADMIN_VIEWS_PATH . 'html_admin_delete_screen.php';
26 | } catch ( Exception $exception ) {
27 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
28 | }
29 | }
30 |
31 | /**
32 | * Register the admin settings
33 | *
34 | * @author Sven Lehnert
35 | * @package TK Loop Designer
36 | * @since 1.0
37 | */
38 |
39 | public function wc4bp_register_admin_settings_delete() {
40 | // Settings fields and sections
41 | add_settings_section( 'section_delete', __( 'Delete all Settings on Plugin Deactivation', 'wc4bp' ), '', 'wc4bp_options_delete' );
42 | add_settings_field( 'delete_all_settings', __( 'Delete all Settings ', 'wc4bp' ), array( $this, 'wc4bp_delete_all_settings' ), 'wc4bp_options_delete', 'section_delete' );
43 | }
44 |
45 | public function wc4bp_delete_all_settings() {
46 | try {
47 | $wc4bp_options_delete = get_option( 'wc4bp_options_delete' );
48 | include_once WC4BP_ABSPATH_ADMIN_VIEWS_PATH . 'delete/html_admin_delete_all_settings.php';
49 | } catch ( Exception $exception ) {
50 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/templates/shop/member/dashboard.php:
--------------------------------------------------------------------------------
1 |
25 |
26 |
27 |
28 | Woocommerce - Settings - Advanced and checking the configuration of the endpoitns', 'wc4bp' );
31 | echo esc_html( $dashboard_desc );
32 | ?>
33 |
34 |
35 | wantTo( 'check the Store when is enabled or disabled' );
7 |
8 | //Login as user1
9 | $I->seeUserInDatabase( array( 'user_login' => 'user1' ) );
10 | $user1 = $I->haveFriend( 'user1' );
11 | $user1->does( function ( AcceptanceTester $I ) {
12 | $I->wantTo( 'User1 check the buddypress his profile' );
13 | $I->loginAs( 'user1', 'user1' );
14 | $I->amOnPage( '/members/user1' );
15 | $I->see( 'user1' );
16 | $I->expect('User1 to see the Shop tab');
17 | $I->See( 'Shop' );
18 | } );
19 |
20 | //Login as admin
21 | $I->loginAs( 'admin', 'admin' );
22 | $I->amOnAdminPage( '/' );
23 | $I->see( 'Dashboard' );
24 |
25 | //Check the store is enabled
26 | $I->amOnPage( '/members/admin/' );
27 | $I->expect('to see the Shop tab');
28 | $I->See( 'Shop' );
29 |
30 | //Disable the store
31 | $I->amOnAdminPage( 'admin.php?page=wc4bp-options-page' );
32 | $I->see( 'WooCommerce BuddyPress Integration' );
33 |
34 | $I->see( 'WC4BP Settings' );
35 | $I->see( 'Turn off Shop. Disable the BuddyPress Shop Tab and WooCommerce My Account will work normally.' );
36 | $I->checkOption( "input[name*='tab_activity_disabled'][name^='wc4bp_options']" );
37 | $I->seeCheckboxIsChecked( "input[name*='tab_activity_disabled'][name^='wc4bp_options']" );
38 | $I->makeScreenshot( 'Disabling the store' );
39 |
40 | $I->amOnPage( '/members/admin/' );
41 | $I->expect('to not see the Shop tab');
42 | $I->canSee( 'Shop' );
43 |
44 | $user1->does( function ( AcceptanceTester $I ) {
45 | $I->wantTo( 'User1 check the buddypress his profile' );
46 | $I->loginAs( 'user1', 'user1' );
47 | $I->amOnPage( '/members/user1' );
48 | $I->see( 'user1' );
49 | $I->expect('User1 to not see the Shop tab');
50 | $I->canSee( 'Shop' );
51 | } );
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 |
2 | ## WooCommerce for Buddypress (wc4bp-premium)
3 | Create a seamless customer experience and get more engagement on your site by integrating your WooCommerce store with your BuddyPress community.
4 |
5 | # Setup for development
6 | If you want install this plugin in your local for testing or develop. You need to read carefully the next sections.
7 |
8 | ### Requirements
9 | - PHP 7
10 | - WordPress
11 | - Docker & Docker Composer
12 |
13 | ### Installation
14 |
15 | * Composer
16 | * `composer install`
17 | * If you need the TK Script submodule
18 | * `git submodule update --init --recursive`
19 |
20 | #### Troubleshooting
21 | If you face composer memory problems like in the next line.
22 |
23 | > `PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>`
24 |
25 | Use the command
26 |
27 | > `php -d memory_limit=-1 <...>`
28 |
29 | Source: [https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors](https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors)
30 |
31 | ### Testing
32 | We use [codeception](https://codeception.com/) and webdriver.
33 |
34 | Related commands for testing
35 | * Run chromedriver before start executing the test
36 | * `vendor/bin/chromedriver --url-base=/wd/hub`
37 | * Generate Class Test file
38 | * `vendor/bin/codecept g:cest acceptance `
39 | * To run all the acceptance test from command line with steps
40 | * `vendor/bin/codecept run tests/acceptance/SiteNameCest.php --steps`
41 | * To run specific file test from command line with steps
42 | * `vendor/bin/codecept run --steps`
43 |
44 | ## Contributors
45 | * @themekraft
46 | * @svenl77
47 | * @slava
48 | * @travel-junkie
49 | * @kishores
50 | * @marin250189
51 | * @gfirem
52 | * @garrett-eclipse
53 |
54 | ## License
55 |
56 | This project is licensed under the GPLv2 or later license - see the [license.txt](LICENSE) file for details.
--------------------------------------------------------------------------------
/class/includes/freemius/includes/entities/class-fs-billing.php:
--------------------------------------------------------------------------------
1 | get_slug();
19 | ?>
20 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/account/payments.php:
--------------------------------------------------------------------------------
1 | get_slug();
25 |
26 | ?>
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | >
45 | id ?>
46 | created ) ) ?>
47 | formatted_gross() ?>
48 | is_migrated() ) : ?>
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
29 |
31 |
32 |
33 |
36 |
37 |
38 |
39 |
class="fs-tooltip-trigger">
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/admin/views/main/html_admin_shop_disable.php:
--------------------------------------------------------------------------------
1 |
4 |
7 | disable_class_tag( 'p', wc4bp_base::$starter_plan_id ) ); ?>>
8 |
9 |
10 | disable_input_tag( 'checkbox', wc4bp_base::$starter_plan_id ) ); ?> name='wc4bp_options[tab_cart_disabled]' type='checkbox' value='1' />
11 |
12 |
13 |
14 |
15 | disable_class_tag( 'p', wc4bp_base::$starter_plan_id ) ); ?>>
16 |
17 |
18 | disable_input_tag( 'checkbox', wc4bp_base::$starter_plan_id ) ); ?> name='wc4bp_options[tab_checkout_disabled]' type='checkbox' value='1' />
19 |
20 |
21 |
22 |
23 | disable_class_tag( 'p', wc4bp_base::$starter_plan_id ) ); ?>>
24 |
25 |
26 | disable_input_tag( 'checkbox', wc4bp_base::$starter_plan_id ) ); ?> name='wc4bp_options[tab_track_disabled]' type='checkbox' value='1' />
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/templates/shop/member/bb/dashboard.php:
--------------------------------------------------------------------------------
1 |
25 |
26 |
27 |
28 |
29 | Woocommerce - Settings - Advanced and checking the configuration of the endpoitns', 'wc4bp' );
32 | echo esc_html( $dashboard_desc );
33 | ?>
34 |
35 |
36 |
41 |
42 |
43 | id .
60 | $entity->secret_key .
61 | $entity->public_key .
62 | $action
63 | );
64 | }
65 |
66 | /**
67 | * @param \FS_Scope_Entity $entity
68 | * @param int|bool $timestamp
69 | * @param string $action
70 | *
71 | * @return array
72 | */
73 | function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
74 | if ( false === $timestamp ) {
75 | $timestamp = time();
76 | }
77 |
78 | return array(
79 | 's_ctx_type' => $entity->get_type(),
80 | 's_ctx_id' => $entity->id,
81 | 's_ctx_ts' => $timestamp,
82 | 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
83 | );
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/entities/class-fs-affiliate.php:
--------------------------------------------------------------------------------
1 | status );
47 | }
48 |
49 | /**
50 | * @author Leo Fajardo
51 | *
52 | * @return bool
53 | */
54 | function is_pending() {
55 | return ( 'pending' === $this->status );
56 | }
57 |
58 | /**
59 | * @author Leo Fajardo
60 | *
61 | * @return bool
62 | */
63 | function is_suspended() {
64 | return ( 'suspended' === $this->status );
65 | }
66 |
67 | /**
68 | * @author Leo Fajardo
69 | *
70 | * @return bool
71 | */
72 | function is_rejected() {
73 | return ( 'rejected' === $this->status );
74 | }
75 |
76 | /**
77 | * @author Leo Fajardo
78 | *
79 | * @return bool
80 | */
81 | function is_blocked() {
82 | return ( 'blocked' === $this->status );
83 | }
84 | }
--------------------------------------------------------------------------------
/class/includes/freemius/assets/css/admin/affiliation.css:
--------------------------------------------------------------------------------
1 | #fs_affiliation_content_wrapper #messages{margin-top:25px}#fs_affiliation_content_wrapper h3{font-size:24px;padding:0;margin-left:0}#fs_affiliation_content_wrapper ul li{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;list-style-type:none}#fs_affiliation_content_wrapper ul li:before{content:"✓";margin-right:10px;font-weight:bold}#fs_affiliation_content_wrapper p:not(.description),#fs_affiliation_content_wrapper li,#fs_affiliation_content_wrapper label{font-size:16px !important;line-height:26px !important}#fs_affiliation_content_wrapper .button{margin-top:20px;margin-bottom:7px;line-height:35px;height:40px;font-size:16px}#fs_affiliation_content_wrapper .button#cancel_button{margin-right:5px}#fs_affiliation_content_wrapper form .input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form .input-container .input-label{font-weight:bold;display:block;width:100%}#fs_affiliation_content_wrapper form .input-container.input-container-text label,#fs_affiliation_content_wrapper form .input-container.input-container-text input,#fs_affiliation_content_wrapper form .input-container.input-container-text textarea{display:block}#fs_affiliation_content_wrapper form .input-container #add_domain,#fs_affiliation_content_wrapper form .input-container .remove-domain{text-decoration:none;display:inline-block;margin-top:3px}#fs_affiliation_content_wrapper form .input-container #add_domain:focus,#fs_affiliation_content_wrapper form .input-container .remove-domain:focus{box-shadow:none}#fs_affiliation_content_wrapper form .input-container #add_domain.disabled,#fs_affiliation_content_wrapper form .input-container .remove-domain.disabled{color:#aaa;cursor:default}#fs_affiliation_content_wrapper form #extra_domains_container .description{margin-top:0;position:relative;top:-4px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain{display:inline-block;margin-right:5px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain:last-of-type{margin-bottom:0}
2 |
--------------------------------------------------------------------------------
/admin/views/sync/html_admin_sync_change_xprofile_allow_custom.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | >
8 |
9 |
10 | >
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | array(
23 | 'class' => array(),
24 | 'id' => array(),
25 | ),
26 | 'li' => array(
27 | 'class' => array(),
28 | 'id' => array(),
29 | ),
30 | );
31 | echo '';
32 | foreach ( $billing as $key => $field_id ) {
33 | bp_xprofile_update_field_meta( $field_id, 'allow_custom_visibility', $wc4bp_options_sync['custom_visibility'] );
34 | echo wp_kses( sprintf( __( 'billing_%1$s default visibility changed to %2$s ', 'wc4bp' ), $key, $wc4bp_options_sync['custom_visibility'] ), $allowed );
35 | }
36 | echo ' ';
37 | echo '';
38 | foreach ( $shipping as $key => $field_id ) {
39 | bp_xprofile_update_field_meta( $field_id, 'allow_custom_visibility', $wc4bp_options_sync['custom_visibility'] );
40 | echo wp_kses( sprintf( __( 'shipping_%1$s default visibility changed to %2$s ', 'wc4bp' ), $key, $wc4bp_options_sync['custom_visibility'] ), $allowed );
41 | }
42 | echo ' ';
43 | esc_html_e( 'All Done! ', 'wc4bp' );
44 | unset( $wc4bp_options_sync['allow_custom_visibility'] );
45 | update_option( 'wc4bp_options_sync', $wc4bp_options_sync );
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/sdk/Exceptions/Exception.php:
--------------------------------------------------------------------------------
1 | _result = $result;
23 |
24 | $code = 0;
25 | $message = 'Unknown error, please check GetResult().';
26 | $type = '';
27 |
28 | if ( isset( $result['error'] ) && is_array( $result['error'] ) ) {
29 | if ( isset( $result['error']['code'] ) ) {
30 | $code = $result['error']['code'];
31 | }
32 | if ( isset( $result['error']['message'] ) ) {
33 | $message = $result['error']['message'];
34 | }
35 | if ( isset( $result['error']['type'] ) ) {
36 | $type = $result['error']['type'];
37 | }
38 | }
39 |
40 | $this->_type = $type;
41 | $this->_code = $code;
42 |
43 | parent::__construct( $message, is_numeric( $code ) ? $code : 0 );
44 | }
45 |
46 | /**
47 | * Return the associated result object returned by the API server.
48 | *
49 | * @return array The result from the API server
50 | */
51 | public function getResult() {
52 | return $this->_result;
53 | }
54 |
55 | public function getStringCode() {
56 | return $this->_code;
57 | }
58 |
59 | public function getType() {
60 | return $this->_type;
61 | }
62 |
63 | /**
64 | * To make debugging easier.
65 | *
66 | * @return string The string representation of the error
67 | */
68 | public function __toString() {
69 | $str = $this->getType() . ': ';
70 |
71 | if ( $this->code != 0 ) {
72 | $str .= $this->getStringCode() . ': ';
73 | }
74 |
75 | return $str . $this->getMessage();
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/debug/logger.php:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 |
19 |
20 | #
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
33 |
39 | >
42 | .
43 | get_id() ?>
44 |
45 |
46 |
47 | %s ',
50 | esc_html( substr( $log['msg'], 0, 32 ) ) . ( 32 < strlen( $log['msg'] ) ? '...' : '' )
51 | );
52 | ?>
53 |
54 |
55 |
56 |
57 | get_file() ) . ':' . $log['line'];
60 | }
61 | ?>
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/powered-by.php:
--------------------------------------------------------------------------------
1 | is_whitelabeled() && ! $fs->apply_filters( 'hide_freemius_powered_by', false ) ) {
37 | wp_enqueue_script( 'jquery' );
38 | wp_enqueue_script( 'json2' );
39 | fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
40 | fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
41 | ?>
42 |
43 |
61 |
62 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/firewall-issues-js.php:
--------------------------------------------------------------------------------
1 |
17 |
63 |
--------------------------------------------------------------------------------
/admin/admin-notifications.php:
--------------------------------------------------------------------------------
1 | wc4bp_register_admin_settings_notifications();
25 | include_once WC4BP_ABSPATH_ADMIN_VIEWS_PATH . 'html_admin_notifications_screen.php';
26 | } catch ( Exception $exception ) {
27 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
28 | }
29 | }
30 |
31 | /**
32 | * Register the admin settings
33 | *
34 | * @author Sven Lehnert
35 | * @package TK Loop Designer
36 | * @since 1.0
37 | */
38 |
39 | public function wc4bp_register_admin_settings_notifications() {
40 | // Settings fields and sections
41 | add_settings_section( 'section_notifications', __( 'Notifications Settings', 'wc4bp' ), '', 'wc4bp_options_notifications' );
42 | add_settings_field( 'notifications_settings', __( 'Purchase Notification ', 'wc4bp' ), array( $this, 'wc4bp_notifications_settings' ), 'wc4bp_options_notifications', 'section_notifications' );
43 | add_settings_field( 'notifications_order_status', '', array( $this, 'wc4bp_notifications_order_status' ), 'wc4bp_options_notifications', 'section_notifications' );
44 | }
45 |
46 | public function wc4bp_notifications_settings() {
47 | try {
48 | $wc4bp_options_notifications = get_option( 'wc4bp_options_notifications' );
49 | include_once WC4BP_ABSPATH_ADMIN_VIEWS_PATH . 'notifications/html_admin_notifications_settings.php';
50 | } catch ( Exception $exception ) {
51 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
52 | }
53 | }
54 |
55 | public function wc4bp_notifications_order_status() {
56 | try {
57 | $wc4bp_options_notifications = get_option( 'wc4bp_options_notifications' );
58 | include_once WC4BP_ABSPATH_ADMIN_VIEWS_PATH . 'notifications/html_admin_notifications_select_order.php';
59 | } catch ( Exception $exception ) {
60 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/account/partials/activate-license-button.php:
--------------------------------------------------------------------------------
1 |
35 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/gdpr-optin-js.php:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/class-fs-user-lock.php:
--------------------------------------------------------------------------------
1 | _lock = new FS_Lock( "locked_{$current_user_id}" );
53 | }
54 |
55 | /**
56 | * Try to acquire lock. If the lock is already set or is being acquired by another locker, don't do anything.
57 | *
58 | * @author Vova Feldman (@svovaf)
59 | * @since 2.1.0
60 | *
61 | * @param int $expiration
62 | *
63 | * @return bool TRUE if successfully acquired lock.
64 | */
65 | function try_lock( $expiration = 0 ) {
66 | return $this->_lock->try_lock( $expiration );
67 | }
68 |
69 | /**
70 | * Acquire lock regardless if it's already acquired by another locker or not.
71 | *
72 | * @author Vova Feldman (@svovaf)
73 | * @since 2.1.0
74 | *
75 | * @param int $expiration
76 | */
77 | function lock( $expiration = 0 ) {
78 | $this->_lock->lock( $expiration );
79 | }
80 |
81 | /**
82 | * Unlock the lock.
83 | *
84 | * @author Vova Feldman (@svovaf)
85 | * @since 2.1.0
86 | */
87 | function unlock() {
88 | $this->_lock->unlock();
89 | }
90 | }
--------------------------------------------------------------------------------
/class/includes/freemius/templates/plugin-info/description.php:
--------------------------------------------------------------------------------
1 | info->selling_point_0 ) ||
21 | ! empty( $plugin->info->selling_point_1 ) ||
22 | ! empty( $plugin->info->selling_point_2 )
23 | ) : ?>
24 |
25 |
26 |
27 | info->{'selling_point_' . $i} ) ) : ?>
28 |
29 |
30 | info->{'selling_point_' . $i} ) ?>
31 |
32 |
33 |
34 |
35 |
36 |
37 | info->description, array(
39 | 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ),
40 | 'b' => array(),
41 | 'i' => array(),
42 | 'p' => array(),
43 | 'blockquote' => array(),
44 | 'h2' => array(),
45 | 'h3' => array(),
46 | 'ul' => array(),
47 | 'ol' => array(),
48 | 'li' => array()
49 | ) );
50 | ?>
51 |
52 | info->screenshots ) ) : ?>
53 | info->screenshots ?>
54 |
55 |
slug ) ?>
56 |
57 | $url ) : ?>
59 |
64 |
65 |
71 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/admin-notice.php:
--------------------------------------------------------------------------------
1 |
39 | data-id="" data-manager-id="" data-slug="" data-type=""
40 | class=" fs-notice">
68 |
69 |
70 |
71 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/managers/class-fs-license-manager.php:
--------------------------------------------------------------------------------
1 | get_slug() );
24 | //
25 | // if ( ! isset( self::$_instances[ $slug ] ) ) {
26 | // self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs );
27 | // }
28 | //
29 | // return self::$_instances[ $slug ];
30 | // }
31 | //
32 | //// private function __construct($slug) {
33 | //// parent::__construct($slug);
34 | //// }
35 | //
36 | // function entry_id() {
37 | // return 'licenses';
38 | // }
39 | //
40 | // function sync( $id ) {
41 | //
42 | // }
43 | //
44 | // /**
45 | // * @author Vova Feldman (@svovaf)
46 | // * @since 1.0.5
47 | // * @uses FS_Api
48 | // *
49 | // * @param number|bool $plugin_id
50 | // *
51 | // * @return FS_Plugin_License[]|stdClass Licenses or API error.
52 | // */
53 | // function api_get_user_plugin_licenses( $plugin_id = false ) {
54 | // $api = $this->_fs->get_api_user_scope();
55 | //
56 | // if ( ! is_numeric( $plugin_id ) ) {
57 | // $plugin_id = $this->_fs->get_id();
58 | // }
59 | //
60 | // $result = $api->call( "/plugins/{$plugin_id}/licenses.json" );
61 | //
62 | // if ( ! isset( $result->error ) ) {
63 | // for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
64 | // $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
65 | // }
66 | //
67 | // $result = $result->licenses;
68 | // }
69 | //
70 | // return $result;
71 | // }
72 | //
73 | // function api_get_many() {
74 | //
75 | // }
76 | //
77 | // function api_activate( $id ) {
78 | //
79 | // }
80 | //
81 | // function api_deactivate( $id ) {
82 | //
83 | // }
84 |
85 | /**
86 | * @param FS_Plugin_License[] $licenses
87 | *
88 | * @return bool
89 | */
90 | static function has_premium_license( $licenses ) {
91 | if ( is_array( $licenses ) ) {
92 | foreach ( $licenses as $license ) {
93 | /**
94 | * @var FS_Plugin_License $license
95 | */
96 | if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
97 | return true;
98 | }
99 | }
100 | }
101 |
102 | return false;
103 | }
104 | }
--------------------------------------------------------------------------------
/tests/acceptance.suite.yml:
--------------------------------------------------------------------------------
1 | # Codeception Test Suite Configuration
2 | #
3 | # Suite for acceptance tests.
4 | # Perform tests in browser using the WPWebDriver or WPBrowser.
5 | # Use WPDb to set up your initial database fixture.
6 | # If you need both WPWebDriver and WPBrowser tests - create a separate suite.
7 |
8 | actor: AcceptanceTester
9 | modules:
10 | enabled:
11 | - WPDb
12 | - WPWebDriver
13 | - \Helper\Acceptance
14 | config:
15 | WPDb:
16 | dsn: 'mysql:host=%TEST_SITE_DB_HOST%;dbname=%TEST_SITE_DB_NAME%'
17 | user: '%TEST_SITE_DB_USER%'
18 | password: '%TEST_SITE_DB_PASSWORD%'
19 | dump: 'tests/_data/dump.sql'
20 | #import the dump before the tests; this means the test site database will be repopulated before the tests.
21 | populate: true
22 | # re-import the dump between tests; this means the test site database will be repopulated between the tests.
23 | cleanup: true
24 | waitlock: 10
25 | originalUrl: '%TEST_SITE_WP_URL%'
26 | url: '%TEST_SITE_WP_URL%'
27 | urlReplacement: true #replace the hardcoded dump URL with the one above
28 | tablePrefix: '%TEST_SITE_TABLE_PREFIX%'
29 | WPBrowser:
30 | url: '%TEST_SITE_WP_URL%'
31 | adminUsername: '%TEST_SITE_ADMIN_USERNAME%'
32 | adminPassword: '%TEST_SITE_ADMIN_PASSWORD%'
33 | adminPath: '%TEST_SITE_WP_ADMIN_PATH%'
34 | headers:
35 | X_TEST_REQUEST: 1
36 | X_WPBROWSER_REQUEST: 1
37 | WPWebDriver:
38 | url: '%TEST_SITE_WP_URL%'
39 | port: '%LT_PORT%' #Uncomment to run using LambdaTest service
40 | host: '%LT_URL%' #Uncomment to run using LambdaTest service
41 | # host: '%TEST_CHROME_DRIVER_IP%' #Uncomment to run using local chrome driver
42 | # port: '%TEST_CHROME_DRIVER_PORT%' #Uncomment to run using local chrome driver
43 | adminUsername: '%TEST_SITE_ADMIN_USERNAME%'
44 | adminPassword: '%TEST_SITE_ADMIN_PASSWORD%'
45 | adminPath: '%TEST_SITE_WP_ADMIN_PATH%'
46 | headers:
47 | X_TEST_REQUEST: 1
48 | X_WPBROWSER_REQUEST: 1
49 | browser: chrome
50 | restart: true
51 | wait: 0
52 | window_size: 1024x768
53 | clear_cookies: false
54 | log_js_errors: true
55 | capabilities:
56 | name: 'WC4BP Codeception'
57 | build: '1.0'
58 | browserName: 'Chrome' # request the latest version of chrome
59 | platform: 'ANY'
60 | version: '71.0'
61 | tunnel: true
62 | network: true
63 | video: true
64 | visual: true
65 | console: true
--------------------------------------------------------------------------------
/class/includes/freemius/templates/connect/permissions-group.php:
--------------------------------------------------------------------------------
1 | get_text_x_inline( 'Opt Out', 'verb', 'opt-out' );
32 | $opt_in_text = $fs->get_text_x_inline( 'Opt In', 'verb', 'opt-in' );
33 |
34 | if ( empty( $permission_group[ 'prompt' ] ) ) {
35 | $is_enabled = false;
36 |
37 | foreach ( $permission_group[ 'permissions' ] as $permission ) {
38 | if ( true === $permission[ 'default' ] ) {
39 | // Even if one of the permissions is on, treat as if the entire group is on.
40 | $is_enabled = true;
41 | break;
42 | }
43 | }
44 | } else {
45 | $is_enabled = ( isset( $permission_group['is_enabled'] ) && true === $permission_group['is_enabled'] );
46 | }
47 | ?>
48 |
49 |
65 |
66 | render_permission( $permission );
69 | }
70 | ?>
71 |
72 |
--------------------------------------------------------------------------------
/class/wc4bp-exception-handler.php:
--------------------------------------------------------------------------------
1 | exception_list_name = $prefix . '_' . $this->exception_list_name;
29 | $this->internal_prefix = $prefix . '_' . $this->internal_prefix;
30 | $this->load_exceptions_list();
31 | }
32 |
33 | public function error_handler( $number, $message, $file, $line ) {
34 | $trace = new stdClass();
35 | $trace->number = $number;
36 | $trace->message = $message;
37 | $trace->file = $file;
38 | $trace->line = $line;
39 | $this->save_exception( $trace );
40 | }
41 |
42 | public function save_exception( $trace ) {
43 | if ( ! empty( $trace ) ) {
44 | $this->exception_list[ time() ] = $trace;
45 |
46 | return true;
47 | } else {
48 | return false;
49 | }
50 | }
51 |
52 | public function register_exception() {
53 | if ( ! empty( $this->exception_list ) ) {
54 | return update_option( $this->exception_list_name, $this->exception_list );
55 | } else {
56 | return false;
57 | }
58 | }
59 |
60 | public function get_exception_list() {
61 | return $this->exception_list;
62 | }
63 |
64 | public function load_exceptions_list() {
65 | if ( empty( $this->exception_list ) ) {
66 | $register_exceptions = get_option( $this->exception_list_name );
67 | if ( ! empty( $register_exceptions ) ) {
68 | $this->exception_list = $register_exceptions;
69 | } else {
70 | $this->exception_list = array();
71 | }
72 | } else {
73 | $this->exception_list;
74 | }
75 | }
76 |
77 | public static function clean_exceptions() {
78 | $list_name = self::get_instance()->exception_list_name;
79 |
80 | return delete_option( $list_name );
81 | }
82 |
83 | /**
84 | * Return an instance of this class.
85 | *
86 | * @return WC4BP_Exception_Handler A single instance of this class.
87 | */
88 | public static function get_instance() {
89 | // If the single instance hasn't been set, set it now.
90 | if ( null === self::$instance ) {
91 | self::$instance = new self();
92 | }
93 |
94 | return self::$instance;
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/class/includes/freemius/assets/css/customizer.css:
--------------------------------------------------------------------------------
1 | #fs_customizer_upsell .fs-customizer-plan{padding:10px 20px 20px 20px;border-radius:3px;background:#fff}#fs_customizer_upsell .fs-customizer-plan h2{position:relative;margin:0;line-height:2em;text-transform:uppercase}#fs_customizer_upsell .fs-customizer-plan h2 .button-link{top:-2px}#fs_customizer_upsell .fs-feature{position:relative}#fs_customizer_upsell .dashicons-yes{color:#0085ba;font-size:2em;vertical-align:bottom;margin-left:-7px;margin-right:10px}.rtl #fs_customizer_upsell .dashicons-yes{margin-left:10px;margin-right:-7px}#fs_customizer_upsell .dashicons-editor-help{color:#bbb;cursor:help}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{opacity:0;visibility:hidden;-moz-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;position:absolute;background:#000;color:#fff;font-family:"arial",serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:0;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);line-height:1.3em;font-weight:bold;text-align:left}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{text-align:right}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{content:" ";display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:#000 transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{right:21px;left:auto}#fs_customizer_upsell .dashicons-editor-help:hover .fs-feature-desc{visibility:visible;opacity:1}#fs_customizer_upsell .button-primary{display:block;text-align:center;margin-top:10px}#fs_customizer_support{display:block !important}#fs_customizer_support .button{float:right}#fs_customizer_support .button-group{width:100%;display:block;margin-top:10px}#fs_customizer_support .button-group .button{float:none;width:50%;text-align:center}#customize-theme-controls #accordion-section-freemius_upsell{border-top:1px solid #0085ba !important;border-bottom:1px solid #0085ba !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title{color:#fff;background-color:#0085ba;border-left:4px solid #0085ba;transition:.15s background-color ease-in-out,.15s border-color ease-in-out;outline:none;border-bottom:none !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:hover{background-color:#008ec2;border-left-color:#0073aa}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:after{color:#fff}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title{border-left:none;border-right:4px solid #0085ba}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title:hover{border-right-color:#0073aa}
2 |
--------------------------------------------------------------------------------
/class/includes/freemius/templates/debug/plugins-themes-sync.php:
--------------------------------------------------------------------------------
1 | get_option( 'all_plugins' );
15 | $all_themes = $fs_options->get_option( 'all_themes' );
16 |
17 | /* translators: %s: time period (e.g. In "2 hours") */
18 | $in_x_text = fs_text_inline( 'In %s', 'in-x' );
19 | /* translators: %s: time period (e.g. "2 hours" ago) */
20 | $x_ago_text = fs_text_inline( '%s ago', 'x-ago' );
21 | $sec_text = fs_text_x_inline( 'sec', 'seconds' );
22 | ?>
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | plugins ) ?>
37 | timestamp ) && is_numeric( $all_plugins->timestamp ) ) {
39 | $diff = abs( WP_FS__SCRIPT_START_TIME - $all_plugins->timestamp );
40 | $human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
41 | $diff . ' ' . $sec_text :
42 | human_time_diff( WP_FS__SCRIPT_START_TIME, $all_plugins->timestamp );
43 |
44 | echo esc_html( sprintf(
45 | ( ( WP_FS__SCRIPT_START_TIME < $all_plugins->timestamp ) ?
46 | $in_x_text :
47 | $x_ago_text ),
48 | $human_diff
49 | ) );
50 | }
51 | ?>
52 |
53 |
54 |
55 |
56 |
57 | themes ) ?>
58 | timestamp ) && is_numeric( $all_themes->timestamp ) ) {
60 | $diff = abs( WP_FS__SCRIPT_START_TIME - $all_themes->timestamp );
61 | $human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
62 | $diff . ' ' . $sec_text :
63 | human_time_diff( WP_FS__SCRIPT_START_TIME, $all_themes->timestamp );
64 |
65 | echo esc_html( sprintf(
66 | ( ( WP_FS__SCRIPT_START_TIME < $all_themes->timestamp ) ?
67 | $in_x_text :
68 | $x_ago_text ),
69 | $human_diff
70 | ) );
71 | }
72 | ?>
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/admin/views/sync/html_admin_sync_shop_profile_sync_ajax.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
69 |
70 | plugin_name = $plugin_name . DIRECTORY_SEPARATOR . 'wc4bp-basic-integration.php';// TODO this need to be testd in the free version
24 | add_action( 'upgrader_process_complete', array( $this, 'upgrader_process_complete' ), 10, 2 );
25 | }
26 |
27 | /**
28 | * This function is trigger when the plugin is updated. It check if the version already apply a patch if not it execute.
29 | *
30 | * @use WC4BP_Loader::VERSION The function use this constant to check for the current version of the patch
31 | *
32 | * @param $upgrader_object
33 | * @param $options
34 | *
35 | * @return bool
36 | */
37 | public function upgrader_process_complete( $upgrader_object, $options ) {
38 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX && defined( 'WP_ADMIN' ) && WP_ADMIN ) {
39 | return false;
40 | }
41 | $wc4bp_upgrade_patch = get_option( 'wc4bp_upgrade' ); // Option where the flags of path version will be store
42 | if ( empty( $wc4bp_upgrade_patch ) || empty( $wc4bp_upgrade_patch[ WC4BP_Loader::VERSION ] ) ) {
43 | if ( 'update' === $options['action'] && 'plugin' === $options['type'] && isset( $options['plugins'] ) ) {
44 | // Iterate through the plugins being updated and check if ours is there
45 | foreach ( $options['plugins'] as $plugin ) {
46 | if ( $plugin === $this->plugin_name ) {
47 | if ( empty( $wc4bp_upgrade_patch[ WC4BP_Loader::VERSION ] ) && file_exists( WC4BP_ABSPATH_PATCH_PATH . WC4BP_Loader::VERSION . '.php' ) ) {
48 | return $this->execute_patch( $wc4bp_upgrade_patch );
49 | }
50 | }
51 | }
52 | }
53 | }
54 |
55 | return false;
56 | }
57 |
58 | /**
59 | * Execute the patch. This use a name convention to remove the dot in the version and build the class name like WC4BP_3013
60 | *
61 | * @param $wc4bp_upgrade_patch
62 | *
63 | * @return bool
64 | */
65 | public function execute_patch( $wc4bp_upgrade_patch ) {
66 | $plain_version = str_replace( '.', '', WC4BP_Loader::VERSION );
67 | $class_name = 'WC4BP_' . $plain_version;
68 | require_once WC4BP_ABSPATH_PATCH_PATH . WC4BP_Loader::VERSION . '.php';
69 | new $class_name( $wc4bp_upgrade_patch );
70 |
71 | return true;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/patch/3.0.14.php:
--------------------------------------------------------------------------------
1 | wc4bp_upgrade_patch_options = $wc4bp_upgrade_patch_options;
23 | $this->init();
24 | }
25 |
26 | public function init() {
27 | try {
28 | if ( $this->continue_process() ) {
29 | $posts = $this->get_pages();
30 | if ( ! empty( $posts ) ) {
31 | foreach ( $posts as $post ) {
32 | if ( isset( $post->ID ) ) {
33 | $post = get_post( intval( $post->ID ) );
34 | wp_delete_post( $post->ID );
35 | wp_cache_delete( 'wc4bp_get_page_by_name_' . $post->post_name, 'wc4bp' );
36 | }
37 | }
38 | $wc4bp_options = get_option( 'wc4bp_options' );
39 | if ( isset( $wc4bp_options['my_account_prefix'] ) ) {
40 | unset( $wc4bp_options['my_account_prefix'] );
41 | update_option( 'wc4bp_options', $wc4bp_options );
42 | }
43 | WC4BP_MyAccount::clean_my_account_cached();
44 |
45 | return $this->finish_process();
46 | }
47 | }
48 | } catch ( Exception $exception ) {
49 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
50 | }
51 |
52 | return false;
53 | }
54 |
55 | /**
56 | * Get a list of pages with post_name start with 'wc4pb'
57 | *
58 | * @return array
59 | */
60 | private function get_pages() {
61 | try {
62 | global $wpdb;
63 | $posts = $wpdb->get_results( "SELECT ID FROM kraft_posts WHERE post_name LIKE 'wc4pb_%' AND post_type='page'" );
64 | if ( ! empty( $posts ) ) {
65 | return $posts;
66 | }
67 | } catch ( Exception $exception ) {
68 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
69 | }
70 |
71 | return array();
72 | }
73 |
74 | /**
75 | * Determine if the process can continue
76 | *
77 | * @return bool
78 | */
79 | public function continue_process() {
80 | if ( defined( 'DOING_AJAX' ) && DOING_AJAX && defined( 'WP_ADMIN' ) && WP_ADMIN ) {
81 | return false;
82 | } else {
83 | return ( empty( $this->wc4bp_upgrade_patch_options ) && empty( $this->wc4bp_upgrade_patch_options[ WC4BP_Loader::VERSION ] ) );
84 | }
85 | }
86 |
87 | /**
88 | * Mark this process as finished
89 | *
90 | * @return bool
91 | */
92 | public function finish_process() {
93 | $wc4bp_upgrade_patch[ WC4BP_Loader::VERSION ] = 1;
94 |
95 | return update_option( 'wc4bp_upgrade', $wc4bp_upgrade_patch );
96 | }
97 |
98 | }
99 | }
--------------------------------------------------------------------------------
/class/includes/freemius/includes/customizer/class-fs-customizer-support-section.php:
--------------------------------------------------------------------------------
1 | register_section_type( 'FS_Customizer_Support_Section' );
23 |
24 | parent::__construct( $manager, $id, $args );
25 | }
26 |
27 | /**
28 | * The type of customize section being rendered.
29 | *
30 | * @since 1.0.0
31 | * @access public
32 | * @var string
33 | */
34 | public $type = 'freemius-support-section';
35 |
36 | /**
37 | * @var Freemius
38 | */
39 | public $fs = null;
40 |
41 | /**
42 | * Add custom parameters to pass to the JS via JSON.
43 | *
44 | * @since 1.0.0
45 | */
46 | public function json() {
47 | $json = parent::json();
48 |
49 | $is_contact_visible = $this->fs->is_page_visible( 'contact' );
50 | $is_support_visible = $this->fs->is_page_visible( 'support' );
51 |
52 | $json['theme_title'] = $this->fs->get_plugin_name();
53 |
54 | if ( $is_contact_visible && $is_support_visible ) {
55 | $json['theme_title'] .= ' ' . $this->fs->get_text_inline( 'Support', 'support' );
56 | }
57 |
58 | if ( $is_contact_visible ) {
59 | $json['contact'] = array(
60 | 'label' => $this->fs->get_text_inline( 'Contact Us', 'contact-us' ),
61 | 'url' => $this->fs->contact_url(),
62 | );
63 | }
64 |
65 | if ( $is_support_visible ) {
66 | $json['support'] = array(
67 | 'label' => $this->fs->get_text_inline( 'Support Forum', 'support-forum' ),
68 | 'url' => $this->fs->get_support_forum_url()
69 | );
70 | }
71 |
72 | return $json;
73 | }
74 |
75 | /**
76 | * Outputs the Underscore.js template.
77 | *
78 | * @since 1.0.0
79 | */
80 | protected function render_template() {
81 | ?>
82 |
84 |
85 | {{ data.theme_title }}
86 | <# if ( data.contact && data.support ) { #>
87 |
97 | <# } #>
98 |
99 |
100 | wantTo( 'check the Store slug' );
7 |
8 | //Login as admin
9 | $I->loginAs( 'admin', 'admin' );
10 | $I->amOnAdminPage( '/' );
11 | $I->see( 'Dashboard' );
12 |
13 | $I->amOnAdminPage( 'admin.php?page=wc4bp-options-page' );
14 | $I->see( 'WooCommerce BuddyPress Integration' );
15 |
16 | //Setting the default store url
17 | $I->see( 'WC4BP Settings' );
18 | $I->see( 'Change the Shop Url. This option is useful when you want to change the Url of the Shop.' );
19 | $I->fillField( "input[name*='tab_my_account_shop_url'][name^='wc4bp_options']", 'shop' );
20 | $I->makeScreenshot( 'Update the store url to default value' );
21 | $I->scrollTo( 'input[type="submit"]' );
22 | $I->click( 'input[type="submit"]' );
23 |
24 | //Login as user1
25 | $I->seeUserInDatabase( array( 'user_login' => 'user1' ) );
26 | $user1 = $I->haveFriend( 'user1' );
27 | $user1->does( function ( AcceptanceTester $I ) {
28 | $I->wantTo( 'User1 check the buddypress default url' );
29 | $I->loginAs( 'user1', 'user1' );
30 | $I->amOnPage( '/members/user1' );
31 | $I->see( 'user1' );
32 | $I->expect( 'User1 to see the Shop tab' );
33 | $I->See( 'Shop' );
34 | $I->scrollTo( '.entry-content' );
35 | $I->click( 'li#shop-personal-li' );
36 | $I->see( 'Orders' );
37 | $I->seeInCurrentUrl( 'shop' );
38 | } );
39 |
40 |
41 | //Check the store is enabled
42 | $I->amOnPage( '/members/admin/' );
43 | $I->expect( 'to have the default shop url' );
44 | $I->See( 'Shop' );
45 | $I->scrollTo( '.entry-content' );
46 | $I->click( 'li#shop-personal-li' );
47 | $I->see( 'Orders' );
48 | $I->seeInCurrentUrl( 'shop' );
49 |
50 | //Check teh store is disabled
51 | $I->amOnAdminPage( 'admin.php?page=wc4bp-options-page' );
52 | $I->see( 'WooCommerce BuddyPress Integration' );
53 |
54 | $I->see( 'WC4BP Settings' );
55 | $I->see( 'Change the Shop Url. This option is useful when you want to change the Url of the Shop.' );
56 | $I->fillField( "input[name*='tab_my_account_shop_url'][name^='wc4bp_options']", 'store111' );
57 | $I->makeScreenshot( 'Changing the store url' );
58 | $I->scrollTo( 'input[type="submit"]' );
59 | $I->click( 'input[type="submit"]' );
60 |
61 | //Check the new Store url
62 | $I->see( 'Change the Shop Url. This option is useful when you want to change the Url of the Shop.' );
63 | $I->seeInField( "input[name*='tab_my_account_shop_url'][name^='wc4bp_options']", 'store111' );
64 |
65 | //Check the new store url in the frontend admin and user1
66 | $I->amOnPage( '/members/admin/' );
67 | $I->expect( 'to not see the Shop tab' );
68 | $I->See( 'Shop' );
69 | $I->scrollTo( '.entry-content' );
70 | $I->click( 'li#store111-personal-li' );
71 | $I->see( 'Orders' );
72 | $I->seeInCurrentUrl( 'store111' );
73 |
74 | $user1->does( function ( AcceptanceTester $I ) {
75 | $I->wantTo( 'User1 check the new store url' );
76 | $I->loginAs( 'user1', 'user1' );
77 | $I->amOnPage( '/members/user1' );
78 | $I->see( 'user1' );
79 | $I->See( 'Shop' );
80 | $I->scrollTo( '.entry-content' );
81 | $I->click( 'li#store111-personal-li' );
82 | $I->see( 'Orders' );
83 | $I->seeInCurrentUrl( 'store111' );
84 | } );
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/admin/views/sync/html_admin_sync_shop_profile.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
hide
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/class/includes/freemius/includes/class-fs-lock.php:
--------------------------------------------------------------------------------
1 | _lock_id = $lock_id;
38 |
39 | if ( ! isset( self::$_thread_id ) ) {
40 | self::$_thread_id = mt_rand( 0, 32000 );
41 | }
42 | }
43 |
44 | /**
45 | * Try to acquire lock. If the lock is already set or is being acquired by another locker, don't do anything.
46 | *
47 | * @param int $expiration
48 | *
49 | * @return bool TRUE if successfully acquired lock.
50 | */
51 | function try_lock( $expiration = 0 ) {
52 | if ( $this->is_locked() ) {
53 | // Already locked.
54 | return false;
55 | }
56 |
57 | set_site_transient( $this->_lock_id, self::$_thread_id, $expiration );
58 |
59 | if ( $this->has_lock() ) {
60 | $this->lock($expiration);
61 |
62 | return true;
63 | }
64 |
65 | return false;
66 | }
67 |
68 | /**
69 | * Acquire lock regardless if it's already acquired by another locker or not.
70 | *
71 | * @author Vova Feldman (@svovaf)
72 | * @since 2.1.0
73 | *
74 | * @param int $expiration
75 | */
76 | function lock( $expiration = 0 ) {
77 | set_site_transient( $this->_lock_id, true, $expiration );
78 | }
79 |
80 | /**
81 | * Checks if lock is currently acquired.
82 | *
83 | * @author Vova Feldman (@svovaf)
84 | * @since 2.1.0
85 | *
86 | * @return bool
87 | */
88 | function is_locked() {
89 | return ( false !== get_site_transient( $this->_lock_id ) );
90 | }
91 |
92 | /**
93 | * Unlock the lock.
94 | *
95 | * @author Vova Feldman (@svovaf)
96 | * @since 2.1.0
97 | */
98 | function unlock() {
99 | delete_site_transient( $this->_lock_id );
100 | }
101 |
102 | /**
103 | * Checks if lock is currently acquired by the current locker.
104 | *
105 | * @return bool
106 | */
107 | protected function has_lock() {
108 | return ( self::$_thread_id == get_site_transient( $this->_lock_id ) );
109 | }
110 | }
--------------------------------------------------------------------------------
/admin/wc4bp-revision.php:
--------------------------------------------------------------------------------
1 | roles;
15 | if ( in_array( 'administrator', $roles ) ) {
16 | $user_id = $user->ID;
17 | $wc4bp_review = get_user_meta( $user_id, 'wc4bp-review', true );
18 | $wc4bp_review_later = get_user_meta( $user_id, 'wc4bp-review-later', true );
19 | $time_result = false;
20 | if ( ! empty( $wc4bp_review_later ) ) {
21 | try {
22 | $wc4bp_review_now = new DateTime( 'now' );
23 | $time_comparison = $wc4bp_review_now->diff( $wc4bp_review_later );
24 | $time_result = ( 1 === $time_comparison->invert );
25 | } catch ( Exception $exception ) {
26 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
27 | }
28 | }
29 | if ( empty( $wc4bp_review ) ) {
30 | if ( false !== $time_result || empty( $wc4bp_review_later ) ) {
31 | add_action( 'admin_notices', array( $this, 'ask_for_revision' ) );
32 | add_action( 'network_admin_notices', array( $this, 'ask_for_revision' ) );
33 | add_action( 'admin_enqueue_scripts', array( $this, 'revision_script' ), 10 );
34 | add_action( 'wp_ajax_wc4bp_revision_review', array( $this, 'wc4bp_revision_trigger' ) );
35 | add_action( 'wp_ajax_wc4bp_revision_later', array( $this, 'wc4bp_revision_trigger' ) );
36 | add_action( 'wp_ajax_wc4bp_revision_already', array( $this, 'wc4bp_revision_trigger' ) );
37 | }
38 | }
39 | }
40 | }
41 |
42 | public function ask_for_revision() {
43 | include_once WC4BP_ABSPATH_ADMIN_VIEWS_PATH . 'html_admin_revision.php';
44 | }
45 |
46 | public function revision_script( $hook ) {
47 | wp_enqueue_style( 'wc4bp_admin_revision_css', wc4bp_Manager::assets_path( 'wc4bp-revision', 'css' ) );
48 | wp_enqueue_script( 'wc4bp_admin_revision_js', wc4bp_Manager::assets_path( 'wc4bp-revision' ), array( 'jquery' ), WC4BP_Loader::VERSION );
49 | wp_localize_script(
50 | 'wc4bp_admin_revision_js',
51 | 'wc4bp_admin_revision_js',
52 | array(
53 | 'nonce' => wp_create_nonce( 'wc4bp_review_nonce' ),
54 | 'ajaxurl' => admin_url( 'admin-ajax.php' ),
55 | )
56 | );
57 | }
58 |
59 | public function wc4bp_revision_trigger() {
60 | if ( ! defined( 'DOING_AJAX' ) && DOING_AJAX ) {
61 | return false;
62 | }
63 | $user_id = get_current_user_id();
64 | check_ajax_referer( 'wc4bp_review_nonce', 'nonce' );
65 | $trigger = Request_Helper::get_post_param( 'trigger' );
66 | if ( ! empty( $trigger ) ) {
67 | switch ( $trigger ) {
68 | case 'review':
69 | update_user_meta( $user_id, 'wc4bp-review', true );
70 | break;
71 | case 'later':
72 | try {
73 | $remind = new DateTime( 'now' );
74 | $remind->add( new DateInterval( 'P5D' ) );
75 | update_user_meta( $user_id, 'wc4bp-review-later', $remind );
76 | } catch ( Exception $exception ) {
77 | WC4BP_Loader::get_exception_handler()->save_exception( $exception->getTrace() );
78 | }
79 | break;
80 | case 'already':
81 | update_user_meta( $user_id, 'wc4bp-review', true );
82 | break;
83 | }
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------