From 80f105d35aa27dfbc9471c0d358d6a4108c50c95 Mon Sep 17 00:00:00 2001
From: Erick Hitter <ehitter@gmail.com>
Date: Sat, 11 May 2013 20:17:46 -0500
Subject: [PATCH] Make class variables private and provide access via a magic
 getter.

---
 date-based-taxonomy-archives.php | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/date-based-taxonomy-archives.php b/date-based-taxonomy-archives.php
index 42dedc9..44f027a 100644
--- a/date-based-taxonomy-archives.php
+++ b/date-based-taxonomy-archives.php
@@ -31,7 +31,7 @@ class Date_Based_Taxonomy_Archives {
 	/**
 	 * Class variables
 	 */
-	var $defaults = array(
+	private $defaults = array(
 		'taxonomies' => false,
 		'show_post_count' => false,
 		'limit' => '',
@@ -40,10 +40,10 @@ class Date_Based_Taxonomy_Archives {
 		'echo' => true
 	);
 
-	var $cache_key_incrementor = 'incrementor';
-	var $cache_group = 'date_based_taxonomy_archives';
+	private $cache_key_incrementor = 'incrementor';
+	private $cache_group = 'date_based_taxonomy_archives';
 
-	var $filter_archive_links = false;
+	private $filter_archive_links = false;
 
 	/**
 	 * Silence is golden!
@@ -66,6 +66,19 @@ class Date_Based_Taxonomy_Archives {
 		return self::$__instance;
 	}
 
+	/**
+	 * Magic getter to provide access to class variables that were public prior to v0.3.
+	 *
+	 * @param string $name
+	 * @return mixed
+	 */
+	public function __get( $name ) {
+		if ( property_exists( $this, $name ) )
+			return $this->$name;
+		else
+			return null;
+	}
+
 	/**
 	 * Register actions and filters
 	 *
-- 
GitLab