Skip to content

Commit

Permalink
Merge pull request #1518 from publishpress/release-4.0.1
Browse files Browse the repository at this point in the history
Release 4.0.1
  • Loading branch information
olatechpro authored Jan 4, 2024
2 parents 93cb721 + c520698 commit 392855d
Show file tree
Hide file tree
Showing 73 changed files with 5,432 additions and 10,413 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ node_modules
builder.yml
builder.yml.dist
.editorconfig
/cache

!tests/_support/.gitkeep
tests/_support/*
Expand Down
9 changes: 7 additions & 2 deletions common/css/publishpress-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,12 @@ div.pp-icon img {
Status color box */

.pp-status-color {
width: 10px;
height: 10px;
display: inline-block;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-o-border-radius: 3px;
padding: 2px 5px 2px 5px;
}

.pp-status-color + strong {
Expand Down Expand Up @@ -245,6 +244,12 @@ Status color box */
float: left;
}

.pp-admin-notice {
padding: 10px !important;
line-height: 18px;
position: relative;
}

@media (max-width: 1199px) {

.pp-columns-wrapper.pp-enable-sidebar .pp-column-left,
Expand Down
55 changes: 25 additions & 30 deletions common/php/class-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public function module_enabled($slug)
{
global $publishpress;

if ('custom_status' == $slug) {
return class_exists('PublishPress_Statuses');
}

return isset($publishpress->$slug) && $publishpress->$slug->module->options->enabled == 'on';
}

Expand Down Expand Up @@ -180,7 +184,6 @@ public function get_post_types_for_module($module)

/**
* Get all of the currently available post statuses
* This should be used in favor of calling $publishpress->custom_status->get_custom_statuses() directly
*
* @return array $post_statuses All of the post statuses that aren't a published state
*
Expand All @@ -190,11 +193,7 @@ public function get_post_statuses()
{
global $publishpress;

if ($this->module_enabled('custom_status')) {
return $publishpress->custom_status->get_custom_statuses();
} else {
return $this->get_core_post_statuses();
}
return $publishpress->getPostStatuses();
}

/**
Expand All @@ -206,26 +205,22 @@ public function get_post_statuses()
*/
protected function get_core_post_statuses()
{
return [
(object)[
'name' => __('Draft'),
'description' => '',
'slug' => 'draft',
'position' => 1,
],
(object)[
'name' => __('Pending Review'),
'description' => '',
'slug' => 'pending',
'position' => 2,
],
(object)[
'name' => __('Published'),
'description' => '',
'slug' => 'publish',
'position' => 3,
],
];
global $publishpress;

return $publishpress->getCorePostStatuses();
}

/**
* Back compat for existing code calling $publishpress->custom_status->get_custom_status_by()
*
* @return object
*
* @since 4.0
*/
public function get_custom_status_by($field, $value) {
global $publishpress;

return $publishpress->getPostStatusBy($field, $value);
}

/**
Expand Down Expand Up @@ -273,11 +268,11 @@ public function get_post_status_friendly_name($status)
];

// Custom statuses only handles workflow statuses
if ($this->module_enabled('custom_status')
&& !in_array($status, ['publish', 'future', 'private', 'trash'])) {
$status_object = $publishpress->custom_status->get_custom_status_by('slug', $status);
if (!in_array($status, ['publish', 'future', 'private', 'trash'])) {
$status_object = $publishpress->getPostStatusBy('slug', $status);

if ($status_object && !is_wp_error($status_object)) {
$status_friendly_name = $status_object->name;
$status_friendly_name = $status_object->label;
}
} elseif (array_key_exists($status, $builtin_stati)) {
$status_friendly_name = $builtin_stati[$status];
Expand Down
Loading

0 comments on commit 392855d

Please sign in to comment.