| 1 |
<?php |
| 2 |
|
| 3 |
namespace Better_Payment\Lite\Admin; |
| 4 |
|
| 5 |
use Better_Payment\Lite\Controller; |
| 6 |
|
| 7 |
/** |
| 8 |
* Exit if accessed directly |
| 9 |
*/ |
| 10 |
if (!defined('ABSPATH')) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Front-end legacy script loader. |
| 16 |
* |
| 17 |
* The backend half of this class enqueued the old PHP admin's scripts and styles |
| 18 |
* on the `better-payment-settings` / `-transactions` / `-analytics` pages. Those |
| 19 |
* pages no longer exist (the admin is React — see ReactAdmin), so only the |
| 20 |
* front-end enqueue remains: the user-dashboard templates still rely on |
| 21 |
* admin.min.js for their copy-to-clipboard buttons. The jQuery UI datepicker is |
| 22 |
* Pro's (analytics report); its scripts declare that dependency themselves. |
| 23 |
* |
| 24 |
* @since 0.0.1 |
| 25 |
*/ |
| 26 |
class Menu extends Controller{ |
| 27 |
|
| 28 |
/** |
| 29 |
* Initialize the class |
| 30 |
* |
| 31 |
* @since 0.0.1 |
| 32 |
*/ |
| 33 |
function __construct( ) { |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Register the front-end enqueue. |
| 39 |
* |
| 40 |
* @param string $end Only 'frontend' registers anything; the parameter is kept |
| 41 |
* for existing callers (Frontend passes it). |
| 42 |
* @since 0.0.1 |
| 43 |
*/ |
| 44 |
public function init($end = 'frontend'){ |
| 45 |
if('frontend' === $end){ |
| 46 |
add_action('wp_enqueue_scripts', array($this, 'handle_scripts_and_styles_frontend')); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Enqueue scripts and styles |
| 52 |
* |
| 53 |
* @since 0.0.1 |
| 54 |
*/ |
| 55 |
public function handle_scripts_and_styles_frontend() { |
| 56 |
wp_enqueue_style('toastr-css'); |
| 57 |
|
| 58 |
wp_enqueue_script('toastr-js'); |
| 59 |
wp_enqueue_script('better-payment-script'); |
| 60 |
wp_enqueue_script('bp-admin-settings'); |
| 61 |
wp_enqueue_script('better-payment-common-script'); |
| 62 |
} |
| 63 |
} |
| 64 |
|