HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux sci 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: tpdc (1002)
PHP: 7.4.3-4ubuntu2.29
Disabled: 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/nsci/wp-content/themes/soledad/inc/social-counter/counter-vimeo-api.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
if ( ! class_exists( 'Penci_Social_Counter_Vimeo_API' ) ):
	class Penci_Social_Counter_Vimeo_API {
		public static function get_count( $data, $cache_period ) {

			$page_id      = preg_replace( '/\s+/', '', $data['name'] );
			$data['url']  = "http://vimeo.com/$page_id";
			$data['icon'] = penci_icon_by_ver( 'fab fa-vimeo-v' );

			$cache_key   = 'penci_counter__vimeo' . $page_id;
			$vimeo_count = get_transient( $cache_key );
			if ( ! $vimeo_count ) {

				$count = self::get_vimeo_count( $page_id );

				set_transient( $cache_key, $count, $cache_period );
			} else {
				$count = $vimeo_count;
			}

			if ( $count ) {
				$data['count'] = $count;
			}

			return $data;
		}

		private static function get_vimeo_count( $id ) {
			$status_code = @get_headers( 'https://vimeo.com/' . $id . '/following/followers/', 1 );
			$response    = array();
			if ( strpos( $status_code[0], '200' ) ) {
				$response = wp_remote_get( 'https://vimeo.com/' . $id . '/following/followers/', array(
					'timeout' => 10,
				) );
			}

			$pattern = "/data-title=\"(.*?) Follower(s?)\"/";
			preg_match( $pattern, $response['body'], $matches );

			if ( ! empty( $matches[1] ) ) {
				$result = '';
				foreach ( str_split( $matches[1] ) as $char ) {
					if ( is_numeric( $char ) ) {
						$result .= $char;
					}
				}

				return (int) $result;
			}
		}
	}

endif;