[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.14.248.199: ~ $
<?php
/**
 * LearnDash Factory Class.
 *
 * This is an abstract class for Course Posts, User Progression, etc.
 *
 * @since 2.5.0
 * @package LearnDash
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! class_exists( 'LDLMS_Factory' ) ) {

	/**
	 * Class for LearnDash LMS Factory.
	 *
	 * @since 2.5.0
	 */
	abstract class LDLMS_Factory {

		/**
		 * Static array of object instances.
		 *
		 * @var array $instances.
		 */
		protected static $instances = array();

		/**
		 * Public constructor for class.
		 *
		 * @since 2.5.0
		 */
		public function __construct() {
		}

		/**
		 * Get the current instance of this class or new.
		 *
		 * @since 2.5.0
		 *
		 * @param string $model        Unique identifier for model.
		 * @param string $key          Unique identifier for instance.
		 * @param bool   $add_instance Optional. Whether to add an instance. Default true.
		 */
		protected static function get_instance( $model = '', $key = null, $add_instance = true ) {
			$model = esc_attr( $model );
			$key   = esc_attr( $key );

			if ( ( ! empty( $model ) ) && ( ! empty( $key ) ) ) {
				if ( isset( self::$instances[ $model ][ $key ] ) ) {
					return self::$instances[ $model ][ $key ];
				} elseif ( true === $add_instance ) {
					return self::add_instance( $model, $key );
				}
			}
		}

		/**
		 * Add Model instance.
		 *
		 * @since 2.5.0
		 *
		 * @param string     $model    Class name to add.
		 * @param int|string $key      Unique key for instance.
		 * @param mixed      ...$args  Args passed to class constructor.
		 */
		protected static function add_instance( $model = '', $key = null, ...$args ) {
			$model = esc_attr( $model );
			$key   = esc_attr( $key );

			if ( ( ! empty( $model ) ) && ( class_exists( $model ) ) && ( ! empty( $key ) ) ) {
				if ( ! isset( self::$instances[ $model ] ) ) {
					self::$instances[ $model ] = array();
				}

				if ( isset( self::$instances[ $model ][ $key ] ) ) {
					return self::$instances[ $model ][ $key ];
				} else {
					try {
						$class                             = new ReflectionClass( $model );
						self::$instances[ $model ][ $key ] = $class->newInstanceArgs( $args );
						return self::$instances[ $model ][ $key ];
					} catch ( LDLMS_Exception_NotFound $e ) {
						return null;
					}
				}
			}
		}

		/**
		 * Remove Model instance.
		 *
		 * @since 2.5.0
		 *
		 * @param string     $model Class name to add.
		 * @param int|string $key   Unique ID for instance.
		 */
		protected static function remove_instance( $model = '', $key = null ) {
			$model = esc_attr( $model );
			$key   = esc_attr( $key );

			if ( ( ! empty( $model ) ) && ( class_exists( $model ) ) && ( ! empty( $key ) ) ) {
				if ( isset( self::$instances[ $model ][ $key ] ) ) {
					unset( self::$instances[ $model ][ $key ] );
					return true;
				}
			}
		}
	}
}


Filemanager

Name Type Size Permission Actions
answer-types Folder 0755
exam-question-types Folder 0755
class-ldlms-exception.php File 477 B 0644
class-ldlms-factory-post.php File 6.88 KB 0644
class-ldlms-factory-user.php File 2.61 KB 0644
class-ldlms-factory.php File 2.77 KB 0644
class-ldlms-model-activity.php File 3.5 KB 0644
class-ldlms-model-course-steps.php File 56.97 KB 0644
class-ldlms-model-course.php File 14.76 KB 0644
class-ldlms-model-exam-question.php File 10.88 KB 0644
class-ldlms-model-exam.php File 20.09 KB 0644
class-ldlms-model-group.php File 798 B 0644
class-ldlms-model-lesson.php File 1.78 KB 0644
class-ldlms-model-post.php File 4.09 KB 0644
class-ldlms-model-question.php File 839 B 0644
class-ldlms-model-quiz-questions.php File 20.34 KB 0644
class-ldlms-model-quiz.php File 772 B 0644
class-ldlms-model-topic.php File 787 B 0644
class-ldlms-model-user-course-progress.php File 33 KB 0644
class-ldlms-model-user-quiz-progress.php File 10.82 KB 0644
class-ldlms-model-user-quiz-resume.php File 5.24 KB 0644
class-ldlms-model-user.php File 755 B 0644
class-ldlms-model.php File 385 B 0644
class-loader.php File 1.13 KB 0644