芝麻web文件管理V1.00
编辑当前文件:/home/ezdajrnh/www/wp-content/plugins/google-site-kit/includes/Core/User_Surveys/Survey_Queue.php
get(); // Do not add the survey if it is already in the queue. foreach ( $surveys as $item ) { if ( $item['survey_id'] === $survey['survey_id'] ) { return false; } } $surveys[] = $survey; $this->set( $surveys ); return true; } /** * Dequeues a survey that has the provided survey ID. * * @since 1.98.0 * * @param string $survey_id The survey ID to dequeue. * @return array|null A survey object if it has been found, otherwise NULL. */ public function dequeue( $survey_id ) { $survey = null; // Search for the requested survey_id. $old_surveys = $this->get(); $new_surveys = array(); foreach ( $old_surveys as $item ) { if ( $item['survey_id'] === $survey_id ) { $survey = $item; } else { $new_surveys[] = $item; } } // Update existing surveys list if we have found the survey we need to dequeue. if ( ! is_null( $survey ) ) { $this->set( $new_surveys ); } return $survey; } /** * Gets the first survey in the queue without removing it from the queue. * * @since 1.98.0 * * @return array|null A survey object if at least one survey exists in the queue, otherwise NULL. */ public function front() { $surveys = $this->get(); return reset( $surveys ) ?: null; } /** * Gets the survey for the provided session. * * @since 1.98.0 * * @param array $session { * The current session object. * * @type string $session_id Session ID. * @type string $session_token Session token. * } * @return array|null A survey object if it has been found for the session, otherwise NULL. */ public function find_by_session( $session ) { $surveys = $this->get(); foreach ( $surveys as $survey ) { if ( ! empty( $survey['session']['session_id'] ) && ! empty( $session['session_id'] ) && $survey['session']['session_id'] === $session['session_id'] ) { return $survey; } } return null; } /** * Sanitizes array items. * * @since 1.98.0 * * @param array $items The original array items. * @return array Filtered items. */ protected function sanitize_list_items( $items ) { return $items; } }