balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-redux-path.php (1087B)


      1 <?php
      2 /**
      3  * Redux Path Class
      4  *
      5  * @class Redux_Path
      6  * @version 4.0.0
      7  * @package Redux Framework
      8  */
      9 
     10 defined( 'ABSPATH' ) || exit;
     11 
     12 if ( ! class_exists( 'Redux_Path', false ) ) {
     13 
     14 	/**
     15 	 * Class Redux_Path
     16 	 */
     17 	class Redux_Path {
     18 
     19 		/**
     20 		 * Class init
     21 		 */
     22 		public static function init() {
     23 
     24 		}
     25 
     26 		/**
     27 		 * Gets Redux path.
     28 		 *
     29 		 * @param string $relative_path Self explanitory.
     30 		 *
     31 		 * @return string
     32 		 */
     33 		public static function get_path( string $relative_path ): string {
     34 			$path = Redux_Core::$redux_path . $relative_path;
     35 
     36 			if ( Redux_Core::$pro_loaded ) {
     37 				$pro_path = '';
     38 
     39 				if ( class_exists( 'Redux_Pro' ) ) {
     40 					$pro_path = Redux_Pro::$dir . '/core' . $relative_path;
     41 				}
     42 
     43 				if ( file_exists( $pro_path ) ) {
     44 					$path = $pro_path;
     45 				}
     46 			}
     47 
     48 			return $path;
     49 		}
     50 
     51 		/**
     52 		 * Require class.
     53 		 *
     54 		 * @param string $relative_path Path.
     55 		 */
     56 		public static function require_class( string $relative_path ) {
     57 			$path = self::get_path( $relative_path );
     58 
     59 			if ( file_exists( $path ) ) {
     60 				require_once $path;
     61 			}
     62 		}
     63 	}
     64 
     65 	Redux_Path::init();
     66 }