Skip to content

Conversation

@soderlind
Copy link
Owner

This pull request introduces a major refactor to adopt PSR-4 autoloading via Composer and standardizes class naming conventions throughout the codebase. It also updates all references in source and translation files to match the new class and file names. The custom autoloader is removed in favor of Composer's autoloader, making the codebase more maintainable and compliant with modern PHP standards.

Autoloading and Class/File Naming Refactor:

  • Migrated to PSR-4 autoloading using Composer, removing the previous custom autoloader.
  • Renamed all class files in the includes directory to use PascalCase (e.g., class-admin-settings.phpAdminSettings.php).
  • Updated all class names from underscore style to PascalCase (e.g., Admin_SettingsAdminSettings, Cookie_HandlerCookieHandler, etc.) in both class definitions and all usages. [1] [2] [3] [4]

Documentation and Translation Updates:

  • Updated the changelog to reflect the new version (1.2.0) and summarize the refactor.
  • Updated translation template (.pot) and Norwegian translation (.po) files to reference the new PascalCase file and class names, ensuring all translation keys point to the correct source locations. [1] [2] [3] [4]

Code Consistency:

  • Updated all PHPDoc annotations and type hints to use the new class names. [1] [2]
  • Adjusted constructor type hints and usages to reference the newly named classes.

- Added `CookieHandler.php`:
  - Introduced a new class to manage authentication cookies for password-protected posts.
  - Implemented methods to set, validate, and clear cookies, ensuring secure handling of user sessions.

- Added `GitHubPluginUpdater.php`:
  - Created a class to facilitate automatic updates for the plugin from GitHub repositories.
  - Included methods for configuration and setup of the update checker, allowing for flexible integration with GitHub.

- Added `Protection.php`:
  - Developed a class to handle password protection logic for posts and pages.
  - Implemented methods to check if a page requires protection, display a password form, and handle form submissions.
  - Integrated cookie validation to manage user access based on authentication status.

These changes enhance the security and update management of the PassWP Posts plugin, providing a robust framework for password protection and seamless updates from GitHub.
@soderlind soderlind merged commit db3c45f into main Dec 15, 2025
3 checks 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.

2 participants