Changeset 2186955
- Timestamp:
- 11/06/2019 01:19:55 PM (6 years ago)
- Location:
- simple-www-redirect/trunk
- Files:
-
- 23 deleted
- 4 edited
-
css/admin.css (modified) (1 diff)
-
index.php (modified) (7 diffs)
-
js/admin.js (modified) (1 diff)
-
lang/swr-ar_AR.mo (deleted)
-
lang/swr-ar_AR.po (deleted)
-
lang/swr-de_DE.mo (deleted)
-
lang/swr-de_DE.po (deleted)
-
lang/swr-es_ES.mo (deleted)
-
lang/swr-es_ES.po (deleted)
-
lang/swr-fr_FR.mo (deleted)
-
lang/swr-fr_FR.po (deleted)
-
lang/swr-hi-HI.mo (deleted)
-
lang/swr-hi-HI.po (deleted)
-
lang/swr-it_IT.mo (deleted)
-
lang/swr-it_IT.po (deleted)
-
lang/swr-nl_NL.mo (deleted)
-
lang/swr-nl_NL.po (deleted)
-
lang/swr-pt_PT.mo (deleted)
-
lang/swr-pt_PT.po (deleted)
-
lang/swr-ru_RU.mo (deleted)
-
lang/swr-ru_RU.po (deleted)
-
lang/swr-tr_TR.mo (deleted)
-
lang/swr-tr_TR.po (deleted)
-
lang/swr-zh.mo (deleted)
-
lang/swr-zh.po (deleted)
-
readme.txt (modified) (3 diffs)
-
screenshot-1.png (deleted)
Legend:
- Unmodified
- Added
- Removed
-
simple-www-redirect/trunk/css/admin.css
r2177006 r2186955 81 81 display:none; 82 82 } 83 84 .light-plugins-link{ 85 font-weight:600; 86 } -
simple-www-redirect/trunk/index.php
r2185777 r2186955 6 6 Author: LightPlugins 7 7 Author URI: https://lightplugins.com/ 8 Version: 1.0. 18 Version: 1.0.2 9 9 Text Domain: swr 10 10 */ … … 94 94 $parsed_url2 = wp_parse_url($home); 95 95 96 // htaccess 97 $htaccess_file = ABSPATH . ".htaccess"; 98 96 99 // the IP address doesn't support www. 97 100 if(filter_var($siteurl, FILTER_VALIDATE_IP)) { … … 125 128 // force www 126 129 if($type == "www"){ 130 131 // redirect rules 132 $rules = "RewriteEngine On 133 RewriteCond %{HTTP_HOST} !^www\. [NC] 134 RewriteRule ^(.*)$ ".$protocol."www.%{HTTP_HOST}/$1 [R=301,L]"; 127 135 128 136 // add www to siteurl … … 139 147 }else if($type == "non-www"){ 140 148 149 // redirect rules 150 $rules = "RewriteEngine On 151 RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 152 RewriteRule ^(.*)$ ".$protocol."%1/$1 [R=301,L]"; 153 141 154 // remove www from siteurl and home 142 155 update_option("siteurl", str_replace("://www.", "://", $siteurl)); … … 145 158 } 146 159 147 } 160 // checks if htaccess file is exists 161 if (file_exists($htaccess_file)){ 162 163 // remove insert 164 if($method == "deactivate"){ 165 insert_with_markers($htaccess_file, "Simple www Redirect", array()); 166 167 // insert 168 }else if(strlen($rules) > 0){ 169 insert_with_markers($htaccess_file, "Simple www Redirect", explode("\n", $rules)); 170 } 171 172 } 173 174 } 175 176 177 // the plugin deactivate hook 178 function swr_deactivate_hook(){ 179 180 // delete redirect lines from htaccess file when deactivated 181 swr_update_url(null, "deactivate"); 182 183 } 184 185 register_deactivation_hook( __FILE__, 'swr_deactivate_hook' ); 148 186 149 187 … … 243 281 <div id="swr-settings"<?php echo $error_class; ?>> 244 282 245 <p id="swr-information"><?php _e('The plugin specifies whether your domain will include www. The plugin basically creates redirect rule and adds to the . urlfile. Choose Your Style!', 'swr'); ?></p>283 <p id="swr-information"><?php _e('The plugin specifies whether your domain will include www. The plugin basically creates redirect rule and adds to the .htaccess file. Choose Your Style!', 'swr'); ?></p> 246 284 247 285 <p class="swr-errors"><?php echo $errors; ?></p> … … 259 297 </div> 260 298 299 <p class="light-plugins-link">This plugin total is just 6KB.<br />Do you like lightweight plugins? Check <a href="https://www.lightplugins.com/?ref=simple-www-redirect" target="_blank">lightplugins.com</a></p> 300 261 301 </form> 262 302 </div> -
simple-www-redirect/trunk/js/admin.js
r2157673 r2186955 1 1 ;(function($) { 2 2 3 4 3 5 // after document ready 6 4 7 $(document).ready(function(){ 5 8 9 10 6 11 // the radio change event 12 7 13 $("[name='swr_force_type']").on("change", function() { 14 8 15 $(".swr-radio").removeClass("checked"); 16 9 17 $("[name='swr_force_type']:checked").parents(".swr-radio").addClass("checked"); 18 10 19 }); 11 20 21 22 12 23 // radio division click updating the radio value 24 13 25 $(".swr-radio").on("click", function() { 26 14 27 $(this).find("input").prop("checked", true); 28 15 29 $(".swr-radio").removeClass("checked"); 30 16 31 $("[name='swr_force_type']:checked").parents(".swr-radio").addClass("checked"); 32 17 33 }); 34 35 18 36 19 37 }); 20 38 39 40 21 41 }(jQuery)); -
simple-www-redirect/trunk/readme.txt
r2185404 r2186955 2 2 Tags: disable, www, non-www, redirect, world wide web 3 3 Requires at least: 4.0 4 Tested up to: 5. 25 Stable tag: 5. 24 Tested up to: 5.3 5 Stable tag: 5.3 6 6 Contributors: LightPlugins 7 7 License: GPLv2 or later … … 14 14 15 15 = Key Features = 16 * Add www to your domain, redirect non-www links to www16 * Redirect non-www links to www 17 17 * Or redirect www links to non-www 18 18 * A simple lightweight plugin … … 35 35 36 36 == Changelog == 37 = 1.0.2 = 38 * Fixed a confict on Linux servers about htaccess file 39 37 40 = 1.0.1 = 38 41 * A Redirect bug fixed
Note: See TracChangeset
for help on using the changeset viewer.