-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from CodeProKid/feature/51
Feature/51 - adding support for using modifiers on object type caches
- Loading branch information
Showing
11 changed files
with
700 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
if ( ! class_exists( 'DFM_Transient_Utils' ) ) { | ||
|
||
/** | ||
* Class DFM_Transient_Utils | ||
* Helper methods for the DFM_Transients plugin | ||
*/ | ||
class DFM_Transient_Utils { | ||
|
||
/** | ||
* Return the *_metadata() cache type translated from the registered `cache_type`. | ||
* | ||
* @param string $cache_type Name of the cache type to translate to the friendlier version | ||
* | ||
* @return string|WP_Error | ||
*/ | ||
public static function get_meta_type( $cache_type ) { | ||
|
||
switch ( $cache_type ) { | ||
case 'post_meta' : | ||
$meta_type = 'post'; | ||
break; | ||
case 'term_meta' : | ||
$meta_type = 'term'; | ||
break; | ||
case 'user_meta'; | ||
$meta_type = 'user'; | ||
break; | ||
default: | ||
return new WP_Error( 'invalid-cache-type', __( 'When registering your transient, you used an invalid cache type. Valid options are transient, post_meta, term_meta.', 'dfm-transients' ) ); | ||
} | ||
|
||
return $meta_type; | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.