Skip to content

Commit

Permalink
updated - and moved classes related to the widgets class
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveJonesDev committed Dec 15, 2023
1 parent 935e376 commit e99fd27
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 38 deletions.
38 changes: 6 additions & 32 deletions accessibility-checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@
require_once plugin_dir_path( __FILE__ ) . 'includes/purge.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/system-info.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-admin-notices.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-rest-api.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-helpers.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-settings.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-issues-query.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-scans-stats.php';
require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-widgets.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-rest-api.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-helpers.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-settings.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-issues-query.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-scans-stats.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-widgets.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-welcome-page.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-ajax.php';
//require_once plugin_dir_path( __FILE__ ) . 'includes/classes/class-frontend-highlight.php';
Expand All @@ -172,7 +172,6 @@
/**
* Filters and Actions
*/
add_action( 'init', 'edac_init' );
add_action( 'admin_enqueue_scripts', 'edac_admin_enqueue_scripts' );
add_action( 'admin_enqueue_scripts', 'edac_admin_enqueue_styles' );
add_action( 'wp_enqueue_scripts', 'edac_enqueue_scripts' );
Expand All @@ -193,15 +192,6 @@
add_action( 'updated_post_meta', 'edac_oxygen_builder_save_post', 10, 4 );
}
//add_action( 'admin_init', 'edac_anww_update_post_meta' );
add_action( 'wp_dashboard_setup', 'edac_wp_dashboard_setup' );

/**
* Init the plugin
*/
function edac_init() {
// instantiate the classes that need to load hooks early.
new \EDAC\Rest_Api();
}

/**
* Create/Update database
Expand Down Expand Up @@ -307,22 +297,6 @@ function edac_before_page_render() {
}
}

/**
* Add dashboard widget
*
* @return void
*/
function edac_wp_dashboard_setup() {
wp_add_dashboard_widget(
'edac_dashboard_scan_summary',
'Accessibility Checker',
array(
'\EDAC\Widgets',
'render_dashboard_scan_summary',
)
);
}

/**
* Summary Data
*
Expand Down
7 changes: 6 additions & 1 deletion admin/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

namespace EDAC\Admin;
use EDAC;

/**
* Admin handling class.
Expand All @@ -28,6 +29,11 @@ public function __construct() {
private function init() {
$admin_notices = new \EDAC\Admin\Admin_Notices();
$admin_notices->init_hooks();

$widgets = new \EDAC\Admin\Widgets();
$widgets->init_hooks();

new EDAC\REST_Api();
}

/**
Expand All @@ -46,5 +52,4 @@ private function init_ajax() {
$frontend_highlight = new \EDAC\Admin\Frontend_Highlight();
$frontend_highlight->init_hooks();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace EDAC;

use EDAC\Helpers;
use EDAC\Settings;
use EDAC\Admin\Settings;

/**
* Class that handles calculating scan report data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace EDAC;

use EDAC\Scans_Stats;
use EDAC\Settings;
use EDAC\Admin\Settings;
use EDAC\Helpers;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace EDAC;

use EDAC\Settings;
use EDAC\Admin\Settings;
use EDAC\Helpers;
use EDAC\Issues_Query;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Accessibility_Checker
*/

namespace EDAC;
namespace EDAC\Admin;

use EDAC\Helpers;

Expand Down
23 changes: 22 additions & 1 deletion includes/classes/class-widgets.php → admin/class-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,34 @@
* @package Accessibility_Checker
*/

namespace EDAC;
namespace EDAC\Admin;

/**
* Class that handles widgets
*/
class Widgets {

/**
* Initialize hooks.
*
* @return void
*/
public function init_hooks() {
add_action( 'wp_dashboard_setup', array( $this, 'dashboard_setup' ) );
}

/**
* Add dashboard widget
*
* @return void
*/
public function dashboard_setup() {
wp_add_dashboard_widget(
'edac_dashboard_scan_summary',
'Accessibility Checker',
array( $this, 'render_dashboard_scan_summary' )
);
}

/**
* Renders as widget
Expand Down

0 comments on commit e99fd27

Please sign in to comment.