1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | namespace lsx_health_plan\classes; |
||
3 | |||
4 | /** |
||
5 | * Contains the endpoints |
||
6 | * |
||
7 | * @package lsx-health-plan |
||
8 | */ |
||
9 | class Modals { |
||
10 | |||
11 | /** |
||
12 | * Holds class instance |
||
13 | * |
||
14 | * @since 1.0.0 |
||
15 | * |
||
16 | * @var object \lsx_health_plan\classes\Modals() |
||
17 | */ |
||
18 | protected static $instance = null; |
||
19 | |||
20 | /** |
||
21 | * Holds the modals to be outputted |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | public $modals = array(); |
||
26 | |||
27 | /** |
||
28 | * Constructor |
||
29 | */ |
||
30 | public function __construct() { |
||
0 ignored issues
–
show
|
|||
31 | add_action( 'wp_footer', array( $this, 'output_modals' ) ); |
||
32 | } |
||
0 ignored issues
–
show
|
|||
33 | |||
34 | /** |
||
35 | * Return an instance of this class. |
||
36 | * |
||
37 | * @since 1.0.0 |
||
38 | * |
||
39 | * @return object \lsx_health_plan\classes\Endpoints() A single instance of this class. |
||
40 | */ |
||
41 | public static function get_instance() { |
||
42 | // If the single instance hasn't been set, set it now. |
||
43 | if ( null === self::$instance ) { |
||
0 ignored issues
–
show
|
|||
44 | self::$instance = new self(); |
||
45 | } |
||
0 ignored issues
–
show
|
|||
46 | return self::$instance; |
||
47 | } |
||
0 ignored issues
–
show
|
|||
48 | |||
49 | /** |
||
50 | * Registers a modal to be outputted |
||
51 | * |
||
52 | * @param array $modal |
||
0 ignored issues
–
show
|
|||
53 | * @param string $index |
||
0 ignored issues
–
show
|
|||
54 | * @return void |
||
55 | */ |
||
56 | public function register_modal( $modal = array(), $index = '' ) { |
||
57 | if ( '' !== $index && ! empty( $modal ) ) { |
||
0 ignored issues
–
show
|
|||
58 | $modal['id'] = $index; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 12 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
59 | $this->modals[ $index ] = $modal; |
||
60 | } |
||
61 | } |
||
0 ignored issues
–
show
|
|||
62 | |||
63 | /** |
||
64 | * Registers the rewrites. |
||
65 | */ |
||
66 | public function output_modals() { |
||
67 | if ( ! empty( $this->modals ) ) { |
||
0 ignored issues
–
show
|
|||
68 | wp_enqueue_script( 'lsx-health-plan-modals', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-modals.min.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
||
69 | |||
70 | foreach ( $this->modals as $index => $modal ) { |
||
0 ignored issues
–
show
|
|||
71 | \lsx_health_plan\functions\output_modal( $modal ); |
||
72 | } |
||
73 | } |
||
74 | } |
||
0 ignored issues
–
show
|
|||
75 | } |
||
76 |