Skip to content

Commit

Permalink
Rename our cache variable for verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber committed Jan 3, 2014
1 parent 1cf32d9 commit b6953ee
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions modules/custom-status/custom-status.php
Expand Up @@ -14,7 +14,7 @@ class EF_Custom_Status extends EF_Module {

var $module;

private $custom_statuses = array();
private $custom_statuses_cache = array();

// This is taxonomy name used to store all our custom statuses
const taxonomy_key = 'post_status';
Expand Down Expand Up @@ -458,7 +458,7 @@ function add_custom_status( $term, $args = array() ) {
$response = wp_insert_term( $term, self::taxonomy_key, array( 'slug' => $slug, 'description' => $encoded_description ) );

// Reset our internal object cache
$this->custom_statuses = array();
$this->custom_statuses_cache = array();

return $response;

Expand All @@ -479,7 +479,7 @@ function update_custom_status( $status_id, $args = array() ) {
return new WP_Error( 'invalid', __( "Custom status doesn't exist.", 'edit-flow' ) );

// Reset our internal object cache
$this->custom_statuses = array();
$this->custom_statuses_cache = array();

// If the name was changed, we need to change the slug
if ( isset( $args['name'] ) && $args['name'] != $old_status->name )
Expand Down Expand Up @@ -525,7 +525,7 @@ function delete_custom_status( $status_id, $args = array(), $reassign = '' ) {
return new WP_Error( 'invalid', __( 'Cannot reassign to the status you want to delete', 'edit-flow' ) );

// Reset our internal object cache
$this->custom_statuses = array();
$this->custom_statuses_cache = array();

if( !$this->is_restricted_status( $old_status ) ) {
$default_status = $this->get_default_custom_status()->slug;
Expand Down Expand Up @@ -563,8 +563,8 @@ function get_custom_statuses( $args = array() ) {

// Internal object cache for repeat requests
$arg_hash = md5( serialize( $args ) );
if ( ! empty( $this->custom_statuses[ $arg_hash ] ) ) {
return $this->custom_statuses[ $arg_hash ];
if ( ! empty( $this->custom_statuses_cache[ $arg_hash ] ) ) {
return $this->custom_statuses_cache[ $arg_hash ];
}

// Handle if the requested taxonomy doesn't exist
Expand Down Expand Up @@ -603,7 +603,7 @@ function get_custom_statuses( $args = array() ) {
foreach( $hold_to_end as $unpositioned_status )
$ordered_statuses[] = $unpositioned_status;

$this->custom_statuses[ $arg_hash ] = $ordered_statuses;
$this->custom_statuses_cache[ $arg_hash ] = $ordered_statuses;

return $ordered_statuses;
}
Expand Down

0 comments on commit b6953ee

Please sign in to comment.