WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
класс не описан

WPSEO_Tracking_Server_Data{} Yoast 1.0

Represents the server data.

Хуков нет.

Возвращает

Null. Ничего.

Использование

$WPSEO_Tracking_Server_Data = new WPSEO_Tracking_Server_Data();
// use class methods

Методы

  1. get()
  2. get_server_data()
  3. get_curl_info()
  4. get_php_extensions()

Код WPSEO_Tracking_Server_Data{} Yoast 15.1.1

<?php
class WPSEO_Tracking_Server_Data implements WPSEO_Collection {

	/**
	 * Returns the collection data.
	 *
	 * @return array The collection data.
	 */
	public function get() {
		return [
			'server' => $this->get_server_data(),
		];
	}

	/**
	 * Returns the values with server details.
	 *
	 * @return array Array with the value.
	 */
	protected function get_server_data() {
		$server_data = [];

		// Validate if the server address is a valid IP-address.
		$ipaddress = filter_input( INPUT_SERVER, 'SERVER_ADDR', FILTER_VALIDATE_IP );
		if ( $ipaddress ) {
			$server_data['ip']       = $ipaddress;
			$server_data['Hostname'] = gethostbyaddr( $ipaddress );
		}

		$server_data['os']            = php_uname();
		$server_data['PhpVersion']    = PHP_VERSION;
		$server_data['CurlVersion']   = $this->get_curl_info();
		$server_data['PhpExtensions'] = $this->get_php_extensions();

		return $server_data;
	}

	/**
	 * Returns details about the curl version.
	 *
	 * @return array|null The curl info. Or null when curl isn't available..
	 */
	protected function get_curl_info() {
		if ( ! function_exists( 'curl_version' ) ) {
			return null;
		}

		$curl = curl_version();

		$ssl_support = true;
		if ( ! $curl['features'] && CURL_VERSION_SSL ) {
			$ssl_support = false;
		}

		return [
			'version'    => $curl['version'],
			'sslSupport' => $ssl_support,
		];
	}

	/**
	 * Returns a list with php extensions.
	 *
	 * @return array Returns the state of the php extensions.
	 */
	protected function get_php_extensions() {
		return [
			'imagick'   => extension_loaded( 'imagick' ),
			'filter'    => extension_loaded( 'filter' ),
			'bcmath'    => extension_loaded( 'bcmath' ),
			'pcre'      => extension_loaded( 'pcre' ),
			'xml'       => extension_loaded( 'xml' ),
			'pdo_mysql' => extension_loaded( 'pdo_mysql' ),
		];
	}
}