HEX
Server: Apache
System: Linux vps.teamads.com 4.18.0-553.126.1.el8_10.x86_64 #1 SMP Thu May 28 06:44:09 EDT 2026 x86_64
User: teamadsc (1024)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/teamadsc/public_html/wp-content/plugins/page-views-count/src/pvc_shortcode.php
<?php
namespace A3Rev\PageViewsCount;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

class Shortcode
{

	public function __construct() {
		add_shortcode( 'pvc_stats', array( $this, 'parse_shortcode') );

		add_filter( 'pvc_stats_shortcode', array( $this, 'pvc_stats_shortcode' ), 10, 4 );
	}

	public function parse_shortcode( $attr = array() ) {
		if ( is_admin() ) {
			return '';
		}

		$attr = shortcode_atts(
			array(
				'postid'           => '',
				'increase'         => 1,
				'show_views_today' => 1,
			), $attr );

		$postid           = esc_attr( $attr['postid'] );
		$increase         = intval( $attr['increase'] );
		$show_views_today = intval( $attr['show_views_today'] );

		$output = apply_filters( 'pvc_stats_shortcode', '', $postid, $increase, $show_views_today );

		return $output;
	}

	public function pvc_stats_shortcode( $output = '', $postid = '', $increase = 1, $show_views_today = 1 ) {
		if ( empty( $postid ) ) {
			global $post;
			if ( $post ) {
				$postid = $post->ID;
			}
		}

		if ( empty( $postid ) ) {
			return '';
		}

		$attributes = array( 'views_type' => ( 0 == $show_views_today ? 'total_only' : 'all' ) );

		if ( 1 == $increase ) {
			$output = A3_PVC::custom_stats_update_echo( $postid, 0, $attributes );
		} else {
			$output = A3_PVC::custom_stats_echo( $postid, 0, $attributes );
		}

		return $output;
	}
}