Skip to content

2.0 Beta 2#451

Merged
Justinabes007 merged 48 commits intomasterfrom
2.0-beta-2
Dec 3, 2024
Merged

2.0 Beta 2#451
Justinabes007 merged 48 commits intomasterfrom
2.0-beta-2

Conversation

@krugazul
Copy link
Collaborator

@krugazul krugazul commented Dec 3, 2024

Description

The following PR were concluded to close off Bugherd and Issues list in the Tour Operator Project.

Pull Requests

#445

#446

  • Making sure the trashed items are not used, BH 64,BH 77, BH 63
  • Moving the render block function
  • Updating the visibility for the featured and related blocks - Query Loop Variations for Related Content Display #431
  • Fixing the output of the tour custom field blocks.
  • Fixing the price includes and excludes innerBlock Structure
  • Fixing the display of the currencies 97
  • Fixing the php warnings
  • Updating the description if there is an empty departure day
  • Updating the Price filters to work on the single supplement as well BH 92.

#447

#450

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced styling for currency icons across multiple wrappers, ensuring consistent display and spacing.
    • Introduced new block variations for accommodation and tour itineraries, improving content organization and layout options.
  • Bug Fixes

    • Adjusted spacing and layout for various slider components, including arrows and dots for better user experience.
  • Chores

    • Removed obsolete files and functions that were no longer in use, streamlining the codebase.
  • Documentation

    • Updated the README file to reflect changes in contributors and compatibility with newer WordPress versions.

Summary by CodeRabbit

Release Notes for Pull Request

  • New Feature: Introduced a new block template for a gallery in the Tour Operator project, enhancing image display within a gallery wrapper.
  • Refactor: Streamlined CSS by removing unused code and updating class names for better styling. Improved HTML structure for displaying accommodation facilities.
  • Refactor: Updated block variations with new icons, categories, and attributes. Enhanced robustness by adding conditional checks before function calls.
  • Refactor: Modified currency retrieval logic and rating display in the price_filter and rating functions. Removed redundant arrays from the Tour class.
  • Refactor: Updated options for "Drinks Basis" and "Room Basis" fields in itinerary settings.
  • Chore: Removed build script commands and redundant lines of code in the add_tagline_form_field function.
  • Style: Removed LSX Customizer integration code related to color schemes, impacting color customization for LSX Tour Operator.
  • Documentation: Updated plugin metadata such as contributors, tested version, and stable tag.

krugazul and others added 30 commits November 14, 2024 09:29
@krugazul krugazul added this to the 2.0.0 milestone Dec 3, 2024
@krugazul krugazul self-assigned this Dec 3, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2024

Warning

CodeRabbit GitHub Action detected

The repository is using both CodeRabbit Pro and CodeRabbit Open Source (via GitHub Actions), which is not recommended as it may lead to duplicate comments and extra noise. Please remove the CodeRabbit GitHub Action.

Warning

Rate limit exceeded

@krugazul has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 16b7739 and 66eb31f.

Walkthrough

The changes in this pull request encompass various modifications across multiple files, primarily focusing on styling updates, block variations in WordPress, and the restructuring of class methods. Key updates include enhancements to currency icon styling, the introduction of new block variations for tour operators, and significant modifications to the Setup, Bindings, and Registration classes. Additionally, several files related to post types and layouts have been removed, indicating a shift in how the application manages its content structure and presentation.

Changes

File Path Change Summary
assets/css/scss/_icons.scss Modified styling for currency icons; expanded .lsx-price-wrapper to include .lsx-single-supplement-wrapper and .unit-price-wrapper; adjusted margins.
assets/css/scss/_slider.scss Enhanced styling for slider components, including .slick-arrow and .slick-dots; defined new styles for various slider elements.
assets/css/scss/style.scss Removed file containing SCSS imports and mixins for the "LSX Tour Operators" project.
assets/css/style.css Updated CSS for currency icons to apply consistent styles across new wrappers.
assets/js/blocks/accommodation.js Added multiple block variations for accommodation-related content; updated class names for some variations.
assets/js/blocks/general.js Updated registration for gallery and price blocks; added a new "View More Button Block" variation.
assets/js/blocks/tour.js Introduced new block variations for itineraries and updated existing variations for better structure.
assets/js/src/custom.js Enhanced functions for read more functionality; updated logic for lightbox initialization.
bin/build.command Removed file containing Gulp tasks for automated builds.
includes/actions.php Removed file containing action hooks and functions for content management within the theme.
includes/classes/admin/class-setup.php Removed singleton pattern; added new properties and methods for managing image sizes and HTML attributes.
includes/classes/blocks/class-bindings.php Removed maybe_hide_varitaion method; updated post_connections_callback for handling facilities.
includes/classes/blocks/class-registration.php Added properties for managing block variations; introduced methods for conditional rendering of blocks.
includes/classes/blocks/class-templates.php Added conditional check for register_block_template function to prevent errors.
includes/classes/class-tour-operator.php Updated instantiation of Setup and other properties to direct instantiation instead of using singletons.
includes/classes/legacy/class-accommodation.php Updated price_filter method to handle multiple currency fields; simplified star rating generation.
includes/classes/legacy/class-admin.php Added method for a tagline form field in term metadata; updated save_meta for tagline handling.
includes/classes/legacy/class-frontend.php Removed methods related to post classes and pagination; streamlined breadcrumb logic.
includes/classes/legacy/class-tour-operator.php Removed compatibility check methods and hooks; added debug logging for Google Maps API key.
includes/classes/legacy/class-tour.php Removed properties for meal and drink options; updated price_filter method for broader handling of price-related data.
includes/classes/legacy/class-unit-query.php Updated item_thumbnail method to accept dynamic image size; enhanced checks in item_thumbnails method.
includes/customizer.php Removed file for custom color scheme integration in the theme customizer.
includes/functions.php Updated itinerary thumbnail function; removed uninstall hooks; added action to streamline admin menu.
includes/layout.php Removed functions related to layout management for post types.
includes/metaboxes/config-tour.php Updated options for drinks_basis and room_basis fields in the metabox configuration.
includes/patterns/gallery.php New file defining a gallery pattern for WordPress.
includes/patterns/room-card.php Updated class names and structure for room card elements.
includes/template-tags/accommodation.php Modified output structure for accommodation facilities; updated class attributes.
includes/template-tags/helpers.php Enhanced data handling in custom field query functions.
post-types/accommodation.json Removed post type configuration for "Accommodation."
post-types/destinations.json Removed post type configuration for "Destinations."
post-types/tours.json Removed post type configuration for "Tours."
tour-operator-bootstrap.php Removed several require_once statements and an action hook for loading actions.
vendor/cmb-field-select2/cmb-field-select2.php Added placeholder option for multi-select dropdown in get_pw_multiselect_options method.

Poem

🐇 In the land of code where changes bloom,
New wrappers and styles dispel the gloom.
Icons dance with a fresh new grace,
As blocks unite in a vibrant space.
With each line of code, a tale unfolds,
In the world of tours, adventure beholds! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

github-actions bot commented Dec 3, 2024

Image description CodeRabbit

Walkthrough

This update brings a series of changes aimed at improving code robustness, streamlining stylesheets, enhancing data presentation, and updating plugin metadata. The modifications span across CSS selectors, class names, block variations, function calls, and array handling. Notably, the update also introduces a new gallery block template and removes LSX Customizer integration related to color schemes.

Changes

Files Summary
assets/css/scss/*.scss, includes/patterns/room-card.php, includes/functions.php, includes/template-tags/*.php Streamlined CSS selectors and stylesheets, improved HTML structure for displaying accommodation facilities, enhanced handling of array values.
assets/js/blocks/*.js, includes/classes/blocks/class-templates.php, includes/classes/*.php, includes/metaboxes/config-tour.php Updated block variations, icons, categories, attributes, added conditional checks for function calls, refactored logic related to currency fields, updated options for itinerary settings.
bin/build.command, includes/classes/legacy/class-admin.php Removed build script commands and redundant lines of code.
includes/classes/legacy/class-unit-query.php, includes/customizer.php Introduced a new parameter in the thumbnail method, removed LSX Customizer integration related to color schemes.
includes/patterns/gallery.php Introduced a new block template for a gallery.
readme.txt, tour-operator-bootstrap.php, tour-operator.php Updated plugin metadata, moved file inclusion to after_setup_theme, updated version number in the plugin core file.

"With each commit we make, 🐇💻

Our code becomes a piece of cake. 🍰

We refactor, streamline, and enhance, 🚀

Giving our codebase a chance to dance. 💃🕺

So here's to changes, big and small, 🎉

Making our project stand tall!" 🏗️🌟


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

🧹 Outside diff range and nitpick comments (19)
assets/js/src/custom.js (3)

Line range hint 275-276: Fix incorrect child element count check

Using $this.children.length may not return the correct number of child elements because $this.children is a jQuery method, not a property. You should use $this.children().length to get the number of child elements.

Apply this diff to fix the issue:

-if ( 1 < $this.children.length ) {
+if ( 1 < $this.children().length ) {

72-73: Remove debugging statements

There are console.log statements at lines 72-73, 275-276, and 321, 323 that should be removed to avoid cluttering the console and potential performance issues in production.

Apply this diff to remove the console.log statements:

-    console.log(contentWrapper);
-    console.log(contentWrapper.length);
-    console.log($this);
-    console.log(roomImages);

Also applies to: 275-276, 321-321, 323-323


75-76: Use consistent variable declarations

You're mixing var and let declarations in the same scope. For consistency and to adhere to modern JavaScript best practices, consider using let or const for all variable declarations.

Apply this diff to use let consistently:

-var limit = 1;
+let limit = 1;
includes/classes/legacy/class-frontend.php (1)

382-405: Consider refactoring duplicated code in breadcrumb methods

The methods accommodation_breadcrumb_links and tour_breadcrumb_links contain similar logic for building breadcrumbs based on primary terms and fallback terms. To improve maintainability and reduce code duplication, consider refactoring this logic into a shared function or method.

Also applies to: 431-460

assets/js/blocks/tour.js (3)

958-1078: Ensure consistency in block variation naming and registration

The Price Include & Exclude block variation uses inconsistent naming conventions compared to other block variations. Align the naming to maintain consistency across the codebase.

Apply this diff to standardise the naming:

-name: 'lsx-tour-operator/price-include-exclude',
+name: 'lsx-tour-operator/price-include-exclude-wrapper',

Line range hint 301-317: Optimise image URLs for portability

Hardcoding image URLs can lead to broken links when migrating between environments. Use wp_get_attachment_url() or get_template_directory_uri() to generate the image URLs dynamically.

Apply this diff to use dynamic image URLs:

-url: 'https://tour-operator.lsx.design/wp-content/uploads/2024/09/Typelocation-icon.png',
+url: '<?php echo esc_url( get_template_directory_uri() . "/assets/img/Typelocation-icon.png" ); ?>',

Line range hint 920-955: Avoid duplication by creating reusable components

The block variations for Departs From and Ends In share similar structures. Consider creating a reusable function or component to reduce code duplication and improve maintainability.

assets/css/scss/_slider.scss (2)

6-7: Remove unnecessary empty lines

There are extra empty lines at the beginning of the file that can be removed for cleaner code.

Apply this diff:

-
-

Line range hint 162-168: Ensure consistent vendor prefixes for cross-browser compatibility

In the .slick-arrow class, properties like transform and transition should include vendor prefixes for broader browser support.

includes/patterns/gallery.php (1)

3-39: Provide a description for the gallery pattern

The 'description' key is currently empty. Adding a meaningful description enhances understanding and usability within the block editor.

Apply this diff:

- 'description'   => __( '', 'tour-operator' ),
+ 'description'   => __( 'A gallery pattern for the Tour Operator theme.', 'tour-operator' ),
includes/classes/blocks/class-templates.php (1)

112-115: Proper defensive programming implementation!

The function_exists check is a good addition to prevent errors on WordPress versions where register_block_template isn't available. Consider adding a debug log when the function isn't available to help with troubleshooting.

 if ( function_exists( 'register_block_template' ) ) {
    register_block_template( 'lsx-tour-operator//' . $key, $args );
+} else {
+   error_log( 'register_block_template function not available. WordPress version might be outdated.' );
 }
includes/classes/class-tour-operator.php (1)

Line range hint 222-226: Good architectural improvement moving away from singletons!

The direct instantiation pattern is better for testing and dependency management. However, we should verify the initialization order as these classes might have interdependencies.

Consider implementing a dependency injection container to manage these instances and their dependencies more effectively.

includes/classes/legacy/class-accommodation.php (1)

Line range hint 121-139: Critical: Potential price truncation issue in currency handling

The casting of price value to integer using (int) could truncate decimal prices. This might lead to incorrect price displays.

Apply this fix to preserve decimal precision:

-$value = number_format( (int) $value, 2 );
+$value = number_format( (float) $value, 2 );
vendor/cmb-field-select2/cmb-field-select2.php (1)

125-127: Brilliant addition of a default option!

The default "Select" option improves user experience when no items are selected. However, consider making the text translatable for multilingual support.

-			$selected_items = '<option value="" selected="selected">Select</option>';
+			$selected_items = '<option value="" selected="selected">' . esc_html__('Select', 'cmb-field-select2') . '</option>';
assets/css/style.css (1)

5-7: Brilliant work on maintaining styling consistency!

The addition of .lsx-single-supplement-wrapper and .unit-price-wrapper ensures consistent currency icon styling. However, consider using SASS mixins to reduce repetition in the CSS.

Example mixin approach:

@mixin currency-wrapper {
  .amount .currency-icon:after {
    margin-right: 0px;
  }
}

.lsx-price-wrapper,
.lsx-single-supplement-wrapper,
.unit-price-wrapper {
  @include currency-wrapper;
}

Also applies to: 149-151, 156-158

includes/metaboxes/config-tour.php (2)

260-269: Consider using constants for option values

The drinks basis options would be more maintainable if defined as constants.

Consider refactoring like this:

+define( 'LSX_DRINKS_BASIS_NONE', 'None' );
+define( 'LSX_DRINKS_BASIS_TEA_COFFEE', 'TeaCoffee' );
// ... more constants ...

 'options' => array(
-    'None'                => esc_html__( 'None', 'tour-operator' ),
-    'TeaCoffee'           => esc_html__( 'Tea and Coffee Only', 'tour-operator' ),
+    LSX_DRINKS_BASIS_NONE       => esc_html__( 'None', 'tour-operator' ),
+    LSX_DRINKS_BASIS_TEA_COFFEE => esc_html__( 'Tea and Coffee Only', 'tour-operator' ),

276-293: Standardise translation strings

The room basis options use inconsistent formatting in translation strings.

Consider standardising the format:

-'BedAndBreakfast' => esc_html__( 'B&amp;B: Bed and Breakfast', 'tour-operator' ),
+'BedAndBreakfast' => esc_html__( 'Bed and Breakfast (B&B)', 'tour-operator' ),
includes/template-tags/helpers.php (1)

Line range hint 949-949: Mind the CSS selector changes, chaps!

The class name changes from plural to singular form might affect existing CSS styles:

  • lsx-special-interests-wrapperlsx-special-interest-wrapper
  • lsx-facilities-wrapperlsx-facility-wrapper

Please ensure all CSS selectors are updated accordingly in your stylesheets.

Also applies to: 1047-1047

assets/js/blocks/accommodation.js (1)

Line range hint 1-1300: Eish, those hardcoded image URLs need sorting!

The block variations contain hardcoded URLs to image assets (e.g., https://tour-operator.lsx.design/wp-content/uploads/...). This isn't ideal for different environments.

Consider using WordPress's asset handling functions or environment variables for image URLs.

Ag, let's DRY up this code, hey?

There's quite a bit of repeated styling patterns across block variations. For example, the padding and spacing configurations are duplicated.

Extract common styles into shared configuration objects:

const commonStyles = {
  spacing: {
    padding: {
      top: '2px',
      bottom: '2px'
    }
  }
};

const commonLayout = {
  type: 'flex',
  flexWrap: 'nowrap'
};

// Use in block variations
wp.blocks.registerBlockVariation('core/group', {
  // ...
  style: commonStyles,
  layout: commonLayout
  // ...
});
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 73257ab and 16b7739.

⛔ Files ignored due to path filters (3)
  • assets/css/style.css.map is excluded by !**/*.map
  • assets/img/rating-star-empty.png is excluded by !**/*.png
  • assets/img/rating-star-full.png is excluded by !**/*.png
📒 Files selected for processing (34)
  • assets/css/scss/_icons.scss (1 hunks)
  • assets/css/scss/_slider.scss (1 hunks)
  • assets/css/scss/style.scss (0 hunks)
  • assets/css/style.css (3 hunks)
  • assets/js/blocks/accommodation.js (3 hunks)
  • assets/js/blocks/general.js (3 hunks)
  • assets/js/blocks/tour.js (3 hunks)
  • assets/js/src/custom.js (5 hunks)
  • bin/build.command (0 hunks)
  • includes/actions.php (0 hunks)
  • includes/classes/admin/class-setup.php (3 hunks)
  • includes/classes/blocks/class-bindings.php (13 hunks)
  • includes/classes/blocks/class-registration.php (7 hunks)
  • includes/classes/blocks/class-templates.php (1 hunks)
  • includes/classes/class-tour-operator.php (1 hunks)
  • includes/classes/legacy/class-accommodation.php (3 hunks)
  • includes/classes/legacy/class-admin.php (0 hunks)
  • includes/classes/legacy/class-frontend.php (2 hunks)
  • includes/classes/legacy/class-tour-operator.php (2 hunks)
  • includes/classes/legacy/class-tour.php (1 hunks)
  • includes/classes/legacy/class-unit-query.php (2 hunks)
  • includes/customizer.php (0 hunks)
  • includes/functions.php (1 hunks)
  • includes/layout.php (0 hunks)
  • includes/metaboxes/config-tour.php (1 hunks)
  • includes/patterns/gallery.php (1 hunks)
  • includes/patterns/room-card.php (3 hunks)
  • includes/template-tags/accommodation.php (2 hunks)
  • includes/template-tags/helpers.php (1 hunks)
  • post-types/accommodation.json (0 hunks)
  • post-types/destinations.json (0 hunks)
  • post-types/tours.json (0 hunks)
  • tour-operator-bootstrap.php (0 hunks)
  • vendor/cmb-field-select2/cmb-field-select2.php (1 hunks)
💤 Files with no reviewable changes (10)
  • tour-operator-bootstrap.php
  • bin/build.command
  • post-types/destinations.json
  • assets/css/scss/style.scss
  • includes/customizer.php
  • includes/classes/legacy/class-admin.php
  • post-types/tours.json
  • post-types/accommodation.json
  • includes/layout.php
  • includes/actions.php
🧰 Additional context used
🪛 Biome (1.9.4)
assets/js/blocks/general.js

[error] 410-410: This property value named name is later overwritten by an object member with the same name.

Overwritten with this value.

If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property value named name

(lint/suspicious/noDuplicateObjectKeys)

🔇 Additional comments (15)
includes/classes/blocks/class-registration.php (1)

298-298: Verify that 'lsx_to_item_has_children' function exists

At line 298, you're calling lsx_to_item_has_children( get_the_ID(), 'destination' ). Please ensure that this function is defined and accessible in the current context. If it's part of a plugin or theme, verify that it's correctly included.

includes/classes/blocks/class-bindings.php (3)

616-619: Ensure $gallery is always an array to prevent errors

The additional check to ensure $gallery is an array is good practice. This prevents errors when $gallery is not in the expected format.


630-634: Set default values to avoid undefined index notices

The introduction of $target with a default empty string avoids potential undefined index notices when linkTarget is not set.


135-136: ⚠️ Potential issue

Initialise variables to prevent undefined behaviour

The variable $value is declared without initialisation. Ensure that variables are initialised to avoid potential undefined variable notices.

Apply this diff to initialise $value:

+ $value = '';

Likely invalid or redundant comment.

assets/css/scss/_icons.scss (2)

119-121: Combine selector definitions for better maintainability

Combining .lsx-price-wrapper, .lsx-single-supplement-wrapper, and .unit-price-wrapper into a single declaration enhances readability and maintainability.


119-121: Adjust margin for currency icons to ensure proper spacing

The adjustment of margin-right to 0px on .currency-icon:after within .amount may affect layout. Verify that this change maintains the desired visual spacing.

includes/classes/legacy/class-tour.php (1)

135-140: Enhancement to currency field handling looks good!

The addition of the $currency_fields array improves code maintainability and allows for consistent currency formatting across different price fields.

includes/classes/legacy/class-unit-query.php (2)

Line range hint 211-224: Good improvement to image size handling!

The addition of the $size parameter with a default value maintains backwards compatibility while providing more flexibility.


Line range hint 237-265: Verify gallery items handling

The gallery validation has been improved, but we should ensure this doesn't affect existing gallery displays.

✅ Verification successful

Let me gather more information about gallery-related functionality to ensure we have a complete picture.


Let me check for any template files and gallery usage in the broader codebase.


Gallery handling changes are safe to proceed

The improved gallery validation in class-unit-query.php is isolated to the room thumbnail generation and won't affect existing gallery displays because:

  • The gallery implementation is used consistently across accommodation, tours and destinations with the same structure
  • The lsx_to_accommodation_room_thumbnail filter is only used within the room context
  • The new block-based gallery rendering in class-bindings.php handles galleries independently
  • The core gallery data structure (gallery meta field) remains unchanged
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any existing gallery implementations that might be affected
rg -A 3 "item_thumbnails\(\)" --type php

Length of output: 349


Script:

#!/bin/bash
# Check for gallery-related filters and implementations
rg -A 3 "lsx_to_accommodation_room_thumbnail" --type php

# Check for gallery usage in templates
rg -A 3 "gallery" --type php includes/templates/

Length of output: 1037


Script:

#!/bin/bash
# Find template directories and files
fd -t d "templates"

# Check for gallery-related functions and hooks
rg -A 3 "gallery|get_gallery" --type php

# Check for any gallery-related filters
rg -A 3 "add_filter.*accommodation.*gallery|add_filter.*gallery" --type php

Length of output: 19027

includes/patterns/room-card.php (2)

Line range hint 38-53: Good semantic improvement to wrapper classes!

The change from itin-type-wrapper to unit-type-wrapper better reflects the content purpose.


Line range hint 54-67: Verify price wrapper styling

The new unit-price-wrapper class needs to be checked for consistent styling across different themes.

✅ Verification successful

Currency styling is properly handled for the unit-price-wrapper class

The codebase shows comprehensive CSS styling for the unit-price-wrapper class across multiple currency types. The styling includes:

  • Consistent margin handling for currency icons
  • Support for 25+ international currency symbols
  • Proper currency symbol positioning and spacing
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any custom CSS overrides that might affect the new wrapper
rg -A 3 "unit-price-wrapper|unit-price" --type css

Length of output: 7152

assets/js/blocks/general.js (2)

2-6: Spot on with the gallery icon change!

The change from "admin-multisite" to "gallery" icon is more intuitive and better represents the block's purpose.


43-47: Good job adding the category definition!

The explicit category definition for the price block improves organization in the block editor.

includes/template-tags/helpers.php (2)

287-289: Brilliant addition of array filtering!

The addition of array_filter before imploding ensures cleaner output by removing empty values.


Line range hint 1121-1141: Verify the facilities data migration

The switch from taxonomy terms to post connections for facilities display might require data migration. Please ensure all existing facility data has been properly migrated.

Comment on lines +376 to +378
$allowedstyles[] = 'display';
$allowedstyles[] = 'background-image';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Review security implications of allowing 'background-image' CSS property

Adding 'background-image' to the list of allowed CSS properties in safe_style_css can introduce security risks because URLs specified in 'background-image' can be exploited for XSS attacks if not properly sanitised. Please ensure that any URLs used in 'background-image' styles are properly sanitised and that only safe protocols are permitted.

Comment on lines +210 to +361

/**
* Allow extra tags and attributes to wp_kses_post()
*/
public function wp_kses_allowed_html( $allowedtags, $context ) {
if ( ! isset( $allowedtags['i'] ) ) {
$allowedtags['i'] = array();
}
$allowedtags['i']['aria-hidden'] = true;

if ( ! isset( $allowedtags['span'] ) ) {
$allowedtags['span'] = array();
}

$allowedtags['span']['aria-hidden'] = true;

if ( ! isset( $allowedtags['button'] ) ) {
$allowedtags['button'] = array();
}

$allowedtags['button']['aria-label'] = true;
$allowedtags['button']['data-dismiss'] = true;

if ( ! isset( $allowedtags['li'] ) ) {
$allowedtags['li'] = array();
}

$allowedtags['li']['data-target'] = true;
$allowedtags['li']['data-slide-to'] = true;

if ( ! isset( $allowedtags['a'] ) ) {
$allowedtags['a'] = array();
}


$allowedtags['a']['target'] = true;
$allowedtags['a']['data-toggle'] = true;
$allowedtags['a']['data-target'] = true;
$allowedtags['a']['data-slide'] = true;
$allowedtags['a']['data-collapsed'] = true;
$allowedtags['a']['data-envira-caption'] = true;
$allowedtags['a']['data-envira-retina'] = true;
$allowedtags['a']['data-thumbnail'] = true;
$allowedtags['a']['data-mobile-thumbnail'] = true;
$allowedtags['a']['data-envirabox-type'] = true;
$allowedtags['a']['data-video-width'] = true;
$allowedtags['a']['data-video-height'] = true;
$allowedtags['a']['data-video-aspect-ratio'] = true;

if ( ! isset( $allowedtags['h2'] ) ) {
$allowedtags['h2'] = array();
}

$allowedtags['h2']['data-target'] = true;
$allowedtags['h2']['data-toggle'] = true;

if ( ! isset( $allowedtags['div'] ) ) {
$allowedtags['div'] = array();
}

$allowedtags['div']['aria-labelledby'] = true;
$allowedtags['div']['data-interval'] = true;
$allowedtags['div']['data-icon'] = true;
$allowedtags['div']['data-id'] = true;
$allowedtags['div']['data-class'] = true;
$allowedtags['div']['data-long'] = true;
$allowedtags['div']['data-lat'] = true;
$allowedtags['div']['data-zoom'] = true;
$allowedtags['div']['data-link'] = true;
$allowedtags['div']['data-thumbnail'] = true;
$allowedtags['div']['data-title'] = true;
$allowedtags['div']['data-type'] = true;
$allowedtags['div']['data-cluster-small'] = true;
$allowedtags['div']['data-cluster-medium'] = true;
$allowedtags['div']['data-cluster-large'] = true;
$allowedtags['div']['data-fusion-tables'] = true;
$allowedtags['div']['data-fusion-tables-colour-border'] = true;
$allowedtags['div']['data-fusion-tables-width-border'] = true;
$allowedtags['div']['data-fusion-tables-colour-background'] = true;
$allowedtags['div']['itemscope'] = true;
$allowedtags['div']['itemtype'] = true;
$allowedtags['div']['data-row-height'] = true;
$allowedtags['div']['data-justified-margins'] = true;
$allowedtags['div']['data-slick'] = true;

//Envirta Gallery tags
//
$allowedtags['div']['data-envira-id'] = true;
$allowedtags['div']['data-gallery-config'] = true;
$allowedtags['div']['data-gallery-images'] = true;
$allowedtags['div']['data-gallery-theme'] = true;
$allowedtags['div']['data-envira-columns'] = true;

if ( ! isset( $allowedtags['img'] ) ) {
$allowedtags['img'] = array();
}

$allowedtags['img']['data-envira-index'] = true;
$allowedtags['img']['data-envira-caption'] = true;
$allowedtags['img']['data-envira-gallery-id'] = true;
$allowedtags['img']['data-envira-item-id'] = true;
$allowedtags['img']['data-envira-src'] = true;
$allowedtags['img']['data-envira-srcset'] = true;

if ( ! isset( $allowedtags['input'] ) ) {
$allowedtags['input'] = array();
}

$allowedtags['input']['type'] = true;
$allowedtags['input']['id'] = true;
$allowedtags['input']['name'] = true;
$allowedtags['input']['value'] = true;
$allowedtags['input']['size'] = true;
$allowedtags['input']['checked'] = true;
$allowedtags['input']['onclick'] = true;
$allowedtags['input']['class'] = true;
$allowedtags['input']['placeholder'] = true;
$allowedtags['input']['autocomplete'] = true;

if ( ! isset( $allowedtags['select'] ) ) {
$allowedtags['select'] = array();
}

$allowedtags['select']['name'] = true;
$allowedtags['select']['id'] = true;
$allowedtags['select']['disabled'] = true;
$allowedtags['select']['onchange'] = true;

if ( ! isset( $allowedtags['option'] ) ) {
$allowedtags['option'] = array();
}

$allowedtags['option']['value'] = true;
$allowedtags['option']['selected'] = true;

if ( ! isset( $allowedtags['iframe'] ) ) {
$allowedtags['iframe'] = array();
}

$allowedtags['iframe']['src'] = true;
$allowedtags['iframe']['width'] = true;
$allowedtags['iframe']['height'] = true;
$allowedtags['iframe']['frameborder'] = true;
$allowedtags['iframe']['allowfullscreen'] = true;
$allowedtags['iframe']['style'] = true;

if ( ! isset( $allowedtags['noscript'] ) ) {
$allowedtags['noscript'] = array();
}

return $allowedtags;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ensure proper sanitisation for extended allowed HTML tags and attributes

The wp_kses_allowed_html function adds numerous tags and attributes to the allowed list, including potentially risky attributes like 'onclick', 'onchange', 'style', 'src', and 'href'. These attributes can be used to inject malicious code if not properly sanitised. Please review the added tags and attributes to ensure they do not introduce security vulnerabilities, and consider using WordPress's built-in sanitisation functions where appropriate.

if ( 0 < stripos( $key, '-query' ) ) {

$query_key = str_replace( [ '-query' ], '', $key );
$current_parent = get_post_parent( get_the_ID() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Undefined function 'get_post_parent'

At line 289, get_post_parent( get_the_ID() ); is used, but get_post_parent is not a standard WordPress function. You might have intended to use wp_get_post_parent_id( get_the_ID() );, which returns the parent post ID.

Apply this diff to fix the issue:

-$current_parent = get_post_parent( get_the_ID() );
+$current_parent = wp_get_post_parent_id( get_the_ID() );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$current_parent = get_post_parent( get_the_ID() );
$current_parent = wp_get_post_parent_id( get_the_ID() );

$this->map_post_types = array( 'accommodation', 'activity', 'destination' );
$this->markers = new \stdClass();

do_action( 'qm/debug', $this->options['googlemaps_key'] );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove debugging code leaking sensitive information

At line 330, do_action( 'qm/debug', $this->options['googlemaps_key'] ); is a debugging statement that outputs the Google Maps API key to the debug log. This can expose sensitive information and should be removed from the production code.

Apply this diff to fix the issue:

-do_action( 'qm/debug', $this->options['googlemaps_key'] );

Comment on lines +162 to +263
// Single Supplement
wp.blocks.registerBlockVariation('core/group', {
name: 'lsx-tour-operator/single-supplement-wrapper',
title: 'Single Supplement',
category: 'lsx-tour-operator',
attributes: {
align: 'wide',
className: 'lsx-include-exclude-wrapper',
metadata: {
name: 'Single Supplement',
},
className: 'lsx-single-supplement-wrapper',
style: {
spacing: {
padding: {
top: 'var:preset|spacing|x-small',
bottom: 'var:preset|spacing|x-small',
left: 'var:preset|spacing|x-small',
right: 'var:preset|spacing|x-small'
}
},
border: {
radius: '8px',
width: '1px'
blockGap: '5px'
}
},
backgroundColor: 'base',
borderColor: 'primary',
layout: {
type: 'constrained'
type: 'flex',
flexWrap: 'nowrap'
}
},
innerBlocks: [
[
'core/columns', {
align: 'wide',
style: {
spacing: {
blockGap: {
top: 'var:preset|spacing|medium',
left: 'var:preset|spacing|medium'
}
}
}
},
[
[
'core/column', {
width: '50%',
id: 'lsx-included-wrapper',
['core/group', {
style: {
spacing: {
blockGap: '0'
}
}
spacing: {
blockGap: '5px'
}
},
layout: {
type: 'flex',
flexWrap: 'nowrap',
verticalAlignment: 'top'
}
},
[
[
'core/paragraph', {
['core/image', {
id: 122733,
width: '20px',
sizeSlug: 'large',
linkDestination: 'none',
url: 'https://tour-operator.lsx.design/wp-content/uploads/2024/11/single-supplement-icon-black-52px-1.svg',
alt: ''
}],
['core/paragraph', {
style: {
elements: {
link: {
color: {
text: 'var:preset|color|primary-700'
}
spacing: {
padding: {
top: '2px',
bottom: '2px'
}
}
}
},
textColor: 'primary-700',
fontSize: 'medium'
},
[ 'Price Includes:' ]
],
[
'core/paragraph', {
metadata: {
bindings: {
content: {
source: 'lsx/post-meta',
args: { key: 'included' }
}
}
}
},
[]
]
fontSize: 'x-small',
content: '<strong>Single supplement:</strong>'
}]
]
],
[
'core/column', {
width: '50%',
className: 'lsx-not-included-wrapper',
],
['core/group', {
style: {
spacing: {
blockGap: '0'
}
spacing: {
blockGap: '5px'
},
layout: {
type: 'flex',
flexWrap: 'nowrap'
}
}
},
[
[
'core/paragraph', {
style: {
elements: {
link: {
color: {
text: 'var:preset|color|primary-700'
['core/paragraph', {
metadata: {
bindings: {
content: {
source: 'lsx/post-meta',
args: {
key: 'single_supplement'
}
}
}
},
className: 'amount has-primary-color has-text-color has-link-color',
style: {
elements: {
link: {
color: {
text: 'var:preset|color|primary-700'
}
}
},
spacing: {
padding: {
top: '2px',
bottom: '2px'
}
}
}
},
textColor: 'primary-700',
fontSize: 'medium'
},
[ 'Price Excludes:' ]
],
[
'core/paragraph', {
metadata: {
bindings: {
content: {
source: 'lsx/post-meta',
args: { key: 'not_included' }
}
}
}
},
[]
]
]
content: ''
}]
]
]
]
]
} );
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Optimise the Single Supplement block variation for reusability and maintainability

The Single Supplement block variation contains hardcoded image URLs and IDs, which may cause issues when the environment changes or when the IDs differ between environments. Consider using dynamic retrieval methods for images and ensure that any media assets are properly registered and accessible.

Apply this diff to make the image ID and URL dynamic:

-['core/image', {
-    id: 122733,
-    width: '20px',
-    sizeSlug: 'large',
-    linkDestination: 'none',
-    url: 'https://tour-operator.lsx.design/wp-content/uploads/2024/11/single-supplement-icon-black-52px-1.svg',
-    alt: ''
-}],
+['core/image', {
+    width: '20px',
+    sizeSlug: 'large',
+    linkDestination: 'none',
+    url: '<?php echo esc_url( get_template_directory_uri() . "/assets/img/single-supplement-icon.svg" ); ?>',
+    alt: 'Single Supplement Icon'
+}],

Committable suggestion skipped: line range outside the PR's diff.

'single_supplement'
];

do_action( 'qm/debug', [ get_post_type(), $meta_key ] );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove debug code before deployment

The debug action should not be present in production code as it could impact performance and potentially expose sensitive information.

-do_action( 'qm/debug', [ get_post_type(), $meta_key ] );

Comment on lines +408 to +413
// View More Button Block
wp.blocks.registerBlockVariation('core/button', {
name: 'lsx-tour-operator/more-link',
title: 'More Button',
name: 'core/button',
category: "lsx-tour-operator",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the duplicate 'name' property in the button variation.

There's a critical issue where the 'name' property is defined twice with different values, which could cause unexpected behaviour.

wp.blocks.registerBlockVariation('core/button', {
-        name: 'lsx-tour-operator/more-link',
-        title: 'More Button',
-		name: 'core/button',
+        name: 'lsx-tour-operator/more-link',
+        title: 'More Button',
		category: "lsx-tour-operator",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// View More Button Block
wp.blocks.registerBlockVariation('core/button', {
name: 'lsx-tour-operator/more-link',
title: 'More Button',
name: 'core/button',
category: "lsx-tour-operator",
// View More Button Block
wp.blocks.registerBlockVariation('core/button', {
name: 'lsx-tour-operator/more-link',
title: 'More Button',
category: "lsx-tour-operator",
🧰 Tools
🪛 Biome (1.9.4)

[error] 410-410: This property value named name is later overwritten by an object member with the same name.

Overwritten with this value.

If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.
Unsafe fix: Remove this property value named name

(lint/suspicious/noDuplicateObjectKeys)


//Output in the order we want
if ( count( $main_facilities ) > 0 && count( $child_facilities ) > 0 ) {
$return .= '<div class="' . $heading->slug . ' wp-block-columns is-layout-flex wp-block-columns-is-layout-flex">';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix undefined variable usage

The variable $heading is used before it's defined, which could cause PHP notices or errors.

Apply this diff to fix the issue:

-$return .= '<div class="' . $heading->slug . ' wp-block-columns is-layout-flex wp-block-columns-is-layout-flex">';
+$return .= '<div class="wp-block-columns is-layout-flex wp-block-columns-is-layout-flex">';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$return .= '<div class="' . $heading->slug . ' wp-block-columns is-layout-flex wp-block-columns-is-layout-flex">';
$return .= '<div class="wp-block-columns is-layout-flex wp-block-columns-is-layout-flex">';

$return .= '<div class="' . $heading->slug . ' col-xs-12 col-sm-6"><div class="facilities-content"><h5 class="facilities-title"><a href="' . esc_url( get_term_link( $heading->slug, 'facility' ) ) . '">' . esc_html( $heading->name ) . '</a></h5>';
$return .= '<ul class="facilities-list">';
$return .= '<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<p class="has-medium-font-size facilities-title wp-block-heading"><a href="' . esc_url( get_term_link( $heading->slug, 'facility' ) ) . '">' . esc_html( $heading->name ) . '</a></h5>';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Correct heading structure inconsistency

The markup mixes heading semantics by using a paragraph tag with heading class.

Apply this diff to maintain proper heading hierarchy:

-<p class="has-medium-font-size facilities-title wp-block-heading"><a href="' . esc_url( get_term_link( $heading->slug, 'facility' ) ) . '">' . esc_html( $heading->name ) . '</a></h5>';
+<h3 class="has-medium-font-size facilities-title"><a href="' . esc_url( get_term_link( $heading->slug, 'facility' ) ) . '">' . esc_html( $heading->name ) . '</a></h3>';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<p class="has-medium-font-size facilities-title wp-block-heading"><a href="' . esc_url( get_term_link( $heading->slug, 'facility' ) ) . '">' . esc_html( $heading->name ) . '</a></h5>';
<h3 class="has-medium-font-size facilities-title"><a href="' . esc_url( get_term_link( $heading->slug, 'facility' ) ) . '">' . esc_html( $heading->name ) . '</a></h3>';

Comment on lines +222 to +224
if ( ! empty( $tour_itinerary->itinerary['featured_image_id'] ) ) {
$tour_itinerary->save_used_image( $tour_itinerary->itinerary['featured_image_id'] );
$thumbnail = wp_get_attachment_image_src( $tour_itinerary->itinerary['featured_image_id'], $size );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add validation for featured image ID

The featured image ID should be validated before use.

Apply this diff to add validation:

-if ( ! empty( $tour_itinerary->itinerary['featured_image_id'] ) ) {
+if ( ! empty( $tour_itinerary->itinerary['featured_image_id'] ) && wp_attachment_is_image( $tour_itinerary->itinerary['featured_image_id'] ) ) {
     $tour_itinerary->save_used_image( $tour_itinerary->itinerary['featured_image_id'] );
     $thumbnail = wp_get_attachment_image_src( $tour_itinerary->itinerary['featured_image_id'], $size );
+} else {
+    error_log( 'Invalid featured image ID in tour itinerary' );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if ( ! empty( $tour_itinerary->itinerary['featured_image_id'] ) ) {
$tour_itinerary->save_used_image( $tour_itinerary->itinerary['featured_image_id'] );
$thumbnail = wp_get_attachment_image_src( $tour_itinerary->itinerary['featured_image_id'], $size );
if ( ! empty( $tour_itinerary->itinerary['featured_image_id'] ) && wp_attachment_is_image( $tour_itinerary->itinerary['featured_image_id'] ) ) {
$tour_itinerary->save_used_image( $tour_itinerary->itinerary['featured_image_id'] );
$thumbnail = wp_get_attachment_image_src( $tour_itinerary->itinerary['featured_image_id'], $size );
} else {
error_log( 'Invalid featured image ID in tour itinerary' );

@Justinabes007 Justinabes007 merged commit 80a9811 into master Dec 3, 2024
@Justinabes007 Justinabes007 deleted the 2.0-beta-2 branch December 3, 2024 14:33
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 73257ab and 66eb31f commits.
Files selected (32)
  • assets/css/scss/_icons.scss (2)
  • assets/css/scss/_slider.scss (1)
  • assets/css/scss/style.scss (1)
  • assets/css/style.css (3)
  • assets/js/blocks/accommodation.js (3)
  • assets/js/blocks/general.js (3)
  • assets/js/blocks/tour.js (4)
  • assets/js/src/custom.js (5)
  • bin/build.command (1)
  • includes/actions.php (1)
  • includes/classes/admin/class-setup.php (4)
  • includes/classes/blocks/class-bindings.php (15)
  • includes/classes/blocks/class-registration.php (7)
  • includes/classes/blocks/class-templates.php (1)
  • includes/classes/class-tour-operator.php (1)
  • includes/classes/legacy/class-accommodation.php (3)
  • includes/classes/legacy/class-admin.php (1)
  • includes/classes/legacy/class-frontend.php (6)
  • includes/classes/legacy/class-tour-operator.php (6)
  • includes/classes/legacy/class-tour.php (3)
  • includes/classes/legacy/class-unit-query.php (2)
  • includes/customizer.php (1)
  • includes/functions.php (9)
  • includes/layout.php (1)
  • includes/metaboxes/config-tour.php (1)
  • includes/patterns/gallery.php (1)
  • includes/patterns/room-card.php (3)
  • includes/template-tags/accommodation.php (2)
  • includes/template-tags/helpers.php (1)
  • readme.txt (1)
  • tour-operator-bootstrap.php (1)
  • tour-operator.php (1)
Files ignored due to filter (6)
  • assets/img/rating-star-empty.png
  • assets/img/rating-star-full.png
  • post-types/accommodation.json
  • post-types/destinations.json
  • post-types/tours.json
  • vendor/cmb-field-select2/cmb-field-select2.php
Files not summarized due to errors (9)
  • assets/css/style.css (diff tokens exceeds limit)
  • assets/js/blocks/tour.js (diff tokens exceeds limit)
  • assets/js/src/custom.js (diff tokens exceeds limit)
  • includes/classes/admin/class-setup.php (diff tokens exceeds limit)
  • includes/classes/blocks/class-bindings.php (diff tokens exceeds limit)
  • includes/classes/blocks/class-registration.php (diff tokens exceeds limit)
  • includes/classes/legacy/class-frontend.php (diff tokens exceeds limit)
  • includes/classes/legacy/class-tour-operator.php (diff tokens exceeds limit)
  • includes/layout.php (diff tokens exceeds limit)
Files not reviewed due to errors (13)
  • assets/js/blocks/general.js (no response)
  • assets/js/blocks/tour.js (no response)
  • assets/js/src/custom.js (no response)
  • includes/classes/admin/class-setup.php (no response)
  • includes/classes/blocks/class-bindings.php (no response)
  • includes/classes/legacy/class-accommodation.php (no response)
  • includes/classes/legacy/class-frontend.php (no response)
  • includes/classes/blocks/class-registration.php (no response)
  • includes/classes/legacy/class-tour-operator.php (no response)
  • includes/classes/legacy/class-tour.php (no response)
  • includes/functions.php (no response)
  • includes/patterns/gallery.php (no response)
  • includes/patterns/room-card.php (no response)
Files skipped from review due to trivial changes (12)
  • assets/css/scss/_slider.scss
  • assets/css/scss/style.scss
  • bin/build.command
  • includes/classes/blocks/class-templates.php
  • includes/classes/class-tour-operator.php
  • includes/classes/legacy/class-admin.php
  • includes/metaboxes/config-tour.php
  • includes/template-tags/accommodation.php
  • includes/template-tags/helpers.php
  • readme.txt
  • tour-operator.php
  • includes/layout.php (diff too large)
Review comments generated (11)
  • Review: 7
  • LGTM: 4

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Comment on lines +5 to +134
.lsx-price-wrapper .amount .currency-icon:after,
.lsx-single-supplement-wrapper .amount .currency-icon:after,
.unit-price-wrapper .amount .currency-icon:after {
margin-left: 3px;
margin-right: 3px;
}
.lsx-price-wrapper .amount .currency-icon.usd:after, .lsx-price-wrapper .amount .currency-icon.nad:after, .lsx-price-wrapper .amount .currency-icon.cad:after, .lsx-price-wrapper .amount .currency-icon.hkd:after, .lsx-price-wrapper .amount .currency-icon.sgd:after, .lsx-price-wrapper .amount .currency-icon.nzd:after, .lsx-price-wrapper .amount .currency-icon.aud:after {
.lsx-price-wrapper .amount .currency-icon.usd:after,
.lsx-single-supplement-wrapper .amount .currency-icon.usd:after,
.unit-price-wrapper .amount .currency-icon.usd:after, .lsx-price-wrapper .amount .currency-icon.nad:after,
.lsx-single-supplement-wrapper .amount .currency-icon.nad:after,
.unit-price-wrapper .amount .currency-icon.nad:after, .lsx-price-wrapper .amount .currency-icon.cad:after,
.lsx-single-supplement-wrapper .amount .currency-icon.cad:after,
.unit-price-wrapper .amount .currency-icon.cad:after, .lsx-price-wrapper .amount .currency-icon.hkd:after,
.lsx-single-supplement-wrapper .amount .currency-icon.hkd:after,
.unit-price-wrapper .amount .currency-icon.hkd:after, .lsx-price-wrapper .amount .currency-icon.sgd:after,
.lsx-single-supplement-wrapper .amount .currency-icon.sgd:after,
.unit-price-wrapper .amount .currency-icon.sgd:after, .lsx-price-wrapper .amount .currency-icon.nzd:after,
.lsx-single-supplement-wrapper .amount .currency-icon.nzd:after,
.unit-price-wrapper .amount .currency-icon.nzd:after, .lsx-price-wrapper .amount .currency-icon.aud:after,
.lsx-single-supplement-wrapper .amount .currency-icon.aud:after,
.unit-price-wrapper .amount .currency-icon.aud:after {
content: "$";
}
.lsx-price-wrapper .amount .currency-icon.eur:after {
.lsx-price-wrapper .amount .currency-icon.eur:after,
.lsx-single-supplement-wrapper .amount .currency-icon.eur:after,
.unit-price-wrapper .amount .currency-icon.eur:after {
content: "€";
}
.lsx-price-wrapper .amount .currency-icon.gbp:after {
.lsx-price-wrapper .amount .currency-icon.gbp:after,
.lsx-single-supplement-wrapper .amount .currency-icon.gbp:after,
.unit-price-wrapper .amount .currency-icon.gbp:after {
content: "£";
}
.lsx-price-wrapper .amount .currency-icon.zar:after {
.lsx-price-wrapper .amount .currency-icon.zar:after,
.lsx-single-supplement-wrapper .amount .currency-icon.zar:after,
.unit-price-wrapper .amount .currency-icon.zar:after {
content: "R";
}
.lsx-price-wrapper .amount .currency-icon.brl:after {
.lsx-price-wrapper .amount .currency-icon.brl:after,
.lsx-single-supplement-wrapper .amount .currency-icon.brl:after,
.unit-price-wrapper .amount .currency-icon.brl:after {
content: "R$";
}
.lsx-price-wrapper .amount .currency-icon.bwp:after {
.lsx-price-wrapper .amount .currency-icon.bwp:after,
.lsx-single-supplement-wrapper .amount .currency-icon.bwp:after,
.unit-price-wrapper .amount .currency-icon.bwp:after {
content: "P";
}
.lsx-price-wrapper .amount .currency-icon.cny:after, .lsx-price-wrapper .amount .currency-icon.jpy:after {
.lsx-price-wrapper .amount .currency-icon.cny:after,
.lsx-single-supplement-wrapper .amount .currency-icon.cny:after,
.unit-price-wrapper .amount .currency-icon.cny:after, .lsx-price-wrapper .amount .currency-icon.jpy:after,
.lsx-single-supplement-wrapper .amount .currency-icon.jpy:after,
.unit-price-wrapper .amount .currency-icon.jpy:after {
content: "¥";
}
.lsx-price-wrapper .amount .currency-icon.inr:after {
.lsx-price-wrapper .amount .currency-icon.inr:after,
.lsx-single-supplement-wrapper .amount .currency-icon.inr:after,
.unit-price-wrapper .amount .currency-icon.inr:after {
content: "₹";
}
.lsx-price-wrapper .amount .currency-icon.idr:after {
.lsx-price-wrapper .amount .currency-icon.idr:after,
.lsx-single-supplement-wrapper .amount .currency-icon.idr:after,
.unit-price-wrapper .amount .currency-icon.idr:after {
content: "₹";
}
.lsx-price-wrapper .amount .currency-icon.ils:after {
.lsx-price-wrapper .amount .currency-icon.ils:after,
.lsx-single-supplement-wrapper .amount .currency-icon.ils:after,
.unit-price-wrapper .amount .currency-icon.ils:after {
content: "₪";
}
.lsx-price-wrapper .amount .currency-icon.kes:after {
.lsx-price-wrapper .amount .currency-icon.kes:after,
.lsx-single-supplement-wrapper .amount .currency-icon.kes:after,
.unit-price-wrapper .amount .currency-icon.kes:after {
content: "K";
}
.lsx-price-wrapper .amount .currency-icon.lak:after {
.lsx-price-wrapper .amount .currency-icon.lak:after,
.lsx-single-supplement-wrapper .amount .currency-icon.lak:after,
.unit-price-wrapper .amount .currency-icon.lak:after {
content: "₭";
}
.lsx-price-wrapper .amount .currency-icon.mwk:after {
.lsx-price-wrapper .amount .currency-icon.mwk:after,
.lsx-single-supplement-wrapper .amount .currency-icon.mwk:after,
.unit-price-wrapper .amount .currency-icon.mwk:after {
content: "MK";
}
.lsx-price-wrapper .amount .currency-icon.myr:after {
.lsx-price-wrapper .amount .currency-icon.myr:after,
.lsx-single-supplement-wrapper .amount .currency-icon.myr:after,
.unit-price-wrapper .amount .currency-icon.myr:after {
content: "RM";
}
.lsx-price-wrapper .amount .currency-icon.mzn:after {
.lsx-price-wrapper .amount .currency-icon.mzn:after,
.lsx-single-supplement-wrapper .amount .currency-icon.mzn:after,
.unit-price-wrapper .amount .currency-icon.mzn:after {
content: "MT";
}
.lsx-price-wrapper .amount .currency-icon.nok:after, .lsx-price-wrapper .amount .currency-icon.sek:after {
.lsx-price-wrapper .amount .currency-icon.nok:after,
.lsx-single-supplement-wrapper .amount .currency-icon.nok:after,
.unit-price-wrapper .amount .currency-icon.nok:after, .lsx-price-wrapper .amount .currency-icon.sek:after,
.lsx-single-supplement-wrapper .amount .currency-icon.sek:after,
.unit-price-wrapper .amount .currency-icon.sek:after {
content: "kr";
}
.lsx-price-wrapper .amount .currency-icon.rub:after {
.lsx-price-wrapper .amount .currency-icon.rub:after,
.lsx-single-supplement-wrapper .amount .currency-icon.rub:after,
.unit-price-wrapper .amount .currency-icon.rub:after {
content: "руб";
}
.lsx-price-wrapper .amount .currency-icon.chf:after {
.lsx-price-wrapper .amount .currency-icon.chf:after,
.lsx-single-supplement-wrapper .amount .currency-icon.chf:after,
.unit-price-wrapper .amount .currency-icon.chf:after {
content: "CHF";
}
.lsx-price-wrapper .amount .currency-icon.tzs:after {
.lsx-price-wrapper .amount .currency-icon.tzs:after,
.lsx-single-supplement-wrapper .amount .currency-icon.tzs:after,
.unit-price-wrapper .amount .currency-icon.tzs:after {
content: "TSh";
}
.lsx-price-wrapper .amount .currency-icon.aed:after {
.lsx-price-wrapper .amount .currency-icon.aed:after,
.lsx-single-supplement-wrapper .amount .currency-icon.aed:after,
.unit-price-wrapper .amount .currency-icon.aed:after {
content: "د.إ";
}
.lsx-price-wrapper .amount .currency-icon.zmw:after {
.lsx-price-wrapper .amount .currency-icon.zmw:after,
.lsx-single-supplement-wrapper .amount .currency-icon.zmw:after,
.unit-price-wrapper .amount .currency-icon.zmw:after {
content: "Zk";
}
.lsx-price-wrapper .amount .currency-icon.zwl:after {
.lsx-price-wrapper .amount .currency-icon.zwl:after,
.lsx-single-supplement-wrapper .amount .currency-icon.zwl:after,
.unit-price-wrapper .amount .currency-icon.zwl:after {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The changes in this section are primarily about adding new CSS selectors for .lsx-single-supplement-wrapper and .unit-price-wrapper. This is to ensure that the styles applied to the .lsx-price-wrapper are also applied to these new classes. The changes seem to be consistent with the existing code and there doesn't appear to be any issues.

Comment on lines +149 to +158
.lsx-price-wrapper,
.lsx-single-supplement-wrapper,
.unit-price-wrapper {
/*&:before {
background-image: url( ../img/icons/price-icon.png );
}*/
}
.lsx-price-wrapper .amount .currency-icon:after {
.lsx-price-wrapper .amount .currency-icon:after,
.lsx-single-supplement-wrapper .amount .currency-icon:after,
.unit-price-wrapper .amount .currency-icon:after {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Similar to the previous hunk, this change adds new CSS selectors for .lsx-single-supplement-wrapper and .unit-price-wrapper. It seems like the intention is to apply the same styles as those applied to .lsx-price-wrapper. The changes are consistent with the existing code and there doesn't appear to be any issues.

display: none;
}
/*# sourceMappingURL=style.css.map */
/*# sourceMappingURL=style.css.map */ No newline at end of file
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

This line removes a newline at the end of the file. While it's not a critical issue, it's generally a good practice to end files with a newline. This helps with compatibility across different systems and tools.

- /*# sourceMappingURL=style.css.map */
+ /*# sourceMappingURL=style.css.map */
+ 

name: 'Special Interests',
},
className: 'lsx-special-interests-wrapper',
className: 'lsx-special-interest-wrapper',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The class name has been changed from 'lsx-special-interests-wrapper' to 'lsx-special-interest-wrapper'. If there are any CSS or JavaScript selectors that rely on the old class name, they will need to be updated to reflect this change.

- className: 'lsx-special-interests-wrapper',
+ className: 'lsx-special-interest-wrapper',

name: 'Facilities',
},
className: 'lsx-facilities-wrapper',
className: 'lsx-facility-wrapper',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Similar to the previous comment, the class name has been changed from 'lsx-facilities-wrapper' to 'lsx-facility-wrapper'. Any dependent CSS or JavaScript selectors should be updated accordingly.

- className: 'lsx-facilities-wrapper',
+ className: 'lsx-facility-wrapper',

Comment on lines +1121 to +1141
['core/paragraph', {
metadata: {
bindings: {
content: {
source: 'lsx/post-connection',
args: {
key: 'facilities'
}
}
}
},
className: 'has-septenary-color has-text-color has-link-color has-primary-color has-primary-700-color',
style: {
spacing: {
padding: {
top: '2px',
bottom: '2px'
}
}
},
textColor: 'primary-700'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The block structure for displaying facilities has been significantly altered. The previous version used a 'core/post-terms' block with the term set to 'facility' and a font size of 'x-small'. The new version uses a 'core/paragraph' block with metadata bindings to source content from 'lsx/post-connection' with a key of 'facilities'. This is a significant change in how the facilities data is sourced and displayed, so it's important to ensure that the new method correctly retrieves and displays the desired data.

- ['core/post-terms', {
-   term: 'facility',
-   fontSize: 'x-small'
- }]
+ ['core/paragraph', {
+   metadata: {
+     bindings: {
+       content: {
+         source: 'lsx/post-connection',
+         args: {
+           key: 'facilities'
+         }
+       }
+     }
+   },
+   className: 'has-septenary-color has-text-color has-link-color has-primary-color has-primary-700-color',
+   style: {
+     spacing: {
+       padding: {
+         top: '2px',
+         bottom: '2px'
+       }
+     }
+   },
+   textColor: 'primary-700'
+ }]

Comment on lines +211 to +217
public function item_thumbnail( $size = 'large' ) {
$thumbnail_src = false;
$thumbnail_src = apply_filters( 'lsx_to_accommodation_room_thumbnail', $thumbnail_src );
if ( $this->have_query && false !== $this->query_item && ! empty( $this->query_item ) ) {
if ( false !== $this->query_item['gallery'] ) {
if ( isset( $this->query_item['gallery'] ) && ! empty( $this->query_item['gallery'] ) ) {
$images = array_keys( $this->query_item['gallery'] );
$thumbnail = wp_get_attachment_image_src( $images[0], 'medium' );
$thumbnail = wp_get_attachment_image_src( $images[0], $size );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The new code introduces a parameter $size to the item_thumbnail function, which allows specifying the size of the thumbnail image. This is a good improvement for flexibility. However, there's no validation or sanitization on the $size input. It's important to ensure that the provided size is one of the sizes registered with WordPress to avoid potential errors or unexpected behavior.

	public function item_thumbnail( $size = 'large' ) {
 		$thumbnail_src = false;
 		$thumbnail_src = apply_filters( 'lsx_to_accommodation_room_thumbnail', $thumbnail_src );
 		if ( $this->have_query && false !== $this->query_item && ! empty( $this->query_item ) ) {
			if ( isset( $this->query_item['gallery'] ) && ! empty( $this->query_item['gallery'] ) ) {
 				$images = array_keys( $this->query_item['gallery'] );
+               if (!in_array($size, get_intermediate_image_sizes())) {
+                   $size = 'large'; // default to 'large' if the provided size is not valid
+               }
				$thumbnail = wp_get_attachment_image_src( $images[0], $size );
 				if ( is_array( $thumbnail ) ) {
 					$thumbnail_src = $thumbnail[0];
 				}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Parent: Tour Operator Plugin Tasks

2 participants