ØÏõå<hÑõå<ÈÒõå<(Ôõå<@àõ[æ<~a@ö[æ<€a@ðà[æ<€a€aPÐõå<8Ðõå<€ahÐõå<øÐõå<PÑõå<@Ð\æ<aƒaƒa {Þå<°Ðõå<@ ö[æ<„a@@ö[æ<„a„a(Ñõå<„a¸{Þå<Ñõå<€aÐ{Þå< Ðõå<@`ö[æ<†a@€ö[æ<ˆa@(Ð\æ<ˆaˆa°Ñõå<˜Ñõå<ˆaÈÑõå<XÒõå<°Òõå<@PÐ\æ<‰a‹a‹aè{Þå<Òõå<@ ö[æ<Œa@Àö[æ<ŒaŒaˆÒõå<Œa|Þå<pÒõå<ˆa|Þå<€Ñõå<@àö[æ<Ža@÷[æ<a@ á[æ<aaÓõå<øÒõå<a(Óõå<¸Óõå<Ôõå<@xÐ\æ<‘a“a“a0|Þå<pÓõå<@ ÷[æ<”a@@÷[æ<”a”aèÓõå<”aH|Þå<ÐÓõå<a`|Þå<àÒõå<@`÷[æ<–a@€÷[æ<˜a@ Ð\æ<˜a˜apÔõå<XÔõå<˜aˆÔõå<Õõå<pÕõå<@ÈÐ\æ<™a›a›ax|Þå<ÐÔõå<@ ÷[æ<œa@À÷[æ<œaœaHÕõå<œa|Þå<0Õõå<˜a¨|Þå<@Ôõå<xaØÏõå<hÑõå<ÈÒõå<(Ôõå<ˆÕõå<8×õå<àØõå<@Úõå<@à÷[æ<ža@ø[æ< a@ðÐ\æ< a a Öõå<Öõå< a8Öõå<ÈÖõå< ×õå<@Ñ\æ<¡a£a£aÀ|Þå<€Öõå<@ ø[æ<¤a@@ø[æ<¤a¤aøÖõå<¤aØ|Þå<àÖõå< að|Þå<ðÕõå<@`ø[æ<¦a@€ø[æ<¨a@Pá[æ<¨a¨a€×õå<h×õå<¨a˜×õå<pØõå<ÈØõå<@@Ñ\æ<©a@«a@€á[æ<«a«aØõå<ø×õå<«a(Øõå<«a}Þå<à×õå<@ ø[æ<­a@Àø[æ<­a­a Øõå<­a }Þå<ˆØõå<¨a8}Þå<P×õå<@àø[æ<¯a@ù[æ<±a@hÑ\æ<±a±a(Ùõå<Ùõå<±a@Ùõå<ÐÙõå<(Úõå<@Ñ\æ<²a´a´aP}Þå<ˆÙõå<@ ù[æ<µa@@ù[æ<µaµaÚõå<µah}Þå<èÙõå<±a€}Þå<øØõå<@`ù[æ<·a@€ù[æ<¹a@¸Ñ\æ<¹a¹aˆÚõå<pÚõå<¹a Úõå<0Ûõå<ˆÛõå<@àÑ\æ<ºa¼a¼a˜}Þå<èÚõå<@ ù[æ<½a@Àù[æ<½a½a`Ûõå<½a°}Þå<HÛõå<¹aÈ}Þå<XÚõå<xaØÏõå<hÑõå<ÈÒõå<(Ôõå<ˆÕõå<8×õå<àØõå<@Úõå< Ûõå<Ýõå<8ßõå<˜àõå<øáõå<Xãõå<åõå<¨æõå<@àù[æ<¿a@ú[æ<Áa@Ò\æ<ÁaÁaxÜõå<`Üõå<ÁaÜõå< Ýõå<xÝõå<@0Ò\æ<ÂaÄaÄaà}Þå<ØÜõå<@ ú[æ<Åa@@ú[æ<ÅaÅaPÝõå<Åaø}Þå<8Ýõå<Áa~Þå<HÜõå<@`ú[æ<Ça@€ú[æ<Éa@XÒ\æ<ÉaÉaØÝõå<ÀÝõå<ÉaðÝõå<ÈÞõå< ßõå<@€Ò\æ<Êa@Ìa@ ú[æ<ÌaÌahÞõå<PÞõå<Ìa€Þõå<Ìa(~Þå<8Þõå<@Àú[æ<Îa@àú[æ<ÎaÎaøÞõå<Îa@~Þå<àÞõå<ÉaX~Þå<¨Ýõå<@û[æ<Ða@ û[æ<Òa@¨Ò\æ<ÒaÒa€ßõå<hßõå<Òa˜ßõå<(àõå<€àõå<@ÐÒ\æ<ÓaÕa * * @since 5.0.6 * * @param mixed $value If anything diff than null it will short-circuit. * @param string $key Key for the option we are trying to get. * @param mixed $default Default value when the option is either expired or not-set. * @param bool $force If we should expire cache and fetch from the database. * @param bool $cache If the value was pulled from cache. */ return apply_filters( 'tec_common_timed_option_value', $this->data[ $key ]['value'], $key, $default, $force, true ); } $timed_option = null; if ( $this->is_active() ) { $timed_option_name = $this->get_option_name( $key ); if ( true === $force ) { wp_cache_delete( $timed_option_name, 'options' ); } $timed_option = get_option( $timed_option_name, null ); } // Bail with default when non-existent. if ( empty( $timed_option ) ) { if ( $this->is_active() ) { // Avoids next request check, forces auto-loading. $this->set( $key, null, 0 ); } return $default; } // Bail with default when expired. if ( $time >= $timed_option['expiration'] ) { $this->delete( $key ); return $default; } $this->data[ $key ] = $timed_option; /** * Allows the filtering of the value of the timed option. * * @since 5.0.6 * * @param mixed $value If anything diff than null it will short-circuit. * @param string $key Key for the option we are trying to get. * @param mixed $default Default value when the option is either expired or not-set. * @param bool $force If we should expire cache and fetch from the database. * @param bool $cache If the value was pulled from cache. */ return apply_filters( 'tec_common_timed_option_value', $timed_option['value'], $key, $default, $force, false ); } /** * Delete a given timed option based on a key. * Will also clear local cache. * * @since 5.0.6 * * @param string $key Which timed option we are checking. * * @return bool */ public function delete( $key ): bool { $key = (string) $key; $updated = false; if ( $this->is_active() ) { $timed_option_name = $this->get_option_name( $key ); $updated = update_option( $timed_option_name, null, true ); wp_cache_delete( $timed_option_name, 'options' ); } // Bail with default when non-existent. if ( ! isset( $this->data[ $key ] ) ) { return $updated; } unset( $this->data[ $key ] ); return $updated; } /** * Checks if a given timed option exists. * * @since 5.0.6 * * @param string $key Which timed option we are checking. * @param bool $force Clears the cache before get_option() * * @return bool */ public function exists( $key, bool $force = false ): bool { /** * Allows the filtering to short-circuit the whole exists logic. * * @since 5.0.6 * * @param mixed|null $pre If anything diff than null it will short-circuit. * @param string $key Key for the option we are trying to get. * @param bool $force If we should expire cache and fetch from the database. */ $pre = apply_filters( 'tec_common_timed_option_pre_exists', null, $key, $force ); if ( null !== $pre ) { return (bool) $pre; } $time = time(); $cached = false; $timed_option = null; // If we have a stored value that is not expired, use it. if ( ! $force && isset( $this->data[ $key ] ) && is_numeric( $this->data[ $key ]['expiration'] ) && $time < $this->data[ $key ]['expiration'] ) { $cached = true; $timed_option = $this->data[ $key ]; } elseif ( $this->is_active() ) { $timed_option_name = $this->get_option_name( $key ); if ( true === $force ) { wp_cache_delete( $timed_option_name, 'options' ); } $timed_option = get_option( $timed_option_name, null ); } $exists = true; if ( null === $timed_option ) { $exists = false; } if ( ! is_array( $timed_option ) ) { $exists = false; } if ( ! isset( $timed_option['expiration'] ) || ! is_numeric( $timed_option['expiration'] ) ) { $exists = false; } /** * Does a particular timed option key exists. * * @since 5.0.6 * * @param mixed $exists If anything diff than null it will short-circuit. * @param string $key Key for the option we are trying to get. * @param bool $force If we should expire cache and fetch from the database. * @param bool $cached If the value was pulled from cache. */ return (bool) apply_filters( 'tec_common_timed_option_exists', $exists, $key, $force, $cached ); } /** * Update the value of a timed option on the database and on local cache. * * @since 5.0.6 * * @param string $key Key for this option. * @param mixed $value Value stored for this option. * @param int $expiration Expiration in seconds for this timed option. * * @return bool */ public function set( $key, $value, int $expiration = DAY_IN_SECONDS ): bool { $key = (string) $key; $data = [ 'key' => $key, 'value' => $value, 'expiration' => time() + $expiration, ]; $this->data[ $key ] = $data; $updated = true; if ( $this->is_active() ) { $updated = update_option( $this->get_option_name( $key ), $data, true ); } return $updated; } }