Skip to content

Commit

Permalink
Version 1.1.4 (#176)
Browse files Browse the repository at this point in the history
- Fix: Flush permalinks on plugin update to Elementor error when trying to edit the Header/Footer.
- Setup database upgrades routines to run functions after HFE has been updated on a users website.
  • Loading branch information
Nikschavan authored Aug 27, 2019
1 parent 03cae02 commit 7b5a791
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 7 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
**Donate link:** https://www.paypal.me/BrainstormForce
**Requires at least:** 4.4
**Requires PHP:** 5.4
**Tested up to:** 5.0
**Stable tag:** 1.1.3
**Tested up to:** 5.2
**Stable tag:** 1.1.4
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -115,6 +115,9 @@ If the above is nnot possible, You can also add support for the plugin from your

## Changelog ##

### 1.1.4 ###
- Fix: Flush permalinks on plugin update to Elementor error when trying to edit the Header/Footer.

### 1.1.3 ###
- Improvement: Allow changing the permalinks for the hfe templates (<a href="https://github.com/Nikschavan/header-footer-elementor/pull/162/">#162</a>)
- Fix: WPML Translations do not work when using the Elementor Template as a shortcode. (<a href="https://github.com/Nikschavan/header-footer-elementor/pull/159/">#159</a>)
Expand Down
4 changes: 2 additions & 2 deletions header-footer-elementor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* Author URI: https://www.brainstormforce.com/
* Text Domain: header-footer-elementor
* Domain Path: /languages
* Version: 1.1.3
* Version: 1.1.4
*
* @package header-footer-elementor
*/

define( 'HFE_VER', '1.1.3' );
define( 'HFE_VER', '1.1.4' );
define( 'HFE_DIR', plugin_dir_path( __FILE__ ) );
define( 'HFE_URL', plugins_url( '/', __FILE__ ) );
define( 'HFE_PATH', plugin_basename( __FILE__ ) );
Expand Down
3 changes: 3 additions & 0 deletions inc/class-header-footer-elementor.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public function includes() {

// Load the Admin Notice Class.
require_once HFE_DIR . 'inc/class-hfe-notices.php';

// Setup upgrade routines.
require_once HFE_DIR . 'inc/class-hfe-update.php';
}

/**
Expand Down
97 changes: 97 additions & 0 deletions inc/class-hfe-update.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php
/**
* Theme Update
*
* @package Header Footer Elementor
* @author Nikhil Chavan <[email protected]>
* @copyright Copyright (c) 2019, Header Footer Elementor
* @link https://github.com/Nikschavan/header-footer-elementor/
* @since HFE 1.1.4
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

if ( ! class_exists( 'HFE_Update' ) ) {

/**
* HFE_Update initial setup
*
* @since 1.1.4
*/
class HFE_Update {

/**
* Option key for stored version number.
*
* @since 1.1.4
* @var string
*/
private $db_option_key = '_hfe_db_version';

/**
* Constructor
*
* @since 1.1.4
*/
public function __construct() {

// Theme Updates.
if ( is_admin() ) {
add_action( 'admin_init', array( $this, 'init' ), 5 );
} else {
add_action( 'wp', array( $this, 'init' ), 5 );
}
}

/**
* Implement theme update logic.
*
* @since 1.1.4
*/
public function init() {
do_action( 'hfe_update_before' );

if ( ! $this->needs_db_update() ) {
return;
}

// flush rewrite rules on plugin update.
flush_rewrite_rules();

$this->update_db_version();

do_action( 'hfe_update_after' );
}

/**
* Check if db upgrade is required.
*
* @since 1.1.4
* @return true|false True if stored database version is lower than constant; false if otherwise.
*/
private function needs_db_update() {
$db_version = get_option( $this->db_option_key, false );

if ( false === $db_version || version_compare( $db_version, HFE_VER ) ) {
return true;
}

return false;
}

/**
* Update DB version.
*
* @since 1.1.4
* @return void
*/
private function update_db_version() {
update_option( $this->db_option_key, HFE_VER );
}

}
}

new HFE_Update();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "header-footer-elementor",
"version": "1.1.3",
"version": "1.1.4",
"main": "Gruntfile.js",
"author": "Nikhil Chavan",
"devDependencies": {
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Tags: elementor, header footer builder, header, footer, page builder, template b
Donate link: https://www.paypal.me/BrainstormForce
Requires at least: 4.4
Requires PHP: 5.4
Tested up to: 5.0
Stable tag: 1.1.3
Tested up to: 5.2
Stable tag: 1.1.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -115,6 +115,9 @@ If the above is nnot possible, You can also add support for the plugin from your

== Changelog ==

= 1.1.4 =
- Fix: Flush permalinks on plugin update to Elementor error when trying to edit the Header/Footer.

= 1.1.3 =
- Improvement: Allow changing the permalinks for the hfe templates (<a href="https://github.com/Nikschavan/header-footer-elementor/pull/162/">#162</a>)
- Fix: WPML Translations do not work when using the Elementor Template as a shortcode. (<a href="https://github.com/Nikschavan/header-footer-elementor/pull/159/">#159</a>)
Expand Down

0 comments on commit 7b5a791

Please sign in to comment.