Skip to content

Commit

Permalink
Merge pull request #20 from mehul0810/release/1.2.3
Browse files Browse the repository at this point in the history
Release/1.2.3
  • Loading branch information
mehul0810 authored Dec 31, 2019
2 parents 0015134 + 576a471 commit 8ab0784
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 65 deletions.
69 changes: 41 additions & 28 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,34 +273,6 @@ function perform_load_modules_on_init() {

}

/**
* Set Post Revisions Limit.
*
* @since 1.0.0
*/
$post_revisions_limit = perform_get_option( 'limit_post_revisions', 'perform_common' );
if ( ! empty( $post_revisions_limit ) ) {
Perform()->config->exists( 'constant', 'WP_POST_REVISIONS' ) ?
Perform()->config->update( 'constant', 'WP_POST_REVISIONS', $post_revisions_limit ) :
Perform()->config->add( 'constant', 'WP_POST_REVISIONS', $post_revisions_limit );
} else {
Perform()->config->remove( 'constant', 'WP_POST_REVISIONS' );
}

/**
* Set Autosave Interval.
*
* @since 1.0.0
*/
$autosave_interval = perform_get_option( 'autosave_interval', 'perform_common' );
if ( ! empty( $autosave_interval ) ) {
Perform()->config->exists( 'constant', 'AUTOSAVE_INTERVAL' ) ?
Perform()->config->update( 'constant', 'AUTOSAVE_INTERVAL', $autosave_interval ) :
Perform()->config->add( 'constant', 'AUTOSAVE_INTERVAL', $autosave_interval );
} else {
Perform()->config->remove( 'constant', 'AUTOSAVE_INTERVAL' );
}

// Load WooCommerce Manager module when WooCommerce is active.
if ( perform_is_woocommerce_active() ) {
/**
Expand All @@ -327,6 +299,47 @@ function perform_load_modules_on_init() {

add_action( 'init', 'perform_load_modules_on_init', 0 );

function perform_define_necessary_constants() {

/**
* Set Autosave Interval.
*
* @since 1.0.0
*/
$autosave_interval = perform_get_option( 'autosave_interval', 'perform_common' );

// If `Autosave Interval` is already defined in `wp-config.php` then leave it as is.
if ( ! empty( $autosave_interval ) && ! defined( 'AUTOSAVE_INTERVAL' ) ) {
define( 'AUTOSAVE_INTERVAL', $autosave_interval );
}

/**
* Set Post Revisions Limit.
*
* @since 1.0.0
*/
$post_revisions_limit = perform_get_option( 'limit_post_revisions', 'perform_common' );

// If `Post Revisions` is already defined in `wp-config.php` then leave it as is.
if ( ! empty( $post_revisions_limit ) && ! defined( 'WP_POST_REVISIONS' ) ) {
define( 'WP_POST_REVISIONS', $post_revisions_limit );
}

/**
* Force Admin SSL.
*
* @since 1.2.3
*/
$is_ssl_enabled = perform_get_option( 'enable_ssl', 'perform_ssl', false );

// If `Force Admin SSL` is already defined in `wp-config.php` then leave it as is.
if ( ! empty( $is_ssl_enabled ) && ! defined( 'FORCE_SSL_ADMIN' ) ) {
define( 'FORCE_SSL_ADMIN', 'true' );
}
}

add_action( 'perform_loaded', 'perform_define_necessary_constants' );

/**
* Load SSL Manager.
*
Expand Down
15 changes: 3 additions & 12 deletions includes/modules/class-perform-ssl-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,10 @@ public function __construct() {

$this->is_ssl_enabled = perform_get_option( 'enable_ssl', 'perform_ssl', false );

if ( $this->is_ssl_enabled ) {

// Forcing SSL for admin.
Perform()->config->exists( 'constant', 'FORCE_SSL_ADMIN' ) ?
Perform()->config->update( 'constant', 'FORCE_SSL_ADMIN', 'true' ) :
Perform()->config->add( 'constant', 'FORCE_SSL_ADMIN', 'true' );

// Proceed, only if site accessed with non-HTTP url.
if ( ! is_ssl() ) {
$this->wp_redirect_to_ssl();
}
// Proceed, only if site accessed with non-HTTP url.
if ( ! is_ssl() && $this->is_ssl_enabled ) {
$this->wp_redirect_to_ssl();
}

}

/**
Expand Down
16 changes: 8 additions & 8 deletions languages/perform.pot
Original file line number Diff line number Diff line change
Expand Up @@ -521,34 +521,34 @@ msgstr ""
msgid "Manage Assets"
msgstr ""

#: perform.php:93, perform.php:106
#: perform.php:83, perform.php:96
msgid "Cheatin’ huh?"
msgstr ""

#: perform.php:289
#: perform.php:290
msgid "Your site could be faster and more secure with a newer PHP version."
msgstr ""

#: perform.php:290
#: perform.php:291
msgid "Hey, we've noticed that you're running an outdated version of PHP. PHP is the programming language that WordPress and Perform for WordPress are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we're sending you this notice."
msgstr ""

#: perform.php:291
#: perform.php:292
msgid "Hosts have the ability to update your PHP version, but sometimes they don't dare to do that because they're afraid they'll break your site."
msgstr ""

#: perform.php:292
#: perform.php:293
msgid "To which version should I update?"
msgstr ""

#: perform.php:293
#: perform.php:294
msgid "You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It's also the only PHP version still in active development and therefore the better option for your site in the long run."
msgstr ""

#: perform.php:294
#: perform.php:295
msgid "Can't update? Ask your host!"
msgstr ""

#: perform.php:295
#: perform.php:296
msgid "If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don't want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s."
msgstr ""
33 changes: 17 additions & 16 deletions perform.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Plugin Name: Perform - Performance Optimization Plugin for WordPress
* Plugin URI: https://performwp.com/
* Description: This plugin adds toolset for performance and speed improvements to your WordPress sites.
* Version: 1.2.2
* Version: 1.2.3
* Author: Mehul Gohil
* Author URI: https://www.mehulgohil.in/
* License: GPLv2 or later
Expand Down Expand Up @@ -67,16 +67,6 @@ final class Perform {
*/
public $settings;

/**
* Config Object to transform.
*
* @since 1.2.2
* @access public
*
* @var WPConfigTransformer object
*/
public $config;

/**
* Throw error on object clone.
*
Expand Down Expand Up @@ -172,11 +162,25 @@ function_exists( 'phpversion' ) &&
*/
public function init() {

/**
* This action will be used before init of the plugin.
*
* @since 1.2.3
*/
do_action( 'perform_before_init' );

// Set up localization.
$this->load_textdomain();

$this->settings = new Perform_Admin_Settings();
$this->config = new WPConfigTransformer( ABSPATH . 'wp-config.php' );

/**
* This action will be used after the plugin is loaded
*
* @since 1.2.3
*/
do_action( 'perform_loaded' );

}

/**
Expand All @@ -191,7 +195,7 @@ private function setup_constants() {

// Plugin version.
if ( ! defined( 'PERFORM_VERSION' ) ) {
define( 'PERFORM_VERSION', '1.2.2' );
define( 'PERFORM_VERSION', '1.2.3' );
}

// Minimum Required PHP version.
Expand Down Expand Up @@ -236,9 +240,6 @@ public function includes() {
require_once PERFORM_PLUGIN_DIR . '/includes/admin/class-perform-admin-settings-api.php';
require_once PERFORM_PLUGIN_DIR . '/includes/admin/class-perform-admin-settings.php';

// Load Libraries.
require_once PERFORM_PLUGIN_DIR . '/includes/libraries/WPConfigTransformer.php';

// Load Frontend Files.
require_once PERFORM_PLUGIN_DIR . '/includes/install.php';
require_once PERFORM_PLUGIN_DIR . '/includes/actions.php';
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: https://mehulgohil.com/donate/
Requires at least: 4.8
Tested up to: 5.3
Requires PHP: 5.6
Stable tag: 1.2.2
Stable tag: 1.2.3
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -98,6 +98,9 @@ Please make sure you make a backup of your database before updating any version

== Changelog ==

= 1.2.3: December 31st, 2019 =
Resolved fatal error when `wp-config.php` file is not writable

= 1.2.2: December 27th, 2019 =
Fix: cdn rewrite is not working [#16](https://github.com/mehul0810/perform/issues/16)
UI Improvements for Assets Manager
Expand Down

0 comments on commit 8ab0784

Please sign in to comment.