PluginProbe
SEO Redirection Plugin – 301 Redirect Manager / 8.4
SEO Redirection Plugin – 301 Redirect Manager v8.4
9.19 trunk 4.17 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.1 9.10 9.11 9.12 All 39 releases
seo-redirection / cf / lib / cf.jforms.class.php

cf.jforms.class.php in SEO Redirection Plugin – 301 Redirect Manager 8.4, at cf/lib/cf.jforms.class.php

101 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if(!class_exists('jforms')) {
4 class jforms
5 {
6 private $forms = array();
7 private $scripts = array();
8
9 public function add_form($selector,$function, $options="")
10 {
11 $index = count($this->forms);
12
13 if(!$this->selector_exists($selector))
14 {
15 $this->forms[$index]['selector']=$selector;
16 $this->forms[$index]['function']=$function;
17 $this->forms[$index]['options']=$options;
18 }
19 }
20
21 public function add_script($script)
22 {
23 $index = count($this->scripts);
24 $this->scripts[$index]=$script;
25 }
26
27 public function selector_exists($selector)
28 {
29 for($i=0;$i<count($this->forms);$i++)
30 {
31 if($this->forms[$i]['selector']==$selector)
32 {
33 return true;
34 }
35 }
36 return false;
37 }
38
39 public function add_select_picker()
40 {
41 $this->add_form(".selectpicker","selectpicker");
42 }
43
44 public function add_switch($name)
45 {
46 $this->add_form("[name='" . $name . "']","bootstrapSwitch");
47 }
48
49 public function add_color_picker()
50 {
51 $this->add_form(".color_picker","minicolors");
52 }
53
54 public function hide_alerts($stime=3000,$selector='.alert')
55 {
56 $this->add_script("$('$selector').delay($stime).slideUp('slow');");
57 }
58
59 public function set_small_select_pickers()
60 {
61 $this->add_script("$('.selectpicker').addClass('btn-sm');");
62 }
63
64 public function run()
65 {
66 $functions="";
67 $scripts="";
68
69 for($i=0;$i<count($this->forms);$i++)
70 {
71 $functions= $functions . "\n" . '$("' . $this->forms[$i]['selector'] . '").' . $this->forms[$i]['function'];
72 if($this->forms[$i]['options']=='')
73 {
74 $functions = $functions . "();";
75 }
76 else
77 {
78 $functions = $functions . "({
79 " . $this->forms[$i]['options'] . "
80 });";
81 }
82 }
83
84 for($i=0;$i<count($this->scripts);$i++)
85 {
86 $scripts = $scripts . "\n" . $this->scripts[$i];
87 }
88
89 echo "<script>
90 jQuery(document).ready(function($){";
91 echo esc_js($functions);
92 echo esc_js($scripts);
93 echo "\n
94 });
95 </script>";
96
97 }
98
99
100 }
101 }