Version Description
- Bug fixing in http redirects
Download this release
Release Info
Developer | fakhris |
Plugin | SEO Redirection Plugin |
Version | 4.17 |
Comparing to | |
See all releases |
Version 4.17
- cf/lib/cf.jforms.class.php +101 -0
- cf/lib/forms/cf.bcheckbox_option.class.php +246 -0
- cf/lib/forms/cf.dropdownlist.class.php +99 -0
- common/bootstrap.css +289 -0
- common/controls.php +16 -0
- common/controls/cf_checkoption.php +59 -0
- common/controls/cf_ckeckboxlist.php +375 -0
- common/controls/cf_datemenu.php +92 -0
- common/controls/cf_dropdown.php +91 -0
- common/controls/cf_tab.php +114 -0
- common/controls/cf_wherest.php +91 -0
- common/controls/datagrid.class.php +633 -0
- common/controls/pagination.class.php +682 -0
- common/customJs.js +298 -0
- common/images/action_success.png +0 -0
- common/images/add.png +0 -0
- common/images/delete.png +0 -0
- common/images/dialog-warning.png +0 -0
- common/images/edit.png +0 -0
- common/images/error.png +0 -0
- common/images/go_link.png +0 -0
- common/images/gradient_color_bg.gif +0 -0
- common/images/help_off.png +0 -0
- common/images/help_over.png +0 -0
- common/images/large-info.png +0 -0
- common/images/link.png +0 -0
- common/images/search.png +0 -0
- common/images/see.png +0 -0
- common/js/jquery.validate.min.js +2 -0
- common/js/sweetalert.min.js +1 -0
- common/style.css +347 -0
- common/sweetalert.css +1 -0
- common/util.php +659 -0
- custom/controls.php +3 -0
- custom/controls/cf.SR_redirect_cache.class.php +154 -0
- custom/controls/grid_templates.php +44 -0
- custom/export/.htaccess +4 -0
- custom/export/csv.php +73 -0
- custom/export/sample.csv +7 -0
- custom/export/simple_form.csv +2 -0
- custom/export/xml.php +57 -0
- custom/functions.php +144 -0
- custom/images/404_manager.png +0 -0
- custom/images/404pro.png +0 -0
- custom/images/arrow_from.png +0 -0
- custom/images/arrow_to.png +0 -0
- custom/images/check.gif +0 -0
- custom/images/circles.png +0 -0
- custom/images/control_panel.png +0 -0
- custom/images/folder.png +0 -0
- custom/images/folder_off.png +0 -0
- custom/images/help-icon.png +0 -0
- custom/images/help_center.png +0 -0
- custom/images/import_export.png +0 -0
- custom/images/other_features.png +0 -0
- custom/images/page.png +0 -0
- custom/images/page_off.png +0 -0
- custom/images/pro.png +0 -0
- custom/images/redirect_manager_intro.png +0 -0
- custom/images/regex.png +0 -0
- custom/images/regex_off.png +0 -0
- custom/images/seo.png +0 -0
- custom/images/seopro.png +0 -0
- custom/lib/cf.SR_redirect_cache.class.php +223 -0
- custom/style.css +45 -0
- license.txt +674 -0
- options/help.php +30 -0
- options/option_export_import.php +292 -0
- options/option_page_custome_redirection.php +147 -0
- options/option_page_custome_redirection_add_update.php +294 -0
- options/option_page_custome_redirection_list.php +242 -0
- options/option_page_goptions.php +183 -0
- options/option_page_history.php +132 -0
- options/option_page_post_redirection_list.php +115 -0
- options/premium.php +38 -0
- readme.txt +220 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- screenshot-5.png +0 -0
- screenshot-6.png +0 -0
- screenshot-7.png +0 -0
- screenshot-8.png +0 -0
- seo-redirection.php +1178 -0
cf/lib/cf.jforms.class.php
ADDED
@@ -0,0 +1,101 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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 $functions;
|
92 |
+
echo $scripts;
|
93 |
+
echo "\n
|
94 |
+
});
|
95 |
+
</script>";
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
}
|
101 |
+
}
|
cf/lib/forms/cf.bcheckbox_option.class.php
ADDED
@@ -0,0 +1,246 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Author: Fakhri Alsadi
|
4 |
+
Date: 24-4-2015
|
5 |
+
|
6 |
+
A simple class to create checkbox options
|
7 |
+
*/
|
8 |
+
|
9 |
+
if(!class_exists('bcheckbox_option')){
|
10 |
+
class bcheckbox_option{
|
11 |
+
|
12 |
+
private $group_name="";
|
13 |
+
private $list_nodes="";
|
14 |
+
private $list_selected_nodes = array();
|
15 |
+
private $style = "default";
|
16 |
+
|
17 |
+
/* set style ------------------------------------------------------------------- */
|
18 |
+
public function set_style($style)
|
19 |
+
{
|
20 |
+
$this->style = $style;
|
21 |
+
}
|
22 |
+
/* Get style ------------------------------------------------------------------- */
|
23 |
+
public function get_style()
|
24 |
+
{
|
25 |
+
return $this->style;
|
26 |
+
}
|
27 |
+
|
28 |
+
/* default style ------------------------------------------------------------------- */
|
29 |
+
public function set_default_style()
|
30 |
+
{
|
31 |
+
$this->set_style("default");
|
32 |
+
}
|
33 |
+
|
34 |
+
/* default style ------------------------------------------------------------------- */
|
35 |
+
public function set_primary_style()
|
36 |
+
{
|
37 |
+
$this->set_style("primary");
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
/* check all css class ------------------------------------------------------------------- */
|
42 |
+
public function get_check_all_css_class()
|
43 |
+
{
|
44 |
+
return 'bcheckbox_check_all';
|
45 |
+
}
|
46 |
+
|
47 |
+
/* uncheck all css class ------------------------------------------------------------------- */
|
48 |
+
public function get_uncheck_all_css_class()
|
49 |
+
{
|
50 |
+
return 'bcheckbox_unckeck_all';
|
51 |
+
}
|
52 |
+
|
53 |
+
/* get check uncheck attribute ----------------------------------------------------------*/
|
54 |
+
public function get_check_uncheck_attribute($group_name)
|
55 |
+
{
|
56 |
+
return "data-group=\"$group_name\"";
|
57 |
+
}
|
58 |
+
|
59 |
+
/* define a group -------------------------------------------------------------------*/
|
60 |
+
public function set_group($group_name)
|
61 |
+
{
|
62 |
+
$this->group_name=$group_name;
|
63 |
+
}
|
64 |
+
|
65 |
+
/* define a list -------------------------------------------------------------------*/
|
66 |
+
public function set_list($list_name)
|
67 |
+
{
|
68 |
+
$this->set_group($list_name);
|
69 |
+
$this->list_nodes= array();
|
70 |
+
}
|
71 |
+
|
72 |
+
/* reset group -------------------------------------------------------------------*/
|
73 |
+
public function reset_group()
|
74 |
+
{
|
75 |
+
$this->group_name="";
|
76 |
+
}
|
77 |
+
|
78 |
+
/* reset list -------------------------------------------------------------------*/
|
79 |
+
public function reset_list()
|
80 |
+
{
|
81 |
+
$this->reset_group();
|
82 |
+
$this->list_nodes="";
|
83 |
+
}
|
84 |
+
|
85 |
+
/* is group -------------------------------------------------------------------*/
|
86 |
+
public function is_group()
|
87 |
+
{
|
88 |
+
return($this->group_name!="");
|
89 |
+
}
|
90 |
+
|
91 |
+
/* is list -------------------------------------------------------------------*/
|
92 |
+
public function is_list()
|
93 |
+
{
|
94 |
+
return (is_array($this->list_nodes) && $this->is_group());
|
95 |
+
}
|
96 |
+
|
97 |
+
/* get group name -------------------------------------------------------------------*/
|
98 |
+
public function get_group_name()
|
99 |
+
{
|
100 |
+
return $this->group_name ;
|
101 |
+
}
|
102 |
+
|
103 |
+
/* get list name -------------------------------------------------------------------*/
|
104 |
+
public function get_list_name()
|
105 |
+
{
|
106 |
+
return $this->get_group_name();
|
107 |
+
}
|
108 |
+
|
109 |
+
/* add to list ----------------------------------------------------------------*/
|
110 |
+
public function add_to_list($name, $title)
|
111 |
+
{
|
112 |
+
$index= count($this->list_nodes);
|
113 |
+
$this->list_nodes[$index]['name']= $name;
|
114 |
+
$this->list_nodes[$index]['title']= $title;
|
115 |
+
}
|
116 |
+
|
117 |
+
/* Selected items -----------------------------------------------------------------------------*/
|
118 |
+
public function selected_items($items)
|
119 |
+
{
|
120 |
+
if(!is_array($items))
|
121 |
+
{
|
122 |
+
$items = explode(",",$items);
|
123 |
+
}
|
124 |
+
$this->list_selected_nodes = $items;
|
125 |
+
}
|
126 |
+
|
127 |
+
/* Create list -------------------------------------------------------------*/
|
128 |
+
public function create_list_option()
|
129 |
+
{
|
130 |
+
if($this->is_list())
|
131 |
+
{
|
132 |
+
for($i=0;$i<count($this->list_nodes);$i++)
|
133 |
+
{
|
134 |
+
$checked=0;
|
135 |
+
if(array_search($this->list_nodes[$i]['name'],$this->list_selected_nodes)!==false)
|
136 |
+
{
|
137 |
+
$checked=1;
|
138 |
+
}
|
139 |
+
echo "<div style=\"margin-top: 3px\">";
|
140 |
+
$this->create_grouped_option($this->list_nodes[$i]['name'],$checked);
|
141 |
+
echo " {$this->list_nodes[$i]['title']}</div>";
|
142 |
+
}
|
143 |
+
}else
|
144 |
+
{
|
145 |
+
echo __("You have no lists to create!",'wsr');
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
/* create grouped option ---------------------------------------------------------*/
|
150 |
+
public function create_grouped_option($value, $checked=0)
|
151 |
+
{
|
152 |
+
if($this->is_group())
|
153 |
+
{
|
154 |
+
$this->create_option($this->get_group_name(),$value,$checked);
|
155 |
+
}else
|
156 |
+
{
|
157 |
+
echo __("To use this function you must previously used set_group()",'wsr');
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
/* create grouped option ------------------------------------------------------------------ */
|
162 |
+
public function create_check_all_option($value='bcheckbox_check_unckeck_all', $checked=0)
|
163 |
+
{
|
164 |
+
if($this->is_group())
|
165 |
+
{
|
166 |
+
$this->create_option($this->get_group_name(),$value,$checked,'bcheckbox_check_unckeck_all');
|
167 |
+
}else
|
168 |
+
{
|
169 |
+
echo __("To use this function you must previously used set_group()",'wsr');
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
/* Create check all button ---------------------------------------------------------------*/
|
174 |
+
public function create_check_all_button($title="Check All")
|
175 |
+
{
|
176 |
+
if($this->is_group())
|
177 |
+
{
|
178 |
+
echo "<a {$this->get_check_uncheck_attribute($this->get_group_name())} class=\"btn btn-{$this->get_style()} btn-xs {$this->get_check_all_css_class()}\">
|
179 |
+
<span class=\"glyphicon glyphicon-check\"></span> $title</a>";
|
180 |
+
}else
|
181 |
+
{
|
182 |
+
echo __("To use this function you must previously used set_group()",'wsr');
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
/* Create check all button ---------------------------------------------------------------*/
|
188 |
+
public function create_uncheck_all_button($title="None")
|
189 |
+
{
|
190 |
+
if($this->is_group())
|
191 |
+
{
|
192 |
+
echo "<a {$this->get_check_uncheck_attribute($this->get_group_name())} class=\"btn btn-{$this->get_style()} btn-xs {$this->get_uncheck_all_css_class()}\">
|
193 |
+
<span class=\"glyphicon glyphicon-unchecked\"></span> $title</a>";
|
194 |
+
}else
|
195 |
+
{
|
196 |
+
echo __("To use this function you must previously used set_group()",'wsr');
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
/* Create single check box ------------------------------------------------------------------*/
|
202 |
+
public function create_single_option($name,$checked=0)
|
203 |
+
{
|
204 |
+
if($checked!=0)
|
205 |
+
{
|
206 |
+
$checked=1;
|
207 |
+
}
|
208 |
+
$this->create_option($name,1,$checked);
|
209 |
+
}
|
210 |
+
|
211 |
+
/* Create Check Option -------------------------------------------------------------------*/
|
212 |
+
private function create_option($name, $value, $checked=0, $type='')
|
213 |
+
{
|
214 |
+
$check_html = "";
|
215 |
+
$check_class ="";
|
216 |
+
$brackets="";
|
217 |
+
$data_group="";
|
218 |
+
$id=$name;
|
219 |
+
if($this->is_group())
|
220 |
+
{
|
221 |
+
$data_group="data-group=\"{$name}\"";
|
222 |
+
$brackets="[]";
|
223 |
+
$id= $name . '_' . str_replace(' ','',$value);
|
224 |
+
}
|
225 |
+
if($type!='')
|
226 |
+
{
|
227 |
+
$brackets= "_" . $type;
|
228 |
+
$name= $name . "_" . $type;
|
229 |
+
}
|
230 |
+
if($checked==1)
|
231 |
+
{
|
232 |
+
$check_html = "checked=\"checked\"";
|
233 |
+
$check_class = "active";
|
234 |
+
}
|
235 |
+
echo "<div data-toggle=\"buttons\" {$data_group} data-id=\"{$id}\" class=\"btn-group bcheckbox $type\">
|
236 |
+
<label class=\"btn btn-{$this->get_style()} btn-xs {$check_class} {$name}\" id=\"{$id}_label\" >
|
237 |
+
<input type=\"checkbox\" autocomplete=\"off\" value=\"{$value}\" id=\"{$id}\" name=\"{$name}{$brackets}\" $check_html>
|
238 |
+
<span class=\"glyphicon glyphicon-ok\"></span>
|
239 |
+
</label>
|
240 |
+
</div>";
|
241 |
+
}
|
242 |
+
|
243 |
+
|
244 |
+
|
245 |
+
}
|
246 |
+
}
|
cf/lib/forms/cf.dropdownlist.class.php
ADDED
@@ -0,0 +1,99 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Author: Fakhri Alsadi
|
4 |
+
Date: 16-7-2010
|
5 |
+
Contact: www.clogica.com info@clogica.com
|
6 |
+
A simple class to create Drop down lists easily using PHP
|
7 |
+
----------------------------------------------------------
|
8 |
+
example:
|
9 |
+
----------------------------------------------------------
|
10 |
+
$drop = new dropdownlist('gendar');
|
11 |
+
$drop->add('mail','mail');`
|
12 |
+
$drop->add('femail','femail');
|
13 |
+
$drop->run();
|
14 |
+
$drop->select('femail');
|
15 |
+
//////////////////////////////
|
16 |
+
$drop = new dropdownlist('gendar');
|
17 |
+
$drop->data_bind('data_status');
|
18 |
+
$drop->run();
|
19 |
+
*/
|
20 |
+
|
21 |
+
if(!class_exists('dropdown_list')){
|
22 |
+
class dropdown_list{
|
23 |
+
|
24 |
+
private $name='drop';
|
25 |
+
private $options='';
|
26 |
+
private $class='';
|
27 |
+
private $onchange='';
|
28 |
+
|
29 |
+
function __construct($str,$class='',$onchange='')
|
30 |
+
{
|
31 |
+
$this->name=$str;
|
32 |
+
|
33 |
+
if($class!='')
|
34 |
+
{
|
35 |
+
$this->class=$class;
|
36 |
+
}
|
37 |
+
|
38 |
+
if($onchange!='')
|
39 |
+
{
|
40 |
+
$this->onchange=$onchange;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
public function add($name,$value,$data_icon='')
|
45 |
+
{
|
46 |
+
if($data_icon!='')
|
47 |
+
{
|
48 |
+
$this->options=$this->options. "<option data-icon='$data_icon' value='$value'>$name</option>";
|
49 |
+
}else
|
50 |
+
{
|
51 |
+
$this->options=$this->options. "<option value='$value'>$name</option>";
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
public function onchange($onchange)
|
56 |
+
{
|
57 |
+
$this->onchange=$onchange;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function run(&$jforms=null)
|
61 |
+
{
|
62 |
+
if($this->onchange == '')
|
63 |
+
{
|
64 |
+
echo "<select data-size='5' class='selectpicker' name='" . $this->name. "' id='" . $this->name. "' >" . $this->options . "</select>";
|
65 |
+
|
66 |
+
}else
|
67 |
+
{
|
68 |
+
echo "<select data-size='5' class='selectpicker' name='" . $this->name. "' id='" . $this->name. "' onchange='" . $this->onchange . "' >" . $this->options . "</select>";
|
69 |
+
}
|
70 |
+
|
71 |
+
if(!is_null($jforms))
|
72 |
+
{
|
73 |
+
$jforms->add_select_picker();
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
public function select($str)
|
78 |
+
{
|
79 |
+
echo "<script>document.getElementById('" . $this->name . "').value='".$str."'</script>";
|
80 |
+
}
|
81 |
+
|
82 |
+
public function select_array_option($array,$key)
|
83 |
+
{
|
84 |
+
if(array_key_exists($key,$array))
|
85 |
+
{
|
86 |
+
$this->select($array[$key]);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
public function data_bind($tbl,$name="name",$id="id",$where="",$order="",$limit="")
|
91 |
+
{
|
92 |
+
global $wpdb;
|
93 |
+
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â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/*!
|
2 |
+
* Bootstrap v3.3.5 (http://getbootstrap.com)
|
3 |
+
* Copyright 2011-2015 Twitter, Inc.
|
4 |
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
5 |
+
*/
|
6 |
+
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
|
7 |
+
|
8 |
+
button.list-group-item {
|
9 |
+
color: #555;
|
10 |
+
}
|
11 |
+
a.list-group-item .list-group-item-heading,
|
12 |
+
button.list-group-item .list-group-item-heading {
|
13 |
+
color: #333;
|
14 |
+
}
|
15 |
+
a.list-group-item:hover,
|
16 |
+
button.list-group-item:hover,
|
17 |
+
a.list-group-item:focus,
|
18 |
+
button.list-group-item:focus {
|
19 |
+
color: #555;
|
20 |
+
text-decoration: none;
|
21 |
+
background-color: #f5f5f5;
|
22 |
+
}
|
23 |
+
button.list-group-item {
|
24 |
+
width: 100%;
|
25 |
+
text-align: left;
|
26 |
+
}
|
27 |
+
|
28 |
+
button.list-group-item-success {
|
29 |
+
color: #3c763d;
|
30 |
+
}
|
31 |
+
|
32 |
+
button.list-group-item-success .list-group-item-heading {
|
33 |
+
color: inherit;
|
34 |
+
}
|
35 |
+
|
36 |
+
button.list-group-item-success:hover,
|
37 |
+
a.list-group-item-success:focus,
|
38 |
+
button.list-group-item-success:focus {
|
39 |
+
color: #3c763d;
|
40 |
+
background-color: #d0e9c6;
|
41 |
+
}
|
42 |
+
|
43 |
+
button.list-group-item-success.active,
|
44 |
+
|
45 |
+
button.list-group-item-success.active:hover,
|
46 |
+
|
47 |
+
button.list-group-item-success.active:focus {
|
48 |
+
color: #fff;
|
49 |
+
background-color: #3c763d;
|
50 |
+
border-color: #3c763d;
|
51 |
+
}
|
52 |
+
.list-group-item-info {
|
53 |
+
color: #31708f;
|
54 |
+
background-color: #d9edf7;
|
55 |
+
}
|
56 |
+
|
57 |
+
button.list-group-item-info {
|
58 |
+
color: #31708f;
|
59 |
+
}
|
60 |
+
|
61 |
+
button.list-group-item-info .list-group-item-heading {
|
62 |
+
color: inherit;
|
63 |
+
}
|
64 |
+
|
65 |
+
button.list-group-item-info:hover,
|
66 |
+
|
67 |
+
button.list-group-item-info:focus {
|
68 |
+
color: #31708f;
|
69 |
+
background-color: #c4e3f3;
|
70 |
+
}
|
71 |
+
|
72 |
+
button.list-group-item-info.active,
|
73 |
+
|
74 |
+
button.list-group-item-info.active:hover,
|
75 |
+
|
76 |
+
button.list-group-item-info.active:focus {
|
77 |
+
color: #fff;
|
78 |
+
background-color: #31708f;
|
79 |
+
border-color: #31708f;
|
80 |
+
}
|
81 |
+
.list-group-item-warning {
|
82 |
+
color: #8a6d3b;
|
83 |
+
background-color: #fcf8e3;
|
84 |
+
}
|
85 |
+
|
86 |
+
button.list-group-item-warning {
|
87 |
+
color: #8a6d3b;
|
88 |
+
}
|
89 |
+
|
90 |
+
button.list-group-item-warning .list-group-item-heading {
|
91 |
+
color: inherit;
|
92 |
+
}
|
93 |
+
|
94 |
+
button.list-group-item-warning:hover,
|
95 |
+
|
96 |
+
button.list-group-item-warning:focus {
|
97 |
+
color: #8a6d3b;
|
98 |
+
background-color: #faf2cc;
|
99 |
+
}
|
100 |
+
|
101 |
+
button.list-group-item-warning.active,
|
102 |
+
|
103 |
+
button.list-group-item-warning.active:hover,
|
104 |
+
|
105 |
+
button.list-group-item-warning.active:focus {
|
106 |
+
color: #fff;
|
107 |
+
background-color: #8a6d3b;
|
108 |
+
border-color: #8a6d3b;
|
109 |
+
}
|
110 |
+
.list-group-item-danger {
|
111 |
+
color: #a94442;
|
112 |
+
background-color: #f2dede;
|
113 |
+
}
|
114 |
+
|
115 |
+
button.list-group-item-danger {
|
116 |
+
color: #a94442;
|
117 |
+
}
|
118 |
+
|
119 |
+
button.list-group-item-danger .list-group-item-heading {
|
120 |
+
color: inherit;
|
121 |
+
}
|
122 |
+
|
123 |
+
button.list-group-item-danger:hover,
|
124 |
+
|
125 |
+
button.list-group-item-danger:focus {
|
126 |
+
color: #a94442;
|
127 |
+
background-color: #ebcccc;
|
128 |
+
}
|
129 |
+
|
130 |
+
button.list-group-item-danger.active,
|
131 |
+
|
132 |
+
button.list-group-item-danger.active:hover,
|
133 |
+
|
134 |
+
button.list-group-item-danger.active:focus {
|
135 |
+
color: #fff;
|
136 |
+
background-color: #a94442;
|
137 |
+
border-color: #a94442;
|
138 |
+
}
|
139 |
+
|
140 |
+
.close {
|
141 |
+
float: right;
|
142 |
+
font-size: 21px;
|
143 |
+
font-weight: bold;
|
144 |
+
line-height: 1;
|
145 |
+
color: #000;
|
146 |
+
text-shadow: 0 1px 0 #fff;
|
147 |
+
filter: alpha(opacity=20);
|
148 |
+
opacity: .2;
|
149 |
+
}
|
150 |
+
.close:hover,
|
151 |
+
.close:focus {
|
152 |
+
color: #000;
|
153 |
+
text-decoration: none;
|
154 |
+
cursor: pointer;
|
155 |
+
filter: alpha(opacity=50);
|
156 |
+
opacity: .5;
|
157 |
+
}
|
158 |
+
button.close {
|
159 |
+
-webkit-appearance: none;
|
160 |
+
padding: 0;
|
161 |
+
cursor: pointer;
|
162 |
+
background: transparent;
|
163 |
+
border: 0;
|
164 |
+
}
|
165 |
+
.modal-open {
|
166 |
+
overflow: hidden;
|
167 |
+
}
|
168 |
+
.modal {
|
169 |
+
position: fixed;
|
170 |
+
top: 0;
|
171 |
+
right: 0;
|
172 |
+
bottom: 0;
|
173 |
+
left: 0;
|
174 |
+
z-index: 1050;
|
175 |
+
display: none;
|
176 |
+
overflow: hidden;
|
177 |
+
-webkit-overflow-scrolling: touch;
|
178 |
+
outline: 0;
|
179 |
+
}
|
180 |
+
.modal.fade .modal-dialog {
|
181 |
+
-webkit-transition: -webkit-transform .3s ease-out;
|
182 |
+
-o-transition: -o-transform .3s ease-out;
|
183 |
+
transition: transform .3s ease-out;
|
184 |
+
-webkit-transform: translate(0, -25%);
|
185 |
+
-ms-transform: translate(0, -25%);
|
186 |
+
-o-transform: translate(0, -25%);
|
187 |
+
transform: translate(0, -25%);
|
188 |
+
}
|
189 |
+
.modal.in .modal-dialog {
|
190 |
+
-webkit-transform: translate(0, 0);
|
191 |
+
-ms-transform: translate(0, 0);
|
192 |
+
-o-transform: translate(0, 0);
|
193 |
+
transform: translate(0, 0);
|
194 |
+
}
|
195 |
+
.modal-open .modal {
|
196 |
+
overflow-x: hidden;
|
197 |
+
overflow-y: auto;
|
198 |
+
}
|
199 |
+
.modal-dialog {
|
200 |
+
position: relative;
|
201 |
+
width: auto;
|
202 |
+
margin: 10px;
|
203 |
+
}
|
204 |
+
.modal-content {
|
205 |
+
position: relative;
|
206 |
+
background-color: #fff;
|
207 |
+
-webkit-background-clip: padding-box;
|
208 |
+
background-clip: padding-box;
|
209 |
+
border: 1px solid #999;
|
210 |
+
border: 1px solid rgba(0, 0, 0, .2);
|
211 |
+
border-radius: 6px;
|
212 |
+
outline: 0;
|
213 |
+
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
|
214 |
+
box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
|
215 |
+
}
|
216 |
+
.modal-backdrop {
|
217 |
+
position: fixed;
|
218 |
+
top: 0;
|
219 |
+
right: 0;
|
220 |
+
bottom: 0;
|
221 |
+
left: 0;
|
222 |
+
z-index: 1040;
|
223 |
+
background-color: #000;
|
224 |
+
}
|
225 |
+
.modal-backdrop.fade {
|
226 |
+
filter: alpha(opacity=0);
|
227 |
+
opacity: 0;
|
228 |
+
}
|
229 |
+
.modal-backdrop.in {
|
230 |
+
filter: alpha(opacity=50);
|
231 |
+
opacity: .5;
|
232 |
+
}
|
233 |
+
.modal-header {
|
234 |
+
min-height: 16.42857143px;
|
235 |
+
padding: 15px;
|
236 |
+
border-bottom: 1px solid #e5e5e5;
|
237 |
+
}
|
238 |
+
.modal-header .close {
|
239 |
+
margin-top: -2px;
|
240 |
+
}
|
241 |
+
.modal-title {
|
242 |
+
margin: 0;
|
243 |
+
line-height: 1.42857143;
|
244 |
+
}
|
245 |
+
.modal-body {
|
246 |
+
position: relative;
|
247 |
+
padding: 15px;
|
248 |
+
}
|
249 |
+
.modal-footer {
|
250 |
+
padding: 15px;
|
251 |
+
text-align: right;
|
252 |
+
border-top: 1px solid #e5e5e5;
|
253 |
+
}
|
254 |
+
.modal-footer .btn + .btn {
|
255 |
+
margin-bottom: 0;
|
256 |
+
margin-left: 5px;
|
257 |
+
}
|
258 |
+
.modal-footer .btn-group .btn + .btn {
|
259 |
+
margin-left: -1px;
|
260 |
+
}
|
261 |
+
.modal-footer .btn-block + .btn-block {
|
262 |
+
margin-left: 0;
|
263 |
+
}
|
264 |
+
.modal-scrollbar-measure {
|
265 |
+
position: absolute;
|
266 |
+
top: -9999px;
|
267 |
+
width: 50px;
|
268 |
+
height: 50px;
|
269 |
+
overflow: scroll;
|
270 |
+
}
|
271 |
+
@media (min-width: 768px) {
|
272 |
+
.modal-dialog {
|
273 |
+
width: 600px;
|
274 |
+
margin: 30px auto;
|
275 |
+
}
|
276 |
+
.modal-content {
|
277 |
+
|
278 |
+
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
|
279 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
|
280 |
+
}
|
281 |
+
.modal-sm {
|
282 |
+
width: 300px;
|
283 |
+
}
|
284 |
+
}
|
285 |
+
@media (min-width: 992px) {
|
286 |
+
.modal-lg {
|
287 |
+
width: 900px;
|
288 |
+
}
|
289 |
+
}
|
common/controls.php
ADDED
@@ -0,0 +1,16 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Author: Fakhri Alsadi
|
4 |
+
Date: 16-7-2010
|
5 |
+
Contact: www.clogica.com info@clogica.com mobile: +972599322252
|
6 |
+
|
7 |
+
*/
|
8 |
+
|
9 |
+
include_once "util.php";
|
10 |
+
include_once "controls/datagrid.class.php";
|
11 |
+
include_once "controls/cf_ckeckboxlist.php";
|
12 |
+
include_once "controls/cf_checkoption.php";
|
13 |
+
include_once "controls/cf_datemenu.php";
|
14 |
+
include_once "controls/cf_dropdown.php";
|
15 |
+
include_once "controls/cf_tab.php";
|
16 |
+
include_once "controls/cf_wherest.php";
|
common/controls/cf_checkoption.php
ADDED
@@ -0,0 +1,59 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Author: Fakhri Alsadi
|
4 |
+
Date: 16-7-2010
|
5 |
+
Contact: www.clogica.com info@clogica.com mobile: +972599322252
|
6 |
+
*/
|
7 |
+
|
8 |
+
///@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
9 |
+
///@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
10 |
+
//// class checkoption @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
11 |
+
/*
|
12 |
+
A simple class to create checkbox options
|
13 |
+
|
14 |
+
----------------------------------------------------------
|
15 |
+
example:
|
16 |
+
----------------------------------------------------------
|
17 |
+
$check = new checkoption('redirect_control_panel');
|
18 |
+
$check->check($options['redirect_control_panel'],'1')
|
19 |
+
|
20 |
+
or
|
21 |
+
|
22 |
+
$check = new checkoption('redirect_control_panel',$options['redirect_control_panel'],'1');
|
23 |
+
|
24 |
+
*/
|
25 |
+
|
26 |
+
|
27 |
+
if(!class_exists('checkoption')){
|
28 |
+
class checkoption{
|
29 |
+
|
30 |
+
var $name;
|
31 |
+
|
32 |
+
|
33 |
+
function __construct($name,$check=null,$value='1')
|
34 |
+
{
|
35 |
+
|
36 |
+
$this->name=$name;
|
37 |
+
echo '<input type="checkbox" name="' . $name . '" id="' . $name . '" value="1">';
|
38 |
+
|
39 |
+
if(isset($check))
|
40 |
+
$this->check($check,$value);
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
//---------------------------------------
|
45 |
+
|
46 |
+
function check($check,$value)
|
47 |
+
{
|
48 |
+
if($check==$value)
|
49 |
+
echo "<script type='text/javascript'>document.getElementById('" . $this->name . "').checked=true;</script>";
|
50 |
+
else
|
51 |
+
echo "<script type='text/javascript'>document.getElementById('" . $this->name . "').checked=false;</script>";
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
}}
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
?>
|
common/controls/cf_ckeckboxlist.php
ADDED
@@ -0,0 +1,375 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|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â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!class_exists('ckeckboxlist')){
|
4 |
+
class ckeckboxlist{
|
5 |
+
var $chname="check";
|
6 |
+
var $check;
|
7 |
+
var $script="";
|
8 |
+
var $checkall="Check All";
|
9 |
+
var $precheck="";
|
10 |
+
var $width=100;
|
11 |
+
var $height=100;
|
12 |
+
var $selcolor="CCFFCC";
|
13 |
+
|
14 |
+
|
15 |
+
//----------------------------------------------------------------------
|
16 |
+
function __construct($chname,$width=100,$height=100,$precheck,$selcolor="CCFFCC")
|
17 |
+
{
|
18 |
+
$this->chname=$chname;
|
19 |
+
$this->check = new checkbox($chname);
|
20 |
+
$this->check->chbox_init();
|
21 |
+
$this->width=$width;
|
22 |
+
$this->height=$height;
|
23 |
+
$this->precheck=$precheck;
|
24 |
+
$this->selcolor=$selcolor;
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
//----------------------------------------------------------------------
|
29 |
+
|
30 |
+
function checkalltext($txt)
|
31 |
+
{
|
32 |
+
$this->checkall=$txt;
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
//----------------------------------------------------------------------
|
37 |
+
function ischecked($val)
|
38 |
+
{
|
39 |
+
$chks=explode(',',$this->precheck);
|
40 |
+
for($i=0;$i< count($chks); $i++)
|
41 |
+
{ if($chks[$i]==$val)
|
42 |
+
return'checked';
|
43 |
+
}
|
44 |
+
|
45 |
+
return '';
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
//----------------------------------------------------------------------
|
50 |
+
function additem($val,$txt)
|
51 |
+
{
|
52 |
+
$this->script=$this->script . "<div id='" . $this->check->getcheck($this->check->getcount()+1). "_div' >" . $this->check->get_chbox_add($this->check->getcount()+1,$val,$this->ischecked($val),$this->check->chname . "_div_list_color('" . $this->check->getcheck($this->check->getcount()+1). "')") . "<span style='cursor:hand' onclick=\"". $this->check->chname ."_list_check('" . $this->check->getcheck($this->check->getcount()) . "') \"> $txt</span></div>";
|
53 |
+
}
|
54 |
+
|
55 |
+
//------------------------------------------------------------------------
|
56 |
+
|
57 |
+
function data_bind($tbl,$name="name",$id="id",$where="",$order="",$limit="")
|
58 |
+
{
|
59 |
+
global $mysql;
|
60 |
+
$res=$mysql->sql(" select $name,$id from PREFIX_$tbl $where $order $limit ");
|
61 |
+
while($ar=mysqli_fetch_array($res)){
|
62 |
+
$this->additem($ar[1],$ar[0]);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
//----------------------------------------------------------------------
|
67 |
+
function endlist()
|
68 |
+
{
|
69 |
+
|
70 |
+
|
71 |
+
$js="<script>
|
72 |
+
function " . $this->check->chname . "_list_check(check){
|
73 |
+
if(document.getElementById(check).checked){
|
74 |
+
document.getElementById(check).checked=false;
|
75 |
+
}
|
76 |
+
else
|
77 |
+
{
|
78 |
+
document.getElementById(check).checked=true;
|
79 |
+
}
|
80 |
+
|
81 |
+
" . $this->check->chname . "_div_list_color(check);
|
82 |
+
" . $this->check->chname . "_update();
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
function " . $this->check->chname . "_div_list_color(check){
|
88 |
+
if(document.getElementById(check).checked){
|
89 |
+
document.getElementById(check + '_div').style.backgroundColor='#" . $this->selcolor . "';
|
90 |
+
}
|
91 |
+
else
|
92 |
+
{
|
93 |
+
document.getElementById(check + '_div').style.backgroundColor='';
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
function " . $this->check->chname . "_all_div_list_color()
|
99 |
+
{
|
100 |
+
var count = document.getElementById('" . $this->check->chname . "_count').value;
|
101 |
+
for(i=1;i<=count;i++)
|
102 |
+
" . $this->check->chname . "_div_list_color('" . $this->check->chname . "_box' + i);
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
</script>";
|
107 |
+
|
108 |
+
|
109 |
+
$htm="<div style='background-color: #FFFFF6; width: " . $this->width . "px; height: " . $this->height . "px; overflow:auto;' >";
|
110 |
+
|
111 |
+
echo $js;
|
112 |
+
echo $htm;
|
113 |
+
$this->check->chbox_all($this->check->chname . "_all_div_list_color()");
|
114 |
+
echo $this->checkall . "<br>";
|
115 |
+
echo $this->script;
|
116 |
+
$this->check->chbox_finish();
|
117 |
+
echo "</div>";
|
118 |
+
echo "<script>" . $this->check->chname . "_all_div_list_color()</script>";
|
119 |
+
echo "<script>" . $this->check->chname . "_update()</script>";
|
120 |
+
}
|
121 |
+
|
122 |
+
}}
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
////@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
127 |
+
|
128 |
+
////@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
129 |
+
|
130 |
+
//// checkbox class to create a list of checks ! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
131 |
+
|
132 |
+
/*
|
133 |
+
|
134 |
+
A class to create a custom group of check boxes to use in any report
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
+
------------------------------------------------------------------
|
139 |
+
|
140 |
+
example
|
141 |
+
|
142 |
+
------------------------------------------------------------------
|
143 |
+
|
144 |
+
<?
|
145 |
+
|
146 |
+
$ch = new checkbox('check33');
|
147 |
+
|
148 |
+
$ch->chbox_init();
|
149 |
+
|
150 |
+
?>
|
151 |
+
|
152 |
+
|
153 |
+
|
154 |
+
<? $ch->chbox_all(); ?> Check all <br>
|
155 |
+
|
156 |
+
|
157 |
+
|
158 |
+
<p><? $ch->chbox_add(1,12) ?>i urtiurtowertowet</p>
|
159 |
+
|
160 |
+
<p><? $ch->chbox_add(2,13) ?> oiutoieru twoieurtoe</p>
|
161 |
+
|
162 |
+
<p><? $ch->chbox_add(3,14) ?> wiu riow uerowqeu r</p>
|
163 |
+
|
164 |
+
|
165 |
+
|
166 |
+
<p><? $ch->chbox_finish()?>
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
*/
|
173 |
+
|
174 |
+
////@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
175 |
+
if(!class_exists('checkbox')){
|
176 |
+
class checkbox{
|
177 |
+
|
178 |
+
|
179 |
+
var $chname="check";
|
180 |
+
var $count=0;
|
181 |
+
|
182 |
+
|
183 |
+
//----------------------------------------------------------------------
|
184 |
+
|
185 |
+
function set_sellect_all_functions($fun)
|
186 |
+
|
187 |
+
{
|
188 |
+
|
189 |
+
$this->sellect_all_functions=$fun;
|
190 |
+
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
|
195 |
+
//----------------------------------------------------------------------
|
196 |
+
|
197 |
+
function __construct($chname)
|
198 |
+
|
199 |
+
{
|
200 |
+
|
201 |
+
$this->chname=$chname;
|
202 |
+
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
+
//----------------------------------------------------------------------
|
207 |
+
|
208 |
+
function chbox_init()
|
209 |
+
|
210 |
+
{
|
211 |
+
|
212 |
+
|
213 |
+
$js="
|
214 |
+
|
215 |
+
|
216 |
+
|
217 |
+
<script>
|
218 |
+
|
219 |
+
function " . $this->chname . "_update()
|
220 |
+
|
221 |
+
{
|
222 |
+
|
223 |
+
var check_name='" . $this->chname . "';
|
224 |
+
|
225 |
+
document.getElementById(check_name).value='';
|
226 |
+
|
227 |
+
count=document.getElementById(check_name + '_count').value;
|
228 |
+
|
229 |
+
if(count>0){
|
230 |
+
|
231 |
+
for(i=1;i<=count;i++)
|
232 |
+
|
233 |
+
{
|
234 |
+
|
235 |
+
if(document.getElementById(check_name + '_box' + i ).checked)
|
236 |
+
|
237 |
+
{
|
238 |
+
|
239 |
+
if(document.getElementById(check_name).value =='')
|
240 |
+
|
241 |
+
document.getElementById(check_name).value=document.getElementById(check_name + '_box' + i ).value;
|
242 |
+
|
243 |
+
else
|
244 |
+
|
245 |
+
document.getElementById(check_name).value= document.getElementById(check_name).value + ',' + document.getElementById(check_name + '_box' + i ).value;
|
246 |
+
|
247 |
+
}
|
248 |
+
|
249 |
+
}
|
250 |
+
|
251 |
+
}
|
252 |
+
|
253 |
+
}
|
254 |
+
|
255 |
+
</script>
|
256 |
+
|
257 |
+
|
258 |
+
<script>
|
259 |
+
|
260 |
+
function " . $this->chname . "_checkall()
|
261 |
+
|
262 |
+
{
|
263 |
+
|
264 |
+
count=document.getElementById('" . $this->chname . "_count').value;
|
265 |
+
|
266 |
+
if(count>0){
|
267 |
+
|
268 |
+
|
269 |
+
|
270 |
+
initval=document.getElementById('" . $this->chname . "_allboxes' ).checked;
|
271 |
+
|
272 |
+
for(i=1;i<=count;i++)
|
273 |
+
|
274 |
+
{
|
275 |
+
|
276 |
+
document.getElementById('" . $this->chname . "_box' + i ).checked=initval;
|
277 |
+
|
278 |
+
|
279 |
+
|
280 |
+
}
|
281 |
+
|
282 |
+
}
|
283 |
+
|
284 |
+
" . $this->chname . "_update();
|
285 |
+
|
286 |
+
}
|
287 |
+
|
288 |
+
</script>
|
289 |
+
|
290 |
+
";
|
291 |
+
|
292 |
+
|
293 |
+
|
294 |
+
echo $js;
|
295 |
+
|
296 |
+
}
|
297 |
+
|
298 |
+
|
299 |
+
|
300 |
+
//----------------------------------------------------------------------
|
301 |
+
|
302 |
+
function chbox_all($fun="")
|
303 |
+
|
304 |
+
{
|
305 |
+
|
306 |
+
echo "<input type='checkbox' name='" . $this->chname . "_allboxes' id='" . $this->chname . "_allboxes' onclick=\" " . $this->chname . "_checkall();$fun\" value='ON'>";
|
307 |
+
|
308 |
+
}
|
309 |
+
|
310 |
+
|
311 |
+
//----------------------------------------------------------------------
|
312 |
+
|
313 |
+
function chbox_add($num,$val,$ext='',$onclick='')
|
314 |
+
|
315 |
+
{
|
316 |
+
|
317 |
+
$this->count=$this->count+1;
|
318 |
+
|
319 |
+
echo "<input onclick=\" " . $this->chname . "_update();document.getElementById('" . $this->chname . "_allboxes' ).checked=false;$onclick\" type='checkbox' name='" . $this->chname . "_box". $num ."' id='" . $this->chname . "_box". $num ."' value='" . $val . "' $ext >";
|
320 |
+
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
|
325 |
+
//----------------------------------------------------------------------
|
326 |
+
|
327 |
+
function get_chbox_add($num,$val,$ext='',$onclick='')
|
328 |
+
|
329 |
+
{
|
330 |
+
|
331 |
+
$this->count=$this->count+1;
|
332 |
+
|
333 |
+
return "<input onclick=\" " . $this->chname . "_update();document.getElementById('" . $this->chname . "_allboxes' ).checked=false;$onclick\" type='checkbox' name='" . $this->chname . "_box". $num ."' id='" . $this->chname . "_box". $num ."' value='" . $val . "' $ext >";
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
+
|
338 |
+
//----------------------------------------------------------------------
|
339 |
+
|
340 |
+
function getcheck($num)
|
341 |
+
|
342 |
+
{
|
343 |
+
|
344 |
+
return $this->chname . "_box". $num;
|
345 |
+
|
346 |
+
}
|
347 |
+
|
348 |
+
//----------------------------------------------------------------------
|
349 |
+
|
350 |
+
function getcount()
|
351 |
+
|
352 |
+
{
|
353 |
+
|
354 |
+
return $this->count;
|
355 |
+
|
356 |
+
}
|
357 |
+
|
358 |
+
|
359 |
+
|
360 |
+
//----------------------------------------------------------------------
|
361 |
+
|
362 |
+
function chbox_finish()
|
363 |
+
|
364 |
+
{
|
365 |
+
|
366 |
+
echo "<input type='hidden' name='" . $this->chname . "' id='" . $this->chname . "' size='21'><input type='hidden' name='" . $this->chname . "_count' id='" . $this->chname . "_count' value='" . $this->count . "' >";
|
367 |
+
|
368 |
+
}
|
369 |
+
|
370 |
+
|
371 |
+
}}
|
372 |
+
|
373 |
+
|
374 |
+
|
375 |
+
?>
|
common/controls/cf_datemenu.php
ADDED
@@ -0,0 +1,92 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Author: Fakhri Alsadi
|
4 |
+
|
5 |
+
Date: 16-7-2010
|
6 |
+
|
7 |
+
Contact: www.clogica.com info@clogica.com mobile: +972599322252
|
8 |
+
*/
|
9 |
+
|
10 |
+
///@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
11 |
+
|
12 |
+
///@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
13 |
+
|
14 |
+
//// class datemenu @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
15 |
+
|
16 |
+
/*
|
17 |
+
|
18 |
+
A simple class to create Date menu easily using PHP
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
----------------------------------------------------------
|
23 |
+
|
24 |
+
example:
|
25 |
+
|
26 |
+
----------------------------------------------------------
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
$datemenu = new datemenu();
|
31 |
+
|
32 |
+
$datemenu->date_print('nama','1-1-2009');
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
Note it must beside a form!
|
37 |
+
|
38 |
+
*/
|
39 |
+
|
40 |
+
////@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
if(!class_exists('datemenu')){
|
46 |
+
class datemenu{
|
47 |
+
|
48 |
+
function __construct()
|
49 |
+
|
50 |
+
{
|
51 |
+
|
52 |
+
echo "<script type='text/javascript' src='" . RPATH . "cframework/cf_javascript/calendarDateInput.js'></script>";
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
function date_print($name,$value="")
|
61 |
+
|
62 |
+
{
|
63 |
+
|
64 |
+
if($value=="")
|
65 |
+
|
66 |
+
echo "<script>DateInput('$name', true, 'YYYY-MM-DD')</script>";
|
67 |
+
|
68 |
+
else
|
69 |
+
|
70 |
+
echo "<script>DateInput('$name', true, 'YYYY-MM-DD','$value')</script>";
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
}}
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
?>
|
common/controls/cf_dropdown.php
ADDED
@@ -0,0 +1,91 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Author: Fakhri Alsadi
|
4 |
+
Date: 16-7-2010
|
5 |
+
Contact: www.clogica.com info@clogica.com mobile: +972599322252
|
6 |
+
*/
|
7 |
+
|
8 |
+
///@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
9 |
+
///@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
10 |
+
//// class dropdown @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
11 |
+
/*
|
12 |
+
A simple class to create Drop down lists easily using PHP
|
13 |
+
|
14 |
+
----------------------------------------------------------
|
15 |
+
example:
|
16 |
+
----------------------------------------------------------
|
17 |
+
$drop = new dropdown('gendar');
|
18 |
+
$drop->add('mail','mail');`
|
19 |
+
$drop->add('femail','femail');
|
20 |
+
$drop->dropdown_print();
|
21 |
+
$drop->select('femail');
|
22 |
+
|
23 |
+
|
24 |
+
//////////////////////////////
|
25 |
+
|
26 |
+
$drop = new dropdown('gendar');
|
27 |
+
$drop->data_bind('data_status');
|
28 |
+
$drop->dropdown_print();
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
*/
|
33 |
+
////@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
34 |
+
|
35 |
+
if(!class_exists('dropdown')){
|
36 |
+
class dropdown{
|
37 |
+
|
38 |
+
var $name='drop';
|
39 |
+
var $options='';
|
40 |
+
var $class='';
|
41 |
+
var $onchange='';
|
42 |
+
|
43 |
+
function __construct($str,$class='',$onchange='')
|
44 |
+
{
|
45 |
+
$this->name=$str;
|
46 |
+
|
47 |
+
if($class!='')
|
48 |
+
$this->class=$class;
|
49 |
+
|
50 |
+
if($onchange!='')
|
51 |
+
$this->onchange=$onchange;
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
function add($name,$value)
|
56 |
+
{
|
57 |
+
$this->options=$this->options. "<option value='$value'>$name</option>";
|
58 |
+
}
|
59 |
+
|
60 |
+
function dropdown_print()
|
61 |
+
{
|
62 |
+
if($this->onchange == '')
|
63 |
+
echo "<select size='1' name='" . $this->name. "' id='" . $this->name. "' >" . $this->options . "</select>";
|
64 |
+
else
|
65 |
+
echo "<select size='1' name='" . $this->name. "' id='" . $this->name. "' onchange='" . $this->onchange . "' >" . $this->options . "</select>";
|
66 |
+
}
|
67 |
+
|
68 |
+
function select($str)
|
69 |
+
{
|
70 |
+
echo "<script>document.getElementById('" . $this->name . "').value='".$str."'</script>";
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
function data_bind($tbl,$name="name",$id="id",$where="",$order="",$limit="")
|
75 |
+
{
|
76 |
+
global $wpdb;
|
77 |
+
$res = $wpdb->get_results("select $id,$name from PREFIX_$tbl $where $order $limit ", ARRAY_A);
|
78 |
+
foreach ( $res as $ar){
|
79 |
+
$this->add($ar[1],$ar[0]);
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
}}
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
?>
|
common/controls/cf_tab.php
ADDED
@@ -0,0 +1,114 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Author: Fakhri Alsadi
|
4 |
+
Date: 16-7-2010
|
5 |
+
Contact: www.clogica.com info@clogica.com mobile: +972599322252
|
6 |
+
|
7 |
+
*/
|
8 |
+
|
9 |
+
if(!class_exists('phptab')){
|
10 |
+
class phptab{
|
11 |
+
|
12 |
+
var $tabs; // each tab has num,title,content,parameter.
|
13 |
+
var $parameter = 'tab';
|
14 |
+
var $ignore_parameters='';
|
15 |
+
|
16 |
+
|
17 |
+
function __construct($parameter='tab')
|
18 |
+
{
|
19 |
+
$this->tabs = array();
|
20 |
+
$this->$parameter = $parameter;
|
21 |
+
}
|
22 |
+
|
23 |
+
//----------------------------------------------------------------------------
|
24 |
+
|
25 |
+
function add_file_tab($num, $title, $content, $type )
|
26 |
+
{
|
27 |
+
$index=$this->tabs_count();
|
28 |
+
$this->tabs[$index] = array('num' => $num , 'title'=> $title, 'content'=> $content, 'type' => $type );
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
//----------------------------------------------------------------------------
|
34 |
+
|
35 |
+
function tabs_count()
|
36 |
+
{
|
37 |
+
if(is_array($this->tabs))
|
38 |
+
return count($this->tabs);
|
39 |
+
else
|
40 |
+
return 0;
|
41 |
+
}
|
42 |
+
|
43 |
+
//----------------------------------------------------------------------------
|
44 |
+
|
45 |
+
function set_ignore_parameter($ar)
|
46 |
+
{
|
47 |
+
if(is_array($ar))
|
48 |
+
$this->ignore_parameters =$ar;
|
49 |
+
else
|
50 |
+
$this->ignore_parameters =array($ar);
|
51 |
+
}
|
52 |
+
|
53 |
+
//----------------------------------------------------------------------------
|
54 |
+
|
55 |
+
function get_ignore_parameter($ar)
|
56 |
+
{
|
57 |
+
return $this->ignore_parameters;
|
58 |
+
}
|
59 |
+
|
60 |
+
//----------------------------------------------------------------------------
|
61 |
+
function run()
|
62 |
+
{
|
63 |
+
global $util;
|
64 |
+
|
65 |
+
$tab_index= $util->get($this->parameter);
|
66 |
+
|
67 |
+
if($tab_index=='')
|
68 |
+
$tab_index=$this->tabs[0]['num'];
|
69 |
+
|
70 |
+
$options_path='';
|
71 |
+
if(is_array($this->ignore_parameters))
|
72 |
+
{
|
73 |
+
$ignore=array_merge(array($this->parameter),$this->ignore_parameters);
|
74 |
+
$options_path= $util->get_current_parameters($ignore);
|
75 |
+
}else
|
76 |
+
{
|
77 |
+
$options_path= $util->get_current_parameters($this->parameter);
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
$num_index=-1;
|
82 |
+
echo '<ul class="tabs">';
|
83 |
+
|
84 |
+
for($i=0;$i<$this->tabs_count();$i++)
|
85 |
+
{
|
86 |
+
if($this->tabs[$i]['num']==$tab_index){
|
87 |
+
echo '<li class="active"><a href="' . $options_path . '&' . $this->parameter .'=' . $this->tabs[$i]['num'] . '">' . $this->tabs[$i]['title'] . '</a></li>';
|
88 |
+
$num_index=$i;
|
89 |
+
}
|
90 |
+
else
|
91 |
+
{
|
92 |
+
echo '<li><a href="' . $options_path . '&' . $this->parameter .'=' . $this->tabs[$i]['num'] . '">' . $this->tabs[$i]['title'] . '</a></li>';
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
echo '</ul>';
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
if($num_index>=0)
|
101 |
+
{
|
102 |
+
echo '<div class="tabContainer"><div id="tab1" class="tabContent">';
|
103 |
+
include $util->get_plugin_path() . 'options/' . $this->tabs[$num_index]['content'];
|
104 |
+
echo '</div></div>';
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
}}
|
113 |
+
|
114 |
+
?>
|
common/controls/cf_wherest.php
ADDED
@@ -0,0 +1,91 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Author: Fakhri Alsadi
|
5 |
+
Date: 16-7-2010
|
6 |
+
Contact: www.clogica.com info@clogica.com mobile: +972599322252
|
7 |
+
*/
|
8 |
+
|
9 |
+
|
10 |
+
///@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
11 |
+
|
12 |
+
///@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
13 |
+
|
14 |
+
//// class wherest @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
15 |
+
|
16 |
+
/*
|
17 |
+
A simple class to create Drop down lists easily using PHP
|
18 |
+
----------------------------------------------------------
|
19 |
+
|
20 |
+
example:
|
21 |
+
|
22 |
+
----------------------------------------------------------
|
23 |
+
|
24 |
+
$wherest = new wherest();
|
25 |
+
|
26 |
+
$wherest->add_param("and", "binary tawajoh like '%$msn%' ");
|
27 |
+
|
28 |
+
$wherest->add_text( "some text ");
|
29 |
+
|
30 |
+
$wherest->get_statment();
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
*/
|
35 |
+
|
36 |
+
////@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
37 |
+
|
38 |
+
if(!class_exists('wherest')){
|
39 |
+
class wherest{
|
40 |
+
|
41 |
+
var $where='';
|
42 |
+
|
43 |
+
function add_param($op , $value)
|
44 |
+
|
45 |
+
{
|
46 |
+
if($this->where == '')
|
47 |
+
|
48 |
+
$this->where=" where " . $value . " ";
|
49 |
+
else
|
50 |
+
|
51 |
+
$this->where= $this->where . " " . $op . " " . $value;
|
52 |
+
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
function add_text($value)
|
61 |
+
{
|
62 |
+
$this->where=$this->where . $value ;
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
|
69 |
+
function get_statment()
|
70 |
+
|
71 |
+
{
|
72 |
+
|
73 |
+
return $this->where;
|
74 |
+
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
}}
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
?>
|
common/controls/datagrid.class.php
ADDED
@@ -0,0 +1,633 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|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|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/****************************************************************************
|
3 |
+
* datagrid.class.php
|
4 |
+
*
|
5 |
+
* version 1.0
|
6 |
+
*
|
7 |
+
* This script can be used to create dynamically HTML Tables for your website.
|
8 |
+
*
|
9 |
+
* ----------------------------------------------------------------
|
10 |
+
*
|
11 |
+
* A demo example is included in demo folder.
|
12 |
+
*
|
13 |
+
* Copyright (C) 2012 Fakhri Alsadi <fakrhi.s@hotmail.com>
|
14 |
+
*
|
15 |
+
*******************************************************************************/
|
16 |
+
|
17 |
+
require_once "pagination.class.php";
|
18 |
+
|
19 |
+
if(!class_exists('datagrid')){
|
20 |
+
class datagrid
|
21 |
+
{
|
22 |
+
|
23 |
+
public $pagination;
|
24 |
+
private $table;
|
25 |
+
private $cols;
|
26 |
+
private $ext_fields;
|
27 |
+
private $header;
|
28 |
+
private $body;
|
29 |
+
private $footer;
|
30 |
+
private $data_source;
|
31 |
+
private $filter;
|
32 |
+
private $order;
|
33 |
+
private $paged=true;
|
34 |
+
private $sql;
|
35 |
+
private $no_data_text='No data available to display!';
|
36 |
+
|
37 |
+
//-----------------------------------------------------------------
|
38 |
+
|
39 |
+
public function __construct($data_source='',$filter='')
|
40 |
+
{
|
41 |
+
|
42 |
+
$this->cols = array();
|
43 |
+
$this->ext_fields = array();
|
44 |
+
$this->table = array();
|
45 |
+
|
46 |
+
$this->header = array();
|
47 |
+
$this->body = array();
|
48 |
+
$this->footer = array();
|
49 |
+
|
50 |
+
$this->pagination = new cf_pagination($data_source,$filter);
|
51 |
+
$this->set_data_source($data_source);
|
52 |
+
$this->set_filter($filter);
|
53 |
+
$this->set_table_attr('class','grid');
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
//-----------------------------------------------------------------
|
59 |
+
|
60 |
+
public function set_data_source($data_source)
|
61 |
+
{
|
62 |
+
$this->data_source=$data_source;
|
63 |
+
$this->pagination->set_data_source($data_source);
|
64 |
+
}
|
65 |
+
|
66 |
+
//-----------------------------------------------------------------
|
67 |
+
|
68 |
+
public function get_data_source()
|
69 |
+
{
|
70 |
+
return $this->data_source;
|
71 |
+
}
|
72 |
+
|
73 |
+
//-----------------------------------------------------------------
|
74 |
+
|
75 |
+
public function set_filter($filter)
|
76 |
+
{
|
77 |
+
$this->filter=$filter;
|
78 |
+
$this->pagination->set_filter($filter);
|
79 |
+
}
|
80 |
+
|
81 |
+
//-----------------------------------------------------------------
|
82 |
+
|
83 |
+
public function get_filter()
|
84 |
+
{
|
85 |
+
return $this->filter;
|
86 |
+
}
|
87 |
+
|
88 |
+
//-----------------------------------------------------------------
|
89 |
+
|
90 |
+
public function set_order($order)
|
91 |
+
{
|
92 |
+
$this->order=$order;
|
93 |
+
}
|
94 |
+
|
95 |
+
//-----------------------------------------------------------------
|
96 |
+
|
97 |
+
public function get_order()
|
98 |
+
{
|
99 |
+
return $this->order;
|
100 |
+
}
|
101 |
+
//-----------------------------------------------------------------
|
102 |
+
public function get_cols_count()
|
103 |
+
{
|
104 |
+
return count($this->cols);
|
105 |
+
}
|
106 |
+
//-----------------------------------------------------------------
|
107 |
+
|
108 |
+
public function set_paged($val)
|
109 |
+
{
|
110 |
+
if($val)
|
111 |
+
$this->paged = true;
|
112 |
+
else
|
113 |
+
$this->paged = false;
|
114 |
+
}
|
115 |
+
|
116 |
+
//-----------------------------------------------------------------
|
117 |
+
|
118 |
+
public function is_paged()
|
119 |
+
{
|
120 |
+
return $this->paged;
|
121 |
+
}
|
122 |
+
|
123 |
+
//-----------------------------------------------------------------
|
124 |
+
|
125 |
+
public function set_no_data_text($text)
|
126 |
+
{
|
127 |
+
$this->no_data_text=$text;
|
128 |
+
}
|
129 |
+
|
130 |
+
//-----------------------------------------------------------------
|
131 |
+
|
132 |
+
public function get_no_data_text()
|
133 |
+
{
|
134 |
+
return $this->no_data_text;
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
//-----------------------------------------------------------------
|
140 |
+
|
141 |
+
public function add_data_col($field, $title='')
|
142 |
+
{
|
143 |
+
$newindex=count($this->cols);
|
144 |
+
$this->cols[$newindex]['field']= $field;
|
145 |
+
$this->cols[$newindex]['title']= $title;
|
146 |
+
}
|
147 |
+
|
148 |
+
//-----------------------------------------------------------------
|
149 |
+
|
150 |
+
public function add_html_col($html, $title='')
|
151 |
+
{
|
152 |
+
$newindex=count($this->cols);
|
153 |
+
$this->cols[$newindex]['html']= $html;
|
154 |
+
$this->cols[$newindex]['title']= $title;
|
155 |
+
}
|
156 |
+
|
157 |
+
//-----------------------------------------------------------------
|
158 |
+
|
159 |
+
public function add_php_col($php, $title='')
|
160 |
+
{
|
161 |
+
$newindex=count($this->cols);
|
162 |
+
$this->cols[$newindex]['php']= $php;
|
163 |
+
$this->cols[$newindex]['title']= $title;
|
164 |
+
}
|
165 |
+
|
166 |
+
//-----------------------------------------------------------------
|
167 |
+
|
168 |
+
public function add_template_col($template,$param='', $title='')
|
169 |
+
{
|
170 |
+
$newindex=count($this->cols);
|
171 |
+
$this->cols[$newindex]['template']= $template;
|
172 |
+
$this->cols[$newindex]['title']= $title;
|
173 |
+
$this->cols[$newindex]['param']= $param;
|
174 |
+
}
|
175 |
+
|
176 |
+
//-----------------------------------------------------------------
|
177 |
+
|
178 |
+
private function get_rs_field_name($field)
|
179 |
+
{
|
180 |
+
//$field=strtolower($field);
|
181 |
+
$fileds=explode(".",$field);
|
182 |
+
$field=$fileds[count($fileds)-1];
|
183 |
+
$fileds=explode("as",$field);
|
184 |
+
$field=trim($fileds[count($fileds)-1]);
|
185 |
+
return $field;
|
186 |
+
}
|
187 |
+
|
188 |
+
//-----------------------------------------------------------------
|
189 |
+
|
190 |
+
private function get_select_fields()
|
191 |
+
{
|
192 |
+
$result="";
|
193 |
+
for($i=0;$i<count($this->cols);$i++)
|
194 |
+
{
|
195 |
+
|
196 |
+
if(array_key_exists('field',$this->cols[$i]) && $this->cols[$i]['field']!='')
|
197 |
+
{
|
198 |
+
if($result=="")
|
199 |
+
$result=$this->cols[$i]['field'];
|
200 |
+
else
|
201 |
+
$result= $result . ',' . $this->cols[$i]['field'];
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
+
for($i=0;$i<count($this->ext_fields);$i++)
|
207 |
+
{
|
208 |
+
if($this->ext_fields[$i]!='')
|
209 |
+
{
|
210 |
+
if($result=="")
|
211 |
+
$result=$this->ext_fields[$i];
|
212 |
+
else
|
213 |
+
$result= $result . ',' . $this->ext_fields[$i];
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
|
218 |
+
return $result;
|
219 |
+
}
|
220 |
+
|
221 |
+
//-----------------------------------------------------------------
|
222 |
+
|
223 |
+
public function add_select_field($field)
|
224 |
+
{
|
225 |
+
$this->ext_fields[count($this->ext_fields)]=$field;
|
226 |
+
}
|
227 |
+
|
228 |
+
|
229 |
+
//-----------------------------------------------------------------
|
230 |
+
|
231 |
+
|
232 |
+
private function &get_handler($group='')
|
233 |
+
{
|
234 |
+
$group = strtolower($group);
|
235 |
+
$handler="";
|
236 |
+
if($group=='header')
|
237 |
+
$handler=&$this->header;
|
238 |
+
else if($group=='footer')
|
239 |
+
$handler=&$this->footer;
|
240 |
+
else
|
241 |
+
$handler=&$this->body;
|
242 |
+
|
243 |
+
return $handler;
|
244 |
+
}
|
245 |
+
|
246 |
+
//-----------------------------------------------------------------
|
247 |
+
|
248 |
+
public function set_col_attr($index,$attr,$val,$group='')
|
249 |
+
{
|
250 |
+
|
251 |
+
if($index>0)
|
252 |
+
$index = $index -1;
|
253 |
+
else
|
254 |
+
$index=0;
|
255 |
+
|
256 |
+
$handler=&$this->get_handler($group);
|
257 |
+
$handler['col'][intval($index)][$attr]=$val;
|
258 |
+
|
259 |
+
}
|
260 |
+
|
261 |
+
//-----------------------------------------------------------------
|
262 |
+
|
263 |
+
public function get_col_attr($index,$attr,$group='')
|
264 |
+
{
|
265 |
+
|
266 |
+
if($index>0)
|
267 |
+
$index = $index -1;
|
268 |
+
else
|
269 |
+
$index=0;
|
270 |
+
|
271 |
+
$handler=&$this->get_handler($group);
|
272 |
+
return $handler['col'][intval($index)][$attr];
|
273 |
+
}
|
274 |
+
|
275 |
+
//-----------------------------------------------------------------
|
276 |
+
|
277 |
+
public function set_rows_attr($attr,$val,$group='')
|
278 |
+
{
|
279 |
+
|
280 |
+
$handler=&$this->get_handler($group);
|
281 |
+
$handler[rows][$attr]=$val;
|
282 |
+
|
283 |
+
}
|
284 |
+
|
285 |
+
//-----------------------------------------------------------------
|
286 |
+
|
287 |
+
public function get_rows_attr($attr,$group='')
|
288 |
+
{
|
289 |
+
$handler=&$this->get_handler($group);
|
290 |
+
return $handler[rows][$attr];
|
291 |
+
}
|
292 |
+
|
293 |
+
//-----------------------------------------------------------------
|
294 |
+
|
295 |
+
public function set_table_attr($attr,$val)
|
296 |
+
{
|
297 |
+
$this->table[$attr]=$val;
|
298 |
+
|
299 |
+
}
|
300 |
+
|
301 |
+
//-----------------------------------------------------------------
|
302 |
+
|
303 |
+
public function get_table_attr($attr)
|
304 |
+
{
|
305 |
+
return $this->table[$attr];
|
306 |
+
}
|
307 |
+
|
308 |
+
//-----------------------------------------------------------------
|
309 |
+
|
310 |
+
private function is_html_attr($attr)
|
311 |
+
{
|
312 |
+
$reserved[0]='data_field';
|
313 |
+
$reserved[1]='html';
|
314 |
+
$reserved[2]='text';
|
315 |
+
$reserved[3]='php';
|
316 |
+
|
317 |
+
return !in_array(strtolower($attr),$reserved);
|
318 |
+
}
|
319 |
+
|
320 |
+
//-----------------------------------------------------------------
|
321 |
+
|
322 |
+
private function get_attrs($elem)
|
323 |
+
{
|
324 |
+
$attrs="";
|
325 |
+
if(is_array($elem))
|
326 |
+
foreach($elem as $attr => $value)
|
327 |
+
{
|
328 |
+
if($this->is_html_attr($attr))
|
329 |
+
{
|
330 |
+
$attrs = $attrs . " " . $attr . "=" . "\"" . $value . "\"";
|
331 |
+
}
|
332 |
+
}
|
333 |
+
return $attrs;
|
334 |
+
}
|
335 |
+
|
336 |
+
|
337 |
+
//-----------------------------------------------------------------
|
338 |
+
|
339 |
+
private function fill_data()
|
340 |
+
{
|
341 |
+
global $wpdb,$table_prefix;
|
342 |
+
|
343 |
+
if($this->get_data_source() == '' )
|
344 |
+
die("No Data Source Specified!");
|
345 |
+
|
346 |
+
$title= array();
|
347 |
+
for($i=0;$i<count($this->cols);$i++)
|
348 |
+
{
|
349 |
+
$title[$i]=$this->cols[$i]['title'];
|
350 |
+
}
|
351 |
+
if(is_array($title))
|
352 |
+
$this->insert_row($title,'header');
|
353 |
+
|
354 |
+
|
355 |
+
$fields=$this->get_select_fields();
|
356 |
+
$tables=$this->get_data_source();
|
357 |
+
$filter=$this->get_filter();
|
358 |
+
$limit='';
|
359 |
+
$order=$this->get_order();
|
360 |
+
|
361 |
+
if($order!='')
|
362 |
+
$order=' order by ' . $order;
|
363 |
+
|
364 |
+
if($filter !='')
|
365 |
+
{
|
366 |
+
$filter = "where $filter";
|
367 |
+
}
|
368 |
+
|
369 |
+
|
370 |
+
if($this->is_paged())
|
371 |
+
{
|
372 |
+
$limit= $this->pagination->get_sql_limit();
|
373 |
+
}
|
374 |
+
|
375 |
+
|
376 |
+
// /$sql1= " select $fields from $tables $filter $order $limit ";
|
377 |
+
$url=isset($_REQUEST['tab'])?$_REQUEST['tab']:"";
|
378 |
+
|
379 |
+
$table_seo_name=$table_prefix.'WP_SEO_Redirection_LOG';
|
380 |
+
if($url=="history")
|
381 |
+
{
|
382 |
+
$sql= " select $fields from $tables $filter $order $limit ";
|
383 |
+
}
|
384 |
+
else {
|
385 |
+
|
386 |
+
$sql = "select $fields, (SELECT count(ID) FROM $table_seo_name where `rfrom` = redirect_from and `rto` = redirect_to ) as redirect_hits, (SELECT `ctime` FROM $table_seo_name where `rfrom` = redirect_from and `rto` = redirect_to order by `ctime` desc limit 1) as redirect_last_access from $tables $filter $order $limit";
|
387 |
+
}
|
388 |
+
|
389 |
+
$this->sql=$sql;
|
390 |
+
$res= $wpdb->get_results($sql,ARRAY_A);
|
391 |
+
$row_count=0;
|
392 |
+
$j;
|
393 |
+
$page_num = isset( $_REQUEST['page_num'] ) ? absint( $_REQUEST['page_num'] ) : 1;
|
394 |
+
$offset =( ( $page_num - 1 ) * $this->pagination->get_rows())+1;
|
395 |
+
|
396 |
+
// $start=$this->pagination->get_rows() * $offset;
|
397 |
+
|
398 |
+
|
399 |
+
$j=$offset;
|
400 |
+
|
401 |
+
|
402 |
+
|
403 |
+
foreach ( $res as $ar){
|
404 |
+
$row_count++;
|
405 |
+
|
406 |
+
$ar['row_count']=$row_count;
|
407 |
+
|
408 |
+
extract($ar, EXTR_PREFIX_ALL, "db");
|
409 |
+
|
410 |
+
$row= array();
|
411 |
+
|
412 |
+
for($i=0;$i<count($this->cols);$i++)
|
413 |
+
{
|
414 |
+
|
415 |
+
if(array_key_exists('field',$this->cols[$i]) && $this->cols[$i]['field']!='')
|
416 |
+
{
|
417 |
+
$row[$i]=$ar[$this->get_rs_field_name($this->cols[$i]['field'])];
|
418 |
+
|
419 |
+
|
420 |
+
}
|
421 |
+
elseif(array_key_exists('field',$this->cols[$i]) && $this->cols[$i]['field']==''&&$this->cols[$i]['title']=='Hits')
|
422 |
+
{
|
423 |
+
|
424 |
+
$row[$i]=$ar['redirect_hits'];
|
425 |
+
}
|
426 |
+
elseif(array_key_exists('field',$this->cols[$i]) && $this->cols[$i]['field']==''&&$this->cols[$i]['title']=='Last Access')
|
427 |
+
{
|
428 |
+
$row[$i]=$ar['redirect_last_access'];
|
429 |
+
}
|
430 |
+
elseif(array_key_exists('field',$this->cols[$i]) && $this->cols[$i]['field']==''&&$this->cols[$i]['title']=='No')
|
431 |
+
{
|
432 |
+
|
433 |
+
$row[$i]=$j++;
|
434 |
+
}
|
435 |
+
else if(array_key_exists('php',$this->cols[$i]) && $this->cols[$i]['php']!='')
|
436 |
+
{
|
437 |
+
$row[$i]=@eval(str_ireplace('echo','return',$this->cols[$i]['php']));
|
438 |
+
|
439 |
+
|
440 |
+
}else if(array_key_exists('html',$this->cols[$i]) && $this->cols[$i]['html']!='')
|
441 |
+
{
|
442 |
+
$html = $this->cols[$i]['html'];
|
443 |
+
foreach ($ar as $key => $value)
|
444 |
+
{
|
445 |
+
$key_var = "db_" . $key;
|
446 |
+
$html=str_ireplace('{' . $key_var . '}', $$key_var , $html);
|
447 |
+
}
|
448 |
+
|
449 |
+
$row[$i]= $html;
|
450 |
+
|
451 |
+
}else if(array_key_exists('template',$this->cols[$i]) && $this->cols[$i]['template']!='')
|
452 |
+
|
453 |
+
{
|
454 |
+
global $template;
|
455 |
+
$temp = $this->cols[$i]['template'];
|
456 |
+
$params = $this->cols[$i]['param'];
|
457 |
+
$content = $template[$temp]['content'];
|
458 |
+
|
459 |
+
|
460 |
+
|
461 |
+
if(is_array($params))
|
462 |
+
for($j=0;$j<count($params);$j++)
|
463 |
+
{
|
464 |
+
$content=str_ireplace('{param' . $j . '}', $params[$j] , $content);
|
465 |
+
}else
|
466 |
+
{
|
467 |
+
$content=str_ireplace('{param}' , $params , $content);
|
468 |
+
|
469 |
+
}
|
470 |
+
|
471 |
+
if(is_array($template[$temp]['options']))
|
472 |
+
{
|
473 |
+
foreach ($template[$temp]['options'] as $key => $value )
|
474 |
+
{
|
475 |
+
$this->set_col_attr($i+1,$key,$value);
|
476 |
+
}
|
477 |
+
|
478 |
+
}
|
479 |
+
|
480 |
+
|
481 |
+
foreach ($ar as $key => $value)
|
482 |
+
{
|
483 |
+
$key_var = "db_" . $key;
|
484 |
+
$content=str_ireplace('{' . $key_var . '}', $$key_var , $content);
|
485 |
+
}
|
486 |
+
|
487 |
+
$row[$i]= $content;
|
488 |
+
|
489 |
+
}
|
490 |
+
}
|
491 |
+
|
492 |
+
$this->insert_row($row);
|
493 |
+
/// print_r($row);
|
494 |
+
}
|
495 |
+
|
496 |
+
|
497 |
+
}
|
498 |
+
|
499 |
+
//-----------------------------------------------------------------
|
500 |
+
|
501 |
+
public function run()
|
502 |
+
{
|
503 |
+
|
504 |
+
$this->fill_data();
|
505 |
+
|
506 |
+
$this->show_table();
|
507 |
+
|
508 |
+
if(!array_key_exists('data',$this->body) || count($this->body['data'])==0)
|
509 |
+
{
|
510 |
+
echo '<div'. $this->get_attrs($this->table) .'><p align="center">' . $this->no_data_text . '</p></div>';
|
511 |
+
|
512 |
+
}
|
513 |
+
if($this->is_paged())
|
514 |
+
{
|
515 |
+
echo "<BR/>";
|
516 |
+
$this->pagination->print_pagination();
|
517 |
+
}
|
518 |
+
}
|
519 |
+
|
520 |
+
|
521 |
+
//-----------------------------------------------------------------
|
522 |
+
|
523 |
+
private function insert_row($array, $group='')
|
524 |
+
{
|
525 |
+
$handler=&$this->get_handler($group);
|
526 |
+
|
527 |
+
if(!array_key_exists('data',$handler))
|
528 |
+
{
|
529 |
+
$handler['data']= array();
|
530 |
+
}
|
531 |
+
|
532 |
+
$handler['data'][count($handler['data'])]=$array;
|
533 |
+
}
|
534 |
+
|
535 |
+
|
536 |
+
//-----------------------------------------------------------------
|
537 |
+
|
538 |
+
private function update_row($index, $array, $group='')
|
539 |
+
{
|
540 |
+
$handler=&$this->get_handler($group);
|
541 |
+
$handler['data'][$index]=$array;
|
542 |
+
}
|
543 |
+
|
544 |
+
//-----------------------------------------------------------------
|
545 |
+
|
546 |
+
private function show_table()
|
547 |
+
{
|
548 |
+
|
549 |
+
$body=&$this->get_handler();
|
550 |
+
$header=&$this->get_handler('header');
|
551 |
+
$footer=&$this->get_handler('footer');
|
552 |
+
|
553 |
+
// print the table tag start
|
554 |
+
|
555 |
+
echo '<table class="wp-list-table widefat fixed striped "'. $this->get_attrs($this->table) .'>';
|
556 |
+
|
557 |
+
if(array_key_exists('data',$header) && count($header['data'])>0){
|
558 |
+
echo '<thead>';
|
559 |
+
for($i=0;$i< count($header['data']);$i++)
|
560 |
+
$this->get_html_row($i,'header');
|
561 |
+
echo '</thead>';
|
562 |
+
}
|
563 |
+
|
564 |
+
if(array_key_exists('data',$footer) && count($footer['data'])>0){
|
565 |
+
echo '<tfoot>';
|
566 |
+
for($i=0;$i< count($footer['data']);$i++)
|
567 |
+
$this->get_html_row($i,'footer');
|
568 |
+
echo '</tfoot>';
|
569 |
+
}
|
570 |
+
|
571 |
+
if(array_key_exists('data',$body) && count($body['data'])>0){
|
572 |
+
echo '<tbody>';
|
573 |
+
for($i=0;$i< count($body['data']);$i++)
|
574 |
+
$this->get_html_row($i);
|
575 |
+
echo '</tbody>';
|
576 |
+
}
|
577 |
+
//print the table tag end
|
578 |
+
echo '</table>';
|
579 |
+
}
|
580 |
+
|
581 |
+
//-----------------------------------------------------------------
|
582 |
+
|
583 |
+
private function get_html_row($index, $group='')
|
584 |
+
{
|
585 |
+
|
586 |
+
$handler=&$this->get_handler($group);
|
587 |
+
$row=$handler['data'][$index];
|
588 |
+
|
589 |
+
$col_limit=$this->get_cols_count();
|
590 |
+
if(count($row)<$col_limit)
|
591 |
+
$col_limit=count($row) ;
|
592 |
+
|
593 |
+
//print row tag start
|
594 |
+
$trattr='';
|
595 |
+
$tdattr='';
|
596 |
+
|
597 |
+
|
598 |
+
if(array_key_exists('rows',$handler))
|
599 |
+
$trattr=$this->get_attrs($handler['rows']);
|
600 |
+
|
601 |
+
echo '<tr'. $trattr .'>';
|
602 |
+
for($i=0;$i<$col_limit;$i++)
|
603 |
+
{
|
604 |
+
|
605 |
+
|
606 |
+
|
607 |
+
if(array_key_exists('col',$handler) && is_array($handler['col']) && array_key_exists($i,$handler['col']))
|
608 |
+
$tdattr=$this->get_attrs($handler['col'][$i]);
|
609 |
+
else
|
610 |
+
$tdattr='';
|
611 |
+
|
612 |
+
|
613 |
+
echo '<td' . $tdattr . '>' . $row[$i] . '</td>';
|
614 |
+
}
|
615 |
+
echo '</tr>';
|
616 |
+
|
617 |
+
}
|
618 |
+
|
619 |
+
//-----------------------------------------------------------------
|
620 |
+
|
621 |
+
public function get_sql()
|
622 |
+
{
|
623 |
+
return $this->sql;
|
624 |
+
}
|
625 |
+
|
626 |
+
|
627 |
+
|
628 |
+
}}
|
629 |
+
|
630 |
+
|
631 |
+
|
632 |
+
|
633 |
+
?>
|
common/controls/pagination.class.php
ADDED
@@ -0,0 +1,682 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|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Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/****************************************************************************
|
3 |
+
* pagination.class.php
|
4 |
+
*
|
5 |
+
* version 1.0
|
6 |
+
*
|
7 |
+
* This script can be used to generate dynamically pagination for any list of rows or items from MySQL Database
|
8 |
+
*
|
9 |
+
* ----------------------------------------------------------------
|
10 |
+
*
|
11 |
+
* A demo example is included in demo folder.
|
12 |
+
*
|
13 |
+
* Copyright (C) 2012 Fakhri Alsadi <fakrhi.s@hotmail.com>
|
14 |
+
*
|
15 |
+
*******************************************************************************/
|
16 |
+
|
17 |
+
if(!class_exists('cf_pagination')){
|
18 |
+
class cf_pagination{
|
19 |
+
|
20 |
+
private $rows=15; //The rows per page.
|
21 |
+
private $table_rows_count; //The total rows to show.
|
22 |
+
private $pages_count; //The pages number to generate.
|
23 |
+
private $current_page=1; //The number of the current page displayed.
|
24 |
+
private $start=0; //The start of the mysql limit keyword.
|
25 |
+
private $printed_pages=7; //Number of pages to display.
|
26 |
+
private $parameter='page_num'; //The pgination paramerter name.
|
27 |
+
private $url_rewrite=''; //The URL rewrite structure.
|
28 |
+
private $data_source; //The MySQL Table or Tables used.
|
29 |
+
private $filter; //The MySQL Where clouse.
|
30 |
+
private $current_parameters; //The existing query string parameters
|
31 |
+
private $prev_page; //The previous page.
|
32 |
+
private $next_page; //The next page
|
33 |
+
private $run_count=0; //Times that the funtion run() invoked.
|
34 |
+
private $show_pages_number=true; //Pages number box status.
|
35 |
+
private $show_go_button=true; //Showing Go button status.
|
36 |
+
private $show_prev_next=true; //Showing pervious and next page buttons status.
|
37 |
+
private $show_first_last=true; //Showing first and last page buttons status.
|
38 |
+
private $direction=''; //The direction of pagination.
|
39 |
+
private $alignment=''; //The alignment of pagination.
|
40 |
+
private $go_button_text= "GO"; //Set text of Go button
|
41 |
+
private $pages_number_text= "of pages"; //Set text of pages number
|
42 |
+
private $next_page_text= ">"; //Set text of next page button
|
43 |
+
private $prev_page_text= "<"; //Set text of previous button
|
44 |
+
private $first_page_text= "<<"; //Set text of first page button
|
45 |
+
private $last_page_text= ">>"; //Set text of last button
|
46 |
+
private $invalid_page_number_text= "invalid page number!"; //Set text of invalid page number error
|
47 |
+
|
48 |
+
public function __construct($data_source='',$filter='',$rows=15,$parameter='page_num')
|
49 |
+
{
|
50 |
+
$this->data_source=$data_source;
|
51 |
+
$this->set_filter($filter);
|
52 |
+
$this->rows=$rows;
|
53 |
+
$this->parameter= $parameter;
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
//------------------------------------------------------------------------
|
58 |
+
|
59 |
+
private function run()
|
60 |
+
{
|
61 |
+
global $wpdb;
|
62 |
+
|
63 |
+
if($this->run_count == 0)
|
64 |
+
{
|
65 |
+
|
66 |
+
if($this->data_source== '')
|
67 |
+
{
|
68 |
+
echo 'You must set the Data Source using the function set_data_source($data_source)';
|
69 |
+
exit(0);
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
$sql=" select count(*) as cnt from {$this->data_source} {$this->filter} ";
|
75 |
+
$result=$wpdb->get_row($sql);
|
76 |
+
$this->table_rows_count = intval($result->cnt);
|
77 |
+
|
78 |
+
|
79 |
+
$this->pages_count = intval($this->table_rows_count/$this->rows);
|
80 |
+
if($this->table_rows_count%$this->rows !=0)
|
81 |
+
$this->pages_count=$this->pages_count+1;
|
82 |
+
if($this->pages_count ==0)
|
83 |
+
$this->pages_count=1;
|
84 |
+
|
85 |
+
if(array_key_exists($this->parameter,$_GET))
|
86 |
+
$this->current_page = intval($_GET[$this->parameter]);
|
87 |
+
else
|
88 |
+
$this->current_page =1;
|
89 |
+
|
90 |
+
if($this->current_page<1)
|
91 |
+
$this->current_page=1;
|
92 |
+
else if($this->current_page > $this->pages_count)
|
93 |
+
$this->current_page=$this->pages_count;
|
94 |
+
|
95 |
+
$this->current_parameters = $this->get_current_parameters($this->parameter);
|
96 |
+
$this->prev_page= $this->current_page -1;
|
97 |
+
$this->next_page= $this->current_page +1;
|
98 |
+
|
99 |
+
$this->start = (($this->current_page - 1) * $this->rows);
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
$this->run_count ++;
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
//------------------------------------------------------------------------
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
public function print_pagination()
|
113 |
+
{
|
114 |
+
|
115 |
+
$this->run();
|
116 |
+
|
117 |
+
$this->pagination_header_html();
|
118 |
+
|
119 |
+
if($this->current_page > 1)
|
120 |
+
{
|
121 |
+
if($this->show_first_last)
|
122 |
+
echo $this->get_page_html(1,$this->first_page_text);
|
123 |
+
if($this->show_prev_next)
|
124 |
+
echo $this->get_page_html($this->prev_page,$this->prev_page_text );
|
125 |
+
}
|
126 |
+
|
127 |
+
$stop=0;
|
128 |
+
$half_pages="";
|
129 |
+
$frompage="";
|
130 |
+
$topage ="";
|
131 |
+
|
132 |
+
if($this->printed_pages>1){
|
133 |
+
|
134 |
+
$half_pages= intval($this->printed_pages/2);
|
135 |
+
if($this->printed_pages%$half_pages ==0)
|
136 |
+
$half_pages--;
|
137 |
+
|
138 |
+
$frompage=($this->current_page - $half_pages );
|
139 |
+
$topage = ($this->current_page + $this->printed_pages);
|
140 |
+
|
141 |
+
}
|
142 |
+
|
143 |
+
if($this->printed_pages==1)
|
144 |
+
{
|
145 |
+
$frompage = $this->current_page;
|
146 |
+
$topage = $this->current_page;
|
147 |
+
}
|
148 |
+
|
149 |
+
if($this->printed_pages==3)
|
150 |
+
{
|
151 |
+
$frompage = $this->current_page -1;
|
152 |
+
$topage = $this->current_page + 1 ;
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
if($this->current_page > ( $this->pages_count - ($this->printed_pages - $half_pages ) ))
|
157 |
+
{
|
158 |
+
$topage = $this->pages_count ;
|
159 |
+
$frompage= ( $this->pages_count - $this->printed_pages +1 );
|
160 |
+
}
|
161 |
+
|
162 |
+
for($i=$frompage;$i<=$topage;$i++)
|
163 |
+
{
|
164 |
+
|
165 |
+
if($i>0 && $i<=$this->pages_count && $this->pages_count>1)
|
166 |
+
{
|
167 |
+
if($i==$this->current_page)
|
168 |
+
echo $this->get_current_page_html($i);
|
169 |
+
else
|
170 |
+
echo $this->get_page_html($i,$i);
|
171 |
+
|
172 |
+
$stop++;
|
173 |
+
if($stop >= $this->printed_pages)
|
174 |
+
break;
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
178 |
+
|
179 |
+
|
180 |
+
if($this->current_page >= 1 && $this->pages_count>1 && $this->current_page< $this->pages_count)
|
181 |
+
{
|
182 |
+
if($this->show_prev_next)
|
183 |
+
echo $this->get_page_html($this->next_page,$this->next_page_text);
|
184 |
+
if($this->show_first_last)
|
185 |
+
echo $this->get_page_html($this->pages_count,$this->last_page_text);
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
|
190 |
+
echo $this->get_pages_number_html();
|
191 |
+
echo $this->get_go_button_html();
|
192 |
+
|
193 |
+
$this->pagination_footer_html();
|
194 |
+
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
//------------------------------------------------------------------------
|
199 |
+
|
200 |
+
private function get_page_html($page,$name)
|
201 |
+
{
|
202 |
+
return '<a href="' . $this->get_page_url($page) . '">' . $name . '</a>';
|
203 |
+
}
|
204 |
+
|
205 |
+
//------------------------------------------------------------------------
|
206 |
+
|
207 |
+
private function get_current_page_html($name)
|
208 |
+
{
|
209 |
+
|
210 |
+
return '<span class="currentpage">' . $name . '</span>';
|
211 |
+
}
|
212 |
+
|
213 |
+
//------------------------------------------------------------------------
|
214 |
+
|
215 |
+
private function pagination_header_html()
|
216 |
+
{
|
217 |
+
|
218 |
+
$options="";
|
219 |
+
if($this->direction!='')
|
220 |
+
$options= $options . ' dir="' . $this->direction . '" ';
|
221 |
+
|
222 |
+
if($this->alignment!='')
|
223 |
+
$options= $options . ' align="' . $this->alignment . '" ';
|
224 |
+
|
225 |
+
|
226 |
+
echo '<div style="text-align:right;" class="pagination tablenav-page" ' . $options . ' >';
|
227 |
+
|
228 |
+
|
229 |
+
}
|
230 |
+
|
231 |
+
//------------------------------------------------------------------------
|
232 |
+
|
233 |
+
private function pagination_footer_html()
|
234 |
+
{
|
235 |
+
echo '</div>';
|
236 |
+
}
|
237 |
+
|
238 |
+
//------------------------------------------------------------------------
|
239 |
+
|
240 |
+
private function random_id()
|
241 |
+
{
|
242 |
+
srand ((double) microtime( )*1000000000);
|
243 |
+
return rand();
|
244 |
+
}
|
245 |
+
|
246 |
+
//------------------------------------------------------------------------
|
247 |
+
private function get_go_button_html()
|
248 |
+
{
|
249 |
+
|
250 |
+
$id='gopage' . $this->random_id();
|
251 |
+
|
252 |
+
$url_structure="";
|
253 |
+
if($this->url_rewrite !='')
|
254 |
+
$url_structure = $this->url_rewrite;
|
255 |
+
else
|
256 |
+
$url_structure = $this->get_page_url_parameter() . '{pagination}';
|
257 |
+
|
258 |
+
if($this->show_go_button)
|
259 |
+
echo '<script>
|
260 |
+
function fun_'. $id .'()
|
261 |
+
{
|
262 |
+
var page=parseInt(document.getElementById(\''. $id .'\').value);
|
263 |
+
var url = "' . $url_structure . '";
|
264 |
+
if(page>0)
|
265 |
+
{
|
266 |
+
window.location= url.replace(/{pagination}/gi, page);
|
267 |
+
}else
|
268 |
+
{
|
269 |
+
alert(\'' . $this->invalid_page_number_text . '\');
|
270 |
+
}
|
271 |
+
}
|
272 |
+
function keypress_'. $id .'(event)
|
273 |
+
{
|
274 |
+
var key=event.keyCode;
|
275 |
+
|
276 |
+
if(key == 13)
|
277 |
+
{
|
278 |
+
fun_'. $id .'();
|
279 |
+
return false;
|
280 |
+
}
|
281 |
+
}
|
282 |
+
</script><input onkeydown="return keypress_'. $id .'(event)" type="text" name="' . $id . '" id="' . $id . '" size="3" value="' . $this->current_page . '" ><a onclick="fun_'. $id .'()" href="#">' . $this->go_button_text .'</a>';
|
283 |
+
}
|
284 |
+
|
285 |
+
//------------------------------------------------------------------------
|
286 |
+
|
287 |
+
private function get_pages_number_html()
|
288 |
+
{
|
289 |
+
if($this->show_pages_number)
|
290 |
+
echo '<span class="tablenav-paging-text">' . $this->current_page . ' ' . $this->pages_number_text . ' ' . $this->pages_count . '</span>';
|
291 |
+
}
|
292 |
+
//------------------------------------------------------------------------
|
293 |
+
|
294 |
+
|
295 |
+
public function get_page_url($page)
|
296 |
+
{
|
297 |
+
if($this->url_rewrite == '')
|
298 |
+
{
|
299 |
+
if($this->current_parameters =="")
|
300 |
+
return "?" . $this->parameter . "=" . $page;
|
301 |
+
else
|
302 |
+
return $this->current_parameters . "&" . $this->parameter . "=" . $page;
|
303 |
+
}else
|
304 |
+
{
|
305 |
+
return str_replace('{pagination}',$page, $this->url_rewrite);
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
|
310 |
+
//------------------------------------------------------------------------
|
311 |
+
|
312 |
+
|
313 |
+
|
314 |
+
private function get_page_url_parameter()
|
315 |
+
{
|
316 |
+
if($this->current_parameters =="")
|
317 |
+
return "?" . $this->parameter . "=";
|
318 |
+
else
|
319 |
+
return $this->current_parameters . "&" . $this->parameter . "=";
|
320 |
+
}
|
321 |
+
|
322 |
+
//------------------------------------------------------------------------
|
323 |
+
|
324 |
+
private function get_current_parameters($remove_parameter="")
|
325 |
+
{
|
326 |
+
|
327 |
+
if($_SERVER['QUERY_STRING']!='')
|
328 |
+
{
|
329 |
+
$qry = '?' . $_SERVER['QUERY_STRING'];
|
330 |
+
if($remove_parameter!='')
|
331 |
+
{
|
332 |
+
if(array_key_exists($remove_parameter,$_GET)){
|
333 |
+
$string_remove = '&' . $remove_parameter . "=" . sanitize_text_field($_GET[$remove_parameter]);
|
334 |
+
$qry=str_replace($string_remove,"",$qry);
|
335 |
+
$string_remove = '?' . $remove_parameter . "=" . sanitize_text_field($_GET[$remove_parameter]);
|
336 |
+
$qry=str_replace($string_remove,"",$qry);
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
return $qry;
|
341 |
+
}else
|
342 |
+
{
|
343 |
+
return "";
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
//------------------------------------------------------------------------
|
348 |
+
|
349 |
+
|
350 |
+
public function get_sql_limit()
|
351 |
+
{
|
352 |
+
$this->run();
|
353 |
+
return " limit {$this->start},{$this->rows} ";
|
354 |
+
}
|
355 |
+
|
356 |
+
//------------------------------------------------------------------------
|
357 |
+
|
358 |
+
public function get_rows()
|
359 |
+
{
|
360 |
+
return $this->rows;
|
361 |
+
}
|
362 |
+
|
363 |
+
//------------------------------------------------------------------------
|
364 |
+
|
365 |
+
public function set_rows($rows)
|
366 |
+
{
|
367 |
+
if(intval($rows)>0)
|
368 |
+
{
|
369 |
+
$this->rows=$rows;
|
370 |
+
$this->run_count=0;
|
371 |
+
}
|
372 |
+
}
|
373 |
+
|
374 |
+
//------------------------------------------------------------------------
|
375 |
+
|
376 |
+
public function get_total_records()
|
377 |
+
{
|
378 |
+
return $this->table_rows_count;
|
379 |
+
}
|
380 |
+
|
381 |
+
|
382 |
+
//------------------------------------------------------------------------
|
383 |
+
|
384 |
+
public function get_printed_pages()
|
385 |
+
{
|
386 |
+
return $this->printed_pages;
|
387 |
+
}
|
388 |
+
|
389 |
+
//------------------------------------------------------------------------
|
390 |
+
|
391 |
+
public function set_printed_pages($printed_pages)
|
392 |
+
{
|
393 |
+
if(intval($printed_pages)>0)
|
394 |
+
{
|
395 |
+
$this->printed_pages=$printed_pages;
|
396 |
+
$this->run_count=0;
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
//------------------------------------------------------------------------
|
401 |
+
|
402 |
+
public function get_parameter_name()
|
403 |
+
{
|
404 |
+
return $this->parameter;
|
405 |
+
}
|
406 |
+
|
407 |
+
//------------------------------------------------------------------------
|
408 |
+
|
409 |
+
public function set_parameter_name($parameter)
|
410 |
+
{
|
411 |
+
$this->parameter=$parameter;
|
412 |
+
$this->run_count=0;
|
413 |
+
}
|
414 |
+
//------------------------------------------------------------------------
|
415 |
+
|
416 |
+
public function get_url_rewrite()
|
417 |
+
{
|
418 |
+
return $this->url_rewrite;
|
419 |
+
}
|
420 |
+
|
421 |
+
//------------------------------------------------------------------------
|
422 |
+
|
423 |
+
public function set_url_rewrite($url_rewrite)
|
424 |
+
{
|
425 |
+
$this->url_rewrite=$url_rewrite;
|
426 |
+
$this->run_count=0;
|
427 |
+
}
|
428 |
+
//------------------------------------------------------------------------
|
429 |
+
|
430 |
+
|
431 |
+
public function get_data_source()
|
432 |
+
{
|
433 |
+
return $this->data_source;
|
434 |
+
}
|
435 |
+
|
436 |
+
//------------------------------------------------------------------------
|
437 |
+
|
438 |
+
public function set_data_source($data_source)
|
439 |
+
{
|
440 |
+
$this->data_source=$data_source;
|
441 |
+
$this->run_count=0;
|
442 |
+
}
|
443 |
+
|
444 |
+
//------------------------------------------------------------------------
|
445 |
+
|
446 |
+
public function get_filter()
|
447 |
+
{
|
448 |
+
return $this->filter;
|
449 |
+
}
|
450 |
+
|
451 |
+
//------------------------------------------------------------------------
|
452 |
+
|
453 |
+
public function set_filter($filter)
|
454 |
+
{
|
455 |
+
if($filter!='')
|
456 |
+
$this->filter= ' where ' . $filter;
|
457 |
+
$this->run_count=0;
|
458 |
+
}
|
459 |
+
|
460 |
+
//------------------------------------------------------------------------
|
461 |
+
|
462 |
+
public function get_go_button_text()
|
463 |
+
{
|
464 |
+
return $this->go_button_text;
|
465 |
+
}
|
466 |
+
|
467 |
+
//------------------------------------------------------------------------
|
468 |
+
|
469 |
+
public function set_go_button_text($go_button_text)
|
470 |
+
{
|
471 |
+
$this->go_button_text=$go_button_text;
|
472 |
+
$this->run_count=0;
|
473 |
+
}
|
474 |
+
|
475 |
+
//------------------------------------------------------------------------
|
476 |
+
|
477 |
+
public function get_pages_number_text()
|
478 |
+
{
|
479 |
+
return $this->pages_number_text;
|
480 |
+
}
|
481 |
+
|
482 |
+
//------------------------------------------------------------------------
|
483 |
+
|
484 |
+
public function set_pages_number_text($pages_number_text)
|
485 |
+
{
|
486 |
+
$this->pages_number_text=$pages_number_text;
|
487 |
+
$this->run_count=0;
|
488 |
+
}
|
489 |
+
//------------------------------------------------------------------------
|
490 |
+
|
491 |
+
public function get_next_page_text()
|
492 |
+
{
|
493 |
+
return $this->next_page_text;
|
494 |
+
}
|
495 |
+
|
496 |
+
//------------------------------------------------------------------------
|
497 |
+
|
498 |
+
public function set_next_page_text($next_page_text)
|
499 |
+
{
|
500 |
+
$this->next_page_text=$next_page_text;
|
501 |
+
$this->run_count=0;
|
502 |
+
}
|
503 |
+
|
504 |
+
//------------------------------------------------------------------------
|
505 |
+
|
506 |
+
public function get_prev_page_text()
|
507 |
+
{
|
508 |
+
return $this->prev_page_text;
|
509 |
+
}
|
510 |
+
|
511 |
+
//------------------------------------------------------------------------
|
512 |
+
|
513 |
+
public function set_prev_page_text($prev_page_text)
|
514 |
+
{
|
515 |
+
$this->prev_page_text=$prev_page_text;
|
516 |
+
$this->run_count=0;
|
517 |
+
}
|
518 |
+
|
519 |
+
//------------------------------------------------------------------------
|
520 |
+
|
521 |
+
public function get_first_page_text()
|
522 |
+
{
|
523 |
+
return $this->first_page_text;
|
524 |
+
}
|
525 |
+
|
526 |
+
//------------------------------------------------------------------------
|
527 |
+
|
528 |
+
public function set_first_page_text($first_page_text)
|
529 |
+
{
|
530 |
+
$this->first_page_text=$first_page_text;
|
531 |
+
$this->run_count=0;
|
532 |
+
}
|
533 |
+
|
534 |
+
//------------------------------------------------------------------------
|
535 |
+
|
536 |
+
public function get_last_page_text()
|
537 |
+
{
|
538 |
+
return $this->last_page_text;
|
539 |
+
}
|
540 |
+
|
541 |
+
//------------------------------------------------------------------------
|
542 |
+
|
543 |
+
public function set_last_page_text($last_page_text)
|
544 |
+
{
|
545 |
+
$this->last_page_text=$last_page_text;
|
546 |
+
$this->run_count=0;
|
547 |
+
}
|
548 |
+
|
549 |
+
//------------------------------------------------------------------------
|
550 |
+
|
551 |
+
public function get_invalid_page_number_text()
|
552 |
+
{
|
553 |
+
return $this->invalid_page_number_text;
|
554 |
+
}
|
555 |
+
|
556 |
+
//------------------------------------------------------------------------
|
557 |
+
|
558 |
+
public function set_invalid_page_number_text($invalid_page_number_text)
|
559 |
+
{
|
560 |
+
$this->invalid_page_number_text=$invalid_page_number_text;
|
561 |
+
$this->run_count=0;
|
562 |
+
}
|
563 |
+
|
564 |
+
//------------------------------------------------------------------------
|
565 |
+
|
566 |
+
public function get_alignment()
|
567 |
+
{
|
568 |
+
return $this->$alignment;
|
569 |
+
}
|
570 |
+
|
571 |
+
//------------------------------------------------------------------------
|
572 |
+
|
573 |
+
public function set_alignment($alignment)
|
574 |
+
{
|
575 |
+
$this->alignment=$alignment;
|
576 |
+
$this->run_count=0;
|
577 |
+
}
|
578 |
+
|
579 |
+
//------------------------------------------------------------------------
|
580 |
+
|
581 |
+
public function get_direction()
|
582 |
+
{
|
583 |
+
return $this->$direction;
|
584 |
+
}
|
585 |
+
|
586 |
+
//------------------------------------------------------------------------
|
587 |
+
|
588 |
+
public function set_direction($direction)
|
589 |
+
{
|
590 |
+
$this->direction=$direction;
|
591 |
+
$this->run_count=0;
|
592 |
+
}
|
593 |
+
|
594 |
+
//------------------------------------------------------------------------
|
595 |
+
|
596 |
+
public function show_pages_number($value)
|
597 |
+
{
|
598 |
+
|
599 |
+
if($value)
|
600 |
+
$this->show_pages_number = true;
|
601 |
+
else
|
602 |
+
$this->show_pages_number = false;
|
603 |
+
|
604 |
+
$this->run_count=0;
|
605 |
+
|
606 |
+
}
|
607 |
+
//------------------------------------------------------------------------
|
608 |
+
|
609 |
+
public function can_show_pages_number()
|
610 |
+
{
|
611 |
+
return $this->show_pages_number;
|
612 |
+
}
|
613 |
+
|
614 |
+
//------------------------------------------------------------------------
|
615 |
+
|
616 |
+
public function show_go_button($value)
|
617 |
+
{
|
618 |
+
|
619 |
+
if($value)
|
620 |
+
$this->show_go_button = true;
|
621 |
+
else
|
622 |
+
$this->show_go_button = false;
|
623 |
+
|
624 |
+
$this->run_count=0;
|
625 |
+
|
626 |
+
}
|
627 |
+
|
628 |
+
//------------------------------------------------------------------------
|
629 |
+
|
630 |
+
public function can_show_go_button()
|
631 |
+
{
|
632 |
+
return $this->show_go_button;
|
633 |
+
}
|
634 |
+
|
635 |
+
//------------------------------------------------------------------------
|
636 |
+
|
637 |
+
public function show_prev_next($value)
|
638 |
+
{
|
639 |
+
|
640 |
+
if($value)
|
641 |
+
$this->show_prev_next = true;
|
642 |
+
else
|
643 |
+
$this->show_prev_next = false;
|
644 |
+
|
645 |
+
$this->run_count=0;
|
646 |
+
|
647 |
+
}
|
648 |
+
|
649 |
+
//------------------------------------------------------------------------
|
650 |
+
|
651 |
+
public function can_show_prev_next()
|
652 |
+
{
|
653 |
+
return $this->show_prev_next;
|
654 |
+
}
|
655 |
+
|
656 |
+
//------------------------------------------------------------------------
|
657 |
+
|
658 |
+
public function show_first_last($value)
|
659 |
+
{
|
660 |
+
|
661 |
+
if($value)
|
662 |
+
$this->show_first_last = true;
|
663 |
+
else
|
664 |
+
$this->show_first_last = false;
|
665 |
+
|
666 |
+
$this->run_count=0;
|
667 |
+
|
668 |
+
}
|
669 |
+
|
670 |
+
//------------------------------------------------------------------------
|
671 |
+
|
672 |
+
public function can_show_first_last()
|
673 |
+
{
|
674 |
+
return $this->show_first_last;
|
675 |
+
}
|
676 |
+
|
677 |
+
|
678 |
+
//------------------------------------------------------------------------
|
679 |
+
|
680 |
+
}}
|
681 |
+
|
682 |
+
?>
|
common/customJs.js
ADDED
@@ -0,0 +1,298 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
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|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
var $ = jQuery;
|
2 |
+
var save_method; //for save method string
|
3 |
+
var host=window.location.hostname;
|
4 |
+
var fullpath=window.location.pathname;
|
5 |
+
var fullparam=window.location.search.split('&');
|
6 |
+
|
7 |
+
var firstparam=fullparam[0];
|
8 |
+
var secoundparam=fullparam[1];
|
9 |
+
|
10 |
+
jQuery(document).ready(function () {
|
11 |
+
|
12 |
+
$(document).on('click', '.SwalBtn1', function() {
|
13 |
+
swal.clickConfirm();
|
14 |
+
});
|
15 |
+
$(document).on('click', '.SwalBtn2', function() {
|
16 |
+
window.open(
|
17 |
+
"http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin",
|
18 |
+
'_blank'
|
19 |
+
);
|
20 |
+
//window.location.href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin";
|
21 |
+
swal.clickConfirm();
|
22 |
+
});
|
23 |
+
$(document).on('click', '.SwalBtn3', function() {
|
24 |
+
sessionStorage.setItem("bool", "1");
|
25 |
+
swal.clickConfirm();
|
26 |
+
});
|
27 |
+
|
28 |
+
if(sessionStorage && (firstparam=="?page=seo-redirection.php" && !secoundparam) || secoundparam=="tab=cutom")
|
29 |
+
{
|
30 |
+
|
31 |
+
if (seoredirection.msg.length > 0 && !sessionStorage.getItem("bool")==true)
|
32 |
+
{
|
33 |
+
swal({
|
34 |
+
title:"Oops! Don't lose your web traffic!<br><br>"+
|
35 |
+
seoredirection.msg,
|
36 |
+
type: "warning",
|
37 |
+
animation: "slide-from-top",
|
38 |
+
html: '<center><button type="button" role="button" class="SwalBtn1 customSwalBtn1">' + 'Close' + '</button>' +
|
39 |
+
'<button type="button" role="button" class="SwalBtn2 customSwalBtn2">' + 'Fix now' + '</button>'+
|
40 |
+
'<button type="button" role="button" class="SwalBtn3 customSwalBtn3">' + "Don't show again" + '</button></center>',
|
41 |
+
showCancelButton: false,
|
42 |
+
showConfirmButton: false
|
43 |
+
});
|
44 |
+
|
45 |
+
// swal({
|
46 |
+
// title: seoredirection.msg,
|
47 |
+
// type: "warning",
|
48 |
+
// showCancelButton: true,
|
49 |
+
// confirmButtonColor: '#DD6B55',
|
50 |
+
// cancelButtonColor :'#5bc0de',
|
51 |
+
// confirmButtonText: "Don't Show Again",
|
52 |
+
// cancelButtonText: " Ok ",
|
53 |
+
// closeOnConfirm: true,
|
54 |
+
// closeOnCancel: true,
|
55 |
+
// animation: "slide-from-top",
|
56 |
+
// html:true,
|
57 |
+
// },
|
58 |
+
// function (isConfirm) {
|
59 |
+
// if (isConfirm) {
|
60 |
+
// sessionStorage.setItem("bool", "1");
|
61 |
+
// }
|
62 |
+
// }
|
63 |
+
//
|
64 |
+
// );
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
// swal("Warning!", seoredirection.msg, "warning");
|
69 |
+
|
70 |
+
$('div.edit_template').click(function (event) {
|
71 |
+
$('.loading').show();
|
72 |
+
var ele = $(this);
|
73 |
+
$(this).attr('disabled', true);
|
74 |
+
save_method = 'Update';
|
75 |
+
event.preventDefault();
|
76 |
+
var parent = $(this).parent();
|
77 |
+
var editID = parent.attr("href");
|
78 |
+
$.ajax({
|
79 |
+
url: seoredirection.ajax_url,
|
80 |
+
type: "POST",
|
81 |
+
data: {
|
82 |
+
'action': 'customUpdateRec',
|
83 |
+
'ID': editID,
|
84 |
+
},
|
85 |
+
success: function (data) {
|
86 |
+
var record = $.parseJSON(data);
|
87 |
+
if (record.status == 'suucess')
|
88 |
+
{
|
89 |
+
clr();
|
90 |
+
$('#edit').val(editID);
|
91 |
+
$('#add_new').val("");
|
92 |
+
$('#edit_exist').val("1");
|
93 |
+
$('#myModal').modal('show'); // show bootstrap modal
|
94 |
+
$('.loading').hide();
|
95 |
+
$('.modal-title').text('Edit Custom Redirection'); // Set Title to Bootstrap modal title
|
96 |
+
$('#btnSave').val(save_method); //change button text
|
97 |
+
$('#btnSave').attr('disabled', false); //set button enable
|
98 |
+
var newdata = record.rec;
|
99 |
+
$('#redirect_from_type').val(newdata.redirect_from_type);
|
100 |
+
$('#redirect_from').val(newdata.redirect_from);
|
101 |
+
$('#redirect_from_folder_settings').val(newdata.redirect_from_folder_settings);
|
102 |
+
$('#redirect_from_subfolders').val(newdata.redirect_from_subfolders);
|
103 |
+
$('#redirect_to_type').val(newdata.redirect_to_type);
|
104 |
+
$('#redirect_to').val(newdata.redirect_to);
|
105 |
+
$('#redirect_to_folder_settings').val(newdata.redirect_to_folder_settings);
|
106 |
+
$('#redirect_type').val(newdata.redirect_type);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
});
|
110 |
+
});
|
111 |
+
|
112 |
+
$("input").change(function () {
|
113 |
+
$(this).parent().parent().removeClass('has-error');
|
114 |
+
$(this).next().empty();
|
115 |
+
});
|
116 |
+
$("textarea").change(function () {
|
117 |
+
$(this).parent().parent().removeClass('has-error');
|
118 |
+
$(this).next().empty();
|
119 |
+
});
|
120 |
+
$("select").change(function () {
|
121 |
+
$(this).parent().parent().removeClass('has-error');
|
122 |
+
$(this).next().empty();
|
123 |
+
});
|
124 |
+
});
|
125 |
+
function clr() {
|
126 |
+
$('.help-block').hide();
|
127 |
+
$('#redirect_from_type').show();
|
128 |
+
$('#redirect_from_folder_settings').hide();
|
129 |
+
$('#redirect_from_subfolders').hide();
|
130 |
+
$('#redirect_from').attr('class', 'Page_background_1 regular-text');
|
131 |
+
$('#redirect_to_type').show();
|
132 |
+
$('#redirect_to').attr('class', 'Page_background_1 regular-text');
|
133 |
+
$('#redirect_to_folder_settings').hide();
|
134 |
+
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
+
}
|
139 |
+
function add_rec() {
|
140 |
+
clr();
|
141 |
+
|
142 |
+
$('.loading').show();
|
143 |
+
save_method = 'Add New';
|
144 |
+
$(this).attr('disabled', true);
|
145 |
+
$('#add_new').val("1");
|
146 |
+
$('#edit').val("");
|
147 |
+
$('#edit_exist').val("");
|
148 |
+
$('#myform')[0].reset(); // reset form on modals
|
149 |
+
$('#myModal').modal('show'); // show bootstrap modal
|
150 |
+
$('.loading').hide();
|
151 |
+
$('.modal-title').text('Add Custom Redirection'); // Set Title to Bootstrap modal title
|
152 |
+
$('#btnSave').val(save_method); //change button text
|
153 |
+
$('#btnSave').attr('disabled', false); //set button enable
|
154 |
+
}
|
155 |
+
function save_function()
|
156 |
+
{
|
157 |
+
$('.loading').show();
|
158 |
+
$('#btnSave').val('Saving...'); //change button text
|
159 |
+
$('#btnSave').attr('disabled', true); //set button disable
|
160 |
+
var formData = $('#myform').serialize();
|
161 |
+
msg = $("#msg_response");
|
162 |
+
$.ajax({
|
163 |
+
url: seoredirection.ajax_url,
|
164 |
+
type: "POST",
|
165 |
+
data: {
|
166 |
+
'action': 'customAddUpdate',
|
167 |
+
'formData': formData,
|
168 |
+
},
|
169 |
+
success: function (data) {
|
170 |
+
|
171 |
+
data = $.parseJSON(data);
|
172 |
+
if (data.status == 'error') //if success close modal and reload ajax table
|
173 |
+
{
|
174 |
+
$('.loading').hide();
|
175 |
+
msg.html('<span style="color:red">' + data.msg + '</span>')
|
176 |
+
|
177 |
+
}
|
178 |
+
else if (data.status == 'success')
|
179 |
+
{
|
180 |
+
$('#myModal').modal('hide');
|
181 |
+
$('.loading').hide();
|
182 |
+
//msg.html('<span style="color:green">' + data.msg + '</span>')
|
183 |
+
console.log(data.msg);
|
184 |
+
swal({
|
185 |
+
title: data.msg,
|
186 |
+
type: "success",
|
187 |
+
confirmButtonColor: '#5cb85c',
|
188 |
+
confirmButtonText: "ok",
|
189 |
+
closeOnConfirm: true,
|
190 |
+
animation: "slide-from-top",
|
191 |
+
}).then(function() {
|
192 |
+
$('.loading').show();
|
193 |
+
window.location.href = data.url;
|
194 |
+
});
|
195 |
+
}
|
196 |
+
if (data.inputerror) {
|
197 |
+
$('.loading').hide();
|
198 |
+
for (var i = 0; i < data.inputerror.length; i++) {
|
199 |
+
$('.help-block').show();
|
200 |
+
$('[name="' + data.inputerror[i] + '"]').next().text(data.error_string[i]);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
$('#btnSave').val(save_method); //change button text
|
204 |
+
$('#btnSave').attr('disabled', false); //set button enable
|
205 |
+
},
|
206 |
+
error: function (jqXHR, textStatus, errorThrown) {
|
207 |
+
console.log(jqXHR, textStatus, errorThrown);
|
208 |
+
$('.loading').hide();
|
209 |
+
$('#btnSave').val(save_method); //change button text
|
210 |
+
$('#btnSave').attr('disabled', false); //set button enable
|
211 |
+
}
|
212 |
+
});
|
213 |
+
}
|
214 |
+
|
215 |
+
function redirect_from_type_change()
|
216 |
+
{
|
217 |
+
if (document.getElementById('redirect_from_type').value == 'Folder')
|
218 |
+
{
|
219 |
+
document.getElementById('redirect_from_folder_settings').style.display = 'inline';
|
220 |
+
document.getElementById('redirect_from').className = 'Folder_background_1';
|
221 |
+
redirect_to_folder_settings_change();
|
222 |
+
}
|
223 |
+
else if (document.getElementById('redirect_from_type').value == 'Page')
|
224 |
+
{
|
225 |
+
document.getElementById('redirect_from_folder_settings').style.display = 'none';
|
226 |
+
document.getElementById('redirect_from').className = 'Page_background_1 regular-text';
|
227 |
+
document.getElementById('redirect_from_subfolders').style.display = 'none';
|
228 |
+
}
|
229 |
+
else if (document.getElementById('redirect_from_type').value == 'Regex')
|
230 |
+
{
|
231 |
+
document.getElementById('redirect_from_folder_settings').style.display = 'none';
|
232 |
+
document.getElementById('redirect_from').className = 'Regex_background_1';
|
233 |
+
document.getElementById('redirect_from_subfolders').style.display = 'none';
|
234 |
+
}
|
235 |
+
|
236 |
+
check_redirect_from();
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
function redirect_to_type_change()
|
241 |
+
{
|
242 |
+
if (document.getElementById('redirect_to_type').value == 'Folder')
|
243 |
+
{
|
244 |
+
document.getElementById('redirect_to_folder_settings').style.display = 'inline';
|
245 |
+
document.getElementById('redirect_to').className = 'Folder_background_1';
|
246 |
+
}
|
247 |
+
else if (document.getElementById('redirect_to_type').value == 'Page')
|
248 |
+
{
|
249 |
+
document.getElementById('redirect_to_folder_settings').style.display = 'none';
|
250 |
+
document.getElementById('redirect_to').className = 'Page_background_1 regular-text';
|
251 |
+
}
|
252 |
+
|
253 |
+
check_redirect_to();
|
254 |
+
}
|
255 |
+
|
256 |
+
function redirect_to_folder_settings_change()
|
257 |
+
{
|
258 |
+
|
259 |
+
if (document.getElementById('redirect_from_folder_settings').value == '1')
|
260 |
+
{
|
261 |
+
document.getElementById('redirect_from_subfolders').style.display = 'none';
|
262 |
+
} else
|
263 |
+
{
|
264 |
+
document.getElementById('redirect_from_subfolders').style.display = 'block';
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
function check_redirect_from()
|
269 |
+
{
|
270 |
+
|
271 |
+
var rfrom = document.getElementById('redirect_from').value;
|
272 |
+
|
273 |
+
if (rfrom != '') {
|
274 |
+
var cr = rfrom.substring(rfrom.length - 1);
|
275 |
+
if (document.getElementById('redirect_from_type').value == 'Folder' && cr != '/')
|
276 |
+
document.getElementById('redirect_from').value = rfrom + '/';
|
277 |
+
}
|
278 |
+
}
|
279 |
+
|
280 |
+
|
281 |
+
function check_redirect_to()
|
282 |
+
{
|
283 |
+
|
284 |
+
var rto = document.getElementById('redirect_to').value;
|
285 |
+
|
286 |
+
|
287 |
+
if (rto != '') {
|
288 |
+
var cr = rto.substring(rto.length - 1);
|
289 |
+
if (document.getElementById('redirect_to_type').value == 'Folder' && cr != '/')
|
290 |
+
document.getElementById('redirect_to').value = rto + '/';
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
if((firstparam=="?page=seo-redirection.php" && !secoundparam) || secoundparam=="tab=cutom")
|
295 |
+
{
|
296 |
+
redirect_from_type_change();
|
297 |
+
redirect_to_type_change();
|
298 |
+
}
|
common/images/action_success.png
ADDED
Binary file
|
common/images/add.png
ADDED
Binary file
|
common/images/delete.png
ADDED
Binary file
|
common/images/dialog-warning.png
ADDED
Binary file
|
common/images/edit.png
ADDED
Binary file
|
common/images/error.png
ADDED
Binary file
|
common/images/go_link.png
ADDED
Binary file
|
common/images/gradient_color_bg.gif
ADDED
Binary file
|
common/images/help_off.png
ADDED
Binary file
|
common/images/help_over.png
ADDED
Binary file
|
common/images/large-info.png
ADDED
Binary file
|
common/images/link.png
ADDED
Binary file
|
common/images/search.png
ADDED
Binary file
|
common/images/see.png
ADDED
Binary file
|
common/js/jquery.validate.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
Â
|
|
Â
|
1 |
+
/*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation
|
2 |
+
* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("<input type='hidden'/>").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery);
|
common/js/sweetalert.min.js
ADDED
@@ -0,0 +1 @@
|
|
Â
|
1 |
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";function e(){if(void 0===arguments[0])return console.error("SweetAlert2 expects at least 1 attribute!"),!1;var e=c({},j);switch(typeof arguments[0]){case"string":e.title=arguments[0],e.text=arguments[1]||"",e.type=arguments[2]||"";break;case"object":c(e,arguments[0]),e.extraParams=arguments[0].extraParams,"email"===e.input&&null===e.inputValidator&&(e.inputValidator=function(e){return new Promise(function(t,n){var o=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;o.test(e)?t():n("Invalid email address")})});break;default:return console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got '+typeof arguments[0]),!1}K(e);var n=f();return new Promise(function(o,r){function a(t,n){for(var o=b(e.focusCancel),i=0;i<o.length;i++){t+=n,t===o.length?t=0:-1===t&&(t=o.length-1);var r=o[t];if(L(r))return r.focus()}}function l(n){var o=n||window.event,i=o.keyCode||o.which;if(-1!==[9,13,32,27].indexOf(i)){for(var l=o.target||o.srcElement,c=b(e.focusCancel),s=-1,u=0;u<c.length;u++)if(l===c[u]){s=u;break}9===i?(o.shiftKey?a(s,-1):a(s,1),V(o)):13===i||32===i?-1===s&&(e.focusCancel?O(P,o):O(M,o)):27===i&&e.allowEscapeKey===!0&&(t.closeModal(e.onClose),r("esc"))}}e.timer&&(n.timeout=setTimeout(function(){t.closeModal(e.onClose),r("timer")},e.timer));var c=function(){switch(e.input){case"select":return x(n,i.select);case"radio":return n.querySelector("."+i.radio+" input:checked")||n.querySelector("."+i.radio+" input:first-child");case"checkbox":return n.querySelector("#"+i.checkbox);case"textarea":return x(n,i.textarea);default:return x(n,i.input)}},u=function(){var t=c();switch(e.input){case"checkbox":return t.checked?1:0;case"radio":return t.checked?t.value:null;case"file":return t.files.length?t.files[0]:null;default:return e.inputAutoTrim?t.value.trim():t.value}};e.input&&setTimeout(function(){var e=c();e&&w(e)},0);var p,f=function(n){e.showLoaderOnConfirm&&t.showLoading(),e.preConfirm?e.preConfirm(n,e.extraParams).then(function(i){t.closeModal(e.onClose),o(i||n)},function(e){t.hideLoading(),e&&t.showValidationError(e)}):(t.closeModal(e.onClose),o(n))},g=function(n){var o=n||window.event,i=o.target||o.srcElement,a=v(),l=h(),c=a===i||a.contains(i),d=l===i||l.contains(i);switch(o.type){case"mouseover":case"mouseup":e.buttonsStyling&&(c?a.style.backgroundColor=s(e.confirmButtonColor,-.1):d&&(l.style.backgroundColor=s(e.cancelButtonColor,-.1)));break;case"mouseout":e.buttonsStyling&&(c?a.style.backgroundColor=e.confirmButtonColor:d&&(l.style.backgroundColor=e.cancelButtonColor));break;case"mousedown":e.buttonsStyling&&(c?a.style.backgroundColor=s(e.confirmButtonColor,-.2):d&&(l.style.backgroundColor=s(e.cancelButtonColor,-.2)));break;case"click":if(c&&t.isVisible())if(e.input){var p=u();e.inputValidator?(t.disableInput(),e.inputValidator(p,e.extraParams).then(function(){t.enableInput(),f(p)},function(e){t.enableInput(),e&&t.showValidationError(e)})):f(p)}else f(!0);else d&&t.isVisible()&&(t.closeModal(e.onClose),r("cancel"))}},q=n.querySelectorAll("button");for(p=0;p<q.length;p++)q[p].onclick=g,q[p].onmouseover=g,q[p].onmouseout=g,q[p].onmousedown=g;y().onclick=function(){t.closeModal(e.onClose),r("close")},m().onclick=function(){e.allowOutsideClick&&(t.closeModal(e.onClose),r("overlay"))};var M=v(),P=h();e.reverseButtons?M.parentNode.insertBefore(P,M):M.parentNode.insertBefore(M,P),d.previousWindowKeyDown=window.onkeydown,window.onkeydown=l,e.buttonsStyling&&(M.style.borderLeftColor=e.confirmButtonColor,M.style.borderRightColor=e.confirmButtonColor),t.showLoading=t.enableLoading=function(){C(M,"loading"),C(n,"loading"),M.disabled=!0,P.disabled=!0},t.hideLoading=t.disableLoading=function(){k(M,"loading"),k(n,"loading"),M.disabled=!1,P.disabled=!1},t.enableButtons=function(){M.disabled=!1,P.disabled=!1},t.disableButtons=function(){M.disabled=!0,P.disabled=!0},t.enableConfirmButton=function(){M.disabled=!1},t.disableConfirmButton=function(){M.disabled=!0},t.enableInput=function(){var e=c();if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=!1;else e.disabled=!1},t.disableInput=function(){var e=c();if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=!0;else e.disabled=!0},t.showValidationError=function(e){var t=n.querySelector("."+i.validationerror);t.innerHTML=e,S(t);var o=c();w(o),C(o,"error")},t.resetValidationError=function(){var e=n.querySelector("."+i.validationerror);B(e);var t=c();t&&k(t,"error")},t.enableButtons(),t.hideLoading(),t.resetValidationError();var T,N=["input","select","radio","checkbox","textarea"];for(p=0;p<N.length;p++){var H=i[N[p]];for(T=x(n,H);T.attributes.length>0;)T.removeAttribute(T.attributes[0].name);for(var D in e.inputAttributes)T.setAttribute(D,e.inputAttributes[D]);T.className=H,e.inputClass&&C(T,e.inputClass),A(T)}var I;switch(e.input){case"text":case"email":case"password":case"file":T=x(n,i.input),T.value=e.inputValue,T.placeholder=e.inputPlaceholder,T.type=e.input,E(T);break;case"select":var j=x(n,i.select);if(j.innerHTML="",e.inputPlaceholder){var K=document.createElement("option");K.innerHTML=e.inputPlaceholder,K.value="",K.disabled=!0,K.selected=!0,j.appendChild(K)}I=function(t){for(var n in t){var o=document.createElement("option");o.value=n,o.innerHTML=t[n],e.inputValue===n&&(o.selected=!0),j.appendChild(o)}E(j),j.focus()};break;case"radio":var z=x(n,i.radio);z.innerHTML="",I=function(t){for(var n in t){var o=1,r=document.createElement("input"),a=document.createElement("label"),l=document.createElement("span");r.type="radio",r.name=i.radio,r.value=n,r.id=i.radio+"-"+o++,e.inputValue===n&&(r.checked=!0),l.innerHTML=t[n],a.appendChild(r),a.appendChild(l),a["for"]=r.id,z.appendChild(a)}E(z);var c=z.querySelectorAll("input");c.length&&c[0].focus()};break;case"checkbox":var R=x(n,i.checkbox),Z=n.querySelector("#"+i.checkbox);Z.value=1,Z.checked=Boolean(e.inputValue);var $=R.getElementsByTagName("span");$.length&&R.removeChild($[0]),$=document.createElement("span"),$.innerHTML=e.inputPlaceholder,R.appendChild($),E(R);break;case"textarea":var F=x(n,i.textarea);F.value=e.inputValue,F.placeholder=e.inputPlaceholder,E(F);break;case null:break;default:console.error('SweetAlert2: Unexpected type of input! Expected "text" or "email" or "password", "select", "checkbox", "textarea" or "file", got "'+e.input+'"')}"select"!==e.input&&"radio"!==e.input||(e.inputOptions instanceof Promise?(t.showLoading(),e.inputOptions.then(function(e){t.hideLoading(),I(e)})):"object"==typeof e.inputOptions?I(e.inputOptions):console.error("SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got "+typeof e.inputOptions)),W(),U(e.animation,e.onOpen),a(-1,1)})}function t(){var n=arguments,o=f();return null===o&&(t.init(),o=f()),t.isVisible()&&t.close(),e.apply(this,n)}var n="swal2-",o=function(e){var t={};for(var o in e)t[e[o]]=n+e[o];return t},i=o(["container","modal","overlay","close","content","spacer","confirm","cancel","icon","image","input","select","radio","checkbox","textarea","validationerror"]),r=o(["success","warning","info","question","error"]),a={title:"",text:"",html:"",type:null,customClass:"",animation:!0,allowOutsideClick:!0,allowEscapeKey:!0,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonColor:"#3085d6",confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonColor:"#aaa",cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,focusCancel:!1,showCloseButton:!1,showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageClass:null,timer:null,width:500,padding:20,background:"#fff",input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,onOpen:null,onClose:null},l='<div class="'+i.overlay+'" tabIndex="-1"></div><div class="'+i.modal+'" style="display: none" tabIndex="-1"><div class="'+i.icon+" "+r.error+'"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="'+i.icon+" "+r.question+'">?</div><div class="'+i.icon+" "+r.warning+'">!</div><div class="'+i.icon+" "+r.info+'">i</div><div class="'+i.icon+" "+r.success+'"><span class="line tip"></span> <span class="line long"></span><div class="placeholder"></div> <div class="fix"></div></div><img class="'+i.image+'"><h2></h2><div class="'+i.content+'"></div><input class="'+i.input+'"><select class="'+i.select+'"></select><div class="'+i.radio+'"></div><label for="'+i.checkbox+'" class="'+i.checkbox+'"><input type="checkbox" id="'+i.checkbox+'"></label><textarea class="'+i.textarea+'"></textarea><div class="'+i.validationerror+'"></div><hr class="'+i.spacer+'"><button class="'+i.confirm+'">OK</button><button class="'+i.cancel+'">Cancel</button><span class="'+i.close+'">×</span></div>',c=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},s=function(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;for(var n="#",o=0;3>o;o++){var i=parseInt(e.substr(2*o,2),16);i=Math.round(Math.min(Math.max(0,i+i*t),255)).toString(16),n+=("00"+i).substr(i.length)}return n},u=function(e){return"function"==typeof e},d={previousWindowKeyDown:null,previousActiveElement:null},p=function(e){return document.querySelector("."+e)},f=function(){return p(i.modal)},m=function(){return p(i.overlay)},v=function(){return p(i.confirm)},h=function(){return p(i.cancel)},y=function(){return p(i.close)},b=function(e){var t=[v(),h()];return e&&t.reverse(),t.concat(Array.prototype.slice.call(f().querySelectorAll("button:not([class^="+n+"]), input:not([type=hidden]), textarea, select")))},g=function(e,t){return e.classList.contains(t)},w=function(e){e.focus();var t=e.value;e.value="",e.value=t},C=function(e,t){if(e&&t){var n=t.split(/\s+/);n.forEach(function(t){e.classList.add(t)})}},k=function(e,t){if(e&&t){var n=t.split(/\s+/);n.forEach(function(t){e.classList.remove(t)})}},x=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(g(e.childNodes[n],t))return e.childNodes[n]},E=function(e){e.style.opacity="",e.style.display="block"},S=function(e){if(e&&!e.length)return E(e);for(var t=0;t<e.length;++t)E(e[t])},A=function(e){e.style.opacity="",e.style.display="none"},B=function(e){if(e&&!e.length)return A(e);for(var t=0;t<e.length;++t)A(e[t])},L=function(e){return e.offsetWidth||e.offsetHeight||e.getClientRects().length},q=function(e,t){e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(t)},M=function(e){var t=e.style.display;e.style.left="-9999px",e.style.display="block";var n=e.clientHeight;return e.style.left="",e.style.display=t,"-"+parseInt(n/2,10)+"px"},P=function(e,t){if(+e.style.opacity<1){t=t||16,e.style.opacity=0,e.style.display="block";var n=+new Date,o=function(){var i=+e.style.opacity+(new Date-n)/100;e.style.opacity=i>1?1:i,n=+new Date,+e.style.opacity<1&&setTimeout(o,t)};o()}},T=function(e,t){if(+e.style.opacity>0){t=t||16;var n=e.style.opacity,o=+new Date,i=function(){var r=new Date-o,a=+e.style.opacity-r/(100*n);e.style.opacity=a,o=+new Date,+e.style.opacity>0?setTimeout(i,t):A(e)};i()}},O=function(e){if("function"==typeof MouseEvent){var t=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0});e.dispatchEvent(t)}else if(document.createEvent){var n=document.createEvent("MouseEvents");n.initEvent("click",!1,!1),e.dispatchEvent(n)}else document.createEventObject?e.fireEvent("onclick"):"function"==typeof e.onclick&&e.onclick()},V=function(e){"function"==typeof e.stopPropagation?(e.stopPropagation(),e.preventDefault()):window.event&&window.event.hasOwnProperty("cancelBubble")&&(window.event.cancelBubble=!0)},N=function(){var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",msAnimation:"MSAnimationEnd",animation:"animationend"};for(var n in t)if(t.hasOwnProperty(n)&&void 0!==e.style[n])return t[n];return!1}(),H=function(){var e=f();window.onkeydown=d.previousWindowKeyDown,d.previousActiveElement&&d.previousActiveElement.focus&&d.previousActiveElement.focus(),clearTimeout(e.timeout)},D=function(e){var t=n+"mediaquery-"+Math.random().toString(36).substring(2,7),o=document.getElementsByTagName("head")[0],i=document.createElement("style");return i.type="text/css",i.id=t,i.innerHTML=e,o.appendChild(i),t},I=function(e){if(!e)return!1;var t=document.getElementsByTagName("head")[0],n=document.getElementById(e);n&&t.removeChild(n)},j=c({},a),K=function(e){var t=f();for(var n in e)a.hasOwnProperty(n)||"extraParams"===n||console.warn('SweetAlert2: Unknown parameter "'+n+'"');e.width=e.width.toString();var o,l=e.width.match(/^(\d+)(px|%)?$/);if(l?(o="px",l[2]&&(o=l[2]),l=parseInt(l[1],10),t.style.width=l+o,t.style.marginLeft=-l/2+o):console.warn('SweetAlert2: Invalid width parameter, usage examples: "400px", "50%", or just 500 which equals to "500px"'),t.style.padding=e.padding+"px",t.style.background=e.background,"px"===o){var c=5,s=l+l*(c/100)*2,u=D("@media screen and (max-width: "+s+"px) {."+i.modal+" {width: auto !important;left: "+c+"% !important;right: "+c+"% !important;margin-left: 0 !important;}}");t.setAttribute("data-mediaquery-id",u)}var d=t.querySelector("h2"),p=t.querySelector("."+i.content),m=v(),y=h(),b=t.querySelector("."+i.spacer),g=t.querySelector("."+i.close);if(d.innerHTML=e.title.split("\n").join("<br>"),e.text||e.html){if("object"==typeof e.html)if(p.innerHTML="",0 in e.html)for(var w=0;w in e.html;w++)p.appendChild(e.html[w]);else p.appendChild(e.html);else p.innerHTML=e.html||e.text.split("\n").join("<br>");S(p)}else B(p);if(e.showCloseButton?S(g):B(g),t.className=i.modal,e.customClass&&C(t,e.customClass),B(t.querySelectorAll("."+i.icon)),e.type){var x=!1;for(var E in r)if(e.type===E){x=!0;break}if(!x)return console.error("SweetAlert2: Unknown alert type: "+e.type),!1;var A=t.querySelector("."+i.icon+"."+r[e.type]);switch(S(A),e.type){case"success":C(A,"animate"),C(A.querySelector(".tip"),"animate-success-tip"),C(A.querySelector(".long"),"animate-success-long");break;case"error":C(A,"animate-error-icon"),C(A.querySelector(".x-mark"),"animate-x-mark");break;case"warning":C(A,"pulse-warning")}}var L=t.querySelector("."+i.image);e.imageUrl?(L.setAttribute("src",e.imageUrl),S(L),e.imageWidth?L.setAttribute("width",e.imageWidth):L.removeAttribute("width"),e.imageHeight?L.setAttribute("height",e.imageHeight):L.removeAttribute("height"),L.className=i.image,e.imageClass&&C(L,e.imageClass)):B(L),e.showCancelButton?y.style.display="inline-block":B(y),e.showConfirmButton?q(m,"display"):B(m),e.showConfirmButton||e.showCancelButton?S(b):B(b),m.innerHTML=e.confirmButtonText,y.innerHTML=e.cancelButtonText,e.buttonsStyling&&(m.style.backgroundColor=e.confirmButtonColor,y.style.backgroundColor=e.cancelButtonColor),m.className=i.confirm,C(m,e.confirmButtonClass),y.className=i.cancel,C(y,e.cancelButtonClass),e.buttonsStyling?(C(m,"styled"),C(y,"styled")):(k(m,"styled"),k(y,"styled"),m.style.backgroundColor=m.style.borderLeftColor=m.style.borderRightColor="",y.style.backgroundColor=y.style.borderLeftColor=y.style.borderRightColor=""),e.animation===!0?k(t,"no-animation"):C(t,"no-animation")},U=function(e,t){var n=f();e?(P(m(),10),C(n,"show-swal2"),k(n,"hide-swal2")):S(m()),S(n),d.previousActiveElement=document.activeElement,null!==t&&"function"==typeof t&&t.call(this,n)},W=function(){var e=f();null!==e&&(e.style.marginTop=M(e))};return t.isVisible=function(){var e=f();return L(e)},t.queue=function(e,n){var o;return n&&(o={fork:function(e){n=e,this.next=e[0]},repeatCurrent:function(){n.unshift(this.current),this.next=this.current},insert:function(e){n.unshift(e),this.next=this.state},terminate:function(){n=[],this.next=""}}),new Promise(function(i,r){!function a(l,c){var s=null;u(e)?n&&n.length>0?(o.current=n[0],o.next=n.length>1?n[1]:"",o.alertNumber=l,n.shift(),s=e(o)):s=e(l):l<e.length&&(s=e[l]),s?t(s).then(function(){a(l+1,c)},function(e){r(e)}):i()}(0)})},t.close=t.closeModal=function(e){var t=f();k(t,"show-swal2"),C(t,"hide-swal2");var n=t.querySelector("."+i.icon+"."+r.success);k(n,"animate"),k(n.querySelector(".tip"),"animate-success-tip"),k(n.querySelector(".long"),"animate-success-long");var o=t.querySelector("."+i.icon+"."+r.error);k(o,"animate-error-icon"),k(o.querySelector(".x-mark"),"animate-x-mark");var a=t.querySelector("."+i.icon+"."+r.warning);k(a,"pulse-warning"),H();var l=t.getAttribute("data-mediaquery-id");N&&!g(t,"no-animation")?t.addEventListener(N,function c(){t.removeEventListener(N,c),g(t,"hide-swal2")&&(A(t),T(m(),0)),I(l)}):(A(t),A(m()),I(l)),null!==e&&"function"==typeof e&&e.call(this,t)},t.clickConfirm=function(){v().click()},t.clickCancel=function(){h().click()},t.init=function(){if("undefined"==typeof document)return void console.log("SweetAlert2 requires document to initialize");if(!document.getElementsByClassName(i.container).length){var e=document.createElement("div");e.className=i.container,e.innerHTML=l,document.body.appendChild(e);var n=f(),o=x(n,i.input),r=x(n,i.select),a=n.querySelector("#"+i.checkbox),c=x(n,i.textarea),s=x(n,i.image);o.oninput=function(){t.resetValidationError()},o.onkeyup=function(e){e.stopPropagation(),13===e.keyCode&&t.clickConfirm()},r.onchange=function(){t.resetValidationError()},a.onchange=function(){t.resetValidationError()},c.oninput=function(){t.resetValidationError()},s.onload=s.onerror=W,window.addEventListener("resize",W,!1)}},t.setDefaults=function(e){if(!e)throw new Error("userParams is required");if("object"!=typeof e)throw new Error("userParams has to be a object");c(j,e)},t.resetDefaults=function(){j=c({},a)},t.version="4.2.4",window.sweetAlert=window.swal=t,function(){"complete"===document.readyState||"interactive"===document.readyState&&document.body?t.init():document.addEventListener("DOMContentLoaded",function e(){document.removeEventListener("DOMContentLoaded",e,!1),t.init()},!1)}(),"function"==typeof Promise?Promise.prototype.done=Promise.prototype.done||function(){return this["catch"](function(){})}:console.warn("SweetAlert2: Please inlude Promise polyfill BEFORE including sweetalert2.js if IE10+ support needed."),t});
|
common/style.css
ADDED
@@ -0,0 +1,347 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
hr{
|
2 |
+
border-bottom:1px dashed #CCCCCC;
|
3 |
+
border-top:0 solid #FFFFFF;
|
4 |
+
border-left:0 solid #FFFFFF;
|
5 |
+
border-right:0 solid #FFFFFF;
|
6 |
+
}
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
ul.tabs {
|
11 |
+
float:left;
|
12 |
+
list-style:none;
|
13 |
+
height:32px;
|
14 |
+
width:100%;
|
15 |
+
min-width: 820px;
|
16 |
+
border-radius:4px;
|
17 |
+
margin:0;
|
18 |
+
padding:0;
|
19 |
+
}
|
20 |
+
|
21 |
+
ul.tabs li {
|
22 |
+
float:left;
|
23 |
+
height:31px;
|
24 |
+
line-height:31px;
|
25 |
+
border:1px solid #999;
|
26 |
+
overflow:hidden;
|
27 |
+
position:relative;
|
28 |
+
background:#eee;
|
29 |
+
-webkit-border-top-left-radius:2px;
|
30 |
+
-webkit-border-top-right-radius:2px;
|
31 |
+
-moz-border-radius-topleft:0px;
|
32 |
+
-moz-border-radius-topright:0px;
|
33 |
+
border-top-left-radius:2px;
|
34 |
+
border-top-right-radius:2px;
|
35 |
+
margin:0 5px -1px 0;
|
36 |
+
padding:0;
|
37 |
+
}
|
38 |
+
|
39 |
+
.bcheckbox{
|
40 |
+
display: inline !important;
|
41 |
+
}
|
42 |
+
|
43 |
+
ul.tabs li a {
|
44 |
+
text-decoration:none;
|
45 |
+
color:#000;
|
46 |
+
display:block;
|
47 |
+
/*font-size:14px;*/
|
48 |
+
border:1px solid #fff;
|
49 |
+
outline:none;
|
50 |
+
-webkit-border-top-left-radius:4px;
|
51 |
+
-webkit-border-top-right-radius:4px;
|
52 |
+
-moz-border-radius-topleft:0px;
|
53 |
+
-moz-border-radius-topright:0px;
|
54 |
+
border-top-left-radius:4px;
|
55 |
+
border-top-right-radius:4px;
|
56 |
+
padding:0 20px;
|
57 |
+
}
|
58 |
+
|
59 |
+
ul.tabs li a:hover {
|
60 |
+
background:#ccc;
|
61 |
+
}
|
62 |
+
|
63 |
+
html ul.tabs li.active,html ul.tabs li.active a:hover {
|
64 |
+
background:#fff;
|
65 |
+
border-bottom:1px solid #fff;
|
66 |
+
}
|
67 |
+
|
68 |
+
.tabContainer {
|
69 |
+
border:1px solid #999;
|
70 |
+
overflow:hidden;
|
71 |
+
clear:both;
|
72 |
+
float:left;
|
73 |
+
width:100%;
|
74 |
+
min-width: 820px;
|
75 |
+
background:#fff;
|
76 |
+
-webkit-border-radius:4px;
|
77 |
+
-webkit-border-top-left-radius:0;
|
78 |
+
-moz-border-radius:8px;
|
79 |
+
-moz-border-radius-topleft:0;
|
80 |
+
border-radius:4px;
|
81 |
+
border-top-left-radius:0;
|
82 |
+
}
|
83 |
+
|
84 |
+
.tabContent {
|
85 |
+
/*font-size: 12px;*/
|
86 |
+
padding:20px;
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
.pagination{
|
91 |
+
/*font-size:12px;*/
|
92 |
+
margin:0 0 30px}
|
93 |
+
.pagination a,.pagination span{-moz-border-radius:4px;border:1px solid #CCC;color:#000;display:inline-block;margin:2px!important;padding:5px 8px}
|
94 |
+
.pagination a{background:url(images/gradient_color_bg.gif) repeat-x scroll center top #e5e5e5;text-decoration:none}
|
95 |
+
.pagination a:hover{background:none #0073aa;color:#FFF}
|
96 |
+
.pagination span.currentpage{
|
97 |
+
background: #e5e5e5;
|
98 |
+
border: 1px solid #ccc;
|
99 |
+
color: #0073aa;
|
100 |
+
text-decoration: underline;
|
101 |
+
|
102 |
+
}
|
103 |
+
.pagination span.spaninput{-moz-border-radius:4px;border:1px solid #CCC;color:#000;display:inline-block;margin:2px!important;padding:2px}
|
104 |
+
.pagination input{
|
105 |
+
border: 1px solid #ccc;
|
106 |
+
/* font-size: 12px; */
|
107 |
+
margin: 2px;
|
108 |
+
text-align: center;
|
109 |
+
width: 35px;
|
110 |
+
height: 30px;}
|
111 |
+
.grid{border:1px solid #CCC;border-collapse:collapse;
|
112 |
+
/*font-size:10pt*/
|
113 |
+
}
|
114 |
+
.grid td{border:1px solid #CCC;padding:3px}
|
115 |
+
.grid tbody tr:nth-child(even){background:#FDFDFD}
|
116 |
+
.grid tbody tr:nth-child(odd){background:#FFF}
|
117 |
+
.grid thead td{padding-left:6px;padding-right:6px}
|
118 |
+
.grid thead,.grid tfoot{background:url(images/gradient_color_bg.gif) repeat-x scroll center top #EFEFEF;color:#000;font-weight:700}
|
119 |
+
.grid a {text-decoration: none; }
|
120 |
+
|
121 |
+
.cfrom{border:0px;border-collapse:collapse;
|
122 |
+
/*font-size:10pt*/
|
123 |
+
}
|
124 |
+
.cform td{padding:3px;
|
125 |
+
/*font-size: 12px;*/
|
126 |
+
}
|
127 |
+
.cform tbody td.label{width:110px;}
|
128 |
+
.cform tbody td.labelx{width:160px;}
|
129 |
+
.cform tbody td.labelxx{width:200px;}
|
130 |
+
.cform tbody tr:nth-child(odd){background:#FDFDFD}
|
131 |
+
.cform tbody tr:nth-child(even){background:#FFF}
|
132 |
+
|
133 |
+
|
134 |
+
.link_buttons{
|
135 |
+
/*font-size:12px;*/
|
136 |
+
margin-bottom:5px;}
|
137 |
+
.link_buttons a{background:url(images/gradient_color_bg.gif) repeat-x scroll center top #EFEFEF;text-decoration:none;-moz-border-radius:4px;border:1px solid #CCC;color:#000;display:inline-block;margin:2px!important;padding:2px 8px}
|
138 |
+
.link_buttons a:hover{background:none #313428;color:#FFF}
|
139 |
+
|
140 |
+
|
141 |
+
.info_icon { width:32px; height:32px; background:url(images/large-info.png) 0 0; float:left; margin-top: -7px; margin-right: 7px; }
|
142 |
+
.warning_icon { width:32px; height:32px; background:url(images/dialog-warning.png) 0 0; float:left; margin-top: -7px; margin-right: 7px; }
|
143 |
+
.success_icon { width:32px; height:32px; background:url(images/action_success.png) 0 0; float:left; margin-top: -7px; margin-right: 7px; }
|
144 |
+
.failure_icon { width:30px; height:30px; background:url(images/error.png) 0 0; float:left; margin-top: -7px; margin-right: 7px; }
|
145 |
+
|
146 |
+
.del_template { width:16px; height:16px; background:url(images/delete.png) no-repeat 0 0; }
|
147 |
+
.add_template { width:16px; height:16px; background:url(images/add.png) no-repeat 0 0;}
|
148 |
+
.search_template { width:16px; height:16px; background:url(images/search.png) no-repeat 0 0; }
|
149 |
+
.edit_template {width:16px; height:16px; background:url(images/edit.png) no-repeat 0 0;}
|
150 |
+
.go_link_template {width:16px; height:16px; background:url(images/go_link.png) no-repeat 0 0;}
|
151 |
+
|
152 |
+
a.help_link{ line-height: 24px; background:url(images/help_off.png) no-repeat left center; padding-left:28px; margin-top: -15px; float:right; text-decoration: none; font-szie: 12px}
|
153 |
+
a.help_link:hover { background:url(images/help_over.png) no-repeat left center;}
|
154 |
+
|
155 |
+
.add_link {height:26px; background:url(images/add.png) no-repeat 0 0; background-position: left center; line-height: 26px; padding-left:21px; padding-right:5px;}
|
156 |
+
.del_link {height:26px; background:url(images/delete.png) no-repeat 0 0; background-position: left center; line-height: 26px; padding-left:21px; padding-right:5px;}
|
157 |
+
.search_link {height:26px; background:url(images/search.png) no-repeat 0 0; background-position: left center; line-height: 26px; padding-left:21px; padding-right:5px;}
|
158 |
+
.see_link {height:26px; background:url(images/see.png) no-repeat 0 0; background-position: left center; line-height: 26px; padding-left:25px; padding-right:5px;}
|
159 |
+
.link {height:26px; background:url(images/link.png) no-repeat 0 0; background-position: left center; line-height: 26px; padding-left:17px;}
|
160 |
+
|
161 |
+
.hint_text {
|
162 |
+
/*font-size: 12px;*/
|
163 |
+
color:#a7a7a7}
|
164 |
+
|
165 |
+
#myform .cform select{
|
166 |
+
height: 40px !important;
|
167 |
+
vertical-align: bottom;
|
168 |
+
}
|
169 |
+
ul.tabs li:hover, ul.tabs li:hover a {
|
170 |
+
border-bottom-color: #fff;
|
171 |
+
background: #fff;
|
172 |
+
}
|
173 |
+
ul.tabs li a:hover {
|
174 |
+
background: #fff;
|
175 |
+
border-color: #fff;
|
176 |
+
}
|
177 |
+
|
178 |
+
.help-block{
|
179 |
+
display:block ;
|
180 |
+
color: red;
|
181 |
+
font-weight: bold;
|
182 |
+
}
|
183 |
+
/* Absolute Center Spinner */
|
184 |
+
.loading {
|
185 |
+
position: fixed;
|
186 |
+
z-index: 99999999;
|
187 |
+
height: 2em;
|
188 |
+
width: 2em;
|
189 |
+
overflow: show;
|
190 |
+
margin: auto;
|
191 |
+
top: 0;
|
192 |
+
left: 0;
|
193 |
+
bottom: 0;
|
194 |
+
right: 0;
|
195 |
+
}
|
196 |
+
|
197 |
+
/* Transparent Overlay */
|
198 |
+
.loading:before {
|
199 |
+
content: '';
|
200 |
+
display: block;
|
201 |
+
position: fixed;
|
202 |
+
top: 0;
|
203 |
+
left: 0;
|
204 |
+
width: 100%;
|
205 |
+
height: 100%;
|
206 |
+
background: radial-gradient(rgba(20, 20, 20,.8), rgba(0, 0, 0, .8));
|
207 |
+
|
208 |
+
background: -webkit-radial-gradient(rgba(20, 20, 20,.8), rgba(0, 0, 0,.8));
|
209 |
+
}
|
210 |
+
|
211 |
+
/* :not(:required) hides these rules from IE9 and below */
|
212 |
+
.loading:not(:required) {
|
213 |
+
/* hide "loading..." text */
|
214 |
+
font: 0/0 a;
|
215 |
+
color: transparent;
|
216 |
+
text-shadow: none;
|
217 |
+
background-color: transparent;
|
218 |
+
border: 0;
|
219 |
+
}
|
220 |
+
|
221 |
+
.loading:not(:required):after {
|
222 |
+
content: '';
|
223 |
+
display: block;
|
224 |
+
font-size: 10px;
|
225 |
+
width: 1em;
|
226 |
+
height: 1em;
|
227 |
+
margin-top: -0.5em;
|
228 |
+
-webkit-animation: spinner 1500ms infinite linear;
|
229 |
+
-moz-animation: spinner 1500ms infinite linear;
|
230 |
+
-ms-animation: spinner 1500ms infinite linear;
|
231 |
+
-o-animation: spinner 1500ms infinite linear;
|
232 |
+
animation: spinner 1500ms infinite linear;
|
233 |
+
border-radius: 0.5em;
|
234 |
+
-webkit-box-shadow: rgba(255,255,255, 0.75) 1.5em 0 0 0, rgba(255,255,255, 0.75) 1.1em 1.1em 0 0, rgba(255,255,255, 0.75) 0 1.5em 0 0, rgba(255,255,255, 0.75) -1.1em 1.1em 0 0, rgba(255,255,255, 0.75) -1.5em 0 0 0, rgba(255,255,255, 0.75) -1.1em -1.1em 0 0, rgba(255,255,255, 0.75) 0 -1.5em 0 0, rgba(255,255,255, 0.75) 1.1em -1.1em 0 0;
|
235 |
+
box-shadow: rgba(255,255,255, 0.75) 1.5em 0 0 0, rgba(255,255,255, 0.75) 1.1em 1.1em 0 0, rgba(255,255,255, 0.75) 0 1.5em 0 0, rgba(255,255,255, 0.75) -1.1em 1.1em 0 0, rgba(255,255,255, 0.75) -1.5em 0 0 0, rgba(255,255,255, 0.75) -1.1em -1.1em 0 0, rgba(255,255,255, 0.75) 0 -1.5em 0 0, rgba(255,255,255, 0.75) 1.1em -1.1em 0 0;
|
236 |
+
}
|
237 |
+
|
238 |
+
/* Animation */
|
239 |
+
|
240 |
+
@-webkit-keyframes spinner {
|
241 |
+
0% {
|
242 |
+
-webkit-transform: rotate(0deg);
|
243 |
+
-moz-transform: rotate(0deg);
|
244 |
+
-ms-transform: rotate(0deg);
|
245 |
+
-o-transform: rotate(0deg);
|
246 |
+
transform: rotate(0deg);
|
247 |
+
}
|
248 |
+
100% {
|
249 |
+
-webkit-transform: rotate(360deg);
|
250 |
+
-moz-transform: rotate(360deg);
|
251 |
+
-ms-transform: rotate(360deg);
|
252 |
+
-o-transform: rotate(360deg);
|
253 |
+
transform: rotate(360deg);
|
254 |
+
}
|
255 |
+
}
|
256 |
+
@-moz-keyframes spinner {
|
257 |
+
0% {
|
258 |
+
-webkit-transform: rotate(0deg);
|
259 |
+
-moz-transform: rotate(0deg);
|
260 |
+
-ms-transform: rotate(0deg);
|
261 |
+
-o-transform: rotate(0deg);
|
262 |
+
transform: rotate(0deg);
|
263 |
+
}
|
264 |
+
100% {
|
265 |
+
-webkit-transform: rotate(360deg);
|
266 |
+
-moz-transform: rotate(360deg);
|
267 |
+
-ms-transform: rotate(360deg);
|
268 |
+
-o-transform: rotate(360deg);
|
269 |
+
transform: rotate(360deg);
|
270 |
+
}
|
271 |
+
}
|
272 |
+
@-o-keyframes spinner {
|
273 |
+
0% {
|
274 |
+
-webkit-transform: rotate(0deg);
|
275 |
+
-moz-transform: rotate(0deg);
|
276 |
+
-ms-transform: rotate(0deg);
|
277 |
+
-o-transform: rotate(0deg);
|
278 |
+
transform: rotate(0deg);
|
279 |
+
}
|
280 |
+
100% {
|
281 |
+
-webkit-transform: rotate(360deg);
|
282 |
+
-moz-transform: rotate(360deg);
|
283 |
+
-ms-transform: rotate(360deg);
|
284 |
+
-o-transform: rotate(360deg);
|
285 |
+
transform: rotate(360deg);
|
286 |
+
}
|
287 |
+
}
|
288 |
+
@keyframes spinner {
|
289 |
+
0% {
|
290 |
+
-webkit-transform: rotate(0deg);
|
291 |
+
-moz-transform: rotate(0deg);
|
292 |
+
-ms-transform: rotate(0deg);
|
293 |
+
-o-transform: rotate(0deg);
|
294 |
+
transform: rotate(0deg);
|
295 |
+
}
|
296 |
+
100% {
|
297 |
+
-webkit-transform: rotate(360deg);
|
298 |
+
-moz-transform: rotate(360deg);
|
299 |
+
-ms-transform: rotate(360deg);
|
300 |
+
-o-transform: rotate(360deg);
|
301 |
+
transform: rotate(360deg);
|
302 |
+
}
|
303 |
+
}
|
304 |
+
.customSwalBtn1{
|
305 |
+
background-color: #c9302c;
|
306 |
+
border-color: #ac2925;
|
307 |
+
border: 0;
|
308 |
+
border-radius: 2px;
|
309 |
+
color: #fff;
|
310 |
+
cursor: pointer;
|
311 |
+
font-size: 17px;
|
312 |
+
font-weight: 500;
|
313 |
+
margin: 30px 5px 0px 5px;
|
314 |
+
padding: 10px 32px;
|
315 |
+
}
|
316 |
+
|
317 |
+
.customSwalBtn2{
|
318 |
+
color: #fff;
|
319 |
+
background-color: #5cb85c;
|
320 |
+
border-color: #4cae4c;
|
321 |
+
border: 0;
|
322 |
+
border-radius: 2px;
|
323 |
+
cursor: pointer;
|
324 |
+
font-size: 17px;
|
325 |
+
font-weight: 500;
|
326 |
+
margin: 30px 5px 0px 5px;
|
327 |
+
padding: 10px 32px;
|
328 |
+
}
|
329 |
+
.customSwalBtn3{
|
330 |
+
|
331 |
+
background-color: #f0ad4e;
|
332 |
+
border-color: #eea236;
|
333 |
+
border: 0;
|
334 |
+
border-radius: 2px;
|
335 |
+
color: #fff;
|
336 |
+
cursor: pointer;
|
337 |
+
font-size: 17px;
|
338 |
+
font-weight: 500;
|
339 |
+
margin: 30px 5px 0px 5px;
|
340 |
+
padding: 10px 32px;
|
341 |
+
}
|
342 |
+
.swal2-modal h2{
|
343 |
+
font-size:18px !important;
|
344 |
+
font-weight: 300 !important;
|
345 |
+
line-height: 20px !important;
|
346 |
+
font-weight: bold !important;
|
347 |
+
}
|
common/sweetalert.css
ADDED
@@ -0,0 +1 @@
|
|
Â
|
1 |
+
.swal2-modal,.swal2-overlay{position:fixed;display:none}.swal2-overlay{background-color:rgba(0,0,0,.4);left:0;right:0;top:0;bottom:0;z-index:1000}.swal2-modal{background-color:#fff;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;border-radius:5px;box-sizing:border-box;text-align:center;left:50%;top:50%;margin-top:-200px;max-height:90%;overflow-x:hidden;overflow-y:auto;z-index:2000}.swal2-modal:focus{outline:0}.swal2-modal.loading{overflow-y:hidden}.swal2-modal h2{color:#575757;font-size:30px;text-align:center;font-weight:600;text-transform:none;position:relative;margin:0;padding:0;line-height:60px;display:block}.swal2-modal .swal2-spacer{height:10px;color:transparent;border:0}.swal2-modal button.styled{color:#fff;border:0;box-shadow:none;font-size:17px;font-weight:500;border-radius:3px;padding:10px 32px;margin:0 5px;cursor:pointer}.swal2-content,.swal2-icon{padding:0;position:relative}.swal2-modal button.styled:not(.loading)[disabled]{opacity:.4;cursor:no-drop}.swal2-modal button.styled.loading{box-sizing:border-box;border:4px solid transparent;width:40px;height:40px;padding:0;margin:-2px 30px;vertical-align:top;background-color:transparent!important;color:transparent;cursor:default;border-radius:100%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal}.swal2-modal button:not(.styled).loading:after{display:inline-block;content:"";margin-left:5px;vertical-align:-1px;height:6px;width:6px;border:3px solid #999;border-right-color:transparent;border-radius:50%;-webkit-animation:rotate-loading 1.5s linear 0s infinite normal;animation:rotate-loading 1.5s linear 0s infinite normal}.swal2-checkbox input,.swal2-checkbox span,.swal2-radio input,.swal2-radio span{vertical-align:middle}.swal2-modal .swal2-image{margin:20px auto;max-width:100%}.swal2-modal .swal2-close{font-size:36px;line-height:36px;font-family:serif;position:absolute;top:5px;right:13px;cursor:pointer;color:#cfcfcf;-webkit-transition:all .1s ease;transition:all .1s ease}.swal2-modal .swal2-close:hover{color:#d55}.swal2-modal>.swal2-checkbox,.swal2-modal>.swal2-input,.swal2-modal>.swal2-radio,.swal2-modal>.swal2-select,.swal2-modal>.swal2-textarea{display:none}.swal2-content{font-size:18px;text-align:center;font-weight:300;float:none;margin:0;line-height:normal;color:#555}.swal2-icon.swal2-info,.swal2-icon.swal2-question,.swal2-icon.swal2-warning{font-size:60px;line-height:80px;text-align:center}.swal2-icon{width:80px;height:80px;border:4px solid grey;border-radius:50%;margin:20px auto 30px;box-sizing:content-box;cursor:default;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .x-mark{position:relative;display:block}.swal2-icon.swal2-error .line{position:absolute;height:5px;width:47px;background-color:#f27474;display:block;top:37px;border-radius:2px}.swal2-icon.swal2-error .line.left{-webkit-transform:rotate(45deg);transform:rotate(45deg);left:17px}.swal2-icon.swal2-error .line.right{-webkit-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}.swal2-icon.swal2-warning{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;color:#f8bb86;border-color:#f8bb86}.swal2-icon.swal2-info{font-family:"Open Sans",sans-serif;color:#3fc3ee;border-color:#3fc3ee}.swal2-icon.swal2-question{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;color:#c9dae1;border-color:#c9dae1}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success::after,.swal2-icon.swal2-success::before{content:'';position:absolute;width:60px;height:120px;background:#fff}.swal2-icon.swal2-success::before{border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;transform-origin:60px 60px}.swal2-icon.swal2-success::after{border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;transform-origin:0 60px}.swal2-icon.swal2-success .placeholder{width:80px;height:80px;border:4px solid rgba(165,220,134,.2);border-radius:50%;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.swal2-icon.swal2-success .fix{width:7px;height:90px;background-color:#fff;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-success .line{height:5px;background-color:#a5dc86;display:block;border-radius:2px;position:absolute;z-index:2}.swal2-icon.swal2-success .line.tip{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success .line.long{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-checkbox,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:20px auto}.swal2-input:not([type=file]),.swal2-textarea{width:100%;box-sizing:border-box;border-radius:3px;border:1px solid #d7d7d7;font-size:18px;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);-webkit-transition:all .3s;transition:all .3s}.swal2-input:not([type=file]).error,.swal2-textarea.error{border-color:#f06e57!important}.swal2-input:not([type=file]):focus,.swal2-textarea:focus{outline:0;box-shadow:0 0 3px #c4e6f5;border:1px solid #b4dbed}.swal2-input:not([type=file]):focus::-moz-placeholder,.swal2-textarea:focus::-moz-placeholder{-webkit-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file]):focus:-ms-input-placeholder,.swal2-textarea:focus:-ms-input-placeholder{-webkit-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file]):focus::-webkit-input-placeholder,.swal2-textarea:focus::-webkit-input-placeholder{-webkit-transition:opacity .3s 30ms ease;transition:opacity .3s 30ms ease;opacity:.8}.swal2-input:not([type=file])::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#bdbdbd}.swal2-input:not([type=file]):-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#bdbdbd}.swal2-input:not([type=file])::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#bdbdbd}.swal2-input:not([type=file]){height:43px;padding:0 12px}.swal2-input[type=file]{font-size:20px}.swal2-textarea{height:108px;padding:12px}.swal2-select{color:#555;font-size:inherit;padding:5px 10px;min-width:40%;max-width:100%}.swal2-radio{border:0}.swal2-radio label:not(:first-child){margin-left:20px}.swal2-radio input{margin:0 3px 0 0}.swal2-checkbox{color:#555}.swal2-validationerror{background-color:#f1f1f1;margin:0 -20px;overflow:hidden;padding:10px;color:#797979;font-size:16px;font-weight:300;display:none}.swal2-validationerror::before{content:"!";display:inline-block;width:24px;height:24px;border-radius:50%;background-color:#ea7d7d;color:#fff;line-height:24px;text-align:center;margin-right:10px}@-webkit-keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}.show-swal2{-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s}.show-swal2.no-animation{-webkit-animation:none;animation:none}.hide-swal2{-webkit-animation:hideSweetAlert .15s forwards;animation:hideSweetAlert .15s forwards}.hide-swal2.no-animation{-webkit-animation:none;animation:none}@-webkit-keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@-webkit-keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@-webkit-keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}.animate-success-tip{-webkit-animation:animate-success-tip .75s;animation:animate-success-tip .75s}.animate-success-long{-webkit-animation:animate-success-long .75s;animation:animate-success-long .75s}.swal2-icon.swal2-success.animate::after{-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}@-webkit-keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}@keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}.animate-error-icon{-webkit-animation:animate-error-icon .5s;animation:animate-error-icon .5s}@-webkit-keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}@keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}.animate-x-mark{-webkit-animation:animate-x-mark .5s;animation:animate-x-mark .5s}@-webkit-keyframes pulse-warning{0%{border-color:#f8d486}100%{border-color:#f8bb86}}@keyframes pulse-warning{0%{border-color:#f8d486}100%{border-color:#f8bb86}}.pulse-warning{-webkit-animation:pulse-warning .75s infinite alternate;animation:pulse-warning .75s infinite alternate}@-webkit-keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}
|
common/util.php
ADDED
@@ -0,0 +1,659 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â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â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Author: Fakhri Alsadi
|
4 |
+
Date: 16-7-2010
|
5 |
+
Contact: www.clogica.com info@clogica.com mobile: +972599322252
|
6 |
+
*/
|
7 |
+
|
8 |
+
if(!class_exists('clogica_util_1')){
|
9 |
+
class clogica_util_1{
|
10 |
+
|
11 |
+
private $slug;
|
12 |
+
private $plugin_file;
|
13 |
+
private $plugin_path;
|
14 |
+
private $plugin_url;
|
15 |
+
|
16 |
+
private $option_group_name='clogica_option_group';
|
17 |
+
private $plugin_folder='plugin_folder_name';
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
public function init ($option_gruop='clogica_option_group',$plugin_file='')
|
22 |
+
{
|
23 |
+
$this->set_option_gruop($option_gruop);
|
24 |
+
$this->set_plugin_folder(basename(dirname($plugin_file)));
|
25 |
+
$this->plugin_file = $plugin_file;
|
26 |
+
$this->slug = basename($plugin_file);
|
27 |
+
$this->plugin_path = dirname($plugin_file) . '/';
|
28 |
+
$this->plugin_url =plugin_dir_url($plugin_file);
|
29 |
+
|
30 |
+
}
|
31 |
+
public function get($key,$type='text')
|
32 |
+
{
|
33 |
+
|
34 |
+
if(array_key_exists($key,$_GET))
|
35 |
+
{
|
36 |
+
$unsafe_val=$_GET[$key];
|
37 |
+
return $this->sanitize_req($unsafe_val,$type);
|
38 |
+
}
|
39 |
+
else
|
40 |
+
{
|
41 |
+
return '';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
//----------------------------------------------------
|
46 |
+
|
47 |
+
public function post($key,$type='text')
|
48 |
+
{
|
49 |
+
if(array_key_exists($key,$_POST))
|
50 |
+
{
|
51 |
+
$unsafe_val=$_POST[$key];
|
52 |
+
return $this->sanitize_req($unsafe_val,$type);
|
53 |
+
}
|
54 |
+
else
|
55 |
+
{
|
56 |
+
return '';
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
//----------------------------------------------------
|
62 |
+
|
63 |
+
public function sanitize_req($unsafe_val,$type='text')
|
64 |
+
{
|
65 |
+
switch ($type) {
|
66 |
+
case 'text': return sanitize_text_field($unsafe_val);
|
67 |
+
break;
|
68 |
+
|
69 |
+
case 'int': return intval($unsafe_val);
|
70 |
+
break;
|
71 |
+
|
72 |
+
case 'email': return sanitize_email($unsafe_val);
|
73 |
+
break;
|
74 |
+
|
75 |
+
case 'filename': return sanitize_file_name($unsafe_val);
|
76 |
+
break;
|
77 |
+
|
78 |
+
case 'title': return sanitize_title($unsafe_val);
|
79 |
+
break;
|
80 |
+
|
81 |
+
case 'url': return esc_url($unsafe_val);
|
82 |
+
break;
|
83 |
+
|
84 |
+
default:
|
85 |
+
return sanitize_text_field($unsafe_val);
|
86 |
+
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
//----------------------------------------------------
|
91 |
+
|
92 |
+
public function get_ref()
|
93 |
+
{
|
94 |
+
if(array_key_exists('HTTP_REFERER',$_SERVER))
|
95 |
+
{
|
96 |
+
return $this->sanitize_req(strip_tags($_SERVER['HTTP_REFERER']),"url");
|
97 |
+
}
|
98 |
+
else
|
99 |
+
{
|
100 |
+
return '';
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
//----------------------------------------------------
|
105 |
+
|
106 |
+
public function set_option_gruop($option_group_name)
|
107 |
+
{
|
108 |
+
$this->option_group_name=$option_group_name;
|
109 |
+
}
|
110 |
+
|
111 |
+
//----------------------------------------------------
|
112 |
+
|
113 |
+
public function get_option_gruop()
|
114 |
+
{
|
115 |
+
return $this->option_group_name;
|
116 |
+
}
|
117 |
+
|
118 |
+
//----------------------------------------------------
|
119 |
+
|
120 |
+
public function set_plugin_folder($folder)
|
121 |
+
{
|
122 |
+
$this->plugin_folder=$folder;
|
123 |
+
}
|
124 |
+
|
125 |
+
|
126 |
+
//----------------------------------------------------
|
127 |
+
|
128 |
+
public function get_plugin_folder()
|
129 |
+
{
|
130 |
+
return $this->plugin_folder;
|
131 |
+
}
|
132 |
+
|
133 |
+
//----------------------------------------------------
|
134 |
+
|
135 |
+
|
136 |
+
public function update_my_options($options)
|
137 |
+
{
|
138 |
+
update_option($this->get_option_gruop(),$options);
|
139 |
+
}
|
140 |
+
|
141 |
+
//----------------------------------------------------
|
142 |
+
|
143 |
+
public function get_my_options()
|
144 |
+
{
|
145 |
+
$options=get_option($this->get_option_gruop());
|
146 |
+
if(!is_array($options))
|
147 |
+
{
|
148 |
+
add_option($this->get_option_gruop());
|
149 |
+
$options= array();
|
150 |
+
}
|
151 |
+
return $options;
|
152 |
+
}
|
153 |
+
|
154 |
+
//---------------------------------------------------
|
155 |
+
|
156 |
+
public function get_option_value($key)
|
157 |
+
{
|
158 |
+
$options=$this->get_my_options();
|
159 |
+
if(array_key_exists($key,$options))
|
160 |
+
{
|
161 |
+
return $options[$key];
|
162 |
+
}else
|
163 |
+
{
|
164 |
+
return '';
|
165 |
+
}
|
166 |
+
}
|
167 |
+
//----------------------------------------------------
|
168 |
+
|
169 |
+
public function update_option($key,$value)
|
170 |
+
{
|
171 |
+
$options=$this->get_my_options();
|
172 |
+
$options[$key]=$value;
|
173 |
+
$this->update_my_options($options);
|
174 |
+
}
|
175 |
+
|
176 |
+
//----------------------------------------------------
|
177 |
+
|
178 |
+
public function update_post_option($key)
|
179 |
+
{
|
180 |
+
$options=$this->get_my_options();
|
181 |
+
$options[$key]=intval($this->post($key));
|
182 |
+
$this->update_my_options($options);
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
//----------------------------------------------------
|
187 |
+
|
188 |
+
|
189 |
+
public function delete_my_options()
|
190 |
+
{
|
191 |
+
delete_option($this->get_option_gruop());
|
192 |
+
}
|
193 |
+
|
194 |
+
|
195 |
+
|
196 |
+
/* get_current_URL ---------------------------------------------- */
|
197 |
+
public function get_current_URL()
|
198 |
+
{
|
199 |
+
$pageURL = 'http';
|
200 |
+
if ( array_key_exists("HTTPS",$_SERVER) && $_SERVER["HTTPS"] == "on")
|
201 |
+
{
|
202 |
+
$pageURL .= "s";
|
203 |
+
}
|
204 |
+
$pageURL .= "://";
|
205 |
+
|
206 |
+
if (array_key_exists("SERVER_PORT",$_SERVER) && $_SERVER["SERVER_PORT"] != "80") {
|
207 |
+
$pageURL .= $_SERVER["HTTP_HOST"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
208 |
+
} else {
|
209 |
+
$pageURL .= $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
|
210 |
+
}
|
211 |
+
return $this->sanitize_req($pageURL,"url");
|
212 |
+
}
|
213 |
+
|
214 |
+
//-----------------------------------------------------
|
215 |
+
|
216 |
+
public function remove_url_http_www($url)
|
217 |
+
{
|
218 |
+
$url = str_ireplace("http://www.",'',$url);
|
219 |
+
$url = str_ireplace("https://www.",'',$url);
|
220 |
+
$url = str_ireplace("http://",'',$url);
|
221 |
+
$url = str_ireplace("https://",'',$url);
|
222 |
+
return $url;
|
223 |
+
}
|
224 |
+
//-----------------------------------------------------
|
225 |
+
public function make_relative_url($url)
|
226 |
+
{
|
227 |
+
if($url=="")
|
228 |
+
{
|
229 |
+
return "";
|
230 |
+
}
|
231 |
+
$site_url = $this->remove_url_http_www(site_url());
|
232 |
+
if(stripos($url,$site_url) !==false)
|
233 |
+
{
|
234 |
+
$url_no_www = $this->remove_url_http_www($url);
|
235 |
+
if(strtolower(substr($url_no_www,0,strlen($site_url))) == strtolower($site_url))
|
236 |
+
{
|
237 |
+
$url = str_ireplace($site_url,'',$url_no_www);
|
238 |
+
}
|
239 |
+
}
|
240 |
+
if($url=="")
|
241 |
+
{
|
242 |
+
$url="/";
|
243 |
+
}
|
244 |
+
return $url;
|
245 |
+
}
|
246 |
+
|
247 |
+
//----------------------------------------------------
|
248 |
+
public function make_absolute_url($url)
|
249 |
+
{
|
250 |
+
if(substr($url,0,1)=='/')
|
251 |
+
{
|
252 |
+
$url = site_url() . $url;
|
253 |
+
}
|
254 |
+
return $url;
|
255 |
+
}
|
256 |
+
|
257 |
+
//----------------------------------------------------
|
258 |
+
|
259 |
+
public function get_current_relative_url()
|
260 |
+
{
|
261 |
+
return $this->make_relative_url($this->get_current_URL());
|
262 |
+
}
|
263 |
+
//----------------------------------------------------
|
264 |
+
public function is_valid_url($url)
|
265 |
+
{
|
266 |
+
if(stripos($url,'://')!== false || substr($url,0, 1)=='/')
|
267 |
+
{
|
268 |
+
return true;
|
269 |
+
}else{
|
270 |
+
return false;
|
271 |
+
}
|
272 |
+
}
|
273 |
+
//----------------------------------------------------
|
274 |
+
|
275 |
+
public function get_current_parameters($remove_parameter="")
|
276 |
+
{
|
277 |
+
|
278 |
+
if($_SERVER['QUERY_STRING']!='')
|
279 |
+
{
|
280 |
+
$qry = '?' . $_SERVER['QUERY_STRING'];
|
281 |
+
|
282 |
+
if(is_array($remove_parameter))
|
283 |
+
{
|
284 |
+
for($i=0;$i<count($remove_parameter);$i++)
|
285 |
+
{
|
286 |
+
if(array_key_exists($remove_parameter[$i],$_GET)){
|
287 |
+
$string_remove = '&' . $remove_parameter[$i] . "=" . $this->get($remove_parameter[$i]);
|
288 |
+
$qry=str_replace($string_remove,"",$qry);
|
289 |
+
$string_remove = '?' . $remove_parameter[$i] . "=" . $this->get($remove_parameter[$i]);
|
290 |
+
$qry=str_replace($string_remove,"",$qry);
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
}else{
|
295 |
+
if($remove_parameter!='')
|
296 |
+
{
|
297 |
+
if(array_key_exists($remove_parameter,$_GET)){
|
298 |
+
$string_remove = '&' . $remove_parameter . "=" . $this->get($remove_parameter);
|
299 |
+
$qry=str_replace($string_remove,"",$qry);
|
300 |
+
$string_remove = '?' . $remove_parameter . "=" . $this->get($remove_parameter);
|
301 |
+
$qry=str_replace($string_remove,"",$qry);
|
302 |
+
}
|
303 |
+
}
|
304 |
+
}
|
305 |
+
return $this->sanitize_req($qry,"url");
|
306 |
+
}else
|
307 |
+
{
|
308 |
+
return "";
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
|
313 |
+
//---------------------------------------------------------------
|
314 |
+
|
315 |
+
public function get_plugin_path($folder='')
|
316 |
+
{
|
317 |
+
return WP_PLUGIN_DIR . '/' . $this->get_plugin_folder() . '/' . $folder;
|
318 |
+
}
|
319 |
+
|
320 |
+
/* get_plugin_path ---------------------------------------------
|
321 |
+
public function get_plugin_path()
|
322 |
+
{
|
323 |
+
return $this->plugin_path;
|
324 |
+
}*/
|
325 |
+
|
326 |
+
/* get plugin slug -------------------------------------------- */
|
327 |
+
public function get_plugin_slug()
|
328 |
+
{
|
329 |
+
return $this->slug;
|
330 |
+
}
|
331 |
+
|
332 |
+
/* get plugin slug -------------------------------------------- */
|
333 |
+
public function get_plugin_file()
|
334 |
+
{
|
335 |
+
return $this->plugin_file;
|
336 |
+
}
|
337 |
+
//-----------------------------------------------------
|
338 |
+
|
339 |
+
|
340 |
+
public function get_plugin_url($url='')
|
341 |
+
{
|
342 |
+
return $this->plugin_url;
|
343 |
+
}
|
344 |
+
|
345 |
+
|
346 |
+
//----------------------------------------------------
|
347 |
+
|
348 |
+
public function get_visitor_IP()
|
349 |
+
{
|
350 |
+
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
351 |
+
|
352 |
+
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
353 |
+
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
|
354 |
+
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
355 |
+
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
356 |
+
}
|
357 |
+
|
358 |
+
return $ipaddress ;
|
359 |
+
}
|
360 |
+
|
361 |
+
//----------------------------------------------------
|
362 |
+
|
363 |
+
|
364 |
+
public function get_visitor_OS()
|
365 |
+
{
|
366 |
+
|
367 |
+
$userAgent= $_SERVER['HTTP_USER_AGENT'];
|
368 |
+
$oses = array (
|
369 |
+
'iPhone' => '(iPhone)',
|
370 |
+
'Windows 3.11' => 'Win16',
|
371 |
+
'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)',
|
372 |
+
'Windows 98' => '(Windows 98)|(Win98)',
|
373 |
+
'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
|
374 |
+
'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
|
375 |
+
'Windows 2003' => '(Windows NT 5.2)',
|
376 |
+
'Windows Vista' => '(Windows NT 6.0)|(Windows Vista)',
|
377 |
+
'Windows 7' => '(Windows NT 6.1)|(Windows 7)',
|
378 |
+
'Windows 8' => '(Windows NT 6.2)|(Windows 8)',
|
379 |
+
'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
|
380 |
+
'Windows ME' => 'Windows ME',
|
381 |
+
'Open BSD'=>'OpenBSD',
|
382 |
+
'Sun OS'=>'SunOS',
|
383 |
+
//'Linux'=>'(Linux)|(X11)', to detect if android or not
|
384 |
+
'Safari' => '(Safari)',
|
385 |
+
'Macintosh'=>'(Mac_PowerPC)|(Macintosh)',
|
386 |
+
'QNX'=>'QNX',
|
387 |
+
'BeOS'=>'BeOS',
|
388 |
+
'OS/2'=>'OS\/2',
|
389 |
+
'SearchBot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp\/cat)|(msnbot)|(ia_archiver)'
|
390 |
+
);
|
391 |
+
|
392 |
+
foreach($oses as $os=>$pattern){
|
393 |
+
|
394 |
+
if(preg_match('/'.$pattern. '/i', $userAgent)) {
|
395 |
+
return $os;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
// more tests
|
400 |
+
|
401 |
+
$ua = strtolower($userAgent);
|
402 |
+
|
403 |
+
if(stripos($ua,'android') !== false) {
|
404 |
+
return 'Android';
|
405 |
+
}
|
406 |
+
|
407 |
+
if(stripos($ua,'iphone') !== false) {
|
408 |
+
return 'iOS';
|
409 |
+
}
|
410 |
+
|
411 |
+
|
412 |
+
if(stripos($ua,'ipad') !== false) {
|
413 |
+
return 'iOS';
|
414 |
+
}
|
415 |
+
|
416 |
+
if(stripos($ua,'ipod') !== false) {
|
417 |
+
return 'iOS';
|
418 |
+
}
|
419 |
+
|
420 |
+
if(stripos($ua,'windows') !== false) {
|
421 |
+
return 'Windows';
|
422 |
+
}
|
423 |
+
|
424 |
+
|
425 |
+
if(stripos($ua,'linux') !== false) {
|
426 |
+
return 'Linux';
|
427 |
+
}
|
428 |
+
|
429 |
+
|
430 |
+
if(stripos($ua,'googlebot') !== false) {
|
431 |
+
return 'Googlebot';
|
432 |
+
}
|
433 |
+
|
434 |
+
if(stripos($ua,'bot') !== false) {
|
435 |
+
return 'SearchBot';
|
436 |
+
}
|
437 |
+
|
438 |
+
|
439 |
+
return 'Unknown';
|
440 |
+
}
|
441 |
+
|
442 |
+
//-----------------------------------------------------------------
|
443 |
+
|
444 |
+
public function get_visitor_Browser()
|
445 |
+
{
|
446 |
+
|
447 |
+
$u_agent= $_SERVER['HTTP_USER_AGENT'];
|
448 |
+
$bname = 'Unknown';
|
449 |
+
|
450 |
+
if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent))
|
451 |
+
{
|
452 |
+
$bname = 'Internet Explorer';
|
453 |
+
}
|
454 |
+
elseif(preg_match('/Firefox/i',$u_agent))
|
455 |
+
{
|
456 |
+
$bname = 'Firefox';
|
457 |
+
}
|
458 |
+
elseif(preg_match('/Chrome/i',$u_agent))
|
459 |
+
{
|
460 |
+
$bname = 'Chrome';
|
461 |
+
}
|
462 |
+
elseif(preg_match('/Safari/i',$u_agent))
|
463 |
+
{
|
464 |
+
$bname = 'Safari';
|
465 |
+
}
|
466 |
+
elseif(preg_match('/Opera/i',$u_agent))
|
467 |
+
{
|
468 |
+
$bname = 'Opera';
|
469 |
+
}
|
470 |
+
elseif(preg_match('/Netscape/i',$u_agent))
|
471 |
+
{
|
472 |
+
$bname = 'Netscape';
|
473 |
+
}
|
474 |
+
elseif(preg_match('/googlebot/i',$u_agent))
|
475 |
+
{
|
476 |
+
$bname = 'GoogleBot';
|
477 |
+
}
|
478 |
+
elseif(preg_match('/bot/i',$u_agent))
|
479 |
+
{
|
480 |
+
$bname = 'SearchBot';
|
481 |
+
}
|
482 |
+
|
483 |
+
|
484 |
+
return $bname;
|
485 |
+
|
486 |
+
}
|
487 |
+
|
488 |
+
//----------------------------------------------------
|
489 |
+
|
490 |
+
public function get_visitor_country()
|
491 |
+
{
|
492 |
+
$client = @$_SERVER['HTTP_CLIENT_IP'];
|
493 |
+
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
|
494 |
+
$remote = $_SERVER['REMOTE_ADDR'];
|
495 |
+
$result = "Unknown";
|
496 |
+
if(filter_var($client, FILTER_VALIDATE_IP))
|
497 |
+
{
|
498 |
+
$ip = $client;
|
499 |
+
}
|
500 |
+
elseif(filter_var($forward, FILTER_VALIDATE_IP))
|
501 |
+
{
|
502 |
+
$ip = $forward;
|
503 |
+
}
|
504 |
+
else
|
505 |
+
{
|
506 |
+
$ip = $remote;
|
507 |
+
}
|
508 |
+
|
509 |
+
$ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip));
|
510 |
+
|
511 |
+
if($ip_data && $ip_data->geoplugin_countryName != null)
|
512 |
+
{
|
513 |
+
$result = $ip_data->geoplugin_countryName;
|
514 |
+
}
|
515 |
+
|
516 |
+
return $result;
|
517 |
+
}
|
518 |
+
|
519 |
+
//----------------------------------------------------
|
520 |
+
|
521 |
+
public function option_msg($msg,$out='echo')
|
522 |
+
{
|
523 |
+
$msg = '<div id="message" class="updated"><p>' . $msg . '</p></div>';
|
524 |
+
if($out=='echo')
|
525 |
+
echo $msg;
|
526 |
+
elseif($out=='push')
|
527 |
+
$this->push_msg($msg);
|
528 |
+
}
|
529 |
+
|
530 |
+
//----------------------------------------------------
|
531 |
+
|
532 |
+
|
533 |
+
public function info_option_msg($msg,$out='echo')
|
534 |
+
{
|
535 |
+
|
536 |
+
$msg = '<div id="message" class="updated"><p><div class="info_icon"></div> ' . $msg . '</p></div>';
|
537 |
+
if($out=='echo')
|
538 |
+
echo $msg;
|
539 |
+
elseif($out=='push')
|
540 |
+
$this->push_msg($msg);
|
541 |
+
|
542 |
+
|
543 |
+
}
|
544 |
+
|
545 |
+
//----------------------------------------------------
|
546 |
+
|
547 |
+
|
548 |
+
public function warning_option_msg($msg,$out='echo')
|
549 |
+
{
|
550 |
+
$msg = '<div id="message" class="error"><p><div class="warning_icon"></div> ' . $msg . '</p></div>';
|
551 |
+
if($out=='echo')
|
552 |
+
echo $msg;
|
553 |
+
elseif($out=='push')
|
554 |
+
$this->push_msg($msg);
|
555 |
+
|
556 |
+
|
557 |
+
}
|
558 |
+
|
559 |
+
//----------------------------------------------------
|
560 |
+
|
561 |
+
public function success_option_msg($msg,$out='echo')
|
562 |
+
{
|
563 |
+
$msg = '<div id="message" class="updated"><p><div class="success_icon"></div> ' . $msg . '</p></div>';
|
564 |
+
if($out=='echo')
|
565 |
+
echo $msg;
|
566 |
+
elseif($out=='push')
|
567 |
+
$this->push_msg($msg);
|
568 |
+
}
|
569 |
+
|
570 |
+
//----------------------------------------------------
|
571 |
+
|
572 |
+
public function failure_option_msg($msg,$out='echo')
|
573 |
+
{
|
574 |
+
$msg = '<div id="message" class="error"><p><div class="failure_icon"></div> ' . $msg . '</p></div>';
|
575 |
+
if($out=='echo')
|
576 |
+
echo $msg;
|
577 |
+
elseif($out=='push')
|
578 |
+
$this->push_msg($msg);
|
579 |
+
|
580 |
+
}
|
581 |
+
|
582 |
+
//----------------------------------------------------
|
583 |
+
|
584 |
+
private function push_msg($msg)
|
585 |
+
{
|
586 |
+
global $utilpro;
|
587 |
+
$msgs=$utilpro->get_option_value('admin_notices');
|
588 |
+
if(is_array($msgs))
|
589 |
+
{
|
590 |
+
$msgs[count($msgs)]=$msg;
|
591 |
+
|
592 |
+
}else
|
593 |
+
{
|
594 |
+
$msgs = array();
|
595 |
+
$msgs[0]=$msg;
|
596 |
+
}
|
597 |
+
|
598 |
+
$utilpro->update_option('admin_notices',$msgs);
|
599 |
+
|
600 |
+
}
|
601 |
+
|
602 |
+
//----------------------------------------------------
|
603 |
+
|
604 |
+
|
605 |
+
public function there_is_cache()
|
606 |
+
{
|
607 |
+
|
608 |
+
$plugins=get_option( 'active_plugins' );
|
609 |
+
|
610 |
+
for($i=0;$i<count($plugins);$i++)
|
611 |
+
{
|
612 |
+
if ( array_key_exists($i, $plugins) && stripos($plugins[$i],'cache')!==false)
|
613 |
+
{
|
614 |
+
return $plugins[$i];
|
615 |
+
}
|
616 |
+
}
|
617 |
+
|
618 |
+
|
619 |
+
return '';
|
620 |
+
}
|
621 |
+
|
622 |
+
//----------------------------------------------------
|
623 |
+
|
624 |
+
|
625 |
+
public function there_is_plugin($plugin)
|
626 |
+
{
|
627 |
+
|
628 |
+
$plugins=get_option( 'active_plugins' );
|
629 |
+
|
630 |
+
for($i=0;$i<count($plugins);$i++)
|
631 |
+
{
|
632 |
+
$phpfile = substr( $plugins[$i], strrpos( $plugins[$i], '/' )+1 );
|
633 |
+
$phpfile = explode(".", $phpfile);
|
634 |
+
$plugin_name = $phpfile[0];
|
635 |
+
if ($plugin_name==$plugin)
|
636 |
+
{
|
637 |
+
return true;
|
638 |
+
}
|
639 |
+
}
|
640 |
+
|
641 |
+
|
642 |
+
return false;
|
643 |
+
}
|
644 |
+
|
645 |
+
//---------------------------------------------------------------
|
646 |
+
|
647 |
+
public function regex_prepare($string)
|
648 |
+
{
|
649 |
+
|
650 |
+
$from= array('.', '+', '*', '?','[','^',']','$','(',')','{','}','=','!','<','>','|',':','-',')','/', '\\');
|
651 |
+
$to= array('\\.', '\\+', '\\*', '\\?','\\[','\\^','\\]','\\$','\\(','\\)','\\{','\\}','\\=','\\!','\\<','\\>','\\|','\\:','\\-','\\)','\\/','\\\\');
|
652 |
+
return str_replace($from,$to,$string);
|
653 |
+
|
654 |
+
}
|
655 |
+
|
656 |
+
|
657 |
+
}}
|
658 |
+
|
659 |
+
?>
|
custom/controls.php
ADDED
@@ -0,0 +1,3 @@
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
require_once "controls/grid_templates.php";
|
3 |
+
require_once "functions.php";
|
custom/controls/cf.SR_redirect_cache.class.php
ADDED
@@ -0,0 +1,154 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
if(!class_exists('free_SR_redirect_cache')){
|
3 |
+
class free_SR_redirect_cache {
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
/*- Add Redirect ----------------------------------------*/
|
8 |
+
public function add_redirect($post_id,$is_redirected,$redirect_from,$redirect_to,$redirect_type=301)
|
9 |
+
{
|
10 |
+
global $wpdb,$table_prefix;
|
11 |
+
$table_name = $table_prefix . 'WP_SEO_Cache';
|
12 |
+
$wpdb->query($wpdb->prepare(" insert IGNORE into $table_name(ID,is_redirected,redirect_from,redirect_to,redirect_type) values(%d,%d,%s,%s,%d); ",$post_id,$is_redirected,$redirect_from,$redirect_to,$redirect_type));
|
13 |
+
}
|
14 |
+
|
15 |
+
/*- Fetch Redirect ----------------------------------------*/
|
16 |
+
public function fetch_redirect($post_id)
|
17 |
+
{
|
18 |
+
global $wpdb,$table_prefix;
|
19 |
+
$table_name = $table_prefix . 'WP_SEO_Cache';
|
20 |
+
return $wpdb->get_row("select * from $table_name where ID='$post_id'; ");
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
/* get_current_URL ---------------------------------------------- */
|
28 |
+
public function get_current_URL()
|
29 |
+
{
|
30 |
+
$pageURL = 'http';
|
31 |
+
if ( array_key_exists("HTTPS",$_SERVER) && $_SERVER["HTTPS"] == "on")
|
32 |
+
{
|
33 |
+
$pageURL .= "s";
|
34 |
+
}
|
35 |
+
$pageURL .= "://";
|
36 |
+
|
37 |
+
if (array_key_exists("SERVER_PORT",$_SERVER) && $_SERVER["SERVER_PORT"] != "80") {
|
38 |
+
$pageURL .= $_SERVER["HTTP_HOST"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
39 |
+
} else {
|
40 |
+
$pageURL .= $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
|
41 |
+
}
|
42 |
+
return $pageURL;
|
43 |
+
}
|
44 |
+
|
45 |
+
//-----------------------------------------------------
|
46 |
+
|
47 |
+
public function remove_url_http_www($url)
|
48 |
+
{
|
49 |
+
$url = str_ireplace("http://www.",'',$url);
|
50 |
+
$url = str_ireplace("https://www.",'',$url);
|
51 |
+
$url = str_ireplace("http://",'',$url);
|
52 |
+
$url = str_ireplace("https://",'',$url);
|
53 |
+
return $url;
|
54 |
+
}
|
55 |
+
//-----------------------------------------------------
|
56 |
+
public function make_relative_url($url)
|
57 |
+
{
|
58 |
+
if($url=="")
|
59 |
+
{
|
60 |
+
return "";
|
61 |
+
}
|
62 |
+
$site_url = $this->remove_url_http_www(site_url());
|
63 |
+
if(stripos($url,$site_url) !==false)
|
64 |
+
{
|
65 |
+
$url_no_www = $this->remove_url_http_www($url);
|
66 |
+
if(strtolower(substr($url_no_www,0,strlen($site_url))) == strtolower($site_url))
|
67 |
+
{
|
68 |
+
$url = str_ireplace($site_url,'',$url_no_www);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
if($url=="")
|
72 |
+
{
|
73 |
+
$url="/";
|
74 |
+
}
|
75 |
+
return $url;
|
76 |
+
}
|
77 |
+
|
78 |
+
//----------------------------------------------------
|
79 |
+
public function make_absolute_url($url)
|
80 |
+
{
|
81 |
+
if(substr($url,0,1)=='/')
|
82 |
+
{
|
83 |
+
$url = site_url() . $url;
|
84 |
+
}
|
85 |
+
return $url;
|
86 |
+
}
|
87 |
+
|
88 |
+
//----------------------------------------------------
|
89 |
+
|
90 |
+
public function get_current_relative_url()
|
91 |
+
{
|
92 |
+
return $this->make_relative_url($this->get_current_URL());
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
|
97 |
+
/*- Redirect Cache ----------------------------------------*/
|
98 |
+
public function redirect_cached($post_id)
|
99 |
+
{
|
100 |
+
$redirect = $this->fetch_redirect($post_id);
|
101 |
+
|
102 |
+
if($redirect != null && $redirect->redirect_from==$this->get_current_relative_url())
|
103 |
+
{
|
104 |
+
if($redirect->is_redirected==1)
|
105 |
+
{
|
106 |
+
if($redirect->redirect_type==301)
|
107 |
+
{
|
108 |
+
header ('HTTP/1.1 301 Moved Permanently');
|
109 |
+
header ("Location: " . $redirect->redirect_to);
|
110 |
+
exit();
|
111 |
+
}
|
112 |
+
else if($redirect->redirect_type==307)
|
113 |
+
{
|
114 |
+
header ('HTTP/1.0 307 Temporary Redirect');
|
115 |
+
header ("Location: " . $redirect->redirect_to);
|
116 |
+
exit();
|
117 |
+
}
|
118 |
+
else if($redirect->redirect_type==302)
|
119 |
+
{
|
120 |
+
header ("Location: " . $redirect->redirect_to);
|
121 |
+
exit();
|
122 |
+
}
|
123 |
+
}
|
124 |
+
return 'not_redirected';
|
125 |
+
}
|
126 |
+
return 'not_found';
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
/*- Delete Redirect ----------------------------------------*/
|
131 |
+
public function del_redirect($post_id)
|
132 |
+
{
|
133 |
+
global $wpdb,$table_prefix;
|
134 |
+
$table_name = $table_prefix . 'WP_SEO_Cache';
|
135 |
+
return $wpdb->get_var("delete from $table_name where ID='$post_id'; ");
|
136 |
+
}
|
137 |
+
|
138 |
+
/*- Free Cache ----------------------------------------*/
|
139 |
+
public function free_cache()
|
140 |
+
{
|
141 |
+
global $wpdb,$table_prefix;
|
142 |
+
$table_name = $table_prefix . 'WP_SEO_Cache';
|
143 |
+
$wpdb->query(" TRUNCATE TABLE $table_name ");
|
144 |
+
}
|
145 |
+
|
146 |
+
/*- Cache Count ----------------------------------------*/
|
147 |
+
public function count_cache()
|
148 |
+
{
|
149 |
+
global $wpdb,$table_prefix;
|
150 |
+
$table_name = $table_prefix . 'WP_SEO_Cache';
|
151 |
+
return $wpdb->get_var("select count(*) as cnt from $table_name where 1; ");
|
152 |
+
}
|
153 |
+
|
154 |
+
}}
|
custom/controls/grid_templates.php
ADDED
@@ -0,0 +1,44 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$template = array(
|
4 |
+
|
5 |
+
|
6 |
+
'edit' => array(
|
7 |
+
'content'=> "<a href='{param}'><div class='edit_template'></div></a>",
|
8 |
+
'options' => array(
|
9 |
+
'width' => '20px',
|
10 |
+
'align' => 'center'
|
11 |
+
)
|
12 |
+
)
|
13 |
+
,
|
14 |
+
|
15 |
+
'go_link' => array(
|
16 |
+
|
17 |
+
'content' => "<a target='_blank' href='{param}'><div class='go_link_template'></div></a>",
|
18 |
+
'options' => array(
|
19 |
+
'width' => '20px',
|
20 |
+
'align' => 'center'
|
21 |
+
)
|
22 |
+
)
|
23 |
+
,
|
24 |
+
|
25 |
+
'redirect_link' => array(
|
26 |
+
|
27 |
+
'content' => "<a href='{param}'><div class='go_link_template'></div></a>",
|
28 |
+
'options' => array(
|
29 |
+
'width' => '20px',
|
30 |
+
'align' => 'center'
|
31 |
+
)
|
32 |
+
)
|
33 |
+
,
|
34 |
+
|
35 |
+
'del' => array(
|
36 |
+
|
37 |
+
'content' => "<a href='#' onclick=\"if(confirm('Are you sure you want to delete this item?'))window.location='{param}';\"><div class='del_template'></div></a>",
|
38 |
+
'options' => array(
|
39 |
+
'width' => '20px',
|
40 |
+
'align' => 'center'
|
41 |
+
)
|
42 |
+
)
|
43 |
+
|
44 |
+
);
|
custom/export/.htaccess
ADDED
@@ -0,0 +1,4 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<FilesMatch "csv\.php$">
|
2 |
+
Satisfy Any
|
3 |
+
Allow from all
|
4 |
+
</FilesMatch>
|
custom/export/csv.php
ADDED
@@ -0,0 +1,73 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
global $wpdb;
|
3 |
+
|
4 |
+
$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
|
5 |
+
require_once( $parse_uri[0] . 'wp-load.php' );
|
6 |
+
|
7 |
+
function arr_csv($results, $name = NULL)
|
8 |
+
{
|
9 |
+
if( ! $name)
|
10 |
+
{
|
11 |
+
$name = md5(uniqid() . microtime(TRUE) . mt_rand()). '.csv';
|
12 |
+
}
|
13 |
+
header('Content-Type: text/csv');
|
14 |
+
header('Content-Disposition: attachment; filename='. $name);
|
15 |
+
header('Pragma: no-cache');
|
16 |
+
header("Expires: 0");
|
17 |
+
$outstream = fopen("php://output", "w");
|
18 |
+
foreach($results as $result)
|
19 |
+
{
|
20 |
+
fputcsv($outstream, $result);
|
21 |
+
}
|
22 |
+
fclose($outstream);
|
23 |
+
}
|
24 |
+
|
25 |
+
if(current_user_can("manage_options")){
|
26 |
+
|
27 |
+
|
28 |
+
$group="";
|
29 |
+
if(array_key_exists('grpID',$_POST) && $_POST['grpID']!='' )
|
30 |
+
{
|
31 |
+
$group = " and grpID=" . intval($_POST['grpID']);
|
32 |
+
}
|
33 |
+
|
34 |
+
if(array_key_exists('blog',$_POST) && $_POST['blog']!='' )
|
35 |
+
{
|
36 |
+
$blog = " and blog='" . get_current_blog_id() . "' ";
|
37 |
+
}else
|
38 |
+
{
|
39 |
+
echo __("Invalid parameters ....",'wsr');
|
40 |
+
exit(0);
|
41 |
+
}
|
42 |
+
|
43 |
+
$table_name= $table_prefix."WP_SEO_Redirection";
|
44 |
+
$results = $wpdb->get_results("select redirect_from,redirect_to,redirect_type,redirect_from_type,redirect_from_folder_settings,redirect_from_subfolders,redirect_to_type,redirect_to_folder_settings,regex from $table_name");
|
45 |
+
$cvar[0][0]='redirect_from';
|
46 |
+
$cvar[0][1]='redirect_to';
|
47 |
+
$cvar[0][2]='redirect_type';
|
48 |
+
$cvar[0][3]='redirect_from_type';
|
49 |
+
$cvar[0][4]='redirect_from_folder_settings';
|
50 |
+
$cvar[0][5]='redirect_from_subfolders';
|
51 |
+
$cvar[0][6]='redirect_to_type';
|
52 |
+
$cvar[0][7]='redirect_to_folder_settings';
|
53 |
+
$cvar[0][8]='regex';
|
54 |
+
|
55 |
+
$i=0;
|
56 |
+
foreach($results as $result)
|
57 |
+
{
|
58 |
+
$i++;
|
59 |
+
$cvar[$i][0]=$result->redirect_from;
|
60 |
+
$cvar[$i][1]=$result->redirect_to;
|
61 |
+
$cvar[$i][2]=$result->redirect_type;
|
62 |
+
$cvar[$i][3]=$result->redirect_from_type;
|
63 |
+
$cvar[$i][4]=$result->redirect_from_folder_settings;
|
64 |
+
$cvar[$i][5]=$result->redirect_from_subfolders;
|
65 |
+
$cvar[$i][6]=$result->redirect_to_type;
|
66 |
+
$cvar[$i][7]=$result->redirect_to_folder_settings;
|
67 |
+
$cvar[$i][8]=$result->regex;
|
68 |
+
}
|
69 |
+
|
70 |
+
arr_csv($cvar, 'redirects.csv');
|
71 |
+
}else{
|
72 |
+
echo __("You must login to export!!",'wsr');
|
73 |
+
}
|
custom/export/sample.csv
ADDED
@@ -0,0 +1,7 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
redirect_from,redirect_to,redirect_type,redirect_from_type,redirect_from_folder_settings,redirect_from_subfolders,redirect_to_type,redirect_to_folder_settings,regex
|
2 |
+
/2017/11/15/testing/,http://google.com,301,Page,0,0,Page,0,
|
3 |
+
/2017/11/15/hello-world-post-2/,http://ew.prismitsystems.com/dashboard,301,,0,1,,1,
|
4 |
+
/blog/2017/11/15/hello-prism/,http://ew.prismitsystems.com/,301,,0,1,,1,
|
5 |
+
/blog/2017/11/15/hello-world-prism/,http://google.com,301,Page,0,0,Page,0,
|
6 |
+
/blog/2017/11/07/hello-world/,http://ew.prismitsystems.com/,301,,0,1,,1,
|
7 |
+
/2017/11/16/hjiiii-world/,http://ew.prismitsystems.com/dashboard,301,,0,1,,1,
|
custom/export/simple_form.csv
ADDED
@@ -0,0 +1,2 @@
|
|
Â
|
|
Â
|
1 |
+
redirect_from,redirect_to,redirect_type
|
2 |
+
link,link,301
|
custom/export/xml.php
ADDED
@@ -0,0 +1,57 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// setting up PDO
|
4 |
+
$dbLocation = 'mysql:dbname=db001;host=localhost';
|
5 |
+
$dbUser = 'user';
|
6 |
+
$dbPass = 'password';
|
7 |
+
$db = new PDO($dbLocation, $dbUser, $dbPass);
|
8 |
+
|
9 |
+
// prepare all queries...
|
10 |
+
$dbArtists = $db->prepare("SELECT * FROM artist");
|
11 |
+
$dbAlbums = $db->prepare("SELECT * FROM album WHERE artist_ID=:artist_id");
|
12 |
+
$dbSongs = $db->prepare("SELECT * FROM song WHERE album_ID=:album_id");
|
13 |
+
|
14 |
+
// fetch all artists
|
15 |
+
$dbArtists->execute();
|
16 |
+
$artists=$dbArtists->fetchAll(PDO::FETCH_ASSOC);
|
17 |
+
|
18 |
+
|
19 |
+
$x=new XMLWriter();
|
20 |
+
$x->openMemory();
|
21 |
+
$x->startDocument('1.0','UTF-8');
|
22 |
+
$x->startElement('music');
|
23 |
+
|
24 |
+
foreach ($artists as $artist) {
|
25 |
+
|
26 |
+
$x->startElement('artist');
|
27 |
+
$x->writeAttribute('name',$artist['artist']);
|
28 |
+
|
29 |
+
// fetch all albums of this artist
|
30 |
+
$dbAlbums->execute(array(':artist_id' => $artist['artist_id']));
|
31 |
+
$albums = $dbAlbums->fetchAll(PDO::FETCH_ASSOC);
|
32 |
+
|
33 |
+
foreach ($albums as $album) {
|
34 |
+
|
35 |
+
$x->startElement('album');
|
36 |
+
$x->writeAttribute('name',$album['album']);
|
37 |
+
|
38 |
+
// fetch all songs from this album
|
39 |
+
$dbSongs->execute(array(':album_id' => $album['album_id']));
|
40 |
+
$songs = $dbSongs->fetchAll(PDO::FETCH_ASSOC);
|
41 |
+
|
42 |
+
foreach ($songs as $song) {
|
43 |
+
|
44 |
+
$x->startElement('song');
|
45 |
+
$x->text($song['song']);
|
46 |
+
$x->endElement(); // song
|
47 |
+
} // foreach $songs
|
48 |
+
|
49 |
+
$x->endElement(); // album
|
50 |
+
} // foreach $albums
|
51 |
+
|
52 |
+
$x->endElement(); // artist
|
53 |
+
} // foreach $artists
|
54 |
+
|
55 |
+
$x->endElement(); // music
|
56 |
+
$x->endDocument();
|
57 |
+
$xml = $x->outputMemory();
|
custom/functions.php
ADDED
@@ -0,0 +1,144 @@
|
|
Â
|
|
Â
|
|
Â
|
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exists("SEOR_make_absolute_url")) {
|
4 |
+
function SEOR_make_absolute_url($url)
|
5 |
+
{
|
6 |
+
if(substr($url,0,1)=='/')
|
7 |
+
{
|
8 |
+
$url = site_url() . $url;
|
9 |
+
}
|
10 |
+
return $url;
|
11 |
+
}
|
12 |
+
}
|
13 |
+
if(!function_exists("c_init_my_options")) {
|
14 |
+
function c_init_my_options()
|
15 |
+
{
|
16 |
+
global $util;
|
17 |
+
|
18 |
+
$options=$util->get_my_options();
|
19 |
+
|
20 |
+
$options['plugin_status']= '1';
|
21 |
+
$options['ip_logging_status']= '1';
|
22 |
+
$options['redirection_base']= site_url();
|
23 |
+
$options['redirect_control_panel']= '1';
|
24 |
+
$options['show_redirect_box']= '1';
|
25 |
+
$options['reflect_modifications']= '1';
|
26 |
+
$options['history_status']= '1';
|
27 |
+
$options['history_limit']= '30';
|
28 |
+
$options['p404_discovery_status']= '1';
|
29 |
+
$options['p404_redirect_to']= site_url();
|
30 |
+
$options['p404_status']= '2';
|
31 |
+
$options['keep_data']= '1';
|
32 |
+
|
33 |
+
$util->update_my_options($options);
|
34 |
+
}}
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
if(!function_exists("c_save_redirection_general_options")) {
|
39 |
+
function c_save_redirection_general_options()
|
40 |
+
{ global $util;
|
41 |
+
$util->update_post_option('plugin_status');
|
42 |
+
$util->update_post_option('ip_logging_status');
|
43 |
+
$util->update_post_option('redirect_control_panel');
|
44 |
+
$util->update_post_option('show_redirect_box');
|
45 |
+
$util->update_post_option('reflect_modifications');
|
46 |
+
|
47 |
+
}}
|
48 |
+
|
49 |
+
//----------------------------------------------------------
|
50 |
+
|
51 |
+
if(!function_exists("c_save_redirection_history_options")) {
|
52 |
+
function c_save_redirection_history_options()
|
53 |
+
{ global $util;
|
54 |
+
$util->update_post_option('history_status');
|
55 |
+
$util->update_post_option('history_limit');
|
56 |
+
|
57 |
+
}}
|
58 |
+
|
59 |
+
//----------------------------------------------------------
|
60 |
+
|
61 |
+
if(!function_exists("c_save_404_redirection_options")) {
|
62 |
+
function c_save_404_redirection_options()
|
63 |
+
{ global $util;
|
64 |
+
|
65 |
+
$util->update_post_option('p404_discovery_status');
|
66 |
+
$util->update_post_option('p404_status');
|
67 |
+
$util->update_option('p404_redirect_to',$util->post('redirect_to'));
|
68 |
+
}}
|
69 |
+
|
70 |
+
//------------------------------------------------------------
|
71 |
+
|
72 |
+
if(!function_exists("c_clear_redirection_history")) {
|
73 |
+
function c_clear_redirection_history()
|
74 |
+
{
|
75 |
+
global $wpdb,$table_prefix;
|
76 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection_LOG';
|
77 |
+
$wpdb->query(" TRUNCATE TABLE $table_name ");
|
78 |
+
|
79 |
+
}}
|
80 |
+
|
81 |
+
//------------------------------------------------------------
|
82 |
+
|
83 |
+
if(!function_exists("c_clear_all_404")) {
|
84 |
+
function c_clear_all_404()
|
85 |
+
{
|
86 |
+
global $wpdb,$table_prefix;
|
87 |
+
$table_name = $table_prefix . 'WP_SEO_404_links';
|
88 |
+
$wpdb->query(" TRUNCATE TABLE $table_name ");
|
89 |
+
|
90 |
+
}}
|
91 |
+
|
92 |
+
//------------------------------------------------------------
|
93 |
+
|
94 |
+
if(!function_exists("c_save_keep_data")){
|
95 |
+
function c_save_keep_data()
|
96 |
+
{
|
97 |
+
global $util;
|
98 |
+
$util->update_post_option('keep_data');
|
99 |
+
|
100 |
+
}}
|
101 |
+
|
102 |
+
//------------------------------------------------------------
|
103 |
+
|
104 |
+
if(!function_exists("c_optimize_tables")){
|
105 |
+
function c_optimize_tables()
|
106 |
+
{
|
107 |
+
global $wpdb,$table_prefix;
|
108 |
+
$table_name1 = $table_prefix . 'WP_SEO_404_links';
|
109 |
+
$table_name2 = $table_prefix . 'WP_SEO_Redirection';
|
110 |
+
$table_name3 = $table_prefix . 'WP_SEO_Redirection_LOG';
|
111 |
+
$table_name4 = $table_prefix . 'WP_SEO_Cache';
|
112 |
+
$wpdb->query(" OPTIMIZE TABLE $table_name1,$table_name2,$table_name3,$table_name4 ");
|
113 |
+
}}
|
114 |
+
|
115 |
+
//------------------------------------------------------------
|
116 |
+
|
117 |
+
if(!function_exists("SR_Get_total_404")){
|
118 |
+
function SR_Get_total_404()
|
119 |
+
{
|
120 |
+
global $wpdb,$table_prefix;
|
121 |
+
$table_name = $table_prefix . 'WP_SEO_404_links';
|
122 |
+
|
123 |
+
|
124 |
+
$thecount = $wpdb->get_row("select count(DISTINCT link) as tot from $table_name");
|
125 |
+
|
126 |
+
return number_format($thecount->tot);
|
127 |
+
|
128 |
+
}}
|
129 |
+
|
130 |
+
//------------------------------------------------------------
|
131 |
+
|
132 |
+
if(!function_exists("SR_cut_string")){
|
133 |
+
function SR_cut_string($string, $strt, $end)
|
134 |
+
{
|
135 |
+
if(strlen($string) > $end)
|
136 |
+
{
|
137 |
+
return substr($string, $strt, $end).'..';
|
138 |
+
}else{
|
139 |
+
|
140 |
+
return $string;
|
141 |
+
}
|
142 |
+
|
143 |
+
}}
|
144 |
+
|
custom/images/404_manager.png
ADDED
Binary file
|
custom/images/404pro.png
ADDED
Binary file
|
custom/images/arrow_from.png
ADDED
Binary file
|
custom/images/arrow_to.png
ADDED
Binary file
|
custom/images/check.gif
ADDED
Binary file
|
custom/images/circles.png
ADDED
Binary file
|
custom/images/control_panel.png
ADDED
Binary file
|
custom/images/folder.png
ADDED
Binary file
|
custom/images/folder_off.png
ADDED
Binary file
|
custom/images/help-icon.png
ADDED
Binary file
|
custom/images/help_center.png
ADDED
Binary file
|
custom/images/import_export.png
ADDED
Binary file
|
custom/images/other_features.png
ADDED
Binary file
|
custom/images/page.png
ADDED
Binary file
|
custom/images/page_off.png
ADDED
Binary file
|
custom/images/pro.png
ADDED
Binary file
|
custom/images/redirect_manager_intro.png
ADDED
Binary file
|
custom/images/regex.png
ADDED
Binary file
|
custom/images/regex_off.png
ADDED
Binary file
|
custom/images/seo.png
ADDED
Binary file
|
custom/images/seopro.png
ADDED
Binary file
|
custom/lib/cf.SR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Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
define('option_group_name','clogica_option_group');
|
3 |
+
if(!class_exists('clogica_SR_redirect_cache')){
|
4 |
+
class clogica_SR_redirect_cache {
|
5 |
+
|
6 |
+
public static $show_notifications=true;
|
7 |
+
private $option_group_name='clogica_option_group';
|
8 |
+
private $cf;
|
9 |
+
private $request;
|
10 |
+
|
11 |
+
|
12 |
+
/* Set the object's parent cf to access all objects ------------------ */
|
13 |
+
public function set_cf($cf)
|
14 |
+
{
|
15 |
+
$this->cf=$cf;
|
16 |
+
$this->request= call_user_func(array($cf, 'get_request'));
|
17 |
+
//$this->request = $cf::get_request();
|
18 |
+
}
|
19 |
+
|
20 |
+
/* initialization -------------------------------------------------- */
|
21 |
+
public function init($option_group_name)
|
22 |
+
{
|
23 |
+
$this->option_group_name=$option_group_name;
|
24 |
+
}
|
25 |
+
|
26 |
+
/* set_option_group -------------------------------------------------- */
|
27 |
+
public static function set_option_group($option_group_name)
|
28 |
+
{
|
29 |
+
$this->option_group_name=$option_group_name;
|
30 |
+
}
|
31 |
+
|
32 |
+
/* get_option_group -------------------------------------------------- */
|
33 |
+
public static function get_option_group()
|
34 |
+
{
|
35 |
+
return option_group_name;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* update_my_options ------------------------------------------------- */
|
39 |
+
public static function update_my_options($options,$blog=0)
|
40 |
+
{
|
41 |
+
if(intval($blog)<=0)
|
42 |
+
{
|
43 |
+
update_site_option(self::get_option_group(),$options);
|
44 |
+
}else
|
45 |
+
{
|
46 |
+
update_blog_option($blog, self::get_option_group(), $options);
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
/* get_my_options ---------------------------------------------------- */
|
52 |
+
public static function get_my_options($blog=0)
|
53 |
+
{
|
54 |
+
if(intval($blog)<=0)
|
55 |
+
{
|
56 |
+
$options=get_site_option(self::get_option_group());
|
57 |
+
if(!is_array($options))
|
58 |
+
{
|
59 |
+
$options= array();
|
60 |
+
add_site_option(self::get_option_group(),$options);
|
61 |
+
}
|
62 |
+
return $options;
|
63 |
+
}else
|
64 |
+
{
|
65 |
+
$options=get_blog_option($blog, self::get_option_group());
|
66 |
+
if(!is_array($options))
|
67 |
+
{
|
68 |
+
$options= array();
|
69 |
+
add_blog_option($blog, self::get_option_group(),$options);
|
70 |
+
}
|
71 |
+
return $options;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
/* read_option_value ------------------------------------------------- */
|
76 |
+
public static function read_option_value($key,$default='',$blog=0)
|
77 |
+
{
|
78 |
+
$options=self::get_my_options($blog);
|
79 |
+
if(array_key_exists($key,$options))
|
80 |
+
{
|
81 |
+
return $options[$key];
|
82 |
+
}else
|
83 |
+
{
|
84 |
+
self::save_option_value($key,$default,$blog);
|
85 |
+
return $default;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/* save_option_value ------------------------------------------------- */
|
90 |
+
public static function save_option_value($key,$value,$blog=0)
|
91 |
+
{
|
92 |
+
$options=self::get_my_options($blog);
|
93 |
+
$options[$key]=$value;
|
94 |
+
self::update_my_options($options,$blog);
|
95 |
+
}
|
96 |
+
|
97 |
+
/* save_post_option_value ------------------------------------------------- */
|
98 |
+
public function save_post_option_value($key,$type='text',$blog=0)
|
99 |
+
{
|
100 |
+
$options=self::get_my_options($blog);
|
101 |
+
$options[$key]=$this->request->post($key,$type);
|
102 |
+
$this->update_my_options($options,$blog);
|
103 |
+
}
|
104 |
+
|
105 |
+
/* save_get_option_value -------------------------------------------------- */
|
106 |
+
public function save_get_option_value($key,$type='text',$blog=0)
|
107 |
+
{
|
108 |
+
$options=self::get_my_options($blog);
|
109 |
+
$options[$key]=$this->request->get($key,$type);
|
110 |
+
self::update_my_options($options,$blog);
|
111 |
+
}
|
112 |
+
|
113 |
+
/* delete_my_options ----------------------------------------------------- */
|
114 |
+
public function delete_my_options($blog)
|
115 |
+
{
|
116 |
+
if(intval($blog)<=0)
|
117 |
+
{
|
118 |
+
delete_site_option(self::get_option_group());
|
119 |
+
}else
|
120 |
+
{
|
121 |
+
delete_blog_option($blog,self::get_option_group());
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
/*- Add Redirect ----------------------------------------*/
|
126 |
+
public function add_redirect($post_id,$is_redirected,$redirect_from,$redirect_to,$redirect_type=301)
|
127 |
+
{
|
128 |
+
if(self::cache_enabled()){
|
129 |
+
global $wpdb,$table_prefix;
|
130 |
+
$table_name = $table_prefix."WP_SEO_Cache";
|
131 |
+
$wpdb->query(" insert IGNORE into $table_name(ID,is_redirected,redirect_from,redirect_to,redirect_type) values('$post_id','$is_redirected','$redirect_from','$redirect_to','$redirect_type'); ");
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
/*- Fetch Redirect ----------------------------------------*/
|
136 |
+
public function fetch_redirect($post_id)
|
137 |
+
{
|
138 |
+
global $wpdb,$table_prefix;
|
139 |
+
$table_name = $table_prefix."WP_SEO_Cache";
|
140 |
+
return $wpdb->get_row("select * from $table_name where ID='$post_id'; ");
|
141 |
+
}
|
142 |
+
|
143 |
+
/*- Redirect Cache ----------------------------------------*/
|
144 |
+
public function redirect_cached($post_id)
|
145 |
+
{
|
146 |
+
$redirect = self::fetch_redirect($post_id);
|
147 |
+
if($redirect != null && $redirect->redirect_from==self::get_current_relative_url() && self::cache_enabled())
|
148 |
+
{
|
149 |
+
|
150 |
+
if($redirect->is_redirected==1)
|
151 |
+
{
|
152 |
+
if($redirect->redirect_type==301)
|
153 |
+
{
|
154 |
+
header ('HTTP/1.1 301 Moved Permanently');
|
155 |
+
header ("Location: " . $redirect->redirect_to);
|
156 |
+
exit();
|
157 |
+
}
|
158 |
+
else if($redirect->redirect_type==307)
|
159 |
+
{
|
160 |
+
header ('HTTP/1.0 307 Temporary Redirect');
|
161 |
+
header ("Location: " . $redirect->redirect_to);
|
162 |
+
exit();
|
163 |
+
}
|
164 |
+
else if($redirect->redirect_type==302)
|
165 |
+
{
|
166 |
+
header ("Location: " . $redirect->redirect_to);
|
167 |
+
exit();
|
168 |
+
}
|
169 |
+
}
|
170 |
+
return 'not_redirected';
|
171 |
+
}
|
172 |
+
return 'not_found';
|
173 |
+
}
|
174 |
+
|
175 |
+
/*- Delete Redirect ----------------------------------------*/
|
176 |
+
public function del_redirect($post_id)
|
177 |
+
{
|
178 |
+
global $wpdb,$table_prefix;
|
179 |
+
$table_name = $table_prefix."WP_SEO_Cache";
|
180 |
+
return $wpdb->get_var("delete from $table_name where ID='$post_id'; ");
|
181 |
+
}
|
182 |
+
|
183 |
+
/*- Free Cache ----------------------------------------*/
|
184 |
+
public static function free_cache($force=0)
|
185 |
+
{
|
186 |
+
if(self::cache_enabled() || $force==1){
|
187 |
+
global $wpdb,$table_prefix;
|
188 |
+
$table_name = $table_prefix."WP_SEO_Cache";
|
189 |
+
$wpdb->query("delete * from $table_name");
|
190 |
+
if(self::show_notifications() && $force!=2)
|
191 |
+
echo "<b>".__("All cached redirects are deleted!",'wsr')."</b>";
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
/*- Free Cache ----------------------------------------*/
|
196 |
+
public static function free_cache_without_notification(){
|
197 |
+
self::free_cache(2);
|
198 |
+
}
|
199 |
+
|
200 |
+
/*- Cache Count ----------------------------------------*/
|
201 |
+
public function count_cache()
|
202 |
+
{
|
203 |
+
global $wpdb,$table_prefix;
|
204 |
+
$table_name = $table_prefix."WP_SEO_Cache";
|
205 |
+
return $wpdb->get_var("select count(*) as cnt from $table_name ");
|
206 |
+
}
|
207 |
+
|
208 |
+
|
209 |
+
/* ----------------------------------------------- */
|
210 |
+
public static function show_notifications()
|
211 |
+
{
|
212 |
+
return self::$show_notifications;
|
213 |
+
}
|
214 |
+
|
215 |
+
/* ----------------------------------------------- */
|
216 |
+
public static function cache_enabled()
|
217 |
+
{
|
218 |
+
return (self::read_option_value("cache_enable")!=0);
|
219 |
+
}
|
220 |
+
|
221 |
+
|
222 |
+
|
223 |
+
}}
|
custom/style.css
ADDED
@@ -0,0 +1,45 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
.Folder_background_1 { padding-left: 24px; background:url("images/folder.png") no-repeat left center }
|
2 |
+
.Folder_background_0{ padding-left: 24px; background:url("images/folder_off.png") no-repeat left center; color:#B6B6B6; }
|
3 |
+
|
4 |
+
.Page_background_1 { padding-left: 24px; background:url("images/page.png") no-repeat left center }
|
5 |
+
.Page_background_0 { padding-left: 24px; background:url("images/page_off.png") no-repeat left center; color:#B6B6B6; }
|
6 |
+
|
7 |
+
.Regex_background_1 { padding-left: 24px; background:url("images/regex.png") no-repeat left center }
|
8 |
+
.Regex_background_0 { padding-left: 24px; background:url("images/regex_off.png") no-repeat left center; color:#B6B6B6; }
|
9 |
+
|
10 |
+
|
11 |
+
.arrow_from{ padding-left: 20px; background:url("images/arrow_from.png") no-repeat left top}
|
12 |
+
.arrow_to{ padding-left: 20px; background:url("images/arrow_to.png") no-repeat left bottom}
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
.procontainer {
|
17 |
+
border:1px solid #999;
|
18 |
+
float:left;
|
19 |
+
width:100%;
|
20 |
+
min-width: 820px;
|
21 |
+
background:#fff;
|
22 |
+
-webkit-border-radius:8px;
|
23 |
+
-moz-border-radius:8px;
|
24 |
+
border-radius:8px;
|
25 |
+
margin-top:15px;
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
.procontainer .ad{
|
30 |
+
padding-left:410px;
|
31 |
+
padding-top:5px;
|
32 |
+
background:url(images/pro.png) no-repeat 5px 5px;
|
33 |
+
height:51px;
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
ul.features li {
|
38 |
+
background-image: url("images/check.gif");
|
39 |
+
background-position: 0 3px;
|
40 |
+
background-repeat: no-repeat;
|
41 |
+
font-size: 14px;
|
42 |
+
margin-bottom: 10px;
|
43 |
+
margin-left: 20px;
|
44 |
+
padding-left: 23px;
|
45 |
+
}
|
license.txt
ADDED
@@ -0,0 +1,674 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
<program> Copyright (C) <year> <name of author>
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<http://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
options/help.php
ADDED
@@ -0,0 +1,30 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
$imgpath= $util->get_plugin_url().'custom/images/';
|
4 |
+
?>
|
5 |
+
<h2><img height="30px" src="<?php echo $imgpath ?>help-icon.png"> <?php _e("Help Center","wsr") ?>;</h2>
|
6 |
+
<hr/>
|
7 |
+
<div class="row">
|
8 |
+
<div class="col-sm-12">
|
9 |
+
<p><?php _e('We recommend before contacting us and wait for reply, to explore the product page in our knowledge base, it contains many articles about how to use the plugin','wsr') ?><br/>
|
10 |
+
<b><?php _e("To go to the",'wsr') ?> <a target="_blank" href="http://www.clogica.com/kb/topics/seo-redirection-premium"><?php _e("knowledge base click here","wsr") ?></a></b></p>
|
11 |
+
<br/>
|
12 |
+
<h2 style="display: inline; color: #636465; font-size:24px"><b><?php _e("Open a new ticket?","wsr") ?></b></h2>
|
13 |
+
</div>
|
14 |
+
</div>
|
15 |
+
<div class="row">
|
16 |
+
<div class="col-sm-10">
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
<div class="form-group">
|
21 |
+
<div class="col-sm-offset-1 col-sm-7">
|
22 |
+
<p><?php _e("Please provide as much details as possible so we can best assist you. To update a previously submitted ticket, Please login.",'wsr') ?></p>
|
23 |
+
|
24 |
+
<button class="button-secondary" type="button" name="new_ticket" target="newwindow" onclick="window.open('http://www.clogica.com/support-center','_blank')" value="btn_send"><?php _e("Open a new ticket now","wsr") ?></button>
|
25 |
+
</div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
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
global $wpdb, $table_prefix;
|
3 |
+
require_once PATH . "custom/lib/cf.SR_redirect_cache.class.php";
|
4 |
+
require_once PATH . "cf/lib/cf.jforms.class.php";
|
5 |
+
require_once PATH . "cf/lib/forms/cf.dropdownlist.class.php";
|
6 |
+
require_once PATH . "cf/lib/forms/cf.bcheckbox_option.class.php";
|
7 |
+
|
8 |
+
$SR_jforms = new jforms();
|
9 |
+
$SR_redirect_cache = new clogica_SR_redirect_cache();
|
10 |
+
|
11 |
+
function get_current_parameters($remove_parameter = "") {
|
12 |
+
if ($_SERVER['QUERY_STRING'] != '') {
|
13 |
+
$qry = '?' . urldecode($_SERVER['QUERY_STRING']);
|
14 |
+
if (is_array($remove_parameter)) {
|
15 |
+
for ($i = 0; $i < count($remove_parameter); $i++) {
|
16 |
+
if (array_key_exists($remove_parameter[$i], $_GET)) {
|
17 |
+
$string_remove = '&' . $remove_parameter[$i] . "=" . urldecode($_GET[$remove_parameter[$i]]);
|
18 |
+
$qry = str_ireplace($string_remove, "", $qry);
|
19 |
+
$string_remove = '?' . $remove_parameter[$i] . "=" . urldecode($_GET[$remove_parameter[$i]]);
|
20 |
+
$qry = str_ireplace($string_remove, "", $qry);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
} else {
|
24 |
+
if ($remove_parameter != '') {
|
25 |
+
if (array_key_exists($remove_parameter, $_GET)) {
|
26 |
+
$string_remove = '&' . $remove_parameter . "=" . urldecode($_GET[$remove_parameter]);
|
27 |
+
$qry = str_ireplace($string_remove, "", $qry);
|
28 |
+
$string_remove = '?' . $remove_parameter . "=" . urldecode($_GET[$remove_parameter]);
|
29 |
+
$qry = str_ireplace($string_remove, "", $qry);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
return $qry;
|
34 |
+
} else {
|
35 |
+
return "";
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
function echo_message($msgtxt, $type = 'success') {
|
40 |
+
$css = $type;
|
41 |
+
$icon = "";
|
42 |
+
if ($type == 'updated' || $type == 'success') {
|
43 |
+
$css = 'success';
|
44 |
+
$icon = "<span class=\"glyphicon glyphicon-ok\"></span>";
|
45 |
+
} else if ($type == 'error' || $type == 'danger') {
|
46 |
+
$css = 'danger';
|
47 |
+
$icon = "<span class=\"glyphicon glyphicon-warning-sign\"></span>";
|
48 |
+
}
|
49 |
+
|
50 |
+
echo '<div class="alert alert-' . $css . '" role="alert">' . $icon . ' ' . $msgtxt . '</div>';
|
51 |
+
}
|
52 |
+
|
53 |
+
function csv_arr($file_name) {
|
54 |
+
$arrResult = array();
|
55 |
+
$handle = fopen($file_name, "r");
|
56 |
+
if ($handle) {
|
57 |
+
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
58 |
+
$arrResult[] = $data;
|
59 |
+
}
|
60 |
+
fclose($handle);
|
61 |
+
}
|
62 |
+
return $arrResult;
|
63 |
+
}
|
64 |
+
|
65 |
+
function add_csv_mime_upload_mimes($existing_mimes) {
|
66 |
+
$existing_mimes['csv'] = 'application/octet-stream'; //allow CSV files
|
67 |
+
return $existing_mimes;
|
68 |
+
}
|
69 |
+
|
70 |
+
if ( isset($_POST['btn_import']) && $_POST['btn_import'] != '') {
|
71 |
+
add_filter('upload_mimes', 'add_csv_mime_upload_mimes');
|
72 |
+
|
73 |
+
if (array_key_exists('import_file', $_FILES) && $_FILES['import_file']['name'] != '') {
|
74 |
+
$filename = $_FILES['import_file']['name'];
|
75 |
+
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
76 |
+
if (strtolower($ext) == 'csv') {
|
77 |
+
if (!function_exists('wp_handle_upload')) {
|
78 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
79 |
+
}
|
80 |
+
|
81 |
+
$uploadedfile = $_FILES['import_file'];
|
82 |
+
$upload_overrides = array('test_form' => false);
|
83 |
+
$movefile = wp_handle_upload($uploadedfile, $upload_overrides);
|
84 |
+
if ($movefile && !isset($movefile['error'])) {
|
85 |
+
|
86 |
+
|
87 |
+
echo_message(__("File is valid, and was successfully uploaded.", 'wsr'));
|
88 |
+
$results = csv_arr($movefile['file']);
|
89 |
+
|
90 |
+
// start add to database ----------------------------------
|
91 |
+
|
92 |
+
$index = 0;
|
93 |
+
|
94 |
+
//if($request->post('col_names','int')!=0) $index++;
|
95 |
+
if ($_POST['col_names'] != 0)
|
96 |
+
$index++;
|
97 |
+
|
98 |
+
$errors = 0;
|
99 |
+
$exist = 0;
|
100 |
+
$new = 0;
|
101 |
+
//$grpID=$request->post('grpID','int');
|
102 |
+
$grpID = isset($_POST['grpID'])?$_POST['grpID']:'';
|
103 |
+
|
104 |
+
|
105 |
+
for ($i = $index; $i < count($results); $i++) {
|
106 |
+
|
107 |
+
$sql = "";
|
108 |
+
$redirect_from_type = 'Page';
|
109 |
+
$redirect_to_type = 'Page';
|
110 |
+
$redirect_from_folder_settings = '1';
|
111 |
+
$redirect_from_subfolders = '0';
|
112 |
+
$redirect_to_folder_settings = '1';
|
113 |
+
$redirect_type = '301';
|
114 |
+
$regex = '';
|
115 |
+
$redirect_from = '';
|
116 |
+
$redirect_to = '';
|
117 |
+
|
118 |
+
if (count($results[$i]) > 0)
|
119 |
+
$redirect_from = $results[$i][0];
|
120 |
+
|
121 |
+
if (count($results[$i]) > 1)
|
122 |
+
$redirect_to = $results[$i][1];
|
123 |
+
|
124 |
+
if (count($results[$i]) > 2)
|
125 |
+
$redirect_type = $results[$i][2];
|
126 |
+
|
127 |
+
if (count($results[$i]) > 3)
|
128 |
+
$redirect_from_type = $results[$i][3];
|
129 |
+
|
130 |
+
if (count($results[$i]) > 4)
|
131 |
+
$redirect_from_folder_settings = $results[$i][4];
|
132 |
+
|
133 |
+
if (count($results[$i]) > 5)
|
134 |
+
$redirect_from_subfolders = $results[$i][5];
|
135 |
+
|
136 |
+
if (count($results[$i]) > 6)
|
137 |
+
$redirect_to_type = $results[$i][6];
|
138 |
+
|
139 |
+
if (count($results[$i]) > 7)
|
140 |
+
$redirect_to_folder_settings = $results[$i][7];
|
141 |
+
|
142 |
+
if (count($results[$i]) > 8)
|
143 |
+
$regex = $results[$i][8];
|
144 |
+
|
145 |
+
if ($redirect_from != '' && $redirect_to != '' && intval($redirect_type) != 0) {
|
146 |
+
$exec = 0;
|
147 |
+
$seo_table = $table_prefix . "WP_SEO_Redirection";
|
148 |
+
if ($wpdb->get_var(" select redirect_from from $seo_table where redirect_from='$redirect_from'")) {
|
149 |
+
$exist++;
|
150 |
+
//if($request->post('rule')=='replace')
|
151 |
+
if ($_POST['rule'] == 'replace') {
|
152 |
+
$wpdb->get_var(" delete from $seo_table where redirect_from='$redirect_from'");
|
153 |
+
$exec = 1;
|
154 |
+
}
|
155 |
+
} else {
|
156 |
+
$exec = 1;
|
157 |
+
$new++;
|
158 |
+
}
|
159 |
+
|
160 |
+
if ($exec == 1) {
|
161 |
+
|
162 |
+
$wpdb->insert($seo_table, array(
|
163 |
+
"redirect_from" => $redirect_from,
|
164 |
+
"redirect_to" => $redirect_to,
|
165 |
+
"redirect_type" => $redirect_type,
|
166 |
+
"redirect_from_type" => $redirect_from_type,
|
167 |
+
"redirect_from_folder_settings" => $redirect_from_folder_settings,
|
168 |
+
"redirect_from_subfolders" => $redirect_from_subfolders,
|
169 |
+
"redirect_to_type" => $redirect_to_type,
|
170 |
+
"redirect_to_folder_settings" => $redirect_to_folder_settings,
|
171 |
+
"regex" => $regex,
|
172 |
+
));
|
173 |
+
}
|
174 |
+
} else {
|
175 |
+
echo "err";
|
176 |
+
$errors++;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
$report = intval($errors + $exist + $new) . " redirects are imported with $errors errors,$new new redirects and $exist are ";
|
181 |
+
//if($request->post('rule')=='replace')
|
182 |
+
if ($_POST['rule'] == 'replace') {
|
183 |
+
$report = $report . 'replaced!';
|
184 |
+
} else {
|
185 |
+
$report = $report . 'skipped!';
|
186 |
+
}
|
187 |
+
|
188 |
+
echo_message($report);
|
189 |
+
|
190 |
+
// end the entrance to database ---------------------------
|
191 |
+
|
192 |
+
|
193 |
+
unlink($movefile['file']);
|
194 |
+
echo_message(__("File is deleted!", 'wsr'));
|
195 |
+
$SR_redirect_cache->free_cache();
|
196 |
+
} else {
|
197 |
+
echo $movefile['error'];
|
198 |
+
}
|
199 |
+
} else {
|
200 |
+
echo_message(__("Please choose a CSV file", 'wsr'), 'danger');
|
201 |
+
}
|
202 |
+
} else {
|
203 |
+
echo_message(__("You need to select a file to upload it!", 'wsr'), 'danger');
|
204 |
+
}
|
205 |
+
}
|
206 |
+
?>
|
207 |
+
|
208 |
+
<h3><?php _e("Export Redirects", 'wsr') ?></h3><hr/>
|
209 |
+
|
210 |
+
|
211 |
+
<form id="export" target="_blank" action="<?php echo URL ?>custom/export/csv.php" method="post" class="form-horizontal" role="form" data-toggle="validator">
|
212 |
+
|
213 |
+
<table cellpadding="10">
|
214 |
+
<tr>
|
215 |
+
<td>
|
216 |
+
<label class="control-label col-sm-2" for="export_file_type"><?php _e("Output Type:", 'wsr') ?></label>
|
217 |
+
</td>
|
218 |
+
<td>
|
219 |
+
<?php
|
220 |
+
$drop = new dropdown_list('export_file_type');
|
221 |
+
$drop->add('CSV', 'csv');
|
222 |
+
$drop->run($SR_jforms);
|
223 |
+
?>
|
224 |
+
|
225 |
+
</td>
|
226 |
+
</tr>
|
227 |
+
</table>
|
228 |
+
<br>
|
229 |
+
<input type="hidden" name="blog" value="<?php echo get_current_blog_id() ?>"/>
|
230 |
+
<button type="submit" class="button-secondary" name="btn_export" value="btn_export"><span class="dashicons dashicons-admin-links" style="padding-top: 3px;"></span> <?php _e("Export", 'wsr'); ?> </button>
|
231 |
+
|
232 |
+
</form>
|
233 |
+
<br>
|
234 |
+
<h3><?php _e("Import Redirects", 'wsr'); ?></h3><hr/>
|
235 |
+
|
236 |
+
<form id="import" name="import" enctype='multipart/form-data' action="<?php echo get_current_parameters(array("add", "edit", "del")); ?>" method="post" class="form-horizontal" role="form" data-toggle="validator">
|
237 |
+
|
238 |
+
<table cellpadding="10">
|
239 |
+
<tr>
|
240 |
+
<td><label class="control-label col-sm-2" for="import_file_type"><?php _e("File Type:", 'wsr') ?></label></td>
|
241 |
+
<td>
|
242 |
+
<?php
|
243 |
+
$drop = new dropdown_list('import_file_type');
|
244 |
+
$drop->add(__('CSV', 'wsr'), 'csv');
|
245 |
+
$drop->run($SR_jforms);
|
246 |
+
?>
|
247 |
+
</td>
|
248 |
+
</tr>
|
249 |
+
<tr>
|
250 |
+
<td><label class="control-label col-sm-2" for="file"><?php _e("Choose File:", 'wsr'); ?></label></td>
|
251 |
+
<td>
|
252 |
+
<input class="btn btn-default btn-sm" type="file" accept="text/csv" id="import_file" name="import_file" required/>
|
253 |
+
</td>
|
254 |
+
</tr>
|
255 |
+
<tr>
|
256 |
+
<td><label class="control-label col-sm-2" for="Rule"><?php _e("Column Titles:", 'wsr') ?> </label></td>
|
257 |
+
<td>
|
258 |
+
<?php
|
259 |
+
$check = new bcheckbox_option();
|
260 |
+
$check->create_single_option('col_names', 1);
|
261 |
+
echo __(" Skip the first row of the file (if there is a table header)", 'wsr');
|
262 |
+
?>
|
263 |
+
</td>
|
264 |
+
</tr>
|
265 |
+
<tr>
|
266 |
+
<td> <label class="control-label col-sm-2" for="Rule"><?php _e("Import Rule:", 'wsr'); ?></label></td>
|
267 |
+
<td>
|
268 |
+
<?php
|
269 |
+
$drop = new dropdown_list('rule');
|
270 |
+
$drop->add(__('Skip the existing redirects with the same source', 'wsr'), 'skip');
|
271 |
+
$drop->add(__('Replace the existing redirects with the same source', 'wsr'), 'replace');
|
272 |
+
$drop->run($SR_jforms);
|
273 |
+
?>
|
274 |
+
</td>
|
275 |
+
</tr>
|
276 |
+
</table>
|
277 |
+
|
278 |
+
<input type="hidden" name="MAX_FILE_SIZE" value="999000000" />
|
279 |
+
<br>
|
280 |
+
<div class="form-group">
|
281 |
+
<div class="col-sm-offset-2 col-sm-12">
|
282 |
+
<button class="button" type="submit" name="btn_import" value="btn_import"><span style="padding-top: 3px;" class="dashicons dashicons-migrate"></span> <?php _e("Import", 'wsr') ?></button>
|
283 |
+
</div>
|
284 |
+
</div>
|
285 |
+
<br/>
|
286 |
+
<h3><a target="_blank" href="<?php echo URL . 'custom/export/sample.csv' ?>">Sample Csv File</a></h3>
|
287 |
+
<div style="text-align: right"><?php _e("* Need Help?", 'wsr'); ?> <a target="_blank" href="http://www.clogica.com/kb/topics/seo-redirection-premium/export-import"><?php _e("click here to see info about import and export", "wsr"); ?></a></div>
|
288 |
+
<br/>
|
289 |
+
</form>
|
290 |
+
|
291 |
+
<?php
|
292 |
+
|
options/option_page_custome_redirection.php
ADDED
@@ -0,0 +1,147 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
global $wpdb,$table_prefix,$util;
|
4 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
5 |
+
$table_name_404 = $table_prefix . 'WP_SEO_404_links';
|
6 |
+
|
7 |
+
$nonce="";
|
8 |
+
if(isset($_REQUEST['_wpnonce']))
|
9 |
+
$nonce = $_REQUEST['_wpnonce'];
|
10 |
+
|
11 |
+
if($util->post('redirect_from')!='' && wp_verify_nonce( $nonce, 'seoredirection' )){
|
12 |
+
|
13 |
+
$redirect_from=urldecode($util->make_relative_url($util->post('redirect_from')));
|
14 |
+
$redirect_to=$util->make_relative_url($util->post('redirect_to'));
|
15 |
+
$redirect_type=$util->post('redirect_type');
|
16 |
+
|
17 |
+
$redirect_from_type=$util->post('redirect_from_type');
|
18 |
+
$redirect_from_folder_settings=$util->post('redirect_from_folder_settings');
|
19 |
+
$redirect_from_subfolders=$util->post('redirect_from_subfolders');
|
20 |
+
|
21 |
+
$redirect_to_type=$util->post('redirect_to_type');
|
22 |
+
$redirect_to_folder_settings=$util->post('redirect_to_folder_settings');
|
23 |
+
|
24 |
+
$enabled=$util->post('enabled');
|
25 |
+
|
26 |
+
$regex="";
|
27 |
+
|
28 |
+
if($redirect_from_type =='Folder')
|
29 |
+
{
|
30 |
+
|
31 |
+
if(substr($redirect_from,-1)!='/')
|
32 |
+
$redirect_from = $redirect_from . '/';
|
33 |
+
|
34 |
+
if($redirect_from_folder_settings==2)
|
35 |
+
{
|
36 |
+
if($redirect_from_subfolders ==0)
|
37 |
+
{
|
38 |
+
$regex= '^'. $util->regex_prepare($redirect_from) . '.*'; ;
|
39 |
+
}
|
40 |
+
else
|
41 |
+
{
|
42 |
+
$regex= '^'. $util->regex_prepare($redirect_from) . '[^/]*$';
|
43 |
+
}
|
44 |
+
}
|
45 |
+
else if($redirect_from_folder_settings==3)
|
46 |
+
{
|
47 |
+
if($redirect_from_subfolders ==0)
|
48 |
+
{
|
49 |
+
$regex= '^'. $util->regex_prepare($redirect_from) . '.+';
|
50 |
+
}
|
51 |
+
else
|
52 |
+
{
|
53 |
+
$regex= '^'. $util->regex_prepare($redirect_from) . '[^/]+$';
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
}else if($redirect_from_type =='Regex')
|
58 |
+
{
|
59 |
+
$regex= $redirect_from;
|
60 |
+
}
|
61 |
+
|
62 |
+
if ($redirect_from_type=='Page' || $redirect_from_type=='Regex')
|
63 |
+
{
|
64 |
+
$redirect_from_folder_settings="";
|
65 |
+
$redirect_from_subfolders="";
|
66 |
+
}
|
67 |
+
|
68 |
+
if ($redirect_to_type=='Page')
|
69 |
+
{
|
70 |
+
$redirect_to_folder_settings="";
|
71 |
+
}
|
72 |
+
|
73 |
+
if($redirect_to_type =='Folder')
|
74 |
+
{
|
75 |
+
if(substr($redirect_to,-1)!='/')
|
76 |
+
$redirect_to= $redirect_to. '/';
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
+
if($util->post('add_new')!='')
|
81 |
+
{
|
82 |
+
|
83 |
+
$theurl = $wpdb->get_row($wpdb->prepare(" select count(ID) as cnt from $table_name where redirect_from=%s ",$redirect_from));
|
84 |
+
if($theurl->cnt >0)
|
85 |
+
{
|
86 |
+
$util->failure_option_msg(__("This URL",'wsr')." <b>'$redirect_from'</b>". __("is added previously!",'wsr'));
|
87 |
+
}else
|
88 |
+
{
|
89 |
+
|
90 |
+
|
91 |
+
if($redirect_from=='' || $redirect_to=='' || $redirect_type=='' ){
|
92 |
+
$util->failure_option_msg(__('Please input all required fields!','wsr'));
|
93 |
+
}else
|
94 |
+
{
|
95 |
+
|
96 |
+
$wpdb->insert($table_name,array(
|
97 |
+
'redirect_from' => $redirect_from,
|
98 |
+
'redirect_to' => $redirect_to,
|
99 |
+
'redirect_type' => $redirect_type,
|
100 |
+
'url_type' => 1,
|
101 |
+
'redirect_from_type' => $redirect_from_type,
|
102 |
+
'redirect_from_folder_settings' => $redirect_from_folder_settings,
|
103 |
+
'redirect_from_subfolders' => $redirect_from_subfolders,
|
104 |
+
'redirect_to_type' => $redirect_to_type,
|
105 |
+
'redirect_to_folder_settings' => $redirect_to_folder_settings,
|
106 |
+
'regex' => $regex,
|
107 |
+
'enabled' => $enabled
|
108 |
+
|
109 |
+
));
|
110 |
+
|
111 |
+
$wpdb->query($wpdb->prepare(" delete from $table_name_404 where link=%s ",$redirect_from));
|
112 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
113 |
+
$SR_redirect_cache->free_cache();
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
}}else if($util->post('edit_exist')!='')
|
119 |
+
{
|
120 |
+
$edit=$util->post('edit');
|
121 |
+
|
122 |
+
if($redirect_from=='' || $redirect_to=='' || $redirect_type=='' ){
|
123 |
+
$util->failure_option_msg('Please input all required fields!');
|
124 |
+
}else
|
125 |
+
{
|
126 |
+
|
127 |
+
$wpdb->query($wpdb->prepare("update $table_name set redirect_from=%s,redirect_to=%s,redirect_type=%s,redirect_from_type=%s ,redirect_from_folder_settings=%d,redirect_from_subfolders=%d ,redirect_to_type=%s ,redirect_to_folder_settings=%d ,regex=%s,enabled=%s where ID=%d ",$redirect_from,$redirect_to,$redirect_type,$redirect_from_type,$redirect_from_folder_settings,$redirect_from_subfolders,$redirect_to_type,$redirect_to_folder_settings,$regex,$enabled,$edit));
|
128 |
+
|
129 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
130 |
+
$SR_redirect_cache->free_cache();
|
131 |
+
}
|
132 |
+
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
if($util->there_is_cache()!='')
|
137 |
+
$util->info_option_msg(__("You have a cache plugin installed",'wsr')." <b>'" . $util->there_is_cache() . "'</b>, ". __("you have to clear cache after any changes to get the changes reflected immediately! ",'wsr'));
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
if($util->get('add')!='' || $util->get('edit')!='' )
|
142 |
+
{
|
143 |
+
include "option_page_custome_redirection_add_update.php";
|
144 |
+
}else
|
145 |
+
{
|
146 |
+
include "option_page_custome_redirection_list.php";
|
147 |
+
}
|
options/option_page_custome_redirection_add_update.php
ADDED
@@ -0,0 +1,294 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
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|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
global $wpdb,$table_prefix,$util;
|
4 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
5 |
+
|
6 |
+
$redirect_from="";
|
7 |
+
$redirect_to="";
|
8 |
+
$redirect_type="";
|
9 |
+
$redirect_from_type="";
|
10 |
+
$redirect_from_folder_settings="";
|
11 |
+
$redirect_from_subfolders="";
|
12 |
+
$redirect_to_type="";
|
13 |
+
$redirect_to_folder_settings="";
|
14 |
+
$enabled="";
|
15 |
+
|
16 |
+
if($util->get('add')!='')
|
17 |
+
echo "<h3>".__('Add New Custom Redirection','wsr')."<hr></h3>";
|
18 |
+
else if(intval($util->get('edit'))>0){
|
19 |
+
echo "<h3>".__('Update Existing Redirection','wsr')."<hr></h3>";
|
20 |
+
$item = $wpdb->get_row($wpdb->prepare(" select * from $table_name where ID=%d ",$util->get('edit')));
|
21 |
+
if($wpdb->num_rows==0)
|
22 |
+
{
|
23 |
+
$utilpro->info_option_msg(__("Sorry, this redirect rule is not found, it may deleted by the user!",'wsr'));
|
24 |
+
exit(0);
|
25 |
+
}
|
26 |
+
$redirect_from=$item->redirect_from;
|
27 |
+
$redirect_to=$item->redirect_to;
|
28 |
+
$redirect_type=$item->redirect_type;
|
29 |
+
|
30 |
+
$redirect_from_type=$item->redirect_from_type;
|
31 |
+
$redirect_from_folder_settings=$item->redirect_from_folder_settings;
|
32 |
+
$redirect_from_subfolders=$item->redirect_from_subfolders;
|
33 |
+
|
34 |
+
$redirect_to_type=$item->redirect_to_type;
|
35 |
+
$redirect_to_folder_settings=$item->redirect_to_folder_settings;
|
36 |
+
|
37 |
+
$enabled=$item->enabled;
|
38 |
+
|
39 |
+
}
|
40 |
+
else
|
41 |
+
header("location: .");
|
42 |
+
|
43 |
+
|
44 |
+
if($util->get('page404')!='')
|
45 |
+
{
|
46 |
+
$table_name_404 = $table_prefix . 'WP_SEO_404_links';
|
47 |
+
$i404 = $wpdb->get_row(" select link from $table_name_404 where ID=". intval($util->get('page404')));
|
48 |
+
if($i404->link!='')
|
49 |
+
$redirect_from=$i404->link;
|
50 |
+
else
|
51 |
+
$_GET['page404']='';
|
52 |
+
}
|
53 |
+
|
54 |
+
?>
|
55 |
+
<form onsubmit="return check_from();" method="POST" id="myform" action="<?php echo $util->get_current_parameters(array('add','edit','page404'));?>">
|
56 |
+
<table class="cform" width="100%">
|
57 |
+
<tr>
|
58 |
+
<td class="label"><?php _e('Redirection status:','wsr') ?></td>
|
59 |
+
<td> <select size="1" name="enabled" id="enabled">
|
60 |
+
<option value="1"><?php _e('Enabled','wsr') ?></option>
|
61 |
+
<option value="0"><?php _e('Disabled','wsr') ?></option>
|
62 |
+
</select>
|
63 |
+
|
64 |
+
</td>
|
65 |
+
</tr>
|
66 |
+
<tr>
|
67 |
+
|
68 |
+
<td class="label"><?php _e('Redirect from:','wsr') ?></td>
|
69 |
+
<td>
|
70 |
+
<div id="rfrom_div">
|
71 |
+
<select onchange="redirect_from_type_change()" size="1" name="redirect_from_type" id="redirect_from_type">
|
72 |
+
<option value="Page"><?php _e('Page','wsr') ?></option>
|
73 |
+
<option value="Folder"><?php _e('Folder','wsr') ?></option>
|
74 |
+
<option value="Regex"><?php _e('Regex','wsr') ?></option>
|
75 |
+
</select>
|
76 |
+
<input onblur="check_redirect_from()" type="text" id="redirect_from" style="height: 40px;" name="redirect_from" size="45" value="<?php echo $redirect_from?>">
|
77 |
+
<select onchange="redirect_to_folder_settings_change()" size="1" name="redirect_from_folder_settings" id="redirect_from_folder_settings">
|
78 |
+
<option value="1"><?php _e('Only the folder','wsr') ?></option>
|
79 |
+
<option value="2"><?php _e("The folder and it's content",'wsr') ?></option>
|
80 |
+
<option value="3"><?php _e("Only the folder's content",'wsr') ?></option>
|
81 |
+
</select>
|
82 |
+
<select size="1" name="redirect_from_subfolders" id="redirect_from_subfolders" class="cmb2_select">
|
83 |
+
<option value="0"><?php _e("Include sub-folders",'wsr') ?></option>
|
84 |
+
<option value="1"><?php _e("Do not include sub-folders",'wsr') ?></option>
|
85 |
+
</select>
|
86 |
+
|
87 |
+
* <font style="font-size: 12px;color:#a7a7a7"><?php _e("(Starting with 'http://')",'wsr') ?></font>
|
88 |
+
</div>
|
89 |
+
<?php if($util->get('page404')!='') echo $redirect_from; ?>
|
90 |
+
</td>
|
91 |
+
</tr>
|
92 |
+
<tr>
|
93 |
+
<td class="label"><?php _e("Redirect to:",'wsr') ?></td>
|
94 |
+
<td>
|
95 |
+
<select onchange="redirect_to_type_change()" size="1" class="cmb2_select" name="redirect_to_type" id="redirect_to_type">
|
96 |
+
<option value="Page"><?php _e("Page:",'wsr') ?></option>
|
97 |
+
<option value="Folder"><?php _e("Folder",'wsr') ?></option>
|
98 |
+
</select>
|
99 |
+
|
100 |
+
<input onblur="check_redirect_to()" type="text" id="redirect_to" class="regular-text" style="height: 40px;" name="redirect_to" size="45" value="<?php echo $redirect_to?>">
|
101 |
+
|
102 |
+
<select size="1" name="redirect_to_folder_settings" id="redirect_to_folder_settings">
|
103 |
+
<option value="1"><?php _e("Normal",'wsr') ?></option>
|
104 |
+
<option value="2"><?php _e("Wild Card Redirect",'wsr') ?></option>
|
105 |
+
</select>
|
106 |
+
|
107 |
+
*
|
108 |
+
</td>
|
109 |
+
</tr>
|
110 |
+
<tr>
|
111 |
+
<td class="label"><?php _e("Redirection type:",'wsr') ?></td>
|
112 |
+
<td>
|
113 |
+
<select size="1" name="redirect_type" id="redirect_type">
|
114 |
+
<option value="301"><?php _e("301 (SEO)",'wsr') ?></option>
|
115 |
+
<option value="302"><?php _e("302",'wsr') ?></option>
|
116 |
+
<option value="307"><?php _e("307",'wsr') ?></option>
|
117 |
+
</select>
|
118 |
+
|
119 |
+
<script>
|
120 |
+
|
121 |
+
function redirect_from_type_change()
|
122 |
+
{
|
123 |
+
if (document.getElementById('redirect_from_type').value=='Folder')
|
124 |
+
{
|
125 |
+
document.getElementById('redirect_from_folder_settings').style.display = 'inline';
|
126 |
+
document.getElementById('redirect_from').className = 'Folder_background_1';
|
127 |
+
redirect_to_folder_settings_change();
|
128 |
+
}
|
129 |
+
else if (document.getElementById('redirect_from_type').value=='Page')
|
130 |
+
{
|
131 |
+
document.getElementById('redirect_from_folder_settings').style.display = 'none';
|
132 |
+
document.getElementById('redirect_from').className = 'Page_background_1 regular-text';
|
133 |
+
document.getElementById('redirect_from_subfolders').style.display = 'none';
|
134 |
+
}
|
135 |
+
else if (document.getElementById('redirect_from_type').value=='Regex')
|
136 |
+
{
|
137 |
+
document.getElementById('redirect_from_folder_settings').style.display = 'none';
|
138 |
+
document.getElementById('redirect_from').className = 'Regex_background_1';
|
139 |
+
document.getElementById('redirect_from_subfolders').style.display = 'none';
|
140 |
+
}
|
141 |
+
|
142 |
+
check_redirect_from();
|
143 |
+
}
|
144 |
+
|
145 |
+
|
146 |
+
function redirect_to_type_change()
|
147 |
+
{
|
148 |
+
if (document.getElementById('redirect_to_type').value=='Folder')
|
149 |
+
{
|
150 |
+
document.getElementById('redirect_to_folder_settings').style.display = 'inline';
|
151 |
+
document.getElementById('redirect_to').className = 'Folder_background_1';
|
152 |
+
}
|
153 |
+
else if (document.getElementById('redirect_to_type').value=='Page')
|
154 |
+
{
|
155 |
+
document.getElementById('redirect_to_folder_settings').style.display = 'none';
|
156 |
+
document.getElementById('redirect_to').className = 'Page_background_1 regular-text';
|
157 |
+
}
|
158 |
+
|
159 |
+
check_redirect_to();
|
160 |
+
}
|
161 |
+
|
162 |
+
function redirect_to_folder_settings_change()
|
163 |
+
{
|
164 |
+
if (document.getElementById('redirect_from_folder_settings').value=='1')
|
165 |
+
{
|
166 |
+
document.getElementById('redirect_from_subfolders').style.display = 'none';
|
167 |
+
}else
|
168 |
+
{
|
169 |
+
document.getElementById('redirect_from_subfolders').style.display = 'inline';
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
function check_redirect_from()
|
174 |
+
{
|
175 |
+
|
176 |
+
var rfrom = document.getElementById('redirect_from').value;
|
177 |
+
|
178 |
+
if(rfrom!=''){
|
179 |
+
var cr= rfrom .substring(rfrom.length -1);
|
180 |
+
if(document.getElementById('redirect_from_type').value=='Folder' && cr!='/' )
|
181 |
+
document.getElementById('redirect_from').value = rfrom + '/';
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
function check_redirect_to()
|
187 |
+
{
|
188 |
+
|
189 |
+
var rto = document.getElementById('redirect_to').value;
|
190 |
+
|
191 |
+
|
192 |
+
if(rto!=''){
|
193 |
+
var cr= rto.substring(rto.length -1);
|
194 |
+
if(document.getElementById('redirect_to_type').value=='Folder' && cr!='/' )
|
195 |
+
document.getElementById('redirect_to').value = rto + '/';
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
<?php
|
200 |
+
|
201 |
+
if($redirect_type!='')
|
202 |
+
echo "document.getElementById('redirect_type').value='$redirect_type';";
|
203 |
+
|
204 |
+
if($redirect_from_type!='')
|
205 |
+
echo "document.getElementById('redirect_from_type').value='$redirect_from_type';";
|
206 |
+
|
207 |
+
if($redirect_from_folder_settings!='' && $redirect_from_type=='Folder' )
|
208 |
+
echo "document.getElementById('redirect_from_folder_settings').value='$redirect_from_folder_settings';";
|
209 |
+
|
210 |
+
if($redirect_from_subfolders!='' && $redirect_from_type=='Folder' )
|
211 |
+
echo "document.getElementById('redirect_from_subfolders').value='$redirect_from_subfolders';";
|
212 |
+
|
213 |
+
if($redirect_to_type!='')
|
214 |
+
echo "document.getElementById('redirect_to_type').value='$redirect_to_type';";
|
215 |
+
|
216 |
+
if($redirect_to_folder_settings!='' && $redirect_to_type=='Folder' )
|
217 |
+
echo "document.getElementById('redirect_to_folder_settings').value='$redirect_to_folder_settings';";
|
218 |
+
|
219 |
+
if($enabled!='')
|
220 |
+
echo "document.getElementById('enabled').value='$enabled';";
|
221 |
+
|
222 |
+
|
223 |
+
|
224 |
+
if($util->get('page404')!='')
|
225 |
+
echo "document.getElementById('rfrom_div').style.display = 'none';";
|
226 |
+
|
227 |
+
|
228 |
+
|
229 |
+
?>
|
230 |
+
|
231 |
+
redirect_from_type_change();
|
232 |
+
redirect_to_type_change();
|
233 |
+
|
234 |
+
</script>
|
235 |
+
|
236 |
+
|
237 |
+
</td>
|
238 |
+
</tr>
|
239 |
+
</table>
|
240 |
+
<br/>
|
241 |
+
|
242 |
+
<input type="hidden" id="_wpnonce" name="_wpnonce" value="<?php echo $nonce = wp_create_nonce('seoredirection'); ?>" />
|
243 |
+
<input type="hidden" id="edit" name="edit" value="<?php echo intval($util->get('edit'))?>">
|
244 |
+
|
245 |
+
<?php echo "<b>Note</b>:".__(" When you move your site to another domain, the new domain name will be reflected to all links automatically.","wsr"); ?>
|
246 |
+
<br/><br/>
|
247 |
+
<?php
|
248 |
+
|
249 |
+
if($util->get('add')!='')
|
250 |
+
echo '<input class="button-primary" type="submit" value="'.__("Add New","wsr").'" name="add_new">';
|
251 |
+
else if($util->get('edit')!='')
|
252 |
+
echo '<input class="button-primary" type="submit" value="'.__("Update","wsr").'" name="edit_exist">';
|
253 |
+
|
254 |
+
?>
|
255 |
+
<input onclick="window.location='<?php echo $util->get_current_parameters(array('add','edit'));?>';" class="button-primary" type="button" value="<?php _e("Cancel",'wsr') ?>" name="cancel">
|
256 |
+
<br/></form>
|
257 |
+
|
258 |
+
<script>
|
259 |
+
|
260 |
+
function check_from()
|
261 |
+
{
|
262 |
+
|
263 |
+
var rfrom=document.getElementById('redirect_from').value;
|
264 |
+
var rto=document.getElementById('redirect_to').value;
|
265 |
+
|
266 |
+
if( rfrom=='')
|
267 |
+
{
|
268 |
+
alert("<?php _e("You must input the 'Redirect From' URL","wsr") ?>");
|
269 |
+
document.getElementById('redirect_from').focus();
|
270 |
+
return false;
|
271 |
+
}
|
272 |
+
|
273 |
+
|
274 |
+
if( rto=='')
|
275 |
+
{
|
276 |
+
alert("<?php _e("You must input the 'Redirect To' URL","wsr") ?>");
|
277 |
+
|
278 |
+
document.getElementById('redirect_to').focus();
|
279 |
+
return false;
|
280 |
+
}
|
281 |
+
|
282 |
+
<?php if($util->get('add')!='')
|
283 |
+
{?>
|
284 |
+
if(!(rto.indexOf('://')!=-1 || rto.substr(0,1)=='/'))
|
285 |
+
{
|
286 |
+
alert("<?php _e("Invalid redirect target URL!","wsr") ?>");
|
287 |
+
document.getElementById('redirect_to').focus();
|
288 |
+
return false;
|
289 |
+
}
|
290 |
+
<?php }?>
|
291 |
+
|
292 |
+
return true;
|
293 |
+
}
|
294 |
+
</script>
|
options/option_page_custome_redirection_list.php
ADDED
@@ -0,0 +1,242 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
if (!defined('ABSPATH'))
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
global $wpdb, $table_prefix, $util;
|
5 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
6 |
+
|
7 |
+
if ($util->get('del') != '') {
|
8 |
+
$delid = intval($util->get('del'));
|
9 |
+
$wpdb->query($wpdb->prepare(" delete from $table_name where ID=%d ", $delid));
|
10 |
+
|
11 |
+
if ($util->there_is_cache() != '')
|
12 |
+
$util->info_option_msg(__("You have a cache plugin installed", 'wsr') . " <b>'" . $util->there_is_cache() . "'</b>, " . __("you have to clear cache after any changes to get the changes reflected immediately! ", 'wsr'));
|
13 |
+
|
14 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
15 |
+
$SR_redirect_cache->free_cache();
|
16 |
+
}
|
17 |
+
|
18 |
+
$rlink = $util->get_current_parameters(array('del', 'search', 'page_num', 'add', 'edit', 'tab'));
|
19 |
+
|
20 |
+
$redirect_from = isset($redirect_from) ? $redirect_from : '';
|
21 |
+
$redirect_to = isset($redirect_to) ? $redirect_to : '';
|
22 |
+
?>
|
23 |
+
<br/>
|
24 |
+
|
25 |
+
<script type="text/javascript">
|
26 |
+
|
27 |
+
//---------------------------------------------------------
|
28 |
+
|
29 |
+
function go_search() {
|
30 |
+
<?php
|
31 |
+
isset($_REQUEST['tab']) ? $url_op = $_REQUEST['tab'] : $url_op = "";
|
32 |
+
?>
|
33 |
+
var sword = document.getElementById('search').value;
|
34 |
+
if (sword != '') {
|
35 |
+
|
36 |
+
var url = "<?php echo $rlink . '&tab=' . $url_op ?>&search=" + sword;
|
37 |
+
url = decodeURIComponent(url);
|
38 |
+
|
39 |
+
|
40 |
+
window.location = url;
|
41 |
+
} else
|
42 |
+
{
|
43 |
+
alert('<?php _e("Please input any search words!", 'wsr') ?>');
|
44 |
+
document.getElementById('search').focus();
|
45 |
+
}
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
</script>
|
50 |
+
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
51 |
+
<div class="modal-dialog" role="document">
|
52 |
+
<div class="modal-content">
|
53 |
+
<div class="modal-header">
|
54 |
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
55 |
+
<h4 class="modal-title" id="myModalLabel">Add Custom Redirects</h4>
|
56 |
+
</div>
|
57 |
+
<div class="modal-body">
|
58 |
+
|
59 |
+
<form onsubmit="return check_from();" method="POST" id="myform" action="<?php echo $util->get_current_parameters(array('add', 'edit', 'page404')); ?>">
|
60 |
+
<table class="cform" width="100%">
|
61 |
+
<tr>
|
62 |
+
<td class="label"><?php _e('Redirection status:', 'wsr') ?></td>
|
63 |
+
<td> <select size="1" name="enabled" id="enabled">
|
64 |
+
<option value="1"><?php _e('Enabled', 'wsr') ?></option>
|
65 |
+
<option value="0"><?php _e('Disabled', 'wsr') ?></option>
|
66 |
+
</select>
|
67 |
+
|
68 |
+
</td>
|
69 |
+
</tr>
|
70 |
+
<tr>
|
71 |
+
|
72 |
+
<td class="label"><?php _e('Redirect from:', 'wsr') ?></td>
|
73 |
+
<td>
|
74 |
+
<div id="rfrom_div">
|
75 |
+
<select onchange="redirect_from_type_change()" size="1" name="redirect_from_type" id="redirect_from_type">
|
76 |
+
<option value="Page"><?php _e('Page', 'wsr') ?></option>
|
77 |
+
<option value="Folder"><?php _e('Folder', 'wsr') ?></option>
|
78 |
+
<option value="Regex"><?php _e('Regex', 'wsr') ?></option>
|
79 |
+
</select>
|
80 |
+
<input onblur="check_redirect_from()" type="text" id="redirect_from" style="height: 40px;" placeholder="<?php _e("(Starting with 'http://')", 'wsr') ?>" name="redirect_from" size="45" value="<?php echo $redirect_from; ?>">
|
81 |
+
<span class="help-block"></span>
|
82 |
+
<select onchange="redirect_to_folder_settings_change()" size="1" name="redirect_from_folder_settings" id="redirect_from_folder_settings">
|
83 |
+
<option value="1"><?php _e('Only the folder', 'wsr') ?></option>
|
84 |
+
<option value="2"><?php _e("The folder and it's content", 'wsr') ?></option>
|
85 |
+
<option value="3"><?php _e("Only the folder's content", 'wsr') ?></option>
|
86 |
+
</select>
|
87 |
+
<br>
|
88 |
+
<select size="1" name="redirect_from_subfolders" id="redirect_from_subfolders" class="cmb2_select">
|
89 |
+
<option value="0"><?php _e("Include sub-folders", 'wsr') ?></option>
|
90 |
+
<option value="1"><?php _e("Do not include sub-folders", 'wsr') ?></option>
|
91 |
+
</select>
|
92 |
+
|
93 |
+
|
94 |
+
</div>
|
95 |
+
<?php if ($util->get('page404') != '') echo $redirect_from; ?>
|
96 |
+
</td>
|
97 |
+
</tr>
|
98 |
+
<tr>
|
99 |
+
<td class="label"><?php _e("Redirect to:", 'wsr') ?></td>
|
100 |
+
<td>
|
101 |
+
<select onchange="redirect_to_type_change()" size="1" class="cmb2_select" name="redirect_to_type" id="redirect_to_type">
|
102 |
+
<option value="Page"><?php _e("Page:", 'wsr') ?></option>
|
103 |
+
<option value="Folder"><?php _e("Folder", 'wsr') ?></option>
|
104 |
+
</select>
|
105 |
+
|
106 |
+
<input onblur="check_redirect_to()" onblur="if (this.value == 'http://') {
|
107 |
+
this.value = ''
|
108 |
+
}" onfocus="(this.value == '') && (this.value = 'http://')" type="text" id="redirect_to" placeholder="<?php _e("(Starting with 'http://')", 'wsr') ?>" class="regular-text" style="height: 40px;" name="redirect_to" size="45" value="<?php echo $redirect_to ?>">
|
109 |
+
<span class="help-block"></span>
|
110 |
+
<select size="1" name="redirect_to_folder_settings" id="redirect_to_folder_settings">
|
111 |
+
<option value="1"><?php _e("Normal", 'wsr') ?></option>
|
112 |
+
<option value="2"><?php _e("Wild Card Redirect", 'wsr') ?></option>
|
113 |
+
</select>
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
<tr>
|
117 |
+
<td class="label"><?php _e("Redirection type:", 'wsr') ?></td>
|
118 |
+
<td>
|
119 |
+
<select size="1" name="redirect_type" id="redirect_type">
|
120 |
+
<option value="301"><?php _e("301 (SEO)", 'wsr') ?></option>
|
121 |
+
<option value="302"><?php _e("302", 'wsr') ?></option>
|
122 |
+
<option value="307"><?php _e("307", 'wsr') ?></option>
|
123 |
+
</select>
|
124 |
+
<script type="text/javascript">
|
125 |
+
<?php
|
126 |
+
if ($redirect_type != '')
|
127 |
+
echo "document.getElementById('redirect_type').value='$redirect_type';";
|
128 |
+
|
129 |
+
if ($redirect_from_type != '')
|
130 |
+
echo "document.getElementById('redirect_from_type').value='$redirect_from_type';";
|
131 |
+
|
132 |
+
if ($redirect_from_folder_settings != '' && $redirect_from_type == 'Folder')
|
133 |
+
echo "document.getElementById('redirect_from_folder_settings').value='$redirect_from_folder_settings';";
|
134 |
+
|
135 |
+
if ($redirect_from_subfolders != '' && $redirect_from_type == 'Folder')
|
136 |
+
echo "document.getElementById('redirect_from_subfolders').value='$redirect_from_subfolders';";
|
137 |
+
|
138 |
+
if ($redirect_to_type != '')
|
139 |
+
echo "document.getElementById('redirect_to_type').value='$redirect_to_type';";
|
140 |
+
|
141 |
+
if ($redirect_to_folder_settings != '' && $redirect_to_type == 'Folder')
|
142 |
+
echo "document.getElementById('redirect_to_folder_settings').value='$redirect_to_folder_settings';";
|
143 |
+
|
144 |
+
if ($enabled != '')
|
145 |
+
echo "document.getElementById('enabled').value='$enabled';";
|
146 |
+
|
147 |
+
|
148 |
+
if ($util->get('page404') != '')
|
149 |
+
echo "document.getElementById('rfrom_div').style.display = 'none';";
|
150 |
+
?>
|
151 |
+
</script>
|
152 |
+
</td>
|
153 |
+
</tr>
|
154 |
+
</table>
|
155 |
+
<br/>
|
156 |
+
<?php echo "<b>Note</b>:" . __(" When you move your site to another domain, the new domain name will be reflected to all links automatically.", "wsr"); ?>
|
157 |
+
<br/>
|
158 |
+
<label id="msg_response">
|
159 |
+
</label>
|
160 |
+
<br/>
|
161 |
+
</div>
|
162 |
+
<div class="modal-footer">
|
163 |
+
<?php
|
164 |
+
echo '<input class="button-primary" id="btnSave" type="button" value="' . __("Add New", "wsr") . '" onclick="return save_function()">';
|
165 |
+
?>
|
166 |
+
<input type="hidden" id="_wpnonce" name="_wpnonce" value="<?php echo $nonce = wp_create_nonce('seoredirection'); ?>" />
|
167 |
+
<input type="hidden" id="edit" name="edit" value="<?php echo intval($util->get('edit')) ?>">
|
168 |
+
<input type="hidden" id="add_new" name="add_new" value="">
|
169 |
+
<input type="hidden" id="edit_exist" name="edit_exist" value="">
|
170 |
+
<input type="hidden" id="action" name="action" value="customAddUpdate">
|
171 |
+
<input data-dismiss="modal" aria-label="Close" class="button-primary " type="button" value="<?php _e("Cancel", 'wsr') ?>" name="cancel">
|
172 |
+
|
173 |
+
|
174 |
+
</div>
|
175 |
+
</div>
|
176 |
+
</form>
|
177 |
+
</div>
|
178 |
+
</div>
|
179 |
+
<div class="link_buttons">
|
180 |
+
|
181 |
+
<table border="0" width="100%">
|
182 |
+
<tr>
|
183 |
+
<td > <button type="button" class="button-secondary" onclick="add_rec()" >
|
184 |
+
<span style="padding-top: 5px;" class="dashicons dashicons-plus"></span><?php _e('Add New', 'wsr') ?>
|
185 |
+
</button>
|
186 |
+
|
187 |
+
<label id="waiting_lbl"><div class="loading" style="display: none">Loading…</div>
|
188 |
+
</label>
|
189 |
+
</td>
|
190 |
+
<td align="right">
|
191 |
+
<input onkeyup="if (event.keyCode == 13)
|
192 |
+
go_search();" style="height: 30px;" id="search" type="text" name="search" value="<?php echo htmlentities($util->get('search'), ENT_QUOTES) ?>" size="30">
|
193 |
+
<a class="button" onclick="go_search()" href="#" ><span style="padding-top: 3px;" class="dashicons dashicons-search"></span> <?php _e("Search", 'wsr') ?></a>
|
194 |
+
<a class="button" href="<?php echo esc_url(htmlentities($util->get_current_parameters('search'))) ?>"><span style="padding-top: 3px;" class="dashicons dashicons-screenoptions"></span> <?php _e("Show All", 'wsr') ?></a>
|
195 |
+
</td>
|
196 |
+
</tr>
|
197 |
+
</table>
|
198 |
+
</div>
|
199 |
+
<?php
|
200 |
+
$grid = new datagrid();
|
201 |
+
$grid->set_data_source($table_name);
|
202 |
+
$grid->add_select_field('ID');
|
203 |
+
$grid->add_select_field('redirect_from');
|
204 |
+
$grid->add_select_field('redirect_from_type');
|
205 |
+
$grid->add_select_field('redirect_to');
|
206 |
+
$grid->add_select_field('redirect_to_type');
|
207 |
+
$grid->add_select_field('enabled');
|
208 |
+
$grid->set_table_attr('width', '100%');
|
209 |
+
$grid->set_col_attr(4, 'width', '50px');
|
210 |
+
$grid->set_col_attr(5, 'width', '50px');
|
211 |
+
$grid->set_col_attr(6, 'width', '100px');
|
212 |
+
$grid->set_col_attr(7, 'width', '20px');
|
213 |
+
$grid->set_col_attr(8, 'width', '20px');
|
214 |
+
$grid->set_col_attr(2, 'width', '40%');
|
215 |
+
|
216 |
+
$grid->set_col_attr(3, 'width', '40%');
|
217 |
+
$grid->set_col_attr(4, 'width', '50px', 'header');
|
218 |
+
$grid->set_col_attr(1, 'width', '30px', 'header');
|
219 |
+
$grid->set_col_attr(5, 'width', '30px', 'header');
|
220 |
+
$grid->set_col_attr(6, 'width', '150px', 'header');
|
221 |
+
$grid->set_col_attr(7, 'width', '50px', 'header');
|
222 |
+
$grid->set_col_attr(8, 'width', '20px', 'header');
|
223 |
+
|
224 |
+
$grid->set_order(" ID desc ");
|
225 |
+
|
226 |
+
$grid->set_filter("url_type=1");
|
227 |
+
|
228 |
+
if ($util->get('search') != '') {
|
229 |
+
$search = $util->get('search');
|
230 |
+
$grid->set_filter("url_type=1 and (redirect_from like '%%$search%%' or redirect_to like '%%$search%%' or redirect_type like '%%$search%%' )");
|
231 |
+
}
|
232 |
+
|
233 |
+
$grid->add_data_col('', __('No', 'wsr'));
|
234 |
+
$grid->add_php_col(' echo "<div class=\'{$db_redirect_from_type}_background_{$db_enabled}\'><a target=\'_blank\' href=\'" . SEOR_make_absolute_url(esc_url($db_redirect_from)) ."\'>{$db_redirect_from}</a></div>" ;', __('Redirect from ', 'wsr'));
|
235 |
+
$grid->add_php_col(' echo "<div class=\'{$db_redirect_to_type}_background_{$db_enabled}\'><a target=\'_blank\' href=\'" . SEOR_make_absolute_url(esc_url($db_redirect_to)) ."\'>{$db_redirect_to}</a></div>"; ', __('Redirect to ', 'wsr'));
|
236 |
+
$grid->add_data_col('redirect_type', __('Type', 'wsr'));
|
237 |
+
$grid->add_data_col('', __('Hits', 'wsr'));
|
238 |
+
$grid->add_data_col('', __('Last Access', 'wsr'));
|
239 |
+
$grid->add_template_col('del', $util->get_current_parameters('del') . '&del={db_ID}', __('Actions', 'wsr'));
|
240 |
+
$grid->add_template_col('edit', '{db_ID}', __('', 'wsr'));
|
241 |
+
$grid->run();
|
242 |
+
?>
|
options/option_page_goptions.php
ADDED
@@ -0,0 +1,183 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|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
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
global $util;
|
4 |
+
|
5 |
+
$nonce="";
|
6 |
+
if(isset($_REQUEST['_wpnonce']))
|
7 |
+
$nonce = $_REQUEST['_wpnonce'];
|
8 |
+
|
9 |
+
if(isset($_POST) && wp_verify_nonce( $nonce, 'seoredirection' ) ){
|
10 |
+
if($util->post('reset_all_options')!='')
|
11 |
+
{
|
12 |
+
c_init_my_options();
|
13 |
+
$util->success_option_msg(__('All Options Restored to Defaults','wsr'));
|
14 |
+
|
15 |
+
}else if($util->post('Save_general_options')!='')
|
16 |
+
{
|
17 |
+
c_save_redirection_general_options();
|
18 |
+
$util->success_option_msg(__('General Options Saved!','wsr'));
|
19 |
+
|
20 |
+
}else if($util->post('save_history_options')!='')
|
21 |
+
{
|
22 |
+
c_save_redirection_history_options();
|
23 |
+
$util->success_option_msg(__('History Options Saved!','wsr'));
|
24 |
+
}
|
25 |
+
else if($util->post('clear_history')!='')
|
26 |
+
{
|
27 |
+
c_clear_redirection_history();
|
28 |
+
$util->success_option_msg(__('History Cleared!','wsr'));
|
29 |
+
}
|
30 |
+
else if($util->post('save_404_options')!='')
|
31 |
+
{
|
32 |
+
c_save_404_redirection_options();
|
33 |
+
$util->success_option_msg(__('404 Redirection Options Saved!','wsr'));
|
34 |
+
}
|
35 |
+
else if($util->post('clear_all_404')!='')
|
36 |
+
{
|
37 |
+
c_clear_all_404();
|
38 |
+
$util->success_option_msg(__('All Discovered 404 Pages Cleared!','wsr'));
|
39 |
+
}
|
40 |
+
else if($util->post('save_data_options')!='')
|
41 |
+
{
|
42 |
+
c_save_keep_data();
|
43 |
+
$util->success_option_msg(__('Data Options Saved!','wsr'));
|
44 |
+
}
|
45 |
+
else if($util->post('optimize_tables')!='')
|
46 |
+
{
|
47 |
+
c_optimize_tables();
|
48 |
+
$util->success_option_msg(__('Data Tables Optimized!','wsr'));
|
49 |
+
}
|
50 |
+
else if($util->post('save_all_options'))
|
51 |
+
{
|
52 |
+
c_save_redirection_general_options();
|
53 |
+
c_save_redirection_history_options();
|
54 |
+
c_save_404_redirection_options();
|
55 |
+
c_save_keep_data();
|
56 |
+
|
57 |
+
$util->success_option_msg(__('All options saved!','wsr'));
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
if($util->there_is_cache()!='')
|
67 |
+
|
68 |
+
$util->info_option_msg(__("You have a cache plugin installed",'wsr')." <b>'" . $util->there_is_cache() . "'</b>, ".__("you have to clear cache after any changes to get the changes reflected immediately! ",'wsr'));
|
69 |
+
}
|
70 |
+
|
71 |
+
$options= $util->get_my_options();
|
72 |
+
|
73 |
+
?>
|
74 |
+
<form method="POST">
|
75 |
+
<h3><?php _e("General Options","wsr") ?><hr></h3>
|
76 |
+
|
77 |
+
<input type="hidden" id="_wpnonce" name="_wpnonce" value="<?php echo $nonce = wp_create_nonce('seoredirection'); ?>" />
|
78 |
+
|
79 |
+
<table class="cform" align="center" width="100%">
|
80 |
+
<tr><td>
|
81 |
+
<?php _e("Plugin Status:","wsr") ?>
|
82 |
+
<?php
|
83 |
+
$drop = new dropdown('plugin_status');
|
84 |
+
$drop->add(__('Enabled','wsr'),'1');
|
85 |
+
$drop->add(__('Disabled','wsr'),'0');
|
86 |
+
$drop->add(__('Disabled for admin only','wsr'),'2');
|
87 |
+
$drop->dropdown_print();
|
88 |
+
$drop->select($options['plugin_status']);
|
89 |
+
?>
|
90 |
+
|
91 |
+
</td></tr>
|
92 |
+
|
93 |
+
|
94 |
+
<tr><td>
|
95 |
+
<?php _e("IP Logging:","wsr") ?>
|
96 |
+
<?php
|
97 |
+
$drop = new dropdown('ip_logging_status');
|
98 |
+
$drop->add(__('No IP logging','wsr'),'0');
|
99 |
+
$drop->add(__('Full IP logging','wsr'),'1');
|
100 |
+
$drop->add(__('Anonymize IP (mask last part)','wsr'),'2');
|
101 |
+
$drop->dropdown_print();
|
102 |
+
$drop->select($options['ip_logging_status']);
|
103 |
+
?>
|
104 |
+
<small> used for <a href="https://eugdpr.org/" target="_blank">GDPR</a> compliance</small>
|
105 |
+
</td></tr>
|
106 |
+
|
107 |
+
<tr><td>
|
108 |
+
<?php $check = new checkoption('redirect_control_panel',$options['redirect_control_panel']); ?>
|
109 |
+
<?php _e("Do not redirect control panel links (This will be usefull when making wrong expressions that may cause an infinit redirection loop).","wsr"); ?>
|
110 |
+
|
111 |
+
<br/>
|
112 |
+
<?php $check = new checkoption('show_redirect_box',$options['show_redirect_box']); ?>
|
113 |
+
<?php _e("Show redirect box in posts & pages edit page (Important to set up redirection for posts and pages easily).","wsr"); ?>
|
114 |
+
|
115 |
+
|
116 |
+
<br/>
|
117 |
+
<?php $check = new checkoption('reflect_modifications',$options['reflect_modifications']); ?>
|
118 |
+
<?php _e("Reflect any modifications in the post permalink to all redirection links (Mostly Recommended).","wsr"); ?>
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
<script type="text/javascript">
|
124 |
+
|
125 |
+
</script>
|
126 |
+
</td></tr>
|
127 |
+
|
128 |
+
</table>
|
129 |
+
<br/><input style="margin-left:5px" class="button-primary" type="submit" value="<?php _e("Save General Options","wsr") ?>" name="Save_general_options">
|
130 |
+
|
131 |
+
|
132 |
+
<br/><br/>
|
133 |
+
<h3><?php _e("Redirection History Options","wsr") ?><hr></h3>
|
134 |
+
<table class="cform" align="center" width="100%">
|
135 |
+
<tr><td>
|
136 |
+
<?php _e("Redirection History Status:","wsr") ?>
|
137 |
+
<?php
|
138 |
+
$drop = new dropdown('history_status');
|
139 |
+
$drop->add(__('Enabled','wsr'),'1');
|
140 |
+
$drop->add(__('Disabled','wsr'),'0');
|
141 |
+
$drop->dropdown_print();
|
142 |
+
$drop->select($options['history_status']);
|
143 |
+
?>
|
144 |
+
|
145 |
+
</td></tr>
|
146 |
+
<tr><td>
|
147 |
+
<?php _e("Redirection History Limit:","wsr") ?>
|
148 |
+
<?php
|
149 |
+
$drop = new dropdown('history_limit');
|
150 |
+
$drop->add(__('7 days','wsr'),'7');
|
151 |
+
$drop->add(__('1 month','wsr'),'30');
|
152 |
+
$drop->add(__('2 months','wsr'),'60');
|
153 |
+
$drop->add(__('3 months','wsr'),'90');
|
154 |
+
$drop->dropdown_print();
|
155 |
+
$drop->select($options['history_limit']);
|
156 |
+
?>
|
157 |
+
|
158 |
+
</td></tr>
|
159 |
+
|
160 |
+
</table>
|
161 |
+
<br/>
|
162 |
+
<input style="margin-left:5px" class="button-primary" type="submit" value="Save History Options" name="save_history_options">
|
163 |
+
<input style="margin-left:5px" class="button-primary" type="submit" value="Clear History" name="clear_history">
|
164 |
+
|
165 |
+
<br/><br/>
|
166 |
+
|
167 |
+
<h3><?php _e("Redrection Data Options","wsr"); ?><hr></h3>
|
168 |
+
<table class="cform" align="center" width="100%">
|
169 |
+
<tr><td>
|
170 |
+
<?php $check = new checkoption('keep_data',$options['keep_data'],'1'); ?>
|
171 |
+
<?php _e("Keep redirection data after uninstall the plugin, this will be useful when you install it later.","wsr"); ?>
|
172 |
+
|
173 |
+
</td></tr>
|
174 |
+
</table>
|
175 |
+
<br/>
|
176 |
+
<input style="margin-left:5px" class="button-primary" type="submit" value="<?php _e("Save Data Options","wsr") ?>" name="save_data_options">
|
177 |
+
<input style="margin-left:5px" class="button-primary" type="submit" value="<?php _e("Optimize Data Tables","wsr") ?>" name="optimize_tables">
|
178 |
+
<br/><br/><br/>
|
179 |
+
<hr>
|
180 |
+
<input style="margin-left:5px" class="button-primary" type="submit" value="<?php _e("Save All Options","wsr") ?>" name="save_all_options">
|
181 |
+
<input style="margin-left:5px" class="button-primary" type="submit" value="<?php _e("Restore Default Settings","wsr") ?>" name="reset_all_options">
|
182 |
+
|
183 |
+
</form>
|
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,$table_prefix,$util;
|
4 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection_LOG';
|
5 |
+
$rlink=$util->get_current_parameters(array('del','search','page_num','add','edit'));
|
6 |
+
|
7 |
+
if($util->get('del')!=''){
|
8 |
+
if($util->get('del')=='all'){
|
9 |
+
c_clear_redirection_history();
|
10 |
+
|
11 |
+
if($util->there_is_cache()!='')
|
12 |
+
$util->info_option_msg(__("You have a cache plugin installed",'wsr')." <b>'" . $util->there_is_cache() . "'</b>, ".__("you have to clear cache after any changes to get the changes reflected immediately! ",'wsr'));
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
if($util->get_option_value('history_status')!='1')
|
17 |
+
$util->info_option_msg(__("Redirection history property is disabled now!, you can re-enable it from options tab.",'wsr'));
|
18 |
+
|
19 |
+
?>
|
20 |
+
|
21 |
+
<script type="text/javascript">
|
22 |
+
//---------------------------------------------------------
|
23 |
+
function go_search(){
|
24 |
+
var sword = document.getElementById('search').value;
|
25 |
+
if(sword!=''){
|
26 |
+
window.location = "<?php echo esc_url($rlink)?>&search=" + sword ;
|
27 |
+
}else
|
28 |
+
{
|
29 |
+
alert('<?php _e("Please input any search words!","wsr") ?>');
|
30 |
+
document.getElementById('search').focus();
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
</script>
|
36 |
+
|
37 |
+
<h3><?php _e("Redirection History","wsr"); ?><hr></h3>
|
38 |
+
<div class="link_buttons">
|
39 |
+
<table border="0" width="100%">
|
40 |
+
<tr>
|
41 |
+
<td width="150"><a href="<?php echo $rlink?>&del=all" class="button"><span style="padding-top: 3px;" class="dashicons dashicons-trash"></span> <?php _e("Clear History","wsr"); ?></a></td>
|
42 |
+
<td align="right">
|
43 |
+
<input onkeyup="if (event.keyCode == 13) go_search();" style="height: 30px;" id="search" type="text" name="search" value="<?php echo htmlentities($util->get('search'),ENT_QUOTES)?>" size="30">
|
44 |
+
<a onclick="go_search()" href="#" class="button"><span style="padding-top: 3px;" class="dashicons dashicons-search"></span> <?php _e("Search","wsr"); ?></a>
|
45 |
+
<a href="<?php echo $util->get_current_parameters('search')?>" class="button"><span style="padding-top: 3px;" class="dashicons dashicons-screenoptions"></span> <?php _e("Show All","wsr"); ?></a>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
</table>
|
49 |
+
</div>
|
50 |
+
|
51 |
+
<?php
|
52 |
+
|
53 |
+
|
54 |
+
$grid = new datagrid();
|
55 |
+
$grid->set_data_source($table_name);
|
56 |
+
|
57 |
+
$grid->set_order(" ID desc ");
|
58 |
+
|
59 |
+
if($util->get('search')!='')
|
60 |
+
{
|
61 |
+
$search=$util->get('search');
|
62 |
+
|
63 |
+
$grid->set_filter(" rfrom like '%%$search%%' or rto like '%%$search%%' or ctime like '%%$search%%'
|
64 |
+
or referrer like '%%$search%%' or country like '%%$search%%' or ip like '%%$search%%'
|
65 |
+
or os like '%%$search%%' or browser like '%%$search%%' or rsrc like '%%$search%%' or rtype like '%%$search%%'
|
66 |
+
");
|
67 |
+
}
|
68 |
+
|
69 |
+
$grid->add_select_field('rID');
|
70 |
+
$grid->add_select_field('postID');
|
71 |
+
$grid->add_select_field('referrer');
|
72 |
+
$grid->add_select_field('country');
|
73 |
+
$grid->add_select_field('ip');
|
74 |
+
$grid->add_select_field('os');
|
75 |
+
$grid->add_select_field('browser');
|
76 |
+
$grid->add_select_field('rsrc');
|
77 |
+
$grid->add_select_field('rfrom');
|
78 |
+
$grid->add_select_field('rto');
|
79 |
+
$grid->add_select_field('ctime');
|
80 |
+
|
81 |
+
$grid->set_table_attr('width','100%');
|
82 |
+
$grid->set_col_attr(1,'width','120px');
|
83 |
+
$grid->set_col_attr(3,'width','20px');
|
84 |
+
$grid->set_col_attr(3,'align','center');
|
85 |
+
$grid->set_col_attr(4,'width','20px');
|
86 |
+
$grid->set_col_attr(4,'align','center');
|
87 |
+
$grid->set_col_attr(7,'width','30px');
|
88 |
+
$grid->set_col_attr(7,'align','center');
|
89 |
+
$grid->set_col_attr(6,'width','75px');
|
90 |
+
$grid->set_col_attr(5,'width','130px');
|
91 |
+
|
92 |
+
$grid->set_col_attr(1, 'width', '90px', 'header');
|
93 |
+
$grid->set_col_attr(3, 'width', '40px', 'header');
|
94 |
+
$grid->set_col_attr(4, 'width', '40px', 'header');
|
95 |
+
$grid->set_col_attr(5, 'width', '125px', 'header');
|
96 |
+
$grid->set_col_attr(6, 'width', '120px', 'header');
|
97 |
+
$grid->set_col_attr(7, 'width', '50px', 'header');
|
98 |
+
|
99 |
+
$grid->add_php_col('echo date(\'Y-n-j\',strtotime($db_ctime)) . \'<br/>\' . date(\'H:i:s\',strtotime($db_ctime)); ',__('Time','wsr'));
|
100 |
+
|
101 |
+
$grid->add_php_col(' echo "<div class=\'arrow_from\'><a target=\'_blank\' href=\'" . SEOR_make_absolute_url(esc_url($db_rfrom)) ."\'>" .SR_cut_string(esc_url($db_rfrom),0,120) ."</a></div><div class=\'arrow_to\'><a target=\'_blank\' href=\'" . SEOR_make_absolute_url(esc_url($db_rto)) ."\'>" .SR_cut_string(esc_url($db_rto),0,120) ."</a></div>" ;',__('Redirection','wsr'));
|
102 |
+
$grid->add_data_col('rtype','Type');
|
103 |
+
$grid->add_php_col('if($db_referrer !="") echo "<a target=\'_blank\' title=\'$db_referrer\' href=\'$db_referrer\'><span class=\'link\'></span></a>" ;',__('Ref','wsr'));
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
if($util->get_option_value('ip_logging_status') == 0)
|
108 |
+
{
|
109 |
+
$grid->add_html_col('{db_country}',__('Address','wsr'));
|
110 |
+
}else if($util->get_option_value('ip_logging_status') == 1)
|
111 |
+
{
|
112 |
+
$grid->add_html_col('{db_country}<br/>{db_ip}',__('Address','wsr'));
|
113 |
+
}else{
|
114 |
+
|
115 |
+
$grid->add_php_col('echo $db_country." <br>".preg_replace(\'/([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+/\', \'\\1.***\', $db_ip); ',__('Address','wsr'));
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
$grid->add_html_col('{db_os}<br/>{db_browser}',__('Agent','wsr'));
|
121 |
+
|
122 |
+
$grid->add_php_col('
|
123 |
+
if($db_rsrc==\'404\') echo $db_rsrc;
|
124 |
+
if($db_rsrc==\'Custom\') echo "<a target=\'blank\' href=\'?page=wp-seo-redirection.php&edit=$db_rID\'>{$db_rsrc}</a>";
|
125 |
+
if($db_rsrc==\'Post\') echo "<a target=\'blank\' href=\'post.php?action=edit&post=$db_postID\'>{$db_rsrc}</a>";
|
126 |
+
',__('Class','wsr'));
|
127 |
+
|
128 |
+
|
129 |
+
$grid->run();
|
130 |
+
|
131 |
+
|
132 |
+
?>
|
options/option_page_post_redirection_list.php
ADDED
@@ -0,0 +1,115 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
global $wpdb,$table_prefix,$util;
|
4 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
5 |
+
|
6 |
+
if($util->get('del')!='')
|
7 |
+
{
|
8 |
+
$delid=intval($util->get('del'));
|
9 |
+
|
10 |
+
$wpdb->query($wpdb->prepare(" delete from $table_name where ID=%s ",$delid));
|
11 |
+
|
12 |
+
|
13 |
+
if($util->there_is_cache()!='')
|
14 |
+
$util->info_option_msg(__("You have a cache plugin installed",'wsr')." <b>'" . $util->there_is_cache() . "'</b>, ".__("you have to clear cache after any changes to get the changes reflected immediately! ",'wsr'));
|
15 |
+
|
16 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
17 |
+
$SR_redirect_cache->free_cache();
|
18 |
+
}
|
19 |
+
|
20 |
+
$rlink=$util->get_current_parameters(array('del','search','page_num','add','edit','tab'));
|
21 |
+
|
22 |
+
?>
|
23 |
+
<br/>
|
24 |
+
|
25 |
+
<script type="text/javascript">
|
26 |
+
|
27 |
+
//---------------------------------------------------------
|
28 |
+
|
29 |
+
function go_search(){
|
30 |
+
<?php
|
31 |
+
isset($_REQUEST['tab'])?$url_op=$_REQUEST['tab']:$url_op="";
|
32 |
+
?>
|
33 |
+
var sword = document.getElementById('search').value;
|
34 |
+
if(sword!=''){
|
35 |
+
|
36 |
+
var url= "<?php echo $rlink.'&tab='.$url_op?>&search=" + sword;
|
37 |
+
url=decodeURIComponent(url);
|
38 |
+
|
39 |
+
window.location =url;
|
40 |
+
}else
|
41 |
+
{
|
42 |
+
alert('<?php _e("Please input any search words!",'wsr') ?>');
|
43 |
+
document.getElementById('search').focus();
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
</script>
|
50 |
+
|
51 |
+
<div class="link_buttons">
|
52 |
+
<table border="0" width="100%">
|
53 |
+
<tr>
|
54 |
+
<td align="right">
|
55 |
+
<input onkeyup="if (event.keyCode == 13) go_search();" style="height: 30px;" id="search" type="text" name="search" value="<?php echo htmlentities($util->get('search','title'))?>" size="30">
|
56 |
+
<!--<a onclick="go_search()" href="#"><div class="search_link"><?php _e("Search","wsr"); ?></div></a>-->
|
57 |
+
<a onclick="go_search()" href="#" class="button"><span style="padding-top: 3px;" class="dashicons dashicons-search"></span> <?php _e("Search","wsr"); ?></a>
|
58 |
+
|
59 |
+
<a href="<?php echo esc_url($util->get_current_parameters('search'))?>" class="button"><span style="padding-top: 3px;" class="dashicons dashicons-screenoptions"></span> <?php _e("Show All","wsr"); ?></a>
|
60 |
+
</td>
|
61 |
+
</tr>
|
62 |
+
</table>
|
63 |
+
</div>
|
64 |
+
<?php
|
65 |
+
|
66 |
+
$grid = new datagrid();
|
67 |
+
$grid->set_data_source($table_name);
|
68 |
+
$grid->add_select_field('ID');
|
69 |
+
$grid->add_select_field('postID');
|
70 |
+
$grid->add_select_field('redirect_from');
|
71 |
+
$grid->add_select_field('redirect_from_type');
|
72 |
+
$grid->add_select_field('redirect_to');
|
73 |
+
$grid->add_select_field('redirect_to_type');
|
74 |
+
|
75 |
+
$grid->set_table_attr('width','100%');
|
76 |
+
$grid->set_col_attr(4,'width','50px');
|
77 |
+
$grid->set_col_attr(5,'width','50px');
|
78 |
+
$grid->set_col_attr(6,'width','100px');
|
79 |
+
$grid->set_col_attr(2,'width','40%');
|
80 |
+
$grid->set_col_attr(3,'width','40%');
|
81 |
+
$grid->set_col_attr(4,'width','50px','header');
|
82 |
+
$grid->set_col_attr(1,'width','30px','header');
|
83 |
+
$grid->set_col_attr(5,'width','30px','header');
|
84 |
+
$grid->set_col_attr(6,'width','150px','header');
|
85 |
+
$grid->set_col_attr(7,'width','50px','header');
|
86 |
+
$grid->set_col_attr(8,'width','20px','header');
|
87 |
+
$grid->set_order(" ID desc ");
|
88 |
+
|
89 |
+
$grid->set_filter("url_type=2");
|
90 |
+
|
91 |
+
if($util->get('search')!='')
|
92 |
+
{
|
93 |
+
$search=$util->get('search');
|
94 |
+
$grid->set_filter("url_type!=1 and (redirect_from like '%%$search%%' or redirect_to like '%%$search%%' or redirect_type like '%%$search%%' )");
|
95 |
+
}
|
96 |
+
|
97 |
+
$grid->add_data_col('',__('No','wsr'));
|
98 |
+
|
99 |
+
|
100 |
+
//$grid->add_data_col('redirect_from','Redirect from');
|
101 |
+
//$grid->add_data_col('redirect_to','Redirect to');
|
102 |
+
$grid->add_php_col(' echo "<div class=\'{$db_redirect_from_type}_background_{$db_enabled}\'><a target=\'_blank\' href=\'" . SEOR_make_absolute_url($db_redirect_from) ."\'>{$db_redirect_from}</a></div>" ;',__('Redirect from ','wsr'));
|
103 |
+
$grid->add_php_col(' echo "<div class=\'{$db_redirect_to_type}_background_{$db_enabled}\'><a target=\'_blank\' href=\'" . SEOR_make_absolute_url($db_redirect_to) ."\'>{$db_redirect_to}</a></div>"; ',__('Redirect to ','wsr'));
|
104 |
+
$grid->add_data_col('redirect_type',__('Type','wsr'));
|
105 |
+
$grid->add_data_col('',__('Hits','wsr'));
|
106 |
+
$grid->add_data_col('',__('Last Access','wsr'));
|
107 |
+
$grid->add_template_col('go_link','post.php?post={db_postID}&action=edit','Actions');
|
108 |
+
$grid->add_template_col('del', $util->get_current_parameters('del') . '&del={db_ID}','');
|
109 |
+
|
110 |
+
$grid->run();
|
111 |
+
|
112 |
+
|
113 |
+
|
114 |
+
?>
|
115 |
+
<?php echo "<b>Note</b>:".__("To add a redirection for any post or page , use custom redirection or go to the edit page, you will find the redirection box, use it to set your redirection.","wsr")."<br/>" ?>
|
options/premium.php
ADDED
@@ -0,0 +1,38 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
3 |
+
$imgpath= $util->get_plugin_url().'custom/images/';
|
4 |
+
?>
|
5 |
+
|
6 |
+
<h2><?php _e("What’s New in Premium Version?","wsr") ?></h2>
|
7 |
+
<hr/>
|
8 |
+
<ul class="features">
|
9 |
+
<li><?php _e("Organize your redirects in ","wsr") ?><strong><?php _e("groups","wsr") ?></strong>.</li>
|
10 |
+
<li><strong><?php _e("Redirect Cache","wsr") ?></strong> <?php _e("feature to boost performance and redirect speed.","wsr") ?></li>
|
11 |
+
<li><?php _e("Supports all","wsr") ?> <strong><?php _e("post types","wsr") ?></strong><?php _e("with the capability of activating or deactivating any post type.","wsr") ?> </li>
|
12 |
+
<li><?php _e("More redirect types are available ex.","wsr") ?> ‘<strong><?php _e("StartWith","wsr") ?></strong>’, ‘<strong><?php _e("EndWith","wsr") ?></strong>’, ‘<strong><?php _e("Contain","wsr") ?></strong>’<?php _e(" (To redirect all links that contain some text) or ","wsr") ?>‘<strong><?php _e("Filetype","wsr") ?></strong>’<?php _e(" to let you redirect specific file types like redirecting all .php pages.","wsr") ?></li>
|
13 |
+
<li><strong><?php _e("Regular Expression","wsr") ?></strong> <?php _e("is supported for advanced users.","wsr") ?></li>
|
14 |
+
<li><?php _e("More controls on discovered 404 list, for example filter by views, source(regular visitor or search engine), country or link type (Link, Image, Script or others).","wsr") ?></li>
|
15 |
+
<li><?php _e("Add","wsr") ?> <strong><?php _e("404 rules","wsr") ?></strong><?php _e("to handle 404 redirects as your needs.","wsr") ?> </li>
|
16 |
+
<li><strong><?php _e("General rules","wsr") ?></strong><?php _e(" for 404 errors for example you can choose an image to be displayed instead of any broken images and also can redirect all unknown 404 to home page or to any custom page.","wsr") ?></li>
|
17 |
+
<li><?php _e("Adds an ","wsr") ?><strong><?php _e("auto redirect ","wsr") ?></strong><?php _e(" when detecting a change in any post permalink.","wsr") ?></li>
|
18 |
+
<li><?php _e("Keeps track of","wsr") ?> <strong><?php _e("trashed ","wsr") ?></strong><?php _e("or","wsr") ?> <strong><?php _e("drafted","wsr") ?></strong><?php _e(" posts, and ask you to redirect them to prevent 404 errors.","wsr") ?> </li>
|
19 |
+
<li><strong><?php _e("Import","wsr") ?> </strong><?php _e(" and","wsr") ?> <strong><?php _e("Export","wsr") ?></strong><?php _e(" redirects feature with various options.","wsr") ?></li>
|
20 |
+
<li><?php _e("Supports ","wsr") ?><strong><?php _e("WordPress MU ","wsr") ?></strong><?php _e("installation. ","wsr") ?> </li>
|
21 |
+
<li><?php _e("Friendly and easy to use GUI based on ","wsr") ?><strong><?php _e("bootstrap","wsr") ?></strong>.</li>
|
22 |
+
</ul>
|
23 |
+
<h2> <?php _e("What will happen to the current redirects in this version?","wsr") ?></h2>
|
24 |
+
<p><?php _e("All the current redirects will remain and appear in the Premium version after upgrade without any problems","wsr") ?></p>
|
25 |
+
<br/>
|
26 |
+
|
27 |
+
|
28 |
+
<p style="text-align: center"><font size="5"><a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin?src=freeversiom" target="_blank"><?php _e("Click Here for Pricing & Review","wsr") ?></a></font></p>
|
29 |
+
|
30 |
+
<p style="text-align: center"><a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin?src=freeversiom" target="_blank"><img src="<?php echo $imgpath ?>redirect_manager_intro.png"></a></p>
|
31 |
+
<p style="text-align: center"><a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin?src=freeversiom" target="_blank"><img src="<?php echo $imgpath ?>404_manager.png"></a></p>
|
32 |
+
<p style="text-align: center"><a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin?src=freeversiom" target="_blank"><img src="<?php echo $imgpath ?>import_export.png"></a></p>
|
33 |
+
<p style="text-align: center"><a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin?src=freeversiom" target="_blank"><img src="<?php echo $imgpath ?>control_panel.png"></a></p>
|
34 |
+
<p style="text-align: center"><a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin?src=freeversiom" target="_blank"><img src="<?php echo $imgpath ?>help_center.png"></a></p>
|
35 |
+
<p style="text-align: center"><a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin?src=freeversiom" target="_blank"><img src="<?php echo $imgpath ?>other_features.png"></a></p>
|
36 |
+
<p style="text-align: center"><a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin?src=freeversiom" target="_blank"><img src="<?php echo $imgpath ?>circles.png"></a></p>
|
37 |
+
|
38 |
+
<p style="text-align: center"><font size="5"><a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin?src=freeversiom" target="_blank"><?php _e("Click Here for Pricing & Review","wsr") ?></a></font></p>
|
readme.txt
ADDED
@@ -0,0 +1,220 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
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|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
=== SEO Redirection Plugin===
|
2 |
+
Contributors: fakhris
|
3 |
+
Donate link: http://www.clogica.com/donations.htm
|
4 |
+
Tags: post, admin, seo, pages, manage, 301, 404, soft 404, redirect, permalink, redirection, redirection, https, automatic redirection, htaccess, ssl, https redirection, ssl certificate, secure page, secure, force ssl, force https, seo redirection, post redirect, 404 to 301
|
5 |
+
Requires at least: 4.1
|
6 |
+
Tested up to: 5.2
|
7 |
+
Stable tag: 4.17
|
8 |
+
|
9 |
+
SEO Redirection is the best plugin to manage 301 redirections without requiring knowledge of Apache .htaccess files.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
SEO Redirection is a WordPress plugin to manage 301 redirections, you can build and manage redirections easily for your site,
|
14 |
+
This plugin is useful if you want to migrating pages from an old website, or are changing the directory of your WordPress website.
|
15 |
+
|
16 |
+
|
17 |
+
New features include:
|
18 |
+
|
19 |
+
* Manually add 301, 302, and 307 redirections for a WordPress post
|
20 |
+
* Supports wild card redirection.
|
21 |
+
* Fix Crawl Errors (404 & soft 404) in Google Search Console(New)
|
22 |
+
* WPML Support (WordPress Multi-language integration) (New)
|
23 |
+
* Import/Export feature (New)
|
24 |
+
* Adding the last access time & total hits to the redirects list (New)
|
25 |
+
* Automatically add a 301 redirection when a post’s URL changes
|
26 |
+
* Redirect posts and pages that published, draft or deleted from it\'s edit page directly.
|
27 |
+
* Advanced control panel to control all functions of the plugin.
|
28 |
+
* You can redirect folders and all it's content.
|
29 |
+
* Full logs for all redirected URLs
|
30 |
+
* You can use regular expressions in redirections.
|
31 |
+
* Reflect changes to all links when you move your site or change the domain name.
|
32 |
+
* All URLs can be redirected, not just ones that don't exist
|
33 |
+
* Redirection methods - redirect based upon login status, redirect to random pages, redirect based upon the referrer!
|
34 |
+
* Friendly GUI and easy to use.
|
35 |
+
* Apache .htaccess is not required, works entirely inside WordPress
|
36 |
+
* Redirect index.php, index.html, and index.htm access
|
37 |
+
* Redirection statistics telling you how many times a redirection has occurred, when it last happened, who tried to do it, and where they found your URL
|
38 |
+
* (GDPR compliance) You can customise the level of IP information that is collected by our plugin
|
39 |
+
|
40 |
+
== Screenshots ==
|
41 |
+
1. Redirection Box in edit page for posts and pages.
|
42 |
+
2. List of custom redirections.
|
43 |
+
3. Page to Page custom redirection.
|
44 |
+
4. Folders custom redirection.
|
45 |
+
5. Regular Expression custom redirection.
|
46 |
+
6. Redirected posts via the Redirection Box.
|
47 |
+
7. All redirections history.
|
48 |
+
8. Control panel options.
|
49 |
+
|
50 |
+
|
51 |
+
== Installation ==
|
52 |
+
|
53 |
+
The plugin is simple to install:
|
54 |
+
|
55 |
+
1. Download `seo-redirection.zip`
|
56 |
+
1. Unzip the file
|
57 |
+
1. Upload `seo-redirection` directory to your `/wp-content/plugins` directory
|
58 |
+
1. Go to the plugin management page and enable the plugin
|
59 |
+
1. Configure the options from the `Settings/SEO Redirection` page
|
60 |
+
|
61 |
+
You can find full details of installing a plugin on the [plugin installation page](http://goo.gl/nf3WcU).
|
62 |
+
|
63 |
+
|
64 |
+
== Frequently Asked Questions ==
|
65 |
+
|
66 |
+
= Why would I want to use this instead of .htaccess? =
|
67 |
+
|
68 |
+
Redirections are automatically created when a post URL changed. Apache .htaccess is not required
|
69 |
+
|
70 |
+
= Is there a manual or knowledge base for this plugin? =
|
71 |
+
|
72 |
+
Yes, here is the plugin full knowledge base http://www.clogica.com/kb/
|
73 |
+
|
74 |
+
== Upgrade Notice ==
|
75 |
+
= 4.17 =
|
76 |
+
* Bug fixing in http redirects
|
77 |
+
|
78 |
+
= 4.16 =
|
79 |
+
* fixing (is_plugin_active issue)
|
80 |
+
|
81 |
+
= 4.15 =
|
82 |
+
* fixing buddypress issue (redirects was not working for locked pages)
|
83 |
+
* Fixing WPML issues (the plugin was not fully compatible with the last WPML version)
|
84 |
+
* Some other enhancements
|
85 |
+
|
86 |
+
= 4.14 =
|
87 |
+
* Adding option in the general options page for IP address GDPR Compatibility
|
88 |
+
|
89 |
+
= 4.13 =
|
90 |
+
* GDPR Compatibility
|
91 |
+
|
92 |
+
= 4.12 =
|
93 |
+
* fix export redirects issue
|
94 |
+
|
95 |
+
= 4.11 =
|
96 |
+
* fix Undefined index
|
97 |
+
|
98 |
+
= 4.10 =
|
99 |
+
* fix deprecated issue in php 7
|
100 |
+
|
101 |
+
= 4.9 =
|
102 |
+
* WPML support
|
103 |
+
* Import/Export Feature
|
104 |
+
* New interface design
|
105 |
+
* Show last access time & total hits
|
106 |
+
|
107 |
+
|
108 |
+
= 4.8 =
|
109 |
+
* Hot fixes
|
110 |
+
|
111 |
+
= 4.7 =
|
112 |
+
* Absolute URL's fixes
|
113 |
+
|
114 |
+
= 4.5 =
|
115 |
+
* Hot fixes
|
116 |
+
|
117 |
+
|
118 |
+
= 4.4 =
|
119 |
+
* php 7 compatibility
|
120 |
+
|
121 |
+
= 4.3 =
|
122 |
+
* Stored XSS fixes
|
123 |
+
|
124 |
+
= 4.2 =
|
125 |
+
* Hot fixes
|
126 |
+
* php 7 compatibility
|
127 |
+
|
128 |
+
= 4.1 =
|
129 |
+
* Removing "404" tab, We replaced it by a new advanced 404 management plugin. Have a look on this by following this link https://wordpress.org/plugins/404-redirection-manager/
|
130 |
+
|
131 |
+
= 4.0 =
|
132 |
+
* Please backup your data before using this version.
|
133 |
+
|
134 |
+
|
135 |
+
|
136 |
+
== Changelog ==
|
137 |
+
= 4.17 =
|
138 |
+
* Bug fixing in http redirects
|
139 |
+
|
140 |
+
= 4.16 =
|
141 |
+
* fixing (is_plugin_active issue)
|
142 |
+
|
143 |
+
= 4.15 =
|
144 |
+
* fixing buddypress issue (redirects was not working for locked pages)
|
145 |
+
* Fixing WPML issues (the plugin was not fully compatible with the last WPML version)
|
146 |
+
* Some other enhancements
|
147 |
+
|
148 |
+
|
149 |
+
= 4.14 =
|
150 |
+
* Adding option in the general options page for IP address GDPR Compatibility
|
151 |
+
|
152 |
+
= 4.13 =
|
153 |
+
* GDPR Compatibility
|
154 |
+
|
155 |
+
= 4.12 =
|
156 |
+
* fixing export redirects issue
|
157 |
+
|
158 |
+
= 4.11 =
|
159 |
+
* fixing Undefined index error
|
160 |
+
|
161 |
+
= 4.10 =
|
162 |
+
* fix deprecated issue in php 7
|
163 |
+
|
164 |
+
= 4.9 =
|
165 |
+
* WPML support
|
166 |
+
* Import/Export Feature
|
167 |
+
* New interface design
|
168 |
+
* Show last access time & total hits
|
169 |
+
|
170 |
+
= 4.8 =
|
171 |
+
* display total 404 count
|
172 |
+
|
173 |
+
= 4.7 =
|
174 |
+
* php 7 compatibility
|
175 |
+
|
176 |
+
= 4.3 =
|
177 |
+
* Stored XSS fixes
|
178 |
+
|
179 |
+
= 4.2 =
|
180 |
+
* Hot fixes
|
181 |
+
* php 7 compatibility
|
182 |
+
|
183 |
+
= 4.1 =
|
184 |
+
* Removing "404" tab, We replaced it by a new advanced 404 management plugin. Have a look on this by following this link https://wordpress.org/plugins/404-redirection-manager/
|
185 |
+
|
186 |
+
= 4.0 =
|
187 |
+
* Please backup your data before using this version.
|
188 |
+
|
189 |
+
= 3.9 =
|
190 |
+
* Fixing some issues.
|
191 |
+
= 3.8 =
|
192 |
+
* Added feature, the capability to disable plugin for admin users
|
193 |
+
= 3.7 =
|
194 |
+
* Hot fixes
|
195 |
+
= 3.6 =
|
196 |
+
* Fixing some issues.
|
197 |
+
= 3.5 =
|
198 |
+
* Fixing some issues.
|
199 |
+
= 3.4 =
|
200 |
+
* Fixing error appears when deleting the plugin.
|
201 |
+
= 3.3 =
|
202 |
+
* Hot fixes
|
203 |
+
= 3.2 =
|
204 |
+
* Hot fixes
|
205 |
+
= 3.1 =
|
206 |
+
* Redirect loops protection
|
207 |
+
= 3 =
|
208 |
+
* Hot fixes
|
209 |
+
= 2.9 =
|
210 |
+
* Hot fixes for redirecting woo-commerce products.
|
211 |
+
= 2.8 =
|
212 |
+
* Redirect loop prevention.
|
213 |
+
* The Ad for the premium version has become in a separate tab not in all the plugin screens as it may disturb some people.
|
214 |
+
* Some other fixes.
|
215 |
+
= 2.7 =
|
216 |
+
* Some fixes.
|
217 |
+
= 2.6 =
|
218 |
+
* Some hot fixes.
|
219 |
+
= 2.5 =
|
220 |
+
* Using relative URLs instead of absolute URL's, This will useful when changing the domain name.
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
screenshot-4.png
ADDED
Binary file
|
screenshot-5.png
ADDED
Binary file
|
screenshot-6.png
ADDED
Binary file
|
screenshot-7.png
ADDED
Binary file
|
screenshot-8.png
ADDED
Binary file
|
seo-redirection.php
ADDED
@@ -0,0 +1,1178 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: SEO Redirection
|
4 |
+
Plugin URI: http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin
|
5 |
+
Description: By this plugin you can manage all your website redirection types easily.
|
6 |
+
Author: Fakhri Alsadi
|
7 |
+
Version: 4.17
|
8 |
+
Author URI: http://www.clogica.com
|
9 |
+
Text Domain: wsr
|
10 |
+
*/
|
11 |
+
|
12 |
+
require_once('common/controls.php');
|
13 |
+
require_once('custom/controls.php');
|
14 |
+
require_once('custom/controls/cf.SR_redirect_cache.class.php');
|
15 |
+
|
16 |
+
define('PATH', plugin_dir_path(__FILE__));
|
17 |
+
|
18 |
+
if (!defined('URL')) define('URL', plugin_dir_url(__FILE__));
|
19 |
+
|
20 |
+
|
21 |
+
if (!defined('WP_SEO_REDIRECTION_OPTIONS')) {
|
22 |
+
define('WP_SEO_REDIRECTION_OPTIONS', 'wp-seo-redirection-group');
|
23 |
+
}
|
24 |
+
|
25 |
+
if (!defined('WP_SEO_REDIRECTION_VERSION')) {
|
26 |
+
define('WP_SEO_REDIRECTION_VERSION', '4.17');
|
27 |
+
}
|
28 |
+
|
29 |
+
$util = new clogica_util_1();
|
30 |
+
$util->init(WP_SEO_REDIRECTION_OPTIONS, __FILE__);
|
31 |
+
|
32 |
+
add_action('admin_enqueue_scripts', 'WPSR_header_code');
|
33 |
+
add_action('admin_menu', 'WPSR_admin_menu');
|
34 |
+
add_action('wp', 'WPSR_redirect', 1);
|
35 |
+
add_action('save_post', 'WPSR_get_post_redirection');
|
36 |
+
add_action('add_meta_boxes', 'adding_WPSR_custom_meta_boxes', 10, 3);
|
37 |
+
add_action('admin_head', 'WPSR_check_default_permalink');
|
38 |
+
add_action('plugins_loaded', 'WPSR_upgrade');
|
39 |
+
|
40 |
+
register_activation_hook(__FILE__, 'WPSR_upgrade');
|
41 |
+
register_uninstall_hook(__FILE__, 'WPSR_uninstall');
|
42 |
+
|
43 |
+
/////////////////////////////////////////////////////////////////////////
|
44 |
+
|
45 |
+
|
46 |
+
function prism_multiple_plugin_activate_trial()
|
47 |
+
{
|
48 |
+
global $wpdb;
|
49 |
+
if (is_multisite()) {
|
50 |
+
if (is_plugin_active_for_network(__FILE__)) {
|
51 |
+
$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
52 |
+
foreach ($blogids as $blog_id) {
|
53 |
+
switch_to_blog($blog_id);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
register_activation_hook(__FILE__, 'prism_multiple_plugin_activate_trial');
|
60 |
+
|
61 |
+
|
62 |
+
function adding_WPSR_custom_meta_boxes()
|
63 |
+
{
|
64 |
+
global $util;
|
65 |
+
if ($util->get_option_value('show_redirect_box') == '1') {
|
66 |
+
|
67 |
+
$screens = array('post', 'page');
|
68 |
+
|
69 |
+
foreach ($screens as $screen) {
|
70 |
+
|
71 |
+
add_meta_box(
|
72 |
+
'WPSR_meta_box',
|
73 |
+
__('SEO Redirection'),
|
74 |
+
'WPSR_render_meta_box',
|
75 |
+
$screen
|
76 |
+
);
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
function WPSR_render_meta_box($post)
|
84 |
+
{
|
85 |
+
global $wpdb, $table_prefix, $util;
|
86 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
87 |
+
|
88 |
+
if (get_post_status() != 'auto-draft') {
|
89 |
+
$permalink = "";
|
90 |
+
if (in_array($post->post_status, array('draft', 'pending'))) {
|
91 |
+
list($permalink, $postname) = get_sample_permalink($post->ID);
|
92 |
+
$permalink = str_replace('%postname%', $postname, $permalink);
|
93 |
+
|
94 |
+
} else {
|
95 |
+
|
96 |
+
$permalink = get_permalink($post->ID);
|
97 |
+
}
|
98 |
+
|
99 |
+
$permalink = $util->make_relative_url($permalink);
|
100 |
+
|
101 |
+
$postID = $post->ID;
|
102 |
+
|
103 |
+
|
104 |
+
$theurl = $wpdb->get_row($wpdb->prepare(" select redirect_to,redirect_from from $table_name where postID=%d ", $postID));
|
105 |
+
|
106 |
+
$urlredirect_to = '';
|
107 |
+
if ($wpdb->num_rows > 0)
|
108 |
+
$urlredirect_to = $theurl->redirect_to;
|
109 |
+
|
110 |
+
if ($urlredirect_to != '' && $theurl->redirect_from != $permalink) {
|
111 |
+
// the post_name field changed!
|
112 |
+
$wpdb->query($wpdb->prepare(" update $table_name set redirect_from=%s where postID=%d ", $permalink, $postID));
|
113 |
+
if ($util->get_option_value('reflect_modifications') == '1') {
|
114 |
+
$wpdb->query($wpdb->prepare(" update $table_name set redirect_to=%s where redirect_to=%s ", $permalink, $theurl->redirect_from));
|
115 |
+
$util->info_option_msg('<b>' . __("SEO Redirection", 'wsr') . '</b>' . __('has detected a change in Permalink, this will be reflected to the redirection records!', 'wsr'));
|
116 |
+
}
|
117 |
+
//-------------------------------------------
|
118 |
+
}
|
119 |
+
|
120 |
+
echo '
|
121 |
+
<table border="0" width="100%" cellpadding="2">
|
122 |
+
<tr>
|
123 |
+
<td width="99%"><input onchange="redirect_check_click()" type="checkbox" name="redirect_check" id="redirect_check" value="ON">
|
124 |
+
Redirect <font color="#008000">' . $permalink . '</font><input type="hidden" name="wp_seo_redirection_url_from" value="' . $permalink . '"></td>
|
125 |
+
</tr>
|
126 |
+
</table>
|
127 |
+
<div class="wrap pro"><h4>' . __("Upgrade to", 'wsr') . ' <a target="_blank" href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin">' . __("pro version", 'wsr') . '</a>' . __(" to manage 404 errors and empower your site seo", 'wsr') . ' <strong style="color:yellow; background-color:red; padding:3px;">' . __(" NOW 50% OFF ", 'wsr') . '</strong> ,' . __(" The discount won't last long, so don't miss the best deal", 'wsr') . '</h4><br /></div>
|
128 |
+
<div id="redirect_frame">
|
129 |
+
<table border="0" width="100%" cellpadding="2">
|
130 |
+
<tr>
|
131 |
+
<td>
|
132 |
+
|
133 |
+
<b>' . __(" Redirect to", 'wsr') . '</b><input type="text" name="wp_seo_redirection_url" id="wp_seo_redirection_url" value="' . $urlredirect_to . '" size="62"></td>
|
134 |
+
</tr>
|
135 |
+
<tr>
|
136 |
+
<td>
|
137 |
+
<ul>
|
138 |
+
<li>' . __(" To make a redirection, put the full", 'wsr') . ' <b>' . __("URL", 'wsr') . '</b> ' . __("including ", 'wsr') . '<b>\'http://\'</b> ' . __("in the text field above and then click the button ", 'wsr') . '<b>' . __("Update", 'wsr') . '</b>.</li>
|
139 |
+
<li>' . __("If you have a caching plugin installed, clear cache to reflect the
|
140 |
+
changes immediately.", 'wsr') . '</li>
|
141 |
+
|
142 |
+
<li>' . __("To remove the redirection, just uncheck the check box above and then click the button", 'wsr') . ' <b>' . __("Update", 'wsr') . '</b>.</li>
|
143 |
+
</ul>
|
144 |
+
</td>
|
145 |
+
</tr>
|
146 |
+
</table>
|
147 |
+
</div>';
|
148 |
+
|
149 |
+
echo "
|
150 |
+
|
151 |
+
<script type='text/javascript'>
|
152 |
+
function WSR_check_status(x)
|
153 |
+
{
|
154 |
+
if(x==0)
|
155 |
+
{
|
156 |
+
document.getElementById('redirect_check').checked=false;
|
157 |
+
document.getElementById('redirect_frame').style.display = 'none';
|
158 |
+
document.getElementById('wp_seo_redirection_url').value='';
|
159 |
+
}else
|
160 |
+
{
|
161 |
+
document.getElementById('redirect_check').checked=true;
|
162 |
+
document.getElementById('redirect_frame').style.display= 'block';
|
163 |
+
}
|
164 |
+
|
165 |
+
}
|
166 |
+
|
167 |
+
function redirect_check_click()
|
168 |
+
{
|
169 |
+
if(document.getElementById('redirect_check').checked)
|
170 |
+
WSR_check_status(1);
|
171 |
+
else
|
172 |
+
WSR_check_status(0);
|
173 |
+
}
|
174 |
+
</script>
|
175 |
+
";
|
176 |
+
|
177 |
+
if ($urlredirect_to == '')
|
178 |
+
echo "<script type='text/javascript'>WSR_check_status(0);</script>";
|
179 |
+
else
|
180 |
+
echo "<script type='text/javascript'>WSR_check_status(1);</script>";
|
181 |
+
|
182 |
+
|
183 |
+
} else {
|
184 |
+
echo __('You can not make a redirection for the new posts before saving them.', 'wsr');
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
//--------------------------------------------------------------------------------------------
|
190 |
+
|
191 |
+
|
192 |
+
function WPSR_check_default_permalink()
|
193 |
+
{
|
194 |
+
global $util, $wp_rewrite;
|
195 |
+
|
196 |
+
$file = get_home_path() . "/.htaccess";
|
197 |
+
$filestr = "";
|
198 |
+
$begin_marker = "# BEGIN WordPress";
|
199 |
+
$end_marker = "# END WordPress";
|
200 |
+
$content = "ErrorDocument 404 /index.php?error=404";
|
201 |
+
$findword = "ErrorDocument 404";
|
202 |
+
|
203 |
+
if ($wp_rewrite->permalink_structure == '') {
|
204 |
+
|
205 |
+
if (file_exists($file)) {
|
206 |
+
|
207 |
+
$f = @fopen($file, 'r+');
|
208 |
+
$filestr = @fread($f, filesize($file));
|
209 |
+
|
210 |
+
if (strpos($filestr, $findword) === false) {
|
211 |
+
if (strpos($filestr, $begin_marker) === false) {
|
212 |
+
$filestr = $begin_marker . PHP_EOL . $content . PHP_EOL . $end_marker . PHP_EOL . $filestr;
|
213 |
+
fwrite($f, $filestr);
|
214 |
+
fclose($f);
|
215 |
+
} else {
|
216 |
+
fclose($f);
|
217 |
+
$f = fopen($file, "w");
|
218 |
+
$n = strpos($filestr, $begin_marker) + strlen('# BEGIN WordPress');;
|
219 |
+
$div1 = substr($filestr, 0, $n);
|
220 |
+
$div2 = substr($filestr, ($n + 1), strlen($filestr));
|
221 |
+
$filestr = $div1 . PHP_EOL . $content . PHP_EOL . $div2;
|
222 |
+
fwrite($f, $filestr);
|
223 |
+
fclose($f);
|
224 |
+
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
} else {
|
229 |
+
|
230 |
+
$filestr = $begin_marker . PHP_EOL . $content . PHP_EOL . $end_marker;
|
231 |
+
if ($f = @fopen($file, 'w')) {
|
232 |
+
@fwrite($f, $filestr);
|
233 |
+
@fclose($f);
|
234 |
+
$util->warning_option_msg(__('SEO Redirection: The', 'wsr') . ' <b>.htaccess</b> ' . __('has been created!', 'wsr'));
|
235 |
+
} else {
|
236 |
+
$util->warning_option_msg(__('SEO Redirection: Could not create the file ', 'wsr') . ' <b>.htaccess</b>!');
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
}
|
241 |
+
|
242 |
+
}
|
243 |
+
|
244 |
+
//--------------------------------------------------------------------------------------------
|
245 |
+
|
246 |
+
//------------------------------------------------------------------------
|
247 |
+
|
248 |
+
function WPSR_get_post_redirection($post_id)
|
249 |
+
{
|
250 |
+
|
251 |
+
global $wpdb, $util, $table_prefix;
|
252 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
253 |
+
|
254 |
+
// Autosave
|
255 |
+
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
|
256 |
+
return;
|
257 |
+
// AJAX
|
258 |
+
if (defined('DOING_AJAX') && DOING_AJAX)
|
259 |
+
return;
|
260 |
+
// Post revision
|
261 |
+
if (false !== wp_is_post_revision($post_id))
|
262 |
+
return;
|
263 |
+
|
264 |
+
$redirect_from = isset($_POST['wp_seo_redirection_url_from']) ? $_POST['wp_seo_redirection_url_from'] : '';
|
265 |
+
$redirect_to = isset($_POST['wp_seo_redirection_url']) ? $_POST['wp_seo_redirection_url'] : '';
|
266 |
+
|
267 |
+
if ($redirect_to != '') {
|
268 |
+
|
269 |
+
|
270 |
+
$wpdb->get_results($wpdb->prepare("select ID from $table_name where postID=%d ", $post_id));
|
271 |
+
|
272 |
+
if ($wpdb->num_rows > 0) {
|
273 |
+
|
274 |
+
$sql = $wpdb->prepare("update $table_name set redirect_to=%s,redirect_from=%s,redirect_type='301',url_type=2 where postID=%d", $redirect_to, $redirect_from, $post_id);
|
275 |
+
$wpdb->query($sql);
|
276 |
+
|
277 |
+
} else {
|
278 |
+
$wpdb->query($wpdb->prepare("delete from $table_name where redirect_from=%s", $redirect_from));
|
279 |
+
$sql = $wpdb->prepare("insert into $table_name(redirect_from,redirect_to,redirect_type,url_type,postID) values (%s,%s,'301',2,%d) ", $redirect_from, $redirect_to, $post_id);
|
280 |
+
$wpdb->query($sql);
|
281 |
+
}
|
282 |
+
|
283 |
+
|
284 |
+
} else {
|
285 |
+
$wpdb->query($wpdb->prepare("delete from $table_name where postID=%d", $post_id));
|
286 |
+
}
|
287 |
+
|
288 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
289 |
+
$SR_redirect_cache->free_cache();
|
290 |
+
}
|
291 |
+
|
292 |
+
|
293 |
+
//-------------------------------------------------------------
|
294 |
+
|
295 |
+
function WPSR_log_404_redirection($link)
|
296 |
+
{
|
297 |
+
global $wpdb, $table_prefix, $util;
|
298 |
+
$table_name = $table_prefix . 'WP_SEO_404_links';
|
299 |
+
|
300 |
+
$referrer = $util->get_ref();
|
301 |
+
$ip = $util->get_visitor_IP();
|
302 |
+
$country = $util->get_visitor_country();
|
303 |
+
$os = $util->get_visitor_OS();
|
304 |
+
$browser = $util->get_visitor_Browser();
|
305 |
+
|
306 |
+
if ($os != 'Unknown' || $browser != 'Unknown') {
|
307 |
+
$wpdb->query($wpdb->prepare(" insert IGNORE into $table_name(ctime,link,referrer,ip,country,os,browser) values(NOW(),%s,%s,%s,%s,%s,%s) ", $link, $referrer, $ip, $country, $os, $browser));
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
|
312 |
+
//-------------------------------------------------------------
|
313 |
+
|
314 |
+
function WPSR_log_redirection_history($rID, $postID, $rfrom, $rto, $rtype, $rsrc)
|
315 |
+
{
|
316 |
+
global $wpdb, $table_prefix, $util;
|
317 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
318 |
+
$SR_redirect_cache->free_cache();
|
319 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection_LOG';
|
320 |
+
$rfrom = esc_url($rfrom);
|
321 |
+
$referrer = $util->get_ref();
|
322 |
+
$ip = $util->get_visitor_IP();
|
323 |
+
$country = $util->get_visitor_country();
|
324 |
+
$os = $util->get_visitor_OS();
|
325 |
+
$browser = $util->get_visitor_Browser();
|
326 |
+
|
327 |
+
$wpdb->query($wpdb->prepare(" insert into $table_name(rID,postID,rfrom,rto,rtype,rsrc,ctime,referrer,ip,country,os,browser) values(%d ,%d,%s,%s,%s,%s,NOW(),%s,%s,%s,%s,%s) ", $rID, $postID, $rfrom, $rto, $rtype, $rsrc, $referrer, $ip, $country, $os, $browser));
|
328 |
+
|
329 |
+
$limit = $util->get_option_value('history_limit');
|
330 |
+
|
331 |
+
$expdate = date('Y-n-j', time() - (intval($limit) * 24 * 60 * 60));
|
332 |
+
$wpdb->query("delete FROM $table_name WHERE date_format(date(ctime),'%Y-%m-%d') < date_format(date('$expdate'),'%Y-%m-%d')");
|
333 |
+
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
+
//-------------------------------------------------------------
|
338 |
+
|
339 |
+
function WPSR_make_redirect($redirect_to, $redirect_type, $redirect_from, $obj = '')
|
340 |
+
{
|
341 |
+
global $util, $post;
|
342 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
343 |
+
if ($redirect_to == $redirect_from || !$util->is_valid_url($redirect_to))
|
344 |
+
return 0;
|
345 |
+
|
346 |
+
if (is_object($obj) && $obj->redirect_to_type == 'Folder' && $obj->redirect_to_folder_settings == '2') {
|
347 |
+
|
348 |
+
if ($obj->redirect_from_type == 'Folder') {
|
349 |
+
|
350 |
+
if ($obj->redirect_from_folder_settings == '2' || $obj->redirect_from_folder_settings == '3') {
|
351 |
+
if (strlen($redirect_from) > strlen($obj->redirect_from)) {
|
352 |
+
$difference = substr($redirect_from, intval(strlen($obj->redirect_from) - strlen($redirect_from)));
|
353 |
+
$redirect_to = $redirect_to . $difference;
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
+
} else if ($obj->redirect_from_type == 'Regex') {
|
358 |
+
$page = substr(strrchr($redirect_from, "/"), 1);
|
359 |
+
$redirect_to = $redirect_to . '/' . $page;
|
360 |
+
}
|
361 |
+
|
362 |
+
}
|
363 |
+
|
364 |
+
$rID = 0;
|
365 |
+
$rsrc = '404';
|
366 |
+
$postID = 0;
|
367 |
+
|
368 |
+
if (is_object($obj)) {
|
369 |
+
$rID = $obj->ID;
|
370 |
+
$postID = $obj->postID;
|
371 |
+
if ($obj->url_type == 1)
|
372 |
+
$rsrc = 'Custom';
|
373 |
+
else if ($obj->url_type == 2)
|
374 |
+
$rsrc = 'Post';
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
if ($util->get_option_value('history_status') == '1') {
|
379 |
+
|
380 |
+
WPSR_log_redirection_history($rID, $postID, $redirect_from, $redirect_to, $redirect_type, $rsrc);
|
381 |
+
}
|
382 |
+
|
383 |
+
$redirect_to = $util->make_absolute_url($redirect_to);
|
384 |
+
|
385 |
+
|
386 |
+
if (is_singular()) {
|
387 |
+
//$SR_redirect_cache = new free_SR_redirect_cache();
|
388 |
+
|
389 |
+
$SR_redirect_cache->add_redirect($post->ID, 1, $redirect_from, $redirect_to, $redirect_type);
|
390 |
+
$SR_redirect_cache->free_cache();
|
391 |
+
}
|
392 |
+
|
393 |
+
if ($redirect_type == '301') {
|
394 |
+
header('HTTP/1.1 301 Moved Permanently');
|
395 |
+
header("Location: " . $redirect_to);
|
396 |
+
exit();
|
397 |
+
} else if ($redirect_type == '307') {
|
398 |
+
header('HTTP/1.0 307 Temporary Redirect');
|
399 |
+
header("Location: " . $redirect_to);
|
400 |
+
exit();
|
401 |
+
} else if ($redirect_type == '302') {
|
402 |
+
header("Location: " . $redirect_to);
|
403 |
+
exit();
|
404 |
+
}
|
405 |
+
|
406 |
+
}
|
407 |
+
|
408 |
+
|
409 |
+
//-------------------------------------------------------------
|
410 |
+
|
411 |
+
function WPSR_redirect()
|
412 |
+
{
|
413 |
+
global $wpdb, $post, $table_prefix, $util;
|
414 |
+
|
415 |
+
|
416 |
+
if ($util->get_option_value('plugin_status') != '0') { // if not disabled
|
417 |
+
|
418 |
+
// if disable for admin and the user is admin
|
419 |
+
if (current_user_can('manage_options') == 1 && $util->get_option_value('plugin_status') == 2) {
|
420 |
+
// nothing
|
421 |
+
|
422 |
+
} else {
|
423 |
+
|
424 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
425 |
+
$permalink = urldecode($util->get_current_relative_url());
|
426 |
+
if (substr($permalink, 0, 1) == ":") {
|
427 |
+
$first_slash = stripos($permalink, "/");
|
428 |
+
$permalink = substr($permalink, $first_slash, strlen($permalink) - $first_slash);
|
429 |
+
}
|
430 |
+
$post_cache_result = "";
|
431 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
432 |
+
|
433 |
+
if (is_singular()) {
|
434 |
+
if (!empty($SR_redirect_cache) && !empty($post->ID)) {
|
435 |
+
$post_cache_result = $SR_redirect_cache->redirect_cached($post->ID);
|
436 |
+
}
|
437 |
+
}
|
438 |
+
if ($post_cache_result == 'not_redirected') {
|
439 |
+
return 0;
|
440 |
+
}
|
441 |
+
$new_site_url = get_option("siteurl");
|
442 |
+
$current_url = home_url();
|
443 |
+
$permalink = $new_site_url . $permalink;
|
444 |
+
$permalink_alternative = substr($permalink, 0, strlen($permalink) - 1);
|
445 |
+
|
446 |
+
/* date 3-jan-18
|
447 |
+
* Add variable
|
448 |
+
* permalink_alternative2
|
449 |
+
* permalink_alternative2_2
|
450 |
+
**/
|
451 |
+
$permalink_alternative2 = $permalink;
|
452 |
+
$permalink_alternative2_2 = $permalink;
|
453 |
+
$default_language = '';
|
454 |
+
$wpml_options = get_option('icl_sitepress_settings');
|
455 |
+
$url_enable_lan = 0;
|
456 |
+
if ($wpml_options) {
|
457 |
+
$default_language = '/' . $wpml_options['default_language'] . '/';
|
458 |
+
$url_enable_lan = $wpml_options['urls']['directory_for_default_language'];
|
459 |
+
}
|
460 |
+
|
461 |
+
$permalink_default = str_replace($new_site_url, "", $permalink);
|
462 |
+
$permalink_default_2 = str_replace($new_site_url, "", $permalink_alternative);
|
463 |
+
$permalink_default_3 = str_replace($new_site_url, "", $permalink_alternative);
|
464 |
+
$permalink_default_3_1 = $permalink_default_3;
|
465 |
+
if ($permalink_default_3 && $permalink_default_3[0] == '/') {
|
466 |
+
$permalink_default_3 = str_replace($new_site_url . '/', "", $permalink_alternative);
|
467 |
+
$permalink_default_3_1 = str_replace($new_site_url . '/', "", $permalink_alternative) . '/';
|
468 |
+
}
|
469 |
+
$permalink_12 = $permalink;
|
470 |
+
$permalink_13 = $permalink_alternative;
|
471 |
+
|
472 |
+
if ($url_enable_lan == 1) {
|
473 |
+
$permalink_12 = $default_language . $permalink_default_3;
|
474 |
+
$permalink_13 = $default_language . $permalink_default_3_1;
|
475 |
+
|
476 |
+
}
|
477 |
+
|
478 |
+
$language_keyword = str_ireplace($new_site_url, '', $current_url);
|
479 |
+
if (!empty($language_keyword)) {
|
480 |
+
$permalink_default_4 = $new_site_url . $language_keyword . $permalink_default_3;
|
481 |
+
$permalink_default_5 = $new_site_url . $language_keyword . $permalink_default_3_1;
|
482 |
+
$permalink_default_6 = str_replace($current_url, '', $permalink);
|
483 |
+
$permalink_default_7 = str_replace($current_url, '', $permalink_alternative);
|
484 |
+
$permalink_default_8 = '/' . str_replace($current_url, '', $permalink_alternative);
|
485 |
+
$permalink_default_9 = '/' . str_replace($current_url, '', $permalink_alternative) . '/';
|
486 |
+
|
487 |
+
if ($language_keyword != $default_language) {
|
488 |
+
$permalink_default_6 = $permalink_default_7 = $permalink_default_8 = $permalink_default_9 = $permalink;
|
489 |
+
}
|
490 |
+
|
491 |
+
$permalink1 = $language_keyword . $permalink;
|
492 |
+
$permalink_alternative1 = $language_keyword . $permalink_alternative;
|
493 |
+
} else {
|
494 |
+
$permalink_default_4 = $new_site_url . $default_language . substr($permalink_default, 1);
|
495 |
+
$permalink_default_5 = $new_site_url . $default_language . substr($permalink_default_3_1, 1);
|
496 |
+
$permalink_default_6 = $default_language . substr(str_replace($new_site_url . "/", '', $permalink), 1);
|
497 |
+
$permalink_default_7 = $default_language . substr(str_replace($new_site_url, '', $permalink_alternative), 1);
|
498 |
+
$permalink_default_8 = substr($default_language . substr(str_replace($new_site_url, '', $permalink_alternative), 1), 1);
|
499 |
+
$permalink_default_9 = $default_language . substr(str_replace($new_site_url, '', $permalink_alternative), 1) . '/';
|
500 |
+
}
|
501 |
+
|
502 |
+
|
503 |
+
$permalinkNew = isset($permalink1) ? $permalink1 : $permalink;
|
504 |
+
$permalink_alternativeNew = isset($permalink_alternative1) ? $permalink_alternative1 : $permalink_alternative;
|
505 |
+
/*
|
506 |
+
echo "1 ".$permalink;
|
507 |
+
echo "<br>";
|
508 |
+
echo "2 ".$permalink_alternative;
|
509 |
+
echo "<br>";
|
510 |
+
echo "3 ".$permalink_default;
|
511 |
+
echo "<br>";
|
512 |
+
echo "4 ".$permalink_default_2;
|
513 |
+
echo "<br>";
|
514 |
+
echo "5 ".$permalink_default_3;
|
515 |
+
echo "<br>";
|
516 |
+
echo "6 ".$permalink_default_3_1;
|
517 |
+
echo "<br>";
|
518 |
+
echo "7 ".$permalink_default_4;
|
519 |
+
echo "<br>";
|
520 |
+
echo "8 ".$permalink_default_5;
|
521 |
+
echo "<br>";
|
522 |
+
echo "9 ".$permalink_default_6;
|
523 |
+
echo "<br>";
|
524 |
+
echo "10 ".$permalink_default_7;
|
525 |
+
echo "<br>";
|
526 |
+
echo "11 ".$permalink_default_8;
|
527 |
+
echo "<br>";
|
528 |
+
echo "12 ".$permalink_default_9;
|
529 |
+
echo "<br>";
|
530 |
+
echo "12 ".$permalink_12;
|
531 |
+
echo "<br>";
|
532 |
+
echo "12 ".$permalink_13;
|
533 |
+
echo "<br>";
|
534 |
+
die;*/
|
535 |
+
|
536 |
+
|
537 |
+
//$permalink_options = "(redirect_from='$permalink' or redirect_from='$permalink_alternative' )";
|
538 |
+
//$permalink_regex_options = "('$permalink' regexp regex or '$permalink_alternative' regexp regex )";
|
539 |
+
/* date 3-jan-18
|
540 |
+
* Add variable in query
|
541 |
+
* permalink_alternative2
|
542 |
+
* permalink_alternative2_2
|
543 |
+
**/
|
544 |
+
$permalink_options = $wpdb->prepare("( redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s OR redirect_from = %s )", $permalink, $permalink_alternative, $permalink_default_2, $permalink_default, $permalink_default_3, $permalink_default_3_1, $permalink_default_4, $permalink_default_5, $permalink_default_6, $permalink_default_7, $permalink_default_8, $permalink_default_9, $permalink_12, $permalink_13);
|
545 |
+
|
546 |
+
/* $permalink_options = $wpdb->prepare("(redirect_from=%s or redirect_from=%s or redirect_from=%s or redirect_from=%s )", $permalink, $permalink_alternative, $permalink_alternative2_2, $permalink_alternative2_2);*/
|
547 |
+
$permalink_regex_options = $wpdb->prepare("(%s regexp regex or %s regexp regex )", $permalink, $permalink_alternative);
|
548 |
+
|
549 |
+
if (($util->get_option_value('redirect_control_panel') != '1') || ($util->get_option_value('redirect_control_panel') == '1' && !preg_match('/^' . str_replace('/', '\/', get_admin_url()) . '/i', $permalink) && !preg_match('/^' . str_replace('/', '\/', site_url()) . '\/wp-login.php/i', $permalink))) {
|
550 |
+
|
551 |
+
|
552 |
+
$theurl = $wpdb->get_row(" select * from $table_name where enabled=1 and regex='' and $permalink_options ");
|
553 |
+
if ($wpdb->num_rows > 0 && $theurl->redirect_to != '') {
|
554 |
+
WPSR_make_redirect($theurl->redirect_to, $theurl->redirect_type, $permalink, $theurl);
|
555 |
+
}
|
556 |
+
|
557 |
+
$theurl = $wpdb->get_row(" select * from $table_name where enabled=1 and regex<>'' and $permalink_regex_options order by LENGTH(regex) desc ");
|
558 |
+
if ($wpdb->num_rows > 0 && $theurl->redirect_to != '') {
|
559 |
+
WPSR_make_redirect($theurl->redirect_to, $theurl->redirect_type, $permalink, $theurl);
|
560 |
+
}
|
561 |
+
|
562 |
+
|
563 |
+
if (is_404()) {
|
564 |
+
|
565 |
+
if ($util->get_option_value('p404_discovery_status') == '1') {
|
566 |
+
WPSR_log_404_redirection($permalink);
|
567 |
+
}
|
568 |
+
|
569 |
+
$options = $util->get_my_options();
|
570 |
+
if ($options['p404_status'] == '1') {
|
571 |
+
|
572 |
+
WPSR_make_redirect($options['p404_redirect_to'], '301', $permalink);
|
573 |
+
|
574 |
+
}
|
575 |
+
}
|
576 |
+
}
|
577 |
+
|
578 |
+
|
579 |
+
if (is_singular() && $post_cache_result == 'not_found') {
|
580 |
+
if (!empty($SR_redirect_cache) && !empty($post->ID)) {
|
581 |
+
$SR_redirect_cache->add_redirect($post->ID, 0, '', '', 0);
|
582 |
+
}
|
583 |
+
}
|
584 |
+
|
585 |
+
}
|
586 |
+
}
|
587 |
+
}
|
588 |
+
|
589 |
+
//---------------------------------------------------------------
|
590 |
+
|
591 |
+
function WPSR_header_code()
|
592 |
+
{
|
593 |
+
//wp_enqueue_script('ajaxcustomvar');
|
594 |
+
|
595 |
+
if (is_admin() && array_key_exists('page', $_GET) && $_GET['page'] == 'seo-redirection.php') {
|
596 |
+
|
597 |
+
wp_register_style('c_admin_css_common', plugins_url() . '/' . basename(dirname(__FILE__)) . '/common/' . "style.css");
|
598 |
+
wp_enqueue_style('sweetalert', plugins_url() . '/' . basename(dirname(__FILE__)) . '/common/' . "sweetalert.css");
|
599 |
+
wp_register_style('c_admin_css_custom', plugins_url() . '/' . basename(dirname(__FILE__)) . '/custom/' . "style.css");
|
600 |
+
wp_enqueue_script('jquery');
|
601 |
+
wp_localize_script('jquery', 'seoredirection', array('ajax_url' => admin_url('admin-ajax.php'), 'msg' => ""));
|
602 |
+
wp_enqueue_style('c_admin_css_common');
|
603 |
+
wp_enqueue_style('c_admin_css_custom');
|
604 |
+
|
605 |
+
wp_enqueue_script('custom', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js', array('jquery'), false, true);
|
606 |
+
wp_enqueue_script('customJS', plugins_url() . '/' . basename(dirname(__FILE__)) . '/common/' . "customJs.js", array('jquery'), false, true);
|
607 |
+
wp_enqueue_script('sweetalert', plugins_url() . '/' . basename(dirname(__FILE__)) . '/common/js/' . "sweetalert.min.js", array('jquery'), false, true);
|
608 |
+
|
609 |
+
wp_enqueue_style('bootstrap', plugins_url() . '/' . basename(dirname(__FILE__)) . '/common/' . "bootstrap.css");
|
610 |
+
|
611 |
+
|
612 |
+
}
|
613 |
+
}
|
614 |
+
|
615 |
+
//---------------------------------------------------------------
|
616 |
+
|
617 |
+
add_action("wp_ajax_customAddUpdate", "customAddUpdate_callback");
|
618 |
+
|
619 |
+
function customAddUpdate_callback()
|
620 |
+
{
|
621 |
+
global $wpdb, $table_prefix, $util;
|
622 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
623 |
+
$table_name_404 = $table_prefix . 'WP_SEO_404_links';
|
624 |
+
parse_str($_POST['formData'], $_POST);
|
625 |
+
$nonce = "";
|
626 |
+
if (isset($_POST['_wpnonce']))
|
627 |
+
$nonce = $_POST['_wpnonce'];
|
628 |
+
$data = array();
|
629 |
+
$data['error_string'] = array();
|
630 |
+
$data['inputerror'] = array();
|
631 |
+
$data['bool'] = TRUE;
|
632 |
+
if (trim($_POST['redirect_from']) == '') {
|
633 |
+
$data['inputerror'][] = 'redirect_from';
|
634 |
+
$data['error_string'][] = __("You must input the 'Redirect From' URL", "wsr");
|
635 |
+
$data['bool'] = FALSE;
|
636 |
+
}
|
637 |
+
// elseif (!preg_match( '/((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/', $_POST['redirect_from'])) {
|
638 |
+
// $data['inputerror'][] = 'redirect_from';
|
639 |
+
// $data['error_string'][] = __("Invalid redirect from target URL!",'wsr');
|
640 |
+
// $data['bool'] = FALSE;
|
641 |
+
// }
|
642 |
+
if (trim($_POST['redirect_to']) == '') {
|
643 |
+
$data['inputerror'][] = 'redirect_to';
|
644 |
+
$data['error_string'][] = __("You must input the 'Redirect To' URL", "wsr");
|
645 |
+
$data['bool'] = FALSE;
|
646 |
+
} elseif ($_POST['edit_exist'] == '' && !preg_match('/^(http|https):\\/\\/[a-z0-9_]+([\\-\\.]{1}[a-z_0-9]+)*\\.[_a-z]{2,5}' . '((:[0-9]{1,5})?\\/.*)?$/i', $_POST['redirect_to'])) {
|
647 |
+
$data['inputerror'][] = 'redirect_to';
|
648 |
+
$data['error_string'][] = __("Invalid redirect target URL!", 'wsr');
|
649 |
+
$data['bool'] = FALSE;
|
650 |
+
}
|
651 |
+
if ($data['bool'] === FALSE) {
|
652 |
+
echo json_encode($data);
|
653 |
+
exit();
|
654 |
+
} else {
|
655 |
+
if ($_POST['redirect_from'] != '' && wp_verify_nonce($nonce, 'seoredirection')) {
|
656 |
+
|
657 |
+
$redirect_from = urldecode($util->make_relative_url($_POST['redirect_from']));
|
658 |
+
|
659 |
+
$redirect_to = $util->make_relative_url($_POST['redirect_to']);
|
660 |
+
$redirect_type = $_POST['redirect_type'];
|
661 |
+
|
662 |
+
$redirect_from_type = $_POST['redirect_from_type'];
|
663 |
+
$redirect_from_folder_settings = $_POST['redirect_from_folder_settings'];
|
664 |
+
$redirect_from_subfolders = $_POST['redirect_from_subfolders'];
|
665 |
+
|
666 |
+
$redirect_to_type = $_POST['redirect_to_type'];
|
667 |
+
$redirect_to_folder_settings = $_POST['redirect_to_folder_settings'];
|
668 |
+
|
669 |
+
$enabled = $_POST['enabled'];
|
670 |
+
|
671 |
+
$regex = "";
|
672 |
+
|
673 |
+
if ($redirect_from_type == 'Folder') {
|
674 |
+
|
675 |
+
if (substr($redirect_from, -1) != '/')
|
676 |
+
$redirect_from = $redirect_from . '/';
|
677 |
+
|
678 |
+
if ($redirect_from_folder_settings == 2) {
|
679 |
+
if ($redirect_from_subfolders == 0) {
|
680 |
+
$regex = '^' . $util->regex_prepare($redirect_from) . '.*';;
|
681 |
+
} else {
|
682 |
+
$regex = '^' . $util->regex_prepare($redirect_from) . '[^/]*$';
|
683 |
+
}
|
684 |
+
} else if ($redirect_from_folder_settings == 3) {
|
685 |
+
if ($redirect_from_subfolders == 0) {
|
686 |
+
$regex = '^' . $util->regex_prepare($redirect_from) . '.+';
|
687 |
+
} else {
|
688 |
+
$regex = '^' . $util->regex_prepare($redirect_from) . '[^/]+$';
|
689 |
+
}
|
690 |
+
}
|
691 |
+
|
692 |
+
} else if ($redirect_from_type == 'Regex') {
|
693 |
+
$regex = $redirect_from;
|
694 |
+
}
|
695 |
+
|
696 |
+
if ($redirect_from_type == 'Page' || $redirect_from_type == 'Regex') {
|
697 |
+
$redirect_from_folder_settings = "";
|
698 |
+
$redirect_from_subfolders = "";
|
699 |
+
}
|
700 |
+
|
701 |
+
if ($redirect_to_type == 'Page') {
|
702 |
+
$redirect_to_folder_settings = "";
|
703 |
+
}
|
704 |
+
|
705 |
+
if ($redirect_to_type == 'Folder') {
|
706 |
+
if (substr($redirect_to, -1) != '/')
|
707 |
+
$redirect_to = $redirect_to . '/';
|
708 |
+
}
|
709 |
+
|
710 |
+
|
711 |
+
if ($_POST['add_new'] != '') {
|
712 |
+
|
713 |
+
$theurl = $wpdb->get_row($wpdb->prepare(" select count(ID) as cnt from $table_name where redirect_from=%s ", $redirect_from));
|
714 |
+
|
715 |
+
if ($theurl->cnt > 0) {
|
716 |
+
$msg = __("This URL", 'wsr') . " <b>'$redirect_from'</b>" . __("is added previously!", 'wsr');
|
717 |
+
echo json_encode(array('status' => 'error', 'msg' => $msg));
|
718 |
+
// $util->failure_option_msg(__("This URL",'wsr')." <b>'$redirect_from'</b>". __("is added previously!",'wsr'));
|
719 |
+
} else {
|
720 |
+
|
721 |
+
|
722 |
+
if ($redirect_from == '' || $redirect_to == '' || $redirect_type == '') {
|
723 |
+
$util->failure_option_msg(__('Please input all required fields!', 'wsr'));
|
724 |
+
} else {
|
725 |
+
|
726 |
+
$wpdb->insert($table_name, array(
|
727 |
+
'redirect_from' => $redirect_from,
|
728 |
+
'redirect_to' => $redirect_to,
|
729 |
+
'redirect_type' => $redirect_type,
|
730 |
+
'url_type' => 1,
|
731 |
+
'redirect_from_type' => $redirect_from_type,
|
732 |
+
'redirect_from_folder_settings' => $redirect_from_folder_settings,
|
733 |
+
'redirect_from_subfolders' => $redirect_from_subfolders,
|
734 |
+
'redirect_to_type' => $redirect_to_type,
|
735 |
+
'redirect_to_folder_settings' => $redirect_to_folder_settings,
|
736 |
+
'regex' => $regex,
|
737 |
+
'enabled' => $enabled
|
738 |
+
|
739 |
+
));
|
740 |
+
|
741 |
+
$wpdb->query($wpdb->prepare(" delete from $table_name_404 where link=%s ", $redirect_from));
|
742 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
743 |
+
$SR_redirect_cache->free_cache();
|
744 |
+
$msg = "Redirection Added Successfully";
|
745 |
+
echo json_encode(array('status' => 'success', 'msg' => $msg, 'url' => admin_url('options-general.php?page=seo-redirection.php')));
|
746 |
+
die;
|
747 |
+
}
|
748 |
+
|
749 |
+
}
|
750 |
+
} else if ($_POST['edit_exist'] != '') {
|
751 |
+
|
752 |
+
$edit = $_POST['edit'];
|
753 |
+
|
754 |
+
if ($redirect_from == '' || $redirect_to == '' || $redirect_type == '') {
|
755 |
+
$util->failure_option_msg('Please input all required fields!');
|
756 |
+
} else {
|
757 |
+
|
758 |
+
$wpdb->query($wpdb->prepare("update $table_name set redirect_from=%s,redirect_to=%s,redirect_type=%s,redirect_from_type=%s ,redirect_from_folder_settings=%d,redirect_from_subfolders=%d ,redirect_to_type=%s ,redirect_to_folder_settings=%d ,regex=%s,enabled=%s where ID=%d ", $redirect_from, $redirect_to, $redirect_type, $redirect_from_type, $redirect_from_folder_settings, $redirect_from_subfolders, $redirect_to_type, $redirect_to_folder_settings, $regex, $enabled, $edit));
|
759 |
+
|
760 |
+
$SR_redirect_cache = new free_SR_redirect_cache();
|
761 |
+
$SR_redirect_cache->free_cache();
|
762 |
+
}
|
763 |
+
$msg = "Redirection Update Successfully";
|
764 |
+
echo json_encode(array('status' => 'success', 'msg' => $msg, 'url' => admin_url('options-general.php?page=seo-redirection.php')));
|
765 |
+
die;
|
766 |
+
|
767 |
+
}
|
768 |
+
|
769 |
+
if ($util->there_is_cache() != '')
|
770 |
+
$util->info_option_msg(__("You have a cache plugin installed", 'wsr') . " <b>'" . $util->there_is_cache() . "'</b>, " . __("you have to clear cache after any changes to get the changes reflected immediately! ", 'wsr'));
|
771 |
+
|
772 |
+
}
|
773 |
+
|
774 |
+
}
|
775 |
+
|
776 |
+
|
777 |
+
die;
|
778 |
+
}
|
779 |
+
|
780 |
+
add_action("wp_ajax_customUpdateRec", "customUpdateRec_callback");
|
781 |
+
function customUpdateRec_callback()
|
782 |
+
{
|
783 |
+
|
784 |
+
|
785 |
+
global $wpdb, $table_prefix, $util;
|
786 |
+
|
787 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
788 |
+
$table_name_404 = $table_prefix . 'WP_SEO_404_links';
|
789 |
+
|
790 |
+
|
791 |
+
$item = $wpdb->get_row($wpdb->prepare(" select * from $table_name where ID=%d ", $_POST['ID']));
|
792 |
+
|
793 |
+
if ($wpdb->num_rows == 0) {
|
794 |
+
echo json_encode(array('status' => 'error', 'msg' => __("Sorry, this redirect rule is not found, it may deleted by the user!", 'wsr')));
|
795 |
+
die;
|
796 |
+
}
|
797 |
+
|
798 |
+
|
799 |
+
$data = array(
|
800 |
+
"redirect_from" => $item->redirect_from,
|
801 |
+
"redirect_to" => $item->redirect_to,
|
802 |
+
"redirect_type" => $item->redirect_type,
|
803 |
+
|
804 |
+
"redirect_from_type" => $item->redirect_from_type,
|
805 |
+
"redirect_from_folder_settings" => $item->redirect_from_folder_settings,
|
806 |
+
"redirect_from_subfolders" => $item->redirect_from_subfolders,
|
807 |
+
|
808 |
+
"redirect_to_type" => $item->redirect_to_type,
|
809 |
+
"redirect_to_folder_settings" => $item->redirect_to_folder_settings,
|
810 |
+
|
811 |
+
"enabled" => $item->enabled
|
812 |
+
);
|
813 |
+
echo json_encode(array('status' => 'suucess', 'rec' => $data));
|
814 |
+
die;
|
815 |
+
}
|
816 |
+
|
817 |
+
|
818 |
+
function WPSR_admin_menu()
|
819 |
+
{
|
820 |
+
add_options_page('SEO Redirection', 'SEO Redirection', 'manage_options', basename(__FILE__), 'WPSR_options_menu');
|
821 |
+
}
|
822 |
+
|
823 |
+
//---------------------------------------------------------------
|
824 |
+
function WPSR_options_menu()
|
825 |
+
{
|
826 |
+
global $util;
|
827 |
+
|
828 |
+
if (!current_user_can('manage_options')) {
|
829 |
+
wp_die(__('You do not have sufficient permissions to access this page.', 'wsr'));
|
830 |
+
}
|
831 |
+
|
832 |
+
|
833 |
+
if ($util->get_option_value('plugin_status') == '0') {
|
834 |
+
$util->info_option_msg(__('SEO Redirection is disabled now, you can go to option tab and enable it!', 'wsr'));
|
835 |
+
} else if ($util->get_option_value('plugin_status') == '2') {
|
836 |
+
$util->info_option_msg(__('SEO Redirection is', 'wsr') . ' <b>' . __('disabled for admin', 'wsr') . '</b>' . __(' only, you can go to option tab and enable it!', 'wsr'));
|
837 |
+
}
|
838 |
+
$total_404_errors = (SR_Get_total_404() > 0) ? __('You have', 'wsr') . ' <b style="color:red; background-color:yellow; padding:3px;">' . SR_Get_total_404() . '</b>' . __(' broken link (404 page)', 'wsr') . ', <br>' : '';
|
839 |
+
|
840 |
+
|
841 |
+
echo '<div class="wrap"><h2>' . __("SEO Redirection Free", 'wsr') . '</h2><h4>' . __('Upgrade to', 'wsr') . ' <a target="_blank" onclick="swal.clickConfirm();" href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin">' . __("pro version", "wsr") . '</a>' . __(" to manage 404 errors and empower your site SEO", "wsr") . ' <strong style="color:yellow; background-color:red; padding:3px;"> ' . __("NOW 50% OFF ", 'wsr') . '</strong></h4>';
|
842 |
+
|
843 |
+
if ($total_404_errors != '') {
|
844 |
+
?>
|
845 |
+
<script type="text/javascript">
|
846 |
+
|
847 |
+
seoredirection.msg = '<?php echo $total_404_errors . '<div class="wrap" style="font-weight:normal; line-height:30px">' . __('Upgrade to', 'wsr') . ' <a target="_blank" href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin">' . __("pro version", "wsr") . '</a>' . __(" to manage 404 errors and empower your site SEO", "wsr") ?></div>';
|
848 |
+
|
849 |
+
</script>
|
850 |
+
|
851 |
+
<?php
|
852 |
+
}
|
853 |
+
|
854 |
+
if (is_multisite()) {
|
855 |
+
|
856 |
+
echo '<div class="error" id="message"><p></p><div class="warning_icon"></div>' . __('This version does not support Multisite WordPress installation, you may face troubles like losing redirects when adding new sites to your network, the premium version supports multisite well', 'wsr') . '(<a target="_blank" href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin">
|
857 |
+
http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin</a>) <p></p></div>';
|
858 |
+
|
859 |
+
}
|
860 |
+
|
861 |
+
$mytabs = new phptab();
|
862 |
+
|
863 |
+
$mytabs->set_ignore_parameter(array('del', 'search', 'page_num', 'add', 'edit', 'page404'));
|
864 |
+
$mytabs->add_file_tab('cutom', __('Custom Redirects', 'wsr'), 'option_page_custome_redirection.php', 'file');
|
865 |
+
$mytabs->add_file_tab('posts', __('Post Redirects', 'wsr'), 'option_page_post_redirection_list.php', 'file');
|
866 |
+
$mytabs->add_file_tab('history', __('History', 'wsr'), 'option_page_history.php', 'file');
|
867 |
+
$mytabs->add_file_tab('export_import', __('Export/Import', 'wsr'), 'option_export_import.php', 'file');
|
868 |
+
|
869 |
+
$mytabs->add_file_tab('goptions', __('Options', 'wsr'), 'option_page_goptions.php', 'file');
|
870 |
+
$mytabs->add_file_tab('help', '<span style="color:green;"><b>' . __('Help', 'wsr') . '</b></span>', 'help.php', 'file');
|
871 |
+
$mytabs->add_file_tab('premium', '<span style="color:brown;"><b>► ' . __('Premium Features', 'wsr') . '</b></span>', 'premium.php', 'file');
|
872 |
+
$mytabs->run();
|
873 |
+
|
874 |
+
$imgpath = $util->get_plugin_url() . 'custom/images/';
|
875 |
+
|
876 |
+
echo '<p> </p><p style="color:green"><a target="_blank" href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin"><b>' . __("Upgrade to premium version now", "wsr") . '</b></a>' . __(" to get more features", "wsr") . ' , <small>' . __("The premium version of SEO redirection is completely different from the free version as there are a lot more features included.", "wsr") . '</small></p>';
|
877 |
+
echo __('<p><a href="https://www.clogica.com/product/seo-redirection-premium-wordpress-plugin" target="_blank"><img src="' . $imgpath . 'seopro.png" /></a></p>');
|
878 |
+
}
|
879 |
+
|
880 |
+
|
881 |
+
function WPSR_upgrade()
|
882 |
+
{
|
883 |
+
|
884 |
+
$util = new clogica_util_1();
|
885 |
+
$util->init(WP_SEO_REDIRECTION_OPTIONS, __FILE__);
|
886 |
+
|
887 |
+
|
888 |
+
if ($util->get_option_value('plugin_version') != WP_SEO_REDIRECTION_VERSION) {
|
889 |
+
WPSR_install();
|
890 |
+
$util->update_option('plugin_version', WP_SEO_REDIRECTION_VERSION);
|
891 |
+
}
|
892 |
+
}
|
893 |
+
|
894 |
+
//-----------------------------------------------------
|
895 |
+
function WPSR_install()
|
896 |
+
{
|
897 |
+
global $wpdb, $table_prefix;
|
898 |
+
|
899 |
+
$util = new clogica_util_1();
|
900 |
+
$util->init(WP_SEO_REDIRECTION_OPTIONS, __FILE__);
|
901 |
+
|
902 |
+
$options = get_option(WP_SEO_REDIRECTION_OPTIONS);
|
903 |
+
if (!is_array($options)) {
|
904 |
+
add_option(WP_SEO_REDIRECTION_OPTIONS);
|
905 |
+
$options = array();
|
906 |
+
}
|
907 |
+
|
908 |
+
|
909 |
+
if (!array_key_exists('plugin_status', $options))
|
910 |
+
$options['plugin_status'] = '1';
|
911 |
+
|
912 |
+
if (!array_key_exists('ip_logging_status', $options))
|
913 |
+
$options['ip_logging_status'] = '1';
|
914 |
+
|
915 |
+
if (!array_key_exists('redirection_base', $options))
|
916 |
+
$options['redirection_base'] = site_url();
|
917 |
+
|
918 |
+
if (!array_key_exists('redirect_control_panel', $options))
|
919 |
+
$options['redirect_control_panel'] = '1';
|
920 |
+
|
921 |
+
if (!array_key_exists('show_redirect_box', $options))
|
922 |
+
$options['show_redirect_box'] = '1';
|
923 |
+
|
924 |
+
if (!array_key_exists('reflect_modifications', $options))
|
925 |
+
$options['reflect_modifications'] = '1';
|
926 |
+
|
927 |
+
if (!array_key_exists('history_status', $options))
|
928 |
+
$options['history_status'] = '1';
|
929 |
+
|
930 |
+
if (!array_key_exists('history_limit', $options))
|
931 |
+
$options['history_limit'] = '30';
|
932 |
+
|
933 |
+
if (!array_key_exists('p404_discovery_status', $options))
|
934 |
+
$options['p404_discovery_status'] = '1';
|
935 |
+
|
936 |
+
if (!array_key_exists('p404_redirect_to', $options))
|
937 |
+
$options['p404_redirect_to'] = site_url();
|
938 |
+
|
939 |
+
if (!array_key_exists('p404_status', $options))
|
940 |
+
$options['p404_status'] = '2';
|
941 |
+
|
942 |
+
if (!array_key_exists('keep_data', $options))
|
943 |
+
$options['keep_data'] = '1';
|
944 |
+
|
945 |
+
update_option(WP_SEO_REDIRECTION_OPTIONS, $options);
|
946 |
+
|
947 |
+
|
948 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
949 |
+
if ($wpdb->get_var("show tables like '$table_name'") != $table_name) {
|
950 |
+
$sql = "
|
951 |
+
CREATE TABLE IF NOT EXISTS `$table_name` (
|
952 |
+
`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
953 |
+
`enabled` int(1) NOT NULL DEFAULT '1',
|
954 |
+
`redirect_from` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
955 |
+
`redirect_from_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
956 |
+
`redirect_from_folder_settings` int(1) NOT NULL,
|
957 |
+
`redirect_from_subfolders` int(1) NOT NULL DEFAULT '1',
|
958 |
+
`redirect_to` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
959 |
+
`redirect_to_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
960 |
+
`redirect_to_folder_settings` int(1) NOT NULL DEFAULT '1',
|
961 |
+
`regex` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
962 |
+
`redirect_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
963 |
+
`url_type` int(2) NOT NULL DEFAULT 1,
|
964 |
+
`postID` int(11) unsigned DEFAULT NULL,
|
965 |
+
PRIMARY KEY (`ID`),
|
966 |
+
UNIQUE KEY `redirect_from` (`redirect_from`)
|
967 |
+
)ENGINE = MyISAM ;";
|
968 |
+
$wpdb->query($sql);
|
969 |
+
} else {
|
970 |
+
//check if Innodb convert it to myisam.
|
971 |
+
$status = $wpdb->get_row("SHOW TABLE STATUS WHERE Name = '$table_name'");
|
972 |
+
if ($status->Engine == 'InnoDB') {
|
973 |
+
$wpdb->query("alter table $table_name engine = MyISAM;");
|
974 |
+
}
|
975 |
+
|
976 |
+
// if the table exists
|
977 |
+
$redirects = $wpdb->get_results(" select redirect_from,redirect_to,ID from $table_name; ");
|
978 |
+
foreach ($redirects as $redirect) {
|
979 |
+
$redirect_from = $util->make_relative_url($redirect->redirect_from);
|
980 |
+
$redirect_to = $util->make_relative_url($redirect->redirect_to);
|
981 |
+
$ID = $redirect->ID;
|
982 |
+
$wpdb->query($wpdb->prepare(" update $table_name set redirect_from=%s,redirect_to=%s where ID=%d", $redirect_from, $redirect_to, $ID));
|
983 |
+
}
|
984 |
+
|
985 |
+
}
|
986 |
+
|
987 |
+
$table_name = $table_prefix . 'WP_SEO_Cache';
|
988 |
+
if ($wpdb->get_var("show tables like '$table_name'") != $table_name) {
|
989 |
+
$sql = "
|
990 |
+
CREATE TABLE IF NOT EXISTS `$table_name` (
|
991 |
+
`ID` int(11) unsigned NOT NULL,
|
992 |
+
`is_redirected` int(1) unsigned NOT NULL,
|
993 |
+
`redirect_from` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
994 |
+
`redirect_to` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
995 |
+
`redirect_type` int(3) unsigned NOT NULL DEFAULT 301,
|
996 |
+
PRIMARY KEY (`ID`)
|
997 |
+
) ENGINE = MyISAM ;
|
998 |
+
";
|
999 |
+
$wpdb->query($sql);
|
1000 |
+
} else {
|
1001 |
+
//check if Innodb convert it to myisam.
|
1002 |
+
$status = $wpdb->get_row("SHOW TABLE STATUS WHERE Name = '$table_name'");
|
1003 |
+
if ($status->Engine == 'InnoDB') {
|
1004 |
+
$wpdb->query("alter table $table_name engine = MyISAM;");
|
1005 |
+
}
|
1006 |
+
}
|
1007 |
+
|
1008 |
+
|
1009 |
+
if ($wpdb->get_var(" SELECT count(*) as cnt FROM INFORMATION_SCHEMA.COLUMNS
|
1010 |
+
WHERE TABLE_NAME = '$table_name'
|
1011 |
+
AND table_schema = DATABASE()
|
1012 |
+
AND COLUMN_NAME = 'redirect_from' ") == '0') {
|
1013 |
+
|
1014 |
+
$sql = "
|
1015 |
+
ALTER TABLE $table_name
|
1016 |
+
ADD COLUMN `redirect_from` varchar(255) COLLATE utf8_unicode_ci NOT NULL;
|
1017 |
+
";
|
1018 |
+
$wpdb->query($sql);
|
1019 |
+
}
|
1020 |
+
|
1021 |
+
|
1022 |
+
$table_name = $table_prefix . 'WP_SEO_404_links';
|
1023 |
+
if ($wpdb->get_var("show tables like '$table_name'") != $table_name) {
|
1024 |
+
$sql = "
|
1025 |
+
CREATE TABLE IF NOT EXISTS `$table_name` (
|
1026 |
+
`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
1027 |
+
`ctime` datetime NOT NULL,
|
1028 |
+
`link` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
1029 |
+
`referrer` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
1030 |
+
`ip` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
|
1031 |
+
`country` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
1032 |
+
`os` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
|
1033 |
+
`browser` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
|
1034 |
+
PRIMARY KEY (`ID`),
|
1035 |
+
UNIQUE KEY `link` (`link`)
|
1036 |
+
) ENGINE = MyISAM ;
|
1037 |
+
";
|
1038 |
+
$wpdb->query($sql);
|
1039 |
+
} else {
|
1040 |
+
//check if Innodb convert it to myisam.
|
1041 |
+
$status = $wpdb->get_row("SHOW TABLE STATUS WHERE Name = '$table_name'");
|
1042 |
+
if ($status->Engine == 'InnoDB') {
|
1043 |
+
$wpdb->query("alter table $table_name engine = MyISAM;");
|
1044 |
+
}
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
|
1048 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection_LOG';
|
1049 |
+
if ($wpdb->get_var("show tables like '$table_name'") != $table_name) {
|
1050 |
+
$sql = "
|
1051 |
+
CREATE TABLE IF NOT EXISTS `$table_name` (
|
1052 |
+
`ID` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
1053 |
+
`rID` int(11) unsigned DEFAULT NULL,
|
1054 |
+
`postID` int(11) unsigned DEFAULT NULL,
|
1055 |
+
`ctime` datetime NOT NULL,
|
1056 |
+
`rfrom` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
1057 |
+
`rto` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
1058 |
+
`rtype` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
1059 |
+
`rsrc` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
|
1060 |
+
`referrer` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
1061 |
+
`ip` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
|
1062 |
+
`country` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
|
1063 |
+
`os` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
|
1064 |
+
`browser` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
|
1065 |
+
PRIMARY KEY (`ID`)
|
1066 |
+
) ENGINE = MyISAM ;
|
1067 |
+
";
|
1068 |
+
|
1069 |
+
$wpdb->query($sql);
|
1070 |
+
} else {
|
1071 |
+
//check if Innodb convert it to myisam.
|
1072 |
+
$status = $wpdb->get_row("SHOW TABLE STATUS WHERE Name = '$table_name'");
|
1073 |
+
if ($status->Engine == 'InnoDB') {
|
1074 |
+
$wpdb->query("alter table $table_name engine = MyISAM;");
|
1075 |
+
}
|
1076 |
+
}
|
1077 |
+
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
|
1081 |
+
//---------------------------------------------------------------
|
1082 |
+
|
1083 |
+
|
1084 |
+
function WPSR_uninstall()
|
1085 |
+
{
|
1086 |
+
global $wpdb, $table_prefix;
|
1087 |
+
|
1088 |
+
$util = new clogica_util_1();
|
1089 |
+
$util->init(WP_SEO_REDIRECTION_OPTIONS, __FILE__);
|
1090 |
+
|
1091 |
+
|
1092 |
+
if ($util->get_option_value('keep_data') != '1') {
|
1093 |
+
|
1094 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection';
|
1095 |
+
$wpdb->query($wpdb->prepare(" DROP TABLE %s ", $table_name));
|
1096 |
+
|
1097 |
+
$table_name = $table_prefix . 'WP_SEO_Cache';
|
1098 |
+
$wpdb->query($wpdb->prepare(" DROP TABLE %s ", $table_name));
|
1099 |
+
|
1100 |
+
$table_name = $table_prefix . 'WP_SEO_404_links';
|
1101 |
+
$wpdb->query($wpdb->prepare(" DROP TABLE %s ", $table_name));
|
1102 |
+
|
1103 |
+
$table_name = $table_prefix . 'WP_SEO_Redirection_LOG';
|
1104 |
+
$wpdb->query($wpdb->prepare(" DROP TABLE %s ", $table_name));
|
1105 |
+
|
1106 |
+
|
1107 |
+
$util->delete_my_options();
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
|
1114 |
+
//---------------------------------------------------------------
|
1115 |
+
|
1116 |
+
function SR_HideMessageAjaxFunction()
|
1117 |
+
{
|
1118 |
+
add_option('nsr_upgrade_message', 'yes');
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
|
1122 |
+
function SR_after_plugin_row($plugin_file, $plugin_data, $status)
|
1123 |
+
{
|
1124 |
+
|
1125 |
+
if (get_option('nsr_upgrade_message') != 'yes') {
|
1126 |
+
$class_name = $plugin_data['slug'];
|
1127 |
+
|
1128 |
+
echo '<tr id="' . $class_name . '-plugin-update-tr" class="plugin-update-tr active">';
|
1129 |
+
echo '<td colspan="3" class="plugin-update">';
|
1130 |
+
echo '<div id="' . $class_name . '-upgradeMsg" class="update-message notice inline notice-warning notice-alt" >';
|
1131 |
+
|
1132 |
+
echo 'You are running SEO redirection free. To get more features, you can <a href="http://www.clogica.com/product/seo-redirection-premium-wordpress-plugin" target="_blank"><strong>upgrade now</strong></a> or ';
|
1133 |
+
|
1134 |
+
echo '<span id="HideMe" style="cursor:pointer" ><a href="javascript:void(0)"><strong>dismiss</strong></a> this message</span>';
|
1135 |
+
echo '</div>';
|
1136 |
+
echo '</td>';
|
1137 |
+
echo '</tr>';
|
1138 |
+
|
1139 |
+
?>
|
1140 |
+
|
1141 |
+
<script type="text/javascript">
|
1142 |
+
jQuery(document).ready(function () {
|
1143 |
+
var row = jQuery('#<?php echo $class_name;?>-plugin-update-tr').closest('tr').prev();
|
1144 |
+
jQuery(row).addClass('update');
|
1145 |
+
|
1146 |
+
jQuery("#HideMe").click(function () {
|
1147 |
+
jQuery.ajax({
|
1148 |
+
type: 'POST',
|
1149 |
+
url: '<?php echo admin_url();?>/admin-ajax.php',
|
1150 |
+
data: {
|
1151 |
+
action: 'SR_HideMessageAjaxFunction'
|
1152 |
+
},
|
1153 |
+
success: function (data, textStatus, XMLHttpRequest) {
|
1154 |
+
|
1155 |
+
jQuery("#<?php echo $class_name;?>-upgradeMsg").hide();
|
1156 |
+
|
1157 |
+
},
|
1158 |
+
error: function (MLHttpRequest, textStatus, errorThrown) {
|
1159 |
+
alert(errorThrown);
|
1160 |
+
}
|
1161 |
+
});
|
1162 |
+
});
|
1163 |
+
|
1164 |
+
});
|
1165 |
+
</script>
|
1166 |
+
|
1167 |
+
<?php
|
1168 |
+
}
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
$path = plugin_basename(__FILE__);
|
1172 |
+
add_action("after_plugin_row_{$path}", 'SR_after_plugin_row', 10, 3);
|
1173 |
+
// creating Ajax call for WordPress
|
1174 |
+
add_action('wp_ajax_nopriv_SR_HideMessageAjaxFunction', 'SR_HideMessageAjaxFunction');
|
1175 |
+
add_action('wp_ajax_SR_HideMessageAjaxFunction', 'SR_HideMessageAjaxFunction');
|
1176 |
+
//---------------------------------------------------------------
|
1177 |
+
|
1178 |
+
?>
|