HEX
Server: Apache
System: Linux digivps 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC 2025 x86_64
User: www (1000)
PHP: 8.3.15
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/healthyton.com/wp-content/plugins/wordpress-popular-posts/src/Shortcode/ViewsCount.php
<?php
namespace WordPressPopularPosts\Shortcode;

use WordPressPopularPosts\Helper;
use WordPressPopularPosts\Shortcode\Shortcode;

class ViewsCount extends Shortcode {

    /**
     * Construct.
     */
    public function __construct()
    {
        $this->tag = 'wpp_views_count';
    }

    /**
     * Handles the HTML output of the shortcode.
     *
     * @since  6.3.0
     * @param  mixed  $attributes  Array of attributes passed to the shortcode, or an empty string if nothing is passed
     * @return string              Views count
     */
    public function handle($attributes = []) : string
    {
        $views = '';

        if ( function_exists('wpp_get_views') ) {
            $attributes = shortcode_atts(
                [
                    'post_id' => null,
                    'range' => 'all',
                    'time_unit' => 'hour',
                    'time_quantity' => 24,
                    'number_format' => 1,
                    'include_views_text' => 1
                ],
                $attributes,
                $this->tag
            );

            if ( ! $attributes['post_id'] ) {
                if ( is_singular() ) {
                    $attributes['post_id'] = \get_queried_object_id();
                }
            }

            if ( $attributes['post_id'] && is_numeric($attributes['post_id']) ) {
                $valid_time_ranges = ['last24hours', 'last7days', 'last30days', 'all', 'custom'];

                if (
                    'all' === $attributes['range']
                    || ! in_array($attributes['range'], $valid_time_ranges)
                ) {
                    $views = wpp_get_views($attributes['post_id'], 'all', false);
                } elseif ( 'custom' !== $attributes['range'] ) {
                    $views = wpp_get_views($attributes['post_id'], $attributes['range'], false);
                } else {
                    $views = wpp_get_views(
                        $attributes['post_id'],
                        [
                            'range' => 'custom',
                            'time_unit' => $attributes['time_unit'],
                            'time_quantity' => $attributes['time_quantity']
                        ],
                        false
                    );
                }

                $views = (int) $views;
                $views_string = $views;

                if ( $views && $attributes['number_format'] ) {
                    $views_string = ( 'prettify' === $attributes['number_format'] ) ? Helper::prettify_number($views) : number_format_i18n($views);
                }

                if ( $attributes['include_views_text'] ) {
                    return sprintf(
                        _n('%s view', '%s views', $views, 'wordpress-popular-posts'),
                        $views_string
                    );
                }

                return $views_string;
            }
        }

        return $views;
    }
}