HEX
Server: Apache/2.4.29 (Ubuntu)
System: Linux elpuerto-web 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64
User: www-data (33)
PHP: 7.2.24-0ubuntu0.18.04.1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/elpuerto/html/wp-content/plugins/ajax-load-more/admin/functions/layouts.php
<?php
/**
 * ALM layout functions and helpers.
 *
 * @package AjaxLoadMore
 * @since   5.6
 */

/**
 * Get layout and return value to repeater template.
 *
 * @since 2.8.3
 */
function alm_get_layout() {
	$form_data = filter_input_array( INPUT_GET );

	if ( ! current_user_can( 'edit_theme_options' ) || ! isset( $form_data['nonce'] ) ) {
		// Bail early if missing WP capabilities or nonce.
		wp_die( esc_attr__( 'You don\'t belong here.', 'ajax-load-more' ) );
	}

	if ( ! wp_verify_nonce( $form_data['nonce'], 'alm_repeater_nonce' ) ) {
		// Verify nonce.
		wp_die( esc_attr__( 'Error - unable to verify nonce, please try again.', 'ajax-load-more' ) );
	}

	$type   = sanitize_text_field( $form_data['type'] );
	$custom = sanitize_text_field( $form_data['custom'] );

	if ( $type === 'default' ) { // Default Layout.
		$path = ALM_PATH . 'admin/includes/layout/' . $type . '.php';

		// Security checker.
		// Note: Confirm directory path does not contain relative path.
		if ( false !== strpos( $path, './' ) ) {
			wp_die( esc_attr__( 'This doesn\'t look right, what are you trying to do?', 'ajax-load-more' ) );
		}

		$content = AjaxLoadMore::alm_get_default_repeater_markup();

	} else {
		if ( $custom === 'true' ) {
			// Custom Layout.
			$dir = 'alm_layouts';
			if ( is_child_theme() ) {
				$path = get_stylesheet_directory() . '/' . $dir . '/' . $type;
				// if child theme does not have the layout, check the parent theme.
				if ( ! file_exists( $path ) ) {
					$path = get_template_directory() . '/' . $dir . '/' . $type;
				}
			} else {
				$path = get_template_directory() . '/' . $dir . '/' . $type;
			}

			// Security checker.
			// Note: Confirm directory path does not contain relative path.
			if ( false !== strpos( $path, './' ) ) {
				wp_die();
			}

			// phpcs:ignore
			$content = file_get_contents( $path );

		} else {
			// Layouts Add-on.
			$path = ALM_LAYOUTS_PATH . 'layouts/' . $type . '.php';

			// Security checker.
			// Note: Confirm directory path does not contain relative path.
			if ( false !== strpos( $path, './' ) ) {
				wp_die();
			}
			// phpcs:ignore
			$content = file_get_contents( ALM_LAYOUTS_PATH . 'layouts/' . $type . '.php' );
		}
	}

	$return['value'] = $content;
	echo wp_json_encode( $return );
	wp_die();
}
add_action( 'wp_ajax_alm_get_layout', 'alm_get_layout' );

/**
 * Get the list of layout templates.
 *
 * @since 2.8.7
 */
function alm_get_layouts() {
	include ALM_PATH . 'admin/includes/components/layout-list.php';
}
add_action( 'alm_get_layouts', 'alm_get_layouts' );