@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * This is the template for the "Number Bubbles" Progress Steps |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | <!-- progress step display --> |
15 | 15 | <div class="ee-progress-step-main-container"> |
16 | 16 | <div class="progress-step-container number-bubbles-container"> |
17 | - <?php foreach ( $progress_steps as $progress_step ) : ?> |
|
18 | - <div data-step-nmbr="<?php echo $progress_step->order();?>" id="progress-step-<?php echo $progress_step->id(); ?>" class="progress-step-number <?php echo $progress_step->htmlClass(); ?>"> |
|
17 | + <?php foreach ($progress_steps as $progress_step) : ?> |
|
18 | + <div data-step-nmbr="<?php echo $progress_step->order(); ?>" id="progress-step-<?php echo $progress_step->id(); ?>" class="progress-step-number <?php echo $progress_step->htmlClass(); ?>"> |
|
19 | 19 | <div class="progress-step-line"></div> |
20 | 20 | <div class="progress-step-bubble"><p><?php echo $progress_step->order(); ?></p></div> |
21 | 21 | <span class="progress-step-text"><?php echo $progress_step->text(); ?></span> |
22 | 22 | </div> |
23 | - <?php endforeach;?> |
|
23 | + <?php endforeach; ?> |
|
24 | 24 | </div> |
25 | 25 | </div> |
26 | 26 |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | use EventEspresso\core\services\collections\CollectionInterface; |
11 | 11 | use EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface; |
12 | 12 | |
13 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
14 | - exit( 'No direct script access allowed' ); |
|
13 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
14 | + exit('No direct script access allowed'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | CollectionInterface $collection = null, |
67 | 67 | EE_Request $request = null |
68 | 68 | ) { |
69 | - $this->setDisplayStrategy( $display_strategy_name ); |
|
70 | - $this->setDefaultStep( $default_step ); |
|
71 | - if ( ! $collection instanceof CollectionInterface ) { |
|
72 | - $collection = new Collection( '\EventEspresso\core\services\progress_steps\ProgressStepInterface' ); |
|
69 | + $this->setDisplayStrategy($display_strategy_name); |
|
70 | + $this->setDefaultStep($default_step); |
|
71 | + if ( ! $collection instanceof CollectionInterface) { |
|
72 | + $collection = new Collection('\EventEspresso\core\services\progress_steps\ProgressStepInterface'); |
|
73 | 73 | } |
74 | 74 | $this->collection = $collection; |
75 | - if ( ! $request instanceof EE_Request ) { |
|
76 | - $request = \EE_Registry::instance()->load_core( 'Request' ); |
|
75 | + if ( ! $request instanceof EE_Request) { |
|
76 | + $request = \EE_Registry::instance()->load_core('Request'); |
|
77 | 77 | } |
78 | 78 | $this->request = $request; |
79 | 79 | } |
@@ -85,28 +85,28 @@ discard block |
||
85 | 85 | * @throws InvalidDataTypeException |
86 | 86 | * @throws InvalidClassException |
87 | 87 | */ |
88 | - protected function setDisplayStrategy( $display_strategy_name = 'number_bubbles' ) { |
|
89 | - if ( ! is_string( $display_strategy_name ) ) { |
|
90 | - throw new InvalidDataTypeException( '$display_strategy_name', $display_strategy_name, 'string' ); |
|
88 | + protected function setDisplayStrategy($display_strategy_name = 'number_bubbles') { |
|
89 | + if ( ! is_string($display_strategy_name)) { |
|
90 | + throw new InvalidDataTypeException('$display_strategy_name', $display_strategy_name, 'string'); |
|
91 | 91 | } |
92 | 92 | // build up FQCN from incoming display strategy folder name |
93 | 93 | $display_strategy_class = 'EventEspresso\core\services\progress_steps\display_strategies\\'; |
94 | - $display_strategy_class .= $display_strategy_name . '\\'; |
|
95 | - $display_strategy_class .= str_replace( ' ', '', ucwords( str_replace( '_', ' ', $display_strategy_name ) ) ); |
|
94 | + $display_strategy_class .= $display_strategy_name.'\\'; |
|
95 | + $display_strategy_class .= str_replace(' ', '', ucwords(str_replace('_', ' ', $display_strategy_name))); |
|
96 | 96 | $display_strategy_class .= 'ProgressStepsDisplay'; |
97 | 97 | $display_strategy_class = apply_filters( |
98 | 98 | 'FHEE__ProgressStepManager__setDisplayStrategy__display_strategy_class', |
99 | 99 | $display_strategy_class |
100 | 100 | ); |
101 | - if ( ! class_exists( $display_strategy_class ) ) { |
|
102 | - throw new InvalidClassException( $display_strategy_class ); |
|
101 | + if ( ! class_exists($display_strategy_class)) { |
|
102 | + throw new InvalidClassException($display_strategy_class); |
|
103 | 103 | } |
104 | 104 | $display_strategy = new $display_strategy_class(); |
105 | - if ( ! $display_strategy instanceof ProgressStepsDisplayInterface ) { |
|
105 | + if ( ! $display_strategy instanceof ProgressStepsDisplayInterface) { |
|
106 | 106 | throw new InvalidClassException( |
107 | 107 | $display_strategy_class, |
108 | 108 | sprintf( |
109 | - __( 'The "%1$s" Class needs to be an implementation of the "%1$s" Interface.', 'event_espresso' ), |
|
109 | + __('The "%1$s" Class needs to be an implementation of the "%1$s" Interface.', 'event_espresso'), |
|
110 | 110 | $display_strategy_class, |
111 | 111 | '\EventEspresso\core\services\progress_steps\display_strategies\ProgressStepsDisplayInterface' |
112 | 112 | ) |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | * @param string $default_step |
122 | 122 | * @throws InvalidDataTypeException |
123 | 123 | */ |
124 | - public function setDefaultStep( $default_step ) { |
|
125 | - if ( ! is_string( $default_step ) ) { |
|
126 | - throw new InvalidDataTypeException( '$default_step', $default_step, 'string' ); |
|
124 | + public function setDefaultStep($default_step) { |
|
125 | + if ( ! is_string($default_step)) { |
|
126 | + throw new InvalidDataTypeException('$default_step', $default_step, 'string'); |
|
127 | 127 | } |
128 | 128 | $this->default_step = $default_step; |
129 | 129 | } |
@@ -134,26 +134,26 @@ discard block |
||
134 | 134 | * @param string $step |
135 | 135 | * @throws \EventEspresso\Core\Exceptions\InvalidIdentifierException |
136 | 136 | */ |
137 | - public function setCurrentStep( $step = '' ) { |
|
137 | + public function setCurrentStep($step = '') { |
|
138 | 138 | // use incoming value if it's set, otherwise use request param if it's set, otherwise use default |
139 | - $step = ! empty( $step ) |
|
139 | + $step = ! empty($step) |
|
140 | 140 | ? $step |
141 | - : $this->request->get( 'ee-step', $this->default_step ); |
|
141 | + : $this->request->get('ee-step', $this->default_step); |
|
142 | 142 | // grab the step previously known as current, in case we need to revert |
143 | 143 | $current_current_step = $this->collection->current(); |
144 | 144 | // verify that requested step exists |
145 | - if ( ! $this->collection->has( $step ) ) { |
|
146 | - throw new InvalidIdentifierException( $step, $this->default_step ); |
|
145 | + if ( ! $this->collection->has($step)) { |
|
146 | + throw new InvalidIdentifierException($step, $this->default_step); |
|
147 | 147 | } |
148 | - if ( $this->collection->setCurrent( $step ) ) { |
|
148 | + if ($this->collection->setCurrent($step)) { |
|
149 | 149 | // if the old boss is the same as the new boss, then nothing changes |
150 | - if ( $this->collection->current() !== $current_current_step ) { |
|
151 | - $current_current_step->setIsCurrent( false ); |
|
150 | + if ($this->collection->current() !== $current_current_step) { |
|
151 | + $current_current_step->setIsCurrent(false); |
|
152 | 152 | } |
153 | 153 | $this->collection->current()->setIsCurrent(); |
154 | 154 | } else { |
155 | - $this->collection->setCurrent( $current_current_step->id() ); |
|
156 | - $current_current_step->setIsCurrent( true ); |
|
155 | + $this->collection->setCurrent($current_current_step->id()); |
|
156 | + $current_current_step->setIsCurrent(true); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | public function displaySteps() { |
195 | 195 | echo \EEH_Template::display_template( |
196 | 196 | $this->display_strategy->getTemplate(), |
197 | - array( 'progress_steps' => $this->collection ), |
|
197 | + array('progress_steps' => $this->collection), |
|
198 | 198 | true |
199 | 199 | ); |
200 | 200 | } |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\Core\Exceptions\InvalidDataTypeException; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @author Brent Christensen |
19 | 19 | * @since $VID:$ |
20 | 20 | */ |
21 | -class ProgressStep implements ProgressStepInterface{ |
|
21 | +class ProgressStep implements ProgressStepInterface { |
|
22 | 22 | |
23 | 23 | |
24 | 24 | /** |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * @param string $text |
65 | 65 | * @throws InvalidDataTypeException |
66 | 66 | */ |
67 | - public function __construct( $order, $id, $html_class, $text ) { |
|
68 | - $this->setOrder( $order ); |
|
69 | - $this->setId( $id ); |
|
70 | - $this->setHtmlClass( $html_class ); |
|
71 | - $this->setText( $text ); |
|
67 | + public function __construct($order, $id, $html_class, $text) { |
|
68 | + $this->setOrder($order); |
|
69 | + $this->setId($id); |
|
70 | + $this->setHtmlClass($html_class); |
|
71 | + $this->setText($text); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @param boolean $is_current |
87 | 87 | */ |
88 | - public function setIsCurrent( $is_current = true ) { |
|
89 | - $this->is_current = filter_var( $is_current, FILTER_VALIDATE_BOOLEAN ); |
|
88 | + public function setIsCurrent($is_current = true) { |
|
89 | + $this->is_current = filter_var($is_current, FILTER_VALIDATE_BOOLEAN); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * @param boolean $completed |
105 | 105 | */ |
106 | - public function setCompleted( $completed = true ) { |
|
107 | - $this->completed = filter_var( $completed, FILTER_VALIDATE_BOOLEAN ); |
|
106 | + public function setCompleted($completed = true) { |
|
107 | + $this->completed = filter_var($completed, FILTER_VALIDATE_BOOLEAN); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | * @param string $id |
124 | 124 | * @throws InvalidDataTypeException |
125 | 125 | */ |
126 | - protected function setId( $id = '' ) { |
|
127 | - if ( ! is_string( $id ) ) { |
|
128 | - throw new InvalidDataTypeException( '$id', $id, 'string' ); |
|
126 | + protected function setId($id = '') { |
|
127 | + if ( ! is_string($id)) { |
|
128 | + throw new InvalidDataTypeException('$id', $id, 'string'); |
|
129 | 129 | } |
130 | 130 | $this->id = $id; |
131 | 131 | } |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * @param int $order |
148 | 148 | * @throws InvalidDataTypeException |
149 | 149 | */ |
150 | - protected function setOrder( $order = 0 ) { |
|
151 | - if ( ! is_int( $order ) ) { |
|
152 | - throw new InvalidDataTypeException( '$order', $order, 'integer' ); |
|
150 | + protected function setOrder($order = 0) { |
|
151 | + if ( ! is_int($order)) { |
|
152 | + throw new InvalidDataTypeException('$order', $order, 'integer'); |
|
153 | 153 | } |
154 | 154 | $this->order = $order; |
155 | 155 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return string |
161 | 161 | */ |
162 | 162 | public function htmlClass() { |
163 | - return $this->is_current ? $this->html_class . ' progress-step-active' : $this->html_class; |
|
163 | + return $this->is_current ? $this->html_class.' progress-step-active' : $this->html_class; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | * @param string $html_class |
171 | 171 | * @throws InvalidDataTypeException |
172 | 172 | */ |
173 | - protected function setHtmlClass( $html_class ) { |
|
174 | - if ( ! is_string( $html_class ) ) { |
|
175 | - throw new InvalidDataTypeException( '$html_class', $html_class, 'string' ); |
|
173 | + protected function setHtmlClass($html_class) { |
|
174 | + if ( ! is_string($html_class)) { |
|
175 | + throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
|
176 | 176 | } |
177 | - if ( strpos( $html_class, 'progress-step-' ) === false ) { |
|
178 | - $html_class = 'progress-step-' . $html_class; |
|
177 | + if (strpos($html_class, 'progress-step-') === false) { |
|
178 | + $html_class = 'progress-step-'.$html_class; |
|
179 | 179 | } |
180 | 180 | $this->html_class = $html_class; |
181 | 181 | } |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | * @param string $text |
197 | 197 | * @throws InvalidDataTypeException |
198 | 198 | */ |
199 | - protected function setText( $text ) { |
|
200 | - if ( ! is_string( $text ) ) { |
|
201 | - throw new InvalidDataTypeException( '$text', $text, 'string' ); |
|
199 | + protected function setText($text) { |
|
200 | + if ( ! is_string($text)) { |
|
201 | + throw new InvalidDataTypeException('$text', $text, 'string'); |
|
202 | 202 | } |
203 | 203 | $this->text = $text; |
204 | 204 | } |