# wp-comment-fields/2.2/classes/input.class.php

Comments Extra Fields For Post,Pages and CPT, version 2.2. 111 lines.

- Page: https://pluginprobe.com/plugins/wp-comment-fields/2.2/code/classes/input.class.php
- Raw: https://pluginprobe.com/plugins/wp-comment-fields/2.2/raw/classes/input.class.php
- Modified: 2021-06-16T12:34:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-comment-fields/2.2/code/classes/input.class.php#L10-L20`.

```php
<?php
/*
 * Followig class handling all inputs control and their
 * dependencies. Do not make changes in code
 * Create on: 9 November, 2013
 */

class NM_Inputs_wpcomment {


	/*
	 * this var is pouplated with current plugin meta
	 */
	var $plugin_meta;


	/*
	 * this var contains the scripts info
	 * requested by input
	 */
	var $input_scripts;


	/**
	 * __construct function.
	 *
	 * @access public
	 * @param
	 */
	public function __construct() {

		$this->plugin_meta = get_plugin_meta_wpcomment();

	}

	/*
	 * returning relevant input object
	 */
	public function get_input( $type ) {

		// global $plugin_meta;
		$class_name = 'NM_' . ucfirst( $type );
		$file_name  = 'input.' . $type . '.php';

		if ( ! class_exists( $class_name ) ) {
				require_once wpcf_get_path() . '/classes/inputs/' . $file_name;
		}

		return new $class_name();
	}

	/*
	 * loading scripts needed by input control
	 */
	function load_input_scripts() {

		if ( $this->input_scripts['shipped'] ) {
			foreach ( $this->input_scripts['shipped'] as $handler ) {
				wp_enqueue_script( $handler );
			}
		}

		// front end scripts
		if ( isset( $this->input_scripts['custom'] ) && $this->input_scripts['custom'] ) {
			foreach ( $this->input_scripts['custom'] as $scripts => $script ) {

				// checking if it is style
				if ( $script['type'] == 'js' ) {
					wp_enqueue_script( $this->plugin_meta['shortname'] . '-' . $script['script_name'], $this->plugin_meta['url'] . $script['script_source'], $script['depends'], '3.0', $script['in_footer'] );
				} else {
					wp_enqueue_style( $this->plugin_meta['shortname'] . '-' . $script['script_name'], $this->plugin_meta['url'] . $script['script_source'] );
				}
			}
		}
	}


	/*
	 * check if browser is ie
	 */
	function if_browser_is_ie() {
		// print_r($_SERVER['HTTP_USER_AGENT']);
		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) &&
		( strpos( $_SERVER['HTTP_USER_AGENT'], 'Chrome' ) == false ) || strpos( $_SERVER['HTTP_USER_AGENT'], 'Safari' ) == false ) {
			return true;
		} else {
			return false;
		}
	}

	/*
	 * get current page url with query string
	 */
	function current_page_url() {
		$page_url = 'http';
		if ( isset( $_SERVER['HTTPS'] ) ) {
			if ( $_SERVER['HTTPS'] == 'on' ) {
				$page_url .= 's';}
		}
		$page_url .= '://';
		if ( $_SERVER['SERVER_PORT'] != '80' ) {
			$page_url .= $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
		} else {
			$page_url .= $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
		}
		return $page_url;
	}


}

```
