Skip to content

Commit

Permalink
v1.3.3 generic backslash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Teubert committed Sep 21, 2011
1 parent 888a8ae commit 934e5bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
19 changes: 12 additions & 7 deletions archivist.php
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Archivist - Custom Archive Templates
Plugin URI: http://www.FarBeyondProgramming.com/wordpress/plugin-archivist-custom-archive
Description: Shortcode Plugin to display an archive by category, tag or custom query.
Version: 1.3.2
Version: 1.3.3
Author: Eric Teubert
Author URI: ericteubert@googlemail.com
License: MIT
Expand Down Expand Up @@ -146,7 +146,7 @@ static function get_default_template_name() {

public function create_default_template() {
$default_name = self::get_default_template_name();
$settings = get_option( 'archivist' );
$settings = $this->get_template_options();
if ( ! isset( $settings[ $default_name ] ) ) {
// TODO: refactor model archivist_settings::new
// TODO: refactor model archivist_settings::new_with_defaults
Expand Down Expand Up @@ -205,7 +205,7 @@ private function update_from_zero() {
add_option( 'archivist_default_template_name', 'default' );

// 1.3.x revalidate all settings
$settings = get_option( 'archivist' );
$settings = $this->get_template_options();
$new_settings = array();
foreach ( $settings as $template_name => $template ) {
if ( $template_name != $template[ 'name' ] ) {
Expand Down Expand Up @@ -247,6 +247,11 @@ private function update_from_zero() {
update_option( 'archivist', $new_settings );
}

private function get_template_options() {
$settings = get_option( 'archivist' );
return array_map( 'stripslashes_deep', $settings );
}

private function keep_backwards_compatibility() {
if ( ! defined( 'ARCHIVIST_VERSION' ) ) {
return;
Expand Down Expand Up @@ -403,7 +408,7 @@ public function display_by_query( $query, $template = false ) {
}

private function display_by_loop( $loop, $template = false ) {
$all_settings = get_option( 'archivist' );
$all_settings = $settings = $this->get_template_options();;

if ( ! $template ) {
$template = self::get_default_template_name();
Expand Down Expand Up @@ -465,7 +470,7 @@ private function get_plugin_data( $value = 'Version' ) {
public function settings_page() {
$tab = ( $_REQUEST[ 'tab' ] == 'add' ) ? 'add' : 'edit';
$current_template = $this->get_current_template_name();
$settings = get_option( 'archivist' );
$settings = $this->get_template_options();

if ( get_magic_quotes_gpc() ) {
// strip slashes so HTML won't be escaped
Expand Down Expand Up @@ -754,7 +759,7 @@ private function get_current_template_name() {
}

// does it still exist? might be deleted
$all_settings = get_option( 'archivist' );
$all_settings = $settings = $this->get_template_options();;
$settings = $all_settings[ $name ];
// if the setting does not exist, take the first you can get
if ( ! $settings ) {
Expand All @@ -768,7 +773,7 @@ private function settings_page_edit() {
$name = $this->get_current_template_name();
$field_name = 'archivist[' . $name . ']';

$all_template_settings = get_option( 'archivist' );
$all_template_settings = $settings = $this->get_template_options();;
$settings = $all_template_settings[ $name ];
$default_template = get_option( 'archivist_default_template_name' );
?>
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Expand Up @@ -94,6 +94,9 @@ Visit https://github.com/eteubert/archivist-custom-archive-templates, fork the p

== Changelog ==

= 1.3.3 =
* generic backslash fix

= 1.3.2 =
* you can now set any template as the default
* current default template more easily recognizable (bold font & marked in template chooser)
Expand Down

0 comments on commit 934e5bc

Please sign in to comment.