Skip to content

Commit

Permalink
Merge pull request #151 from newfold-labs/release/2.0.9
Browse files Browse the repository at this point in the history
Release/2.0.9
  • Loading branch information
circlecube authored Sep 21, 2023
2 parents 8a95e4e + e44a12c commit e509076
Show file tree
Hide file tree
Showing 21 changed files with 8,870 additions and 4,278 deletions.
12 changes: 8 additions & 4 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ node_modules
tests

# Files
.distignore
.gitattributes
.gitignore
.*
cypress.config.js
set-latest-wp-version.js

# File Types
*.json
/*.json
*.lock
*.log
*.md
Expand All @@ -21,3 +21,7 @@ tests
*.xml
*.yml
*.zip

# Newfold src files
vendor/newfold-labs/wp-module-ecommerce/src
vendor/newfold-labs/wp-module-onboarding/src
1 change: 1 addition & 0 deletions .distinclude
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Directories

# Files
/vendor/newfold-labs/wp-module-data/src/Data/Static/*.json

# File Types
5 changes: 4 additions & 1 deletion .github/workflows/cypress-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -86,6 +86,9 @@ jobs:
- name: Install PHP Dependencies
run: composer install --no-progress --no-dev --optimize-autoloader --prefer-dist

- name: Setup Registry
run: printf "\n//npm.pkg.github.com/:_authToken=${{ secrets.NEWFOLD_ACCESS_TOKEN }}" >> .npmrc

- name: NPM Install
run: npm install --legacy-peer-deps

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -78,14 +78,17 @@ jobs:
- name: Install PHP Dependencies
run: composer install --no-progress --no-dev --optimize-autoloader --prefer-dist

- name: Setup Registry
run: printf "\n//npm.pkg.github.com/:_authToken=${{ secrets.NEWFOLD_ACCESS_TOKEN }}" >> .npmrc

- name: NPM Install
run: npm install --legacy-peer-deps

- name: Build JavaScript
run: npm run build

- name: Create Distribution Copy
run: rsync -r --exclude-from=.distignore --include-from=.distinclude . ${{ steps.workflow.outputs.DIST }}/${{ steps.workflow.outputs.PACKAGE }}
run: rsync -r --include-from=.distinclude --exclude-from=.distignore . ${{ steps.workflow.outputs.DIST }}/${{ steps.workflow.outputs.PACKAGE }}

- name: List Distribution Files
working-directory: ${{ steps.workflow.outputs.DIST }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-yml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Lint yaml files
uses: ibiqlik/action-yamllint@v3
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/upload-artifact-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -73,14 +73,17 @@ jobs:
- name: Install PHP Dependencies
run: composer install --no-progress --no-dev --optimize-autoloader --prefer-dist

- name: Setup Registry
run: printf "\n//npm.pkg.github.com/:_authToken=${{ secrets.NEWFOLD_ACCESS_TOKEN }}" >> .npmrc

- name: NPM Install
run: npm install --legacy-peer-deps

- name: Build JavaScript
run: npm run build

- name: Prepare files
run: rsync -r --exclude-from=.distignore . ${{ steps.workflow.outputs.DIST }}
run: rsync -r --include-from=.distinclude --exclude-from=.distignore . ${{ steps.workflow.outputs.DIST }}

- name: List Files
working-directory: ${{ steps.workflow.outputs.DIST }}
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/upload-asset-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Validate version number
if: ${{ (github.repository == 'newfold-labs/wp-plugin-mojo') && (github.event.release.prerelease == false) }}
run: |
taggedVersion=${{ env.VERSION }}
pluginHeaderVersion=`grep "Version:" wp-plugin-mojo.php | grep -Eo "[0-9\.]*"`
pluginConstantVersion=`grep "'MOJO_PLUGIN_VERSION'," wp-plugin-mojo.php | grep -Eo "[0-9\.]*"`
pluginPackageVersion=`grep "version" package.json | grep -Eo "[0-9\.]*"`
pluginPackageVersion=`grep '"version"' package.json | grep -Eo "[0-9\.]*"`
echo "Tagged version: $taggedVersion"
echo "Plugin header version: $pluginHeaderVersion"
echo "Plugin constant version: $pluginConstantVersion"
Expand Down Expand Up @@ -84,14 +84,17 @@ jobs:
- name: Install PHP Dependencies
run: composer install --no-progress --no-dev --optimize-autoloader --prefer-dist

- name: Setup Registry
run: printf "\n//npm.pkg.github.com/:_authToken=${{ secrets.NEWFOLD_ACCESS_TOKEN }}" >> .npmrc

- name: npm install
run: npm install --legacy-peer-deps

- name: Build JavaScript
run: npm run build

- name: Prepare files
run: rsync -r --exclude-from=.distignore . ${{ steps.workflow.outputs.DIST }}/${{ steps.workflow.outputs.PACKAGE }}
run: rsync -r --include-from=.distinclude --exclude-from=.distignore . ${{ steps.workflow.outputs.DIST }}/${{ steps.workflow.outputs.PACKAGE }}

- name: List Files
working-directory: ${{ steps.workflow.outputs.DIST }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wp-i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@newfold-labs:registry=https://npm.pkg.github.com/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16
44 changes: 22 additions & 22 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"core": "WordPress/WordPress#tags/6.3",
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": false,
"FS_METHOD": "direct"
},
"phpVersion": "8.1",
"plugins": [
"."
],
"port": 8880,
"testsPort": 8881,
"env": {
"tests": {
"config": {
"WP_TESTS_DOMAIN": "localhost:8881",
"WP_TESTS_EMAIL": "evanrm@gmail.com",
"WP_TESTS_TITLE": "Mojo WordPress Plugin",
"WP_TESTS_BINARY": "php"
}
}
"core": "WordPress/WordPress#tags/6.3.1",
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": false,
"FS_METHOD": "direct"
},
"phpVersion": "8.1",
"plugins": [
"."
],
"port": 8880,
"testsPort": 8881,
"env": {
"tests": {
"config": {
"WP_SITEURL": "localhost:8881",
"WP_TESTS_DOMAIN": "localhost:8881",
"WP_TESTS_TITLE": "Mojo WordPress Plugin",
"WP_TESTS_BINARY": "php"
}
}
}
}
49 changes: 49 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,52 @@ function() {
}

AdminBar::init();


/**
* Filter to add applicable BN code to paypal requests
*
* https://github.com/newfold-labs/wp-module-ecommerce/blob/trunk/bootstrap.php#L62-L101
*/
if ( function_exists( 'add_filter' ) ) {
add_filter(
'http_request_args',
function ( $parsed_args, $url ) {

// Bail early if the request is not to PayPal's v2 checkout API
if ( false === stripos( wp_parse_url( $url, PHP_URL_HOST ), 'paypal.com' ) ) {
return $parsed_args;
}

// Check for an existing bn_code
$bn_code = isset( $parsed_args['headers']['PayPal-Partner-Attribution-Id'] ) ? $parsed_args['headers']['PayPal-Partner-Attribution-Id'] : null;

// Ensure we only set when blank, or when using one of our stale codes
if ( is_null( $bn_code ) || false !== stripos( $bn_code, 'yith' ) || false !== stripos( $bn_code, 'newfold' ) ) {
// The correct code is case-sensitive. YITH brand is uppercase, but the code is not.
$parsed_args['headers']['PayPal-Partner-Attribution-Id'] = 'Yith_PCP';
}

return $parsed_args;
},
10,
2
);

add_filter(
'script_loader_tag',
function ( $tag, $handle, $source ) {
if ( stripos( $source, 'paypal.com/sdk' ) !== false ) {
$replacement = ' data-partner-attribution-id="Yith_PCP"';
if ( stripos( $tag, 'partner-attribution-id' ) === false ) {
$tag = str_replace( ' src=', $replacement . ' src=', $tag );
} else if ( stripos( $tag, 'NEWFOLD' ) || stripos( $tag, 'YITH' ) ) {
$tag = preg_replace( '/ data-partner-attribution-id="(.*?)"/', $replacement, $tag );
}
}
return $tag;
},
25,
3
);
}
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"require-dev": {
"newfold-labs/wp-php-standards": "^1.2",
"wp-cli/i18n-command": "^2.4.3",
"wp-phpunit/wp-phpunit": "^6.2"
"wp-phpunit/wp-phpunit": "^6.3.1"
},
"scripts": {
"fix": "vendor/bin/phpcbf --standard=phpcs.xml .",
Expand All @@ -56,12 +56,12 @@
"require": {
"doctrine/inflector": "1.2.0 as 1.3.1",
"newfold-labs/wp-module-business-reviews": "^1.1",
"newfold-labs/wp-module-coming-soon": "^1.1.3",
"newfold-labs/wp-module-data": "^2.4.3",
"newfold-labs/wp-module-coming-soon": "^1.1.9",
"newfold-labs/wp-module-data": "^2.4.5",
"newfold-labs/wp-module-loader": "^1.0.10",
"newfold-labs/wp-module-marketplace": "^1.5.1",
"newfold-labs/wp-module-notifications": "^1.1.2",
"newfold-labs/wp-module-performance": "^1.1.1",
"newfold-labs/wp-module-marketplace": "1.5.2",
"newfold-labs/wp-module-notifications": "^1.1.5",
"newfold-labs/wp-module-performance": "1.1.1",
"newfold-labs/wp-module-secure-passwords": "^1.1",
"newfold-labs/wp-module-sso": "^1.0.4",
"wp-forge/wp-update-handler": "^1.0",
Expand Down
Loading

0 comments on commit e509076

Please sign in to comment.