| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* This class will handle file loading for frontend. |
| 5 |
* |
| 6 |
* @package Give |
| 7 |
* @subpackage Frontend |
| 8 |
* @copyright Copyright (c) 2018, GiveWP |
| 9 |
* @license https://opensource.org/licenses/gpl-license GNU Public License |
| 10 |
* @since 2.4.0 |
| 11 |
*/ |
| 12 |
class Give_Frontend { |
| 13 |
/** |
| 14 |
* Instance. |
| 15 |
* |
| 16 |
* @since 2.4.0 |
| 17 |
* @access private |
| 18 |
* @var |
| 19 |
*/ |
| 20 |
private static $instance; |
| 21 |
|
| 22 |
/** |
| 23 |
* Singleton pattern. |
| 24 |
* |
| 25 |
* @since 2.4.0 |
| 26 |
* @access private |
| 27 |
*/ |
| 28 |
private function __construct() { |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
/** |
| 33 |
* Get instance. |
| 34 |
* |
| 35 |
* @since 2.4.0 |
| 36 |
* @access public |
| 37 |
* @return Give_Frontend |
| 38 |
*/ |
| 39 |
public static function get_instance() { |
| 40 |
if ( null === static::$instance ) { |
| 41 |
self::$instance = new static(); |
| 42 |
self::$instance->setup(); |
| 43 |
} |
| 44 |
|
| 45 |
return self::$instance; |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Setup Admin |
| 50 |
* |
| 51 |
* @sinve 2.4.0 |
| 52 |
* @access private |
| 53 |
*/ |
| 54 |
private function setup() { |
| 55 |
$this->frontend_loading(); |
| 56 |
|
| 57 |
add_action( 'give_init', array( $this, 'bc_240' ), 0 ); |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Load core file |
| 62 |
* |
| 63 |
* @since 2.4.0 |
| 64 |
* @access private |
| 65 |
*/ |
| 66 |
private function frontend_loading() { |
| 67 |
require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
| 68 |
require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; // @todo: [refactor] can be load only for success and history page. |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Backward compatibility GIVE_VERSION < 2.4.0 |
| 73 |
* |
| 74 |
* @since 2.4.0 |
| 75 |
* @ccess public |
| 76 |
* |
| 77 |
* @param Give $give |
| 78 |
*/ |
| 79 |
public function bc_240( $give ) { |
| 80 |
$give->template_loader = new Give_Template_Loader(); |
| 81 |
$give->email_access = new Give_Email_Access(); |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
Give_Frontend::get_instance(); |
| 86 |
|