You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current codebase is not well divided into to subclasses responsible for a single thing. It is difficult knowing where each part belongs and the classes are very long.
Restructure files into the recommended file and folder structure. This includes deviding the current files into separate files when it makes sense.
Example: admin/class-ss-shipping-wc-order.php
It seems that autoloading (we cannot assume composer is available) is not widely used in WordPress and it makes no sense making our own autoloader. Instead simply using require_once No need to have our own autoloader implementation
Implement a order utility class that can be used to pull relevant stuff from a WC_Order instance (using the filters we offer and such).
Move calls from SS_SHIPPING_WC()->example() to te new SS_Order_Util::example()
The text was updated successfully, but these errors were encountered:
- build/ | All the files produced during build process
- includes/ | Where to put code that isn’t exclusive to the admin or public (like SDK for external communication)
- vendor/
- smart-send/
- public/
- css/
- ss-shipping-frontend.css
- class-ss-shipping-frontend.php
- admin/ | Contains code exclusive for admins
- css/
- ss-shipping-admin.css
- js/
- ss-shipping-test-connection.js
- ss-shipping-label.js
- ss-shipping-admin.js
- partials/ | Include HTML formatting file like displaying the order meta box
- class-ss-shipping-endpoint.php
- class-ss-shipping-shipment.php
- class-ss-shipping-wc-method.php
- class-ss-shipping-wc-order.php
- class-ss-shipping-wc-product.php
- src/ | Contains the raw, uncompiled code, including JavaScript, CSS, and other assets necessary for developing the block
- pickup-point-block/
- index.js
- block.json | Contains metadata for automatic optimization of assets
- styles.scss
- .prettierrc.js
- phpcs.xml
- smart-send-logistics.php | Main Plugin File
- smart-send-extend-woo-core.php
- readme.txt | A required file for any WordPress plugin with description of author, ...
- index.php | An empty file that is there for (proposed) security reasons
- uninstall.php | Unsed to cleanup or the like when uninstalling the plugin
- package.json
- composer.json
- composer.lock
- configuration-files (many files)
The current codebase is not well divided into to subclasses responsible for a single thing. It is difficult knowing where each part belongs and the classes are very long.
Notes
Best practices: https://developer.wordpress.org/plugins/plugin-basics/best-practices/
Boilerplate plugin using Main plugin file, then one or more class files
Note that namespace is not normally used in WordPress (see Boilerplate without namespaces, article about namespacing: Instead use the class name and folder structure from best practices and the Block folder structure:
admin/class-ss-shipping-wc-order.php
require_once
No need to have our own autoloader implementationWC_Order
instance (using the filters we offer and such).SS_SHIPPING_WC()->example()
to te newSS_Order_Util::example()
The text was updated successfully, but these errors were encountered: