PluginProbe
Comments Extra Fields For Post,Pages and CPT / 1.0
Comments Extra Fields For Post,Pages and CPT v1.0
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 1.0, at classes/input.class.php

112 lines 2.7 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 * returning relevant input object
37 */
38 function get_input($type){
39
40 $class_name = 'NM_' . ucfirst($type);
41 $file_name = 'input.' . $type . '.php';
42
43 if (! class_exists ( $class_name )) {
44 $_inputs = $this -> plugin_meta ['path'] . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'inputs' . DIRECTORY_SEPARATOR . $file_name;
45 if (file_exists ( $_inputs ))
46 include_once ($_inputs);
47 else
48 die ( 'Reen, Reen, BUMPs! not found ' . $_inputs );
49 }
50
51 return new $class_name();
52 }
53
54 /*
55 * loading scripts needed by input control
56 */
57 function load_input_scripts(){
58
59 if($this -> input_scripts['shipped']){
60 foreach($this -> input_scripts['shipped'] as $handler){
61 wp_enqueue_script($handler);
62 }
63 }
64
65 //front end scripts
66 if( isset( $this -> input_scripts['custom'] ) && $this -> input_scripts['custom']){
67 foreach( $this -> input_scripts['custom'] as $scripts => $script ){
68
69 //checking if it is style
70 if( $script['type'] == 'js'){
71 wp_enqueue_script($this->plugin_meta['shortname'].'-'.$script['script_name'], $this->plugin_meta['url'].$script['script_source'], $script['depends'], '3.0', $script['in_footer']);
72 }else{
73 wp_enqueue_style($this->plugin_meta['shortname'].'-'.$script['script_name'], $this->plugin_meta['url'].$script['script_source']);
74 }
75 }
76 }
77 }
78
79
80 /*
81 * check if browser is ie
82 */
83 function if_browser_is_ie()
84 {
85 //print_r($_SERVER['HTTP_USER_AGENT']);
86
87 if (isset($_SERVER['HTTP_USER_AGENT']) &&
88 (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') == false) || strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') == false)
89 return true;
90 else
91 return false;
92 }
93
94 /*
95 * get current page url with query string
96 */
97 function current_page_url() {
98 $page_url = 'http';
99 if( isset($_SERVER["HTTPS"]) ) {
100 if ($_SERVER["HTTPS"] == "on") {$page_url .= "s";}
101 }
102 $page_url .= "://";
103 if ($_SERVER["SERVER_PORT"] != "80") {
104 $page_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
105 } else {
106 $page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
107 }
108 return $page_url;
109 }
110
111
112 }