Skip to content

Commit f744374

Browse files
authored
Merge pull request #408 from ProgressPlanner/develop
v1.2.0
2 parents 3f211a7 + 7059248 commit f744374

120 files changed

Lines changed: 2282 additions & 567 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/playground-merged.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
with:
1717
message: |
1818
**Test merged PR on Playground**
19-
[Test this pull request on the Playground](https://playground.wordpress.net/#{"landingPage":"/wp-admin/admin.php?page=progress-planner","features":{"networking":true},"login":true,"plugins":["https://github-proxy.com/proxy/?repo=${{ github.repository }}"],"steps":[{"step":"defineWpConfigConsts","consts":{"IS_PLAYGROUND_PREVIEW":true}}]}) or [download the zip](${{ github.server_url }}/${{ github.repository }}/archive/refs/heads/develop.zip).
19+
[Test this pull request on the Playground](https://playground.wordpress.net/?blueprint-url=https%3A%2F%2Fprogressplanner.com%2Fresearch%2Fblueprint-pp.php%3Frepo%3D${{ github.repository }}) or [download the zip](${{ github.server_url }}/${{ github.repository }}/archive/refs/heads/develop.zip).

.github/workflows/playground.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ jobs:
1313
with:
1414
message: |
1515
**Test on Playground**
16-
[Test this pull request on the Playground](https://playground.wordpress.net/#{"landingPage":"/wp-admin/admin.php?page=progress-planner","features":{"networking":true},"login":true,"plugins":["https://github-proxy.com/proxy/?repo=${{ github.repository }}&branch=${{ github.head_ref }}"],"steps":[{"step":"defineWpConfigConsts","consts":{"IS_PLAYGROUND_PREVIEW":true}}]}) or [download the zip](${{ github.server_url }}/${{ github.repository }}/archive/${{ github.sha }}.zip).
17-
16+
[Test this pull request on the Playground](https://playground.wordpress.net/?blueprint-url=https%3A%2F%2Fprogressplanner.com%2Fresearch%2Fblueprint-pp.php%3Frepo%3D${{ github.repository }}%26branch%3D${{ github.head_ref }}) or [download the zip](${{ github.server_url }}/${{ github.repository }}/archive/${{ github.sha }}.zip).

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
= 1.2.0 =
2+
3+
In this release we've [added an integration with the **Yoast SEO** plugin](https://prpl.fyi/v12), so you’ll now see personalized suggestions based on your current SEO configuration.
4+
5+
Added these recommendations from Ravi:
6+
7+
* Yoast SEO: [disable the author archive](https://prpl.fyi/yoast-author-archive)
8+
* Yoast SEO: [disable the date archive](https://prpl.fyi/yoast-date-archive)
9+
* Yoast SEO: [disable the format archives](https://prpl.fyi/yoast-format-archive)
10+
* Yoast SEO: [Remove emoji scripts](https://prpl.fyi/yoast-crawl-optimization-emoji-scripts)
11+
* Yoast SEO: [Remove post authors feeds](https://prpl.fyi/yoast-crawl-optimization-feed-authors)
12+
* Yoast SEO: [Remove global comment feeds](https://prpl.fyi/yoast-crawl-optimization-feed-global-comments)
13+
* Yoast SEO: [disable the media pages](https://prpl.fyi/yoast-media-pages)
14+
* Yoast SEO: set your [organization](https://prpl.fyi/yoast-organization-logo) or [person](https://prpl.fyi/yoast-person-logo) logo
15+
16+
Under the hood:
17+
* Changed how the titles and descriptions of one_time and repetitive tasks are defined to be compatible with WP 6.8.
18+
119
= 1.1.1 =
220

321
Bugs we fixed:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![WordPress Plugin Rating](https://img.shields.io/wordpress/plugin/stars/progress-planner.svg)](https://wordpress.org/support/plugin/progress-planner/reviews/)
1111
[![GitHub](https://img.shields.io/github/license/ProgressPlanner/progress-planner.svg)](https://github.com/ProgressPlanner/progress-planner/blob/main/LICENSE)
1212

13-
[![Try Progress Planner on the WordPress playground](https://img.shields.io/badge/Try%20Progress%20Planner%20on%20the%20WordPress%20Playground-%23117AC9.svg?style=for-the-badge&logo=WordPress&logoColor=ddd)](https://playground.wordpress.net/#{"landingPage":"/wp-admin/admin.php?page=progress-planner","features":{"networking":true},"login":true,"plugins":["https://github-proxy.com/proxy/?repo=ProgressPlanner/progress-planner"],"steps":[{"step":"defineWpConfigConsts","consts":{"IS_PLAYGROUND_PREVIEW":true}}]})
13+
[![Try Progress Planner on the WordPress playground](https://img.shields.io/badge/Try%20Progress%20Planner%20on%20the%20WordPress%20Playground-%23117AC9.svg?style=for-the-badge&logo=WordPress&logoColor=ddd)](https://playground.wordpress.net/?blueprint-url=https%3A%2F%2Fprogressplanner.com%2Fresearch%2Fblueprint-pp.php%3Frepo%3DProgressPlanner/progress-planner)
1414

1515
# Progress Planner
1616

assets/css/focus-element.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
gap: 0.25rem;
1717
background-color: #fff9f0;
1818
font-size: 0.75rem;
19-
border: 2px solid #faa310;
19+
border: 2px solid #faa310 !important;
2020
border-radius: 1rem;
2121
color: #534786;
2222
font-weight: 600;

assets/js/web-components/prpl-suggested-task.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ customElements.define(
2222
action = '',
2323
url = '',
2424
dismissable = false,
25-
providerID = '',
25+
provider_id = '',
2626
category = '',
2727
snoozable = true,
2828
order = false,
@@ -248,7 +248,7 @@ customElements.define(
248248
data-task-id="${ task_id }"
249249
data-task-action="${ action }"
250250
data-task-url="${ url }"
251-
data-task-provider-id="${ providerID }"
251+
data-task-provider-id="${ provider_id }"
252252
data-task-points="${ points }"
253253
data-task-category="${ category }"
254254
data-task-order="${ order }"

assets/js/widgets/todo.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,17 @@ document.addEventListener( 'prpl/suggestedTask/move', () => {
171171
// When the 'prpl/suggestedTask/update' event is triggered,
172172
// update the task title in the local tasks array.
173173
document.addEventListener( 'prpl/suggestedTask/update', ( event ) => {
174-
progressPlannerTodo.tasks.find(
174+
const task = progressPlannerTodo.tasks.find(
175175
( item ) =>
176176
item.task_id ===
177177
event.detail.node
178178
.querySelector( 'li' )
179179
.getAttribute( 'data-task-id' )
180-
).title = event.detail.node.querySelector( 'h3 span' ).textContent;
180+
);
181+
182+
if ( task ) {
183+
task.title = event.detail.node.querySelector( 'h3 span' ).textContent;
184+
}
181185
} );
182186

183187
document.addEventListener( 'prpl/suggestedTask/maybeInjectItem', ( event ) => {

assets/js/yoast-focus-element.js

Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
/* global progressPlannerYoastFocusElement, MutationObserver */
2+
/**
3+
* yoast-focus-element script.
4+
*
5+
*/
6+
7+
/**
8+
* Check if the value of the element matches the value specified in the task.
9+
*
10+
* @param {Element} element The element to check.
11+
* @param {Object} task The task to check.
12+
* @return {boolean} True if the value matches, false otherwise.
13+
*/
14+
function checkTaskValue( element, task ) {
15+
if ( ! task.valueElement ) {
16+
return true;
17+
}
18+
19+
const attributeName = task.valueElement.attributeName || 'value';
20+
const attributeValue = task.valueElement.attributeValue;
21+
const operator = task.valueElement.operator || '=';
22+
const currentValue = element.getAttribute( attributeName ) || '';
23+
24+
return '!=' === operator
25+
? currentValue !== attributeValue
26+
: currentValue === attributeValue;
27+
}
28+
29+
/**
30+
* Observe the Yoast sidebar clicks.
31+
*/
32+
function observeYoastSidebarClicks() {
33+
const container = document.querySelector( '#yoast-seo-settings' );
34+
35+
if ( ! container ) {
36+
return;
37+
}
38+
39+
const waitForNav = new MutationObserver( ( mutationsList, observer ) => {
40+
const nav = container.querySelector(
41+
'nav.yst-sidebar-navigation__sidebar'
42+
);
43+
if ( nav ) {
44+
// Sidebar nav loaded.
45+
observer.disconnect();
46+
47+
nav.addEventListener( 'click', ( e ) => {
48+
const link = e.target.closest( 'a' );
49+
if ( link ) {
50+
// Sidebar link clicked.
51+
waitForMainAndObserveContent(); // re-run logic after clicking
52+
}
53+
} );
54+
}
55+
} );
56+
57+
waitForNav.observe( container, {
58+
childList: true,
59+
subtree: true,
60+
} );
61+
}
62+
63+
/**
64+
* Wait for the main content to load and observe the content.
65+
*/
66+
function waitForMainAndObserveContent() {
67+
const container = document.querySelector( '#yoast-seo-settings' );
68+
if ( ! container ) {
69+
return;
70+
}
71+
72+
const waitForMain = new MutationObserver( ( mutationsList, observer ) => {
73+
const main = container.querySelector( 'main.yst-paper' );
74+
if ( main ) {
75+
// Main loaded.
76+
observer.disconnect();
77+
78+
const childObserver = new MutationObserver( ( mutations ) => {
79+
for ( const mutation of mutations ) {
80+
if (
81+
mutation.type === 'attributes' &&
82+
mutation.attributeName === 'class'
83+
) {
84+
const el = mutation.target;
85+
if (
86+
el.parentElement === main &&
87+
el.classList.contains( 'yst-opacity-100' )
88+
) {
89+
// Fully loaded content.
90+
childObserver.disconnect();
91+
92+
// Loop through the tasks and add the focus element.
93+
for ( const task of progressPlannerYoastFocusElement.tasks ) {
94+
// Try to find the toggleButton.
95+
const valueElement = el.querySelector(
96+
task.valueElement.elementSelector
97+
);
98+
let raviIconPositionAbsolute = true;
99+
100+
if ( valueElement ) {
101+
// We usually add icon to the option header.
102+
let addIconElement = valueElement.closest(
103+
task.iconElement
104+
);
105+
106+
// Exception is the upload input field.
107+
if (
108+
! addIconElement &&
109+
valueElement.type === 'hidden'
110+
) {
111+
addIconElement = valueElement
112+
.closest( 'fieldset' )
113+
.querySelector( task.iconElement );
114+
115+
raviIconPositionAbsolute = false;
116+
}
117+
118+
// Upload input field.
119+
if ( ! addIconElement ) {
120+
continue;
121+
}
122+
123+
// Append next to the valueElemen, only if it's not already there.
124+
if (
125+
! addIconElement.querySelector(
126+
'.prpl-form-row-ravi'
127+
)
128+
) {
129+
// Check for value if specified in task.
130+
const valueMatches = checkTaskValue(
131+
valueElement,
132+
task
133+
);
134+
135+
// Create a new span with the class prpl-form-row-ravi.
136+
const raviIconWrapper =
137+
document.createElement( 'span' );
138+
raviIconWrapper.classList.add(
139+
'prpl-form-row-ravi',
140+
'prpl-element-awards-points-icon-wrapper'
141+
);
142+
143+
if ( valueMatches ) {
144+
raviIconWrapper.classList.add(
145+
'complete'
146+
);
147+
}
148+
149+
// Styling for absolute positioning.
150+
if ( raviIconPositionAbsolute ) {
151+
addIconElement.style.position =
152+
'relative';
153+
154+
raviIconWrapper.style.position =
155+
'absolute';
156+
raviIconWrapper.style.right =
157+
'3.5rem';
158+
raviIconWrapper.style.top = '-7px';
159+
}
160+
161+
raviIconWrapper.appendChild(
162+
document.createElement( 'span' )
163+
);
164+
165+
// Create an icon image.
166+
const iconImg =
167+
document.createElement( 'img' );
168+
iconImg.src =
169+
progressPlannerYoastFocusElement.base_url +
170+
'/assets/images/icon_progress_planner.svg';
171+
iconImg.alt = 'Ravi';
172+
iconImg.width = 16;
173+
iconImg.height = 16;
174+
175+
// Append the icon image to the raviIconWrapper.
176+
raviIconWrapper
177+
.querySelector( 'span' )
178+
.appendChild( iconImg );
179+
180+
// Add the points to the raviIconWrapper.
181+
const pointsWrapper =
182+
document.createElement( 'span' );
183+
pointsWrapper.classList.add(
184+
'prpl-form-row-points'
185+
);
186+
pointsWrapper.textContent = valueMatches
187+
? '✓'
188+
: '+1';
189+
raviIconWrapper.appendChild(
190+
pointsWrapper
191+
);
192+
193+
// Finally add the raviIconWrapper to the DOM.
194+
addIconElement.appendChild(
195+
raviIconWrapper
196+
);
197+
198+
// Watch for changes in aria-checked to update the icon dynamically
199+
const valueElementObserver =
200+
new MutationObserver( () => {
201+
// Check value again if specified
202+
const currentValueMatches =
203+
checkTaskValue(
204+
valueElement,
205+
task
206+
);
207+
208+
if ( currentValueMatches ) {
209+
raviIconWrapper.classList.add(
210+
'complete'
211+
);
212+
213+
pointsWrapper.textContent =
214+
'✓';
215+
} else {
216+
raviIconWrapper.classList.remove(
217+
'complete'
218+
);
219+
220+
pointsWrapper.textContent =
221+
'+1';
222+
}
223+
} );
224+
225+
valueElementObserver.observe(
226+
valueElement,
227+
{
228+
attributes: true,
229+
attributeFilter: [
230+
task.valueElement
231+
.attributeName,
232+
],
233+
}
234+
);
235+
}
236+
}
237+
}
238+
}
239+
}
240+
}
241+
} );
242+
243+
// Watch direct children of main.yst-paper
244+
main.querySelectorAll( ':scope > *' ).forEach( ( child ) => {
245+
childObserver.observe( child, {
246+
attributes: true,
247+
attributeFilter: [ 'class' ],
248+
} );
249+
} );
250+
}
251+
} );
252+
253+
waitForMain.observe( container, {
254+
childList: true,
255+
subtree: true,
256+
} );
257+
}
258+
259+
// Run once on initial page load.
260+
waitForMainAndObserveContent();
261+
observeYoastSidebarClicks();

classes/actions/class-content-scan.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public function ajax_reset_posts_data() {
8080
\progress_planner()->get_settings()->set( static::LAST_SCANNED_PAGE_OPTION, 0 );
8181

8282
// Reset the activities.
83-
$activities = \progress_planner()->get_query()->query_activities( [ 'category' => 'content' ] );
84-
\progress_planner()->get_query()->delete_activities( $activities );
83+
$activities = \progress_planner()->get_activities__query()->query_activities( [ 'category' => 'content' ] );
84+
\progress_planner()->get_activities__query()->delete_activities( $activities );
8585

8686
// Reset the word count.
8787
\progress_planner()->get_settings()->set( 'word_count', [] );
@@ -177,6 +177,6 @@ public function insert_activities( $posts ) {
177177
\progress_planner()->get_activities__content_helpers()->get_word_count( $post->post_content, $post->ID );
178178
}
179179

180-
\progress_planner()->get_query()->insert_activities( $activities );
180+
\progress_planner()->get_activities__query()->insert_activities( $activities );
181181
}
182182
}

0 commit comments

Comments
 (0)