HEX
Server: Apache
System: Linux top 5.8.11-1.el7.elrepo.x86_64 #1 SMP Tue Sep 22 18:18:35 EDT 2020 x86_64
User: www (1000)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.018111.cn/wp-content/plugins/wp-user-manager/includes/forms/class-wpum-forms.php
<?php
/**
 * Handles all the setup of the forms.
 *
 * @package     wp-user-manager
 * @copyright   Copyright (c) 2018, Alessandro Tesoro
 * @license     https://opensource.org/licenses/GPL-3.0 GNU Public License
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Base class for all WPUM forms.
 */
class WPUM_Forms {

	/**
	 * The single instance of the class.
	 *
	 * @var WPUM_Forms
	 */
	private static $instance = null;

	/**
	 * Allows for accessing single instance of class. Class should only be constructed once per call.
	 *
	 * @static
	 * @return WPUM_Forms Main instance.
	 */
	public static function instance() {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self();
		}
		return self::$instance;
	}

	/**
	 * Constructor.
	 */
	public function __construct() {
		add_action( 'init', array( $this, 'load_posted_form' ) );
	}

	/**
	 * If a form was posted, load its class so that it can be processed before display.
	 *
	 * @param null $form
	 *
	 * @return false|WPUM_Form
	 */
	public function load_posted_form( $form = null ) {
		if ( empty( $form ) ) {
			$form = filter_input( INPUT_POST, 'wpum_form' );
		}

		if ( ! empty( $form ) ) {
			return $this->load_form_class( sanitize_title( $form ) );
		}

		return false;
	}

	/**
	 * Load a form's class
	 *
	 * @param  string $form_name
	 * @return string class name on success, false on failure
	 */
	private function load_form_class( $form_name ) {
		if ( ! class_exists( 'WPUM_Form' ) ) {
			include WPUM_PLUGIN_DIR . 'includes/abstracts/class-wpum-form.php';
		}
		// Now try to load the form_name
		$form_class = apply_filters( 'wpum_load_form_class', 'WPUM_Form_' . str_replace( '-', '_', $form_name ), $form_name );
		$form_file  = WPUM_PLUGIN_DIR . 'includes/forms/class-wpum-form-' . $form_name . '.php';
		$form_file  = apply_filters( 'wpum_load_form_path', $form_file, $form_name );

		if ( class_exists( $form_class ) ) {
			return call_user_func( array( $form_class, 'instance' ) );
		}
		if ( ! file_exists( $form_file ) ) {
			return false;
		}
		if ( ! class_exists( $form_class ) ) {
			include $form_file;
		}
		// Init the form.
		return call_user_func( array( $form_class, 'instance' ) );
	}

	/**
	 * Returns the form content.
	 *
	 * @param string $form_name
	 * @param array  $atts Optional passed attributes
	 * @return string|null
	 */
	public function get_form( $form_name, $atts = array() ) {
		$form = $this->load_form_class( $form_name );
		if ( $form ) {
			ob_start();
			if ( isset( $atts['group_id'] ) ) {
				$form->__set( 'fields_group_id', $atts['group_id'] );
			}
			$form->output( $atts );
			return ob_get_clean();
		}
	}
}