Changeset 2282394
- Timestamp:
- 04/13/2020 12:51:18 PM (6 years ago)
- Location:
- sumedia-urlify
- Files:
-
- 1 added
- 3 edited
-
tags/0.3.5 (added)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/src/Sumedia/Urlify/Plugin.php (modified) (3 diffs)
-
trunk/sumedia-urlify.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sumedia-urlify/trunk/changelog.txt
r2282369 r2282394 12 12 0.3.4 13 13 - Fixing flush rewrite rules on update 14 15 0.3.5 16 - adding update hook to avoid broken url -
sumedia-urlify/trunk/src/Sumedia/Urlify/Plugin.php
r2282369 r2282394 7 7 public function init() 8 8 { 9 add_action('admin_init', [$this, 'check_version']); 10 add_action('admin_init', [$this, 'check_rewrite_version']); 9 11 add_action('plugins_loaded', [$this, 'textdomain']); 10 12 add_action('admin_print_styles', [$this, 'admin_stylesheets']); … … 19 21 add_action('plugins_loaded', [$this, 'checkRewriteEngineChanges']); 20 22 add_action('plugins_loaded', [$this, 'controller']); 23 } 24 25 function check_version() 26 { 27 $version_option_name = str_replace('-', '_', SUMEDIA_URLIFY_PLUGIN_NAME) . '_version'; 28 $version = get_option($version_option_name) ? : 0; 29 if (-1 == version_compare($version, SUMEDIA_URLIFY_VERSION)) { 30 if ($version == 0) { 31 add_option($version_option_name, SUMEDIA_URLIFY_VERSION); 32 } else { 33 update_option($version_option_name, SUMEDIA_URLIFY_VERSION); 34 } 35 } 36 } 37 38 function check_rewrite_version() 39 { 40 $version_option_name = str_replace('-', '_', SUMEDIA_URLIFY_PLUGIN_NAME) . '_version'; 41 $rewrite_version_option_name = str_replace('-', '_', SUMEDIA_URLIFY_PLUGIN_NAME) . '_rewrite_version'; 42 $version = get_option($version_option_name); 43 $rewrite_version = get_option($rewrite_version_option_name) ? : 0; 44 if (-1 == version_compare($rewrite_version, $version)) { 45 global $wp_rewrite; 46 $wp_rewrite->flush_rules(); 47 48 if ($rewrite_version == 0) { 49 add_option($rewrite_version_option_name, SUMEDIA_URLIFY_VERSION); 50 } else { 51 update_option($rewrite_version_option_name, SUMEDIA_URLIFY_VERSION); 52 } 53 54 add_action('admin_init', function(){ 55 wp_redirect(admin_url()); 56 }); 57 } 21 58 } 22 59 … … 35 72 $config = \Sumedia\Urlify\Base\Registry::get('Sumedia\Urlify\Config'); 36 73 $config->write($admin_url); 37 38 flush_rewrite_rules();39 74 40 75 add_action('admin_init', function(){ -
sumedia-urlify/trunk/sumedia-urlify.php
r2282371 r2282394 12 12 * Plugin URI: https://github.com/sumedia-wordpress/urlify 13 13 * Description: Changes important URL's to improve security 14 * Version: 0.3. 414 * Version: 0.3.5 15 15 * Requires at least: 5.3 (nothing else tested yet) 16 16 * Requires PHP: 5.6.0 (not tested, could work) … … 57 57 } else { 58 58 59 define('SUMEDIA_URLIFY_VERSION', '0.3. 4');59 define('SUMEDIA_URLIFY_VERSION', '0.3.5'); 60 60 define('SUMEDIA_URLIFY_PLUGIN_NAME', dirname(plugin_basename(__FILE__))); 61 61 define('SUMEDIA_URLIFY_PLUGIN_PATH', __DIR__);
Note: See TracChangeset
for help on using the changeset viewer.