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

functions.php in SEO Redirection Plugin – 301 Redirect Manager 8.4, at custom/functions.php

142 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // custom functions
3 if(!function_exists("WPSR_make_absolute_url")) {
4 function WPSR_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("WPSR_Get_total_404")){
118 function WPSR_Get_total_404()
119 {
120 global $wpdb,$table_prefix;
121 $table_name = $table_prefix . 'WP_SEO_404_links';
122 $thecount = $wpdb->get_row("select count(DISTINCT link) as tot from $table_name");
123 return ($thecount->tot);
124
125 }}
126
127 //------------------------------------------------------------
128
129 if(!function_exists("SR_cut_string")){
130 function SR_cut_string($string, $strt, $end)
131 {
132 if(strlen($string) > $end)
133 {
134 return substr($string, $strt, $end).'..';
135 }else{
136
137 return $string;
138 }
139
140 }}
141
142