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

Feature/plugin DI #63

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.log
.htaccess
.svn
.env
sitemap.xml
sitemap.xml.gz
wp-config.php
Expand Down
1 change: 1 addition & 0 deletions wp-content/plugins/ewplugin/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Empty env file
42 changes: 6 additions & 36 deletions wp-content/plugins/ewplugin/admin/class-plugin-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace EwStarter\Admin;

use EwStarter\Admin\Interfaces\Plugin_Admin_Interface;

/**
* The admin-specific functionality of the plugin.
*
Expand All @@ -12,52 +14,20 @@
* @subpackage EWPlugin/admin
* @author Enterwell <[email protected]>
*/
class Plugin_Admin {

/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private string $plugin_name;

/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private string $version;

class Plugin_Admin implements Plugin_Admin_Interface {
/**
* Initialize the class and set its properties.
* Register the JavaScript for the admin area.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( string $plugin_name, string $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
public function enqueue_scripts(): void {
}

/**
* Register the stylesheets for the admin area.
* Register styles for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles(): void {
}

/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts(): void {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace EwStarter\Admin\Interfaces;

/**
* Admin plugin interface.
*/
interface Plugin_Admin_Interface {
/**
* Function used to enqueue admin scripts.
*/
function enqueue_scripts(): void;

/**
* Used to enqueue admin styles.
*/
function enqueue_styles(): void;
}
8 changes: 6 additions & 2 deletions wp-content/plugins/ewplugin/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"require": {
"vlucas/phpdotenv": "^2.5",
"enterwell/wp-helpers": "^1.0"
"enterwell/wp-helpers": "^1.0",
"vlucas/phpdotenv": "^5.6",
"php-di/php-di": "^7.0",
"brain/monkey": "^2.6",
"mockery/mockery": "^1.6",
"antecedent/patchwork": "^2.2"
},
"require-dev": {
"phpunit/phpunit": "^9",
Expand Down
Loading
Loading