@@ -175,8 +183,8 @@ public function analysis_admin_menu() {
if ( current_user_can( 'manage_sensei_grades' ) ) {
add_submenu_page(
'sensei',
- $this->name,
- $this->name,
+ $this->get_name(),
+ $this->get_name(),
'manage_sensei_grades',
self::PAGE_SLUG,
array( $this, 'analysis_page' )
@@ -581,7 +589,7 @@ public function wrapper_container( $which ) {
*/
public function analysis_default_nav() {
_deprecated_function( __METHOD__, '4.2.0' );
- $title = $this->name;
+ $title = $this->get_name();
?>
self::PAGE_SLUG,
);
- $title = sprintf( '%s', esc_url( add_query_arg( $analysis_args, admin_url( 'admin.php' ) ) ), esc_html( $this->name ) );
+ $title = sprintf( '%s', esc_url( add_query_arg( $analysis_args, admin_url( 'admin.php' ) ) ), esc_html( $this->get_name() ) );
if ( isset( $_GET['user_id'] ) && 0 < intval( $_GET['user_id'] ) ) {
$user_id = intval( $_GET['user_id'] );
$url = esc_url(
@@ -656,7 +664,7 @@ public function analysis_user_course_nav() {
$analysis_args = array(
'page' => self::PAGE_SLUG,
);
- $title = sprintf( '%s', esc_url( add_query_arg( $analysis_args, admin_url( 'admin.php' ) ) ), esc_html( $this->name ) );
+ $title = sprintf( '%s', esc_url( add_query_arg( $analysis_args, admin_url( 'admin.php' ) ) ), esc_html( $this->get_name() ) );
if ( isset( $_GET['user_id'] ) && 0 < intval( $_GET['user_id'] ) ) {
$user_id = intval( $_GET['user_id'] );
$user_data = get_userdata( $user_id );
@@ -711,7 +719,7 @@ public function analysis_course_nav() {
$analysis_args = array(
'page' => self::PAGE_SLUG,
);
- $title = sprintf( '%s', add_query_arg( $analysis_args, admin_url( 'admin.php' ) ), esc_html( $this->name ) );
+ $title = sprintf( '%s', add_query_arg( $analysis_args, admin_url( 'admin.php' ) ), esc_html( $this->get_name() ) );
if ( isset( $_GET['course_id'] ) ) {
$course_id = intval( $_GET['course_id'] );
$url = add_query_arg(
@@ -753,7 +761,7 @@ public function analysis_course_users_nav() {
$analysis_args = array(
'page' => self::PAGE_SLUG,
);
- $title = sprintf( '%s', add_query_arg( $analysis_args, admin_url( 'admin.php' ) ), esc_html( $this->name ) );
+ $title = sprintf( '%s', add_query_arg( $analysis_args, admin_url( 'admin.php' ) ), esc_html( $this->get_name() ) );
if ( isset( $_GET['course_id'] ) ) {
$course_id = intval( $_GET['course_id'] );
$url = add_query_arg(
@@ -795,7 +803,7 @@ public function analysis_lesson_users_nav() {
$analysis_args = array(
'page' => self::PAGE_SLUG,
);
- $title = sprintf( '%s', add_query_arg( $analysis_args, admin_url( 'admin.php' ) ), esc_html( $this->name ) );
+ $title = sprintf( '%s', add_query_arg( $analysis_args, admin_url( 'admin.php' ) ), esc_html( $this->get_name() ) );
if ( isset( $_GET['lesson_id'] ) ) {
$lesson_id = intval( $_GET['lesson_id'] );
$course_id = intval( get_post_meta( $lesson_id, '_lesson_course', true ) );
diff --git a/includes/class-sensei-customizer.php b/includes/class-sensei-customizer.php
index d87ccc0925..57eeba6741 100644
--- a/includes/class-sensei-customizer.php
+++ b/includes/class-sensei-customizer.php
@@ -10,19 +10,22 @@
* Add customizer settings.
*/
class Sensei_Customizer {
-
/**
- * Configurable colors.
- *
- * @var array[]
+ * Sensei_Customizer constructor.
*/
- private $colors;
+ public function __construct() {
+ add_action( 'customize_register', [ $this, 'add_customizer_settings' ] );
+ add_action( 'customize_preview_init', [ $this, 'enqueue_customizer_helper' ] );
+ add_action( 'wp_head', [ $this, 'output_custom_settings' ] );
+ }
/**
- * Sensei_Customizer constructor.
+ * Get the configurable colors.
+ *
+ * @return array[]
*/
- public function __construct() {
- $this->colors = [
+ private function get_colors() {
+ return [
'sensei-course-theme-primary-color' => [
'label' => __( 'Primary Color', 'sensei-lms' ),
'default' => '#1e1e1e',
@@ -36,16 +39,12 @@ public function __construct() {
'default' => '#1e1e1e',
],
];
-
- add_action( 'customize_register', [ $this, 'add_customizer_settings' ] );
- add_action( 'customize_preview_init', [ $this, 'enqueue_customizer_helper' ] );
- add_action( 'wp_head', [ $this, 'output_custom_settings' ] );
}
/**
* Add Sensei section and settings to Customizer.
*
- * @param WP_Customize_Manager $wp_customize
+ * @param WP_Customize_Manager $wp_customize The WP_Customize_Manager instance.
*/
public function add_customizer_settings( WP_Customize_Manager $wp_customize ) {
@@ -59,7 +58,7 @@ public function add_customizer_settings( WP_Customize_Manager $wp_customize ) {
]
);
- foreach ( $this->colors as $variable => $settings ) {
+ foreach ( $this->get_colors() as $variable => $settings ) {
$wp_customize->add_setting(
$variable,
@@ -84,7 +83,6 @@ public function add_customizer_settings( WP_Customize_Manager $wp_customize ) {
)
);
}
-
}
/**
@@ -103,7 +101,7 @@ public function output_custom_settings() {
$css = '';
- foreach ( $this->colors as $variable => $settings ) {
+ foreach ( $this->get_colors() as $variable => $settings ) {
$value = get_option( $variable );
if ( $value && $value !== $settings['default'] ) {
$css .= sprintf( "--%s: %s;\n", $variable, ( $value ) );
@@ -127,7 +125,7 @@ public function output_customizer_helper() {
?>