@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | ?> |
13 | 13 | |
14 | -<?php get_sensei_header(); ?> |
|
14 | +<?php get_sensei_header(); ?> |
|
15 | 15 | |
16 | 16 | <?php |
17 | 17 | /** |
@@ -21,15 +21,15 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @hooked Sensei_Course_Results::deprecate_sensei_course_results_content_hook() - 20 |
23 | 23 | */ |
24 | -do_action( 'sensei_course_results_content_before' ); |
|
24 | +do_action('sensei_course_results_content_before'); |
|
25 | 25 | ?> |
26 | 26 | |
27 | 27 | <?php |
28 | 28 | global $course; |
29 | -$course = get_page_by_path( $wp_query->query_vars['course_results'], OBJECT, 'course' ); |
|
29 | +$course = get_page_by_path($wp_query->query_vars['course_results'], OBJECT, 'course'); |
|
30 | 30 | ?> |
31 | 31 | |
32 | -<article <?php post_class( array( 'course', 'post','course-results' ) ); ?> > |
|
32 | +<article <?php post_class(array('course', 'post', 'course-results')); ?> > |
|
33 | 33 | |
34 | 34 | <section class="entry fix"> |
35 | 35 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param integer $course_id |
43 | 43 | * |
44 | 44 | */ |
45 | - do_action( 'sensei_course_results_content_inside_before', $course->ID ); |
|
45 | + do_action('sensei_course_results_content_inside_before', $course->ID); |
|
46 | 46 | ?> |
47 | 47 | |
48 | 48 | <header> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | </header> |
55 | 55 | |
56 | - <?php if ( is_user_logged_in() ):?> |
|
56 | + <?php if (is_user_logged_in()):?> |
|
57 | 57 | |
58 | 58 | <?php |
59 | 59 | /** |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @hooked Sensei_Course_Results::course_info() - 20 |
67 | 67 | */ |
68 | - do_action( 'sensei_course_results_content_inside_before_lessons', $course->ID ); |
|
68 | + do_action('sensei_course_results_content_inside_before_lessons', $course->ID); |
|
69 | 69 | ?> |
70 | 70 | |
71 | 71 | |
72 | 72 | <section class="course-results-lessons"> |
73 | 73 | <?php |
74 | - $started_course = Sensei_Utils::user_started_course( $course->ID, get_current_user_id() ); |
|
75 | - if( $started_course ) { |
|
74 | + $started_course = Sensei_Utils::user_started_course($course->ID, get_current_user_id()); |
|
75 | + if ($started_course) { |
|
76 | 76 | |
77 | 77 | sensei_the_course_results_lessons(); |
78 | 78 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @hooked Sensei()->course_results->course_info - 20 |
94 | 94 | */ |
95 | - do_action( 'sensei_course_results_content_inside_after', $course->ID ); |
|
95 | + do_action('sensei_course_results_content_inside_after', $course->ID); |
|
96 | 96 | ?> |
97 | 97 | |
98 | 98 | </section> |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @since 1.9.0 |
107 | 107 | * |
108 | 108 | */ |
109 | -do_action( 'sensei_course_results_content_after' ); |
|
109 | +do_action('sensei_course_results_content_after'); |
|
110 | 110 | ?> |
111 | 111 | |
112 | 112 |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The Template for displaying course archives, including the course page template. |
|
4 | - * |
|
5 | - * Override this template by copying it to yourtheme/sensei/archive-course.php |
|
6 | - * |
|
7 | - * @author Automattic |
|
8 | - * @package Sensei |
|
9 | - * @category Templates |
|
10 | - * @version 1.9.0 |
|
11 | - */ |
|
3 | + * The Template for displaying course archives, including the course page template. |
|
4 | + * |
|
5 | + * Override this template by copying it to yourtheme/sensei/archive-course.php |
|
6 | + * |
|
7 | + * @author Automattic |
|
8 | + * @package Sensei |
|
9 | + * @category Templates |
|
10 | + * @version 1.9.0 |
|
11 | + */ |
|
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <?php get_sensei_header(); ?> |
15 | 15 | |
16 | 16 | <?php |
17 | 17 | /** |
18 | - * This hook fire inside learner-profile.php before the content |
|
19 | - * |
|
20 | - * @since 1.9.0 |
|
21 | - * |
|
22 | - * @hooked Sensei_Course_Results::deprecate_sensei_course_results_content_hook() - 20 |
|
23 | - */ |
|
18 | + * This hook fire inside learner-profile.php before the content |
|
19 | + * |
|
20 | + * @since 1.9.0 |
|
21 | + * |
|
22 | + * @hooked Sensei_Course_Results::deprecate_sensei_course_results_content_hook() - 20 |
|
23 | + */ |
|
24 | 24 | do_action( 'sensei_course_results_content_before' ); |
25 | 25 | ?> |
26 | 26 | |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | <section class="entry fix"> |
35 | 35 | |
36 | 36 | <?php |
37 | - /** |
|
38 | - * This hook fire inside learner-profile.php inside directly before the content |
|
39 | - * |
|
40 | - * @since 1.9.0 |
|
41 | - * |
|
42 | - * @param integer $course_id |
|
43 | - * |
|
44 | - */ |
|
45 | - do_action( 'sensei_course_results_content_inside_before', $course->ID ); |
|
46 | - ?> |
|
37 | + /** |
|
38 | + * This hook fire inside learner-profile.php inside directly before the content |
|
39 | + * |
|
40 | + * @since 1.9.0 |
|
41 | + * |
|
42 | + * @param integer $course_id |
|
43 | + * |
|
44 | + */ |
|
45 | + do_action( 'sensei_course_results_content_inside_before', $course->ID ); |
|
46 | + ?> |
|
47 | 47 | |
48 | 48 | <header> |
49 | 49 | |
@@ -56,44 +56,44 @@ discard block |
||
56 | 56 | <?php if ( is_user_logged_in() ):?> |
57 | 57 | |
58 | 58 | <?php |
59 | - /** |
|
60 | - * This hook fire inside learner-profile.php inside directly before the content |
|
61 | - * |
|
62 | - * @since 1.9.0 |
|
63 | - * |
|
64 | - * @param integer $course_id |
|
65 | - * |
|
66 | - * @hooked Sensei_Course_Results::course_info() - 20 |
|
67 | - */ |
|
68 | - do_action( 'sensei_course_results_content_inside_before_lessons', $course->ID ); |
|
69 | - ?> |
|
59 | + /** |
|
60 | + * This hook fire inside learner-profile.php inside directly before the content |
|
61 | + * |
|
62 | + * @since 1.9.0 |
|
63 | + * |
|
64 | + * @param integer $course_id |
|
65 | + * |
|
66 | + * @hooked Sensei_Course_Results::course_info() - 20 |
|
67 | + */ |
|
68 | + do_action( 'sensei_course_results_content_inside_before_lessons', $course->ID ); |
|
69 | + ?> |
|
70 | 70 | |
71 | 71 | |
72 | 72 | <section class="course-results-lessons"> |
73 | 73 | <?php |
74 | - $started_course = Sensei_Utils::user_started_course( $course->ID, get_current_user_id() ); |
|
75 | - if( $started_course ) { |
|
74 | + $started_course = Sensei_Utils::user_started_course( $course->ID, get_current_user_id() ); |
|
75 | + if( $started_course ) { |
|
76 | 76 | |
77 | - sensei_the_course_results_lessons(); |
|
77 | + sensei_the_course_results_lessons(); |
|
78 | 78 | |
79 | - } |
|
80 | - ?> |
|
79 | + } |
|
80 | + ?> |
|
81 | 81 | </section> |
82 | 82 | |
83 | 83 | <?php endif; ?> |
84 | 84 | |
85 | 85 | <?php |
86 | - /** |
|
87 | - * This hook fire inside learner-profile.php inside directly after the content |
|
88 | - * |
|
89 | - * @since 1.9.0 |
|
90 | - * |
|
91 | - * @param integer $course_id |
|
92 | - * |
|
93 | - * @hooked Sensei()->course_results->course_info - 20 |
|
94 | - */ |
|
95 | - do_action( 'sensei_course_results_content_inside_after', $course->ID ); |
|
96 | - ?> |
|
86 | + /** |
|
87 | + * This hook fire inside learner-profile.php inside directly after the content |
|
88 | + * |
|
89 | + * @since 1.9.0 |
|
90 | + * |
|
91 | + * @param integer $course_id |
|
92 | + * |
|
93 | + * @hooked Sensei()->course_results->course_info - 20 |
|
94 | + */ |
|
95 | + do_action( 'sensei_course_results_content_inside_after', $course->ID ); |
|
96 | + ?> |
|
97 | 97 | |
98 | 98 | </section> |
99 | 99 | |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | |
102 | 102 | <?php |
103 | 103 | /** |
104 | - * This hook fire inside course-results.php before the content |
|
105 | - * |
|
106 | - * @since 1.9.0 |
|
107 | - * |
|
108 | - */ |
|
104 | + * This hook fire inside course-results.php before the content |
|
105 | + * |
|
106 | + * @since 1.9.0 |
|
107 | + * |
|
108 | + */ |
|
109 | 109 | do_action( 'sensei_course_results_content_after' ); |
110 | 110 | ?> |
111 | 111 |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | * |
19 | 19 | ***************************/ |
20 | 20 | //This hook allow us to change the template WordPress loads for a given page/post_type @since 1.9.0 |
21 | -add_filter( 'template_include', array ( 'Sensei_Templates', 'template_loader' ), 10, 1 ); |
|
21 | +add_filter('template_include', array('Sensei_Templates', 'template_loader'), 10, 1); |
|
22 | 22 | |
23 | 23 | //This hook adds the sensei pagination to the pagination hook |
24 | -add_action( 'sensei_pagination', array( 'Sensei_Frontend', 'load_content_pagination' ), 30 ); |
|
24 | +add_action('sensei_pagination', array('Sensei_Frontend', 'load_content_pagination'), 30); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | /*************************** |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | * |
33 | 33 | ***************************/ |
34 | 34 | // deprecate the archive content hook @since 1.9.0 |
35 | -add_action( 'sensei_archive_before_course_loop', array ( 'Sensei_Templates', 'deprecated_archive_course_content_hook' ), 10, 1 ); |
|
35 | +add_action('sensei_archive_before_course_loop', array('Sensei_Templates', 'deprecated_archive_course_content_hook'), 10, 1); |
|
36 | 36 | |
37 | 37 | // Course archive title hook @since 1.9.0 |
38 | -add_action('sensei_archive_before_course_loop', array( 'Sensei_Course', 'archive_header' ), 10, 0 ); |
|
38 | +add_action('sensei_archive_before_course_loop', array('Sensei_Course', 'archive_header'), 10, 0); |
|
39 | 39 | |
40 | 40 | // add the course image above the content |
41 | -add_action('sensei_course_content_inside_before', array( Sensei()->course, 'course_image' ) ,10, 1 ); |
|
41 | +add_action('sensei_course_content_inside_before', array(Sensei()->course, 'course_image'), 10, 1); |
|
42 | 42 | |
43 | 43 | // add course content title to the courses on the archive page |
44 | -add_action('sensei_course_content_inside_before', array( 'Sensei_Templates', 'the_title' ) ,5, 1 ); |
|
44 | +add_action('sensei_course_content_inside_before', array('Sensei_Templates', 'the_title'), 5, 1); |
|
45 | 45 | |
46 | 46 | /*************************** |
47 | 47 | * |
@@ -53,33 +53,33 @@ discard block |
||
53 | 53 | // @1.9.0 |
54 | 54 | // add deprecated action hooks for backwards compatibility sake |
55 | 55 | // hooks on single course page: sensei_course_image , sensei_course_single_title, sensei_course_single_meta |
56 | -add_action('sensei_single_course_content_inside_before', array( 'Sensei_Templates', 'deprecated_single_course_inside_before_hooks' ), 80); |
|
56 | +add_action('sensei_single_course_content_inside_before', array('Sensei_Templates', 'deprecated_single_course_inside_before_hooks'), 80); |
|
57 | 57 | |
58 | 58 | // @1.9.0 |
59 | 59 | // hook the single course title on the single course page |
60 | -add_action( 'sensei_single_course_content_inside_before',array( 'Sensei_Course', 'the_title'), 10 ); |
|
60 | +add_action('sensei_single_course_content_inside_before', array('Sensei_Course', 'the_title'), 10); |
|
61 | 61 | |
62 | 62 | // @1.9.0 |
63 | 63 | // hook the single course title on the single course page |
64 | -add_action( 'sensei_single_course_content_inside_before', array( Sensei()->course , 'course_image'), 20 ); |
|
64 | +add_action('sensei_single_course_content_inside_before', array(Sensei()->course, 'course_image'), 20); |
|
65 | 65 | |
66 | 66 | |
67 | 67 | // @1.9.0 |
68 | 68 | //Add legacy hooks deprecated in 1.9.0 |
69 | -add_action( 'sensei_single_course_content_inside_before', array( 'Sensei_Templates','deprecate_course_single_meta_hooks'), 10 ); |
|
69 | +add_action('sensei_single_course_content_inside_before', array('Sensei_Templates', 'deprecate_course_single_meta_hooks'), 10); |
|
70 | 70 | |
71 | 71 | // @1.9.0 |
72 | 72 | // Filter the content and replace it with the excerpt if the user doesn't have full access |
73 | -add_filter( 'the_content', array('Sensei_Course', 'single_course_content' ) ); |
|
73 | +add_filter('the_content', array('Sensei_Course', 'single_course_content')); |
|
74 | 74 | |
75 | 75 | // @1.9.0 |
76 | 76 | // Deprecate lessons specific single course hooks |
77 | -add_action( 'sensei_single_course_content_inside_after', array( 'Sensei_Templates','deprecate_sensei_course_single_lessons_hook' ) ); |
|
77 | +add_action('sensei_single_course_content_inside_after', array('Sensei_Templates', 'deprecate_sensei_course_single_lessons_hook')); |
|
78 | 78 | |
79 | 79 | // @1.9.0 |
80 | 80 | // Deprecate single main content hooks |
81 | -add_action( 'sensei_single_course_content_inside_after', array( 'Sensei_Templates', 'deprecated_single_main_content_hook') ); |
|
82 | -add_action( 'sensei_single_message_content_inside_after', array( 'Sensei_Templates', 'deprecated_single_main_content_hook') ); |
|
81 | +add_action('sensei_single_course_content_inside_after', array('Sensei_Templates', 'deprecated_single_main_content_hook')); |
|
82 | +add_action('sensei_single_message_content_inside_after', array('Sensei_Templates', 'deprecated_single_main_content_hook')); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Deprecate all the post type single titile hooks in favor of before content and after content hooks |
@@ -87,62 +87,62 @@ discard block |
||
87 | 87 | * @deprecate 1.9.0 |
88 | 88 | * @1.9.0 |
89 | 89 | */ |
90 | -add_action('sensei_single_message_content_inside_before', array( 'Sensei_Templates', 'deprecate_all_post_type_single_title_hooks' ) ); |
|
90 | +add_action('sensei_single_message_content_inside_before', array('Sensei_Templates', 'deprecate_all_post_type_single_title_hooks')); |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Deprecate hooks into the single course modules |
94 | 94 | * @deprecated since 1.9.0 |
95 | 95 | */ |
96 | -add_action('sensei_single_course_modules_before', array('Sensei_Templates','deprecate_module_before_hook' ) ); |
|
97 | -add_action('sensei_single_course_modules_after', array('Sensei_Templates','deprecate_module_after_hook' ) ); |
|
96 | +add_action('sensei_single_course_modules_before', array('Sensei_Templates', 'deprecate_module_before_hook')); |
|
97 | +add_action('sensei_single_course_modules_after', array('Sensei_Templates', 'deprecate_module_after_hook')); |
|
98 | 98 | |
99 | 99 | // @since 1.9.0 |
100 | 100 | // add the single course lessons title |
101 | -add_action( 'sensei_single_course_content_inside_after' , array( 'Sensei_Course','the_course_lessons_title'), 9 ); |
|
101 | +add_action('sensei_single_course_content_inside_after', array('Sensei_Course', 'the_course_lessons_title'), 9); |
|
102 | 102 | |
103 | 103 | // @since 1.9.0 |
104 | 104 | // hooks in the course lessons query and remove it at the end |
105 | 105 | // also loading the course lessons template in the middle |
106 | -add_action( 'sensei_single_course_lessons_before', array('Sensei_Course','load_single_course_lessons_query' ) ); |
|
107 | -add_action( 'sensei_single_course_content_inside_after', 'course_single_lessons', 10 ); |
|
108 | -add_action( 'sensei_single_course_lessons_after', array( 'Sensei_Utils','restore_wp_query' )); |
|
106 | +add_action('sensei_single_course_lessons_before', array('Sensei_Course', 'load_single_course_lessons_query')); |
|
107 | +add_action('sensei_single_course_content_inside_after', 'course_single_lessons', 10); |
|
108 | +add_action('sensei_single_course_lessons_after', array('Sensei_Utils', 'restore_wp_query')); |
|
109 | 109 | |
110 | 110 | // @since 1.9.0 |
111 | 111 | // add post classes to the lessons on the single course page |
112 | -add_filter( 'post_class', array( 'Sensei_Lesson', 'single_course_lessons_classes' ) ); |
|
112 | +add_filter('post_class', array('Sensei_Lesson', 'single_course_lessons_classes')); |
|
113 | 113 | |
114 | 114 | // @since 1.9.0 |
115 | 115 | // lesson meta information on the single course page |
116 | -add_action( 'sensei_single_course_inside_before_lesson', array('Sensei_Lesson','the_lesson_meta') , 5); |
|
116 | +add_action('sensei_single_course_inside_before_lesson', array('Sensei_Lesson', 'the_lesson_meta'), 5); |
|
117 | 117 | |
118 | 118 | //@since 1.9.0 |
119 | 119 | // lesson image |
120 | -add_action( 'sensei_single_course_inside_before_lesson', array('Sensei_Lesson','the_lesson_thumbnail') , 8); |
|
120 | +add_action('sensei_single_course_inside_before_lesson', array('Sensei_Lesson', 'the_lesson_thumbnail'), 8); |
|
121 | 121 | |
122 | 122 | //@since 1.9.0 |
123 | 123 | // lesson custom excerpts |
124 | -add_filter( 'get_the_excerpt', array( 'Sensei_Lesson', 'alter_the_lesson_excerpt' ) ); |
|
124 | +add_filter('get_the_excerpt', array('Sensei_Lesson', 'alter_the_lesson_excerpt')); |
|
125 | 125 | |
126 | 126 | // @since 1.9.0 |
127 | 127 | // run a deprecated hook for backwards compatibility sake |
128 | -add_action( 'sensei_single_course_modules_before', array( 'Sensei_Core_Modules', 'deprecate_sensei_single_course_modules_content' ) ); |
|
128 | +add_action('sensei_single_course_modules_before', array('Sensei_Core_Modules', 'deprecate_sensei_single_course_modules_content')); |
|
129 | 129 | |
130 | 130 | // @since 1.9.0 |
131 | 131 | // hook in the module loop intialization functionality |
132 | -add_action( 'sensei_single_course_modules_before', array( 'Sensei_Core_Modules', 'setup_single_course_module_loop' ) ); |
|
132 | +add_action('sensei_single_course_modules_before', array('Sensei_Core_Modules', 'setup_single_course_module_loop')); |
|
133 | 133 | |
134 | 134 | // @since 1.9.0 |
135 | 135 | // hook in the module loop destructor functionality |
136 | -add_action( 'sensei_single_course_modules_after', array( 'Sensei_Core_Modules', 'teardown_single_course_module_loop' ) ); |
|
136 | +add_action('sensei_single_course_modules_after', array('Sensei_Core_Modules', 'teardown_single_course_module_loop')); |
|
137 | 137 | |
138 | 138 | // @since 1.9.0 |
139 | 139 | // hook in the possible full content override to show instead of excerpt |
140 | -add_filter('get_the_excerpt', array( 'Sensei_Course', 'full_content_excerpt_override' ) ); |
|
140 | +add_filter('get_the_excerpt', array('Sensei_Course', 'full_content_excerpt_override')); |
|
141 | 141 | |
142 | 142 | //@since 1.9.0 |
143 | 143 | //Course meta |
144 | -add_action( 'sensei_single_course_content_inside_before', array( 'Sensei_Course', 'the_course_enrolment_actions' ), 30 ); |
|
145 | -add_action( 'sensei_single_course_content_inside_before', array( 'Sensei_Course' , 'the_course_video' ), 40 ); |
|
144 | +add_action('sensei_single_course_content_inside_before', array('Sensei_Course', 'the_course_enrolment_actions'), 30); |
|
145 | +add_action('sensei_single_course_content_inside_before', array('Sensei_Course', 'the_course_video'), 40); |
|
146 | 146 | |
147 | 147 | /*************************** |
148 | 148 | * |
@@ -153,54 +153,54 @@ discard block |
||
153 | 153 | ***************************/ |
154 | 154 | //@since 1.9.0 |
155 | 155 | // deprecate hooks no longer needed |
156 | -add_action( 'sensei_single_quiz_content_inside_before', array('Sensei_Quiz', 'deprecate_quiz_sensei_single_main_content_hook' ) ); |
|
157 | -add_action( 'sensei_single_quiz_content_inside_before', array('Sensei_Quiz', 'deprecate_quiz_sensei_quiz_single_title_hook' ) ); |
|
156 | +add_action('sensei_single_quiz_content_inside_before', array('Sensei_Quiz', 'deprecate_quiz_sensei_single_main_content_hook')); |
|
157 | +add_action('sensei_single_quiz_content_inside_before', array('Sensei_Quiz', 'deprecate_quiz_sensei_quiz_single_title_hook')); |
|
158 | 158 | |
159 | 159 | //@since 1.9.0 |
160 | 160 | // Single quiz title |
161 | -add_filter( 'the_title', array( 'Sensei_Quiz' , 'single_quiz_title' ), 20 , 2 ); // append Quiz |
|
162 | -add_action( 'sensei_single_quiz_content_inside_before', array( 'Sensei_Quiz', 'the_title' ), 20 ); //output single quiz |
|
161 | +add_filter('the_title', array('Sensei_Quiz', 'single_quiz_title'), 20, 2); // append Quiz |
|
162 | +add_action('sensei_single_quiz_content_inside_before', array('Sensei_Quiz', 'the_title'), 20); //output single quiz |
|
163 | 163 | |
164 | 164 | // since 1.9.0 |
165 | 165 | // initialize the quiz questions loop |
166 | -add_action( 'sensei_single_quiz_content_inside_before', array( 'Sensei_Quiz', 'start_quiz_questions_loop') ); |
|
166 | +add_action('sensei_single_quiz_content_inside_before', array('Sensei_Quiz', 'start_quiz_questions_loop')); |
|
167 | 167 | |
168 | 168 | // since 1.9.0 |
169 | 169 | // hook in the quiz user message |
170 | -add_action( 'sensei_single_quiz_content_inside_before', array( 'Sensei_Quiz', 'the_user_status_message' ), 40 ); |
|
170 | +add_action('sensei_single_quiz_content_inside_before', array('Sensei_Quiz', 'the_user_status_message'), 40); |
|
171 | 171 | |
172 | 172 | //@since 1.9.0 |
173 | 173 | // hook in the question title, description and quesiton media |
174 | -add_action( 'sensei_quiz_question_inside_before', array( 'Sensei_Question','the_question_title' ), 10 ); |
|
175 | -add_action( 'sensei_quiz_question_inside_before', array( 'Sensei_Question','the_question_description' ), 20 ); |
|
176 | -add_action( 'sensei_quiz_question_inside_before', array( 'Sensei_Question','the_question_media' ), 30 ); |
|
177 | -add_action( 'sensei_quiz_question_inside_before', array( 'Sensei_Question','the_question_hidden_fields' ), 40 ); |
|
174 | +add_action('sensei_quiz_question_inside_before', array('Sensei_Question', 'the_question_title'), 10); |
|
175 | +add_action('sensei_quiz_question_inside_before', array('Sensei_Question', 'the_question_description'), 20); |
|
176 | +add_action('sensei_quiz_question_inside_before', array('Sensei_Question', 'the_question_media'), 30); |
|
177 | +add_action('sensei_quiz_question_inside_before', array('Sensei_Question', 'the_question_hidden_fields'), 40); |
|
178 | 178 | |
179 | 179 | //@since 1.9.0 |
180 | 180 | // hook in incorrect / correct message above questions if the quiz has been graded |
181 | -add_action( 'sensei_quiz_question_inside_before', array( 'Sensei_Question', 'the_answer_result_indication' ), 50 ); |
|
181 | +add_action('sensei_quiz_question_inside_before', array('Sensei_Question', 'the_answer_result_indication'), 50); |
|
182 | 182 | |
183 | 183 | //@since 1.9.0 |
184 | 184 | // add answer grading feedback at the bottom of the question |
185 | -add_action( 'sensei_quiz_question_inside_after', array( 'Sensei_Question', 'answer_feedback_notes' ) ); |
|
185 | +add_action('sensei_quiz_question_inside_after', array('Sensei_Question', 'answer_feedback_notes')); |
|
186 | 186 | |
187 | 187 | //@since 1.9.0 |
188 | 188 | // add extra question data for different quesiton types when get_question_template_data_is_called. |
189 | -add_filter( 'sensei_get_question_template_data', array( 'Sensei_Question','multiple_choice_load_question_data'), 10, 3); |
|
190 | -add_filter( 'sensei_get_question_template_data', array( 'Sensei_Question','gap_fill_load_question_data'), 10, 3); |
|
191 | -add_filter( 'sensei_get_question_template_data', array( 'Sensei_Question','file_upload_load_question_data'), 10, 3); |
|
189 | +add_filter('sensei_get_question_template_data', array('Sensei_Question', 'multiple_choice_load_question_data'), 10, 3); |
|
190 | +add_filter('sensei_get_question_template_data', array('Sensei_Question', 'gap_fill_load_question_data'), 10, 3); |
|
191 | +add_filter('sensei_get_question_template_data', array('Sensei_Question', 'file_upload_load_question_data'), 10, 3); |
|
192 | 192 | |
193 | 193 | //@since 1.9.0 |
194 | 194 | // deprecate the quiz button action |
195 | -add_action( 'sensei_single_quiz_questions_after', array( 'Sensei_Quiz', 'action_buttons' ), 10, 0 ); |
|
195 | +add_action('sensei_single_quiz_questions_after', array('Sensei_Quiz', 'action_buttons'), 10, 0); |
|
196 | 196 | |
197 | 197 | //@since 1.9.0 |
198 | 198 | // deprecate the sensei_complete_quiz hook |
199 | -add_action( 'sensei_single_quiz_content_inside_before', array( 'Sensei_Templates', 'deprecate_sensei_complete_quiz_action' )); |
|
199 | +add_action('sensei_single_quiz_content_inside_before', array('Sensei_Templates', 'deprecate_sensei_complete_quiz_action')); |
|
200 | 200 | |
201 | 201 | //@since 1.9.0 |
202 | 202 | // deprecate the sensei_quiz_question_type hook |
203 | -add_action( 'sensei_quiz_question_inside_after', array( 'Sensei_Templates', 'deprecate_sensei_quiz_question_type_action' )); |
|
203 | +add_action('sensei_quiz_question_inside_after', array('Sensei_Templates', 'deprecate_sensei_quiz_question_type_action')); |
|
204 | 204 | |
205 | 205 | /*************************** |
206 | 206 | * |
@@ -211,63 +211,63 @@ discard block |
||
211 | 211 | ***************************/ |
212 | 212 | //@since 1.9.0 |
213 | 213 | // deprecate the main content hook on the single lesson page |
214 | -add_action( 'sensei_single_lesson_content_inside_before', array( 'Sensei_Templates', 'deprecate_lesson_single_main_content_hook' ), 20); |
|
214 | +add_action('sensei_single_lesson_content_inside_before', array('Sensei_Templates', 'deprecate_lesson_single_main_content_hook'), 20); |
|
215 | 215 | |
216 | 216 | //@since 1.9.0 |
217 | 217 | // hook in the lesson image on the single lesson |
218 | -add_action( 'sensei_single_lesson_content_inside_before', array( 'Sensei_Lesson', 'the_lesson_image' ), 17 ); |
|
218 | +add_action('sensei_single_lesson_content_inside_before', array('Sensei_Lesson', 'the_lesson_image'), 17); |
|
219 | 219 | |
220 | 220 | //@since 1.9.0 |
221 | 221 | // hook in the lesson image on the single lesson deprecated hook function |
222 | -add_action( 'sensei_single_lesson_content_inside_before', array( 'Sensei_Templates','deprecate_lesson_image_hook' ), 10 ); |
|
222 | +add_action('sensei_single_lesson_content_inside_before', array('Sensei_Templates', 'deprecate_lesson_image_hook'), 10); |
|
223 | 223 | |
224 | 224 | //@since 1.9.0 |
225 | 225 | // hook in the lesson single title deprecated function |
226 | -add_action( 'sensei_single_lesson_content_inside_before', array( 'Sensei_Templates', 'deprecate_sensei_lesson_single_title' ), 15 ); |
|
226 | +add_action('sensei_single_lesson_content_inside_before', array('Sensei_Templates', 'deprecate_sensei_lesson_single_title'), 15); |
|
227 | 227 | |
228 | 228 | // @since 1.9.0 |
229 | 229 | // hook in the sensei lesson user notices |
230 | -add_action( 'sensei_single_lesson_content_inside_before', array( 'Sensei_Lesson', 'user_not_taking_course_message' ), 15 ); |
|
230 | +add_action('sensei_single_lesson_content_inside_before', array('Sensei_Lesson', 'user_not_taking_course_message'), 15); |
|
231 | 231 | |
232 | 232 | // @since 1.9.0 |
233 | 233 | // attach the lesson title |
234 | -add_action( 'sensei_single_lesson_content_inside_before', array( 'Sensei_Lesson', 'the_title' ), 15 ); |
|
234 | +add_action('sensei_single_lesson_content_inside_before', array('Sensei_Lesson', 'the_title'), 15); |
|
235 | 235 | |
236 | 236 | //@since 1.9.0 |
237 | 237 | // hook in the lesson image on the single lesson |
238 | -add_action( 'sensei_single_lesson_content_inside_before', array( 'Sensei_Lesson', 'user_lesson_quiz_status_message' ), 20 ); |
|
238 | +add_action('sensei_single_lesson_content_inside_before', array('Sensei_Lesson', 'user_lesson_quiz_status_message'), 20); |
|
239 | 239 | |
240 | 240 | // @since 1.9.0 |
241 | 241 | // add the single lesson meta |
242 | -add_action( 'sensei_single_lesson_content_inside_after', 'sensei_the_single_lesson_meta', 10 ); |
|
242 | +add_action('sensei_single_lesson_content_inside_after', 'sensei_the_single_lesson_meta', 10); |
|
243 | 243 | |
244 | 244 | // @since 1.9.0 |
245 | 245 | // deprecate the sensei_lesson_single_meta hook |
246 | -add_action( 'sensei_single_lesson_content_inside_after', array( 'Sensei_Templates', 'deprecate_sensei_lesson_single_meta_hook' ), 15 ); |
|
246 | +add_action('sensei_single_lesson_content_inside_after', array('Sensei_Templates', 'deprecate_sensei_lesson_single_meta_hook'), 15); |
|
247 | 247 | |
248 | 248 | // @since 1.9.0 |
249 | 249 | // deprecate the sensei_lesson_course_signup hook |
250 | -add_action( 'sensei_single_lesson_content_inside_after', array( 'Sensei_Templates','deprecate_sensei_lesson_course_signup_hook' ), 20 ); |
|
250 | +add_action('sensei_single_lesson_content_inside_after', array('Sensei_Templates', 'deprecate_sensei_lesson_course_signup_hook'), 20); |
|
251 | 251 | |
252 | 252 | // @since 1.9.0 |
253 | 253 | // hook in the lesson prerequisite completion message |
254 | -add_action( 'sensei_single_lesson_content_inside_after', array( 'Sensei_Lesson', 'prerequisite_complete_message' ), 20 ); |
|
254 | +add_action('sensei_single_lesson_content_inside_after', array('Sensei_Lesson', 'prerequisite_complete_message'), 20); |
|
255 | 255 | |
256 | 256 | // @since 1.9.0 |
257 | 257 | // hook the single lesson course_signup_link |
258 | -add_action( 'sensei_single_lesson_content_inside_after', array( 'Sensei_Lesson', 'course_signup_link' ), 30 ); |
|
258 | +add_action('sensei_single_lesson_content_inside_after', array('Sensei_Lesson', 'course_signup_link'), 30); |
|
259 | 259 | |
260 | 260 | // @since 1.9.0 |
261 | 261 | // hook the deprecate breadcrumbs and comments hooks |
262 | -add_action( 'sensei_after_main_content', array( 'Sensei_Templates', 'deprecate_single_lesson_breadcrumbs_and_comments_hooks'), 5 ); |
|
262 | +add_action('sensei_after_main_content', array('Sensei_Templates', 'deprecate_single_lesson_breadcrumbs_and_comments_hooks'), 5); |
|
263 | 263 | |
264 | 264 | // @since 1.9.0 |
265 | 265 | // Add the quiz specific buttons and notices to the lesson |
266 | -add_action( 'sensei_single_lesson_content_inside_after', array('Sensei_Lesson', 'footer_quiz_call_to_action' )); |
|
266 | +add_action('sensei_single_lesson_content_inside_after', array('Sensei_Lesson', 'footer_quiz_call_to_action')); |
|
267 | 267 | |
268 | 268 | // @since 1.9.0 |
269 | 269 | // hook in the comments on the single lessons page |
270 | -add_action( 'sensei_pagination', array( 'Sensei_Lesson', 'output_comments' ), 90 ); |
|
270 | +add_action('sensei_pagination', array('Sensei_Lesson', 'output_comments'), 90); |
|
271 | 271 | |
272 | 272 | /********************** |
273 | 273 | * |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | * |
278 | 278 | ************************/ |
279 | 279 | |
280 | -add_action( 'sensei_single_message_content_inside_before', array( 'Sensei_Messages', 'the_title' ), 20 ); |
|
280 | +add_action('sensei_single_message_content_inside_before', array('Sensei_Messages', 'the_title'), 20); |
|
281 | 281 | |
282 | -add_action( 'sensei_single_message_content_inside_before', array( 'Sensei_Messages', 'the_message_sent_by_title' ), 40 ); |
|
282 | +add_action('sensei_single_message_content_inside_before', array('Sensei_Messages', 'the_message_sent_by_title'), 40); |
|
283 | 283 | |
284 | 284 | /************************* |
285 | 285 | * |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | |
292 | 292 | // deprecate the sensei_lesson_archive_header hook |
293 | 293 | // @deprecated since 1.9.0 |
294 | -add_action( 'sensei_loop_lesson_inside_before', array( 'Sensei_Lesson', 'deprecate_sensei_lesson_archive_header_hook' ), 20 ); |
|
294 | +add_action('sensei_loop_lesson_inside_before', array('Sensei_Lesson', 'deprecate_sensei_lesson_archive_header_hook'), 20); |
|
295 | 295 | |
296 | 296 | // @1.9.0 |
297 | 297 | //The archive title header on the lesson archive loop |
298 | -add_action( 'sensei_loop_lesson_inside_before', array( Sensei()->lesson, 'the_archive_header' ), 20 ); |
|
298 | +add_action('sensei_loop_lesson_inside_before', array(Sensei()->lesson, 'the_archive_header'), 20); |
|
299 | 299 | |
300 | 300 | // @since 1.9.0 |
301 | 301 | //Output the lesson header on the content-lesson.php which runs inside the lessons loop |
302 | -add_action( 'sensei_content_lesson_inside_before', array( 'Sensei_Lesson', 'the_lesson_meta' ), 20 ); |
|
302 | +add_action('sensei_content_lesson_inside_before', array('Sensei_Lesson', 'the_lesson_meta'), 20); |
|
303 | 303 | |
304 | 304 | // @since 1.9.0 |
305 | 305 | // output only part of the lesson on the archive |
306 | -add_filter('the_content', array( 'Sensei_Lesson','limit_archive_content' ) ); |
|
306 | +add_filter('the_content', array('Sensei_Lesson', 'limit_archive_content')); |
|
307 | 307 | |
308 | 308 | /************************** |
309 | 309 | * |
@@ -314,15 +314,15 @@ discard block |
||
314 | 314 | **************************/ |
315 | 315 | // @since 1.9.0 |
316 | 316 | // deprecate the learner profile content hook as the markup code is added in the template directly. |
317 | -add_action('sensei_learner_profile_content_before', array( 'Sensei_Learner_Profiles', 'deprecate_sensei_learner_profile_content_hook' ) ); |
|
317 | +add_action('sensei_learner_profile_content_before', array('Sensei_Learner_Profiles', 'deprecate_sensei_learner_profile_content_hook')); |
|
318 | 318 | |
319 | 319 | // @since 1.9.0 |
320 | 320 | // do the sensei complete course action on the learner profiles page. |
321 | -add_action('sensei_learner_profile_content_before', array( 'Sensei_Templates', 'fire_sensei_complete_course_hook' ) ); |
|
321 | +add_action('sensei_learner_profile_content_before', array('Sensei_Templates', 'fire_sensei_complete_course_hook')); |
|
322 | 322 | |
323 | 323 | // @since 1.9.0 |
324 | 324 | // fire the frontend messages hook before the profile content |
325 | -add_action('sensei_learner_profile_inside_content_before', array( 'Sensei_Templates', 'fire_frontend_messages_hook' ) ); |
|
325 | +add_action('sensei_learner_profile_inside_content_before', array('Sensei_Templates', 'fire_frontend_messages_hook')); |
|
326 | 326 | |
327 | 327 | |
328 | 328 | /********************************** |
@@ -335,26 +335,26 @@ discard block |
||
335 | 335 | |
336 | 336 | // @since 1.9.0 |
337 | 337 | // fire the deprecated hook function within the course-result.php file |
338 | -add_action( 'sensei_course_results_content_before', array('Sensei_Course_Results','deprecate_sensei_course_results_content_hook') ); |
|
338 | +add_action('sensei_course_results_content_before', array('Sensei_Course_Results', 'deprecate_sensei_course_results_content_hook')); |
|
339 | 339 | |
340 | 340 | // @since 1.9.0 |
341 | 341 | // fire the sensei message hooke inside the course-result.php file |
342 | -add_action( 'sensei_course_results_content_inside_before', array('Sensei_Course_Results','fire_sensei_message_hook') ); |
|
342 | +add_action('sensei_course_results_content_inside_before', array('Sensei_Course_Results', 'fire_sensei_message_hook')); |
|
343 | 343 | |
344 | 344 | // @since 1.9.0 |
345 | 345 | // load the course information on the course results page |
346 | -add_action( 'sensei_course_results_content_inside_before_lessons', array( Sensei()->course_results,'course_info') ); |
|
346 | +add_action('sensei_course_results_content_inside_before_lessons', array(Sensei()->course_results, 'course_info')); |
|
347 | 347 | |
348 | 348 | // @since 1.9.0 |
349 | -add_action( 'sensei_course_results_content_inside_before', array( Sensei()->course,'course_image') ); |
|
349 | +add_action('sensei_course_results_content_inside_before', array(Sensei()->course, 'course_image')); |
|
350 | 350 | |
351 | 351 | // @since 1.9.0 |
352 | 352 | // deprecate the course results top hook in favour of a new hook |
353 | -add_action( 'sensei_course_results_content_inside_before', array( 'Sensei_Course_Results', 'deprecate_course_results_top_hook') ); |
|
353 | +add_action('sensei_course_results_content_inside_before', array('Sensei_Course_Results', 'deprecate_course_results_top_hook')); |
|
354 | 354 | |
355 | 355 | // @since 1.9.0 |
356 | 356 | // Fire the course image hook within the course results page |
357 | -add_action( 'sensei_course_results_content_inside_before', array( 'Sensei_Course_Results', 'fire_course_image_hook') ); |
|
357 | +add_action('sensei_course_results_content_inside_before', array('Sensei_Course_Results', 'fire_course_image_hook')); |
|
358 | 358 | |
359 | 359 | |
360 | 360 | /********************************** |
@@ -366,19 +366,19 @@ discard block |
||
366 | 366 | ********************************/ |
367 | 367 | // @since 1.9.0 |
368 | 368 | // fire the sensei complete course action on the my courses template |
369 | -add_action( 'sensei_my_courses_before', array( 'Sensei_Templates', 'fire_sensei_complete_course_hook' ) ); |
|
369 | +add_action('sensei_my_courses_before', array('Sensei_Templates', 'fire_sensei_complete_course_hook')); |
|
370 | 370 | |
371 | 371 | // @since 1.9.0 |
372 | 372 | // fire the sensei frontend messages hook before the my-courses content |
373 | -add_action('sensei_my_courses_content_inside_before', array( 'Sensei_Templates', 'fire_frontend_messages_hook' ) ); |
|
373 | +add_action('sensei_my_courses_content_inside_before', array('Sensei_Templates', 'fire_frontend_messages_hook')); |
|
374 | 374 | |
375 | 375 | // @since 1.9.0 |
376 | 376 | // deprecate the sensei_before_user_course_content hook |
377 | -add_action('sensei_my_courses_content_inside_before', array( 'Sensei_Templates', 'deprecate_sensei_before_user_course_content_hook' ) ); |
|
377 | +add_action('sensei_my_courses_content_inside_before', array('Sensei_Templates', 'deprecate_sensei_before_user_course_content_hook')); |
|
378 | 378 | |
379 | 379 | // @since 1.9.0 |
380 | 380 | // deprecate the sensei_after_user_course_content hook |
381 | -add_action('sensei_my_courses_content_inside_after', array( 'Sensei_Templates', 'deprecate_sensei_after_user_course_content_hook' ) ); |
|
381 | +add_action('sensei_my_courses_content_inside_after', array('Sensei_Templates', 'deprecate_sensei_after_user_course_content_hook')); |
|
382 | 382 | |
383 | 383 | /********************************** |
384 | 384 | * |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | // @since 1.9.0 |
391 | 391 | // deprecate the sensei_login_form hok which was use to load the login form. |
392 | 392 | // This now loads independent of the my-courses template which helps keep templates free from logic |
393 | -add_action( 'sensei_login_form_before', array( 'Sensei_Templates', 'deprecate_sensei_login_form_hook' ) ); |
|
393 | +add_action('sensei_login_form_before', array('Sensei_Templates', 'deprecate_sensei_login_form_hook')); |
|
394 | 394 | |
395 | 395 | /********************************** |
396 | 396 | * |
@@ -401,16 +401,16 @@ discard block |
||
401 | 401 | ********************************/ |
402 | 402 | // @since 1.9.0 |
403 | 403 | // Deprecate the archive messages hooks no longer supported |
404 | -add_action( 'sensei_archive_before_message_loop', array( 'Sensei_Templates', 'deprecated_archive_message_hooks' ) ); |
|
404 | +add_action('sensei_archive_before_message_loop', array('Sensei_Templates', 'deprecated_archive_message_hooks')); |
|
405 | 405 | |
406 | 406 | // @since 1.9.0 |
407 | 407 | // Deprecate the archive messages hooks no longer supported |
408 | -add_action( 'sensei_archive_before_message_loop', array( 'Sensei_Messages', 'the_archive_header' ) ); |
|
408 | +add_action('sensei_archive_before_message_loop', array('Sensei_Messages', 'the_archive_header')); |
|
409 | 409 | |
410 | 410 | // @since 1.9.0 |
411 | 411 | // output the message title and the message sensei |
412 | -add_action( 'sensei_content_message_before', array( 'Sensei_Messages', 'the_message_title' ), 10, 1 ); |
|
413 | -add_action( 'sensei_content_message_before', array( 'Sensei_Messages', 'the_message_sender' ), 20 , 1 ); |
|
412 | +add_action('sensei_content_message_before', array('Sensei_Messages', 'the_message_title'), 10, 1); |
|
413 | +add_action('sensei_content_message_before', array('Sensei_Messages', 'the_message_sender'), 20, 1); |
|
414 | 414 | |
415 | 415 | /********************************** |
416 | 416 | * |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * |
420 | 420 | * |
421 | 421 | **********************************/ |
422 | -add_action( 'sensei_loop_course_before', array( 'Sensei_Course', 'course_category_title' ), 70 , 1 ); |
|
422 | +add_action('sensei_loop_course_before', array('Sensei_Course', 'course_category_title'), 70, 1); |
|
423 | 423 | |
424 | 424 | /********************************** |
425 | 425 | * |
@@ -430,9 +430,9 @@ discard block |
||
430 | 430 | **********************************/ |
431 | 431 | //@since 1.9.0 |
432 | 432 | //add a title to the teacher archive page when viewn siteurl/author/{teacher-username} |
433 | -add_action( 'sensei_teacher_archive_course_loop_before', array( 'Sensei_Teacher', 'archive_title' ) ); |
|
433 | +add_action('sensei_teacher_archive_course_loop_before', array('Sensei_Teacher', 'archive_title')); |
|
434 | 434 | |
435 | 435 | //@since 1.9.0 |
436 | 436 | // remove course meta from the teacher page until it can be refactored to allow only removing the |
437 | 437 | // teacher name and not all lessons |
438 | -add_action( 'sensei_teacher_archive_course_loop_before', array( 'Sensei_Teacher', 'remove_course_meta_on_teacher_archive' ) ); |
|
438 | +add_action('sensei_teacher_archive_course_loop_before', array('Sensei_Teacher', 'remove_course_meta_on_teacher_archive')); |
@@ -192,7 +192,6 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @access public |
194 | 194 | * @param mixed $slug |
195 | - * @param mixed $option |
|
196 | 195 | * @param string $page_title (default: '') |
197 | 196 | * @param string $page_content (default: '') |
198 | 197 | * @param int $post_parent (default: 0) |
@@ -1037,6 +1036,9 @@ discard block |
||
1037 | 1036 | ?></div><?php |
1038 | 1037 | } |
1039 | 1038 | |
1039 | + /** |
|
1040 | + * @return string |
|
1041 | + */ |
|
1040 | 1042 | public function get_course_order() { |
1041 | 1043 | return get_option( 'sensei_course_order', '' ); |
1042 | 1044 | } |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function __construct () { |
18 | 18 | |
19 | - //register admin styles |
|
19 | + //register admin styles |
|
20 | 20 | add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles_global' ) ); |
21 | 21 | |
22 | - //register admin scripts |
|
23 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
22 | + //register admin scripts |
|
23 | + add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
24 | 24 | |
25 | 25 | add_action( 'admin_print_styles', array( $this, 'admin_notices_styles' ) ); |
26 | 26 | add_action( 'settings_before_form', array( $this, 'install_pages_output' ) ); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | add_action( 'admin_head', array( $this, 'admin_menu_highlight' ) ); |
30 | 30 | add_action( 'admin_init', array( $this, 'page_redirect' ) ); |
31 | 31 | add_action( 'admin_init', array( $this, 'sensei_add_custom_menu_items' ) ); |
32 | - add_action( 'admin_init', array( __CLASS__, 'install_pages' )); |
|
32 | + add_action( 'admin_init', array( __CLASS__, 'install_pages' )); |
|
33 | 33 | |
34 | 34 | // Duplicate lesson & courses |
35 | 35 | add_filter( 'post_row_actions', array( $this, 'duplicate_action_link' ), 10, 2 ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | if( $menu_cap ) { |
82 | 82 | $menu[] = array( '', 'read', 'separator-sensei', '', 'wp-menu-separator sensei' ); |
83 | - add_menu_page( 'Sensei', 'Sensei', $menu_cap, 'sensei' , array( Sensei()->analysis, 'analysis_page' ) , '', '50' ); |
|
83 | + add_menu_page( 'Sensei', 'Sensei', $menu_cap, 'sensei' , array( Sensei()->analysis, 'analysis_page' ) , '', '50' ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | add_submenu_page( 'edit.php?post_type=course', __( 'Order Courses', 'woothemes-sensei' ), __( 'Order Courses', 'woothemes-sensei' ), 'manage_sensei', 'course-order', array( $this, 'course_order_screen' ) ); |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | $submenu_file = 'edit-tags.php?taxonomy=course-category&post_type=course'; |
138 | 138 | $parent_file = 'edit.php?post_type=course'; |
139 | 139 | |
140 | - } elseif ( $screen->base == 'edit-tags' && $taxonomy == 'module' ) { |
|
140 | + } elseif ( $screen->base == 'edit-tags' && $taxonomy == 'module' ) { |
|
141 | 141 | |
142 | - $submenu_file = 'edit-tags.php?taxonomy=module'; |
|
143 | - $parent_file = 'edit.php?post_type=course'; |
|
142 | + $submenu_file = 'edit-tags.php?taxonomy=module'; |
|
143 | + $parent_file = 'edit.php?post_type=course'; |
|
144 | 144 | |
145 | 145 | } elseif ( in_array( $screen->id, array( 'sensei_message', 'edit-sensei_message' ) ) ) { |
146 | 146 | |
147 | - $submenu_file = 'edit.php?post_type=sensei_message'; |
|
147 | + $submenu_file = 'edit.php?post_type=sensei_message'; |
|
148 | 148 | $parent_file = 'sensei'; |
149 | 149 | |
150 | 150 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | */ |
173 | 173 | function install_pages_output() { |
174 | 174 | |
175 | - if( isset($_GET['sensei_install_complete']) && 'true' == $_GET['sensei_install_complete']) { |
|
175 | + if( isset($_GET['sensei_install_complete']) && 'true' == $_GET['sensei_install_complete']) { |
|
176 | 176 | |
177 | - ?> |
|
177 | + ?> |
|
178 | 178 | <div id="message" class="updated sensei-message sensei-connect"> |
179 | 179 | <p><?php _e( '<strong>Congratulations!</strong> – Sensei has been installed and set up.', 'woothemes-sensei' ); ?></p> |
180 | 180 | <p><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/sensei/" data-text="A premium Learning Management plugin for #WordPress that helps you create courses. Beautifully." data-via="WooThemes" data-size="large" data-hashtags="Sensei">Tweet</a> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | </div> |
183 | 183 | <?php |
184 | 184 | |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | 187 | } // End install_pages_output() |
188 | 188 | |
@@ -201,25 +201,25 @@ discard block |
||
201 | 201 | function create_page( $slug, $page_title = '', $page_content = '', $post_parent = 0 ) { |
202 | 202 | global $wpdb; |
203 | 203 | |
204 | - $page_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", $slug ) ); |
|
204 | + $page_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", $slug ) ); |
|
205 | 205 | if ( $page_id ) : |
206 | 206 | return $page_id; |
207 | 207 | endif; |
208 | 208 | |
209 | 209 | $page_data = array( |
210 | - 'post_status' => 'publish', |
|
211 | - 'post_type' => 'page', |
|
212 | - 'post_author' => 1, |
|
213 | - 'post_name' => $slug, |
|
214 | - 'post_title' => $page_title, |
|
215 | - 'post_content' => $page_content, |
|
216 | - 'post_parent' => $post_parent, |
|
217 | - 'comment_status' => 'closed' |
|
218 | - ); |
|
210 | + 'post_status' => 'publish', |
|
211 | + 'post_type' => 'page', |
|
212 | + 'post_author' => 1, |
|
213 | + 'post_name' => $slug, |
|
214 | + 'post_title' => $page_title, |
|
215 | + 'post_content' => $page_content, |
|
216 | + 'post_parent' => $post_parent, |
|
217 | + 'comment_status' => 'closed' |
|
218 | + ); |
|
219 | 219 | |
220 | - $page_id = wp_insert_post( $page_data ); |
|
220 | + $page_id = wp_insert_post( $page_data ); |
|
221 | 221 | |
222 | - return $page_id; |
|
222 | + return $page_id; |
|
223 | 223 | |
224 | 224 | } // End create_page() |
225 | 225 | |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | function create_pages() { |
234 | 234 | |
235 | 235 | // Courses page |
236 | - $new_course_page_id = $this->create_page( esc_sql( _x('courses-overview', 'page_slug', 'woothemes-sensei') ), __('Courses', 'woothemes-sensei'), '' ); |
|
237 | - Sensei()->settings->set( 'course_page', $new_course_page_id ); |
|
236 | + $new_course_page_id = $this->create_page( esc_sql( _x('courses-overview', 'page_slug', 'woothemes-sensei') ), __('Courses', 'woothemes-sensei'), '' ); |
|
237 | + Sensei()->settings->set( 'course_page', $new_course_page_id ); |
|
238 | 238 | |
239 | - // User Dashboard page |
|
240 | - $new_my_course_page_id = $this->create_page( esc_sql( _x('my-courses', 'page_slug', 'woothemes-sensei') ), __('My Courses', 'woothemes-sensei'), '[sensei_user_courses]' ); |
|
241 | - Sensei()->settings->set( 'my_course_page',$new_my_course_page_id ); |
|
239 | + // User Dashboard page |
|
240 | + $new_my_course_page_id = $this->create_page( esc_sql( _x('my-courses', 'page_slug', 'woothemes-sensei') ), __('My Courses', 'woothemes-sensei'), '[sensei_user_courses]' ); |
|
241 | + Sensei()->settings->set( 'my_course_page',$new_my_course_page_id ); |
|
242 | 242 | |
243 | 243 | } // End create_pages() |
244 | 244 | |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | wp_register_style( 'woothemes-sensei-global', Sensei()->plugin_url . 'assets/css/global.css', '', Sensei()->version, 'screen' ); |
260 | 260 | wp_enqueue_style( 'woothemes-sensei-global' ); |
261 | 261 | |
262 | - // Select 2 styles |
|
263 | - wp_enqueue_style( 'sensei-core-select2', Sensei()->plugin_url . 'assets/css/select2/select2.css', '', Sensei()->version, 'screen' ); |
|
262 | + // Select 2 styles |
|
263 | + wp_enqueue_style( 'sensei-core-select2', Sensei()->plugin_url . 'assets/css/select2/select2.css', '', Sensei()->version, 'screen' ); |
|
264 | 264 | |
265 | 265 | // Test for Write Panel Pages |
266 | 266 | if ( ( ( isset( $post_type ) && in_array( $post_type, $allowed_post_types ) ) && ( isset( $hook ) && in_array( $hook, $allowed_post_type_pages ) ) ) || ( isset( $_GET['page'] ) && in_array( $_GET['page'], $allowed_pages ) ) ) { |
@@ -273,32 +273,32 @@ discard block |
||
273 | 273 | } // End admin_styles_global() |
274 | 274 | |
275 | 275 | |
276 | - /** |
|
277 | - * Globally register all scripts needed in admin. |
|
278 | - * |
|
279 | - * The script users should enqueue the script when needed. |
|
280 | - * |
|
281 | - * @since 1.8.2 |
|
282 | - * @access public |
|
283 | - */ |
|
284 | - public function register_scripts( $hook ){ |
|
276 | + /** |
|
277 | + * Globally register all scripts needed in admin. |
|
278 | + * |
|
279 | + * The script users should enqueue the script when needed. |
|
280 | + * |
|
281 | + * @since 1.8.2 |
|
282 | + * @access public |
|
283 | + */ |
|
284 | + public function register_scripts( $hook ){ |
|
285 | 285 | |
286 | - $screen = get_current_screen(); |
|
286 | + $screen = get_current_screen(); |
|
287 | 287 | |
288 | - // Allow developers to load non-minified versions of scripts |
|
289 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
288 | + // Allow developers to load non-minified versions of scripts |
|
289 | + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
290 | 290 | |
291 | - // Select2 script used to enhance all select boxes |
|
292 | - wp_register_script( 'sensei-core-select2', Sensei()->plugin_url . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), Sensei()->version ); |
|
291 | + // Select2 script used to enhance all select boxes |
|
292 | + wp_register_script( 'sensei-core-select2', Sensei()->plugin_url . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), Sensei()->version ); |
|
293 | 293 | |
294 | - // load edit module scripts |
|
295 | - if( 'edit-module' == $screen->id ){ |
|
294 | + // load edit module scripts |
|
295 | + if( 'edit-module' == $screen->id ){ |
|
296 | 296 | |
297 | - wp_enqueue_script( 'sensei-chosen-ajax', Sensei()->plugin_url . 'assets/chosen/ajax-chosen.jquery.min.js', array( 'jquery', 'sensei-chosen' ), Sensei()->version, true ); |
|
297 | + wp_enqueue_script( 'sensei-chosen-ajax', Sensei()->plugin_url . 'assets/chosen/ajax-chosen.jquery.min.js', array( 'jquery', 'sensei-chosen' ), Sensei()->version, true ); |
|
298 | 298 | |
299 | - } |
|
299 | + } |
|
300 | 300 | |
301 | - } |
|
301 | + } |
|
302 | 302 | |
303 | 303 | |
304 | 304 | /** |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @return void |
309 | 309 | */ |
310 | 310 | function admin_install_notice() { |
311 | - ?> |
|
311 | + ?> |
|
312 | 312 | <div id="message" class="updated sensei-message sensei-connect"> |
313 | 313 | |
314 | 314 | <p> |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * @return void |
344 | 344 | */ |
345 | 345 | function admin_installed_notice() { |
346 | - ?> |
|
346 | + ?> |
|
347 | 347 | <div id="message" class="updated sensei-message sensei-connect"> |
348 | 348 | |
349 | 349 | <p> |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | </div> |
372 | 372 | <?php |
373 | 373 | |
374 | - // Set installed option |
|
375 | - update_option('sensei_installed', 0); |
|
374 | + // Set installed option |
|
375 | + update_option('sensei_installed', 0); |
|
376 | 376 | } // End admin_installed_notice() |
377 | 377 | |
378 | 378 | |
@@ -404,21 +404,21 @@ discard block |
||
404 | 404 | function admin_notices_styles() { |
405 | 405 | |
406 | 406 | // Installed notices |
407 | - if ( 1 == get_option( 'sensei_installed' ) ) { |
|
407 | + if ( 1 == get_option( 'sensei_installed' ) ) { |
|
408 | 408 | |
409 | - wp_enqueue_style( 'sensei-activation', plugins_url( '/assets/css/activation.css', dirname( __FILE__ ) ), '', Sensei()->version ); |
|
409 | + wp_enqueue_style( 'sensei-activation', plugins_url( '/assets/css/activation.css', dirname( __FILE__ ) ), '', Sensei()->version ); |
|
410 | 410 | |
411 | - if (get_option('skip_install_sensei_pages')!=1 && Sensei()->get_page_id('course')<1 && !isset($_GET['install_sensei_pages']) && !isset($_GET['skip_install_sensei_pages'])) { |
|
412 | - add_action( 'admin_notices', array( $this, 'admin_install_notice' ) ); |
|
413 | - } elseif ( !isset($_GET['page']) || $_GET['page']!='woothemes-sensei-settings' ) { |
|
414 | - add_action( 'admin_notices', array( $this, 'admin_installed_notice' ) ); |
|
415 | - } // End If Statement |
|
411 | + if (get_option('skip_install_sensei_pages')!=1 && Sensei()->get_page_id('course')<1 && !isset($_GET['install_sensei_pages']) && !isset($_GET['skip_install_sensei_pages'])) { |
|
412 | + add_action( 'admin_notices', array( $this, 'admin_install_notice' ) ); |
|
413 | + } elseif ( !isset($_GET['page']) || $_GET['page']!='woothemes-sensei-settings' ) { |
|
414 | + add_action( 'admin_notices', array( $this, 'admin_installed_notice' ) ); |
|
415 | + } // End If Statement |
|
416 | 416 | |
417 | - } // End If Statement |
|
417 | + } // End If Statement |
|
418 | 418 | |
419 | - if ( Sensei_Language_Pack_Manager::has_language_pack_available() ) { |
|
420 | - add_action( 'admin_notices', array( $this, 'language_pack_install_notice' ) ); |
|
421 | - } |
|
419 | + if ( Sensei_Language_Pack_Manager::has_language_pack_available() ) { |
|
420 | + add_action( 'admin_notices', array( $this, 'language_pack_install_notice' ) ); |
|
421 | + } |
|
422 | 422 | |
423 | 423 | } // End admin_notices_styles() |
424 | 424 | |
@@ -534,30 +534,30 @@ discard block |
||
534 | 534 | */ |
535 | 535 | private function duplicate_lesson_quizzes( $old_lesson_id, $new_lesson_id ) { |
536 | 536 | |
537 | - $old_quiz_id = Sensei()->lesson->lesson_quizzes( $old_lesson_id ); |
|
538 | - $old_quiz_questions = Sensei()->lesson->lesson_quiz_questions( $old_quiz_id ); |
|
537 | + $old_quiz_id = Sensei()->lesson->lesson_quizzes( $old_lesson_id ); |
|
538 | + $old_quiz_questions = Sensei()->lesson->lesson_quiz_questions( $old_quiz_id ); |
|
539 | 539 | |
540 | - // duplicate the generic wp post information |
|
540 | + // duplicate the generic wp post information |
|
541 | 541 | $new_quiz = $this->duplicate_post( get_post( $old_quiz_id ), '' ); |
542 | 542 | |
543 | 543 | //update the new lesson data |
544 | - add_post_meta( $new_lesson_id, '_lesson_quiz', $new_quiz->ID ); |
|
544 | + add_post_meta( $new_lesson_id, '_lesson_quiz', $new_quiz->ID ); |
|
545 | 545 | |
546 | 546 | //update the new quiz data |
547 | - add_post_meta( $new_quiz->ID, '_quiz_lesson', $new_lesson_id ); |
|
548 | - wp_update_post( |
|
549 | - array( |
|
550 | - 'ID' => $new_quiz->ID, |
|
551 | - 'post_parent' => $new_lesson_id |
|
552 | - ) |
|
553 | - ); |
|
547 | + add_post_meta( $new_quiz->ID, '_quiz_lesson', $new_lesson_id ); |
|
548 | + wp_update_post( |
|
549 | + array( |
|
550 | + 'ID' => $new_quiz->ID, |
|
551 | + 'post_parent' => $new_lesson_id |
|
552 | + ) |
|
553 | + ); |
|
554 | 554 | |
555 | 555 | foreach( $old_quiz_questions as $question ) { |
556 | 556 | |
557 | 557 | // copy the question order over to the new quiz |
558 | 558 | $old_question_order = get_post_meta( $question->ID, '_quiz_question_order'. $old_quiz_id, true ); |
559 | - $new_question_order = str_ireplace( $old_quiz_id, $new_quiz->ID , $old_question_order ); |
|
560 | - add_post_meta( $question->ID, '_quiz_question_order' . $new_quiz->ID, $new_question_order ); |
|
559 | + $new_question_order = str_ireplace( $old_quiz_id, $new_quiz->ID , $old_question_order ); |
|
560 | + add_post_meta( $question->ID, '_quiz_question_order' . $new_quiz->ID, $new_question_order ); |
|
561 | 561 | |
562 | 562 | // Add question to quiz |
563 | 563 | add_post_meta( $question->ID, '_quiz_id', $new_quiz->ID, false ); |
@@ -879,21 +879,21 @@ discard block |
||
879 | 879 | break; |
880 | 880 | |
881 | 881 | case 'checkbox': |
882 | - //backwards compatibility |
|
883 | - if( empty( $data ) || 'on' == $data ){ |
|
884 | - $checked_value = 'on'; |
|
885 | - }elseif( 'yes' == $data ) { |
|
882 | + //backwards compatibility |
|
883 | + if( empty( $data ) || 'on' == $data ){ |
|
884 | + $checked_value = 'on'; |
|
885 | + }elseif( 'yes' == $data ) { |
|
886 | 886 | |
887 | - $checked_value = 'yes'; |
|
887 | + $checked_value = 'yes'; |
|
888 | 888 | |
889 | - }elseif( 'auto' == $data ) { |
|
889 | + }elseif( 'auto' == $data ) { |
|
890 | 890 | |
891 | - $checked_value = 'auto'; |
|
891 | + $checked_value = 'auto'; |
|
892 | 892 | |
893 | - } else { |
|
894 | - $checked_value = 1; |
|
895 | - $data = intval( $data ); |
|
896 | - } |
|
893 | + } else { |
|
894 | + $checked_value = 1; |
|
895 | + $data = intval( $data ); |
|
896 | + } |
|
897 | 897 | $checked = checked( $checked_value, $data, false ); |
898 | 898 | $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" ' . $checked . ' ' . $disabled . '/>' . "\n"; |
899 | 899 | break; |
@@ -997,26 +997,26 @@ discard block |
||
997 | 997 | |
998 | 998 | if( 0 < count( $courses ) ) { |
999 | 999 | |
1000 | - // order the courses as set by the users |
|
1001 | - $all_course_ids = array(); |
|
1002 | - foreach( $courses as $course ){ |
|
1000 | + // order the courses as set by the users |
|
1001 | + $all_course_ids = array(); |
|
1002 | + foreach( $courses as $course ){ |
|
1003 | 1003 | |
1004 | - $all_course_ids[] = (string)$course->ID; |
|
1004 | + $all_course_ids[] = (string)$course->ID; |
|
1005 | 1005 | |
1006 | - } |
|
1007 | - $order_string = $this->get_course_order(); |
|
1006 | + } |
|
1007 | + $order_string = $this->get_course_order(); |
|
1008 | 1008 | |
1009 | - if( !empty( $order_string ) ){ |
|
1010 | - $ordered_course_ids = explode(',' , $order_string ); |
|
1011 | - $all_course_ids = array_unique( array_merge( $ordered_course_ids , $all_course_ids ) ); |
|
1012 | - } |
|
1009 | + if( !empty( $order_string ) ){ |
|
1010 | + $ordered_course_ids = explode(',' , $order_string ); |
|
1011 | + $all_course_ids = array_unique( array_merge( $ordered_course_ids , $all_course_ids ) ); |
|
1012 | + } |
|
1013 | 1013 | |
1014 | 1014 | |
1015 | 1015 | $html .= '<form id="editgrouping" method="post" action="" class="validate">' . "\n"; |
1016 | 1016 | $html .= '<ul class="sortable-course-list">' . "\n"; |
1017 | 1017 | $count = 0; |
1018 | 1018 | foreach ( $all_course_ids as $course_id ) { |
1019 | - $course = get_post( $course_id ); |
|
1019 | + $course = get_post( $course_id ); |
|
1020 | 1020 | $count++; |
1021 | 1021 | $class = 'course'; |
1022 | 1022 | if ( $count == 1 ) { $class .= ' first'; } |
@@ -1131,73 +1131,73 @@ discard block |
||
1131 | 1131 | |
1132 | 1132 | $displayed_lessons = array(); |
1133 | 1133 | |
1134 | - $modules = Sensei()->modules->get_course_modules( intval( $course_id ) ); |
|
1135 | - |
|
1136 | - foreach( $modules as $module ) { |
|
1137 | - |
|
1138 | - $args = array( |
|
1139 | - 'post_type' => 'lesson', |
|
1140 | - 'post_status' => 'publish', |
|
1141 | - 'posts_per_page' => -1, |
|
1142 | - 'meta_query' => array( |
|
1143 | - array( |
|
1144 | - 'key' => '_lesson_course', |
|
1145 | - 'value' => intval( $course_id ), |
|
1146 | - 'compare' => '=' |
|
1147 | - ) |
|
1148 | - ), |
|
1149 | - 'tax_query' => array( |
|
1150 | - array( |
|
1151 | - 'taxonomy' => Sensei()->modules->taxonomy, |
|
1152 | - 'field' => 'id', |
|
1153 | - 'terms' => intval( $module->term_id ) |
|
1154 | - ) |
|
1155 | - ), |
|
1156 | - 'meta_key' => '_order_module_' . $module->term_id, |
|
1157 | - 'orderby' => 'meta_value_num date', |
|
1158 | - 'order' => 'ASC', |
|
1159 | - 'suppress_filters' => 0 |
|
1160 | - ); |
|
1161 | - |
|
1162 | - $lessons = get_posts( $args ); |
|
1163 | - |
|
1164 | - if( count( $lessons ) > 0 ) { |
|
1165 | - $html .= '<h3>' . $module->name . '</h3>' . "\n"; |
|
1166 | - $html .= '<ul class="sortable-lesson-list" data-module_id="' . $module->term_id . '">' . "\n"; |
|
1167 | - |
|
1168 | - $count = 0; |
|
1169 | - foreach( $lessons as $lesson ) { |
|
1170 | - $count++; |
|
1171 | - $class = 'lesson'; |
|
1172 | - if ( $count == 1 ) { $class .= ' first'; } |
|
1173 | - if ( $count == count( $lesson ) ) { $class .= ' last'; } |
|
1174 | - if ( $count % 2 != 0 ) { |
|
1175 | - $class .= ' alternate'; |
|
1176 | - } |
|
1177 | - |
|
1178 | - $html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $lesson->ID ) . '" style="width: 100%;"> ' . $lesson->post_title . '</span></li>' . "\n"; |
|
1179 | - |
|
1180 | - $displayed_lessons[] = $lesson->ID; |
|
1181 | - } |
|
1182 | - |
|
1183 | - $html .= '</ul>' . "\n"; |
|
1184 | - |
|
1185 | - $html .= '<input type="hidden" name="lesson-order-module-' . $module->term_id . '" value="" />' . "\n"; |
|
1186 | - } |
|
1187 | - } |
|
1188 | - |
|
1189 | - |
|
1190 | - $lessons = Sensei()->course->course_lessons( $course_id ); |
|
1134 | + $modules = Sensei()->modules->get_course_modules( intval( $course_id ) ); |
|
1135 | + |
|
1136 | + foreach( $modules as $module ) { |
|
1137 | + |
|
1138 | + $args = array( |
|
1139 | + 'post_type' => 'lesson', |
|
1140 | + 'post_status' => 'publish', |
|
1141 | + 'posts_per_page' => -1, |
|
1142 | + 'meta_query' => array( |
|
1143 | + array( |
|
1144 | + 'key' => '_lesson_course', |
|
1145 | + 'value' => intval( $course_id ), |
|
1146 | + 'compare' => '=' |
|
1147 | + ) |
|
1148 | + ), |
|
1149 | + 'tax_query' => array( |
|
1150 | + array( |
|
1151 | + 'taxonomy' => Sensei()->modules->taxonomy, |
|
1152 | + 'field' => 'id', |
|
1153 | + 'terms' => intval( $module->term_id ) |
|
1154 | + ) |
|
1155 | + ), |
|
1156 | + 'meta_key' => '_order_module_' . $module->term_id, |
|
1157 | + 'orderby' => 'meta_value_num date', |
|
1158 | + 'order' => 'ASC', |
|
1159 | + 'suppress_filters' => 0 |
|
1160 | + ); |
|
1161 | + |
|
1162 | + $lessons = get_posts( $args ); |
|
1163 | + |
|
1164 | + if( count( $lessons ) > 0 ) { |
|
1165 | + $html .= '<h3>' . $module->name . '</h3>' . "\n"; |
|
1166 | + $html .= '<ul class="sortable-lesson-list" data-module_id="' . $module->term_id . '">' . "\n"; |
|
1167 | + |
|
1168 | + $count = 0; |
|
1169 | + foreach( $lessons as $lesson ) { |
|
1170 | + $count++; |
|
1171 | + $class = 'lesson'; |
|
1172 | + if ( $count == 1 ) { $class .= ' first'; } |
|
1173 | + if ( $count == count( $lesson ) ) { $class .= ' last'; } |
|
1174 | + if ( $count % 2 != 0 ) { |
|
1175 | + $class .= ' alternate'; |
|
1176 | + } |
|
1177 | + |
|
1178 | + $html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $lesson->ID ) . '" style="width: 100%;"> ' . $lesson->post_title . '</span></li>' . "\n"; |
|
1179 | + |
|
1180 | + $displayed_lessons[] = $lesson->ID; |
|
1181 | + } |
|
1182 | + |
|
1183 | + $html .= '</ul>' . "\n"; |
|
1184 | + |
|
1185 | + $html .= '<input type="hidden" name="lesson-order-module-' . $module->term_id . '" value="" />' . "\n"; |
|
1186 | + } |
|
1187 | + } |
|
1188 | + |
|
1189 | + |
|
1190 | + $lessons = Sensei()->course->course_lessons( $course_id ); |
|
1191 | 1191 | |
1192 | 1192 | if( 0 < count( $lessons ) ) { |
1193 | 1193 | |
1194 | - //get module term ids, will be used to exclude lessons |
|
1195 | - $module_items_ids = array(); |
|
1196 | - if( ! empty( $modules ) ) { |
|
1197 | - foreach ($modules as $module) { |
|
1198 | - $module_items_ids[] = $module->term_id; |
|
1199 | - } |
|
1200 | - } |
|
1194 | + //get module term ids, will be used to exclude lessons |
|
1195 | + $module_items_ids = array(); |
|
1196 | + if( ! empty( $modules ) ) { |
|
1197 | + foreach ($modules as $module) { |
|
1198 | + $module_items_ids[] = $module->term_id; |
|
1199 | + } |
|
1200 | + } |
|
1201 | 1201 | |
1202 | 1202 | if( 0 < count( $displayed_lessons ) ) { |
1203 | 1203 | $html .= '<h3>' . __( 'Other Lessons', 'woothemes-sensei' ) . '</h3>' . "\n"; |
@@ -1207,13 +1207,13 @@ discard block |
||
1207 | 1207 | $count = 0; |
1208 | 1208 | foreach ( $lessons as $lesson ) { |
1209 | 1209 | |
1210 | - // if lesson belongs to one fo the course modules then exclude it here |
|
1211 | - // as it is listed above |
|
1212 | - if( has_term( $module_items_ids, 'module', $lesson->ID ) ){ |
|
1210 | + // if lesson belongs to one fo the course modules then exclude it here |
|
1211 | + // as it is listed above |
|
1212 | + if( has_term( $module_items_ids, 'module', $lesson->ID ) ){ |
|
1213 | 1213 | |
1214 | - continue; |
|
1214 | + continue; |
|
1215 | 1215 | |
1216 | - } |
|
1216 | + } |
|
1217 | 1217 | |
1218 | 1218 | $count++; |
1219 | 1219 | $class = 'lesson'; |
@@ -1257,28 +1257,28 @@ discard block |
||
1257 | 1257 | |
1258 | 1258 | if( $course_id ) { |
1259 | 1259 | |
1260 | - $modules = Sensei()->modules->get_course_modules( intval( $course_id ) ); |
|
1260 | + $modules = Sensei()->modules->get_course_modules( intval( $course_id ) ); |
|
1261 | 1261 | |
1262 | - foreach( $modules as $module ) { |
|
1262 | + foreach( $modules as $module ) { |
|
1263 | 1263 | |
1264 | 1264 | |
1265 | - if( isset( $_POST[ 'lesson-order-module-' . $module->term_id ] ) |
|
1266 | - && $_POST[ 'lesson-order-module-' . $module->term_id ] ) { |
|
1265 | + if( isset( $_POST[ 'lesson-order-module-' . $module->term_id ] ) |
|
1266 | + && $_POST[ 'lesson-order-module-' . $module->term_id ] ) { |
|
1267 | 1267 | |
1268 | - $order = explode( ',', $_POST[ 'lesson-order-module-' . $module->term_id ] ); |
|
1269 | - $i = 1; |
|
1270 | - foreach( $order as $lesson_id ) { |
|
1268 | + $order = explode( ',', $_POST[ 'lesson-order-module-' . $module->term_id ] ); |
|
1269 | + $i = 1; |
|
1270 | + foreach( $order as $lesson_id ) { |
|
1271 | 1271 | |
1272 | - if( $lesson_id ) { |
|
1273 | - update_post_meta( $lesson_id, '_order_module_' . $module->term_id, $i ); |
|
1274 | - ++$i; |
|
1275 | - } |
|
1272 | + if( $lesson_id ) { |
|
1273 | + update_post_meta( $lesson_id, '_order_module_' . $module->term_id, $i ); |
|
1274 | + ++$i; |
|
1275 | + } |
|
1276 | 1276 | |
1277 | - }// end for each order |
|
1277 | + }// end for each order |
|
1278 | 1278 | |
1279 | - }// end if |
|
1279 | + }// end if |
|
1280 | 1280 | |
1281 | - } // end for each modules |
|
1281 | + } // end for each modules |
|
1282 | 1282 | |
1283 | 1283 | |
1284 | 1284 | if( $order_string ) { |
@@ -1361,47 +1361,47 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | /** |
1363 | 1363 | * Adding admin notice if the current |
1364 | - * installed theme is not compatible |
|
1365 | - * |
|
1364 | + * installed theme is not compatible |
|
1365 | + * |
|
1366 | 1366 | * @return void |
1367 | 1367 | */ |
1368 | 1368 | public function theme_compatibility_notices() { |
1369 | 1369 | |
1370 | - if( isset( $_GET['sensei_hide_notice'] ) ) { |
|
1371 | - switch( esc_attr( $_GET['sensei_hide_notice'] ) ) { |
|
1370 | + if( isset( $_GET['sensei_hide_notice'] ) ) { |
|
1371 | + switch( esc_attr( $_GET['sensei_hide_notice'] ) ) { |
|
1372 | 1372 | case 'menu_settings': add_user_meta( get_current_user_id(), 'sensei_hide_menu_settings_notice', true ); break; |
1373 | 1373 | case 'theme_check': add_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true ); break; |
1374 | 1374 | } |
1375 | - } |
|
1375 | + } |
|
1376 | 1376 | |
1377 | - // white list templates that are already support by default and do not show notice for them |
|
1378 | - $template = get_option( 'template' ); |
|
1377 | + // white list templates that are already support by default and do not show notice for them |
|
1378 | + $template = get_option( 'template' ); |
|
1379 | 1379 | |
1380 | - $white_list = array( 'twentyeleven', |
|
1381 | - 'twentytwelve', |
|
1382 | - 'twentyfourteen', |
|
1383 | - 'twentyfifteen', |
|
1384 | - 'twentysixteen', |
|
1385 | - 'storefront', |
|
1386 | - ); |
|
1380 | + $white_list = array( 'twentyeleven', |
|
1381 | + 'twentytwelve', |
|
1382 | + 'twentyfourteen', |
|
1383 | + 'twentyfifteen', |
|
1384 | + 'twentysixteen', |
|
1385 | + 'storefront', |
|
1386 | + ); |
|
1387 | 1387 | |
1388 | - if ( in_array( $template, $white_list ) ) { |
|
1388 | + if ( in_array( $template, $white_list ) ) { |
|
1389 | 1389 | |
1390 | - return; |
|
1390 | + return; |
|
1391 | 1391 | |
1392 | - } |
|
1392 | + } |
|
1393 | 1393 | |
1394 | - // don't show the notice if the user chose to hide it |
|
1395 | - $hide_theme_check_notice = get_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true ); |
|
1396 | - if( $hide_theme_check_notice ) { |
|
1394 | + // don't show the notice if the user chose to hide it |
|
1395 | + $hide_theme_check_notice = get_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true ); |
|
1396 | + if( $hide_theme_check_notice ) { |
|
1397 | 1397 | |
1398 | - return; |
|
1398 | + return; |
|
1399 | 1399 | |
1400 | - } |
|
1400 | + } |
|
1401 | 1401 | |
1402 | - // show the notice for themes not supporting sensei |
|
1403 | - if ( ! current_theme_supports( 'sensei' ) ) { |
|
1404 | - ?> |
|
1402 | + // show the notice for themes not supporting sensei |
|
1403 | + if ( ! current_theme_supports( 'sensei' ) ) { |
|
1404 | + ?> |
|
1405 | 1405 | |
1406 | 1406 | <div id="message" class="error sensei-message sensei-connect"> |
1407 | 1407 | <p> |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | public function reset_theme_check_notices() { |
1438 | 1438 | global $current_user; |
1439 | 1439 | wp_get_current_user(); |
1440 | - $user_id = $current_user->ID; |
|
1440 | + $user_id = $current_user->ID; |
|
1441 | 1441 | |
1442 | 1442 | delete_user_meta( $user_id, 'sensei_hide_theme_check_notice' ); |
1443 | 1443 | } |
@@ -1457,62 +1457,62 @@ discard block |
||
1457 | 1457 | return $prevent_access; |
1458 | 1458 | } |
1459 | 1459 | |
1460 | - /** |
|
1461 | - * Hooked onto admin_init. Listens for install_sensei_pages and skip_install_sensei_pages query args |
|
1462 | - * on the sensei settings page. |
|
1463 | - * |
|
1464 | - * The function |
|
1465 | - * |
|
1466 | - * @since 1.8.7 |
|
1467 | - */ |
|
1468 | - public static function install_pages(){ |
|
1460 | + /** |
|
1461 | + * Hooked onto admin_init. Listens for install_sensei_pages and skip_install_sensei_pages query args |
|
1462 | + * on the sensei settings page. |
|
1463 | + * |
|
1464 | + * The function |
|
1465 | + * |
|
1466 | + * @since 1.8.7 |
|
1467 | + */ |
|
1468 | + public static function install_pages(){ |
|
1469 | 1469 | |
1470 | - // only fire on the settings page |
|
1471 | - if( ! isset( $_GET['page'] ) |
|
1472 | - || 'woothemes-sensei-settings' != $_GET['page'] |
|
1473 | - || 1 == get_option('skip_install_sensei_pages') ){ |
|
1470 | + // only fire on the settings page |
|
1471 | + if( ! isset( $_GET['page'] ) |
|
1472 | + || 'woothemes-sensei-settings' != $_GET['page'] |
|
1473 | + || 1 == get_option('skip_install_sensei_pages') ){ |
|
1474 | 1474 | |
1475 | - return; |
|
1475 | + return; |
|
1476 | 1476 | |
1477 | - } |
|
1477 | + } |
|
1478 | 1478 | |
1479 | - // Install/page installer |
|
1480 | - $install_complete = false; |
|
1479 | + // Install/page installer |
|
1480 | + $install_complete = false; |
|
1481 | 1481 | |
1482 | - // Add pages button |
|
1483 | - $settings_url = ''; |
|
1484 | - if (isset($_GET['install_sensei_pages']) && $_GET['install_sensei_pages']) { |
|
1482 | + // Add pages button |
|
1483 | + $settings_url = ''; |
|
1484 | + if (isset($_GET['install_sensei_pages']) && $_GET['install_sensei_pages']) { |
|
1485 | 1485 | |
1486 | - Sensei()->admin->create_pages(); |
|
1486 | + Sensei()->admin->create_pages(); |
|
1487 | 1487 | |
1488 | - update_option('skip_install_sensei_pages', 1); |
|
1488 | + update_option('skip_install_sensei_pages', 1); |
|
1489 | 1489 | |
1490 | - $install_complete = true; |
|
1491 | - $settings_url = remove_query_arg('install_sensei_pages'); |
|
1490 | + $install_complete = true; |
|
1491 | + $settings_url = remove_query_arg('install_sensei_pages'); |
|
1492 | 1492 | |
1493 | - // Skip button |
|
1494 | - } elseif (isset($_GET['skip_install_sensei_pages']) && $_GET['skip_install_sensei_pages']) { |
|
1493 | + // Skip button |
|
1494 | + } elseif (isset($_GET['skip_install_sensei_pages']) && $_GET['skip_install_sensei_pages']) { |
|
1495 | 1495 | |
1496 | - update_option('skip_install_sensei_pages', 1); |
|
1497 | - $install_complete = true; |
|
1498 | - $settings_url = remove_query_arg('skip_install_sensei_pages'); |
|
1496 | + update_option('skip_install_sensei_pages', 1); |
|
1497 | + $install_complete = true; |
|
1498 | + $settings_url = remove_query_arg('skip_install_sensei_pages'); |
|
1499 | 1499 | |
1500 | - } |
|
1500 | + } |
|
1501 | 1501 | |
1502 | - if ($install_complete) { |
|
1502 | + if ($install_complete) { |
|
1503 | 1503 | |
1504 | - // refresh the rewrite rules on init |
|
1505 | - update_option('sensei_flush_rewrite_rules', '1'); |
|
1504 | + // refresh the rewrite rules on init |
|
1505 | + update_option('sensei_flush_rewrite_rules', '1'); |
|
1506 | 1506 | |
1507 | - // Set installed option |
|
1508 | - update_option('sensei_installed', 0); |
|
1507 | + // Set installed option |
|
1508 | + update_option('sensei_installed', 0); |
|
1509 | 1509 | |
1510 | - $complete_url = add_query_arg( 'sensei_install_complete', 'true', $settings_url ); |
|
1511 | - wp_redirect( $complete_url ); |
|
1510 | + $complete_url = add_query_arg( 'sensei_install_complete', 'true', $settings_url ); |
|
1511 | + wp_redirect( $complete_url ); |
|
1512 | 1512 | |
1513 | - } |
|
1513 | + } |
|
1514 | 1514 | |
1515 | - }// end install_pages |
|
1515 | + }// end install_pages |
|
1516 | 1516 | |
1517 | 1517 | } // End Class |
1518 | 1518 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Handles all admin views, assets and navigation. |
@@ -14,51 +14,51 @@ discard block |
||
14 | 14 | * Constructor. |
15 | 15 | * @since 1.0.0 |
16 | 16 | */ |
17 | - public function __construct () { |
|
17 | + public function __construct() { |
|
18 | 18 | |
19 | 19 | //register admin styles |
20 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles_global' ) ); |
|
20 | + add_action('admin_enqueue_scripts', array($this, 'admin_styles_global')); |
|
21 | 21 | |
22 | 22 | //register admin scripts |
23 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
23 | + add_action('admin_enqueue_scripts', array($this, 'register_scripts')); |
|
24 | 24 | |
25 | - add_action( 'admin_print_styles', array( $this, 'admin_notices_styles' ) ); |
|
26 | - add_action( 'settings_before_form', array( $this, 'install_pages_output' ) ); |
|
27 | - add_action( 'admin_menu', array( $this, 'admin_menu' ), 10 ); |
|
28 | - add_action( 'menu_order', array( $this, 'admin_menu_order' ) ); |
|
29 | - add_action( 'admin_head', array( $this, 'admin_menu_highlight' ) ); |
|
30 | - add_action( 'admin_init', array( $this, 'page_redirect' ) ); |
|
31 | - add_action( 'admin_init', array( $this, 'sensei_add_custom_menu_items' ) ); |
|
32 | - add_action( 'admin_init', array( __CLASS__, 'install_pages' )); |
|
25 | + add_action('admin_print_styles', array($this, 'admin_notices_styles')); |
|
26 | + add_action('settings_before_form', array($this, 'install_pages_output')); |
|
27 | + add_action('admin_menu', array($this, 'admin_menu'), 10); |
|
28 | + add_action('menu_order', array($this, 'admin_menu_order')); |
|
29 | + add_action('admin_head', array($this, 'admin_menu_highlight')); |
|
30 | + add_action('admin_init', array($this, 'page_redirect')); |
|
31 | + add_action('admin_init', array($this, 'sensei_add_custom_menu_items')); |
|
32 | + add_action('admin_init', array(__CLASS__, 'install_pages')); |
|
33 | 33 | |
34 | 34 | // Duplicate lesson & courses |
35 | - add_filter( 'post_row_actions', array( $this, 'duplicate_action_link' ), 10, 2 ); |
|
36 | - add_action( 'admin_action_duplicate_lesson', array( $this, 'duplicate_lesson_action' ) ); |
|
37 | - add_action( 'admin_action_duplicate_course', array( $this, 'duplicate_course_action' ) ); |
|
38 | - add_action( 'admin_action_duplicate_course_with_lessons', array( $this, 'duplicate_course_with_lessons_action' ) ); |
|
35 | + add_filter('post_row_actions', array($this, 'duplicate_action_link'), 10, 2); |
|
36 | + add_action('admin_action_duplicate_lesson', array($this, 'duplicate_lesson_action')); |
|
37 | + add_action('admin_action_duplicate_course', array($this, 'duplicate_course_action')); |
|
38 | + add_action('admin_action_duplicate_course_with_lessons', array($this, 'duplicate_course_with_lessons_action')); |
|
39 | 39 | |
40 | 40 | // Handle lessons list table filtering |
41 | - add_action( 'restrict_manage_posts', array( $this, 'lesson_filter_options' ) ); |
|
42 | - add_filter( 'request', array( $this, 'lesson_filter_actions' ) ); |
|
41 | + add_action('restrict_manage_posts', array($this, 'lesson_filter_options')); |
|
42 | + add_filter('request', array($this, 'lesson_filter_actions')); |
|
43 | 43 | |
44 | 44 | // Add Sensei items to 'at a glance' widget |
45 | - add_filter( 'dashboard_glance_items', array( $this, 'glance_items' ), 10, 1 ); |
|
45 | + add_filter('dashboard_glance_items', array($this, 'glance_items'), 10, 1); |
|
46 | 46 | |
47 | 47 | // Handle course and lesson deletions |
48 | - add_action( 'trash_course', array( $this, 'delete_content' ), 10, 2 ); |
|
49 | - add_action( 'trash_lesson', array( $this, 'delete_content' ), 10, 2 ); |
|
48 | + add_action('trash_course', array($this, 'delete_content'), 10, 2); |
|
49 | + add_action('trash_lesson', array($this, 'delete_content'), 10, 2); |
|
50 | 50 | |
51 | 51 | // Delete user activity when user is deleted |
52 | - add_action( 'deleted_user', array( $this, 'delete_user_activity' ), 10, 1 ); |
|
52 | + add_action('deleted_user', array($this, 'delete_user_activity'), 10, 1); |
|
53 | 53 | |
54 | 54 | // Add notices to WP dashboard |
55 | - add_action( 'admin_notices', array( $this, 'theme_compatibility_notices' ) ); |
|
55 | + add_action('admin_notices', array($this, 'theme_compatibility_notices')); |
|
56 | 56 | |
57 | 57 | // Reset theme notices when switching themes |
58 | - add_action( 'switch_theme', array( $this, 'reset_theme_check_notices' ) ); |
|
58 | + add_action('switch_theme', array($this, 'reset_theme_check_notices')); |
|
59 | 59 | |
60 | 60 | // Allow Teacher access the admin area |
61 | - add_filter( 'woocommerce_prevent_admin_access', array( $this, 'admin_access' ) ); |
|
61 | + add_filter('woocommerce_prevent_admin_access', array($this, 'admin_access')); |
|
62 | 62 | |
63 | 63 | } // End __construct() |
64 | 64 | |
@@ -70,21 +70,21 @@ discard block |
||
70 | 70 | public function admin_menu() { |
71 | 71 | global $menu; |
72 | 72 | $menu_cap = ''; |
73 | - if( current_user_can( 'manage_sensei' ) ) { |
|
73 | + if (current_user_can('manage_sensei')) { |
|
74 | 74 | $menu_cap = 'manage_sensei'; |
75 | 75 | } else { |
76 | - if( current_user_can( 'manage_sensei_grades' ) ) { |
|
76 | + if (current_user_can('manage_sensei_grades')) { |
|
77 | 77 | $menu_cap = 'manage_sensei_grades'; |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - if( $menu_cap ) { |
|
82 | - $menu[] = array( '', 'read', 'separator-sensei', '', 'wp-menu-separator sensei' ); |
|
83 | - add_menu_page( 'Sensei', 'Sensei', $menu_cap, 'sensei' , array( Sensei()->analysis, 'analysis_page' ) , '', '50' ); |
|
81 | + if ($menu_cap) { |
|
82 | + $menu[] = array('', 'read', 'separator-sensei', '', 'wp-menu-separator sensei'); |
|
83 | + add_menu_page('Sensei', 'Sensei', $menu_cap, 'sensei', array(Sensei()->analysis, 'analysis_page'), '', '50'); |
|
84 | 84 | } |
85 | 85 | |
86 | - add_submenu_page( 'edit.php?post_type=course', __( 'Order Courses', 'woothemes-sensei' ), __( 'Order Courses', 'woothemes-sensei' ), 'manage_sensei', 'course-order', array( $this, 'course_order_screen' ) ); |
|
87 | - add_submenu_page( 'edit.php?post_type=lesson', __( 'Order Lessons', 'woothemes-sensei' ), __( 'Order Lessons', 'woothemes-sensei' ), 'edit_lessons', 'lesson-order', array( $this, 'lesson_order_screen' ) ); |
|
86 | + add_submenu_page('edit.php?post_type=course', __('Order Courses', 'woothemes-sensei'), __('Order Courses', 'woothemes-sensei'), 'manage_sensei', 'course-order', array($this, 'course_order_screen')); |
|
87 | + add_submenu_page('edit.php?post_type=lesson', __('Order Lessons', 'woothemes-sensei'), __('Order Lessons', 'woothemes-sensei'), 'edit_lessons', 'lesson-order', array($this, 'lesson_order_screen')); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -93,22 +93,22 @@ discard block |
||
93 | 93 | * @param array $menu_order Existing menu order |
94 | 94 | * @return array Modified menu order for Sensei |
95 | 95 | */ |
96 | - public function admin_menu_order( $menu_order ) { |
|
96 | + public function admin_menu_order($menu_order) { |
|
97 | 97 | |
98 | 98 | // Initialize our custom order array |
99 | 99 | $sensei_menu_order = array(); |
100 | 100 | |
101 | 101 | // Get the index of our custom separator |
102 | - $sensei_separator = array_search( 'separator-sensei', $menu_order ); |
|
102 | + $sensei_separator = array_search('separator-sensei', $menu_order); |
|
103 | 103 | |
104 | 104 | // Loop through menu order and do some rearranging |
105 | - foreach ( $menu_order as $index => $item ) : |
|
105 | + foreach ($menu_order as $index => $item) : |
|
106 | 106 | |
107 | - if ( ( ( 'sensei' ) == $item ) ) : |
|
107 | + if ((('sensei') == $item)) : |
|
108 | 108 | $sensei_menu_order[] = 'separator-sensei'; |
109 | 109 | $sensei_menu_order[] = $item; |
110 | - unset( $menu_order[$sensei_separator] ); |
|
111 | - elseif ( !in_array( $item, array( 'separator-sensei' ) ) ) : |
|
110 | + unset($menu_order[$sensei_separator]); |
|
111 | + elseif ( ! in_array($item, array('separator-sensei'))) : |
|
112 | 112 | $sensei_menu_order[] = $item; |
113 | 113 | endif; |
114 | 114 | |
@@ -128,24 +128,24 @@ discard block |
||
128 | 128 | |
129 | 129 | $screen = get_current_screen(); |
130 | 130 | |
131 | - if ( $screen->base == 'post' && $post_type == 'course' ) { |
|
131 | + if ($screen->base == 'post' && $post_type == 'course') { |
|
132 | 132 | |
133 | - $parent_file = 'edit.php?post_type=course'; |
|
133 | + $parent_file = 'edit.php?post_type=course'; |
|
134 | 134 | |
135 | - } elseif ( $screen->base == 'edit-tags' && $taxonomy == 'course-category' ) { |
|
135 | + } elseif ($screen->base == 'edit-tags' && $taxonomy == 'course-category') { |
|
136 | 136 | |
137 | 137 | $submenu_file = 'edit-tags.php?taxonomy=course-category&post_type=course'; |
138 | 138 | $parent_file = 'edit.php?post_type=course'; |
139 | 139 | |
140 | - } elseif ( $screen->base == 'edit-tags' && $taxonomy == 'module' ) { |
|
140 | + } elseif ($screen->base == 'edit-tags' && $taxonomy == 'module') { |
|
141 | 141 | |
142 | 142 | $submenu_file = 'edit-tags.php?taxonomy=module'; |
143 | 143 | $parent_file = 'edit.php?post_type=course'; |
144 | 144 | |
145 | - } elseif ( in_array( $screen->id, array( 'sensei_message', 'edit-sensei_message' ) ) ) { |
|
145 | + } elseif (in_array($screen->id, array('sensei_message', 'edit-sensei_message'))) { |
|
146 | 146 | |
147 | 147 | $submenu_file = 'edit.php?post_type=sensei_message'; |
148 | - $parent_file = 'sensei'; |
|
148 | + $parent_file = 'sensei'; |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | } |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * @return void |
157 | 157 | */ |
158 | 158 | public function page_redirect() { |
159 | - if( isset( $_GET['page'] ) && $_GET['page'] == 'sensei' ) { |
|
160 | - wp_safe_redirect( 'admin.php?page=sensei_analysis' ); |
|
159 | + if (isset($_GET['page']) && $_GET['page'] == 'sensei') { |
|
160 | + wp_safe_redirect('admin.php?page=sensei_analysis'); |
|
161 | 161 | exit; |
162 | 162 | } |
163 | 163 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | */ |
173 | 173 | function install_pages_output() { |
174 | 174 | |
175 | - if( isset($_GET['sensei_install_complete']) && 'true' == $_GET['sensei_install_complete']) { |
|
175 | + if (isset($_GET['sensei_install_complete']) && 'true' == $_GET['sensei_install_complete']) { |
|
176 | 176 | |
177 | 177 | ?> |
178 | 178 | <div id="message" class="updated sensei-message sensei-connect"> |
179 | - <p><?php _e( '<strong>Congratulations!</strong> – Sensei has been installed and set up.', 'woothemes-sensei' ); ?></p> |
|
179 | + <p><?php _e('<strong>Congratulations!</strong> – Sensei has been installed and set up.', 'woothemes-sensei'); ?></p> |
|
180 | 180 | <p><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/sensei/" data-text="A premium Learning Management plugin for #WordPress that helps you create courses. Beautifully." data-via="WooThemes" data-size="large" data-hashtags="Sensei">Tweet</a> |
181 | 181 | <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p> |
182 | 182 | </div> |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | * @param int $post_parent (default: 0) |
199 | 199 | * @return integer $page_id |
200 | 200 | */ |
201 | - function create_page( $slug, $page_title = '', $page_content = '', $post_parent = 0 ) { |
|
201 | + function create_page($slug, $page_title = '', $page_content = '', $post_parent = 0) { |
|
202 | 202 | global $wpdb; |
203 | 203 | |
204 | - $page_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", $slug ) ); |
|
205 | - if ( $page_id ) : |
|
204 | + $page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", $slug)); |
|
205 | + if ($page_id) : |
|
206 | 206 | return $page_id; |
207 | 207 | endif; |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 'comment_status' => 'closed' |
218 | 218 | ); |
219 | 219 | |
220 | - $page_id = wp_insert_post( $page_data ); |
|
220 | + $page_id = wp_insert_post($page_data); |
|
221 | 221 | |
222 | 222 | return $page_id; |
223 | 223 | |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | function create_pages() { |
234 | 234 | |
235 | 235 | // Courses page |
236 | - $new_course_page_id = $this->create_page( esc_sql( _x('courses-overview', 'page_slug', 'woothemes-sensei') ), __('Courses', 'woothemes-sensei'), '' ); |
|
237 | - Sensei()->settings->set( 'course_page', $new_course_page_id ); |
|
236 | + $new_course_page_id = $this->create_page(esc_sql(_x('courses-overview', 'page_slug', 'woothemes-sensei')), __('Courses', 'woothemes-sensei'), ''); |
|
237 | + Sensei()->settings->set('course_page', $new_course_page_id); |
|
238 | 238 | |
239 | 239 | // User Dashboard page |
240 | - $new_my_course_page_id = $this->create_page( esc_sql( _x('my-courses', 'page_slug', 'woothemes-sensei') ), __('My Courses', 'woothemes-sensei'), '[sensei_user_courses]' ); |
|
241 | - Sensei()->settings->set( 'my_course_page',$new_my_course_page_id ); |
|
240 | + $new_my_course_page_id = $this->create_page(esc_sql(_x('my-courses', 'page_slug', 'woothemes-sensei')), __('My Courses', 'woothemes-sensei'), '[sensei_user_courses]'); |
|
241 | + Sensei()->settings->set('my_course_page', $new_my_course_page_id); |
|
242 | 242 | |
243 | 243 | } // End create_pages() |
244 | 244 | |
@@ -248,25 +248,25 @@ discard block |
||
248 | 248 | * @since 1.0.0 |
249 | 249 | * @return void |
250 | 250 | */ |
251 | - public function admin_styles_global ( $hook ) { |
|
251 | + public function admin_styles_global($hook) { |
|
252 | 252 | global $post_type; |
253 | 253 | |
254 | - $allowed_post_types = apply_filters( 'sensei_scripts_allowed_post_types', array( 'lesson', 'course', 'question' ) ); |
|
255 | - $allowed_post_type_pages = apply_filters( 'sensei_scripts_allowed_post_type_pages', array( 'edit.php', 'post-new.php', 'post.php', 'edit-tags.php' ) ); |
|
256 | - $allowed_pages = apply_filters( 'sensei_scripts_allowed_pages', array( 'sensei_grading', 'sensei_analysis', 'sensei_learners', 'sensei_updates', 'woothemes-sensei-settings', 'lesson-order', 'course-order' ) ); |
|
254 | + $allowed_post_types = apply_filters('sensei_scripts_allowed_post_types', array('lesson', 'course', 'question')); |
|
255 | + $allowed_post_type_pages = apply_filters('sensei_scripts_allowed_post_type_pages', array('edit.php', 'post-new.php', 'post.php', 'edit-tags.php')); |
|
256 | + $allowed_pages = apply_filters('sensei_scripts_allowed_pages', array('sensei_grading', 'sensei_analysis', 'sensei_learners', 'sensei_updates', 'woothemes-sensei-settings', 'lesson-order', 'course-order')); |
|
257 | 257 | |
258 | 258 | // Global Styles for icons and menu items |
259 | - wp_register_style( 'woothemes-sensei-global', Sensei()->plugin_url . 'assets/css/global.css', '', Sensei()->version, 'screen' ); |
|
260 | - wp_enqueue_style( 'woothemes-sensei-global' ); |
|
259 | + wp_register_style('woothemes-sensei-global', Sensei()->plugin_url.'assets/css/global.css', '', Sensei()->version, 'screen'); |
|
260 | + wp_enqueue_style('woothemes-sensei-global'); |
|
261 | 261 | |
262 | 262 | // Select 2 styles |
263 | - wp_enqueue_style( 'sensei-core-select2', Sensei()->plugin_url . 'assets/css/select2/select2.css', '', Sensei()->version, 'screen' ); |
|
263 | + wp_enqueue_style('sensei-core-select2', Sensei()->plugin_url.'assets/css/select2/select2.css', '', Sensei()->version, 'screen'); |
|
264 | 264 | |
265 | 265 | // Test for Write Panel Pages |
266 | - if ( ( ( isset( $post_type ) && in_array( $post_type, $allowed_post_types ) ) && ( isset( $hook ) && in_array( $hook, $allowed_post_type_pages ) ) ) || ( isset( $_GET['page'] ) && in_array( $_GET['page'], $allowed_pages ) ) ) { |
|
266 | + if (((isset($post_type) && in_array($post_type, $allowed_post_types)) && (isset($hook) && in_array($hook, $allowed_post_type_pages))) || (isset($_GET['page']) && in_array($_GET['page'], $allowed_pages))) { |
|
267 | 267 | |
268 | - wp_register_style( 'woothemes-sensei-admin-custom', Sensei()->plugin_url . 'assets/css/admin-custom.css', '', Sensei()->version, 'screen' ); |
|
269 | - wp_enqueue_style( 'woothemes-sensei-admin-custom' ); |
|
268 | + wp_register_style('woothemes-sensei-admin-custom', Sensei()->plugin_url.'assets/css/admin-custom.css', '', Sensei()->version, 'screen'); |
|
269 | + wp_enqueue_style('woothemes-sensei-admin-custom'); |
|
270 | 270 | |
271 | 271 | } |
272 | 272 | |
@@ -281,20 +281,20 @@ discard block |
||
281 | 281 | * @since 1.8.2 |
282 | 282 | * @access public |
283 | 283 | */ |
284 | - public function register_scripts( $hook ){ |
|
284 | + public function register_scripts($hook) { |
|
285 | 285 | |
286 | 286 | $screen = get_current_screen(); |
287 | 287 | |
288 | 288 | // Allow developers to load non-minified versions of scripts |
289 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
289 | + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
290 | 290 | |
291 | 291 | // Select2 script used to enhance all select boxes |
292 | - wp_register_script( 'sensei-core-select2', Sensei()->plugin_url . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), Sensei()->version ); |
|
292 | + wp_register_script('sensei-core-select2', Sensei()->plugin_url.'/assets/js/select2/select2'.$suffix.'.js', array('jquery'), Sensei()->version); |
|
293 | 293 | |
294 | 294 | // load edit module scripts |
295 | - if( 'edit-module' == $screen->id ){ |
|
295 | + if ('edit-module' == $screen->id) { |
|
296 | 296 | |
297 | - wp_enqueue_script( 'sensei-chosen-ajax', Sensei()->plugin_url . 'assets/chosen/ajax-chosen.jquery.min.js', array( 'jquery', 'sensei-chosen' ), Sensei()->version, true ); |
|
297 | + wp_enqueue_script('sensei-chosen-ajax', Sensei()->plugin_url.'assets/chosen/ajax-chosen.jquery.min.js', array('jquery', 'sensei-chosen'), Sensei()->version, true); |
|
298 | 298 | |
299 | 299 | } |
300 | 300 | |
@@ -312,19 +312,19 @@ discard block |
||
312 | 312 | <div id="message" class="updated sensei-message sensei-connect"> |
313 | 313 | |
314 | 314 | <p> |
315 | - <?php _e( '<strong>Welcome to Sensei</strong> – You\'re almost ready to create some courses!', 'woothemes-sensei' ); ?> |
|
315 | + <?php _e('<strong>Welcome to Sensei</strong> – You\'re almost ready to create some courses!', 'woothemes-sensei'); ?> |
|
316 | 316 | </p> |
317 | 317 | |
318 | 318 | <p class="submit"> |
319 | 319 | |
320 | - <a href="<?php echo esc_url( add_query_arg('install_sensei_pages', 'true', admin_url('admin.php?page=woothemes-sensei-settings') ) ); ?>" |
|
320 | + <a href="<?php echo esc_url(add_query_arg('install_sensei_pages', 'true', admin_url('admin.php?page=woothemes-sensei-settings'))); ?>" |
|
321 | 321 | class="button-primary"> |
322 | 322 | |
323 | - <?php _e( 'Install Sensei Pages', 'woothemes-sensei' ); ?> |
|
323 | + <?php _e('Install Sensei Pages', 'woothemes-sensei'); ?> |
|
324 | 324 | |
325 | 325 | </a> |
326 | 326 | |
327 | - <a class="skip button" href="<?php echo esc_url( add_query_arg( 'skip_install_sensei_pages', 'true', admin_url('admin.php?page=woothemes-sensei-settings' ) ) ); ?>"> |
|
327 | + <a class="skip button" href="<?php echo esc_url(add_query_arg('skip_install_sensei_pages', 'true', admin_url('admin.php?page=woothemes-sensei-settings'))); ?>"> |
|
328 | 328 | |
329 | 329 | <?php _e('Skip setup', 'woothemes-sensei'); ?> |
330 | 330 | |
@@ -347,11 +347,11 @@ discard block |
||
347 | 347 | <div id="message" class="updated sensei-message sensei-connect"> |
348 | 348 | |
349 | 349 | <p> |
350 | - <?php _e( '<strong>Sensei has been installed</strong> – You\'re ready to start creating courses!', 'woothemes-sensei' ); ?> |
|
350 | + <?php _e('<strong>Sensei has been installed</strong> – You\'re ready to start creating courses!', 'woothemes-sensei'); ?> |
|
351 | 351 | </p> |
352 | 352 | |
353 | 353 | <p class="submit"> |
354 | - <a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button-primary"><?php _e( 'Settings', 'woothemes-sensei' ); ?></a> <a class="docs button" href="http://www.woothemes.com/sensei-docs/"> |
|
354 | + <a href="<?php echo admin_url('admin.php?page=woothemes-sensei-settings'); ?>" class="button-primary"><?php _e('Settings', 'woothemes-sensei'); ?></a> <a class="docs button" href="http://www.woothemes.com/sensei-docs/"> |
|
355 | 355 | <?php _e('Documentation', 'woothemes-sensei'); ?> |
356 | 356 | </a> |
357 | 357 | </p> |
@@ -384,11 +384,11 @@ discard block |
||
384 | 384 | public function language_pack_install_notice() { |
385 | 385 | ?> |
386 | 386 | <div id="message" class="updated sensei-message sensei-connect"> |
387 | - <p><?php _e( '<strong>Sensei in your language</strong> – There is a translation available for your language.', 'woothemes-sensei' ); ?><p> |
|
387 | + <p><?php _e('<strong>Sensei in your language</strong> – There is a translation available for your language.', 'woothemes-sensei'); ?><p> |
|
388 | 388 | |
389 | 389 | <p class="submit"> |
390 | - <a href="<?php echo esc_url( Sensei_Language_Pack_Manager::get_install_uri() ); ?>" class="button-primary"><?php _e( 'Install', 'woothemes-sensei' ); ?></a> |
|
391 | - <a href="<?php echo esc_url( Sensei_Language_Pack_Manager::get_dismiss_uri() ) ?>" class="docs button"><?php _e( 'Hide this notice', 'woothemes-sensei' ); ?></a> |
|
390 | + <a href="<?php echo esc_url(Sensei_Language_Pack_Manager::get_install_uri()); ?>" class="button-primary"><?php _e('Install', 'woothemes-sensei'); ?></a> |
|
391 | + <a href="<?php echo esc_url(Sensei_Language_Pack_Manager::get_dismiss_uri()) ?>" class="docs button"><?php _e('Hide this notice', 'woothemes-sensei'); ?></a> |
|
392 | 392 | </p> |
393 | 393 | </div> |
394 | 394 | <?php |
@@ -404,20 +404,20 @@ discard block |
||
404 | 404 | function admin_notices_styles() { |
405 | 405 | |
406 | 406 | // Installed notices |
407 | - if ( 1 == get_option( 'sensei_installed' ) ) { |
|
407 | + if (1 == get_option('sensei_installed')) { |
|
408 | 408 | |
409 | - wp_enqueue_style( 'sensei-activation', plugins_url( '/assets/css/activation.css', dirname( __FILE__ ) ), '', Sensei()->version ); |
|
409 | + wp_enqueue_style('sensei-activation', plugins_url('/assets/css/activation.css', dirname(__FILE__)), '', Sensei()->version); |
|
410 | 410 | |
411 | - if (get_option('skip_install_sensei_pages')!=1 && Sensei()->get_page_id('course')<1 && !isset($_GET['install_sensei_pages']) && !isset($_GET['skip_install_sensei_pages'])) { |
|
412 | - add_action( 'admin_notices', array( $this, 'admin_install_notice' ) ); |
|
413 | - } elseif ( !isset($_GET['page']) || $_GET['page']!='woothemes-sensei-settings' ) { |
|
414 | - add_action( 'admin_notices', array( $this, 'admin_installed_notice' ) ); |
|
411 | + if (get_option('skip_install_sensei_pages') != 1 && Sensei()->get_page_id('course') < 1 && ! isset($_GET['install_sensei_pages']) && ! isset($_GET['skip_install_sensei_pages'])) { |
|
412 | + add_action('admin_notices', array($this, 'admin_install_notice')); |
|
413 | + } elseif ( ! isset($_GET['page']) || $_GET['page'] != 'woothemes-sensei-settings') { |
|
414 | + add_action('admin_notices', array($this, 'admin_installed_notice')); |
|
415 | 415 | } // End If Statement |
416 | 416 | |
417 | 417 | } // End If Statement |
418 | 418 | |
419 | - if ( Sensei_Language_Pack_Manager::has_language_pack_available() ) { |
|
420 | - add_action( 'admin_notices', array( $this, 'language_pack_install_notice' ) ); |
|
419 | + if (Sensei_Language_Pack_Manager::has_language_pack_available()) { |
|
420 | + add_action('admin_notices', array($this, 'language_pack_install_notice')); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | } // End admin_notices_styles() |
@@ -428,17 +428,17 @@ discard block |
||
428 | 428 | * @param object $post Current post |
429 | 429 | * @return array Modified actions |
430 | 430 | */ |
431 | - public function duplicate_action_link( $actions, $post ) { |
|
432 | - switch( $post->post_type ) { |
|
431 | + public function duplicate_action_link($actions, $post) { |
|
432 | + switch ($post->post_type) { |
|
433 | 433 | case 'lesson': |
434 | - $confirm = __( 'This will duplicate the lesson quiz and all of its questions. Are you sure you want to do this?', 'woothemes-sensei' ); |
|
435 | - $actions['duplicate'] = "<a onclick='return confirm(\"" . $confirm . "\");' href='" . $this->get_duplicate_link( $post->ID ) . "' title='" . esc_attr(__( 'Duplicate this lesson', 'woothemes-sensei' ) ) . "'>" . __('Duplicate', 'woothemes-sensei' ) . "</a>"; |
|
434 | + $confirm = __('This will duplicate the lesson quiz and all of its questions. Are you sure you want to do this?', 'woothemes-sensei'); |
|
435 | + $actions['duplicate'] = "<a onclick='return confirm(\"".$confirm."\");' href='".$this->get_duplicate_link($post->ID)."' title='".esc_attr(__('Duplicate this lesson', 'woothemes-sensei'))."'>".__('Duplicate', 'woothemes-sensei')."</a>"; |
|
436 | 436 | break; |
437 | 437 | |
438 | 438 | case 'course': |
439 | - $confirm = __( 'This will duplicate the course lessons along with all of their quizzes and questions. Are you sure you want to do this?', 'woothemes-sensei' ); |
|
440 | - $actions['duplicate'] = '<a href="' . $this->get_duplicate_link( $post->ID ) . '" title="' . esc_attr(__( 'Duplicate this course', 'woothemes-sensei' ) ) . '">' . __('Duplicate', 'woothemes-sensei' ) . '</a>'; |
|
441 | - $actions['duplicate_with_lessons'] = '<a onclick="return confirm(\'' . $confirm . '\');" href="' . $this->get_duplicate_link( $post->ID, true ) . '" title="' . esc_attr(__( 'Duplicate this course with its lessons', 'woothemes-sensei' ) ) . '">' . __('Duplicate (with lessons)', 'woothemes-sensei' ) . '</a>'; |
|
439 | + $confirm = __('This will duplicate the course lessons along with all of their quizzes and questions. Are you sure you want to do this?', 'woothemes-sensei'); |
|
440 | + $actions['duplicate'] = '<a href="'.$this->get_duplicate_link($post->ID).'" title="'.esc_attr(__('Duplicate this course', 'woothemes-sensei')).'">'.__('Duplicate', 'woothemes-sensei').'</a>'; |
|
441 | + $actions['duplicate_with_lessons'] = '<a onclick="return confirm(\''.$confirm.'\');" href="'.$this->get_duplicate_link($post->ID, true).'" title="'.esc_attr(__('Duplicate this course with its lessons', 'woothemes-sensei')).'">'.__('Duplicate (with lessons)', 'woothemes-sensei').'</a>'; |
|
442 | 442 | break; |
443 | 443 | } |
444 | 444 | |
@@ -451,17 +451,17 @@ discard block |
||
451 | 451 | * @param boolean $with_lessons Include lessons or not |
452 | 452 | * @return string Duplication link |
453 | 453 | */ |
454 | - private function get_duplicate_link( $post_id = 0, $with_lessons = false ) { |
|
454 | + private function get_duplicate_link($post_id = 0, $with_lessons = false) { |
|
455 | 455 | |
456 | - $post = get_post( $post_id ); |
|
456 | + $post = get_post($post_id); |
|
457 | 457 | |
458 | - $action = 'duplicate_' . $post->post_type; |
|
458 | + $action = 'duplicate_'.$post->post_type; |
|
459 | 459 | |
460 | - if( 'course' == $post->post_type && $with_lessons ) { |
|
460 | + if ('course' == $post->post_type && $with_lessons) { |
|
461 | 461 | $action .= '_with_lessons'; |
462 | 462 | } |
463 | 463 | |
464 | - return apply_filters( $action . '_link', admin_url( 'admin.php?action=' . $action . '&post=' . $post_id ), $post_id ); |
|
464 | + return apply_filters($action.'_link', admin_url('admin.php?action='.$action.'&post='.$post_id), $post_id); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | * @return void |
470 | 470 | */ |
471 | 471 | public function duplicate_lesson_action() { |
472 | - $this->duplicate_content( 'lesson' ); |
|
472 | + $this->duplicate_content('lesson'); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | /** |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return void |
478 | 478 | */ |
479 | 479 | public function duplicate_course_action() { |
480 | - $this->duplicate_content( 'course' ); |
|
480 | + $this->duplicate_content('course'); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @return void |
486 | 486 | */ |
487 | 487 | public function duplicate_course_with_lessons_action() { |
488 | - $this->duplicate_content( 'course', true ); |
|
488 | + $this->duplicate_content('course', true); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | /** |
@@ -494,34 +494,34 @@ discard block |
||
494 | 494 | * @param boolean $with_lessons Include lessons or not |
495 | 495 | * @return void |
496 | 496 | */ |
497 | - private function duplicate_content( $post_type = 'lesson', $with_lessons = false ) { |
|
498 | - if ( ! isset( $_GET['post'] ) ) { |
|
499 | - wp_die( sprintf( __( 'Please supply a %1$s ID.', 'woothemes-sensei' ) ), $post_type ); |
|
497 | + private function duplicate_content($post_type = 'lesson', $with_lessons = false) { |
|
498 | + if ( ! isset($_GET['post'])) { |
|
499 | + wp_die(sprintf(__('Please supply a %1$s ID.', 'woothemes-sensei')), $post_type); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | $post_id = $_GET['post']; |
503 | - $post = get_post( $post_id ); |
|
503 | + $post = get_post($post_id); |
|
504 | 504 | |
505 | - if( ! is_wp_error( $post ) ) { |
|
505 | + if ( ! is_wp_error($post)) { |
|
506 | 506 | |
507 | - $new_post = $this->duplicate_post( $post ); |
|
507 | + $new_post = $this->duplicate_post($post); |
|
508 | 508 | |
509 | - if( $new_post && ! is_wp_error( $new_post ) ) { |
|
509 | + if ($new_post && ! is_wp_error($new_post)) { |
|
510 | 510 | |
511 | - if( 'lesson' == $new_post->post_type ) { |
|
512 | - $this->duplicate_lesson_quizzes( $post_id, $new_post->ID ); |
|
511 | + if ('lesson' == $new_post->post_type) { |
|
512 | + $this->duplicate_lesson_quizzes($post_id, $new_post->ID); |
|
513 | 513 | } |
514 | 514 | |
515 | - if( 'course' == $new_post->post_type && $with_lessons ) { |
|
516 | - $this->duplicate_course_lessons( $post_id, $new_post->ID ); |
|
515 | + if ('course' == $new_post->post_type && $with_lessons) { |
|
516 | + $this->duplicate_course_lessons($post_id, $new_post->ID); |
|
517 | 517 | } |
518 | 518 | |
519 | - $redirect_url = admin_url( 'post.php?post=' . $new_post->ID . '&action=edit' ); |
|
519 | + $redirect_url = admin_url('post.php?post='.$new_post->ID.'&action=edit'); |
|
520 | 520 | } else { |
521 | - $redirect_url = admin_url( 'edit.php?post_type=' . $post->post_type . '&message=duplicate_failed' ); |
|
521 | + $redirect_url = admin_url('edit.php?post_type='.$post->post_type.'&message=duplicate_failed'); |
|
522 | 522 | } |
523 | 523 | |
524 | - wp_safe_redirect( esc_url_raw( $redirect_url ) ); |
|
524 | + wp_safe_redirect(esc_url_raw($redirect_url)); |
|
525 | 525 | exit; |
526 | 526 | } |
527 | 527 | } |
@@ -532,19 +532,19 @@ discard block |
||
532 | 532 | * @param integer $new_lesson_id ID of duplicate lesson |
533 | 533 | * @return void |
534 | 534 | */ |
535 | - private function duplicate_lesson_quizzes( $old_lesson_id, $new_lesson_id ) { |
|
535 | + private function duplicate_lesson_quizzes($old_lesson_id, $new_lesson_id) { |
|
536 | 536 | |
537 | - $old_quiz_id = Sensei()->lesson->lesson_quizzes( $old_lesson_id ); |
|
538 | - $old_quiz_questions = Sensei()->lesson->lesson_quiz_questions( $old_quiz_id ); |
|
537 | + $old_quiz_id = Sensei()->lesson->lesson_quizzes($old_lesson_id); |
|
538 | + $old_quiz_questions = Sensei()->lesson->lesson_quiz_questions($old_quiz_id); |
|
539 | 539 | |
540 | 540 | // duplicate the generic wp post information |
541 | - $new_quiz = $this->duplicate_post( get_post( $old_quiz_id ), '' ); |
|
541 | + $new_quiz = $this->duplicate_post(get_post($old_quiz_id), ''); |
|
542 | 542 | |
543 | 543 | //update the new lesson data |
544 | - add_post_meta( $new_lesson_id, '_lesson_quiz', $new_quiz->ID ); |
|
544 | + add_post_meta($new_lesson_id, '_lesson_quiz', $new_quiz->ID); |
|
545 | 545 | |
546 | 546 | //update the new quiz data |
547 | - add_post_meta( $new_quiz->ID, '_quiz_lesson', $new_lesson_id ); |
|
547 | + add_post_meta($new_quiz->ID, '_quiz_lesson', $new_lesson_id); |
|
548 | 548 | wp_update_post( |
549 | 549 | array( |
550 | 550 | 'ID' => $new_quiz->ID, |
@@ -552,15 +552,15 @@ discard block |
||
552 | 552 | ) |
553 | 553 | ); |
554 | 554 | |
555 | - foreach( $old_quiz_questions as $question ) { |
|
555 | + foreach ($old_quiz_questions as $question) { |
|
556 | 556 | |
557 | 557 | // copy the question order over to the new quiz |
558 | - $old_question_order = get_post_meta( $question->ID, '_quiz_question_order'. $old_quiz_id, true ); |
|
559 | - $new_question_order = str_ireplace( $old_quiz_id, $new_quiz->ID , $old_question_order ); |
|
560 | - add_post_meta( $question->ID, '_quiz_question_order' . $new_quiz->ID, $new_question_order ); |
|
558 | + $old_question_order = get_post_meta($question->ID, '_quiz_question_order'.$old_quiz_id, true); |
|
559 | + $new_question_order = str_ireplace($old_quiz_id, $new_quiz->ID, $old_question_order); |
|
560 | + add_post_meta($question->ID, '_quiz_question_order'.$new_quiz->ID, $new_question_order); |
|
561 | 561 | |
562 | 562 | // Add question to quiz |
563 | - add_post_meta( $question->ID, '_quiz_id', $new_quiz->ID, false ); |
|
563 | + add_post_meta($question->ID, '_quiz_id', $new_quiz->ID, false); |
|
564 | 564 | |
565 | 565 | } |
566 | 566 | } |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | * @param integer $new_course_id ID of duplicated course |
572 | 572 | * @return void |
573 | 573 | */ |
574 | - private function duplicate_course_lessons( $old_course_id, $new_course_id ) { |
|
574 | + private function duplicate_course_lessons($old_course_id, $new_course_id) { |
|
575 | 575 | $lesson_args = array( |
576 | 576 | 'post_type' => 'lesson', |
577 | 577 | 'posts_per_page' => -1, |
@@ -579,13 +579,13 @@ discard block |
||
579 | 579 | 'meta_value' => $old_course_id, |
580 | 580 | 'suppress_filters' => 0 |
581 | 581 | ); |
582 | - $lessons = get_posts( $lesson_args ); |
|
582 | + $lessons = get_posts($lesson_args); |
|
583 | 583 | |
584 | - foreach( $lessons as $lesson ) { |
|
585 | - $new_lesson = $this->duplicate_post( $lesson, '', true ); |
|
586 | - add_post_meta( $new_lesson->ID, '_lesson_course', $new_course_id ); |
|
584 | + foreach ($lessons as $lesson) { |
|
585 | + $new_lesson = $this->duplicate_post($lesson, '', true); |
|
586 | + add_post_meta($new_lesson->ID, '_lesson_course', $new_course_id); |
|
587 | 587 | |
588 | - $this->duplicate_lesson_quizzes( $lesson->ID, $new_lesson->ID ); |
|
588 | + $this->duplicate_lesson_quizzes($lesson->ID, $new_lesson->ID); |
|
589 | 589 | } |
590 | 590 | } |
591 | 591 | |
@@ -596,24 +596,24 @@ discard block |
||
596 | 596 | * @param boolean $ignore_course Ignore lesson course when dulicating |
597 | 597 | * @return object Duplicate post object |
598 | 598 | */ |
599 | - private function duplicate_post( $post, $suffix = ' (Duplicate)', $ignore_course = false ) { |
|
599 | + private function duplicate_post($post, $suffix = ' (Duplicate)', $ignore_course = false) { |
|
600 | 600 | |
601 | 601 | $new_post = array(); |
602 | 602 | |
603 | - foreach( $post as $k => $v ) { |
|
604 | - if( ! in_array( $k, array( 'ID', 'post_status', 'post_date', 'post_date_gmt', 'post_name', 'post_modified', 'post_modified_gmt', 'guid', 'comment_count' ) ) ) { |
|
605 | - $new_post[ $k ] = $v; |
|
603 | + foreach ($post as $k => $v) { |
|
604 | + if ( ! in_array($k, array('ID', 'post_status', 'post_date', 'post_date_gmt', 'post_name', 'post_modified', 'post_modified_gmt', 'guid', 'comment_count'))) { |
|
605 | + $new_post[$k] = $v; |
|
606 | 606 | } |
607 | 607 | } |
608 | 608 | |
609 | - $new_post['post_title'] .= __( $suffix, 'woothemes-sensei' ); |
|
609 | + $new_post['post_title'] .= __($suffix, 'woothemes-sensei'); |
|
610 | 610 | |
611 | - $new_post['post_date'] = current_time( 'mysql' ); |
|
612 | - $new_post['post_date_gmt'] = get_gmt_from_date( $new_post['post_date'] ); |
|
611 | + $new_post['post_date'] = current_time('mysql'); |
|
612 | + $new_post['post_date_gmt'] = get_gmt_from_date($new_post['post_date']); |
|
613 | 613 | $new_post['post_modified'] = $new_post['post_date']; |
614 | 614 | $new_post['post_modified_gmt'] = $new_post['post_date_gmt']; |
615 | 615 | |
616 | - switch( $post->post_type ) { |
|
616 | + switch ($post->post_type) { |
|
617 | 617 | case 'course': $new_post['post_status'] = 'draft'; break; |
618 | 618 | case 'lesson': $new_post['post_status'] = 'draft'; break; |
619 | 619 | case 'quiz': $new_post['post_status'] = 'publish'; break; |
@@ -621,45 +621,45 @@ discard block |
||
621 | 621 | } |
622 | 622 | |
623 | 623 | // As per wp_update_post() we need to escape the data from the db. |
624 | - $new_post = wp_slash( $new_post ); |
|
624 | + $new_post = wp_slash($new_post); |
|
625 | 625 | |
626 | - $new_post_id = wp_insert_post( $new_post ); |
|
626 | + $new_post_id = wp_insert_post($new_post); |
|
627 | 627 | |
628 | - if( ! is_wp_error( $new_post_id ) ) { |
|
628 | + if ( ! is_wp_error($new_post_id)) { |
|
629 | 629 | |
630 | - $post_meta = get_post_custom( $post->ID ); |
|
631 | - if( $post_meta && count( $post_meta ) > 0 ) { |
|
630 | + $post_meta = get_post_custom($post->ID); |
|
631 | + if ($post_meta && count($post_meta) > 0) { |
|
632 | 632 | |
633 | - $ignore_meta = array( '_quiz_lesson', '_quiz_id', '_lesson_quiz' ); |
|
633 | + $ignore_meta = array('_quiz_lesson', '_quiz_id', '_lesson_quiz'); |
|
634 | 634 | |
635 | - if( $ignore_course ) { |
|
635 | + if ($ignore_course) { |
|
636 | 636 | $ignore_meta[] = '_lesson_course'; |
637 | 637 | } |
638 | 638 | |
639 | - foreach( $post_meta as $key => $meta ) { |
|
640 | - foreach( $meta as $value ) { |
|
641 | - $value = maybe_unserialize( $value ); |
|
642 | - if( ! in_array( $key, $ignore_meta ) ) { |
|
643 | - add_post_meta( $new_post_id, $key, $value ); |
|
639 | + foreach ($post_meta as $key => $meta) { |
|
640 | + foreach ($meta as $value) { |
|
641 | + $value = maybe_unserialize($value); |
|
642 | + if ( ! in_array($key, $ignore_meta)) { |
|
643 | + add_post_meta($new_post_id, $key, $value); |
|
644 | 644 | } |
645 | 645 | } |
646 | 646 | } |
647 | 647 | } |
648 | 648 | |
649 | - add_post_meta( $new_post_id, '_duplicate', $post->ID ); |
|
649 | + add_post_meta($new_post_id, '_duplicate', $post->ID); |
|
650 | 650 | |
651 | - $taxonomies = get_object_taxonomies( $post->post_type, 'objects' ); |
|
651 | + $taxonomies = get_object_taxonomies($post->post_type, 'objects'); |
|
652 | 652 | |
653 | - foreach ( $taxonomies as $slug => $tax ) { |
|
654 | - $terms = get_the_terms( $post->ID, $slug ); |
|
655 | - if( isset( $terms ) && is_array( $terms ) && 0 < count( $terms ) ) { |
|
656 | - foreach( $terms as $term ) { |
|
657 | - wp_set_object_terms( $new_post_id, $term->term_id, $slug, true ); |
|
653 | + foreach ($taxonomies as $slug => $tax) { |
|
654 | + $terms = get_the_terms($post->ID, $slug); |
|
655 | + if (isset($terms) && is_array($terms) && 0 < count($terms)) { |
|
656 | + foreach ($terms as $term) { |
|
657 | + wp_set_object_terms($new_post_id, $term->term_id, $slug, true); |
|
658 | 658 | } |
659 | 659 | } |
660 | 660 | } |
661 | 661 | |
662 | - $new_post = get_post( $new_post_id ); |
|
662 | + $new_post = get_post($new_post_id); |
|
663 | 663 | |
664 | 664 | return $new_post; |
665 | 665 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | public function lesson_filter_options() { |
675 | 675 | global $typenow; |
676 | 676 | |
677 | - if( is_admin() && 'lesson' == $typenow ) { |
|
677 | + if (is_admin() && 'lesson' == $typenow) { |
|
678 | 678 | |
679 | 679 | $args = array( |
680 | 680 | 'post_type' => 'course', |
@@ -684,16 +684,16 @@ discard block |
||
684 | 684 | 'orderby' => 'menu_order date', |
685 | 685 | 'order' => 'ASC', |
686 | 686 | ); |
687 | - $courses = get_posts( $args ); |
|
687 | + $courses = get_posts($args); |
|
688 | 688 | |
689 | - $selected = isset( $_GET['lesson_course'] ) ? $_GET['lesson_course'] : ''; |
|
689 | + $selected = isset($_GET['lesson_course']) ? $_GET['lesson_course'] : ''; |
|
690 | 690 | $course_options = ''; |
691 | - foreach( $courses as $course ) { |
|
692 | - $course_options .= '<option value="' . esc_attr( $course->ID ) . '" ' . selected( $selected, $course->ID, false ) . '>' . get_the_title( $course->ID ) . '</option>'; |
|
691 | + foreach ($courses as $course) { |
|
692 | + $course_options .= '<option value="'.esc_attr($course->ID).'" '.selected($selected, $course->ID, false).'>'.get_the_title($course->ID).'</option>'; |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | $output = '<select name="lesson_course" id="dropdown_lesson_course">'; |
696 | - $output .= '<option value="">'.__( 'Show all courses', 'woothemes-sensei' ).'</option>'; |
|
696 | + $output .= '<option value="">'.__('Show all courses', 'woothemes-sensei').'</option>'; |
|
697 | 697 | $output .= $course_options; |
698 | 698 | $output .= '</select>'; |
699 | 699 | |
@@ -706,13 +706,13 @@ discard block |
||
706 | 706 | * @param array $request Current request |
707 | 707 | * @return array Modified request |
708 | 708 | */ |
709 | - public function lesson_filter_actions( $request ) { |
|
709 | + public function lesson_filter_actions($request) { |
|
710 | 710 | global $typenow; |
711 | 711 | |
712 | - if( is_admin() && 'lesson' == $typenow ) { |
|
713 | - $lesson_course = isset( $_GET['lesson_course'] ) ? $_GET['lesson_course'] : ''; |
|
712 | + if (is_admin() && 'lesson' == $typenow) { |
|
713 | + $lesson_course = isset($_GET['lesson_course']) ? $_GET['lesson_course'] : ''; |
|
714 | 714 | |
715 | - if( $lesson_course ) { |
|
715 | + if ($lesson_course) { |
|
716 | 716 | $request['meta_key'] = '_lesson_course'; |
717 | 717 | $request['meta_value'] = $lesson_course; |
718 | 718 | $request['meta_compare'] = '='; |
@@ -727,27 +727,27 @@ discard block |
||
727 | 727 | * @param array $items Existing items |
728 | 728 | * @return array Updated items |
729 | 729 | */ |
730 | - public function glance_items( $items = array() ) { |
|
730 | + public function glance_items($items = array()) { |
|
731 | 731 | |
732 | - $types = array( 'course', 'lesson', 'question' ); |
|
732 | + $types = array('course', 'lesson', 'question'); |
|
733 | 733 | |
734 | - foreach( $types as $type ) { |
|
735 | - if( ! post_type_exists( $type ) ) continue; |
|
734 | + foreach ($types as $type) { |
|
735 | + if ( ! post_type_exists($type)) continue; |
|
736 | 736 | |
737 | - $num_posts = wp_count_posts( $type ); |
|
737 | + $num_posts = wp_count_posts($type); |
|
738 | 738 | |
739 | - if( $num_posts ) { |
|
739 | + if ($num_posts) { |
|
740 | 740 | |
741 | - $published = intval( $num_posts->publish ); |
|
742 | - $post_type = get_post_type_object( $type ); |
|
741 | + $published = intval($num_posts->publish); |
|
742 | + $post_type = get_post_type_object($type); |
|
743 | 743 | |
744 | - $text = _n( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $published, 'woothemes-sensei' ); |
|
745 | - $text = sprintf( $text, number_format_i18n( $published ) ); |
|
744 | + $text = _n('%s '.$post_type->labels->singular_name, '%s '.$post_type->labels->name, $published, 'woothemes-sensei'); |
|
745 | + $text = sprintf($text, number_format_i18n($published)); |
|
746 | 746 | |
747 | - if ( current_user_can( $post_type->cap->edit_posts ) ) { |
|
748 | - $items[] = sprintf( '<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $type, $text ) . "\n"; |
|
747 | + if (current_user_can($post_type->cap->edit_posts)) { |
|
748 | + $items[] = sprintf('<a class="%1$s-count" href="edit.php?post_type=%1$s">%2$s</a>', $type, $text)."\n"; |
|
749 | 749 | } else { |
750 | - $items[] = sprintf( '<span class="%1$s-count">%2$s</span>', $type, $text ) . "\n"; |
|
750 | + $items[] = sprintf('<span class="%1$s-count">%2$s</span>', $type, $text)."\n"; |
|
751 | 751 | } |
752 | 752 | } |
753 | 753 | } |
@@ -761,13 +761,13 @@ discard block |
||
761 | 761 | * @param object $post Post object |
762 | 762 | * @return void |
763 | 763 | */ |
764 | - public function delete_content( $post_id, $post ) { |
|
764 | + public function delete_content($post_id, $post) { |
|
765 | 765 | |
766 | 766 | $type = $post->post_type; |
767 | 767 | |
768 | - if( in_array( $type, array( 'lesson', 'course' ) ) ) { |
|
768 | + if (in_array($type, array('lesson', 'course'))) { |
|
769 | 769 | |
770 | - $meta_key = '_' . $type . '_prerequisite'; |
|
770 | + $meta_key = '_'.$type.'_prerequisite'; |
|
771 | 771 | |
772 | 772 | $args = array( |
773 | 773 | 'post_type' => $type, |
@@ -777,10 +777,10 @@ discard block |
||
777 | 777 | 'meta_value' => $post_id |
778 | 778 | ); |
779 | 779 | |
780 | - $posts = get_posts( $args ); |
|
780 | + $posts = get_posts($args); |
|
781 | 781 | |
782 | - foreach( $posts as $post ) { |
|
783 | - delete_post_meta( $post->ID, $meta_key ); |
|
782 | + foreach ($posts as $post) { |
|
783 | + delete_post_meta($post->ID, $meta_key); |
|
784 | 784 | } |
785 | 785 | } |
786 | 786 | } |
@@ -790,181 +790,181 @@ discard block |
||
790 | 790 | * @param integer $user_id User ID |
791 | 791 | * @return void |
792 | 792 | */ |
793 | - public function delete_user_activity( $user_id = 0 ) { |
|
794 | - if( $user_id ) { |
|
795 | - Sensei_Utils::delete_all_user_activity( $user_id ); |
|
793 | + public function delete_user_activity($user_id = 0) { |
|
794 | + if ($user_id) { |
|
795 | + Sensei_Utils::delete_all_user_activity($user_id); |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | |
799 | - public function render_settings( $settings = array(), $post_id = 0, $group_id = '' ) { |
|
799 | + public function render_settings($settings = array(), $post_id = 0, $group_id = '') { |
|
800 | 800 | |
801 | 801 | $html = ''; |
802 | 802 | |
803 | - if( 0 == count( $settings ) ) return $html; |
|
803 | + if (0 == count($settings)) return $html; |
|
804 | 804 | |
805 | - $html .= '<div class="sensei-options-panel">' . "\n"; |
|
805 | + $html .= '<div class="sensei-options-panel">'."\n"; |
|
806 | 806 | |
807 | - $html .= '<div class="options_group" id="' . esc_attr( $group_id ) . '">' . "\n"; |
|
807 | + $html .= '<div class="options_group" id="'.esc_attr($group_id).'">'."\n"; |
|
808 | 808 | |
809 | - foreach( $settings as $field ) { |
|
809 | + foreach ($settings as $field) { |
|
810 | 810 | |
811 | 811 | $data = ''; |
812 | 812 | |
813 | - if( $post_id ) { |
|
814 | - $data = get_post_meta( $post_id, '_' . $field['id'], true ); |
|
815 | - if( ! $data && isset( $field['default'] ) ) { |
|
813 | + if ($post_id) { |
|
814 | + $data = get_post_meta($post_id, '_'.$field['id'], true); |
|
815 | + if ( ! $data && isset($field['default'])) { |
|
816 | 816 | $data = $field['default']; |
817 | 817 | } |
818 | 818 | } else { |
819 | - $option = get_option( $field['id'] ); |
|
820 | - if( isset( $field['default'] ) ) { |
|
819 | + $option = get_option($field['id']); |
|
820 | + if (isset($field['default'])) { |
|
821 | 821 | $data = $field['default']; |
822 | - if( $option ) { |
|
822 | + if ($option) { |
|
823 | 823 | $data = $option; |
824 | 824 | } |
825 | 825 | } |
826 | 826 | } |
827 | 827 | |
828 | 828 | $disabled = ''; |
829 | - if( isset( $field['disabled'] ) && $field['disabled'] ) { |
|
830 | - $disabled = disabled( $field['disabled'], true, false ); |
|
829 | + if (isset($field['disabled']) && $field['disabled']) { |
|
830 | + $disabled = disabled($field['disabled'], true, false); |
|
831 | 831 | } |
832 | 832 | |
833 | - if( 'hidden' != $field['type'] ) { |
|
833 | + if ('hidden' != $field['type']) { |
|
834 | 834 | |
835 | 835 | $class_tail = ''; |
836 | 836 | |
837 | - if( isset( $field['class'] ) ) { |
|
837 | + if (isset($field['class'])) { |
|
838 | 838 | $class_tail .= $field['class']; |
839 | 839 | } |
840 | 840 | |
841 | - if( isset( $field['disabled'] ) && $field['disabled'] ) { |
|
841 | + if (isset($field['disabled']) && $field['disabled']) { |
|
842 | 842 | $class_tail .= ' disabled'; |
843 | 843 | } |
844 | 844 | |
845 | - $html .= '<p class="form-field ' . esc_attr( $field['id'] ) . ' ' . esc_attr( $class_tail ) . '">' . "\n"; |
|
845 | + $html .= '<p class="form-field '.esc_attr($field['id']).' '.esc_attr($class_tail).'">'."\n"; |
|
846 | 846 | } |
847 | 847 | |
848 | - if( ! in_array( $field['type'], array( 'hidden', 'checkbox_multi', 'radio' ) ) ) { |
|
849 | - $html .= '<label for="' . esc_attr( $field['id'] ) . '">' . "\n"; |
|
848 | + if ( ! in_array($field['type'], array('hidden', 'checkbox_multi', 'radio'))) { |
|
849 | + $html .= '<label for="'.esc_attr($field['id']).'">'."\n"; |
|
850 | 850 | } |
851 | 851 | |
852 | - if( $field['label'] ) { |
|
853 | - $html .= '<span class="label">' . esc_html( $field['label'] ) . '</span>'; |
|
852 | + if ($field['label']) { |
|
853 | + $html .= '<span class="label">'.esc_html($field['label']).'</span>'; |
|
854 | 854 | } |
855 | 855 | |
856 | - switch( $field['type'] ) { |
|
856 | + switch ($field['type']) { |
|
857 | 857 | case 'text': |
858 | 858 | case 'password': |
859 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" value="' . $data . '" ' . $disabled . ' />' . "\n"; |
|
859 | + $html .= '<input id="'.esc_attr($field['id']).'" type="'.$field['type'].'" name="'.esc_attr($field['id']).'" placeholder="'.esc_attr($field['placeholder']).'" value="'.$data.'" '.$disabled.' />'."\n"; |
|
860 | 860 | break; |
861 | 861 | |
862 | 862 | case 'number': |
863 | 863 | |
864 | 864 | $min = ''; |
865 | - if( isset( $field['min'] ) ) { |
|
866 | - $min = 'min="' . esc_attr( $field['min'] ) . '"'; |
|
865 | + if (isset($field['min'])) { |
|
866 | + $min = 'min="'.esc_attr($field['min']).'"'; |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | $max = ''; |
870 | - if( isset( $field['max'] ) ) { |
|
871 | - $max = 'max="' . esc_attr( $field['max'] ) . '"'; |
|
870 | + if (isset($field['max'])) { |
|
871 | + $max = 'max="'.esc_attr($field['max']).'"'; |
|
872 | 872 | } |
873 | 873 | |
874 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" value="' . $data . '" ' . $min . ' ' . $max . ' class="small-text" ' . $disabled . ' />' . "\n"; |
|
874 | + $html .= '<input id="'.esc_attr($field['id']).'" type="'.$field['type'].'" name="'.esc_attr($field['id']).'" placeholder="'.esc_attr($field['placeholder']).'" value="'.$data.'" '.$min.' '.$max.' class="small-text" '.$disabled.' />'."\n"; |
|
875 | 875 | break; |
876 | 876 | |
877 | 877 | case 'textarea': |
878 | - $html .= '<textarea id="' . esc_attr( $field['id'] ) . '" rows="5" cols="50" name="' . esc_attr( $field['id'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" ' . $disabled . '>' . $data . '</textarea><br/>'. "\n"; |
|
878 | + $html .= '<textarea id="'.esc_attr($field['id']).'" rows="5" cols="50" name="'.esc_attr($field['id']).'" placeholder="'.esc_attr($field['placeholder']).'" '.$disabled.'>'.$data.'</textarea><br/>'."\n"; |
|
879 | 879 | break; |
880 | 880 | |
881 | 881 | case 'checkbox': |
882 | 882 | //backwards compatibility |
883 | - if( empty( $data ) || 'on' == $data ){ |
|
883 | + if (empty($data) || 'on' == $data) { |
|
884 | 884 | $checked_value = 'on'; |
885 | - }elseif( 'yes' == $data ) { |
|
885 | + }elseif ('yes' == $data) { |
|
886 | 886 | |
887 | 887 | $checked_value = 'yes'; |
888 | 888 | |
889 | - }elseif( 'auto' == $data ) { |
|
889 | + }elseif ('auto' == $data) { |
|
890 | 890 | |
891 | 891 | $checked_value = 'auto'; |
892 | 892 | |
893 | 893 | } else { |
894 | 894 | $checked_value = 1; |
895 | - $data = intval( $data ); |
|
895 | + $data = intval($data); |
|
896 | 896 | } |
897 | - $checked = checked( $checked_value, $data, false ); |
|
898 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" ' . $checked . ' ' . $disabled . '/>' . "\n"; |
|
897 | + $checked = checked($checked_value, $data, false); |
|
898 | + $html .= '<input id="'.esc_attr($field['id']).'" type="'.$field['type'].'" name="'.esc_attr($field['id']).'" '.$checked.' '.$disabled.'/>'."\n"; |
|
899 | 899 | break; |
900 | 900 | |
901 | 901 | case 'checkbox_multi': |
902 | - foreach( $field['options'] as $k => $v ) { |
|
902 | + foreach ($field['options'] as $k => $v) { |
|
903 | 903 | $checked = false; |
904 | - if( in_array( $k, $data ) ) { |
|
904 | + if (in_array($k, $data)) { |
|
905 | 905 | $checked = true; |
906 | 906 | } |
907 | - $html .= '<label for="' . esc_attr( $field['id'] . '_' . $k ) . '"><input type="checkbox" ' . checked( $checked, true, false ) . ' name="' . esc_attr( $field['id'] ) . '[]" value="' . esc_attr( $k ) . '" id="' . esc_attr( $field['id'] . '_' . $k ) . '" ' . $disabled . ' /> ' . $v . '</label> ' . "\n"; |
|
907 | + $html .= '<label for="'.esc_attr($field['id'].'_'.$k).'"><input type="checkbox" '.checked($checked, true, false).' name="'.esc_attr($field['id']).'[]" value="'.esc_attr($k).'" id="'.esc_attr($field['id'].'_'.$k).'" '.$disabled.' /> '.$v.'</label> '."\n"; |
|
908 | 908 | } |
909 | 909 | break; |
910 | 910 | |
911 | 911 | case 'radio': |
912 | - foreach( $field['options'] as $k => $v ) { |
|
912 | + foreach ($field['options'] as $k => $v) { |
|
913 | 913 | $checked = false; |
914 | - if( $k == $data ) { |
|
914 | + if ($k == $data) { |
|
915 | 915 | $checked = true; |
916 | 916 | } |
917 | - $html .= '<label for="' . esc_attr( $field['id'] . '_' . $k ) . '"><input type="radio" ' . checked( $checked, true, false ) . ' name="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $k ) . '" id="' . esc_attr( $field['id'] . '_' . $k ) . '" ' . $disabled . ' /> ' . $v . '</label> ' . "\n"; |
|
917 | + $html .= '<label for="'.esc_attr($field['id'].'_'.$k).'"><input type="radio" '.checked($checked, true, false).' name="'.esc_attr($field['id']).'" value="'.esc_attr($k).'" id="'.esc_attr($field['id'].'_'.$k).'" '.$disabled.' /> '.$v.'</label> '."\n"; |
|
918 | 918 | } |
919 | 919 | break; |
920 | 920 | |
921 | 921 | case 'select': |
922 | - $html .= '<select name="' . esc_attr( $field['id'] ) . '" id="' . esc_attr( $field['id'] ) . '" ' . $disabled . '>' . "\n"; |
|
923 | - foreach( $field['options'] as $k => $v ) { |
|
922 | + $html .= '<select name="'.esc_attr($field['id']).'" id="'.esc_attr($field['id']).'" '.$disabled.'>'."\n"; |
|
923 | + foreach ($field['options'] as $k => $v) { |
|
924 | 924 | $selected = false; |
925 | - if( $k == $data ) { |
|
925 | + if ($k == $data) { |
|
926 | 926 | $selected = true; |
927 | 927 | } |
928 | - $html .= '<option ' . selected( $selected, true, false ) . ' value="' . esc_attr( $k ) . '">' . $v . '</option>' . "\n"; |
|
928 | + $html .= '<option '.selected($selected, true, false).' value="'.esc_attr($k).'">'.$v.'</option>'."\n"; |
|
929 | 929 | } |
930 | - $html .= '</select><br/>' . "\n"; |
|
930 | + $html .= '</select><br/>'."\n"; |
|
931 | 931 | break; |
932 | 932 | |
933 | 933 | case 'select_multi': |
934 | - $html .= '<select name="' . esc_attr( $field['id'] ) . '[]" id="' . esc_attr( $field['id'] ) . '" multiple="multiple" ' . $disabled . '>' . "\n"; |
|
935 | - foreach( $field['options'] as $k => $v ) { |
|
934 | + $html .= '<select name="'.esc_attr($field['id']).'[]" id="'.esc_attr($field['id']).'" multiple="multiple" '.$disabled.'>'."\n"; |
|
935 | + foreach ($field['options'] as $k => $v) { |
|
936 | 936 | $selected = false; |
937 | - if( in_array( $k, $data ) ) { |
|
937 | + if (in_array($k, $data)) { |
|
938 | 938 | $selected = true; |
939 | 939 | } |
940 | - $html .= '<option ' . selected( $selected, true, false ) . ' value="' . esc_attr( $k ) . '" />' . $v . '</option>' . "\n"; |
|
940 | + $html .= '<option '.selected($selected, true, false).' value="'.esc_attr($k).'" />'.$v.'</option>'."\n"; |
|
941 | 941 | } |
942 | 942 | $html .= '</select> . "\n"'; |
943 | 943 | break; |
944 | 944 | |
945 | 945 | case 'hidden': |
946 | - $html .= '<input id="' . esc_attr( $field['id'] ) . '" type="' . $field['type'] . '" name="' . esc_attr( $field['id'] ) . '" value="' . $data . '" ' . $disabled . '/>' . "\n"; |
|
946 | + $html .= '<input id="'.esc_attr($field['id']).'" type="'.$field['type'].'" name="'.esc_attr($field['id']).'" value="'.$data.'" '.$disabled.'/>'."\n"; |
|
947 | 947 | break; |
948 | 948 | |
949 | 949 | } |
950 | 950 | |
951 | - if( $field['description'] ) { |
|
952 | - $html .= ' <span class="description">' . esc_html( $field['description'] ) . '</span>' . "\n"; |
|
951 | + if ($field['description']) { |
|
952 | + $html .= ' <span class="description">'.esc_html($field['description']).'</span>'."\n"; |
|
953 | 953 | } |
954 | 954 | |
955 | - if( ! in_array( $field['type'], array( 'hidden', 'checkbox_multi', 'radio' ) ) ) { |
|
956 | - $html .= '</label>' . "\n"; |
|
955 | + if ( ! in_array($field['type'], array('hidden', 'checkbox_multi', 'radio'))) { |
|
956 | + $html .= '</label>'."\n"; |
|
957 | 957 | } |
958 | 958 | |
959 | - if( 'hidden' != $field['type'] ) { |
|
960 | - $html .= '</p>' . "\n"; |
|
959 | + if ('hidden' != $field['type']) { |
|
960 | + $html .= '</p>'."\n"; |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | } |
964 | 964 | |
965 | - $html .= '</div>' . "\n"; |
|
965 | + $html .= '</div>'."\n"; |
|
966 | 966 | |
967 | - $html .= '</div>' . "\n"; |
|
967 | + $html .= '</div>'."\n"; |
|
968 | 968 | |
969 | 969 | return $html; |
970 | 970 | } |
@@ -975,61 +975,61 @@ discard block |
||
975 | 975 | */ |
976 | 976 | public function course_order_screen() { |
977 | 977 | |
978 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
979 | - wp_enqueue_script( 'woothemes-sensei-settings', esc_url( Sensei()->plugin_url . 'assets/js/settings' . $suffix . '.js' ), array( 'jquery', 'jquery-ui-sortable' ), Sensei()->version ); |
|
978 | + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
979 | + wp_enqueue_script('woothemes-sensei-settings', esc_url(Sensei()->plugin_url.'assets/js/settings'.$suffix.'.js'), array('jquery', 'jquery-ui-sortable'), Sensei()->version); |
|
980 | 980 | |
981 | 981 | ?><div id="course-order" class="wrap course-order"> |
982 | - <h2><?php _e( 'Order Courses', 'woothemes-sensei' ); ?></h2><?php |
|
982 | + <h2><?php _e('Order Courses', 'woothemes-sensei'); ?></h2><?php |
|
983 | 983 | |
984 | 984 | $html = ''; |
985 | 985 | |
986 | - if( isset( $_POST['course-order'] ) && 0 < strlen( $_POST['course-order'] ) ) { |
|
987 | - $ordered = $this->save_course_order( esc_attr( $_POST['course-order'] ) ); |
|
986 | + if (isset($_POST['course-order']) && 0 < strlen($_POST['course-order'])) { |
|
987 | + $ordered = $this->save_course_order(esc_attr($_POST['course-order'])); |
|
988 | 988 | |
989 | - if( $ordered ) { |
|
990 | - $html .= '<div class="updated fade">' . "\n"; |
|
991 | - $html .= '<p>' . __( 'The course order has been saved.', 'woothemes-sensei' ) . '</p>' . "\n"; |
|
992 | - $html .= '</div>' . "\n"; |
|
989 | + if ($ordered) { |
|
990 | + $html .= '<div class="updated fade">'."\n"; |
|
991 | + $html .= '<p>'.__('The course order has been saved.', 'woothemes-sensei').'</p>'."\n"; |
|
992 | + $html .= '</div>'."\n"; |
|
993 | 993 | } |
994 | 994 | } |
995 | 995 | |
996 | 996 | $courses = Sensei()->course->get_all_courses(); |
997 | 997 | |
998 | - if( 0 < count( $courses ) ) { |
|
998 | + if (0 < count($courses)) { |
|
999 | 999 | |
1000 | 1000 | // order the courses as set by the users |
1001 | 1001 | $all_course_ids = array(); |
1002 | - foreach( $courses as $course ){ |
|
1002 | + foreach ($courses as $course) { |
|
1003 | 1003 | |
1004 | - $all_course_ids[] = (string)$course->ID; |
|
1004 | + $all_course_ids[] = (string) $course->ID; |
|
1005 | 1005 | |
1006 | 1006 | } |
1007 | 1007 | $order_string = $this->get_course_order(); |
1008 | 1008 | |
1009 | - if( !empty( $order_string ) ){ |
|
1010 | - $ordered_course_ids = explode(',' , $order_string ); |
|
1011 | - $all_course_ids = array_unique( array_merge( $ordered_course_ids , $all_course_ids ) ); |
|
1009 | + if ( ! empty($order_string)) { |
|
1010 | + $ordered_course_ids = explode(',', $order_string); |
|
1011 | + $all_course_ids = array_unique(array_merge($ordered_course_ids, $all_course_ids)); |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | |
1015 | - $html .= '<form id="editgrouping" method="post" action="" class="validate">' . "\n"; |
|
1016 | - $html .= '<ul class="sortable-course-list">' . "\n"; |
|
1015 | + $html .= '<form id="editgrouping" method="post" action="" class="validate">'."\n"; |
|
1016 | + $html .= '<ul class="sortable-course-list">'."\n"; |
|
1017 | 1017 | $count = 0; |
1018 | - foreach ( $all_course_ids as $course_id ) { |
|
1019 | - $course = get_post( $course_id ); |
|
1018 | + foreach ($all_course_ids as $course_id) { |
|
1019 | + $course = get_post($course_id); |
|
1020 | 1020 | $count++; |
1021 | 1021 | $class = 'course'; |
1022 | - if ( $count == 1 ) { $class .= ' first'; } |
|
1023 | - if ( $count == count( $course ) ) { $class .= ' last'; } |
|
1024 | - if ( $count % 2 != 0 ) { |
|
1022 | + if ($count == 1) { $class .= ' first'; } |
|
1023 | + if ($count == count($course)) { $class .= ' last'; } |
|
1024 | + if ($count % 2 != 0) { |
|
1025 | 1025 | $class .= ' alternate'; |
1026 | 1026 | } |
1027 | - $html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $course->ID ) . '" style="width: 100%;"> ' . $course->post_title . '</span></li>' . "\n"; |
|
1027 | + $html .= '<li class="'.esc_attr($class).'"><span rel="'.esc_attr($course->ID).'" style="width: 100%;"> '.$course->post_title.'</span></li>'."\n"; |
|
1028 | 1028 | } |
1029 | - $html .= '</ul>' . "\n"; |
|
1029 | + $html .= '</ul>'."\n"; |
|
1030 | 1030 | |
1031 | - $html .= '<input type="hidden" name="course-order" value="' . esc_attr( $order_string ) . '" />' . "\n"; |
|
1032 | - $html .= '<input type="submit" class="button-primary" value="' . __( 'Save course order', 'woothemes-sensei' ) . '" />' . "\n"; |
|
1031 | + $html .= '<input type="hidden" name="course-order" value="'.esc_attr($order_string).'" />'."\n"; |
|
1032 | + $html .= '<input type="submit" class="button-primary" value="'.__('Save course order', 'woothemes-sensei').'" />'."\n"; |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | echo $html; |
@@ -1038,25 +1038,25 @@ discard block |
||
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | public function get_course_order() { |
1041 | - return get_option( 'sensei_course_order', '' ); |
|
1041 | + return get_option('sensei_course_order', ''); |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | - public function save_course_order( $order_string = '' ) { |
|
1045 | - $order = explode( ',', $order_string ); |
|
1044 | + public function save_course_order($order_string = '') { |
|
1045 | + $order = explode(',', $order_string); |
|
1046 | 1046 | |
1047 | - update_option( 'sensei_course_order', $order_string ); |
|
1047 | + update_option('sensei_course_order', $order_string); |
|
1048 | 1048 | |
1049 | 1049 | $i = 1; |
1050 | - foreach( $order as $course_id ) { |
|
1050 | + foreach ($order as $course_id) { |
|
1051 | 1051 | |
1052 | - if( $course_id ) { |
|
1052 | + if ($course_id) { |
|
1053 | 1053 | |
1054 | 1054 | $update_args = array( |
1055 | 1055 | 'ID' => $course_id, |
1056 | 1056 | 'menu_order' => $i, |
1057 | 1057 | ); |
1058 | 1058 | |
1059 | - wp_update_post( $update_args ); |
|
1059 | + wp_update_post($update_args); |
|
1060 | 1060 | |
1061 | 1061 | ++$i; |
1062 | 1062 | } |
@@ -1071,22 +1071,22 @@ discard block |
||
1071 | 1071 | */ |
1072 | 1072 | public function lesson_order_screen() { |
1073 | 1073 | |
1074 | - $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
1075 | - wp_enqueue_script( 'woothemes-sensei-settings', esc_url( Sensei()->plugin_url . 'assets/js/settings' . $suffix . '.js' ), array( 'jquery', 'jquery-ui-sortable' ), Sensei()->version ); |
|
1074 | + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; |
|
1075 | + wp_enqueue_script('woothemes-sensei-settings', esc_url(Sensei()->plugin_url.'assets/js/settings'.$suffix.'.js'), array('jquery', 'jquery-ui-sortable'), Sensei()->version); |
|
1076 | 1076 | |
1077 | 1077 | ?><div id="lesson-order" class="wrap lesson-order"> |
1078 | - <h2><?php _e( 'Order Lessons', 'woothemes-sensei' ); ?></h2><?php |
|
1078 | + <h2><?php _e('Order Lessons', 'woothemes-sensei'); ?></h2><?php |
|
1079 | 1079 | |
1080 | 1080 | $html = ''; |
1081 | 1081 | |
1082 | - if( isset( $_POST['lesson-order'] ) ) { |
|
1082 | + if (isset($_POST['lesson-order'])) { |
|
1083 | 1083 | |
1084 | - $ordered = $this->save_lesson_order( esc_attr( $_POST['lesson-order'] ), esc_attr( $_POST['course_id'] ) ); |
|
1084 | + $ordered = $this->save_lesson_order(esc_attr($_POST['lesson-order']), esc_attr($_POST['course_id'])); |
|
1085 | 1085 | |
1086 | - if( $ordered ) { |
|
1087 | - $html .= '<div class="updated fade">' . "\n"; |
|
1088 | - $html .= '<p>' . __( 'The lesson order has been saved.', 'woothemes-sensei' ) . '</p>' . "\n"; |
|
1089 | - $html .= '</div>' . "\n"; |
|
1086 | + if ($ordered) { |
|
1087 | + $html .= '<div class="updated fade">'."\n"; |
|
1088 | + $html .= '<p>'.__('The lesson order has been saved.', 'woothemes-sensei').'</p>'."\n"; |
|
1089 | + $html .= '</div>'."\n"; |
|
1090 | 1090 | } |
1091 | 1091 | } |
1092 | 1092 | |
@@ -1097,43 +1097,43 @@ discard block |
||
1097 | 1097 | 'orderby' => 'name', |
1098 | 1098 | 'order' => 'ASC', |
1099 | 1099 | ); |
1100 | - $courses = get_posts( $args ); |
|
1100 | + $courses = get_posts($args); |
|
1101 | 1101 | |
1102 | - $html .= '<form action="' . admin_url( 'edit.php' ) . '" method="get">' . "\n"; |
|
1103 | - $html .= '<input type="hidden" name="post_type" value="lesson" />' . "\n"; |
|
1104 | - $html .= '<input type="hidden" name="page" value="lesson-order" />' . "\n"; |
|
1105 | - $html .= '<select id="lesson-order-course" name="course_id">' . "\n"; |
|
1106 | - $html .= '<option value="">' . __( 'Select a course', 'woothemes-sensei' ) . '</option>' . "\n"; |
|
1102 | + $html .= '<form action="'.admin_url('edit.php').'" method="get">'."\n"; |
|
1103 | + $html .= '<input type="hidden" name="post_type" value="lesson" />'."\n"; |
|
1104 | + $html .= '<input type="hidden" name="page" value="lesson-order" />'."\n"; |
|
1105 | + $html .= '<select id="lesson-order-course" name="course_id">'."\n"; |
|
1106 | + $html .= '<option value="">'.__('Select a course', 'woothemes-sensei').'</option>'."\n"; |
|
1107 | 1107 | |
1108 | - foreach( $courses as $course ) { |
|
1108 | + foreach ($courses as $course) { |
|
1109 | 1109 | $course_id = ''; |
1110 | - if( isset( $_GET['course_id'] ) ) { |
|
1111 | - $course_id = intval( $_GET['course_id'] ); |
|
1110 | + if (isset($_GET['course_id'])) { |
|
1111 | + $course_id = intval($_GET['course_id']); |
|
1112 | 1112 | } |
1113 | - $html .= '<option value="' . esc_attr( intval( $course->ID ) ) . '" ' . selected( $course->ID, $course_id, false ) .'>' . get_the_title( $course->ID ) . '</option>' . "\n"; |
|
1113 | + $html .= '<option value="'.esc_attr(intval($course->ID)).'" '.selected($course->ID, $course_id, false).'>'.get_the_title($course->ID).'</option>'."\n"; |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | - $html .= '</select>' . "\n"; |
|
1117 | - $html .= '<input type="submit" class="button-primary lesson-order-select-course-submit" value="' . __( 'Select', 'woothemes-sensei' ) . '" />' . "\n"; |
|
1118 | - $html .= '</form>' . "\n"; |
|
1116 | + $html .= '</select>'."\n"; |
|
1117 | + $html .= '<input type="submit" class="button-primary lesson-order-select-course-submit" value="'.__('Select', 'woothemes-sensei').'" />'."\n"; |
|
1118 | + $html .= '</form>'."\n"; |
|
1119 | 1119 | |
1120 | - $html .= '<script type="text/javascript">' . "\n"; |
|
1121 | - $html .= 'jQuery( \'#lesson-order-course\' ).select2({width:"resolve"});' . "\n"; |
|
1122 | - $html .= '</script>' . "\n"; |
|
1120 | + $html .= '<script type="text/javascript">'."\n"; |
|
1121 | + $html .= 'jQuery( \'#lesson-order-course\' ).select2({width:"resolve"});'."\n"; |
|
1122 | + $html .= '</script>'."\n"; |
|
1123 | 1123 | |
1124 | - if( isset( $_GET['course_id'] ) ) { |
|
1125 | - $course_id = intval( $_GET['course_id'] ); |
|
1126 | - if( $course_id > 0 ) { |
|
1124 | + if (isset($_GET['course_id'])) { |
|
1125 | + $course_id = intval($_GET['course_id']); |
|
1126 | + if ($course_id > 0) { |
|
1127 | 1127 | |
1128 | - $order_string = $this->get_lesson_order( $course_id ); |
|
1128 | + $order_string = $this->get_lesson_order($course_id); |
|
1129 | 1129 | |
1130 | - $html .= '<form id="editgrouping" method="post" action="" class="validate">' . "\n"; |
|
1130 | + $html .= '<form id="editgrouping" method="post" action="" class="validate">'."\n"; |
|
1131 | 1131 | |
1132 | 1132 | $displayed_lessons = array(); |
1133 | 1133 | |
1134 | - $modules = Sensei()->modules->get_course_modules( intval( $course_id ) ); |
|
1134 | + $modules = Sensei()->modules->get_course_modules(intval($course_id)); |
|
1135 | 1135 | |
1136 | - foreach( $modules as $module ) { |
|
1136 | + foreach ($modules as $module) { |
|
1137 | 1137 | |
1138 | 1138 | $args = array( |
1139 | 1139 | 'post_type' => 'lesson', |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | 'meta_query' => array( |
1143 | 1143 | array( |
1144 | 1144 | 'key' => '_lesson_course', |
1145 | - 'value' => intval( $course_id ), |
|
1145 | + 'value' => intval($course_id), |
|
1146 | 1146 | 'compare' => '=' |
1147 | 1147 | ) |
1148 | 1148 | ), |
@@ -1150,66 +1150,66 @@ discard block |
||
1150 | 1150 | array( |
1151 | 1151 | 'taxonomy' => Sensei()->modules->taxonomy, |
1152 | 1152 | 'field' => 'id', |
1153 | - 'terms' => intval( $module->term_id ) |
|
1153 | + 'terms' => intval($module->term_id) |
|
1154 | 1154 | ) |
1155 | 1155 | ), |
1156 | - 'meta_key' => '_order_module_' . $module->term_id, |
|
1156 | + 'meta_key' => '_order_module_'.$module->term_id, |
|
1157 | 1157 | 'orderby' => 'meta_value_num date', |
1158 | 1158 | 'order' => 'ASC', |
1159 | 1159 | 'suppress_filters' => 0 |
1160 | 1160 | ); |
1161 | 1161 | |
1162 | - $lessons = get_posts( $args ); |
|
1162 | + $lessons = get_posts($args); |
|
1163 | 1163 | |
1164 | - if( count( $lessons ) > 0 ) { |
|
1165 | - $html .= '<h3>' . $module->name . '</h3>' . "\n"; |
|
1166 | - $html .= '<ul class="sortable-lesson-list" data-module_id="' . $module->term_id . '">' . "\n"; |
|
1164 | + if (count($lessons) > 0) { |
|
1165 | + $html .= '<h3>'.$module->name.'</h3>'."\n"; |
|
1166 | + $html .= '<ul class="sortable-lesson-list" data-module_id="'.$module->term_id.'">'."\n"; |
|
1167 | 1167 | |
1168 | 1168 | $count = 0; |
1169 | - foreach( $lessons as $lesson ) { |
|
1169 | + foreach ($lessons as $lesson) { |
|
1170 | 1170 | $count++; |
1171 | 1171 | $class = 'lesson'; |
1172 | - if ( $count == 1 ) { $class .= ' first'; } |
|
1173 | - if ( $count == count( $lesson ) ) { $class .= ' last'; } |
|
1174 | - if ( $count % 2 != 0 ) { |
|
1172 | + if ($count == 1) { $class .= ' first'; } |
|
1173 | + if ($count == count($lesson)) { $class .= ' last'; } |
|
1174 | + if ($count % 2 != 0) { |
|
1175 | 1175 | $class .= ' alternate'; |
1176 | 1176 | } |
1177 | 1177 | |
1178 | - $html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $lesson->ID ) . '" style="width: 100%;"> ' . $lesson->post_title . '</span></li>' . "\n"; |
|
1178 | + $html .= '<li class="'.esc_attr($class).'"><span rel="'.esc_attr($lesson->ID).'" style="width: 100%;"> '.$lesson->post_title.'</span></li>'."\n"; |
|
1179 | 1179 | |
1180 | 1180 | $displayed_lessons[] = $lesson->ID; |
1181 | 1181 | } |
1182 | 1182 | |
1183 | - $html .= '</ul>' . "\n"; |
|
1183 | + $html .= '</ul>'."\n"; |
|
1184 | 1184 | |
1185 | - $html .= '<input type="hidden" name="lesson-order-module-' . $module->term_id . '" value="" />' . "\n"; |
|
1185 | + $html .= '<input type="hidden" name="lesson-order-module-'.$module->term_id.'" value="" />'."\n"; |
|
1186 | 1186 | } |
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | |
1190 | - $lessons = Sensei()->course->course_lessons( $course_id ); |
|
1190 | + $lessons = Sensei()->course->course_lessons($course_id); |
|
1191 | 1191 | |
1192 | - if( 0 < count( $lessons ) ) { |
|
1192 | + if (0 < count($lessons)) { |
|
1193 | 1193 | |
1194 | 1194 | //get module term ids, will be used to exclude lessons |
1195 | 1195 | $module_items_ids = array(); |
1196 | - if( ! empty( $modules ) ) { |
|
1196 | + if ( ! empty($modules)) { |
|
1197 | 1197 | foreach ($modules as $module) { |
1198 | 1198 | $module_items_ids[] = $module->term_id; |
1199 | 1199 | } |
1200 | 1200 | } |
1201 | 1201 | |
1202 | - if( 0 < count( $displayed_lessons ) ) { |
|
1203 | - $html .= '<h3>' . __( 'Other Lessons', 'woothemes-sensei' ) . '</h3>' . "\n"; |
|
1202 | + if (0 < count($displayed_lessons)) { |
|
1203 | + $html .= '<h3>'.__('Other Lessons', 'woothemes-sensei').'</h3>'."\n"; |
|
1204 | 1204 | } |
1205 | 1205 | |
1206 | - $html .= '<ul class="sortable-lesson-list" data-module_id="0">' . "\n"; |
|
1206 | + $html .= '<ul class="sortable-lesson-list" data-module_id="0">'."\n"; |
|
1207 | 1207 | $count = 0; |
1208 | - foreach ( $lessons as $lesson ) { |
|
1208 | + foreach ($lessons as $lesson) { |
|
1209 | 1209 | |
1210 | 1210 | // if lesson belongs to one fo the course modules then exclude it here |
1211 | 1211 | // as it is listed above |
1212 | - if( has_term( $module_items_ids, 'module', $lesson->ID ) ){ |
|
1212 | + if (has_term($module_items_ids, 'module', $lesson->ID)) { |
|
1213 | 1213 | |
1214 | 1214 | continue; |
1215 | 1215 | |
@@ -1217,28 +1217,28 @@ discard block |
||
1217 | 1217 | |
1218 | 1218 | $count++; |
1219 | 1219 | $class = 'lesson'; |
1220 | - if ( $count == 1 ) { $class .= ' first'; } |
|
1221 | - if ( $count == count( $lesson ) ) { $class .= ' last'; } |
|
1222 | - if ( $count % 2 != 0 ) { |
|
1220 | + if ($count == 1) { $class .= ' first'; } |
|
1221 | + if ($count == count($lesson)) { $class .= ' last'; } |
|
1222 | + if ($count % 2 != 0) { |
|
1223 | 1223 | |
1224 | 1224 | $class .= ' alternate'; |
1225 | 1225 | |
1226 | 1226 | } |
1227 | - $html .= '<li class="' . esc_attr( $class ) . '"><span rel="' . esc_attr( $lesson->ID ) . '" style="width: 100%;"> ' . $lesson->post_title . '</span></li>' . "\n"; |
|
1227 | + $html .= '<li class="'.esc_attr($class).'"><span rel="'.esc_attr($lesson->ID).'" style="width: 100%;"> '.$lesson->post_title.'</span></li>'."\n"; |
|
1228 | 1228 | |
1229 | 1229 | $displayed_lessons[] = $lesson->ID; |
1230 | 1230 | } |
1231 | - $html .= '</ul>' . "\n"; |
|
1231 | + $html .= '</ul>'."\n"; |
|
1232 | 1232 | } else { |
1233 | - if( 0 == count( $displayed_lessons ) ) { |
|
1234 | - $html .= '<p><em>' . __( 'There are no lessons in this course.', 'woothemes-sensei' ) . '</em></p>'; |
|
1233 | + if (0 == count($displayed_lessons)) { |
|
1234 | + $html .= '<p><em>'.__('There are no lessons in this course.', 'woothemes-sensei').'</em></p>'; |
|
1235 | 1235 | } |
1236 | 1236 | } |
1237 | 1237 | |
1238 | - if( 0 < count( $displayed_lessons ) ) { |
|
1239 | - $html .= '<input type="hidden" name="lesson-order" value="' . esc_attr( $order_string ) . '" />' . "\n"; |
|
1240 | - $html .= '<input type="hidden" name="course_id" value="' . $course_id . '" />' . "\n"; |
|
1241 | - $html .= '<input type="submit" class="button-primary" value="' . __( 'Save lesson order', 'woothemes-sensei' ) . '" />' . "\n"; |
|
1238 | + if (0 < count($displayed_lessons)) { |
|
1239 | + $html .= '<input type="hidden" name="lesson-order" value="'.esc_attr($order_string).'" />'."\n"; |
|
1240 | + $html .= '<input type="hidden" name="course_id" value="'.$course_id.'" />'."\n"; |
|
1241 | + $html .= '<input type="submit" class="button-primary" value="'.__('Save lesson order', 'woothemes-sensei').'" />'."\n"; |
|
1242 | 1242 | } |
1243 | 1243 | } |
1244 | 1244 | } |
@@ -1248,29 +1248,29 @@ discard block |
||
1248 | 1248 | ?></div><?php |
1249 | 1249 | } |
1250 | 1250 | |
1251 | - public function get_lesson_order( $course_id = 0 ) { |
|
1252 | - $order_string = get_post_meta( $course_id, '_lesson_order', true ); |
|
1251 | + public function get_lesson_order($course_id = 0) { |
|
1252 | + $order_string = get_post_meta($course_id, '_lesson_order', true); |
|
1253 | 1253 | return $order_string; |
1254 | 1254 | } |
1255 | 1255 | |
1256 | - public function save_lesson_order( $order_string = '', $course_id = 0 ) { |
|
1256 | + public function save_lesson_order($order_string = '', $course_id = 0) { |
|
1257 | 1257 | |
1258 | - if( $course_id ) { |
|
1258 | + if ($course_id) { |
|
1259 | 1259 | |
1260 | - $modules = Sensei()->modules->get_course_modules( intval( $course_id ) ); |
|
1260 | + $modules = Sensei()->modules->get_course_modules(intval($course_id)); |
|
1261 | 1261 | |
1262 | - foreach( $modules as $module ) { |
|
1262 | + foreach ($modules as $module) { |
|
1263 | 1263 | |
1264 | 1264 | |
1265 | - if( isset( $_POST[ 'lesson-order-module-' . $module->term_id ] ) |
|
1266 | - && $_POST[ 'lesson-order-module-' . $module->term_id ] ) { |
|
1265 | + if (isset($_POST['lesson-order-module-'.$module->term_id]) |
|
1266 | + && $_POST['lesson-order-module-'.$module->term_id]) { |
|
1267 | 1267 | |
1268 | - $order = explode( ',', $_POST[ 'lesson-order-module-' . $module->term_id ] ); |
|
1268 | + $order = explode(',', $_POST['lesson-order-module-'.$module->term_id]); |
|
1269 | 1269 | $i = 1; |
1270 | - foreach( $order as $lesson_id ) { |
|
1270 | + foreach ($order as $lesson_id) { |
|
1271 | 1271 | |
1272 | - if( $lesson_id ) { |
|
1273 | - update_post_meta( $lesson_id, '_order_module_' . $module->term_id, $i ); |
|
1272 | + if ($lesson_id) { |
|
1273 | + update_post_meta($lesson_id, '_order_module_'.$module->term_id, $i); |
|
1274 | 1274 | ++$i; |
1275 | 1275 | } |
1276 | 1276 | |
@@ -1281,15 +1281,15 @@ discard block |
||
1281 | 1281 | } // end for each modules |
1282 | 1282 | |
1283 | 1283 | |
1284 | - if( $order_string ) { |
|
1285 | - update_post_meta( $course_id, '_lesson_order', $order_string ); |
|
1284 | + if ($order_string) { |
|
1285 | + update_post_meta($course_id, '_lesson_order', $order_string); |
|
1286 | 1286 | |
1287 | - $order = explode( ',', $order_string ); |
|
1287 | + $order = explode(',', $order_string); |
|
1288 | 1288 | |
1289 | 1289 | $i = 1; |
1290 | - foreach( $order as $lesson_id ) { |
|
1291 | - if( $lesson_id ) { |
|
1292 | - update_post_meta( $lesson_id, '_order_' . $course_id, $i ); |
|
1290 | + foreach ($order as $lesson_id) { |
|
1291 | + if ($lesson_id) { |
|
1292 | + update_post_meta($lesson_id, '_order_'.$course_id, $i); |
|
1293 | 1293 | ++$i; |
1294 | 1294 | } |
1295 | 1295 | } |
@@ -1304,54 +1304,54 @@ discard block |
||
1304 | 1304 | function sensei_add_custom_menu_items() { |
1305 | 1305 | global $pagenow; |
1306 | 1306 | |
1307 | - if( 'nav-menus.php' == $pagenow ) { |
|
1308 | - add_meta_box( 'add-sensei-links', 'Sensei', array( $this, 'wp_nav_menu_item_sensei_links_meta_box' ), 'nav-menus', 'side', 'low' ); |
|
1307 | + if ('nav-menus.php' == $pagenow) { |
|
1308 | + add_meta_box('add-sensei-links', 'Sensei', array($this, 'wp_nav_menu_item_sensei_links_meta_box'), 'nav-menus', 'side', 'low'); |
|
1309 | 1309 | } |
1310 | 1310 | } |
1311 | 1311 | |
1312 | - function wp_nav_menu_item_sensei_links_meta_box( $object ) { |
|
1312 | + function wp_nav_menu_item_sensei_links_meta_box($object) { |
|
1313 | 1313 | global $nav_menu_selected_id; |
1314 | 1314 | |
1315 | 1315 | $menu_items = array( |
1316 | - '#senseicourses' => __( 'Courses', 'woothemes-sensei' ), |
|
1317 | - '#senseilessons' => __( 'Lessons', 'woothemes-sensei' ), |
|
1318 | - '#senseimycourses' => __( 'My Courses', 'woothemes-sensei' ), |
|
1319 | - '#senseilearnerprofile' => __( 'My Profile', 'woothemes-sensei' ), |
|
1320 | - '#senseimymessages' => __( 'My Messages', 'woothemes-sensei' ), |
|
1321 | - '#senseiloginlogout' => __( 'Login', 'woothemes-sensei' ) . '|' . __( 'Logout', 'woothemes-sensei' ) |
|
1316 | + '#senseicourses' => __('Courses', 'woothemes-sensei'), |
|
1317 | + '#senseilessons' => __('Lessons', 'woothemes-sensei'), |
|
1318 | + '#senseimycourses' => __('My Courses', 'woothemes-sensei'), |
|
1319 | + '#senseilearnerprofile' => __('My Profile', 'woothemes-sensei'), |
|
1320 | + '#senseimymessages' => __('My Messages', 'woothemes-sensei'), |
|
1321 | + '#senseiloginlogout' => __('Login', 'woothemes-sensei').'|'.__('Logout', 'woothemes-sensei') |
|
1322 | 1322 | ); |
1323 | 1323 | |
1324 | 1324 | $menu_items_obj = array(); |
1325 | - foreach ( $menu_items as $value => $title ) { |
|
1325 | + foreach ($menu_items as $value => $title) { |
|
1326 | 1326 | $menu_items_obj[$title] = new stdClass; |
1327 | - $menu_items_obj[$title]->object_id = esc_attr( $value ); |
|
1328 | - $menu_items_obj[$title]->title = esc_attr( $title ); |
|
1329 | - $menu_items_obj[$title]->url = esc_attr( $value ); |
|
1330 | - $menu_items_obj[$title]->description = 'description'; |
|
1327 | + $menu_items_obj[$title]->object_id = esc_attr($value); |
|
1328 | + $menu_items_obj[$title]->title = esc_attr($title); |
|
1329 | + $menu_items_obj[$title]->url = esc_attr($value); |
|
1330 | + $menu_items_obj[$title]->description = 'description'; |
|
1331 | 1331 | $menu_items_obj[$title]->db_id = 0; |
1332 | 1332 | $menu_items_obj[$title]->object = 'sensei'; |
1333 | - $menu_items_obj[$title]->menu_item_parent = 0; |
|
1334 | - $menu_items_obj[$title]->type = 'custom'; |
|
1333 | + $menu_items_obj[$title]->menu_item_parent = 0; |
|
1334 | + $menu_items_obj[$title]->type = 'custom'; |
|
1335 | 1335 | $menu_items_obj[$title]->target = ''; |
1336 | - $menu_items_obj[$title]->attr_title = ''; |
|
1337 | - $menu_items_obj[$title]->classes = array(); |
|
1338 | - $menu_items_obj[$title]->xfn = ''; |
|
1336 | + $menu_items_obj[$title]->attr_title = ''; |
|
1337 | + $menu_items_obj[$title]->classes = array(); |
|
1338 | + $menu_items_obj[$title]->xfn = ''; |
|
1339 | 1339 | } |
1340 | 1340 | |
1341 | - $walker = new Walker_Nav_Menu_Checklist( array() ); |
|
1341 | + $walker = new Walker_Nav_Menu_Checklist(array()); |
|
1342 | 1342 | ?> |
1343 | 1343 | |
1344 | 1344 | <div id="sensei-links" class="senseidiv taxonomydiv"> |
1345 | 1345 | <div id="tabs-panel-sensei-links-all" class="tabs-panel tabs-panel-view-all tabs-panel-active"> |
1346 | 1346 | |
1347 | 1347 | <ul id="sensei-linkschecklist" class="list:sensei-links categorychecklist form-no-clear"> |
1348 | - <?php echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $menu_items_obj ), 0, (object)array( 'walker' => $walker ) ); ?> |
|
1348 | + <?php echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $menu_items_obj), 0, (object) array('walker' => $walker)); ?> |
|
1349 | 1349 | </ul> |
1350 | 1350 | |
1351 | 1351 | </div> |
1352 | 1352 | <p class="button-controls"> |
1353 | 1353 | <span class="add-to-menu"> |
1354 | - <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu', 'woothemes-sensei' ); ?>" name="add-sensei-links-menu-item" id="submit-sensei-links" /> |
|
1354 | + <input type="submit"<?php disabled($nav_menu_selected_id, 0); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu', 'woothemes-sensei'); ?>" name="add-sensei-links-menu-item" id="submit-sensei-links" /> |
|
1355 | 1355 | <span class="spinner"></span> |
1356 | 1356 | </span> |
1357 | 1357 | </p> |
@@ -1367,17 +1367,17 @@ discard block |
||
1367 | 1367 | */ |
1368 | 1368 | public function theme_compatibility_notices() { |
1369 | 1369 | |
1370 | - if( isset( $_GET['sensei_hide_notice'] ) ) { |
|
1371 | - switch( esc_attr( $_GET['sensei_hide_notice'] ) ) { |
|
1372 | - case 'menu_settings': add_user_meta( get_current_user_id(), 'sensei_hide_menu_settings_notice', true ); break; |
|
1373 | - case 'theme_check': add_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true ); break; |
|
1370 | + if (isset($_GET['sensei_hide_notice'])) { |
|
1371 | + switch (esc_attr($_GET['sensei_hide_notice'])) { |
|
1372 | + case 'menu_settings': add_user_meta(get_current_user_id(), 'sensei_hide_menu_settings_notice', true); break; |
|
1373 | + case 'theme_check': add_user_meta(get_current_user_id(), 'sensei_hide_theme_check_notice', true); break; |
|
1374 | 1374 | } |
1375 | 1375 | } |
1376 | 1376 | |
1377 | 1377 | // white list templates that are already support by default and do not show notice for them |
1378 | - $template = get_option( 'template' ); |
|
1378 | + $template = get_option('template'); |
|
1379 | 1379 | |
1380 | - $white_list = array( 'twentyeleven', |
|
1380 | + $white_list = array('twentyeleven', |
|
1381 | 1381 | 'twentytwelve', |
1382 | 1382 | 'twentyfourteen', |
1383 | 1383 | 'twentyfifteen', |
@@ -1385,43 +1385,43 @@ discard block |
||
1385 | 1385 | 'storefront', |
1386 | 1386 | ); |
1387 | 1387 | |
1388 | - if ( in_array( $template, $white_list ) ) { |
|
1388 | + if (in_array($template, $white_list)) { |
|
1389 | 1389 | |
1390 | 1390 | return; |
1391 | 1391 | |
1392 | 1392 | } |
1393 | 1393 | |
1394 | 1394 | // don't show the notice if the user chose to hide it |
1395 | - $hide_theme_check_notice = get_user_meta( get_current_user_id(), 'sensei_hide_theme_check_notice', true ); |
|
1396 | - if( $hide_theme_check_notice ) { |
|
1395 | + $hide_theme_check_notice = get_user_meta(get_current_user_id(), 'sensei_hide_theme_check_notice', true); |
|
1396 | + if ($hide_theme_check_notice) { |
|
1397 | 1397 | |
1398 | 1398 | return; |
1399 | 1399 | |
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | // show the notice for themes not supporting sensei |
1403 | - if ( ! current_theme_supports( 'sensei' ) ) { |
|
1403 | + if ( ! current_theme_supports('sensei')) { |
|
1404 | 1404 | ?> |
1405 | 1405 | |
1406 | 1406 | <div id="message" class="error sensei-message sensei-connect"> |
1407 | 1407 | <p> |
1408 | 1408 | <strong> |
1409 | 1409 | |
1410 | - <?php _e('Your theme does not declare Sensei support', 'woothemes-sensei' ); ?> |
|
1410 | + <?php _e('Your theme does not declare Sensei support', 'woothemes-sensei'); ?> |
|
1411 | 1411 | |
1412 | 1412 | </strong> – |
1413 | 1413 | |
1414 | - <?php _e( 'if you encounter layout issues please read our integration guide or choose a ', 'woothemes-sensei' ); ?> |
|
1414 | + <?php _e('if you encounter layout issues please read our integration guide or choose a ', 'woothemes-sensei'); ?> |
|
1415 | 1415 | |
1416 | - <a href="http://www.woothemes.com/product-category/themes/sensei-themes/"> <?php _e( 'Sensei theme', 'woothemes-sensei' ) ?> </a> |
|
1416 | + <a href="http://www.woothemes.com/product-category/themes/sensei-themes/"> <?php _e('Sensei theme', 'woothemes-sensei') ?> </a> |
|
1417 | 1417 | |
1418 | 1418 | :) |
1419 | 1419 | |
1420 | 1420 | </p> |
1421 | 1421 | <p class="submit"> |
1422 | - <a href="<?php echo esc_url( apply_filters( 'sensei_docs_url', 'http://docs.woothemes.com/document/sensei-and-theme-compatibility/', 'theme-compatibility' ) ); ?>" class="button-primary"> |
|
1422 | + <a href="<?php echo esc_url(apply_filters('sensei_docs_url', 'http://docs.woothemes.com/document/sensei-and-theme-compatibility/', 'theme-compatibility')); ?>" class="button-primary"> |
|
1423 | 1423 | |
1424 | - <?php _e( 'Theme Integration Guide', 'woothemes-sensei' ); ?></a> <a class="skip button" href="<?php echo esc_url( add_query_arg( 'sensei_hide_notice', 'theme_check' ) ); ?>"><?php _e( 'Hide this notice', 'woothemes-sensei' ); ?> |
|
1424 | + <?php _e('Theme Integration Guide', 'woothemes-sensei'); ?></a> <a class="skip button" href="<?php echo esc_url(add_query_arg('sensei_hide_notice', 'theme_check')); ?>"><?php _e('Hide this notice', 'woothemes-sensei'); ?> |
|
1425 | 1425 | |
1426 | 1426 | </a> |
1427 | 1427 | </p> |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | wp_get_current_user(); |
1440 | 1440 | $user_id = $current_user->ID; |
1441 | 1441 | |
1442 | - delete_user_meta( $user_id, 'sensei_hide_theme_check_notice' ); |
|
1442 | + delete_user_meta($user_id, 'sensei_hide_theme_check_notice'); |
|
1443 | 1443 | } |
1444 | 1444 | |
1445 | 1445 | /** |
@@ -1449,8 +1449,8 @@ discard block |
||
1449 | 1449 | * @param bool $prevent_access |
1450 | 1450 | * @return bool |
1451 | 1451 | */ |
1452 | - public function admin_access( $prevent_access ) { |
|
1453 | - if ( current_user_can( 'manage_sensei_grades' ) ) { |
|
1452 | + public function admin_access($prevent_access) { |
|
1453 | + if (current_user_can('manage_sensei_grades')) { |
|
1454 | 1454 | return false; |
1455 | 1455 | } |
1456 | 1456 | |
@@ -1465,12 +1465,12 @@ discard block |
||
1465 | 1465 | * |
1466 | 1466 | * @since 1.8.7 |
1467 | 1467 | */ |
1468 | - public static function install_pages(){ |
|
1468 | + public static function install_pages() { |
|
1469 | 1469 | |
1470 | 1470 | // only fire on the settings page |
1471 | - if( ! isset( $_GET['page'] ) |
|
1471 | + if ( ! isset($_GET['page']) |
|
1472 | 1472 | || 'woothemes-sensei-settings' != $_GET['page'] |
1473 | - || 1 == get_option('skip_install_sensei_pages') ){ |
|
1473 | + || 1 == get_option('skip_install_sensei_pages')) { |
|
1474 | 1474 | |
1475 | 1475 | return; |
1476 | 1476 | |
@@ -1507,8 +1507,8 @@ discard block |
||
1507 | 1507 | // Set installed option |
1508 | 1508 | update_option('sensei_installed', 0); |
1509 | 1509 | |
1510 | - $complete_url = add_query_arg( 'sensei_install_complete', 'true', $settings_url ); |
|
1511 | - wp_redirect( $complete_url ); |
|
1510 | + $complete_url = add_query_arg('sensei_install_complete', 'true', $settings_url); |
|
1511 | + wp_redirect($complete_url); |
|
1512 | 1512 | |
1513 | 1513 | } |
1514 | 1514 | |
@@ -1522,4 +1522,4 @@ discard block |
||
1522 | 1522 | * @since 1.9.0 |
1523 | 1523 | * @ignore |
1524 | 1524 | */ |
1525 | -class WooThemes_Sensei_Admin extends Sensei_Admin{ } |
|
1525 | +class WooThemes_Sensei_Admin extends Sensei_Admin { } |
@@ -1,5 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
5 | +// Exit if accessed directly |
|
3 | 6 | |
4 | 7 | /** |
5 | 8 | * Handles all admin views, assets and navigation. |
@@ -732,7 +735,9 @@ discard block |
||
732 | 735 | $types = array( 'course', 'lesson', 'question' ); |
733 | 736 | |
734 | 737 | foreach( $types as $type ) { |
735 | - if( ! post_type_exists( $type ) ) continue; |
|
738 | + if( ! post_type_exists( $type ) ) { |
|
739 | + continue; |
|
740 | + } |
|
736 | 741 | |
737 | 742 | $num_posts = wp_count_posts( $type ); |
738 | 743 | |
@@ -800,7 +805,9 @@ discard block |
||
800 | 805 | |
801 | 806 | $html = ''; |
802 | 807 | |
803 | - if( 0 == count( $settings ) ) return $html; |
|
808 | + if( 0 == count( $settings ) ) { |
|
809 | + return $html; |
|
810 | + } |
|
804 | 811 | |
805 | 812 | $html .= '<div class="sensei-options-panel">' . "\n"; |
806 | 813 | |
@@ -882,11 +889,11 @@ discard block |
||
882 | 889 | //backwards compatibility |
883 | 890 | if( empty( $data ) || 'on' == $data ){ |
884 | 891 | $checked_value = 'on'; |
885 | - }elseif( 'yes' == $data ) { |
|
892 | + } elseif( 'yes' == $data ) { |
|
886 | 893 | |
887 | 894 | $checked_value = 'yes'; |
888 | 895 | |
889 | - }elseif( 'auto' == $data ) { |
|
896 | + } elseif( 'auto' == $data ) { |
|
890 | 897 | |
891 | 898 | $checked_value = 'auto'; |
892 | 899 |