$value, 'expiration' => $expiration ? time() + (int) $expiration : '', ); update_option( self::WPML_TRANSIENT_PREFIX . $name, $data ); } /** * @param string $name * * @return string */ public function get( $name ) { $data = get_option( self::WPML_TRANSIENT_PREFIX . $name ); if ( $data ) { if ( (int) $data['expiration'] < time() ) { delete_option( self::WPML_TRANSIENT_PREFIX . $name ); return ''; } return $data['value']; } return ''; } /** * @param string $name */ public function delete( $name ) { delete_option( self::WPML_TRANSIENT_PREFIX . $name ); } }