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/layout_outer.php
<?php

class BloxViewLayoutOuterProvider extends BloxViewLayoutOuter{
	
	
	/**
	 * set page title
	 */
	public function setPageTitle(){
		
		if(!$this->layoutID)
			$title = esc_html__("New Page", "unlimited-elements-for-elementor");
		else{
			$title = $this->objLayout->getTitle(true);
			$title .= " - ".esc_html__("Edit Page", "unlimited-elements-for-elementor")."";
		}
		
		UniteProviderFunctionsUC::setAdminTitle($title);
		
	}
	
	
	/**
	 * change the auto draft to draft for a new page
	 */
	private function checkModifyNewPage(){
		
		if(empty($this->layoutID))
			return(false);
			
		$post = get_post($this->layoutID);
		
		$status = $post->post_status;
		
		$arrUpdate = array();
		if($status == "auto-draft"){
			$arrUpdate["post_status"] = "draft";
			
			//update title
			$title = UniteFunctionsUC::getGetVar("title", "", UniteFunctionsUC::SANITIZE_TEXT_FIELD);
			if(empty($title)){
				$objLayout = new UniteCreatorLayout();
				$title = $objLayout->getNewLayoutTitle();
			}
			
			$arrUpdate["title"] = $title;
			$arrUpdate["post_name"] = sanitize_title($title);
			
		}
		
		if(empty($arrUpdate))
			return(false);
		
		$arrUpdate["ID"] = $this->layoutID;
		
		wp_update_post($arrUpdate);
	}
	
	
	/**
	 * the constructor
	 */
	public function __construct(){
		parent::__construct();
		
		$this->checkModifyNewPage();
		
		$this->setPageTitle();
		
		$this->display();
	}
	
}