| @@ -51,9 +51,9 @@ | ||
| 51 | 51 | * @param int $user_id |
| 52 | 52 | * |
| 53 | 53 | * @return string |
| 54 | 54 | * @since 3.0.0 |
| 55 | - * @depecated 4.1.6.9 | |
| 55 | + * @deprecated 4.1.6.9 | |
| 56 | 56 | */ |
| 57 | 57 | /*function learn_press_create_course_action_nonce( $action, $course_id = 0, $user_id = 0 ) { |
| 58 | 58 | return LP_Nonce_Helper::create_course( $action, $course_id, $user_id ); |
| 59 | 59 | }*/ |
| @@ -67,9 +67,9 @@ | ||
| 67 | 67 | * @param int $user_id |
| 68 | 68 | * |
| 69 | 69 | * @return bool |
| 70 | 70 | * @since 3.0.0 |
| 71 | - * @depecated 4.1.6.9 | |
| 71 | + * @deprecated 4.1.6.9 | |
| 72 | 72 | */ |
| 73 | 73 | /*function learn_press_verify_course_action_nonce( $nonce, $action, $course_id = 0, $user_id = 0 ) { |
| 74 | 74 | return LP_Nonce_Helper::verify_course( $nonce, $action, $course_id, $user_id ); |
| 75 | 75 | }*/ |
| @@ -76,8 +76,10 @@ | ||
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * Get type of items are supported in course curriculum (post types). |
| 79 | 79 | * Default: [lp_lesson, lp_quiz] |
| 80 | + * When all addon use hook 'learn-press/course/item-types-support', will deprecate this function | |
| 81 | + * @use CourseModel::item_types_support | |
| 80 | 82 | * |
| 81 | 83 | * @return mixed |
| 82 | 84 | * @since 3.0.0 |
| 83 | 85 | * @editor tungnx |
| @@ -82,8 +84,9 @@ | ||
| 82 | 84 | * @since 3.0.0 |
| 83 | 85 | * @editor tungnx |
| 84 | 86 | * @version 1.0.1 |
| 85 | 87 | * @return array |
| 88 | + * @deprecated | |
| 86 | 89 | */ |
| 87 | 90 | function learn_press_get_course_item_types( bool $return_only_value = true ): array { |
| 88 | 91 | return apply_filters( |
| 89 | 92 | 'learn-press/course-item-type', |
| @@ -111,8 +114,9 @@ | ||
| 111 | 114 | * |
| 112 | 115 | * @param $item |
| 113 | 116 | * |
| 114 | 117 | * @return mixed |
| 118 | + * @Todo - tungnx need review code to rewrite. | |
| 115 | 119 | */ |
| 116 | 120 | function learn_press_get_item_courses( $item ) { |
| 117 | 121 | global $wpdb; |
| 118 | 122 | $query = $wpdb->prepare( |
| @@ -128,9 +132,12 @@ | ||
| 128 | 132 | |
| 129 | 133 | return $wpdb->get_results( $query ); |
| 130 | 134 | } |
| 131 | 135 | |
| 132 | -function _learn_press_usort_terms_by_ID( $terms ) { | |
| 136 | +/** | |
| 137 | + * @deprecated 4.2.7.4 | |
| 138 | + */ | |
| 139 | +/*function _learn_press_usort_terms_by_ID( $terms ) { | |
| 133 | 140 | $version = get_bloginfo( 'version' ); |
| 134 | 141 | if ( version_compare( $version, '4.7', '>=' ) ) { |
| 135 | 142 | $terms = wp_list_sort( $terms, 'term_id' ); |
| 136 | 143 | } else { |
| @@ -137,11 +144,11 @@ | ||
| 137 | 144 | usort( $terms, '_usort_terms_by_ID' ); |
| 138 | 145 | } |
| 139 | 146 | |
| 140 | 147 | return $terms; |
| 141 | -} | |
| 148 | +}*/ | |
| 142 | 149 | |
| 143 | -function learn_press_course_post_type_link( $permalink, $post ) { | |
| 150 | +/*function learn_press_course_post_type_link( $permalink, $post ) { | |
| 144 | 151 | if ( $post->post_type !== 'lp_course' ) { |
| 145 | 152 | return $permalink; |
| 146 | 153 | } |
| 147 | 154 | |
| @@ -202,11 +209,11 @@ | ||
| 202 | 209 | |
| 203 | 210 | $permalink = str_replace( $find, $replace, $permalink ); |
| 204 | 211 | |
| 205 | 212 | return $permalink; |
| 206 | -} | |
| 213 | +}*/ | |
| 207 | 214 | |
| 208 | -add_filter( 'post_type_link', 'learn_press_course_post_type_link', 10, 2 ); | |
| 215 | +//add_filter( 'post_type_link', 'learn_press_course_post_type_link', 10, 2 ); | |
| 209 | 216 | |
| 210 | 217 | function learn_press_item_meta_format( $item, $nonce = '' ) { |
| 211 | 218 | if ( current_theme_supports( 'post-formats' ) ) { |
| 212 | 219 | $format = get_post_format( $item ); |
| @@ -227,15 +234,18 @@ | ||
| 227 | 234 | } |
| 228 | 235 | } |
| 229 | 236 | } |
| 230 | 237 | |
| 231 | -function learn_press_course_item_format_exclude( $format, $item ) { | |
| 238 | +/** | |
| 239 | + * @deprecated 4.2.7.4 | |
| 240 | + */ | |
| 241 | +/*function learn_press_course_item_format_exclude( $format, $item ) { | |
| 232 | 242 | if ( learn_press_get_post_type( $item ) != LP_LESSON_CPT || ( $format == 'standard' ) ) { |
| 233 | 243 | $format = false; |
| 234 | 244 | } |
| 235 | 245 | |
| 236 | 246 | return $format; |
| 237 | -} | |
| 247 | +}*/ | |
| 238 | 248 | |
| 239 | 249 | /** |
| 240 | 250 | * Get curriculum of a course |
| 241 | 251 | * |
| @@ -242,15 +252,15 @@ | ||
| 242 | 252 | * @param $course_id |
| 243 | 253 | * |
| 244 | 254 | * @return mixed |
| 245 | 255 | * @version 1.0 |
| 246 | - * | |
| 256 | + * @deprecated 4.2.7.4 | |
| 247 | 257 | */ |
| 248 | -function learn_press_get_course_curriculum( $course_id ) { | |
| 258 | +/*function learn_press_get_course_curriculum( $course_id ) { | |
| 249 | 259 | $course = learn_press_get_course( $course_id ); |
| 250 | 260 | |
| 251 | 261 | return $course->get_curriculum(); |
| 252 | -} | |
| 262 | +}*/ | |
| 253 | 263 | |
| 254 | 264 | /** |
| 255 | 265 | * Verify course access |
| 256 | 266 | * |
| @@ -260,9 +270,9 @@ | ||
| 260 | 270 | * @return boolean |
| 261 | 271 | * @deprecated 4.1.3 |
| 262 | 272 | * @editor tungnx |
| 263 | 273 | */ |
| 264 | -function learn_press_is_enrolled_course( $course_id = null, $user_id = null ) { | |
| 274 | +/*function learn_press_is_enrolled_course( $course_id = null, $user_id = null ) { | |
| 265 | 275 | _deprecated_function( __FUNCTION__, '4.1.3' ); |
| 266 | 276 | if ( $course = learn_press_get_course( $course_id ) && $user = learn_press_get_user( $user_id ) ) { |
| 267 | 277 | return $user->has_enrolled_course( $course_id ); |
| 268 | 278 | } |
| @@ -267,9 +277,9 @@ | ||
| 267 | 277 | return $user->has_enrolled_course( $course_id ); |
| 268 | 278 | } |
| 269 | 279 | |
| 270 | 280 | return false; |
| 271 | -} | |
| 281 | +}*/ | |
| 272 | 282 | |
| 273 | 283 | /** |
| 274 | 284 | * Detect if a course is free or not |
| 275 | 285 | * |
| @@ -275,16 +285,17 @@ | ||
| 275 | 285 | * |
| 276 | 286 | * @param null $course_id |
| 277 | 287 | * |
| 278 | 288 | * @return bool |
| 289 | + * @deprecated 4.2.7.4 | |
| 279 | 290 | */ |
| 280 | -function learn_press_is_free_course( $course_id = null ) { | |
| 291 | +/*function learn_press_is_free_course( $course_id = null ) { | |
| 281 | 292 | if ( ! $course_id ) { |
| 282 | 293 | $course_id = get_the_ID(); |
| 283 | 294 | } |
| 284 | 295 | |
| 285 | 296 | return learn_press_get_course( $course_id )->is_free(); |
| 286 | -} | |
| 297 | +}*/ | |
| 287 | 298 | |
| 288 | 299 | /** |
| 289 | 300 | * get current status of user's course |
| 290 | 301 | * |
| @@ -292,11 +303,11 @@ | ||
| 292 | 303 | * @param int $course_id |
| 293 | 304 | * |
| 294 | 305 | * @return string |
| 295 | 306 | * @author Tunn |
| 296 | - * | |
| 307 | + * @deprecated 4.2.7.4 | |
| 297 | 308 | */ |
| 298 | -function learn_press_get_user_course_status( $user_id = null, $course_id = null ) { | |
| 309 | +/*function learn_press_get_user_course_status( $user_id = null, $course_id = null ) { | |
| 299 | 310 | $course = learn_press_get_course( $course_id ); |
| 300 | 311 | $user = learn_press_get_user( $user_id ); |
| 301 | 312 | |
| 302 | 313 | if ( $course && $user ) { |
| @@ -303,9 +314,9 @@ | ||
| 303 | 314 | return $user->get_course_status( $course_id ); |
| 304 | 315 | } |
| 305 | 316 | |
| 306 | 317 | return false; |
| 307 | -} | |
| 318 | +}*/ | |
| 308 | 319 | |
| 309 | 320 | /** |
| 310 | 321 | * Wrap function can-view-item of user object. |
| 311 | 322 | * |
| @@ -317,14 +328,14 @@ | ||
| 317 | 328 | * @since 3.1.0 |
| 318 | 329 | * |
| 319 | 330 | */ |
| 320 | 331 | //function learn_press_can_view_item( $item_id, $course_id = 0, $user_id = 0 ) { |
| 321 | -// if ( ! $user_id ) { | |
| 322 | -// $user_id = get_current_user_id(); | |
| 323 | -// } | |
| 324 | -// $user = learn_press_get_user( $user_id ); | |
| 332 | +// if ( ! $user_id ) { | |
| 333 | +// $user_id = get_current_user_id(); | |
| 334 | +// } | |
| 335 | +// $user = learn_press_get_user( $user_id ); | |
| 325 | 336 | // |
| 326 | -// return $user->can_view_item( $item_id, $course_id ); | |
| 337 | +// return $user->can_view_item( $item_id, $course_id ); | |
| 327 | 338 | //} |
| 328 | 339 | |
| 329 | 340 | /** |
| 330 | 341 | * Get course setting is enroll required or public |
| @@ -332,17 +343,17 @@ | ||
| 332 | 343 | * @param int $course_id |
| 333 | 344 | * |
| 334 | 345 | * @return boolean |
| 335 | 346 | * @since 0.9.5 |
| 336 | - * | |
| 347 | + * @deprecated 4.2.7.4 | |
| 337 | 348 | */ |
| 338 | -function learn_press_course_enroll_required( $course_id = null ) { | |
| 349 | +/*function learn_press_course_enroll_required( $course_id = null ) { | |
| 339 | 350 | $course_id = learn_press_get_course_id( $course_id ); |
| 340 | 351 | |
| 341 | 352 | $required = ( 'yes' == get_post_meta( $course_id, '_lpr_course_enrolled_require', true ) ); |
| 342 | 353 | |
| 343 | 354 | return apply_filters( 'learn_press_course_enroll_required', $required, $course_id ); |
| 344 | -} | |
| 355 | +}*/ | |
| 345 | 356 | |
| 346 | 357 | function learn_press_get_all_courses( $args = array() ) { |
| 347 | 358 | $term = ''; |
| 348 | 359 | $exclude = ''; |
| @@ -360,9 +371,12 @@ | ||
| 360 | 371 | |
| 361 | 372 | return apply_filters( 'learn_press_get_courses', $posts, $args ); |
| 362 | 373 | } |
| 363 | 374 | |
| 364 | -function learn_press_search_post_excerpt( $where = '' ) { | |
| 375 | +/** | |
| 376 | + * @deprecated 4.2.7.4 | |
| 377 | + */ | |
| 378 | +/*function learn_press_search_post_excerpt( $where = '' ) { | |
| 365 | 379 | global $wp_the_query, $wpdb; |
| 366 | 380 | |
| 367 | 381 | if ( empty( $wp_the_query->query_vars['s'] ) ) { |
| 368 | 382 | return $where; |
| @@ -374,9 +388,9 @@ | ||
| 374 | 388 | $where |
| 375 | 389 | ); |
| 376 | 390 | |
| 377 | 391 | return $where; |
| 378 | -} | |
| 392 | +}*/ | |
| 379 | 393 | |
| 380 | 394 | // add_filter( 'posts_where', 'learn_press_search_post_excerpt' ); |
| 381 | 395 | |
| 382 | 396 | function learn_press_get_course_user( $course_id = null ) { |
| @@ -389,19 +403,17 @@ | ||
| 389 | 403 | |
| 390 | 404 | /** |
| 391 | 405 | * Get item types support in course curriculum. |
| 392 | 406 | * |
| 393 | - * @param bool $keys | |
| 394 | - * | |
| 395 | - * @return mixed|null | |
| 407 | + * @return array | |
| 396 | 408 | */ |
| 397 | -function learn_press_course_get_support_item_types( $keys = false ) { | |
| 398 | - $types = array(); | |
| 399 | - if ( ! empty( $GLOBALS['learn_press_course_support_item_types'] ) ) { | |
| 400 | - $types = $GLOBALS['learn_press_course_support_item_types']; | |
| 401 | - } | |
| 409 | +function learn_press_course_get_support_item_types() { | |
| 410 | + $types = [ | |
| 411 | + LP_LESSON_CPT => __( 'Lesson', 'learnpress' ), | |
| 412 | + LP_QUIZ_CPT => __( 'Quiz', 'learnpress' ), | |
| 413 | + ]; | |
| 402 | 414 | |
| 403 | - return apply_filters( 'learn-press/course-support-items', $keys ? array_keys( $types ) : $types, $keys ); | |
| 415 | + return apply_filters( 'learn-press/course-support-items', $types, false ); | |
| 404 | 416 | } |
| 405 | 417 | |
| 406 | 418 | /** |
| 407 | 419 | * Register new type of course item |
| @@ -407,10 +419,11 @@ | ||
| 407 | 419 | * Register new type of course item |
| 408 | 420 | * |
| 409 | 421 | * @param string $post_type - Usually is post type |
| 410 | 422 | * @param string $label - Name show for user |
| 423 | + * @deprecated 4.2.7.4 | |
| 411 | 424 | */ |
| 412 | -function learn_press_course_add_support_item_type( $post_type, $label = '' ) { | |
| 425 | +/*function learn_press_course_add_support_item_type( $post_type, $label = '' ) { | |
| 413 | 426 | if ( empty( $GLOBALS['learn_press_course_support_item_types'] ) ) { |
| 414 | 427 | $GLOBALS['learn_press_course_support_item_types'] = array(); |
| 415 | 428 | } |
| 416 | 429 | if ( func_num_args() == 1 && is_array( func_get_arg( 0 ) ) ) { |
| @@ -419,9 +432,9 @@ | ||
| 419 | 432 | } |
| 420 | 433 | } elseif ( func_num_args() == 2 ) { |
| 421 | 434 | $GLOBALS['learn_press_course_support_item_types'][ func_get_arg( 0 ) ] = func_get_arg( 1 ); |
| 422 | 435 | } |
| 423 | -} | |
| 436 | +}*/ | |
| 424 | 437 | |
| 425 | 438 | /** |
| 426 | 439 | * Check if course is support an item's type. |
| 427 | 440 | * |
| @@ -443,14 +456,17 @@ | ||
| 443 | 456 | |
| 444 | 457 | return $support; |
| 445 | 458 | } |
| 446 | 459 | |
| 447 | -learn_press_course_add_support_item_type( | |
| 460 | +/** | |
| 461 | + * @deprecated 4.2.7.4 | |
| 462 | + */ | |
| 463 | +/*learn_press_course_add_support_item_type( | |
| 448 | 464 | array( |
| 449 | 465 | 'lp_lesson' => __( 'Lesson', 'learnpress' ), |
| 450 | 466 | 'lp_quiz' => __( 'Quiz', 'learnpress' ), |
| 451 | 467 | ) |
| 452 | -); | |
| 468 | +);*/ | |
| 453 | 469 | |
| 454 | 470 | function learn_press_add_course_item_feature( $type, $feature ) { |
| 455 | 471 | $features = array(); |
| 456 | 472 | if ( ! empty( $GLOBALS['learn_press_course_item_features'] ) ) { |
| @@ -503,9 +519,9 @@ | ||
| 503 | 519 | * @param int $item_id |
| 504 | 520 | * |
| 505 | 521 | * @return string |
| 506 | 522 | * @since 3.0.0 |
| 507 | - * | |
| 523 | + * Addon Assignment 4.1.1 still use | |
| 508 | 524 | */ |
| 509 | 525 | function learn_press_get_course_item_permalink( int $course_id = 0, int $item_id = 0 ): string { |
| 510 | 526 | $course = learn_press_get_course( $course_id ); |
| 511 | 527 | if ( $course ) { |
| @@ -514,25 +530,20 @@ | ||
| 514 | 530 | |
| 515 | 531 | return ''; |
| 516 | 532 | } |
| 517 | 533 | |
| 518 | - | |
| 534 | +/** | |
| 535 | + * @deprecated 4.2.2 | |
| 536 | + */ | |
| 519 | 537 | function learn_press_get_the_course() { |
| 520 | - static $course; | |
| 521 | - if ( ! $course ) { | |
| 522 | - $course_id = get_the_ID(); | |
| 523 | - if ( learn_press_get_post_type( $course ) == LP_COURSE_CPT ) { | |
| 524 | - $course = learn_press_get_course( $course_id ); | |
| 525 | - } | |
| 526 | - } | |
| 527 | - if ( ! $course ) { | |
| 528 | - return new LP_Course( 0 ); | |
| 529 | - } | |
| 530 | - | |
| 531 | - return $course; | |
| 538 | + _deprecated_function( __FUNCTION__, '4.2.2', 'learn_press_get_course' ); | |
| 539 | + return learn_press_get_course(); | |
| 532 | 540 | } |
| 533 | 541 | |
| 534 | -function learn_press_get_user_question_answer( $args = '' ) { | |
| 542 | +/** | |
| 543 | + * @deprecated 4.2.7.4 | |
| 544 | + */ | |
| 545 | +/*function learn_press_get_user_question_answer( $args = '' ) { | |
| 535 | 546 | $args = wp_parse_args( |
| 536 | 547 | $args, |
| 537 | 548 | array( |
| 538 | 549 | 'question_id' => 0, |
| @@ -559,19 +570,25 @@ | ||
| 559 | 570 | } |
| 560 | 571 | } |
| 561 | 572 | |
| 562 | 573 | return $answered; |
| 563 | -} | |
| 574 | +}*/ | |
| 564 | 575 | |
| 565 | -function need_to_updating() { | |
| 576 | +/** | |
| 577 | + * @deprecated 4.2.7.4 | |
| 578 | + */ | |
| 579 | +/*function need_to_updating() { | |
| 566 | 580 | ob_start(); |
| 567 | 581 | learn_press_display_message( 'This function need to updating' ); |
| 568 | 582 | |
| 569 | 583 | return ob_get_clean(); |
| 570 | -} | |
| 584 | +}*/ | |
| 571 | 585 | |
| 572 | -/* filter section item single course */ | |
| 573 | -function learn_press_get_course_sections() { | |
| 586 | +/** | |
| 587 | + * filter section item single course | |
| 588 | + * @deprecated 4.2.7.4 | |
| 589 | + */ | |
| 590 | +/*function learn_press_get_course_sections() { | |
| 574 | 591 | return apply_filters( |
| 575 | 592 | 'learn_press_get_course_sections', |
| 576 | 593 | array( |
| 577 | 594 | 'lp_lesson', |
| @@ -577,23 +594,29 @@ | ||
| 577 | 594 | 'lp_lesson', |
| 578 | 595 | 'lp_quiz', |
| 579 | 596 | ) |
| 580 | 597 | ); |
| 581 | -} | |
| 598 | +}*/ | |
| 582 | 599 | |
| 583 | -function lean_press_get_course_sections() { | |
| 600 | +/** | |
| 601 | + * @deprecated 4.2.7.4 | |
| 602 | + */ | |
| 603 | +/*function lean_press_get_course_sections() { | |
| 584 | 604 | _deprecated_function( __FUNCTION__, '2.1', 'learn_press_get_course_sections' ); |
| 585 | 605 | |
| 586 | 606 | return learn_press_get_course_sections(); |
| 587 | -} | |
| 607 | +}*/ | |
| 588 | 608 | |
| 589 | -if ( ! function_exists( 'learn_press_get_course_item_url' ) ) { | |
| 609 | +/** | |
| 610 | + * @deprecated 4.2.7.4 | |
| 611 | + */ | |
| 612 | +/*if ( ! function_exists( 'learn_press_get_course_item_url' ) ) { | |
| 590 | 613 | function learn_press_get_course_item_url( $course_id = null, $item_id = null ) { |
| 591 | 614 | $course = learn_press_get_course( $course_id ); |
| 592 | 615 | |
| 593 | 616 | return $course ? $course->get_item_link( $item_id ) : false; |
| 594 | 617 | } |
| 595 | -} | |
| 618 | +}*/ | |
| 596 | 619 | |
| 597 | 620 | /** |
| 598 | 621 | * Add filter to WP comment form of lesson or quiz to output ID of current course. |
| 599 | 622 | * |
| @@ -654,9 +677,9 @@ | ||
| 654 | 677 | * @param int $comment_id |
| 655 | 678 | * @param string $status |
| 656 | 679 | * |
| 657 | 680 | * @since 3.0.10 |
| 658 | - * @depecated 4.1.6.9 | |
| 681 | + * @deprecated 4.1.6.9 | |
| 659 | 682 | * |
| 660 | 683 | */ |
| 661 | 684 | /*function learn_press_force_refresh_course( $comment_id, $status ) { |
| 662 | 685 | |
| @@ -672,38 +695,10 @@ | ||
| 672 | 695 | |
| 673 | 696 | add_action( 'comment_post', 'learn_press_force_refresh_course', 1000, 2 );*/ |
| 674 | 697 | |
| 675 | 698 | /** |
| 676 | - * @editor tungnx | comment code | |
| 677 | - * @deprecated 3.2.7.5 | |
| 699 | + * @deprecated 4.1.6.9 | |
| 678 | 700 | */ |
| 679 | -/*if ( ! function_exists( 'learn_press_get_sample_link_course_item_url' ) ) { | |
| 680 | - | |
| 681 | - function learn_press_get_sample_link_course_item_url( $item_id = null ) { | |
| 682 | - | |
| 683 | - if ( ! $item_id ) { | |
| 684 | - return; | |
| 685 | - } | |
| 686 | - | |
| 687 | - | |
| 688 | - $permalink = get_the_permalink( $item_id ); | |
| 689 | - $post_name = get_post_field( 'post_name', $item_id ); | |
| 690 | - | |
| 691 | - if ( '' != get_option( 'permalink_structure' ) ) { | |
| 692 | - $permalink = $post_name; | |
| 693 | - } else { | |
| 694 | - $key = preg_replace( '!lp_!', '', learn_press_get_post_type( $item_id ) ); | |
| 695 | - $permalink = add_query_arg( array( $key => $post_name ), $permalink ); | |
| 696 | - } | |
| 697 | - | |
| 698 | - return $permalink; | |
| 699 | - | |
| 700 | - } | |
| 701 | -}*/ | |
| 702 | - | |
| 703 | -/** | |
| 704 | - * @depecated 4.1.6.9 | |
| 705 | - */ | |
| 706 | 701 | /*if ( ! function_exists( 'learn_press_get_nav_course_item_url' ) ) { |
| 707 | 702 | function learn_press_get_nav_course_item_url( $course_id = null, $item_id = null, $content_only = false ) { |
| 708 | 703 | |
| 709 | 704 | $course = learn_press_get_course( $course_id ); |
| @@ -741,37 +736,12 @@ | ||
| 741 | 736 | return $return; |
| 742 | 737 | } |
| 743 | 738 | }*/ |
| 744 | 739 | |
| 745 | -if ( ! function_exists( 'learn_press_edit_item_link' ) ) { | |
| 746 | - /** | |
| 747 | - * Displaying course items navigation | |
| 748 | - * | |
| 749 | - * @param null $item_id | |
| 750 | - * @param null $course_id | |
| 751 | - * @param bool $content_only | |
| 752 | - */ | |
| 753 | - function learn_press_edit_item_link( $item_id = null, $course_id = null, $content_only = false ) { | |
| 754 | - $user = learn_press_get_current_user(); | |
| 755 | - if ( $user->can_edit_item( $item_id, $course_id ) ) : ?> | |
| 756 | - <p class="edit-course-item-link"> | |
| 757 | - <a href="<?php echo get_edit_post_link( $item_id ); ?>"> | |
| 758 | - <?php | |
| 759 | - _e( | |
| 760 | - 'Edit this item', | |
| 761 | - 'learnpress' | |
| 762 | - ); | |
| 763 | - ?> | |
| 764 | - </a> | |
| 765 | - </p> | |
| 766 | - <?php | |
| 767 | - endif; | |
| 768 | - } | |
| 769 | -} | |
| 770 | 740 | /** |
| 771 | 741 | * Get course id of an item by id |
| 772 | 742 | * |
| 773 | - * @depecated 4.1.6.9 | |
| 743 | + * @deprecated 4.1.6.9 | |
| 774 | 744 | */ |
| 775 | 745 | |
| 776 | 746 | if ( ! function_exists( 'learn_press_get_item_course_id' ) ) { |
| 777 | 747 | |
| @@ -890,18 +860,17 @@ | ||
| 890 | 860 | * @since 3.0.0 |
| 891 | 861 | * |
| 892 | 862 | */ |
| 893 | 863 | function learn_press_get_preview_url( $post_id ) { |
| 894 | - return | |
| 895 | - esc_url_raw( | |
| 896 | - add_query_arg( | |
| 897 | - array( | |
| 898 | - 'lp-preview' => $post_id, | |
| 899 | - '_wpnonce' => wp_create_nonce( 'lp-preview' ), | |
| 900 | - ), | |
| 901 | - trailingslashit( get_home_url() ) | |
| 902 | - ) | |
| 903 | - ); | |
| 864 | + return esc_url_raw( | |
| 865 | + add_query_arg( | |
| 866 | + array( | |
| 867 | + 'lp-preview' => $post_id, | |
| 868 | + '_wpnonce' => wp_create_nonce( 'lp-preview' ), | |
| 869 | + ), | |
| 870 | + trailingslashit( get_home_url() ) | |
| 871 | + ) | |
| 872 | + ); | |
| 904 | 873 | } |
| 905 | 874 | |
| 906 | 875 | if ( ! function_exists( 'learn_press_course_item_type_link' ) ) { |
| 907 | 876 | /** |
| @@ -989,9 +958,12 @@ | ||
| 989 | 958 | |
| 990 | 959 | return $html; |
| 991 | 960 | } |
| 992 | 961 | |
| 993 | -function learn_press_get_course_results_tooltip( $course_id ) { | |
| 962 | +/** | |
| 963 | + * @deprecated 4.2.7.4 | |
| 964 | + */ | |
| 965 | +/*function learn_press_get_course_results_tooltip( $course_id ) { | |
| 994 | 966 | $metabox = LP_Course_Post_Type::assessment_meta_box(); |
| 995 | 967 | $options = $metabox['fields'][0]['options']; |
| 996 | 968 | $cr = get_post_meta( $course_id, '_lp_course_result', true ); |
| 997 | 969 | $tooltip = ! empty( $options[ $cr ] ) ? $options[ $cr ] : false; |
| @@ -1001,9 +973,9 @@ | ||
| 1001 | 973 | } |
| 1002 | 974 | } |
| 1003 | 975 | |
| 1004 | 976 | return $tooltip; |
| 1005 | -} | |
| 977 | +}*/ | |
| 1006 | 978 | |
| 1007 | 979 | function learn_press_course_passing_condition( $value, $format, $course_id ) { |
| 1008 | 980 | $course = learn_press_get_course( $course_id ); |
| 1009 | 981 | $quiz_id = $course->get_final_quiz(); |
| @@ -1022,13 +994,16 @@ | ||
| 1022 | 994 | } |
| 1023 | 995 | |
| 1024 | 996 | add_filter( 'learn-press/course-passing-condition', 'learn_press_course_passing_condition', 10, 3 ); |
| 1025 | 997 | |
| 998 | +/** | |
| 999 | + * @deprecated 4.2.7.4 | |
| 1000 | + */ | |
| 1026 | 1001 | function learn_press_remove_query_var_enrolled_course( $redirect ) { |
| 1027 | 1002 | return esc_url_raw( remove_query_arg( 'enroll-course', $redirect ) ); |
| 1028 | 1003 | } |
| 1029 | 1004 | |
| 1030 | -add_filter( 'learn-press/enroll-course-redirect', 'learn_press_remove_query_var_enrolled_course' ); | |
| 1005 | +//add_filter( 'learn-press/enroll-course-redirect', 'learn_press_remove_query_var_enrolled_course' ); | |
| 1031 | 1006 | |
| 1032 | 1007 | /** |
| 1033 | 1008 | * Mark the user to know if they have just logged in |
| 1034 | 1009 | * for some purpose. |
| @@ -1034,14 +1009,13 @@ | ||
| 1034 | 1009 | * for some purpose. |
| 1035 | 1010 | * |
| 1036 | 1011 | * @since 3.0.0 |
| 1037 | 1012 | */ |
| 1038 | -function learn_press_mark_user_just_logged_in() { | |
| 1039 | - LP()->session->set( 'user_just_logged_in', 'yes' ); | |
| 1013 | +/*function learn_press_mark_user_just_logged_in() { | |
| 1014 | + LearnPress::instance()->session->set( 'user_just_logged_in', 'yes' ); | |
| 1040 | 1015 | } |
| 1016 | +add_action( 'wp_login', 'learn_press_mark_user_just_logged_in' );*/ | |
| 1041 | 1017 | |
| 1042 | -add_action( 'wp_login', 'learn_press_mark_user_just_logged_in' ); | |
| 1043 | - | |
| 1044 | 1018 | function learn_press_translate_course_result_required( $course ) { |
| 1045 | 1019 | if ( ! $course ) { |
| 1046 | 1020 | return ''; |
| 1047 | 1021 | } |
| @@ -1050,21 +1024,21 @@ | ||
| 1050 | 1024 | |
| 1051 | 1025 | $evaluate_type = $course->get_data( 'course_result', 'evaluate_lesson' ); |
| 1052 | 1026 | switch ( $evaluate_type ) { |
| 1053 | 1027 | case 'evaluate_lesson': |
| 1054 | - $label = esc_html__( 'lessons completed per total number of lessons.', 'learnpress' ); | |
| 1028 | + $label = esc_html__( 'completed lessons per the total number of lessons.', 'learnpress' ); | |
| 1055 | 1029 | break; |
| 1056 | 1030 | case 'evaluate_quiz': |
| 1057 | - $label = esc_html__( 'quizzes passed per total number of quizzes.', 'learnpress' ); | |
| 1031 | + $label = esc_html__( 'passed quizzes per the total number of quizzes.', 'learnpress' ); | |
| 1058 | 1032 | break; |
| 1059 | 1033 | case 'evaluate_final_quiz': |
| 1060 | 1034 | $label = esc_html__( 'Final Quiz', 'learnpress' ); |
| 1061 | 1035 | break; |
| 1062 | 1036 | case 'evaluate_questions': |
| 1063 | - $label = esc_html__( 'correct answers per total number of questions.', 'learnpress' ); | |
| 1037 | + $label = esc_html__( 'correct answers per the total number of questions.', 'learnpress' ); | |
| 1064 | 1038 | break; |
| 1065 | 1039 | case 'evaluate_mark': |
| 1066 | - $label = esc_html__( 'score achieved per total score of the questions.', 'learnpress' ); | |
| 1040 | + $label = esc_html__( 'score achieved per the total score of the questions.', 'learnpress' ); | |
| 1067 | 1041 | break; |
| 1068 | 1042 | default: |
| 1069 | 1043 | $label = apply_filters( 'learnpress/message/evaluate/' . $evaluate_type, $evaluate_type ); |
| 1070 | 1044 | break; |