pforms_is_admin_page() ) { return "{$this->top_level_menu} {$this->selector}"; } // Default return the top-level menu. return $this->top_level_menu; } /** * Prepare and encode args for the pointer. * * @since 1.8.8 * * @return string */ private function get_prepared_args(): string { // Retrieve title and message from arguments array, fallback to empty strings if not set. $title = $this->args['title'] ?? ''; $message = $this->args['message'] ?? ''; // Return early if both title and message are empty. if ( empty( $message ) ) { return ''; } // Pointer markup uses

tag for the title and

tag for the message. $content = ! empty( $title ) ? sprintf( '

%s

', esc_html( $title ) ) : ''; $content .= sprintf( '

%s

', wp_kses( $message, $this->get_allowed_html() ) ); $this->args['content'] = $content; // Unset title and message to clean up arguments array. unset( $this->args['title'], $this->args['message'] ); // If RTL and position edge is 'left', switch it to 'right'. if ( ! empty( $this->args['position']['edge'] ) && $this->args['position']['edge'] === 'left' && is_rtl() ) { $this->args['position']['edge'] = 'right'; } // Encode arguments array to JSON. return wp_json_encode( $this->args ); } /** * Get allowed HTML tags for wp_kses. * * @since 1.8.8 * * @return array */ private function get_allowed_html(): array { return [ 'a' => [ 'id' => [], 'class' => [], 'href' => [], 'target' => [], 'rel' => [], ], 'strong' => [], 'em' => [], 'br' => [], ]; } /** * Check if loading of the pointer is allowed. * * @since 1.8.8 * * @return bool */ abstract protected function allow_load(): bool; /** * Set arguments for the pointer. * * @since 1.8.8 */ abstract protected function set_args(); }