Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve-content-overview-screen #1569

Merged
merged 2 commits into from
Apr 3, 2024
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
1 change: 1 addition & 0 deletions common/libs/floating-scroll/css/jquery.floatingscroll.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions common/libs/floating-scroll/js/jquery.floatingscroll.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions common/php/class-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,5 +803,45 @@ public static function isPublishPressModuleEnabled($module_slug)
return isset($publishpress->{$module_slug})
&& $publishpress->{$module_slug}->module->options->enabled === 'on';
}

public function getUserAuthorizedPostStatusOptions($postType)
{
$postStatuses = $this->getPostStatusOptions();

foreach ($postStatuses as $index => $status) {
// Filter publishing posts if the post type is set
if (in_array($status['value'], ['publish', 'future', 'private'])) {
$postTypeObj = get_post_type_object($postType);
if (! current_user_can($postTypeObj->cap->publish_posts)) {
unset($postStatuses[$index]);
}
}
}

return $postStatuses;
}

public function getPostStatusOptions()
{
$postStatuses = [];
$post_statuses_terms = get_terms('post_status', ['hide_empty' => false]);
$post_statuses_terms_slugs = (!is_wp_error($post_statuses_terms)) ? array_column($post_statuses_terms, 'slug') : [];
foreach ($this->get_post_statuses() as $status) {
//add support for capabilities custom statuses
if (defined('PUBLISHPRESS_CAPS_PRO_VERSION')
&& !empty(get_option('cme_custom_status_control'))
&& in_array($status->slug, $post_statuses_terms_slugs)
&& !current_user_can('status_change_' . $status->slug)
) {
continue;
}
$postStatuses[] = [
'value' => esc_attr($status->slug),
'text' => esc_html($status->label),
];
}

return $postStatuses;
}
}
}
38 changes: 38 additions & 0 deletions common/php/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,41 @@ function pp_get_users_with_author_permissions()
return apply_filters('pp_get_users_eligible_to_be_authors', $authors);
}
}

if (!function_exists('pp_planner_admin_notice')) {
/**
* Show admin notices function for use with admin_notices hook.
*
* Constructs admin notice HTML.
*
* @param string $message Message to use in admin notice. Optional. Default empty string.
* @param bool $success Whether or not a success. Optional. Default true.
* @return mixed
*/
function pp_planner_admin_notice($message = '', $success = true)
{

$class = [];
$class[] = $success ? 'updated' : 'error';
$class[] = 'notice is-dismissible';

$messagewrapstart = '<div id="message" class="' . esc_attr(implode(' ', $class)) . '"><p>';

$messagewrapend = '</p></div>';

$action = '';

/**
* Filters the custom admin notice for ppma.
*
*
* @param string $value Complete HTML output for notice.
* @param string $action Action whose message is being generated.
* @param string $message The message to be displayed.
* @param string $messagewrapstart Beginning wrap HTML.
* @param string $messagewrapend Ending wrap HTML.
*/
return apply_filters('ppch_admin_notice', $messagewrapstart . $message . $messagewrapend, $action, $message,
$messagewrapstart, $messagewrapend);
}
}
10 changes: 0 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
{
"type": "git",
"url": "https://github.com/publishpress/wp-browser"
},
{
"type": "vcs",
"url": "https://github.com/publishpress/publishpress-phpcs-standards"
}
],
"require": {
"php": ">=7.2.5"
Expand All @@ -29,7 +21,6 @@
"bartlett/php-compatinfo": "^5.2",
"overtrue/phplint": "^2.1",
"automattic/vipwpcs": "^2.2",
"publishpress/wp-browser": "2.6.5.2",
"codeception/module-phpbrowser": "^1.0.0",
"codeception/module-asserts": "^1.0.0",
"codeception/module-webdriver": "^1.0",
Expand All @@ -40,7 +31,6 @@
"mustache/mustache": "2.14.1",
"squizlabs/php_codesniffer": "3.*",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"publishpress/publishpress-phpcs-standards": "dev-main",
"phpcompatibility/php-compatibility": "*"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if (! defined('PP_LOADED')) {
if (! defined('PUBLISHPRESS_VERSION')) {
// Define constants
define('PUBLISHPRESS_VERSION', '4.0.3');
define('PUBLISHPRESS_VERSION', '4.0.4-beta.2');
define('PUBLISHPRESS_BASE_PATH', __DIR__);
define('PUBLISHPRESS_VIEWS_PATH', __DIR__ . '/views');
define('PUBLISHPRESS_FILE_PATH', PUBLISHPRESS_BASE_PATH . '/publishpress.php');
Expand Down
2 changes: 1 addition & 1 deletion lib/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions lib/vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitPublishPressPlanner::getLoader();
Loading
Loading