class-translations.php
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace LearnDash\Course_Grid;
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
use LearnDash_Translations;
use LearnDash_Settings_Section;
if ( ( class_exists( 'LearnDash_Settings_Section' ) ) ) {
class Translations extends LearnDash_Settings_Section {
// Must match the Text Domain
private $project_slug = 'learndash-course-grid';
private $registered = false;
function __construct() {
$this->settings_page_id = 'learndash_lms_translations';
// Used within the Settings API to uniquely identify this section
$this->settings_section_key = 'settings_translations_'. $this->project_slug;
// Section label/header
$this->settings_section_label = __( 'LearnDash LMS - Course Grid', 'learndash-course-grid' );
// Class LearnDash_Translations add LD v2.5.0
if ( class_exists( 'LearnDash_Translations' ) ) {
// Method register_translation_slug add LD v2.5.5
if ( method_exists( 'LearnDash_Translations', 'register_translation_slug' ) ) {
$this->registered = true;
LearnDash_Translations::register_translation_slug( $this->project_slug, LEARNDASH_COURSE_GRID_PLUGIN_PATH . 'languages' );
}
}
parent::__construct();
}
function add_meta_boxes( $settings_screen_id = '' ) {
if ( ( $settings_screen_id == $this->settings_screen_id ) && ( $this->registered === true ) ) {
parent::add_meta_boxes( $settings_screen_id );
}
}
function show_meta_box() {
$ld_translations = new LearnDash_Translations( $this->project_slug );
$ld_translations->show_meta_box();
}
}
add_action( 'init', function() {
Translations::add_section_instance();
} );
}