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