Skip to content

Commit 9b2f871

Browse files
authored
Merge branch 'develop' into filip/v110/page-interactive-tasks
2 parents b2b8d53 + 60c9dbb commit 9b2f871

16 files changed

Lines changed: 143 additions & 704 deletions

.distignore

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
/.wordpress-org
21
/.git
32
/.github
3+
/.husky
4+
/.vscode
5+
/.wordpress-org
6+
/bin
47
/coverage
58
/tests
69
/vendor
710
.distignore
811
.editorconfig
912
.eslintrc.js
1013
.env.example
11-
.gitignore
14+
.eslintcrc.js
1215
.gitattributes
16+
.gitignore
1317
.php-cs-fixer.dist.php
18+
.stylelintrc.json
1419
composer.json
1520
composer.lock
16-
package.json
1721
package-lock.json
22+
package.json
1823
phpcs.xml.dist
1924
phpstan.neon.dist
2025
phpunit.xml.dist
26+
playwright.config.js
2127
README.md
28+
SECURITY.md

.gitattributes

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
.editorconfig export-ignore
2-
.gitattributes export-ignore
31
.github/* export-ignore
2+
.husky/* export-ignore
3+
.vscode/* export-ignore
4+
.wordpress-org/* export-ignore
5+
bin/* export-ignore
6+
coverage/* export-ignore
47
tests/* export-ignore
8+
.distignore export-ignore
9+
.editorconfig export-ignore
10+
.env.example export-ignore
11+
.eslintcrc.js export-ignore
12+
.gitattributes export-ignore
513
.gitignore export-ignore
14+
.php-cs-fixer.dist.php export-ignore
15+
.stylelintrc.json export-ignore
616
composer.json export-ignore
717
composer.lock export-ignore
818
package.json export-ignore
919
package-lock.json export-ignore
10-
.wordpress-org/* export-ignore
1120
phpcs.xml.dist export-ignore
1221
phpstan.neon.dist export-ignore
1322
phpunit.xml.dist export-ignore
23+
playwright.config.js export-ignore
1424
README.md export-ignore
15-
.wordpress-org/* export-ignore
16-
.vscode/* export-ignore
25+
SECURITY.md export-ignore

.github/workflows/playground-merged.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
pull-requests: write
1515
actions: read
1616
steps:
17+
- uses: actions/checkout@v4
18+
1719
- name: Prepare blueprint with artifact link
1820
id: blueprint
1921
run: |

.github/workflows/playground.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
actions: read
1313

1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616

1717
# Prepare a folder named exactly like the repo as the plugin root.
1818
# If the repo already has such a folder (common for WP plugins), use it.
@@ -45,9 +45,30 @@ jobs:
4545
PLUGIN_FILE="${{ steps.prep.outputs.PKG_DIR }}/${{ github.event.repository.name }}.php"
4646
PR_NUMBER="${{ github.event.number }}"
4747
48-
# Extract current version and add PR number
48+
# Extract current version
4949
CURRENT_VERSION=$(grep -o "Version:[[:space:]]*[0-9.]*" "$PLUGIN_FILE" | sed 's/Version:[[:space:]]*//')
50-
NEW_VERSION="${CURRENT_VERSION} - PR ${PR_NUMBER}"
50+
51+
# Increment patch version if it exists, otherwise increment minor version
52+
# Handle versions like 2.1.5 or 2.1
53+
if [[ "$CURRENT_VERSION" =~ ^([0-9]+)\.([0-9]+)(\.([0-9]+))?$ ]]; then
54+
MAJOR="${BASH_REMATCH[1]}"
55+
MINOR="${BASH_REMATCH[2]}"
56+
PATCH="${BASH_REMATCH[4]}"
57+
58+
# Build new version with 'b' suffix
59+
if [ -n "$PATCH" ]; then
60+
# If patch exists, increment patch by 1
61+
PATCH=$((PATCH + 1))
62+
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}b - PR ${PR_NUMBER}"
63+
else
64+
# If no patch, increment minor by 1
65+
MINOR=$((MINOR + 1))
66+
NEW_VERSION="${MAJOR}.${MINOR}b - PR ${PR_NUMBER}"
67+
fi
68+
else
69+
# Fallback: if version format is unexpected, just add .1 and 'b'
70+
NEW_VERSION="${CURRENT_VERSION}.1b - PR ${PR_NUMBER}"
71+
fi
5172
5273
# Replace the version line
5374
sed -i "s/Version:[[:space:]]*[0-9.]*/Version: ${NEW_VERSION}/" "$PLUGIN_FILE"
@@ -76,7 +97,7 @@ jobs:
7697
# Upload the FOLDER (not a .zip). The artifact service zips it for us,
7798
# keeping the top-level folder name inside the archive.
7899
- name: Upload plugin artifact
79-
uses: actions/upload-artifact@v4
100+
uses: actions/upload-artifact@v5
80101
with:
81102
name: ${{ github.event.repository.name }}
82103
path: ${{ steps.prep.outputs.PKG_DIR }}

.github/workflows/plugin-check.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'WordPress.org Plugin Check'
2+
on: # rebuild any PRs and main branch changes
3+
pull_request:
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v5
11+
12+
- name: Setup PHP
13+
uses: shivammathur/setup-php@v2
14+
with:
15+
php-version: '8.3'
16+
coverage: none
17+
tools: wp-cli
18+
19+
- name: Install latest version of dist-archive-command
20+
run: wp package install wp-cli/dist-archive-command:@stable
21+
22+
- name: Build plugin
23+
run: |
24+
wp dist-archive . ./${{ github.event.repository.name }}.zip
25+
mkdir build
26+
unzip ${{ github.event.repository.name }}.zip -d build
27+
28+
- name: Run plugin check
29+
uses: wordpress/plugin-check-action@v1.0.6
30+
with:
31+
build-dir: './build/${{ github.event.repository.name }}'

assets/js/color-customizer.js

Lines changed: 0 additions & 88 deletions
This file was deleted.

assets/js/widgets/suggested-tasks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* A widget that displays a list of suggested tasks.
66
*
7-
* Dependencies: wp-api, progress-planner/document-ready, progress-planner/suggested-task, progress-planner/widgets/todo, progress-planner/celebrate, progress-planner/grid-masonry, progress-planner/web-components/prpl-tooltip, progress-planner/suggested-task-terms
7+
* Dependencies: wp-api, progress-planner/document-ready, progress-planner/suggested-task, progress-planner/widgets/todo, progress-planner/celebrate, progress-planner/web-components/prpl-tooltip, progress-planner/suggested-task-terms
88
*/
99
/* eslint-disable camelcase */
1010

assets/js/widgets/todo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* A widget that displays a todo list.
66
*
7-
* Dependencies: wp-api, progress-planner/suggested-task, wp-util, wp-a11y, progress-planner/grid-masonry, progress-planner/celebrate, progress-planner/suggested-task-terms, progress-planner/l10n
7+
* Dependencies: wp-api, progress-planner/suggested-task, wp-util, wp-a11y, progress-planner/celebrate, progress-planner/suggested-task-terms, progress-planner/l10n
88
*/
99

1010
const prplTodoWidget = {

classes/suggested-tasks/providers/class-set-date-format.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ public function should_add_task() {
120120
public function print_popover_instructions() {
121121
$detected_date_format = $this->get_date_format_type();
122122

123+
if ( ! \function_exists( 'wp_get_available_translations' ) ) {
124+
// @phpstan-ignore-next-line requireOnce.fileNotFound
125+
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
126+
}
127+
123128
// Get the site default language name.
124129
$available_languages = \wp_get_available_translations();
125130
$site_locale = \get_locale();

classes/suggested-tasks/providers/class-tasks-interactive.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ protected function get_allowed_interactive_options() {
164164
* @return void
165165
*/
166166
public function add_popover() {
167+
168+
// Don't add the popover if the task is not published.
169+
if ( ! $this->is_task_published() ) {
170+
return;
171+
}
167172
?>
168173
<div id="prpl-popover-<?php echo \esc_attr( static::POPOVER_ID ); ?>" class="prpl-popover prpl-popover-interactive" popover>
169174
<?php $this->the_popover_content(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
@@ -256,6 +261,11 @@ public function enqueue_scripts( $hook ) {
256261
return;
257262
}
258263

264+
// Don't enqueue the script if the task is not published.
265+
if ( ! $this->is_task_published() ) {
266+
return;
267+
}
268+
259269
// Enqueue the web component.
260270
\progress_planner()->get_admin__enqueue()->enqueue_script(
261271
'progress-planner/recommendations/' . $this->get_provider_id(),
@@ -271,4 +281,19 @@ public function enqueue_scripts( $hook ) {
271281
protected function get_enqueue_data() {
272282
return [];
273283
}
284+
285+
/**
286+
* Check if the task is published.
287+
*
288+
* @return bool
289+
*/
290+
public function is_task_published() {
291+
$tasks = \progress_planner()->get_suggested_tasks_db()->get_tasks_by(
292+
[
293+
'provider' => $this->get_provider_id(),
294+
'post_status' => 'publish',
295+
]
296+
);
297+
return ! empty( $tasks );
298+
}
274299
}

0 commit comments

Comments
 (0)