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/views_chooser.class.php
<?php
/**
 * @package Unlimited Elements
 * @author unlimited-elements.com
 * @copyright (C) 2021 Unlimited Elements, All Rights Reserved.
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * */
if ( ! defined( 'ABSPATH' ) ) exit;


class UniteCreatorViewsChooser{

	protected $showButtons = true;
	protected $showHeader = true;
	protected $defaultIcon = "puzzle-piece";
	protected $arrPages = array();
	protected $headerTemplate = "header";
	protected $headerText;

	/**
	 * constructor
	 */
	public function __construct(){

		$this->initDefaults();
		$this->init();
		$this->putHtml();
	}


	/**
	 * init defaults
	 */
	protected function initDefaults(){

		$this->headerText = "My Pages List";

	}

	/**
	 * init the pages
	 */
	protected function init(){

		$urlAddons = helperUC::getViewUrl_Addons();
		$urlDividers = helperUC::getViewUrl_Addons(GlobalsUC::ADDON_TYPE_SHAPE_DEVIDER);
		$urlShapes = helperUC::getViewUrl_Addons(GlobalsUC::ADDON_TYPE_SHAPES);

		$urlSections = HelperUC::getViewUrl_LayoutsList(array(), GlobalsUC::ADDON_TYPE_LAYOUT_SECTION);

		$textAddons = esc_html__("My Addons", "unlimited-elements-for-elementor");
		$textDividers = esc_html__("Dividers", "unlimited-elements-for-elementor");
		$textShapes = esc_html__("Shapes", "unlimited-elements-for-elementor");
		$textSection = esc_html__("Sections", "unlimited-elements-for-elementor");
		$textPageTemplates = esc_html__("Page Templates", "unlimited-elements-for-elementor");

		$this->addPage($urlAddons, $textAddons);
		$this->addPage($urlDividers, $textDividers, "map");
		$this->addPage($urlShapes, $textShapes, "map");
		$this->addPage($urlSections, $textSection);

	}



	/**
	 * add page
	 */
	protected function addPage($url, $title, $icon=null){

		if(empty($icon))
			$icon = $this->defaultIcon;

		$this->arrPages[] = array(
			"url"=>$url,
			"title"=>$title,
			"icon"=>$icon);

	}

	/**
	 * put pages html
	 */
	protected function putHtmlPages(){

		if($this->showHeader == true){

			$headerTitle = $this->headerText;

			require HelperUC::getPathTemplate("header");
		}else
			require HelperUC::getPathTemplate("header_missing");


		?>
		<ul class='uc-list-pages-thumbs'>
		<?php
		foreach($this->arrPages as $page){

			$url = $page["url"];
			$icon = $page["icon"];

			if(empty($icon))
				$icon = "angellist";

			$title = $page["title"];

			?>
			<li>
				<a href="<?php echo esc_url($url)?>">
					<i class="fa fa-<?php echo esc_attr($icon)?>"></i>
					<?php echo esc_html($title)?>
				</a>
			</li>
			<?php
		}
		?>
		</ul>
		<?php
	}


	/**
	 * constructor
	 */
	protected function putHtml(){

		$this->putHtmlPages();

	}

}