Skip to content

Commit

Permalink
Merge pull request #1626 from publishpress/release-4.2.0
Browse files Browse the repository at this point in the history
Release 4.2.0
  • Loading branch information
olatechpro authored May 16, 2024
2 parents a525d23 + 54c0b6a commit 6b09d66
Show file tree
Hide file tree
Showing 34 changed files with 8,052 additions and 1,830 deletions.
4 changes: 4 additions & 0 deletions common/css/publishpress-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ Status color box */
float: left;
}

.wrap.publishpress-admin .nav-tab-wrapper a {
margin-top: 10px;
}

.pp-admin-notice {
padding: 10px !important;
line-height: 18px;
Expand Down
3 changes: 3 additions & 0 deletions common/js/pp_date.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jQuery(document).ready(function ($) {
controlType: 'select',
altFieldTimeOnly: false
});
if (self.hasClass('future-date')) {
options.minDate = new Date();
}
self.datetimepicker(options);
});

Expand Down
67 changes: 66 additions & 1 deletion common/php/class-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,71 @@ public function get_post_statuses()
return $publishpress->getPostStatuses();
}



/**
* Returns the CSS class name and color for the given custom status.
* It reutrns an array with the following keys:
* - icon
* - color
*
* @param string $post_status
*
* @return array
*/
public function get_post_status_options($post_status)
{
global $publishpress;

// Check if we have a custom icon for this post_status
$term = $publishpress->getPostStatusBy('slug', $post_status);

// Icon
$icon = null;
if (! empty($term->icon)) {
$icon = $term->icon;
} else {
// Add an icon for the items
$default_icons = [
'publish' => 'dashicons-yes',
'future' => 'dashicons-calendar-alt',
'private' => 'dashicons-lock',
'draft' => 'dashicons-media-default',
'pending' => 'dashicons-clock',
'auto-draft' => 'dashicons-edit',
];

$icon = isset($default_icons[$post_status]) ? $default_icons[$post_status] : 'dashicons-edit';
}

// Color
if (! empty($term->color)) {
$color = $term->color;
} else {
$default_status_colors = [
'pitch' => '#cc0000',
'assigned' => '#00bcc5',
'in-progress' => '#ccc500',
'draft' => '#f91d84',
'pending' => '#d87200',
'private' => '#000000',
'future' => '#655997',
'publish' => '#655997',
];

if (isset($default_status_colors[$post_status])) {
$color = $default_status_colors[$post_status];
} else {
$color = (class_exists('PublishPress_Statuses')) ? \PublishPress_Statuses::DEFAULT_COLOR : '#78645a';
}
}

return [
'color' => $color,
'icon' => $icon,
];
}

/**
* Get core's 'draft' and 'pending' post statuses, but include our special attributes
*
Expand Down Expand Up @@ -437,7 +502,7 @@ public function print_ajax_response($status, $message = '', $data = null)
*/
protected function is_whitelisted_functional_view($module_name = null)
{
$whitelisted_pages = ['pp-calendar', 'pp-content-overview', 'pp-notif-log', 'pp-modules-settings'];
$whitelisted_pages = ['pp-calendar', 'pp-content-overview', 'pp-content-board', 'pp-notif-log', 'pp-modules-settings'];

if (isset($_GET['page']) && in_array($_GET['page'], $whitelisted_pages)) {
return true;
Expand Down
Loading

0 comments on commit 6b09d66

Please sign in to comment.