Skip to content

Commit

Permalink
Version 2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisWinters committed Aug 7, 2019
1 parent 55fc79f commit e70c5d6
Show file tree
Hide file tree
Showing 19 changed files with 219 additions and 194 deletions.
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

# 2.0.2
**2019-08-07 - Hotfix**

* Removed plugin-activation level upgrade in favor of manual upgrade
* Moved admin/network/public class includes into plugins_loaded hook
* Modified class-translate.php to use new translation call format
* Modified sidebar hardcoded images to use plugin_dir_url()
* Modified plugin settings upgrade message for new installs
* Corrected network delete all settings to correctly delete all settings
* Corrected function call in class-do-network-robotstxt-build.php
* Corrected function call in class-do-robotstxt-cleaner.php
* Corrected bump.js gulp task

# 2.0.1
**2019-07-25 - Hotfix**

Expand Down Expand Up @@ -37,12 +50,12 @@

* Fixed: Bad method call in class-cleaner.php.
* Fixed: Multiple incorrect update_option formats.
* Fixed: Network Robots.txt now saves when published | https://github.com/tribalNerd/multisite-robotstxt-manager/issues/5
* Fixed: Network Robots.txt now saves when published | https://github.com/ChrisWinters/multisite-robotstxt-manager/issues/5
* Fixed: Removed append marker, if no append rules found.
* Fixed: Wrapped is_writable() check to physical robots.txt removal.
* Change: Option names for cleaner, appended cleaner_.
* Change: Modified update success/fail messages.
* Change: Deleted uninstall.php | https://github.com/tribalNerd/multisite-robotstxt-manager/issues/6
* Change: Deleted uninstall.php | https://github.com/ChrisWinters/multisite-robotstxt-manager/issues/6

# 1.0.8

Expand Down
27 changes: 23 additions & 4 deletions inc/classes/class-do-delete-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,39 @@ public function update() {

// Set Disable Marker For Website.
if ( 'delete' === $this->post_action ) {
$this->delete_website();
$this->do_delete();
}
}//end update()


/**
* Init Delete
*/
private function delete_website() {
$this->option_manager->delete_option();
private function do_delete() {
/*
* Retrieves a list of sites matching requested arguments.
* https://developer.wordpress.org/reference/functions/get_sites/
*/
foreach ( get_sites() as $website ) {
/*
* Switch the current blog.
* https://developer.wordpress.org/reference/functions/switch_to_blog/
*/
switch_to_blog( $website->blog_id );

$this->option_manager->delete_option();

/*
* Restore the current blog, after calling switch_to_blog.
* https://developer.wordpress.org/reference/functions/restore_current_blog/
*/
restore_current_blog();
}

$this->option_manager->delete_site_option();

if ( true === empty( $this->option_manager->get_option() ) && true === empty( $this->option_manager->get_site_option() ) ) {
$this->admin_notices->add_notice( 'success', 'delete_success', 'network' );
}
}//end delete_website()
}//end do_delete()
}//end class
21 changes: 13 additions & 8 deletions inc/classes/class-do-member-robotstxt-build.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
exit;
}

use MsRobotstxtManager\Trait_Security_Check as TraitSecurityCheck;
use MsRobotstxtManager\Plugin_Admin_Notices as PluginAdminNotices;
use MsRobotstxtManager\Do_Build_Robotstxt as DoBuildRobotstxt;
use MsRobotstxtManager\Option_Manager as OptionManager;
use MsRobotstxtManager\Trait_Security_Check as TraitSecurityCheck;
use MsRobotstxtManager\Plugin_Admin_Notices as PluginAdminNotices;
use MsRobotstxtManager\Do_Build_Robotstxt as DoBuildRobotstxt;
use MsRobotstxtManager\Option_Manager as OptionManager;

/**
* Build Robots.txt File Across All Member Sites.
*/
final class Do_Member_Robotstxt_Build {
use TraitSecurityCheck;
use TraitSecurityCheck;

/**
* Plugin Admin Post Object.
Expand Down Expand Up @@ -92,7 +92,13 @@ public function init() {
* Fires as an admin screen or script is being initialized.
* https://developer.wordpress.org/reference/hooks/admin_init/
*/
add_action( 'admin_init', [ $this, 'update' ] );
add_action(
'admin_init',
[
$this,
'update',
]
);
}//end init()


Expand Down Expand Up @@ -160,6 +166,5 @@ private function member_robotstxt_build() {
if ( true === $message ) {
$this->admin_notices->add_notice( 'success', 'member_updated', 'network' );
}
}

}//end member_robotstxt_build()
}//end class
20 changes: 13 additions & 7 deletions inc/classes/class-do-network-robotstxt-build.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
exit;
}

use MsRobotstxtManager\Trait_Security_Check as TraitSecurityCheck;
use MsRobotstxtManager\Plugin_Admin_Notices as PluginAdminNotices;
use MsRobotstxtManager\Do_Build_Robotstxt as DoBuildRobotstxt;
use MsRobotstxtManager\Option_Manager as OptionManager;
use MsRobotstxtManager\Trait_Security_Check as TraitSecurityCheck;
use MsRobotstxtManager\Plugin_Admin_Notices as PluginAdminNotices;
use MsRobotstxtManager\Do_Build_Robotstxt as DoBuildRobotstxt;
use MsRobotstxtManager\Option_Manager as OptionManager;

/**
* Build Robots.txt File Across All Network Sites.
*/
final class Do_Network_Robotstxt_Build {
use TraitSecurityCheck;
use TraitSecurityCheck;

/**
* Plugin Admin Post Object.
Expand Down Expand Up @@ -92,7 +92,13 @@ public function init() {
* Fires as an admin screen or script is being initialized.
* https://developer.wordpress.org/reference/hooks/admin_init/
*/
add_action( 'admin_init', [ $this, 'update' ] );
add_action(
'admin_init',
[
$this,
'update',
]
);
}//end init()


Expand Down Expand Up @@ -153,5 +159,5 @@ private function network_robosttxt_build() {
if ( true === $message ) {
$this->admin_notices->add_notice( 'success', 'network_updated', 'network' );
}
}
}//end network_robosttxt_build()
}//end class
8 changes: 4 additions & 4 deletions inc/classes/class-do-robotstxt-cleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private function checkdata() {
$this->option_manager->update_option( [ 'checkdata' => 'error' ] );
$message = true;
} else {
$this->option_manager->del_setting( 'checkdata' );
$this->option_manager->delete_setting( 'checkdata' );
}

if ( true === $message ) {
Expand Down Expand Up @@ -192,7 +192,7 @@ private function checkphysical() {
$this->option_manager->update_option( [ 'checkphysical' => 'error' ] );
$message = true;
} else {
$this->option_manager->del_setting( 'checkphysical' );
$this->option_manager->delete_setting( 'checkphysical' );
}

if ( true === $message ) {
Expand All @@ -214,7 +214,7 @@ private function cleanphysical() {

// Robots.txt File Found.
if ( true === file_exists( get_home_path() . 'robots.txt' ) ) {
$this->option_manager->del_setting( 'checkphysical' );
$this->option_manager->delete_setting( 'checkphysical' );
$this->admin_notices->add_notice( 'error', 'checkphysical_error', 'network' );
} else {
$this->checkphysical();
Expand All @@ -241,7 +241,7 @@ private function checkrewrite() {
$this->option_manager->update_option( [ 'checkrewrite' => 'error' ] );
$message = true;
} else {
$this->option_manager->del_setting( 'checkrewrite' );
$this->option_manager->delete_setting( 'checkrewrite' );
}

if ( true === $message ) {
Expand Down
30 changes: 30 additions & 0 deletions inc/classes/class-msrobotstxtmanager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Manager Class
*
* @package WordPress
* @subpackage Plugin
* @author Chris W. <chrisw@null.net>
* @license GNU GPLv3
* @link /LICENSE
*/

namespace MsRobotstxtManager;

if ( false === defined( 'ABSPATH' ) ) {
exit;
}

/**
* Plugin Core
*/
final class MsRobotstxtManager {
/**
* Init Plugin
*/
public static function init() {
require_once MS_ROBOTSTXT_MANAGER_PLUGIN_DIR . '/inc/instantiate-public-classes.php';
require_once MS_ROBOTSTXT_MANAGER_PLUGIN_DIR . '/inc/instantiate-admin-classes.php';
require_once MS_ROBOTSTXT_MANAGER_PLUGIN_DIR . '/inc/instantiate-network-classes.php';
}//end init()
}//end class
76 changes: 0 additions & 76 deletions inc/classes/class-plugin-activate.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public static function init() {
wp_die( esc_html__( 'WordPress 3.8 is required. Please upgrade WordPress and try again.', 'multisite-robotstxt-manager' ) );
}

// Maybe Upgade Robots.txt Manager Plugin.
self::upgrade_plugin();

// Maybe Save Robots.txt As Plugin Robots.txt.
self::set_robotstxt();

Expand Down Expand Up @@ -106,77 +103,4 @@ public static function get_website_robotstxt() {

return $robotstxt;
}//end get_website_robotstxt()


/**
* Maybe Upgade Robots.txt Manager Plugin
*/
public static function upgrade_plugin() {
$network_robotstxt = get_option( 'ms_robotstxt_manager_network_robotstxt' );

if ( true !== empty( $network_robotstxt['robotstxt'] ) ) {
update_site_option(
MS_ROBOTSTXT_MANAGER_PLUGIN_NAME,
[
'robotstxt' => $network_robotstxt['robotstxt'],
]
);

delete_option( 'ms_robotstxt_manager_network_robotstxt' );
delete_option( 'ms_robotstxt_manager_network_preset' );
delete_option( 'ms_robotstxt_manager_network_status' );
delete_option( 'ms_robotstxt_manager_settings' );
delete_option( 'ms_robotstxt_manager_cleaner_old_data' );
delete_option( 'ms_robotstxt_manager_cleaner_physical' );
delete_option( 'ms_robotstxt_manager_cleaner_rewrite' );
delete_option( 'msrtm_settings' );

$option_array = [];

/*
* Retrieves a list of sites matching requested arguments.
* https://developer.wordpress.org/reference/functions/get_sites/
*/
foreach ( get_sites() as $website ) {
/*
* Switch the current blog.
* https://developer.wordpress.org/reference/functions/switch_to_blog/
*/
switch_to_blog( $website->blog_id );

$website_robotstxt = get_option( 'ms_robotstxt_manager_robotstxt' );
$website_append_rules = get_option( 'ms_robotstxt_manager_append' );

if ( true !== empty( $website_robotstxt['robotstxt'] ) ) {
$option_array['robotstxt'] = $website_robotstxt['robotstxt'];
}

if ( true !== empty( $website_append_rules['robotstxt'] ) ) {
$option_array['append'] = $website_append_rules['robotstxt'];
}

if ( true === get_option( 'ms_robotstxt_manager_status' ) ) {
$option_array['disable'] = true;
}

if ( true !== empty( $option_array ) ) {
update_option(
MS_ROBOTSTXT_MANAGER_PLUGIN_NAME,
$option_array
);
}

delete_option( 'ms_robotstxt_manager_robotstxt' );
delete_option( 'ms_robotstxt_manager_status' );
delete_option( 'ms_robotstxt_manager_append' );
delete_option( 'ms_robotstxt_manager_default' );

/*
* Restore the current blog, after calling switch_to_blog.
* https://developer.wordpress.org/reference/functions/restore_current_blog/
*/
restore_current_blog();
}
}
}//end upgrade_plugin()
}//end class
5 changes: 3 additions & 2 deletions inc/classes/class-plugin-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,13 @@ public function templates() {
$checkrewrite = $option->get_setting( 'checkrewrite' );
}

$network_robotstxt = $option->get_site_setting( 'robotstxt' );
$network_upgrade = $option->get_site_setting( 'upgraded' );
$network_upgrade = $option->get_site_setting( 'upgraded' );

$sdk = $option->get_site_setting( 'sdk_action' );
}

$network_robotstxt = $option->get_site_setting( 'robotstxt' );

include_once $dir . '/inc/templates/header.php';

if ( true === file_exists( $dir . '/inc/templates/' . $tab . '.php' ) ) {
Expand Down
7 changes: 7 additions & 0 deletions inc/classes/class-plugin-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ private function upgrade() {
// Set Upgrade Delte Marker & Send Notice.
$this->option_manager->update_site_setting( 'upgraded', 'delete' );
$this->admin_notices->add_notice( 'success', 'upgrade_success', 'network' );
return;
}

if ( true === empty( $network_robotstxt['robotstxt'] ) ) {
$this->option_manager->update_site_setting( 'upgraded', true );
$this->admin_notices->add_notice( 'success', 'upgraded_already', 'network' );
return;
}
}//end upgrade()

Expand Down
Loading

0 comments on commit e70c5d6

Please sign in to comment.