Server : Apache System : Linux pod-100823:apache2_74:v0.5.7 5.4.0-1138-gcp #147~18.04.1-Ubuntu SMP Mon Oct 7 21:46:26 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33.7 Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system Directory : /nas/content/live/attorneyexperi/wp-content/plugins/diva/includes/ |
<?php /** * Class AMP_Comment_Walker * * @codeCoverageIgnore * @deprecated 1.1.0 This functionality was moved to AMP_Comments_Sanitizer * @package AMP */ /* translators: 1: AMP_Comment_Walker. 2: AMP_Comments_Sanitizer. */ _deprecated_file( __FILE__, '1.1', null, esc_html( sprintf( __( '%1$s functionality has been moved to %2$s.', 'amp' ), AMP_Comment_Walker::class, AMP_Comments_Sanitizer::class ) ) ); /** * Class AMP_Comment_Walker * * Walker to wrap comments in mustache tags for amp-template. * * @deprecated 1.1.0 This functionality was moved to AMP_Comments_Sanitizer * @internal */ class AMP_Comment_Walker extends Walker_Comment { /** * The original comments arguments. * * @since 0.7 * @var array */ public $args; /** * Holds the timestamp of the most recent comment in a thread. * * @since 0.7 * @var array */ private $comment_thread_age = []; /** * Starts the element output. * * @since 0.7.0 * * @see Walker::start_el() * @see wp_list_comments() * @global int $comment_depth * @global WP_Comment $comment * * @param string $output Used to append additional content. Passed by reference. * @param WP_Comment $comment Comment data object. * @param int $depth Optional. Depth of the current comment in reference to parents. Default 0. * @param array $args Optional. An array of arguments. Default empty array. * @param int $id Optional. ID of the current comment. Default 0 (unused). */ public function start_el( &$output, $comment, $depth = 0, $args = [], $id = 0 ) { $new_out = ''; parent::start_el( $new_out, $comment, $depth, $args, $id ); if ( 'div' === $args['style'] ) { $tag = '<div'; } else { $tag = '<li'; } $new_tag = $tag . ' data-sort-time="' . esc_attr( strtotime( $comment->comment_date ) ) . '"'; if ( ! empty( $this->comment_thread_age[ $comment->comment_ID ] ) ) { $new_tag .= ' data-update-time="' . esc_attr( $this->comment_thread_age[ $comment->comment_ID ] ) . '"'; } $output .= $new_tag . substr( ltrim( $new_out ), strlen( $tag ) ); } /** * Output amp-list template code and place holder for comments. * * @since 0.7 * @see Walker::paged_walk() * * @param WP_Comment[] $elements List of comment Elements. * @param int $max_depth The maximum hierarchical depth. * @param int $page_num The specific page number, beginning with 1. * @param int $per_page Per page counter. * @param mixed ...$args Optional additional arguments. * * @return string XHTML of the specified page of elements. */ public function paged_walk( $elements, $max_depth, $page_num, $per_page, ...$args ) { if ( empty( $elements ) || $max_depth < -1 ) { return ''; } $this->build_thread_latest_date( $elements ); $args = array_slice( func_get_args(), 4 ); return parent::paged_walk( $elements, $max_depth, $page_num, $per_page, $args[0] ); } /** * Find the timestamp of the latest child comment of a thread to set the updated time. * * @since 0.7 * * @param WP_Comment[] $elements The list of comments to get thread times for. * @param int $time $the timestamp to check against. * @param bool $is_child Flag used to set the the value or return the time. * @return int Latest time. */ protected function build_thread_latest_date( $elements, $time = 0, $is_child = false ) { foreach ( $elements as $element ) { $children = $element->get_children(); $this_time = strtotime( $element->comment_date ); if ( ! empty( $children ) ) { $this_time = $this->build_thread_latest_date( $children, $this_time, true ); } if ( $this_time > $time ) { $time = $this_time; } if ( false === $is_child ) { $this->comment_thread_age[ $element->comment_ID ] = $time; } } return $time; } }