Plugin Directory

Changeset 1866628


Ignore:
Timestamp:
04/30/2018 08:21:05 PM (8 years ago)
Author:
nmallare
Message:

Defaulting all JWT constants and setting up .htaccess file.

Location:
divvyhq/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • divvyhq/trunk/README.txt

    r1860162 r1866628  
    55Tested up to: 4.9.5
    66Requires PHP: 5.2.4
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4040== Changelog ==
    4141
     42= 1.0.2 =
     43Set JWT Secret Key to WP constant and configure .htaccess.
     44
    4245= 1.0.1 =
    4346Update to webhook URL.
  • divvyhq/trunk/admin/class-divvyhq-admin.php

    r1860159 r1866628  
    111111                . __('Settings', $this->plugin_name) . '</a>',
    112112        );
     113
    113114        return array_merge($settings_link, $links);
     115    }
     116
     117    /**
     118     * Update the .htaccess to add the appropriate JWT rewrite rules
     119     * so that the DivvyHQ user won't have to implement them.
     120     *
     121     * @param $rules
     122     * @return string
     123     */
     124    public function update_rewrite_rules($rules)
     125    {
     126        // This only works if this constant is available.
     127        if (defined('ABSPATH')) {
     128            // Check to see if we've already appended to the .htaccess file,
     129            // If not, write our rules.
     130            $file = file_get_contents(ABSPATH . '.htaccess');
     131
     132            if (!stripos($file, '# Begin DivvyHQ Settings')) {
     133                $divvyhqAddition = <<<DIVVYHQ
     134\n# Begin DivvyHQ Settings
     135<IfModule mod_rewrite.c>
     136RewriteCond %{HTTP:Authorization} ^(.*)
     137RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
     138SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
     139</IfModule>
     140# End DivvyHQ Settings\n
     141DIVVYHQ;
     142
     143                $result = file_put_contents(ABSPATH . '.htaccess', $divvyhqAddition, FILE_APPEND);
     144                unset($result);
     145            }
     146        }
     147
     148        return $rules;
     149    }
     150
     151    /**
     152     * Force the .htaccess changes to be written to the file.
     153     */
     154    public function flush_rewrite_rules()
     155    {
     156        global $wp_rewrite;
     157        $wp_rewrite->flush_rules();
    114158    }
    115159
  • divvyhq/trunk/divvyhq.php

    r1860159 r1866628  
    1616 * Plugin URI:        https://www.wordpress.com/
    1717 * Description:       This plugin allows users to sync their content from their WordPress instance back to DivvyHQ.
    18  * Version:           1.0.1
     18 * Version:           1.0.2
    1919 * Author:            Alluresoft, LLC
    2020 * Author URI:        https://www.divvyhq.com/
     
    3636
    3737/**
     38 * Current plugin version.
     39 */
     40define('DIVVYHQ_VERSION', '1.0.2');
     41
     42
     43/**
     44 * Set the JWT Secret Key
     45 */
     46if (!defined('JWT_AUTH_SECRET_KEY') && defined('SECURE_AUTH_SALT')) {
     47    define('JWT_AUTH_SECRET_KEY', SECURE_AUTH_SALT);
     48}
     49
     50/**
    3851 * Set timeout for JWT Auth Token
    3952 */
     
    4154    define('JWT_AUTH_EXPIRE', time() + (DAY_IN_SECONDS * 90));
    4255}
    43 
    44 /**
    45  * Current plugin version.
    46  */
    47 define('DIVVYHQ_VERSION', '1.0.1');
    4856
    4957/**
  • divvyhq/trunk/includes/class-divvyhq-activator.php

    r1859822 r1866628  
    1616     * On activate, redirect the user to the settings page.
    1717     *
    18      * @since   1.0.0
     18     * @since  1.0.0
    1919     */
    2020    public static function activate()
  • divvyhq/trunk/includes/class-divvyhq-deactivator.php

    r1859822 r1866628  
    1414{
    1515    /**
    16      * Short Description. (use period)
    17      *
    18      * Long Description.
     16     * Remove the DivvyHQ settings from WordPress.
    1917     *
    2018     * @since    1.0.0
  • divvyhq/trunk/includes/class-divvyhq.php

    r1860159 r1866628  
    5959            $this->version = DIVVYHQ_VERSION;
    6060        } else {
    61             $this->version = '1.0.1';
     61            $this->version = '1.0.2';
    6262        }
    6363
     
    147147            'add_action_links');
    148148
     149        // Used to update .htaccess with necessary rewrite rules.
     150        $this->loader->add_filter('mod_rewrite_rules', $plugin_admin, 'update_rewrite_rules');
     151        $this->loader->add_action('admin_init', $plugin_admin, 'flush_rewrite_rules');
     152
    149153        // Redirect the user to the settings page.
    150154        $this->loader->add_action('admin_init', $plugin_admin, 'settings_redirect_after_activation');
Note: See TracChangeset for help on using the changeset viewer.