Skip to:
Content

bbPress.org


Ignore:
Timestamp:
03/11/2009 01:12:09 PM (18 years ago)
Author:
sambauers
Message:

Add support for transients.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-includes/class.bp-options.php

    r1954 r1983  
    44 * in the bbPress database
    55 *
     6 * @see BP_Options_Interface
    67 * @package bbPress
    78 */
    89class BP_Options
    910{
    10         function prefix() {
     11        function prefix()
     12        {
    1113                return 'bp_bbpress_';
    1214        }
    1315       
    14         function get($option) {
    15                 switch ($option) {
     16        function get( $option )
     17        {
     18                switch ( $option ) {
    1619                        case 'application_uri':
    17                                 return bb_get_uri(null, null, BB_URI_CONTEXT_NONE);
     20                                return bb_get_uri( null, null, BB_URI_CONTEXT_NONE );
    1821                                break;
    1922                        case 'cron_uri':
    20                                 return bb_get_uri('bb-cron.php', array('check' => BP_Options::get('cron_check')), BB_URI_CONTEXT_WP_HTTP_REQUEST);
     23                                return bb_get_uri( 'bb-cron.php', array( 'check' => BP_Options::get( 'cron_check' ) ), BB_URI_CONTEXT_WP_HTTP_REQUEST );
    2124                                break;
    2225                        case 'cron_check':
    23                                 return bb_hash('187425');
     26                                return bb_hash( '187425' );
    2427                                break;
    2528                        case 'charset':
    26                                 return bb_get_option($option);
     29                                return bb_get_option( $option );
    2730                                break;
    2831                        case 'wp_http_version':
    29                                 return 'bbPress/' . bb_get_option('version');
     32                                return 'bbPress/' . bb_get_option( 'version' );
    3033                                break;
    3134                        case 'hash_function_name':
    … …  
    3336                                break;
    3437                        default:
    35                                 return bb_get_option(BP_Options::prefix() . $option);
     38                                return bb_get_option( BP_Options::prefix() . $option );
    3639                                break;
    3740                }
    3841        }
    3942       
    40         function add($option, $value) {
    41                 return BP_Options::update($option, $value);
     43        function add( $option, $value )
     44        {
     45                return BP_Options::update( $option, $value );
    4246        }
    4347       
    44         function update($option, $value) {
    45                 return bb_update_option(BP_Options::prefix() . $option, $value);
     48        function update( $option, $value )
     49        {
     50                return bb_update_option( BP_Options::prefix() . $option, $value );
    4651        }
    4752       
    48         function delete($option) {
    49                 return bb_delete_option(BP_Options::prefix() . $option);
     53        function delete( $option )
     54        {
     55                return bb_delete_option( BP_Options::prefix() . $option );
    5056        }
    5157} // END class BP_Options
     58
     59/**
     60 * Allows storage of transients for BackPress
     61 *
     62 * @see BP_Transients_Interface
     63 * @package bbPress
     64 */
     65class BP_Transients
     66{
     67        function prefix()
     68        {
     69                return 'bp_bbpress_';
     70        }
     71       
     72        function get( $transient )
     73        {
     74                return bb_get_transient( BP_Options::prefix() . $transient );
     75        }
     76       
     77        function set( $transient, $value, $expiration = 0 )
     78        {
     79                return bb_set_transient( BP_Options::prefix() . $transient, $value, $expiration );
     80        }
     81       
     82        function delete( $transient )
     83        {
     84                return bb_delete_transient( BP_Options::prefix() . $transient );
     85        }
     86} // END class BP_Transients
Note: See TracChangeset for help on using the changeset viewer.