HEX
Server: Apache/2
System: Linux gains.linuxbigapps.com 4.18.0-553.74.1.lve.el8.x86_64 #1 SMP Tue Sep 9 14:25:24 UTC 2025 x86_64
User: mountains (1551)
PHP: 8.0.30
Disabled: allow_url_include, show_source, symlink, system, passthru, exec, popen, pclose, proc_open, proc_terminate,proc_get_status, proc_close, proc_nice, allow_url_fopen, shell-exec, shell_exec, fpassthru, base64_encodem, escapeshellcmd, escapeshellarg, crack_check,crack_closedict, crack_getlastmessage, crack_opendict, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, dl, escap, phpinfo
Upload Files
File: /home/mountains/public_html/backup/wp-content/themes/neve/inc/compatibility/page_builder_base.php
<?php
/**
 * Page Builder Compatibility extendable class.
 *
 * @package Neve\Compatibility
 */

namespace Neve\Compatibility;

/**
 * Class Page_Builder_Base
 *
 * @package Neve\Compatibility
 */
abstract class Page_Builder_Base {

	/**
	 * Init function.
	 */
	abstract public function init();

	/**
	 * Decide if a page is edited with a page builder or not.
	 *
	 * @param int $pid Post id.
	 *
	 * @return bool
	 */
	abstract protected function is_edited_with_builder( $pid );

	/**
	 * Decide if we should set page template in builder or not.
	 */
	public function maybe_set_page_template() {
		if ( get_post_type() !== 'page' ) {
			return;
		}

		global $post;

		if ( ! isset( $post ) ) {
			return;
		}

		$post_id = get_the_ID();
		if ( ! $post_id ) {
			return;
		}

		/**
		 * Don't change if user already set a page template.
		 */
		$post_meta_template = get_post_meta( $post_id, '_wp_page_template', true );
		if ( $post_meta_template !== 'default' && ! empty( $post_meta_template ) ) {
			return;
		}

		/**
		 * Bail if page is not edited with builder.
		 */
		if ( $this->is_edited_with_builder( $post_id ) === false ) {
			return;
		}

		$this->set_page_template( $post_id );
	}

	/**
	 * Set page layout.
	 *
	 * @param int $post_id the post id.
	 */
	private function set_page_template( $post_id ) {
		global $post;

		if ( isset( $post ) && ( is_admin() || is_singular() ) && empty( $post->post_content ) ) {
			update_post_meta( $post_id, '_wp_page_template', 'page-templates/template-pagebuilder-full-width.php' );
		}
	}
}