Addons.php
7 years ago
Admin.php
7 years ago
Ajax.php
7 years ago
Assets.php
7 years ago
Course.php
7 years ago
Gutenberg.php
7 years ago
Instructor.php
7 years ago
Instructors_List.php
7 years ago
Lesson.php
7 years ago
Options.php
7 years ago
Post_types.php
7 years ago
Q_and_A.php
7 years ago
Question.php
7 years ago
Question_Answers_List.php
7 years ago
Quiz.php
7 years ago
Quiz_Attempts_List.php
7 years ago
Rewrite_Rules.php
7 years ago
Shortcode.php
7 years ago
Student.php
7 years ago
Students_List.php
7 years ago
Template.php
7 years ago
Theme_Compatibility.php
7 years ago
Tools.php
7 years ago
Tutor.php
7 years ago
TutorEDD.php
7 years ago
Tutor_Base.php
7 years ago
Tutor_List_Table.php
7 years ago
User.php
7 years ago
Utils.php
7 years ago
Video_Stream.php
7 years ago
Withdraw.php
7 years ago
Withdraw_Requests_List.php
7 years ago
WooCommerce.php
7 years ago
Admin.php
458 lines
| 1 | <?php |
| 2 | namespace TUTOR; |
| 3 | |
| 4 | /** |
| 5 | * Class Admin |
| 6 | * @package TUTOR |
| 7 | * |
| 8 | * @since v.1.0.0 |
| 9 | */ |
| 10 | |
| 11 | if ( ! defined( 'ABSPATH' ) ) |
| 12 | exit; |
| 13 | |
| 14 | class Admin{ |
| 15 | public function __construct() { |
| 16 | add_action('admin_menu', array($this, 'register_menu')); |
| 17 | //Force activate menu for necessary |
| 18 | add_filter('parent_file', array($this, 'parent_menu_active')); |
| 19 | add_filter('submenu_file', array($this, 'submenu_file_active'), 10, 2); |
| 20 | |
| 21 | add_action('admin_init', array($this, 'filter_posts_for_instructors')); |
| 22 | add_action('load-post.php', array($this, 'check_if_current_users_post') ); |
| 23 | |
| 24 | add_action('admin_action_uninstall_tutor_and_erase', array($this, 'erase_tutor_data')); |
| 25 | add_filter('plugin_action_links_' . plugin_basename(TUTOR_FILE), array( $this, 'plugin_action_links' ) ); |
| 26 | |
| 27 | //Plugin Row Meta |
| 28 | add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2); |
| 29 | |
| 30 | //Admin Footer Text |
| 31 | add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); |
| 32 | } |
| 33 | |
| 34 | public function register_menu(){ |
| 35 | $hasPro = tutor()->has_pro; |
| 36 | |
| 37 | $unanswered_questions = tutor_utils()->unanswered_question_count(); |
| 38 | $unanswered_bubble = ''; |
| 39 | if ($unanswered_questions){ |
| 40 | $unanswered_bubble = '<span class="update-plugins count-'.$unanswered_questions.'"><span class="plugin-count">'.$unanswered_questions.'</span></span>'; |
| 41 | } |
| 42 | |
| 43 | $course_post_type = tutor()->course_post_type; |
| 44 | |
| 45 | add_menu_page(__('Tutor LMS', 'tutor'), __('Tutor LMS', 'tutor'), 'manage_tutor_instructor', 'tutor', null, 'dashicons-welcome-learn-more', 2); |
| 46 | |
| 47 | add_submenu_page('tutor', __('Categories', 'tutor'), __('Categories', 'tutor'), 'manage_tutor', 'edit-tags.php?taxonomy=course-category&post_type='.$course_post_type, null ); |
| 48 | |
| 49 | add_submenu_page('tutor', __('Tags', 'tutor'), __('Tags', 'tutor'), 'manage_tutor', 'edit-tags.php?taxonomy=course-tag&post_type='.$course_post_type, null ); |
| 50 | |
| 51 | add_submenu_page('tutor', __('Students', 'tutor'), __('Students', 'tutor'), 'manage_tutor', 'tutor-students', array($this, 'tutor_students') ); |
| 52 | |
| 53 | add_submenu_page('tutor', __('Instructors', 'tutor'), __('Instructors', 'tutor'), 'manage_tutor', 'tutor-instructors', array($this, 'tutor_instructors') ); |
| 54 | |
| 55 | add_submenu_page('tutor', __('Q & A', 'tutor'), __('Q & A '.$unanswered_bubble, 'tutor'), 'manage_tutor_instructor', 'question_answer', array($this, 'question_answer') ); |
| 56 | |
| 57 | add_submenu_page('tutor', __('Quiz Attempts', 'tutor'), __('Quiz Attempts', 'tutor'), 'manage_tutor_instructor', 'tutor_quiz_attempts',array($this, 'quiz_attempts') ); |
| 58 | add_submenu_page('tutor', __('Withdraw Requests', 'tutor'), __('Withdraw Requests', 'tutor'), 'manage_tutor_instructor', 'tutor_withdraw_requests', array($this, 'withdraw_requests') ); |
| 59 | |
| 60 | //add_submenu_page('tutor', __('Add-ons', 'tutor'), __('Add-ons', 'tutor'), 'manage_tutor', 'tutor-addons', array(new Addons(),'addons_page') ); |
| 61 | |
| 62 | if (defined('TUTOR_PRO_VERSION')) { |
| 63 | add_submenu_page( 'tutor', __( 'Add-ons', 'tutor' ), __( 'Add-ons', 'tutor' ), 'manage_tutor', 'tutor-addons', array( $this, 'enable_disable_addons' ) ); |
| 64 | } |
| 65 | |
| 66 | add_submenu_page('tutor', __('Status', 'tutor'), __('Status', 'tutor'), 'manage_tutor', 'tutor-status', array($this, 'tutor_status') ); |
| 67 | |
| 68 | do_action('tutor_admin_register'); |
| 69 | |
| 70 | add_submenu_page('tutor', __('Settings', 'tutor'), __('Settings', 'tutor'), 'manage_tutor', 'tutor_settings', array($this, 'tutor_page') ); |
| 71 | |
| 72 | add_submenu_page('tutor',__('Uninstall Tutor LMS', 'tutor'), null, 'deactivate_plugin', 'tutor-uninstall', array($this, 'tutor_uninstall')); |
| 73 | /* |
| 74 | if ( ! $hasPro){ |
| 75 | add_submenu_page( 'tutor', __( 'Get Pro', 'tutor' ), __( '<span class="dashicons dashicons-awards tutor-get-pro-text"></span> Get Pro', 'tutor' ), 'manage_options', 'tutor-get-pro', array($this, 'tutor_get_pro') ); |
| 76 | }*/ |
| 77 | |
| 78 | } |
| 79 | |
| 80 | public function tutor_page(){ |
| 81 | $tutor_option = new Options(); |
| 82 | echo apply_filters('tutor/options/generated-html', $tutor_option->generate()); |
| 83 | } |
| 84 | |
| 85 | public function tutor_students(){ |
| 86 | include tutor()->path.'views/pages/students.php'; |
| 87 | } |
| 88 | |
| 89 | public function tutor_instructors(){ |
| 90 | include tutor()->path.'views/pages/instructors.php'; |
| 91 | } |
| 92 | |
| 93 | public function question_answer(){ |
| 94 | include tutor()->path.'views/pages/question_answer.php'; |
| 95 | } |
| 96 | |
| 97 | public function quiz_attempts(){ |
| 98 | include tutor()->path.'views/pages/quiz_attempts.php'; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Show the withdraw requests table |
| 103 | * |
| 104 | * @since v.1.2.0 |
| 105 | */ |
| 106 | public function withdraw_requests(){ |
| 107 | include tutor()->path.'views/pages/withdraw_requests.php'; |
| 108 | } |
| 109 | |
| 110 | public function enable_disable_addons(){ |
| 111 | include tutor()->path.'views/pages/enable_disable_addons.php'; |
| 112 | } |
| 113 | |
| 114 | public function tutor_status(){ |
| 115 | include tutor()->path.'views/pages/status.php'; |
| 116 | } |
| 117 | |
| 118 | public function tutor_uninstall(){ |
| 119 | include tutor()->path.'views/pages/uninstall.php'; |
| 120 | } |
| 121 | |
| 122 | public function tutor_get_pro(){ |
| 123 | include tutor()->path.'views/pages/get-pro.php'; |
| 124 | } |
| 125 | |
| 126 | public function parent_menu_active( $parent_file ){ |
| 127 | $taxonomy = tutor_utils()->avalue_dot('taxonomy', $_GET); |
| 128 | if ($taxonomy === 'course-category' || $taxonomy === 'course-tag'){ |
| 129 | return 'tutor'; |
| 130 | } |
| 131 | |
| 132 | return $parent_file; |
| 133 | } |
| 134 | |
| 135 | public function submenu_file_active($submenu_file, $parent_file){ |
| 136 | $taxonomy = tutor_utils()->avalue_dot('taxonomy', $_GET); |
| 137 | $course_post_type = tutor()->course_post_type; |
| 138 | |
| 139 | if ($taxonomy === 'course-category'){ |
| 140 | return 'edit-tags.php?taxonomy=course-category&post_type='.$course_post_type; |
| 141 | } |
| 142 | if ($taxonomy === 'course-tag'){ |
| 143 | return 'edit-tags.php?taxonomy=course-tag&post_type='.$course_post_type; |
| 144 | } |
| 145 | |
| 146 | |
| 147 | return $submenu_file; |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Filter posts for instructor |
| 152 | */ |
| 153 | public function filter_posts_for_instructors(){ |
| 154 | if ( ! current_user_can('administrator') && current_user_can(tutor()->instructor_role)){ |
| 155 | remove_menu_page( 'edit-comments.php' ); //Comments |
| 156 | add_filter( 'posts_clauses_request', array($this, 'posts_clauses_request') ); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | public function posts_clauses_request($clauses){ |
| 161 | global $wpdb; |
| 162 | |
| 163 | $user_id = get_current_user_id(); |
| 164 | |
| 165 | $get_assigned_courses_ids = $wpdb->get_col("SELECT meta_value from {$wpdb->usermeta} WHERE meta_key = '_tutor_instructor_course_id' AND user_id = {$user_id} "); |
| 166 | |
| 167 | $custom_author_query = "AND {$wpdb->posts}.post_author = {$user_id}"; |
| 168 | if (is_array($get_assigned_courses_ids) && count($get_assigned_courses_ids)){ |
| 169 | $in_query_pre = implode(',', $get_assigned_courses_ids); |
| 170 | $custom_author_query = " AND ( {$wpdb->posts}.post_author = {$user_id} OR {$wpdb->posts}.ID IN({$in_query_pre}) ) "; |
| 171 | } |
| 172 | |
| 173 | $clauses['where'] .= $custom_author_query; |
| 174 | |
| 175 | return $clauses; |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Prevent unauthorised course/lesson edit page by direct URL |
| 180 | * |
| 181 | * @since v.1.0.0 |
| 182 | */ |
| 183 | public function check_if_current_users_post(){ |
| 184 | if (! current_user_can(tutor()->instructor_role)) { |
| 185 | return; |
| 186 | } |
| 187 | |
| 188 | if (! empty($_GET['post']) ) { |
| 189 | $get_post_id = (int) sanitize_text_field($_GET['post']); |
| 190 | $get_post = get_post($get_post_id); |
| 191 | $tutor_post_types = array(tutor()->course_post_type, tutor()->lesson_post_type); |
| 192 | |
| 193 | $current_user = get_current_user_id(); |
| 194 | |
| 195 | if (in_array($get_post->post_type, $tutor_post_types) && $get_post->post_author != $current_user){ |
| 196 | global $wpdb; |
| 197 | |
| 198 | $get_assigned_courses_ids = (int) $wpdb->get_var("SELECT user_id from {$wpdb->usermeta} WHERE user_id = {$current_user} AND meta_key = '_tutor_instructor_course_id' AND meta_value = {$get_post_id} "); |
| 199 | |
| 200 | if ( ! $get_assigned_courses_ids){ |
| 201 | wp_die(__('Permission Denied', 'tutor')); |
| 202 | } |
| 203 | |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * Status |
| 210 | */ |
| 211 | |
| 212 | public static function scan_template_files( $template_path = null ) { |
| 213 | if ( ! $template_path){ |
| 214 | $template_path = tutor()->path.'templates/'; |
| 215 | } |
| 216 | |
| 217 | |
| 218 | $files = @scandir( $template_path ); // @codingStandardsIgnoreLine. |
| 219 | $result = array(); |
| 220 | |
| 221 | if ( ! empty( $files ) ) { |
| 222 | foreach ( $files as $key => $value ) { |
| 223 | if ( ! in_array( $value, array( '.', '..', '.DS_Store' ), true ) ) { |
| 224 | if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) { |
| 225 | $sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value ); |
| 226 | foreach ( $sub_files as $sub_file ) { |
| 227 | $result[] = $value . DIRECTORY_SEPARATOR . $sub_file; |
| 228 | } |
| 229 | } else { |
| 230 | $result[] = $value; |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | return $result; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * @return array |
| 240 | * |
| 241 | * |
| 242 | */ |
| 243 | public static function template_overridden_files(){ |
| 244 | $template_files = self::scan_template_files(); |
| 245 | |
| 246 | $override_files = array(); |
| 247 | foreach ($template_files as $file){ |
| 248 | $file_path = null; |
| 249 | if (file_exists(trailingslashit(get_stylesheet_directory()).tutor()->template_path.$file)){ |
| 250 | $file_path = $file; |
| 251 | }elseif (file_exists(trailingslashit(get_template_directory()).tutor()->template_path.$file)){ |
| 252 | $file_path = $file; |
| 253 | } |
| 254 | |
| 255 | if ($file_path){ |
| 256 | $override_files[] = str_replace( WP_CONTENT_DIR.'/themes/', '', $file_path ); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | return $override_files; |
| 261 | } |
| 262 | |
| 263 | public static function get_environment_info(){ |
| 264 | |
| 265 | // Figure out cURL version, if installed. |
| 266 | $curl_version = ''; |
| 267 | if ( function_exists( 'curl_version' ) ) { |
| 268 | $curl_version = curl_version(); |
| 269 | $curl_version = $curl_version['version'] . ', ' . $curl_version['ssl_version']; |
| 270 | } |
| 271 | |
| 272 | |
| 273 | // WP memory limit. |
| 274 | $wp_memory_limit = tutor_utils()->let_to_num(WP_MEMORY_LIMIT); |
| 275 | if ( function_exists( 'memory_get_usage' ) ) { |
| 276 | $wp_memory_limit = max( $wp_memory_limit, tutor_utils()->let_to_num( @ini_get( 'memory_limit' ) ) ); |
| 277 | } |
| 278 | |
| 279 | $database_version = tutor_utils()->get_db_version(); |
| 280 | |
| 281 | return array( |
| 282 | 'home_url' => get_option( 'home' ), |
| 283 | 'site_url' => get_option( 'siteurl' ), |
| 284 | 'version' => tutor()->version, |
| 285 | 'wp_version' => get_bloginfo( 'version' ), |
| 286 | 'wp_multisite' => is_multisite(), |
| 287 | 'wp_memory_limit' => $wp_memory_limit, |
| 288 | 'wp_debug_mode' => ( defined( 'WP_DEBUG' ) && WP_DEBUG ), |
| 289 | 'wp_cron' => ! ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ), |
| 290 | 'language' => get_locale(), |
| 291 | 'external_object_cache' => wp_using_ext_object_cache(), |
| 292 | 'server_info' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) : '', |
| 293 | 'php_version' => phpversion(), |
| 294 | 'php_post_max_size' => tutor_utils()->let_to_num( ini_get( 'post_max_size' ) ), |
| 295 | 'php_max_execution_time' => ini_get( 'max_execution_time' ), |
| 296 | 'php_max_input_vars' => ini_get( 'max_input_vars' ), |
| 297 | 'curl_version' => $curl_version, |
| 298 | 'suhosin_installed' => extension_loaded( 'suhosin' ), |
| 299 | 'max_upload_size' => wp_max_upload_size(), |
| 300 | 'mysql_version' => $database_version['number'], |
| 301 | 'mysql_version_string' => $database_version['string'], |
| 302 | 'default_timezone' => date_default_timezone_get(), |
| 303 | 'fsockopen_or_curl_enabled' => ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ), |
| 304 | 'soapclient_enabled' => class_exists( 'SoapClient' ), |
| 305 | 'domdocument_enabled' => class_exists( 'DOMDocument' ), |
| 306 | 'gzip_enabled' => is_callable( 'gzopen' ), |
| 307 | 'mbstring_enabled' => extension_loaded( 'mbstring' ), |
| 308 | ); |
| 309 | |
| 310 | } |
| 311 | |
| 312 | |
| 313 | public function erase_tutor_data(){ |
| 314 | global $wpdb; |
| 315 | |
| 316 | $is_erase_data = tutor_utils()->get_option('delete_on_uninstall'); |
| 317 | /**D*/ //=> Deleting Data |
| 318 | |
| 319 | $plugin_file = tutor()->basename; |
| 320 | if ($is_erase_data && current_user_can( 'deactivate_plugin', $plugin_file )) { |
| 321 | /** |
| 322 | * Deleting Post Type, Meta Data, taxonomy |
| 323 | */ |
| 324 | $course_post_type = tutor()->course_post_type; |
| 325 | $lesson_post_type = tutor()->lesson_post_type; |
| 326 | |
| 327 | $post_types = array( |
| 328 | $course_post_type, |
| 329 | $lesson_post_type, |
| 330 | 'tutor_quiz', |
| 331 | 'tutor_question', |
| 332 | 'tutor_enrolled', |
| 333 | 'topics', |
| 334 | 'tutor_enrolled', |
| 335 | 'tutor_announcements', |
| 336 | ); |
| 337 | |
| 338 | $post_type_strings = "'".implode("','", $post_types)."'"; |
| 339 | $tutor_posts = $wpdb->get_col("SELECT ID from {$wpdb->posts} WHERE post_type in({$post_type_strings}) ;"); |
| 340 | |
| 341 | if (is_array($tutor_posts) && count($tutor_posts)){ |
| 342 | foreach ($tutor_posts as $post_id){ |
| 343 | //Delete categories |
| 344 | $terms = wp_get_object_terms( $post_id, 'course-category' ); |
| 345 | foreach( $terms as $term ){ |
| 346 | /**D*/ wp_remove_object_terms( $post_id, array( $term->term_id ), 'course-category' ); |
| 347 | } |
| 348 | |
| 349 | //Delete tags if available |
| 350 | $terms = wp_get_object_terms( $post_id, 'course-tag' ); |
| 351 | foreach( $terms as $term ){ |
| 352 | /**D*/ wp_remove_object_terms( $post_id, array( $term->term_id ), 'course-tag' ); |
| 353 | } |
| 354 | |
| 355 | //Delete All Meta |
| 356 | /**D*/ $wpdb->delete($wpdb->postmeta, array('post_id' => $post_id) ); |
| 357 | /**D*/ $wpdb->delete($wpdb->posts, array('ID' => $post_id) ); |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | /** |
| 362 | * Deleting Comments (reviews, questions, quiz_answers, etc) |
| 363 | */ |
| 364 | $tutor_comments = $wpdb->get_col("SELECT comment_ID from {$wpdb->comments} WHERE comment_agent = 'comment_agent' ;"); |
| 365 | $comments_ids_strings = "'".implode("','", $tutor_comments)."'"; |
| 366 | if (is_array($tutor_comments) && count($tutor_comments)){ |
| 367 | /**D*/ $wpdb->query("DELETE from {$wpdb->commentmeta} WHERE comment_ID in({$comments_ids_strings}) "); |
| 368 | } |
| 369 | /**D*/ $wpdb->delete($wpdb->comments, array('comment_agent' => 'comment_agent')); |
| 370 | |
| 371 | /** |
| 372 | * Delete Options |
| 373 | */ |
| 374 | |
| 375 | /**D*/ delete_option('tutor_option'); |
| 376 | /**D*/ $wpdb->delete($wpdb->usermeta, array('meta_key' => '_is_tutor_student')); |
| 377 | /**D*/ $wpdb->delete($wpdb->usermeta, array('meta_key' => '_tutor_instructor_approved')); |
| 378 | /**D*/ $wpdb->delete($wpdb->usermeta, array('meta_key' => '_tutor_instructor_status')); |
| 379 | /**D*/ $wpdb->delete($wpdb->usermeta, array('meta_key' => '_is_tutor_instructor')); |
| 380 | /**D*/ $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%_tutor_completed_lesson_id_%' "); |
| 381 | |
| 382 | //Deleting Table |
| 383 | $prefix = $wpdb->prefix; |
| 384 | /**D*/ $wpdb->query("DROP TABLE IF EXISTS {$prefix}tutor_quiz_attempts, {$prefix}tutor_quiz_attempt_answers, {$prefix}tutor_quiz_questions, {$prefix}tutor_quiz_question_answers, {$prefix}tutor_earnings, {$prefix}tutor_withdraws "); |
| 385 | |
| 386 | deactivate_plugins($plugin_file); |
| 387 | } |
| 388 | |
| 389 | wp_redirect('plugins.php'); |
| 390 | die(); |
| 391 | } |
| 392 | |
| 393 | public function plugin_action_links($actions){ |
| 394 | /*$hasPro = tutor()->has_pro; |
| 395 | |
| 396 | if(!$hasPro){ |
| 397 | $actions['tutor_pro_link'] = '<a href="https://www.themeum.com/product/tutor-lms/#pricing?utm_source=tutor_plugin_action_link&utm_medium=wordpress_dashboard&utm_campaign=go_premium" target="_blank"><span |
| 398 | style="color: #39a700eb; font-weight: bold;">'.__('Upgrade to Pro', 'wp-megamenu').'</span></a>'; |
| 399 | }*/ |
| 400 | |
| 401 | $is_erase_data = tutor_utils()->get_option('delete_on_uninstall'); |
| 402 | |
| 403 | if ($is_erase_data) { |
| 404 | $plugin_file = tutor()->basename; |
| 405 | if ( current_user_can( 'deactivate_plugin', $plugin_file ) ) { |
| 406 | if ( isset( $actions['deactivate'] ) ) { |
| 407 | $actions['deactivate'] = '<a href="admin.php?page=tutor-uninstall">' . __('Uninstall', 'tutor') . '</a>'; |
| 408 | } |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | $actions['settings'] = '<a href="admin.php?page=tutor_settings">' . __('Settings', 'tutor') . '</a>'; |
| 413 | return $actions; |
| 414 | } |
| 415 | |
| 416 | public function plugin_row_meta($plugin_meta, $plugin_file){ |
| 417 | |
| 418 | if ($plugin_file === tutor()->basename) { |
| 419 | $plugin_meta[] = sprintf( '<a href="%s">%s</a>', |
| 420 | esc_url( 'https://www.themeum.com/docs/tutor-introduction/?utm_source=tutor&utm_medium=plugins_installation_list&utm_campaign=plugin_docs_link' ), |
| 421 | __( '<strong style="color: #03bd24">Documentation</strong>', 'tutor' ) |
| 422 | ); |
| 423 | $plugin_meta[] = sprintf( '<a href="%s">%s</a>', |
| 424 | esc_url( 'https://www.themeum.com/support-forums/?utm_source=tutor&utm_medium=plugins_installation_list&utm_campaign=plugin_support_link' ), |
| 425 | __( '<strong style="color: #03bd24">Get Support</strong>', 'tutor' ) |
| 426 | ); |
| 427 | } |
| 428 | |
| 429 | return $plugin_meta; |
| 430 | } |
| 431 | |
| 432 | /** |
| 433 | * @param $footer_text |
| 434 | * |
| 435 | * @return string |
| 436 | * |
| 437 | * Add footer text only on tutor pages |
| 438 | */ |
| 439 | public function admin_footer_text( $footer_text ) { |
| 440 | $current_screen = get_current_screen(); |
| 441 | $tutor_pages = tutor_utils()->tutor_get_screen_ids(); |
| 442 | |
| 443 | /** |
| 444 | * We are making sure that this message will be only on Tutor Admin page |
| 445 | */ |
| 446 | if ( isset( $current_screen->id ) && apply_filters( 'tutor_display_admin_footer_text', in_array( $current_screen->id, $tutor_pages ) ) ) { |
| 447 | $footer_text = sprintf( |
| 448 | __( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'tutor' ), |
| 449 | sprintf( '<strong>%s</strong>', esc_html__( 'Tutor LMS', 'tutor' ) ), |
| 450 | '<a href="https://wordpress.org/support/plugin/tutor/reviews?rate=5#new-post" target="_blank" class="tutor-rating-link">★★★★★</a>' |
| 451 | ); |
| 452 | } |
| 453 | |
| 454 | return $footer_text; |
| 455 | } |
| 456 | |
| 457 | |
| 458 | } |