HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ubuntu-8gb-hel1-1 6.8.0-55-generic #57-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 12 23:42:21 UTC 2025 x86_64
User: www-data (33)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: /var/www/agighana.org_backup/builder_abstract.class.php
<?php

/**
 * @package Unlimited Elements
 * @author UniteCMS http://unitecms.net
 * @copyright Copyright (c) 2016 UniteCMS
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
 */

if ( ! defined( 'ABSPATH' ) ) exit;

abstract class UCAdminNoticeBuilderAbstract{

	private $id;
	private $dismissible = false;
	private $debug;

	/**
	 * get the notice html
	 */
	abstract public function build();

	/**
	 * create a new builder instance
	 */
	public function __construct($id){

		$this->id = $id;
	}

	/**
	 * set the notice as dismissible
	 */
	public function dismissible(){

		$this->dismissible = true;

		return $this;
	}

	/**
	 * set the notice debug data
	 */
	public function debug($data){

		$this->debug = $data;

		return $this;
	}

	/**
	 * get the notice identifier
	 */
	protected function getId(){

		return $this->id;
	}

	/**
	 * get the dismiss html
	 */
	protected function getDismissHtml(){

		if($this->dismissible === false)
			return '';

		$ajaxUrl = $this->getDismissAjaxUrl();
		$text = __('Dismiss', 'unlimited-elements-for-elementor');
		$title = __('Dismiss Notice', 'unlimited-elements-for-elementor');

		return '<a class="uc-notice-dismiss" href="#" data-action="dismiss" title="' . esc_attr($title) . '" data-ajax-url="' . esc_attr($ajaxUrl) . '">' . $text . '</a>';
	}

	/**
	 * get the debug html
	 */
	protected function getDebugHtml(){

		if(empty($this->debug))
			return '';

		return '<p class="uc-notice-debug"><b>DEBUG:</b> ' . $this->debug . '</p>';
	}

	/**
	 * get the dismiss ajax url
	 */
	protected function getDismissAjaxUrl(){

		$ajaxUrl = HelperUC::getUrlAjax('dismiss_notice');
		$ajaxUrl = UniteFunctionsUC::addUrlParams($ajaxUrl, array('id' => $this->id));

		return $ajaxUrl;
	}

	/**
	 * get the postpone ajax url (duration in hours)
	 */
	protected function getPostponeAjaxUrl($duration){

		$ajaxUrl = HelperUC::getUrlAjax('postpone_notice');
		$ajaxUrl = UniteFunctionsUC::addUrlParams($ajaxUrl, array('id' => $this->id, 'duration' => $duration));

		return $ajaxUrl;
	}

}