Plugin Directory

Changeset 2322741


Ignore:
Timestamp:
06/12/2020 02:49:17 AM (6 years ago)
Author:
davejesch
Message:
  • enhancement: Update .htaccess rules for Apache 2.4.
  • enhancement: Check for minimum WPSiteSync version and disable plugin if WPSiteSync not found or not minimum version.
Location:
wpsitesync-for-http-authentication
Files:
8 added
3 edited

Legend:

Unmodified
Added
Removed
  • wpsitesync-for-http-authentication/trunk/.htaccess

    r1651877 r2322741  
    1 <Files *.php>
    2     Order Deny,Allow
    3     deny from all
    4 </Files>
     1# Apache 2.2
     2<IfModule !mod_authz_core.c>
     3    Satisfy Any
    54
    6 <files ".(xml|css|jpe?g|png|gif|js|ttf|wof|eof)$">
    7     Order Allow,Deny
    8     Allow from all
    9 </files>
     5    <Files *.php>
     6        Require all denied
     7    </Files>
     8
     9    <Files ~*.txt>
     10        Order Deny,Allow
     11        deny from all
     12    </Files>
     13
     14    <files ".(xml|css|jpe?g|png|gif|js|ttf|wof|eof)$">
     15        Order Allow,Deny
     16        Allow from all
     17    </files>
     18</IfModule>
     19
     20
     21# Apache 2.4
     22<IfModule mod_authz_core.c>
     23    Require all granted
     24
     25    <Files *.php>
     26        Require all denied
     27    </Files>
     28
     29    <Files ~*.txt>
     30        Require all denied
     31    </Files>
     32
     33    <files ".(xml|css|jpe?g|png|gif|js|ttf|wof|eof)$">
     34        Require all granted
     35    </files>
     36</IfModule>
  • wpsitesync-for-http-authentication/trunk/readme.txt

    r2199287 r2322741  
    5656
    5757== Changelog ==
     58= 1.1 - Jun 11, 2020 =
     59* enhancement: Update .htaccess rules for Apache 2.4.
     60* enhancement: Check for minimum WPSiteSync version and disable plugin if WPSiteSync not found or not minium version.
     61
    5862= 1.0.0 - May 4, 2017 =
    5963Initial release to WordPress repository.
  • wpsitesync-for-http-authentication/trunk/wpsitesync-httpauth.php

    r1651877 r2322741  
    66Author: WPSiteSync
    77Author URI: http://serverpress.com
    8 Version: 1.0
     8Version: 1.1
    99Text Domain: wpsitesync-httpauth
    1010
     
    2323    {
    2424        add_action('spectrom_sync_init', array($this, 'init'));
     25        if (is_admin())
     26            add_action('wp_loaded', array($this, 'wp_loaded'));
    2527    }
    2628
     
    4648        }
    4749        add_filter('spectrom_sync_api_arguments', array($this, 'filter_api_args'), 10, 2);
     50    }
     51
     52    /**
     53     * Called when WP is loaded so we can check if parent plugin is active.
     54     */
     55    public function wp_loaded()
     56    {
     57        if (is_admin() && !class_exists('WPSiteSyncContent', FALSE) && current_user_can('activate_plugins')) {
     58            add_action('admin_notices', array($this, 'notice_requires_wpss'));
     59            add_action('admin_init', array($this, 'disable_plugin'));
     60        }
     61    }
     62
     63    /**
     64     * Displays the warning message stating that WPSiteSync is not present.
     65     */
     66    public function notice_requires_wpss()
     67    {
     68        $install = admin_url('plugin-install.php?tab=search&s=wpsitesync');
     69        $activate = admin_url('plugins.php');
     70        $msg = sprintf(__('The <em>WPSiteSync for HTTP Authentication</em> plugin requires the main <em>WPSiteSync for Content</em> plugin to be installed and activated. Please %1$sclick here</a> to install or %2$sclick here</a> to activate.', 'wpsitesync-httpauth'),
     71                    '<a href="' . $install . '">',
     72                    '<a href="' . $activate . '">');
     73        $this->_show_notice($msg, 'notice-warning');
     74    }
     75
     76    /**
     77     * Helper method to display notices
     78     * @param string $msg Message to display within notice
     79     * @param string $class The CSS class used on the <div> wrapping the notice
     80     * @param boolean $dismissable TRUE if message is to be dismissable; otherwise FALSE.
     81     */
     82    private function _show_notice($msg, $class = 'notice-success', $dismissable = FALSE)
     83    {
     84        echo '<div class="notice ', $class, ' ', ($dismissable ? 'is-dismissible' : ''), '">';
     85        echo '<p>', $msg, '</p>';
     86        echo '</div>';
     87    }
     88
     89    /**
     90     * Disables the plugin if WPSiteSync not installed
     91     */
     92    public function disable_plugin()
     93    {
     94        deactivate_plugins(plugin_basename(__FILE__));
    4895    }
    4996
Note: See TracChangeset for help on using the changeset viewer.