balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-redux-transients.php (844B)


      1 <?php
      2 /**
      3  * Redux Transients Class
      4  *
      5  * @class Redux_Transients
      6  * @version 4.0.0
      7  * @package Redux Framework
      8  */
      9 
     10 defined( 'ABSPATH' ) || exit;
     11 
     12 if ( ! class_exists( 'Redux_Transients', false ) ) {
     13 
     14 	/**
     15 	 * Class Redux_Transients
     16 	 */
     17 	class Redux_Transients extends Redux_Class {
     18 
     19 		/**
     20 		 * Get transients from database.
     21 		 */
     22 		public function get() {
     23 			$core = $this->core();
     24 
     25 			if ( empty( $core->transients ) ) {
     26 				$core->transients = get_option( $core->args['opt_name'] . '-transients', array() );
     27 			}
     28 		}
     29 
     30 		/**
     31 		 * Set transients in database.
     32 		 */
     33 		public function set() {
     34 			$core = $this->core();
     35 
     36 			if ( ! isset( $core->transients ) || ! isset( $core->transients_check ) || $core->transients_check !== $core->transients ) {
     37 				update_option( $core->args['opt_name'] . '-transients', $core->transients );
     38 			}
     39 		}
     40 	}
     41 }