HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/insiders/wp-load/wp-content/plugins/gutenmate/lib/post-views/post-views.php
<?php

/* -----------------------------------------------------------------------------
 * Load Plugin Adapter
 * -------------------------------------------------------------------------- */

add_action( 'init', 'gtm_init_post_views' );
if ( ! function_exists( 'gtm_init_post_views' ) ) {
	function gtm_init_post_views() {
		defined( 'GTM_POST_VIEWS_IS_ACTIVE' ) || define( 'GTM_POST_VIEWS_IS_ACTIVE', defined( 'WPP_VERSION' ) );
	}
}

if ( ! function_exists( 'gtm_get_post_views' ) ) {
	function gtm_get_post_views( $post_id = '' ) {
		if ( empty( $post_id ) ) {
			$post_id = get_the_id();
		}

		// Get post view from Wordpress Popular Posts plugin
		if ( function_exists( 'wpp_get_views' ) ) {
			$views = intval( wpp_get_views( $post_id, 'all', false ) );
		}

		// Reset views if not a positive integer
		if ( ! ( $views >= 0 ) ) {
			$views = 0;
		}

		return apply_filters( 'gtm_get_post_views', $views, $post_id );
	}
}

/* -----------------------------------------------------------------------------
 * Post Views Forgery
 * -------------------------------------------------------------------------- */

add_filter( 'gtm_get_post_views', 'gtm_post_views_forgery', 10, 1 );
if ( ! function_exists( 'gtm_post_views_forgery' ) ) {
	function gtm_post_views_forgery( $post_views ) {
		$post_views_forgery = get_option( 'gtm_post_views_forgery', 0 );
		return intval( $post_views ) + intval( $post_views_forgery );
	}
}