diff --git a/.gitignore b/.gitignore index 56f1334c..196a8ef2 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ node_modules builder.yml builder.yml.dist .editorconfig +/cache !tests/_support/.gitkeep tests/_support/* diff --git a/dev-workspace/build b/dev-workspace/build index 54684e85..f938e856 100755 --- a/dev-workspace/build +++ b/dev-workspace/build @@ -1,3 +1,3 @@ #!/usr/bin/env bash -DOCKER_HOST_IP=$(php ./scripts/getip) docker compose -f docker/compose.yaml build +docker compose -f docker/compose.yaml build diff --git a/dev-workspace/build-push b/dev-workspace/build-push index 4cdecdfe..88d8f5d3 100755 --- a/dev-workspace/build-push +++ b/dev-workspace/build-push @@ -2,4 +2,4 @@ # This command requires to be logged in on Docker Hub. Check `docker login --help` for more information. -DOCKER_HOST_IP=$(php ./scripts/getip) docker buildx build --platform linux/amd64,linux/arm64 --push -t publishpress/dev-workspace-terminal:planner-free-2 ./docker +docker buildx build --platform linux/amd64,linux/arm64 --push -t publishpress/dev-workspace-terminal:planner-free-2 ./docker diff --git a/dev-workspace/docker/compose.yaml b/dev-workspace/docker/compose.yaml index cddc6b7f..1f72fbb3 100644 --- a/dev-workspace/docker/compose.yaml +++ b/dev-workspace/docker/compose.yaml @@ -1,7 +1,7 @@ name: devworkspace_planner_free services: terminal: - build: ./docker + build: ./ image: publishpress/dev-workspace-terminal:planner-free-2 command: ["zsh"] stdin_open: true @@ -17,7 +17,3 @@ services: - ../cache/.composer/cache:/root/.composer/cache - ../cache/.composer/auth.json:/root/.composer/auth.json - /var/run/docker.sock:/var/run/docker.sock - extra_hosts: - - "dockerhost:${DOCKER_HOST_IP}" - environment: - - DOCKER_HOST_IP=${DOCKER_HOST_IP} diff --git a/dev-workspace/run b/dev-workspace/run index b3cf172d..10a6bcf8 100755 --- a/dev-workspace/run +++ b/dev-workspace/run @@ -1,5 +1,10 @@ #!/usr/bin/env bash +# Make sure we are inside dev-workspace subdirectory. If not, enter it. +if [[ ! "$PWD" =~ dev-workspace$ ]]; then + cd dev-workspace +fi + # Create empty cache files if not exists. [[ -d cache/.npm/_cacache ]] || mkdir -p cache/.npm/_cacache [[ -d cache/.npm/_logs ]] || mkdir -p cache/.npm/_logs @@ -9,8 +14,6 @@ [[ -f cache/.bash_history ]] || touch cache/.bash_history [[ -f cache/.composer/auth.json ]] || echo '{}' > cache/.composer/auth.json -export DOCKER_HOST_IP=$(php ./scripts/getip) - is_online() { echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 diff --git a/dev-workspace/scripts/getip b/dev-workspace/scripts/getip deleted file mode 100755 index 52ac1728..00000000 --- a/dev-workspace/scripts/getip +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env php -module_url . 'lib/async-calendar/js/index.min.js', @@ -665,6 +666,7 @@ public function enqueue_admin_scripts() 'jquery-ui-droppable', 'jquery-inputmask', 'wp-i18n', + 'wp-element', 'date_i18n', ], PUBLISHPRESS_VERSION, @@ -725,7 +727,7 @@ public function enqueue_admin_scripts() $calendar_request_filter['post_type'] = $postType; } } - + if (isset($userFilters['weeks'])) { $weeks = sanitize_key($userFilters['weeks']); @@ -2260,7 +2262,7 @@ public function getCalendarDataForMultipleWeeks($args = [], $context = 'dashboar if (isset($this->module->options->sort_by)) { add_filter('posts_orderby', [$this, 'filterPostsOrderBy'], 10); } - + $post_results = new WP_Query($args); $posts = []; @@ -2741,22 +2743,22 @@ public function settings_show_posts_publish_time_option() if (empty($customStatuses)) { foreach ($statuses as $status) { $id = esc_attr($status) . '-display-publish-time'; - + echo '
'; - + echo '
'; } } else { @@ -2776,11 +2778,11 @@ public function settings_show_posts_publish_time_option() // Defining post_type_supports in the functions.php file or similar should disable the checkbox disabled(post_type_supports($status, $this->module->post_type_support), true); - + echo ' type="checkbox" value="on" /> '; - + echo ' '; - + $style = 'background:' . $arr_status['status_obj']->color . '; color:white'; echo '' @@ -2801,7 +2803,7 @@ public function settings_show_posts_publish_time_option() $_args ) ); - + echo ' ' . __('edit') . ''; } @@ -3157,8 +3159,8 @@ public function searchAuthors() * @param array $args */ $results = apply_filters( - 'publishpress_search_authors_with_args_results_pre_search', - [], + 'publishpress_search_authors_with_args_results_pre_search', + [], ['search' => $queryText, 'role__in' => $user_roles] ); } @@ -3415,7 +3417,7 @@ public function fetchCalendarDataJson() * Update the current user's filters for calendar display with the filters in $_GET($request_filter). The filters * in $_GET($request_filter) take precedence over the current users filters if they exist. * @param array $request_filter - * + * * @return array $filters updated filter */ public function update_user_filters($request_filter) @@ -3614,7 +3616,7 @@ public function getPostData() public function getPostTypeFields() { global $publishpress; - + if (! wp_verify_nonce(sanitize_text_field($_GET['nonce']), 'publishpress-calendar-get-data')) { wp_send_json([], 403); } diff --git a/modules/calendar/lib/async-calendar/js/AsyncCalendar.jsx b/modules/calendar/lib/async-calendar/js/AsyncCalendar.jsx index 3bb43a72..010e45c4 100644 --- a/modules/calendar/lib/async-calendar/js/AsyncCalendar.jsx +++ b/modules/calendar/lib/async-calendar/js/AsyncCalendar.jsx @@ -15,7 +15,7 @@ export default function AsyncCalendar(props) { let statusValue = (props.requestFilter.post_status) ? props.requestFilter.post_status : ''; let typesValue = (props.requestFilter.post_type) ? props.requestFilter.post_type : ''; let weeksValue = (props.requestFilter.weeks) ? props.requestFilter.weeks : props.numberOfWeeksToDisplay; - + let categoryValue = ''; if (props.requestFilter.category && props.requestFilter.category.value) { categoryValue = props.requestFilter.category.value; @@ -25,12 +25,12 @@ export default function AsyncCalendar(props) { if (props.requestFilter.post_tag && props.requestFilter.post_tag.value) { postTagValue = props.requestFilter.post_tag.value; } - + let authorValue = ''; if (props.requestFilter.post_author && props.requestFilter.post_author.value) { authorValue = props.requestFilter.post_author.value; } - + const [firstDateToDisplay, setFirstDateToDisplay] = React.useState(getBeginDateOfWeekByDate(props.firstDateToDisplay, props.weekStartsOnSunday)); const [numberOfWeeksToDisplay, setNumberOfWeeksToDisplay] = React.useState(weeksValue); const [itemsByDate, setItemsByDate] = React.useState(props.items); @@ -454,7 +454,7 @@ export default function AsyncCalendar(props) { if (dayIndexInTheRow === 7) { dayIndexInTheRow = 0; tableRows.push( - {rowCells} + {rowCells} ); } diff --git a/modules/calendar/lib/async-calendar/js/DayCell.jsx b/modules/calendar/lib/async-calendar/js/DayCell.jsx index ebee9272..ec6f4b0f 100644 --- a/modules/calendar/lib/async-calendar/js/DayCell.jsx +++ b/modules/calendar/lib/async-calendar/js/DayCell.jsx @@ -55,7 +55,6 @@ export default function DayCell(props) { return ( {label} ); diff --git a/modules/calendar/lib/async-calendar/js/Functions.jsx b/modules/calendar/lib/async-calendar/js/Functions.jsx index 27cdded8..73362ebb 100644 --- a/modules/calendar/lib/async-calendar/js/Functions.jsx +++ b/modules/calendar/lib/async-calendar/js/Functions.jsx @@ -136,9 +136,9 @@ export function getDateWithNoTimezoneOffset(dateString) { export function getPostLinksElement(linkData, handleOnClick) { if (linkData.url) { - return ({linkData.label}); + return ({linkData.label}); } else if (linkData.action) { - return ( handleOnClick(e, linkData)}>{linkData.label}); + return ( handleOnClick(e, linkData)}>{linkData.label}); } } diff --git a/modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx b/modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx index c0e58a02..0a7116f5 100644 --- a/modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx +++ b/modules/calendar/lib/async-calendar/js/ItemFormPopup.jsx @@ -241,7 +241,7 @@ export default function ItemFormPopup(props) { } fieldRows.push( - + {field} @@ -389,11 +389,11 @@ export default function ItemFormPopup(props) { linkData = formLinks[linkName]; if (savingLink === linkData.id) { - links.push({linkData.labelLoading}); + links.push({linkData.labelLoading}); } else { links.push(getPostLinksElement(linkData, handleLinkOnClick)); } - links.push(|); + links.push(|); } links.pop(); diff --git a/modules/calendar/lib/async-calendar/js/ItemPopup.jsx b/modules/calendar/lib/async-calendar/js/ItemPopup.jsx index f6480e27..6bddbff5 100644 --- a/modules/calendar/lib/async-calendar/js/ItemPopup.jsx +++ b/modules/calendar/lib/async-calendar/js/ItemPopup.jsx @@ -123,7 +123,7 @@ export default function ItemPopup(props) { } fieldRows.push( - + {dataProperty.label}: {field} @@ -155,15 +155,15 @@ export default function ItemPopup(props) { if (linkData.url) { links.push( - {linkData.label} + {linkData.label} ); } else if (linkData.action) { links.push( - handleOnClick(e, linkData)}>{linkData.label} + handleOnClick(e, linkData)}>{linkData.label} ); } - links.push(|); + links.push(|); } links.pop(); diff --git a/modules/calendar/lib/async-calendar/js/Select.jsx b/modules/calendar/lib/async-calendar/js/Select.jsx index 71e9f475..5f2dd303 100644 --- a/modules/calendar/lib/async-calendar/js/Select.jsx +++ b/modules/calendar/lib/async-calendar/js/Select.jsx @@ -86,7 +86,7 @@ export default function Select(props) { if (props.options) { options = props.options.map(option => { - return + return }); } @@ -98,6 +98,7 @@ export default function Select(props) { className += props.metadata ? 'pp-calendar-form-metafied ' + props.post_types : ''; return (