diff --git a/common/libs/floating-scroll/css/jquery.floatingscroll.css b/common/libs/floating-scroll/css/jquery.floatingscroll.css new file mode 100644 index 000000000..47cddfef8 --- /dev/null +++ b/common/libs/floating-scroll/css/jquery.floatingscroll.css @@ -0,0 +1 @@ +.fl-scrolls{overflow:auto;position:fixed}.fl-scrolls div{overflow:hidden;pointer-events:none}.fl-scrolls div::before{content:"\A0"}.fl-scrolls,.fl-scrolls div{font-size:1px;line-height:0;margin:0;padding:0}.fl-scrolls-hidden div::before{content:"\A0\A0"}.fl-scrolls-viewport{position:relative}.fl-scrolls-body{overflow:auto}.fl-scrolls-viewport .fl-scrolls{position:absolute}.fl-scrolls-hoverable .fl-scrolls{opacity:0;transition:opacity .5s .3s}.fl-scrolls-hoverable:hover .fl-scrolls{opacity:1}.fl-scrolls:not([data-orientation]),.fl-scrolls[data-orientation=horizontal]{bottom:0;min-height:17px}.fl-scrolls:not([data-orientation]) div,.fl-scrolls[data-orientation=horizontal] div{height:1px}.fl-scrolls-hidden.fl-scrolls:not([data-orientation]),.fl-scrolls-hidden.fl-scrolls[data-orientation=horizontal]{bottom:9999px}.fl-scrolls-viewport .fl-scrolls:not([data-orientation]),.fl-scrolls-viewport .fl-scrolls[data-orientation=horizontal]{left:0}.fl-scrolls[data-orientation=vertical]{right:0;min-width:17px}.fl-scrolls[data-orientation=vertical] div{width:1px}.fl-scrolls-hidden.fl-scrolls[data-orientation=vertical]{right:9999px}.fl-scrolls-viewport .fl-scrolls[data-orientation=vertical]{top:0} \ No newline at end of file diff --git a/common/libs/floating-scroll/js/jquery.floatingscroll.min.js b/common/libs/floating-scroll/js/jquery.floatingscroll.min.js new file mode 100644 index 000000000..ccfef61a5 --- /dev/null +++ b/common/libs/floating-scroll/js/jquery.floatingscroll.min.js @@ -0,0 +1,6 @@ +/*! +floating-scroll v3.2.0 +https://amphiluke.github.io/floating-scroll/ +(c) 2024 Amphiluke +*/ +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).jQuery)}(this,(function(t){"use strict";var n="horizontal",i="vertical",e={init:function(t,i){var e=this;e.orientationProps=function(t){var i=t===n;return{ORIENTATION:t,SIZE:i?"width":"height",X_SIZE:i?"height":"width",OFFSET_SIZE:i?"offsetWidth":"offsetHeight",OFFSET_X_SIZE:i?"offsetHeight":"offsetWidth",CLIENT_SIZE:i?"clientWidth":"clientHeight",CLIENT_X_SIZE:i?"clientHeight":"clientWidth",INNER_X_SIZE:i?"innerHeight":"innerWidth",SCROLL_SIZE:i?"scrollWidth":"scrollHeight",SCROLL_POS:i?"scrollLeft":"scrollTop",START:i?"left":"top",X_START:i?"top":"left",X_END:i?"bottom":"right"}}(i);var o=t.closest(".fl-scrolls-body");o.length&&(e.scrollBody=o),e.container=t[0],e.visible=!0,e.initWidget(),e.updateAPI(),e.addEventHandlers(),e.skipSyncContainer=e.skipSyncWidget=!1},initWidget:function(){var n=this,i=n.orientationProps,e=i.ORIENTATION,o=i.SIZE,r=i.SCROLL_SIZE,c=n.widget=t('
');t("").appendTo(c)[o](n.container[r]),c.appendTo(n.container)},addEventHandlers:function(){var n=this;(n.eventHandlers=[{$el:t(window),handlers:{"destroyDetached.fscroll":function(t){"fscroll"===t.namespace&&n.destroyDetachedAPI()}}},{$el:n.scrollBody||t(window),handlers:{scroll:function(){n.updateAPI()},resize:function(){n.updateAPI()}}},{$el:n.widget,handlers:{scroll:function(){n.visible&&!n.skipSyncContainer&&n.syncContainer(),n.skipSyncContainer=!1}}},{$el:t(n.container),handlers:{scroll:function(){n.skipSyncWidget||n.syncWidget(),n.skipSyncWidget=!1},focusin:function(){setTimeout((function(){n.widget&&n.syncWidget()}),0)},"update.fscroll":function(t){"fscroll"===t.namespace&&n.updateAPI()},"destroy.fscroll":function(t){"fscroll"===t.namespace&&n.destroyAPI()}}}]).forEach((function(t){var n=t.$el,i=t.handlers;return n.bind(i)}))},checkVisibility:function(){var t=this,n=t.widget,i=t.container,e=t.scrollBody,o=t.orientationProps,r=o.SCROLL_SIZE,c=o.OFFSET_SIZE,s=o.X_START,l=o.X_END,d=o.INNER_X_SIZE,a=o.CLIENT_X_SIZE,f=n[0][r]<=n[0][c];if(!f){var u=i.getBoundingClientRect(),h=e?e[0].getBoundingClientRect()[l]:window[d]||document.documentElement[a];f=u[l]<=h||u[s]>h}t.visible===f&&(t.visible=!f,n.toggleClass("fl-scrolls-hidden"))},syncContainer:function(){var t=this,n=t.orientationProps.SCROLL_POS,i=t.widget[0][n];t.container[n]!==i&&(t.skipSyncWidget=!0,t.container[n]=i)},syncWidget:function(){var t=this,n=t.orientationProps.SCROLL_POS,i=t.container[n];t.widget[0][n]!==i&&(t.skipSyncContainer=!0,t.widget[0][n]=i)},updateAPI:function(){var n=this,i=n.orientationProps,e=i.SIZE,o=i.X_SIZE,r=i.OFFSET_X_SIZE,c=i.CLIENT_SIZE,s=i.CLIENT_X_SIZE,l=i.SCROLL_SIZE,d=i.START,a=n.widget,f=n.container,u=n.scrollBody,h=f[c],S=f[l];a[e](h),u||a.css(d,f.getBoundingClientRect()[d]+"px"),t("div",a)[e](S),S>h&&a[o](a[0][r]-a[0][s]+1),n.syncWidget(),n.checkVisibility()},destroyAPI:function(){var t=this;t.eventHandlers.forEach((function(t){var n=t.$el,i=t.handlers;return n.unbind(i)})),t.widget.remove(),t.eventHandlers=t.widget=t.container=t.scrollBody=null},destroyDetachedAPI:function(){t.contains(document.body,this.container)||this.destroyAPI()}};t.fn.floatingScroll=function(o,r){if(void 0===o&&(o="init"),void 0===r&&(r={}),"init"===o){var c=r.orientation,s=void 0===c?n:c;if(s!==n&&s!==i)throw new Error("Scrollbar orientation should be either “"+n+"” or “"+i+"”");this.each((function(n,i){return Object.create(e).init(t(i),s)}))}else Object.prototype.hasOwnProperty.call(e,o+"API")&&this.trigger(o+".fscroll");return this},t((function(){t("body [data-fl-scrolls]").each((function(n,i){var e=t(i);e.floatingScroll("init",e.data("flScrolls")||{})}))}))})); diff --git a/common/php/class-module.php b/common/php/class-module.php index 76e1147b5..d853d4783 100644 --- a/common/php/class-module.php +++ b/common/php/class-module.php @@ -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; + } } } diff --git a/common/php/util.php b/common/php/util.php index 2eda1e7fe..909382fe3 100644 --- a/common/php/util.php +++ b/common/php/util.php @@ -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 = ''; + + $messagewrapend = '
+ + | ++ + + + + + + + + + + + + + + + + + + | +
---|