芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/www/wp-content/plugins/google-site-kit/includes/Core/Dismissals/Dismissed_Items.php
get(); $items[ $item ] = $expires_in_seconds ? time() + $expires_in_seconds : 0; $this->set( $items ); } /** * Removes one or more items from the list of dismissed items. * * @since 1.107.0 * * @param string $item Item to remove. */ public function remove( $item ) { $items = $this->get(); // If the item is not in dismissed items, there's nothing to do. if ( ! array_key_exists( $item, $items ) ) { return; } unset( $items[ $item ] ); $this->set( $items ); } /** * Gets the value of the setting. * * @since 1.37.0 * * @return array Value set for the option, or default if not set. */ public function get() { $value = parent::get(); return is_array( $value ) ? $value : $this->get_default(); } /** * Gets the expected value type. * * @since 1.37.0 * * @return string The type name. */ protected function get_type() { return 'array'; } /** * Gets the default value. * * @since 1.37.0 * * @return array The default value. */ protected function get_default() { return array(); } /** * Gets the callback for sanitizing the setting's value before saving. * * @since 1.37.0 * * @return callable Sanitize callback. */ protected function get_sanitize_callback() { return function ( $items ) { return $this->filter_dismissed_items( $items ); }; } /** * Determines whether the item is dismissed. * * @since 1.37.0 * * @param string $item The item to check. * @return bool TRUE if item is dismissed, otherwise FALSE. */ public function is_dismissed( $item ) { $items = $this->get(); if ( ! array_key_exists( $item, $items ) ) { return false; } $ttl = $items[ $item ]; if ( $ttl > 0 && $ttl < time() ) { return false; } return true; } /** * Gets dismissed items. * * @since 1.37.0 * * @return array Dismissed items array. */ public function get_dismissed_items() { $dismissed_items = $this->get(); $dismissed_items = $this->filter_dismissed_items( $dismissed_items ); return array_keys( $dismissed_items ); } /** * Filters dismissed items. * * @since 1.37.0 * * @param array $items Dismissed items list. * @return array Filtered dismissed items. */ private function filter_dismissed_items( $items ) { $dismissed = array(); if ( is_array( $items ) ) { foreach ( $items as $item => $ttl ) { if ( self::DISMISS_ITEM_PERMANENTLY === $ttl || $ttl > time() ) { $dismissed[ $item ] = $ttl; } } } return $dismissed; } }