Plugin Directory

Changeset 213203


Ignore:
Timestamp:
03/04/2010 10:07:49 PM (16 years ago)
Author:
fpoller
Message:

Adding 0.2

Location:
private-wp-suite
Files:
2 edited
4 copied

Legend:

Unmodified
Added
Removed
  • private-wp-suite/tags/0.2/private-wp-suite.php

    r213181 r213203  
    3131    Plugin URI: http://poller.se/code/wordpress-plugins/
    3232    Description: Adds option in the admin panel for making your blog (including rss feeds and uploaded files) private.
    33     Version: 0.1
     33    Version: 0.2
    3434    Author: Fredrik Poller
    3535    Author URI: http://poller.se/
     
    6464            $plrpws_upload_path = 'wp-content/uploads';
    6565
     66        $plrpws_htaccess_file   = $plrpws_upload_path . '/.htaccess';
     67
    6668        // Stolen from wp-includes/vars.php, used to give correct notices to the user below
    6769        $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false);
     
    6971        // If upload protection is enabled, check that .htaccess file is in place. If it isn't, try to create it. If it can't be created, warn the user.
    7072        if($plrpws_protect_uploads) {
    71             $plrpws_htaccess_file    = $plrpws_upload_path . '/.htaccess';
    7273            $plrpws_htaccess_content = "# Start Private WP suite rewrite rules\nRewriteEngine On\nRewriteBase $plrpws_wp_path/$plrpws_upload_path/\nRewriteRule . $plrpws_wp_path/nonexsistent_file_to_trigger_404_error\nOptions -Indexes\n# End Private WP suite rewrite rules\n";
    7374            if(file_exists(ABSPATH . $plrpws_htaccess_file)) {
     
    9091                }
    9192            }
     93        } else {
     94            // Upload protection disabled, we should remove the .htaccess file if it exists
     95            if(file_exists(ABSPATH . $plrpws_htaccess_file))
     96                @unlink(ABSPATH . $plrpws_htaccess_file);
    9297        }
    9398
     
    215220    // Hook into the 404 page
    216221    add_filter('404_template', 'plrpws_protect_uploads');
     222
     223    // Function to run when deactivating plugin
     224    function plrpws_deactivate() {
     225        // Remove .htaccess if it exists
     226        $plrpws_upload_path     = get_option('upload_path');
     227        if(!$plrpws_upload_path)
     228            $plrpws_upload_path = 'wp-content/uploads';
     229
     230        $plrpws_htaccess_file   = $plrpws_upload_path . '/.htaccess';
     231
     232        if(file_exists(ABSPATH . $plrpws_htaccess_file))
     233            @unlink(ABSPATH . $plrpws_htaccess_file);
     234
     235        // Delete old options
     236        delete_option('plrpws_protect_blog');
     237        delete_option('plrpws_protect_feeds');
     238        delete_option('plrpws_protect_uploads');
     239        delete_option('plrpws_exceptions');
     240    }
     241
     242    // Register deactivation function
     243    register_deactivation_hook(__FILE__, 'plrpws_deactivate');
    217244
    218245    // Function to check if visitor is excempt, used in other functions
  • private-wp-suite/tags/0.2/readme.txt

    r213181 r213203  
    44Requires at least: 2.9
    55Tested up to: 2.9.2
    6 Stable tag: 0.1
     6Stable tag: 0.2
    77
    88Adds option in the admin panel for making your blog (including rss feeds and uploaded files) private.
     
    2929== Changelog ==
    3030
     31= 0.2 =
     32* Added deactivation function
     33
    3134= 0.1 =
    3235* Initial release
  • private-wp-suite/trunk/private-wp-suite.php

    r213181 r213203  
    3131    Plugin URI: http://poller.se/code/wordpress-plugins/
    3232    Description: Adds option in the admin panel for making your blog (including rss feeds and uploaded files) private.
    33     Version: 0.1
     33    Version: 0.2
    3434    Author: Fredrik Poller
    3535    Author URI: http://poller.se/
     
    6464            $plrpws_upload_path = 'wp-content/uploads';
    6565
     66        $plrpws_htaccess_file   = $plrpws_upload_path . '/.htaccess';
     67
    6668        // Stolen from wp-includes/vars.php, used to give correct notices to the user below
    6769        $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false);
     
    6971        // If upload protection is enabled, check that .htaccess file is in place. If it isn't, try to create it. If it can't be created, warn the user.
    7072        if($plrpws_protect_uploads) {
    71             $plrpws_htaccess_file    = $plrpws_upload_path . '/.htaccess';
    7273            $plrpws_htaccess_content = "# Start Private WP suite rewrite rules\nRewriteEngine On\nRewriteBase $plrpws_wp_path/$plrpws_upload_path/\nRewriteRule . $plrpws_wp_path/nonexsistent_file_to_trigger_404_error\nOptions -Indexes\n# End Private WP suite rewrite rules\n";
    7374            if(file_exists(ABSPATH . $plrpws_htaccess_file)) {
     
    9091                }
    9192            }
     93        } else {
     94            // Upload protection disabled, we should remove the .htaccess file if it exists
     95            if(file_exists(ABSPATH . $plrpws_htaccess_file))
     96                @unlink(ABSPATH . $plrpws_htaccess_file);
    9297        }
    9398
     
    215220    // Hook into the 404 page
    216221    add_filter('404_template', 'plrpws_protect_uploads');
     222
     223    // Function to run when deactivating plugin
     224    function plrpws_deactivate() {
     225        // Remove .htaccess if it exists
     226        $plrpws_upload_path     = get_option('upload_path');
     227        if(!$plrpws_upload_path)
     228            $plrpws_upload_path = 'wp-content/uploads';
     229
     230        $plrpws_htaccess_file   = $plrpws_upload_path . '/.htaccess';
     231
     232        if(file_exists(ABSPATH . $plrpws_htaccess_file))
     233            @unlink(ABSPATH . $plrpws_htaccess_file);
     234
     235        // Delete old options
     236        delete_option('plrpws_protect_blog');
     237        delete_option('plrpws_protect_feeds');
     238        delete_option('plrpws_protect_uploads');
     239        delete_option('plrpws_exceptions');
     240    }
     241
     242    // Register deactivation function
     243    register_deactivation_hook(__FILE__, 'plrpws_deactivate');
    217244
    218245    // Function to check if visitor is excempt, used in other functions
  • private-wp-suite/trunk/readme.txt

    r213181 r213203  
    44Requires at least: 2.9
    55Tested up to: 2.9.2
    6 Stable tag: 0.1
     6Stable tag: 0.2
    77
    88Adds option in the admin panel for making your blog (including rss feeds and uploaded files) private.
     
    2929== Changelog ==
    3030
     31= 0.2 =
     32* Added deactivation function
     33
    3134= 0.1 =
    3235* Initial release
Note: See TracChangeset for help on using the changeset viewer.