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

Namespaces #393

Merged
merged 18 commits into from Dec 11, 2023
Merged

Namespaces #393

merged 18 commits into from Dec 11, 2023

Conversation

Ipstenu
Copy link
Contributor

@Ipstenu Ipstenu commented Dec 8, 2023

One of my long-term goals was to bring this repo up to MODERN PHP Standards (we Predate PHP 7, let alone 8!) and make it easier to update.

I used LWTV as my testbed to build out an autoloader, and restructured things as follows:

  • functions.php - Main Plugin file. Loads auto-loader, components, and defines.
  • /assets/ - Plugin assets
  • /bin/ - Scripts used for PHP Unit Testing
  • /node_scripts/ - Scripts used by Node to properly move content.
  • /php/ - All functional code
  • /plugins/ - Forked 3rd party plugins
  • /tests/ - Unit Tests

Instead of 100 top-level folders, all the code is in /php/ and uses the concept of implementing components that can be dynamically called.

The code is about 80% documented via DocBlocks, and the readme are up to date.

Components

A Component can be thought of as a sub-plugin. It is an atomic, independent module that stores business logic related to a specific feature. It may expose some template tags (functions) that can be called from within the theme as lwtv_plugin()->FUNCTION_NAME() which allows us to connect plugin and theme without needing to know specific classes and/or namespaces.

All Components are stored in /php/ and the details of their use and implementation is in /php/readme.md

To Do

  • Actually run a build on the CSS/JS to combine files (this would mean a lot of code-rewriting)
  • Have the blocks build to outside the PHP folder

Post Merge

After this is merged, you must run LezWatch/lwtv-underscores#199 to ensure the theme is compatible

@Ipstenu Ipstenu merged commit 07cdf4d into production Dec 11, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant