Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Helper_Upgrader::get_changelog_html( string $tag, string $url )
Retrieve changelog information from the make blog
Description Description
Retrieves the most recent 10 changelog entries for the add-on, formats the returned information into a format suitable to display within the thickbox, adds a link to the full changelog, and returns the html string.
If an error is encountered, returns an empty string.
Parameters Parameters
- $tag
-
(string) (Required) Tag slug for the add-on on the blog.
- $url
-
(string) (Required) Full URL to the changelog entries for the add-on.
Return Return
(string)
Source Source
File: libraries/lifterlms-helper/includes/class-llms-helper-upgrader.php
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | private function get_changelog_html( $tag , $url ) { $ret = '' ; $req = wp_remote_get( add_query_arg( 'slug' , $tag , 'https://make.lifterlms.com/wp-json/wp/v2/tags' ) ); $body = json_decode( wp_remote_retrieve_body( $req ), true ); if ( ! empty ( $body ) && ! empty ( $body [0][ '_links' ][ 'wp:post_type' ][0][ 'href' ] ) ) { $logs_url = $body [0][ '_links' ][ 'wp:post_type' ][0][ 'href' ]; $logs_req = wp_remote_get( $logs_url ); $logs = json_decode( wp_remote_retrieve_body( $logs_req ), true ); if ( ! empty ( $logs ) && is_array ( $logs ) ) { foreach ( $logs as $log ) { $ts = strtotime ( $log [ 'date_gmt' ] ); $date = function_exists( 'wp_date' ) ? wp_date( 'Y-m-d' , $ts ) : gmdate ( 'Y-m-d' , $ts ); $split = array_filter ( explode ( ' ' , $log [ 'title' ][ 'rendered' ] ) ); $ver = end ( $split ); // Translators: %1$s - Version number; %2$s - Release date. $ret .= '<h4>' . sprintf( __( 'Version %1$s - %2$s' , 'lifterlms' ), sanitize_text_field( wp_strip_all_tags( trim( $ver ) ) ), $date ) . '</h4>' ; $ret .= strip_tags ( $log [ 'content' ][ 'rendered' ], '<ul><li><p><a><b><strong><em><i>' ); } } $ret .= '<br>' ; // Translators: %s = URL to the full changelog. $ret .= '<p>' . make_clickable( sprintf( __( 'View the full changelog at %s.' , 'lifterlms' ), $url ) ) . '</p>' ; } return $ret ; } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.2.0 | Fix usage of incorrect textdomain. |
3.1.0 | Introduced. |