Server IP : 66.29.132.124 / Your IP : 3.15.142.42 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/Admin/Ajax/ |
Upload File : |
<?php namespace TotalPoll\Admin\Ajax; use TotalPoll\Contracts\Modules\Repository; use TotalPollVendors\TotalCore\Contracts\Http\Request; /** * Class Templates * @package TotalPoll\Admin\Ajax * @since 1.0.0 */ class Templates { /** * @var array $template */ protected $template; /** * @var Request $request */ protected $request; /** * @var Repository $request */ protected $repository; /** * @var array */ protected $templates = []; /** * Templates constructor. * * @param Request $request * @param Repository $repository */ public function __construct( Request $request, Repository $repository ) { $this->request = $request; $this->repository = $repository; $this->template = (string) $this->request->request( 'template' ); $this->templates = $this->repository->getActiveWhere( [ 'type' => 'template' ] ); if ( empty( $this->template ) || ! isset( $this->templates[ $this->template ] ) ): wp_send_json_error( new \WP_Error( 'unknown_template', 'Unknown template.' ) ); endif; } /** * Get template defaults * @action-callback wp_ajax_totalpoll_templates_get_defaults */ public function getDefaults() { wp_send_json( $this->repository->getDefaults( $this->template ) ); } /** * Get template settings * @action-callback wp_ajax_totalpoll_templates_get_settings */ public function getSettings() { echo $this->repository->getSettings( $this->template ); wp_die(); } /** * Get template preview * @action-callback wp_ajax_totalpoll_templates_get_preview */ public function getPreview() { echo $this->repository->getPreview( $this->template ); wp_die(); } }