Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions classes/actions/class-content-scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function update_stats() {
[
'posts_per_page' => static::SCAN_POSTS_PER_PAGE,
'paged' => $current_page,
'post_type' => $content_helpers->get_post_types_names(),
'post_type' => \progress_planner()->get_settings()->get_post_types_names(),
'post_status' => 'publish',
]
);
Expand Down Expand Up @@ -102,7 +102,7 @@ public function get_total_pages() {

// Get the total number of posts.
$total_posts_count = 0;
foreach ( $content_helpers->get_post_types_names() as $post_type ) {
foreach ( \progress_planner()->get_settings()->get_post_types_names() as $post_type ) {
$total_posts_count += \wp_count_posts( $post_type )->publish;
}
// Calculate the total pages to scan.
Expand Down
2 changes: 1 addition & 1 deletion classes/actions/class-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private function should_skip_saving( $post ) {
// Bail if the post is not included in the post-types we're tracking.
if ( ! \in_array(
$post->post_type,
$content_helpers->get_post_types_names(),
\progress_planner()->get_settings()->get_post_types_names(),
true
) ) {
return true;
Expand Down
13 changes: 3 additions & 10 deletions classes/activities/class-content-helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,12 @@ class Content_Helpers {
/**
* Get an array of post-types names for the stats.
*
* @deprecated 1.9.2 Use \progress_planner()->get_settings()->get_post_types_names() instead.
*
* @return string[]
*/
public function get_post_types_names() {
static $include_post_types;
if ( isset( $include_post_types ) && ! empty( $include_post_types ) ) {
return $include_post_types;
}
$default = [ 'post', 'page' ];
$include_post_types = \array_filter(
\progress_planner()->get_settings()->get( [ 'include_post_types' ], $default ),
fn( $post_type ) => $post_type && \post_type_exists( $post_type ) && \is_post_type_viewable( $post_type )
);
return empty( $include_post_types ) ? $default : \array_values( $include_post_types );
return \progress_planner()->get_settings()->get_post_types_names();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/admin/widgets/class-content-activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function filter_activities( $activities ) {
$activities,
fn( $activity ) => 'delete' === $activity->type
|| ( \is_object( $activity->get_post() )
&& \in_array( $activity->get_post()->post_type, \progress_planner()->get_activities__content_helpers()->get_post_types_names(), true )
&& \in_array( $activity->get_post()->post_type, \progress_planner()->get_settings()->get_post_types_names(), true )
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion classes/badges/content/class-content-curator.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function progress_callback( $args = [] ) {

// Get the total number of posts.
$total_posts_count = 0;
foreach ( \progress_planner()->get_activities__content_helpers()->get_post_types_names() as $post_type ) {
foreach ( \progress_planner()->get_settings()->get_post_types_names() as $post_type ) {
$total_posts_count += \wp_count_posts( $post_type )->publish;
}

Expand Down
2 changes: 1 addition & 1 deletion views/page-widgets/content-activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
];

$prpl_tracked_post_types = \progress_planner()->get_activities__content_helpers()->get_post_types_names();
$prpl_tracked_post_types = \progress_planner()->get_settings()->get_post_types_names();
$prpl_activities_count = [
'all' => 0,
];
Expand Down
Loading