Skip to content

Commit

Permalink
Version 1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
tribalNerd committed Mar 31, 2017
1 parent a093dbb commit be6318d
Show file tree
Hide file tree
Showing 13 changed files with 862 additions and 437 deletions.
864 changes: 674 additions & 190 deletions LICENSE

Large diffs are not rendered by default.

35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* **Tags:** robotstxt, robots.txt, robots, robot, spiders, virtual, search, google, seo, plugin, network, mu, multisite, technerdia, tribalnerd
* **Requires at least:** 3.8
* **Tested up to:** 4.7.3
* **Stable tag:** 1.0.8
* **Stable tag:** 1.0.9
* **License:** GNU GPLv3
* **License URI:** https://github.com/tribalNerd/multisite-robotstxt-manager/blob/master/LICENSE

Expand Down Expand Up @@ -203,7 +203,7 @@ A) Yes, however they typically only work for the default WordPress robots.txt fi

= Q) Does the plugin remove the settings when it is disabled or deleted? =

A) When the plugin is disabled, no settings are deleted, however the robots.txt file created by the plugin will no longer display. When the plugin is deleted, all settings the plugin created are removed from the database.
A) No! However you can disable the plugin and delete settings within the plugin admin area.


:: Arbitrary section
Expand Down Expand Up @@ -269,30 +269,37 @@ The marker {APPEND_WEBSITE_ROBOTSTXT} within the Network Robots.txt File is repl
For "real" Multisite HOST Networks, use the WordPress plugin: BWP Google XML Sitemaps - This plugin will list each Websites Sitemap URL's in the Root Network Website's robots.txt file.





:: Changelog
--------

= 1.0.9 =
* Fixed: Bad method call in class-cleaner.php.
* Fixed: Multiple incorrect update_option formats.
* Fixed: Network Robots.txt now saves when published per GitHub Issue #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 per GitHub issue #6.

= 1.0.8 =
* New plugin structure/files, using the same option names.
* Added new tab "Cleaner" to the Network Admin area.
* Added two stage cleaning process - check & clean.
* Added check for a physical robots.txt file.
* Added check for missing robots.txt file rewrite rule.
* Added network tab to Websites for quick access to plugin admin within the Network.
* Added option to disable network robots.txt file on websites, allowing for full customization of websites robots.txt file.
* Modified the plugin admin areas to be more visually friendly.
* Moved screenshots/header/thumbnail images into the svn/assets folder.
* Added: New tab "Cleaner" to the Network Admin area.
* Added: Two stage cleaning process - check & clean.
* Added: Check for a physical robots.txt file.
* Added: Check for missing robots.txt file rewrite rule.
* Added: Network tab to Websites for quick access to plugin admin within the Network.
* Added: Option to disable network robots.txt file on websites, allowing for full customization of websites robots.txt file.
* Change: Plugin admin areas to be more visually friendly.
* Moved: Screenshots/header/thumbnail images into the svn/assets folder.

= 1.0.7 =
* Bug: Fixed bad calls from helper class causing options not saving for each site. Thanks https://github.com/benjaminniess

= 1.0.6 =
* Bug: Corrected class_helper->getSitemapUrl() - printing "No Sitemap Found" in robots.txt files
* Bug: Moved class_admin->updateNetwork()->throwMessage() outside of foreach when updating the network
* Adjusted templates/home.php to display No Sitemap Found within input field
* Change: templates/home.php to display No Sitemap Found within input field

= 1.0.5 =
* Modified class_helper->getSitemapUrl(): added get_option( 'siteurl' ) check for sitemap url
Expand Down
35 changes: 35 additions & 0 deletions classes/class-adminarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @call MsRobotstxtManager_AdminArea::instance();
*
* @method init() Init Admin Actions
* @method redirect() Redirect if Network Tab is Opened
* @method menu() Load Admin Area Menu
* @method enqueue() Enqueue Stylesheet and jQuery
* @method website() Display Website Admin Templates
Expand All @@ -23,6 +24,9 @@ class MsRobotstxtManager_AdminArea extends MsRobotstxtManager_Extended
// Holds Instance Object
protected static $instance = NULL;

// Tab Names
private $tabs;


/**
* @about Init Admin Actions
Expand All @@ -39,6 +43,37 @@ final public function init()
if ( parent::qString( 'page' ) == $this->plugin_name ) {
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
}

// Website Tabs Names: &tab=home
if ( ! is_network_admin() ) {
$this->tabs = array(
'website' => __( 'Website', 'multisite-robotstxt-manager' ),
'msrobotstxt' => __( 'Network', 'multisite-robotstxt-manager' ),
);

// Redirect if Network Tab is Opened
if ( $this->qString( 'tab' ) == 'msrobotstxt' ) {
$this->redirect();
}
}

// Network Tabs Names: &tab=home
if ( is_network_admin() ) {
$this->tabs = array(
'network' => __( 'Network', 'multisite-robotstxt-manager' ),
'cleaner' => __( 'Cleaner', 'multisite-robotstxt-manager' ),
);
}
}


/**
* @about Redirect if Network Tab is Opened
*/
final private function redirect()
{
wp_safe_redirect( network_admin_url( '/settings.php?page=' . $this->plugin_name ) );
exit;
}


Expand Down
26 changes: 9 additions & 17 deletions classes/class-cleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,14 @@ final private function checkData()

if ( $warning == true ) {
// Set Old Data Found Marker
update_option( $this->option_name . 'old_data', '1', '', 'no' );
update_option( $this->option_name . 'cleaner_old_data', true, 'no' );

// Display Message
parent::message( 'yesolddata', 'error' );

} else {
// Remove Old Data Marker
if ( get_option( $this->option_name . 'old_data' ) ) {
delete_option( $this->option_name . 'old_data' );
}
delete_option( $this->option_name . 'cleaner_old_data' );

// Display Message
parent::message( 'noolddata', 'updated' );
Expand Down Expand Up @@ -146,7 +144,7 @@ final private function cleanData()
}

// Run Full Check Again
$this->check();
$this->checkData();
}


Expand All @@ -165,16 +163,14 @@ final private function checkPhysical()

if ( $warning == true ) {
// Set Old Data Found Marker
update_option( $this->option_name . 'physical', '1', '', 'no' );
update_option( $this->option_name . 'cleaner_physical', true, 'no' );

// Display Message
parent::message( 'yesphysical', 'error' );

} else {
// Remove Old Data Marker
if ( get_option( $this->option_name . 'physical' ) ) {
delete_option( $this->option_name . 'physical' );
}
delete_option( $this->option_name . 'cleaner_physical' );

// Display Message
parent::message( 'nophysical', 'updated' );
Expand All @@ -191,7 +187,7 @@ final private function checkPhysical()
final private function cleanPhysical()
{
// Remove Real Robots.txt File
if ( file_exists ( get_home_path() . 'robots.txt' ) ) {
if ( is_writable( get_home_path() . 'robots.txt' ) ) {
unlink( get_home_path() . 'robots.txt' );
}

Expand All @@ -204,9 +200,7 @@ final private function cleanPhysical()
parent::message( 'nophysical', 'updated' );

// Remove Old Data Marker
if ( get_option( $this->option_name . 'physical' ) ) {
delete_option( $this->option_name . 'physical' );
}
delete_option( $this->option_name . 'cleaner_physical' );
}
}

Expand Down Expand Up @@ -250,17 +244,15 @@ final private function checkRewrite()

// Bad Rewrite Rules
if( $warning == true ) {
update_option( $this->option_name . 'rewrite', '1', 'no' );
update_option( $this->option_name . 'cleaner_rewrite', true, 'no' );

// Display Message
parent::message( 'norewrite', 'error' );
}

// Good Rule Found
if( $warning == false ) {
if ( delete_option( $this->option_name . 'rewrite' ) ) {
delete_option( $this->option_name . 'rewrite' );
}
delete_option( $this->option_name . 'cleaner_rewrite' );

// Display Message
parent::message( 'yesrewrite', 'updated' );
Expand Down
6 changes: 4 additions & 2 deletions classes/class-disable.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ final private function deleteNetwork()
delete_option( $this->option_name . 'network_robotstxt' );
delete_option( $this->option_name . 'network_preset' );
delete_option( $this->option_name . 'network_status' );
delete_option( $this->option_name . 'old_data' );
delete_option( $this->option_name . 'settings' );
delete_option( $this->option_name . 'cleaner_old_data' );
delete_option( $this->option_name . 'cleaner_physical' );
delete_option( $this->option_name . 'cleaner_rewrite' );
delete_option( 'msrtm_settings' );

// Return To Previous Website
Expand Down Expand Up @@ -163,7 +165,7 @@ final private function disableWebsite()
final private function disableDefault()
{
// Set Disable
update_option( $this->option_name . 'default', true );
update_option( $this->option_name . 'default', true, 'no' );

// Display Message
parent::message( 'disabledefault', 'updated' );
Expand Down
69 changes: 17 additions & 52 deletions classes/class-extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* @about Core Manager Class
*
* @method __construct() Set Parent Variables
* @method pluginRedirect() Redirect if Network Tab is Opened
* @method message() Display Messages To User
* @method status() Get The Current Status Of The Plugin
* @method getNetworkRobotstxt() Get Root/Network Robots.txt File
Expand Down Expand Up @@ -44,9 +43,6 @@ class MsRobotstxtManager_Extended
// Path To Plugin Templates
public $templates;

// Tab Names
public $tabs;

// Base Option Name
public $option_name;

Expand All @@ -66,42 +62,11 @@ function __construct()
$this->templates = MS_ROBOTSTXT_MANAGER_TEMPLATES;
$this->option_name = MS_ROBOTSTXT_MANAGER_OPTION_NAME;

// Website Tabs Names: &tab=home
if ( ! is_network_admin() ) {
$this->tabs = array(
'website' => __( 'Website', 'multisite-robotstxt-manager' ),
'network' => __( 'Network', 'multisite-robotstxt-manager' ),
);

// Redirect if Network Tab is Opened
if ( $this->qString( 'tab' ) == 'network' ) {
$this->pluginRedirect();
}
}

// Network Tabs Names: &tab=home
if ( is_network_admin() ) {
$this->tabs = array(
'network' => __( 'Network', 'multisite-robotstxt-manager' ),
'cleaner' => __( 'Cleaner', 'multisite-robotstxt-manager' ),
);
}

// Plugin Extension: Version 3.0.0
if ( ! defined( 'MSRTM_TEMPLATES' ) && defined( 'MSRTM' ) ) { $this->msrtm = new MSRTM_Extension(); }
}


/**
* @about Redirect if Network Tab is Opened
*/
final public function pluginRedirect()
{
wp_safe_redirect( $this->base_url . '/wp-admin/network/settings.php?page=' . $this->plugin_name );
exit;
}


/**
* @about Display Messages To User
* @param string $slug Which switch to load
Expand All @@ -119,63 +84,63 @@ final public function message( $slug, $notice_type = false )
break;

case 'presetfailed':
$message = __( 'The Preset Option <u>Failed</u> To Update!', 'multisite-robotstxt-manager' );
$message = __( '<u>Error</u>: Preset robots.txt file failed to update.', 'multisite-robotstxt-manager' );
break;

case 'networkrobotstxtsaved':
$message = __( '<u>Saved</u>: The Network Robots.txt File Has Been Saved!', 'multisite-robotstxt-manager' );
$message = __( '<u>Saved</u>: The network robots.txt file has been saved.', 'multisite-robotstxt-manager' );
break;

case 'networkmemberupdated':
$message = __( '<u>Blogs You Are Member Of Have Been Updated</u>: The saved network robots.txt file has been published to allowed websites.', 'multisite-robotstxt-manager' );
$message = __( '<u>Success</u>: The saved network robots.txt file has been published to allowed websites.', 'multisite-robotstxt-manager' );
break;

case 'networkglobalupdated':
$message = __( '<u>All Network Websites Have Been Updated</u>: The saved network robots.txt file has been published to all network websites.', 'multisite-robotstxt-manager' );
$message = __( '<u>Success</u>: The saved network robots.txt file has been published to all network websites.', 'multisite-robotstxt-manager' );
break;

case 'networkfailed':
$message = __( 'Network Settings <u>Failed</u> To Update!', 'multisite-robotstxt-manager' );
$message = __( '<u>Error</u>: Network settings failed to update.', 'multisite-robotstxt-manager' );
break;

case 'disablenetwork':
$message = __( '<u>Network Disabled</u>: The Multisite Robots.txt Manager Plugin is no longer managing robots.txt files across network websites.', 'multisite-robotstxt-manager' );
$message = __( '<u>Network Disabled</u>: The Multisite Robots.txt Manager plugin is no longer managing robots.txt files across network websites.', 'multisite-robotstxt-manager' );
break;

case 'deletenetwork':
$message = __( '<u>All Saved Settings Deleted</u>: All Multisite Robots.txt Manager Plugin settings have been removed across the network.', 'multisite-robotstxt-manager' );
$message = __( '<u>Settings Deleted</u>: All Multisite Robots.txt Manager plugin settings have been removed across the network.', 'multisite-robotstxt-manager' );
break;

case 'disablewebsite':
$message = __( '<u>Website Disabled</u>: The Multisite Robots.txt Manager Plugin is no longer managing the robots.txt file on this website.', 'multisite-robotstxt-manager' );
break;

case 'disablefailed':
$message = __( '<u>Notice</u>: No Settings Disabled or Deleted!', 'multisite-robotstxt-manager' );
$message = __( '<u>Notice</u>: No settings disabled or deleted!', 'multisite-robotstxt-manager' );
break;

case 'websiteupdated':
$message = __( 'Website Robots.txt File Has Been <u>Updated</u>!', 'multisite-robotstxt-manager' );
$message = __( '<u>Success</u>: The robots.txt file has been updated.', 'multisite-robotstxt-manager' );
break;

case 'noappendrules':
$message = __( '<u>Notice</u>: No Robots.txt Rules or Append Rules Found!', 'multisite-robotstxt-manager' );
$message = __( '<u>Notice</u>: No robots.txt rules or append rules found!', 'multisite-robotstxt-manager' );
break;

case 'noolddata':
$message = __( '<u>Network Is Clean</u>: No Old Data Found.', 'multisite-robotstxt-manager' );
$message = __( '<u>Network Is Clean</u>: No old data found.', 'multisite-robotstxt-manager' );
break;

case 'yesolddata':
$message = __( '<u>Warning</u>: Old Robots.txt File Data Found! Scroll down and click the "remove old data" button to remove the old data.', 'multisite-robotstxt-manager' );
$message = __( '<u>Warning</u>: Old robots.txt file data found! Scroll down and click the "remove old data" button to remove the old data.', 'multisite-robotstxt-manager' );
break;

case 'norewrite':
$message = __( '<u>Warning</u>: Missing Robots.txt Rewrite Rule! Scroll down and click the "correct missing rules" button to add the missing rule.', 'multisite-robotstxt-manager' );
$message = __( '<u>Warning</u>: Missing robots.txt rewrite rule! Scroll down and click the "correct missing rules" button to add the missing rule.', 'multisite-robotstxt-manager' );
break;

case 'yesrewrite':
$message = __( '<u>Network Is Clean</u>: All Network Websites Have The Proper Rewrite Rule.', 'multisite-robotstxt-manager' );
$message = __( '<u>Network Is Clean</u>: All network websites have the proper rewrite rule.', 'multisite-robotstxt-manager' );
break;

case 'nophysical':
Expand All @@ -187,15 +152,15 @@ final public function message( $slug, $notice_type = false )
break;

case 'badphysical':
$message = __( '<u>Warning</u>: The plugin was unable to delete it due to file permissions. You will need to manually delete the real robots.txt file, then run the scan again.', 'multisite-robotstxt-manager' );
$message = __( '<u>Warning</u>: The plugin was unable to delete the robots.txt file due to file permissions. You will need to manually delete the real robots.txt file.', 'multisite-robotstxt-manager' );
break;

case 'disabledefault':
$message = __( 'Network robots.txt file <u>disabled</u> on this website, you can now fully customize the robots.txt file. No changes to the robots.txt file has been made. You need to create your robots.txt file below, the click the "update website rules" button to change the robots.txt file.', 'multisite-robotstxt-manager' );
$message = __( '<u>Success</u>: The network robots.txt file disabled on this website, you can now fully customize the robots.txt file. No changes to the robots.txt file has been made. You need to create your robots.txt file below, the click the "update website rules" button to change the robots.txt file.', 'multisite-robotstxt-manager' );
break;

case 'enabledefault':
$message = __( 'The network robots.txt file on this website has been <u>enabled</u>, restoring the default behavior. No changes to the robots.txt file has been made. You need to modify the append rules below, the click the "update website rules" button to change the robots.txt file.', 'multisite-robotstxt-manager' );
$message = __( '<u>Success</u>: The network robots.txt file on this website has been enabled, restoring the default behavior. No changes to the robots.txt file has been made. You need to modify the append rules below, the click the "update website rules" button to change the robots.txt file.', 'multisite-robotstxt-manager' );
break;
}

Expand Down
Loading

0 comments on commit be6318d

Please sign in to comment.