403Webshell
Server IP : 66.29.132.124  /  Your IP : 18.222.168.73
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wavevlvu/misswavenigeria.com/wp-content/plugins/totalpoll-lite/src/Widgets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/misswavenigeria.com/wp-content/plugins/totalpoll-lite/src/Widgets/Poll.php
<?php

namespace TotalPoll\Widgets;

use TotalPollVendors\TotalCore\Widgets\Widget;

/**
 * Poll Widget.
 * @package TotalPoll\Widgets
 */
class Poll extends Widget {
	/**
	 * Poll constructor.
	 */
	public function __construct() {
		$widgetOptions = array(
			'classname'   => 'totalpoll-widget-poll',
			'description' => esc_html__( 'TotalPoll poll widget', 'totalpoll' ),
		);
		parent::__construct( 'totalpoll_poll', esc_html__( '[TotalPoll] Poll', 'totalpoll' ), $widgetOptions );
	}

	/**
	 * Widget content.
	 *
	 * @param $args
	 * @param $instance
	 */
	public function content( $args, $instance ) {
		if ( ! empty( $instance['poll'] ) ):
			$screen = $instance['screen'] ?: 'vote';
			$poll   = TotalPoll( 'polls.repository' )->getById( $instance['poll'] )->setScreen( $screen );

			echo $poll->render();
		endif;
	}

	/**
	 * Widget form.
	 *
	 * @param array $instance
	 *
	 * @return string|void
	 */
	public function form( $instance ) {
		$instance = wp_parse_args( $instance, [ 'poll' => null, 'title' => null, 'screen' => null ] );
		parent::form( $instance );
	}

	/**
	 * Widget form fields.
	 *
	 * @param $fields
	 * @param $instance
	 *
	 * @return mixed
	 */
	public function fields( $fields, $instance ) {
		// Poll field
		$polls      = [];
		$pollsPosts = (array) get_posts( [ 'post_type' => TP_POLL_CPT_NAME, 'posts_per_page' => - 1 ] );

		foreach ( $pollsPosts as $poll ):
			$polls[ $poll->ID ] = $poll->post_title;
		endforeach;

		$pollsListFieldOptions = [
			'class'   => 'widefat',
			'name'    => esc_attr( $this->get_field_name( 'poll' ) ),
			'label'   => esc_html__( 'Poll:', 'totalpoll' ),
			'options' => $polls,
		];

		$fields['poll'] = TotalPoll( 'form.field.select' )->setOptions( $pollsListFieldOptions )->setValue( $instance['poll'] ?: '' );

		// Screen
		$screen                = $instance['screen'] ?: 'vote';
		$pollScreenFieldOption = [
			'class'   => 'widefat totalpoll-page-selector',
			'name'    => esc_attr( $this->get_field_name( 'screen' ) ),
			'label'   => esc_html__( 'Screen:', 'totalpoll' ),
			'options' => [
				'vote'    => esc_html__( 'Vote', 'totalpoll' ),
				'results' => esc_html__( 'Results', 'totalpoll' ),
			],
		];
		$fields['screen']      = TotalPoll( 'form.field.select' )->setOptions( $pollScreenFieldOption )->setValue( $screen );

		return $fields;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit