PluginProbe
Comments Extra Fields For Post,Pages and CPT / 2.2
Comments Extra Fields For Post,Pages and CPT v2.2
trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 2.2 2.3 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 5.0 5.1 5.2
wp-comment-fields / classes / input.class.php

input.class.php in Comments Extra Fields For Post,Pages and CPT 2.2, at classes/input.class.php

111 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Followig class handling all inputs control and their
4 * dependencies. Do not make changes in code
5 * Create on: 9 November, 2013
6 */
7
8 class NM_Inputs_wpcomment {
9
10
11 /*
12 * this var is pouplated with current plugin meta
13 */
14 var $plugin_meta;
15
16
17 /*
18 * this var contains the scripts info
19 * requested by input
20 */
21 var $input_scripts;
22
23
24 /**
25 * __construct function.
26 *
27 * @access public
28 * @param
29 */
30 public function __construct() {
31
32 $this->plugin_meta = get_plugin_meta_wpcomment();
33
34 }
35
36 /*
37 * returning relevant input object
38 */
39 public function get_input( $type ) {
40
41 // global $plugin_meta;
42 $class_name = 'NM_' . ucfirst( $type );
43 $file_name = 'input.' . $type . '.php';
44
45 if ( ! class_exists( $class_name ) ) {
46 require_once wpcf_get_path() . '/classes/inputs/' . $file_name;
47 }
48
49 return new $class_name();
50 }
51
52 /*
53 * loading scripts needed by input control
54 */
55 function load_input_scripts() {
56
57 if ( $this->input_scripts['shipped'] ) {
58 foreach ( $this->input_scripts['shipped'] as $handler ) {
59 wp_enqueue_script( $handler );
60 }
61 }
62
63 // front end scripts
64 if ( isset( $this->input_scripts['custom'] ) && $this->input_scripts['custom'] ) {
65 foreach ( $this->input_scripts['custom'] as $scripts => $script ) {
66
67 // checking if it is style
68 if ( $script['type'] == 'js' ) {
69 wp_enqueue_script( $this->plugin_meta['shortname'] . '-' . $script['script_name'], $this->plugin_meta['url'] . $script['script_source'], $script['depends'], '3.0', $script['in_footer'] );
70 } else {
71 wp_enqueue_style( $this->plugin_meta['shortname'] . '-' . $script['script_name'], $this->plugin_meta['url'] . $script['script_source'] );
72 }
73 }
74 }
75 }
76
77
78 /*
79 * check if browser is ie
80 */
81 function if_browser_is_ie() {
82 // print_r($_SERVER['HTTP_USER_AGENT']);
83 if ( isset( $_SERVER['HTTP_USER_AGENT'] ) &&
84 ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Chrome' ) == false ) || strpos( $_SERVER['HTTP_USER_AGENT'], 'Safari' ) == false ) {
85 return true;
86 } else {
87 return false;
88 }
89 }
90
91 /*
92 * get current page url with query string
93 */
94 function current_page_url() {
95 $page_url = 'http';
96 if ( isset( $_SERVER['HTTPS'] ) ) {
97 if ( $_SERVER['HTTPS'] == 'on' ) {
98 $page_url .= 's';}
99 }
100 $page_url .= '://';
101 if ( $_SERVER['SERVER_PORT'] != '80' ) {
102 $page_url .= $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
103 } else {
104 $page_url .= $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
105 }
106 return $page_url;
107 }
108
109
110 }
111