et_notification_buttons_html( $notification ), esc_attr( $notification['id'] ), esc_attr( $current_class ), $this->get_video_badge_html( $this->get_component_data( $notification['video'] ) ) ); // Only first notification is current. $current_class = ''; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo wpforms_render( 'admin/notifications', [ 'notifications' => [ 'count' => count( $notifications ), 'html' => $notifications_html, ], ], true ); } /** * Get the allowed HTML tags and their attributes. * * @since 1.8.8 * * @return array */ public function get_allowed_tags(): array { return [ 'br' => [], 'em' => [], 'strong' => [], 'span' => [ 'style' => [], ], 'p' => [ 'id' => [], 'class' => [], ], 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ]; } /** * Retrieve notification's buttons HTML. * * @since 1.7.5 * * @param array $notification Notification data. * * @return string */ private function get_notification_buttons_html( $notification ) { $html = ''; if ( empty( $notification['btns'] ) || ! is_array( $notification['btns'] ) ) { return $html; } foreach ( $notification['btns'] as $btn_type => $btn ) { $btn = $this->get_component_data( $btn ); if ( ! $btn ) { continue; } $url = $this->prepare_btn_url( $btn ); $target = ! empty( $btn['target'] ) ? $btn['target'] : '_blank'; $target = ! empty( $url ) && strpos( $url, home_url() ) === 0 ? '_self' : $target; $html .= sprintf( '%4$s', esc_url( $url ), $btn_type === 'main' ? 'primary' : 'secondary', $target === '_blank' ? ' target="_blank" rel="noopener noreferrer"' : '', ! empty( $btn['text'] ) ? esc_html( $btn['text'] ) : '' ); } return ! empty( $html ) ? sprintf( '
%s
', $html ) : ''; } /** * Retrieve notification's component data by a license type. * * @since 1.7.5 * * @param mixed $data Component data. * * @return false|mixed */ private function get_component_data( $data ) { if ( empty( $data['license'] ) ) { return $data; } $license_type = $this->get_license_type(); if ( in_array( $license_type, self::LICENSES_ELITE, true ) ) { $license_type = 'elite'; } return ! empty( $data['license'][ $license_type ] ) ? $data['license'][ $license_type ] : false; } /** * Retrieve the current installation license type (always lowercase). * * @since 1.7.5 * * @return string */ private function get_license_type() { if ( $this->license_type ) { return $this->license_type; } $this->license_type = wpforms_get_license_type(); if ( ! $this->license_type ) { $this->license_type = 'lite'; } return $this->license_type; } /** * Dismiss notification via AJAX. * * @since 1.7.5 */ public function dismiss() { // Check for required param, security and access. if ( empty( $_POST['id'] ) || ! check_ajax_referer( 'wpforms-admin', 'nonce', false ) || ! $this->has_access() ) { wp_send_json_error(); } $id = sanitize_key( $_POST['id'] ); $type = is_numeric( $id ) ? 'feed' : 'events'; $option = $this->get_option(); $option['dismissed'][] = $id; $option['dismissed'] = array_unique( $option['dismissed'] ); // Remove notification. if ( is_array( $option[ $type ] ) && ! empty( $option[ $type ] ) ) { foreach ( $option[ $type ] as $key => $notification ) { if ( (string) $notification['id'] === (string) $id ) { unset( $option[ $type ][ $key ] ); break; } } } update_option( 'wpforms_notifications', $option ); wp_send_json_success(); } /** * Prepare button URL. * * @since 1.7.5 * * @param array $btn Button data. * * @return string */ private function prepare_btn_url( $btn ) { if ( empty( $btn['url'] ) ) { return ''; } $replace_tags = [ '{admin_url}' => admin_url(), '{license_key}' => wpforms_get_license_key(), ]; return str_replace( array_keys( $replace_tags ), array_values( $replace_tags ), $btn['url'] ); } /** * Get the notification's video badge HTML. * * @since 1.7.5 * * @param string $video_url Valid video URL. * * @return string */ private function get_video_badge_html( $video_url ) { $video_url = wp_http_validate_url( $video_url ); if ( empty( $video_url ) ) { return ''; } $data_attr_lity = wp_is_mobile() ? '' : 'data-lity'; return sprintf( ' %3$s ', esc_url( $video_url ), esc_attr( $data_attr_lity ), esc_html__( 'Watch Video', 'wpforms-lite' ) ); } }
Fatal error: Uncaught Error: Call to undefined method stdClass::has_access() in /var/www/html/padrepio.org.br/web/wp-content/plugins/wpforms-lite/src/Admin/Notifications/EventDriven.php:91 Stack trace: #0 /var/www/html/padrepio.org.br/web/wp-content/plugins/wpforms-lite/src/Admin/Notifications/EventDriven.php(75): WPForms\Admin\Notifications\EventDriven->allow_load() #1 /var/www/html/padrepio.org.br/web/wp-content/plugins/wpforms-lite/src/WPForms.php(325): WPForms\Admin\Notifications\EventDriven->init() #2 /var/www/html/padrepio.org.br/web/wp-includes/class-wp-hook.php(324): WPForms\WPForms->WPForms\{closure}('') #3 /var/www/html/padrepio.org.br/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #4 /var/www/html/padrepio.org.br/web/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /var/www/html/padrepio.org.br/web/wp-content/plugins/wpforms-lite/src/WPForms.php(277): do_action('wpforms_loaded') #6 /var/www/html/padrepio.org.br/web/wp-includes/class-wp-hook.php(324): WPForms\WPForms->object in /var/www/html/padrepio.org.br/web/wp-content/plugins/wpforms-lite/src/Admin/Notifications/EventDriven.php on line 91