Skip to content

Commit

Permalink
Fix fatal error if plugin options don't exist yet
Browse files Browse the repository at this point in the history
  • Loading branch information
mandiwise committed Jul 5, 2014
1 parent e85e109 commit e7746a1
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ Yes, but no translations are available quite yet.

## Changelog

### 2.0.1
* Fixed fatal error on activation

### 2.0
* Refactored all plugin code
* Revamped the plugin settings page to allow users to save multiple post loops (this is a breaking change)
Expand Down
2 changes: 1 addition & 1 deletion admin/class-isotope-posts-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function delete_post_loop() {
die();

$loop_id = isset( $_POST['loop_id'] ) ? $_POST['loop_id'] : null;
$isotope_loops = !empty( get_option('isotope_options') ) ? get_option( 'isotope_options' ) : array();
$isotope_loops = ( get_option('isotope_options') != false ) ? get_option( 'isotope_options' ) : array();

// Check for the loop ID in the plugin options (deletion occurs in validation callback)
if ( $loop_id && $isotope_loops && array_key_exists( $loop_id, $isotope_loops ) ) {
Expand Down
4 changes: 2 additions & 2 deletions admin/views/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

<?php
// Check for existing loops to display
$isotope_loops = !empty( get_option('isotope_options') ) ? get_option( 'isotope_options' ) : array();
$isotope_loops = ( get_option('isotope_options') != false ) ? get_option( 'isotope_options' ) : array();
?>

<div id="isotope-loops">

<h3>Isotope Post Shortcodes</h3>

<?php if ( !empty( $isotope_loops ) ) : ?>
<?php if ( $isotope_loops ) : ?>

<p><?php _e( 'Here are the Isotope Posts shortcodes you\'ve saved so far:', $this->plugin_slug ); ?></p>

Expand Down
2 changes: 1 addition & 1 deletion admin/views/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public function validate_settings( $input = array() ) {
$loop_id = isset( $_POST['loop_id'] ) ? $_POST['loop_id'] : null;

// Check if any options already exist
$isotope_loops = !empty( get_option('isotope_options') ) ? get_option( 'isotope_options' ) : array();
$isotope_loops = ( get_option( 'isotope_options' ) != false ) ? get_option( 'isotope_options' ) : array();

if ( $save_flag == 'delete' ) {

Expand Down
2 changes: 1 addition & 1 deletion isotope-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: Isotope Posts
* Plugin URI: http://mandiwise.com/wordpress/isotope-posts/
* Description: Allows you to use Metafizzy's Isotope to display feeds of WordPress posts using simple shortcodes. Works with custom post types and custom taxonomies too.
* Version: 2.0.0
* Version: 2.0.1
* Author: Mandi Wise
* Author URI: http://mandiwise.com
* Text Domain: isotope-posts
Expand Down
2 changes: 1 addition & 1 deletion public/class-isotope-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Isotope_Posts {
*
* @var string
*/
const VERSION = '2.0.0';
const VERSION = '2.0.1';

/**
* Unique identifier for the plugin.
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: mandiwise
Tags: isotope, jquery, posts
Requires at least: 3.5.1
Tested up to: 3.9.1
Stable tag: 2.0.0
Stable tag: 2.0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -83,6 +83,9 @@ Yes, but no translations are available quite yet.

== Changelog ==

= 2.0.1 =
* Fixed fatal error on activation

= 2.0 =
* Refactored all plugin code
* Revamped the plugin settings page to allow users to save multiple post loops (this is a breaking change)
Expand Down

0 comments on commit e7746a1

Please sign in to comment.