Skip to content

Commit 6f333a2

Browse files
author
Dean Sofer
committed
Merge pull request #4 from destinydriven/master
Addition of visibility keywords
2 parents f8b92cc + 3fea909 commit 6f333a2

File tree

7 files changed

+71
-71
lines changed

7 files changed

+71
-71
lines changed

Controller/Component/WizardComponent.php

+37-37
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class WizardComponent extends Component {
2424
* @var boolean
2525
* @access public
2626
*/
27-
var $autoAdvance = true;
27+
public $autoAdvance = true;
2828
/**
2929
* Option to automatically reset if the wizard does not follow "normal"
3030
* operation. (ie. manual url changing, navigation away and returning, etc.)
@@ -34,15 +34,15 @@ class WizardComponent extends Component {
3434
* @var boolean
3535
* @access public
3636
*/
37-
var $autoReset = false;
37+
public $autoReset = false;
3838
/**
3939
* If no processCallback() exists for the current step, the component will automatically
4040
* validate the model data against the models included in the controller's uses array.
4141
*
4242
* @var boolean
4343
* @access public
4444
*/
45-
var $autoValidate = false;
45+
public $autoValidate = false;
4646
/**
4747
* List of steps, in order, that are to be included in the wizard.
4848
* basic example: $steps = array('contact', 'payment', 'confirm');
@@ -57,103 +57,103 @@ class WizardComponent extends Component {
5757
* @var array
5858
* @access public
5959
*/
60-
var $steps = array();
60+
public $steps = array();
6161
/**
6262
* Controller action that processes your step.
6363
*
6464
* @var string
6565
* @access public
6666
*/
67-
var $action = 'wizard';
67+
public $action = 'wizard';
6868
/**
6969
* Url to be redirected to after the wizard has been completed.
7070
* Controller::afterComplete() is called directly before redirection.
7171
*
7272
* @var mixed
7373
* @access public
7474
*/
75-
var $completeUrl = '/';
75+
public $completeUrl = '/';
7676
/**
7777
* Url to be redirected to after 'Cancel' submit button has been pressed by user.
7878
*
7979
* @var mixed
8080
* @access public
8181
*/
82-
var $cancelUrl = '/';
82+
public $cancelUrl = '/';
8383
/**
8484
* Url to be redirected to after 'Draft' submit button has been pressed by user.
8585
*
8686
* @var mixed
8787
* @access public
8888
*/
89-
var $draftUrl = '/';
89+
public $draftUrl = '/';
9090
/**
9191
* If true, the first "non-skipped" branch in a group will be used if a branch has
9292
* not been included specifically.
9393
*
9494
* @var boolean
9595
* @access public
9696
*/
97-
var $defaultBranch = true;
97+
public $defaultBranch = true;
9898
/**
9999
* If true, the user will not be allowed to edit previously completed steps. They will be
100100
* "locked down" to the current step.
101101
*
102102
* @var boolean
103103
* @access public
104104
*/
105-
var $lockdown = false;
105+
public $lockdown = false;
106106
/**
107107
* If true, the component will render views found in views/{wizardAction}/{step}.ctp rather
108108
* than views/{step}.ctp.
109109
*
110110
* @var boolean
111111
* @access public
112112
*/
113-
var $nestedViews = false;
113+
public $nestedViews = false;
114114
/**
115115
* Internal step tracking.
116116
*
117117
* @var string
118118
* @access protected
119119
*/
120-
var $_currentStep = null;
120+
public $_currentStep = null;
121121
/**
122122
* Holds the session key for data storage.
123123
*
124124
* @var string
125125
* @access protected
126126
*/
127-
var $_sessionKey = null;
127+
public $_sessionKey = null;
128128
/**
129129
* Other session keys used.
130130
*
131131
* @var string
132132
* @access protected
133133
*/
134-
var $_configKey = null;
135-
var $_branchKey = null;
134+
public $_configKey = null;
135+
public $_branchKey = null;
136136
/**
137137
* Holds the array based url for redirecting.
138138
*
139139
* @var array
140140
* @access protected
141141
*/
142-
var $_wizardUrl = array();
142+
public $_wizardUrl = array();
143143
/**
144144
* Other components used.
145145
*
146146
* @var array
147147
* @access public
148148
*/
149-
var $components = array('Session');
149+
public $components = array('Session');
150150
/**
151151
* Initializes WizardComponent for use in the controller
152152
*
153153
* @param object $controller A reference to the instantiating controller object
154154
* @access public
155155
*/
156-
function initialize($controller, $settings = array()) {
156+
public function initialize($controller, $settings = array()) {
157157
$this->controller = $controller;
158158
$this->_set($settings);
159159

@@ -167,7 +167,7 @@ function initialize($controller, $settings = array()) {
167167
* @param object $controller A reference to the instantiating controller object
168168
* @access public
169169
*/
170-
function startup(&$controller) {
170+
public function startup(&$controller) {
171171
$this->steps = $this->_parseSteps($this->steps);
172172

173173
$this->config('action', $this->action);
@@ -183,7 +183,7 @@ function startup(&$controller) {
183183
* @param string $step Name of step associated in $this->steps to be processed.
184184
* @access public
185185
*/
186-
function process($step) {
186+
public function process($step) {
187187
if (isset($this->controller->request->data['Cancel'])) {
188188
if (method_exists($this->controller, '_beforeCancel')) {
189189
$this->controller->_beforeCancel($this->_getExpectedStep());
@@ -284,7 +284,7 @@ function process($step) {
284284
* @param boolean $skip Branch will be skipped instead of included if true.
285285
* @access public
286286
*/
287-
function branch($name, $skip = false) {
287+
public function branch($name, $skip = false) {
288288
$branches = array();
289289

290290
if ($this->controller->Session->check($this->_branchKey)) {
@@ -309,7 +309,7 @@ function branch($name, $skip = false) {
309309
* @return mixed
310310
* @access public
311311
*/
312-
function config($name, $value = null) {
312+
public function config($name, $value = null) {
313313
if ($value == null) {
314314
return $this->controller->Session->read("$this->_configKey.$name");
315315
}
@@ -322,7 +322,7 @@ function config($name, $value = null) {
322322
* @see WizardComponent::process()
323323
* @access public
324324
*/
325-
function loadDraft($draft = array()) {
325+
public function loadDraft($draft = array()) {
326326
if (!empty($draft['_draft']['current']['step'])) {
327327
$this->restore($draft);
328328
$this->redirect($draft['_draft']['current']['step']);
@@ -336,7 +336,7 @@ function loadDraft($draft = array()) {
336336
* @return mixed The value of the session variable
337337
* @access public
338338
*/
339-
function read($key = null) {
339+
public function read($key = null) {
340340
if ($key == null) {
341341
return $this->controller->Session->read($this->_sessionKey);
342342
} else {
@@ -353,7 +353,7 @@ function read($key = null) {
353353
* @see Controller::redirect()
354354
* @access public
355355
*/
356-
function redirect($step = null, $status = null, $exit = true) {
356+
public function redirect($step = null, $status = null, $exit = true) {
357357
if ($step == null) {
358358
$step = $this->_getExpectedStep();
359359
}
@@ -365,15 +365,15 @@ function redirect($step = null, $status = null, $exit = true) {
365365
*
366366
* @access public
367367
*/
368-
function resetWizard() {
368+
public function resetWizard() {
369369
$this->reset();
370370
}
371371
/**
372372
* Resets the wizard by deleting the wizard session.
373373
*
374374
* @access public
375375
*/
376-
function reset() {
376+
public function reset() {
377377
$this->controller->Session->delete($this->_branchKey);
378378
$this->controller->Session->delete($this->_sessionKey);
379379
}
@@ -384,7 +384,7 @@ function reset() {
384384
* @param array $data Data to be written to controller's wizard session.
385385
* @access public
386386
*/
387-
function restore($data = array()) {
387+
public function restore($data = array()) {
388388
$this->controller->Session->write($this->_sessionKey, $data);
389389
}
390390
/**
@@ -395,7 +395,7 @@ function restore($data = array()) {
395395
*
396396
* @access public
397397
*/
398-
function save($step = null, $data = null) {
398+
public function save($step = null, $data = null) {
399399
if (is_null($step)) {
400400
$step = $this->_currentStep;
401401
}
@@ -411,7 +411,7 @@ function save($step = null, $data = null) {
411411
* @param mixed $name The name of the session variable (or a path as sent to Set.extract)
412412
* @access public
413413
*/
414-
function delete($key = null) {
414+
public function delete($key = null) {
415415
if ($key == null) {
416416
return;
417417
} else {
@@ -425,7 +425,7 @@ function delete($key = null) {
425425
* @param string $branch Name of branch to be removed from steps array.
426426
* @access public
427427
*/
428-
function unbranch($branch) {
428+
public function unbranch($branch) {
429429
$this->controller->Session->delete("$this->_branchKey.$branch");
430430
}
431431
/**
@@ -434,7 +434,7 @@ function unbranch($branch) {
434434
* @return string $step or false if complete
435435
* @access protected
436436
*/
437-
function _getExpectedStep() {
437+
protected function _getExpectedStep() {
438438
foreach ($this->steps as $step) {
439439
if (!$this->controller->Session->check("$this->_sessionKey.$step")) {
440440
$this->config('expectedStep', $step);
@@ -449,7 +449,7 @@ function _getExpectedStep() {
449449
* @return mixed
450450
* @access protected
451451
*/
452-
function _branchType($branch) {
452+
protected function _branchType($branch) {
453453
if ($this->controller->Session->check("$this->_branchKey.$branch")) {
454454
return $this->controller->Session->read("$this->_branchKey.$branch");
455455
}
@@ -463,7 +463,7 @@ function _branchType($branch) {
463463
* @return array
464464
* @access protected
465465
*/
466-
function _parseSteps($steps) {
466+
protected function _parseSteps($steps) {
467467
$parsed = array();
468468

469469
foreach ($steps as $key => $name) {
@@ -501,7 +501,7 @@ function _parseSteps($steps) {
501501
* @param $step Step to point to.
502502
* @access protected
503503
*/
504-
function _setCurrentStep($step) {
504+
protected function _setCurrentStep($step) {
505505
$this->_currentStep = reset($this->steps);
506506

507507
while(current($this->steps) != $step) {
@@ -516,7 +516,7 @@ function _setCurrentStep($step) {
516516
* @return boolean
517517
* @access protected
518518
*/
519-
function _validateData() {
519+
protected function _validateData() {
520520
$controller =& $this->controller;
521521

522522
foreach ($controller->data as $model => $data) {
@@ -539,7 +539,7 @@ function _validateData() {
539539
* @return mixed
540540
* @access protected
541541
*/
542-
function _validStep($step) {
542+
protected function _validStep($step) {
543543
if (in_array($step, $this->steps)) {
544544
if ($this->lockdown) {
545545
return (array_search($step, $this->steps) == array_search($this->_getExpectedStep(), $this->steps));

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Wizard plugin for CakePHP automates several aspects of multi-page forms incl
66

77
* Clone/Copy the files in this directory into `app/plugins/wizard`
88
* Include the wizard component in your controller:
9-
* `var $components = array('Wizard.Wizard');`
9+
* `public $components = array('Wizard.Wizard');`
1010

1111
## Documentation
1212

README2.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Because of this, the wizard action itself can be very basic. It merely needs to
1010

1111
<pre><code>&lt;?php
1212
class SignupController extends AppController {
13-
var $components = array('Wizard');
13+
public $components = array('Wizard');
1414

15-
function beforeFilter() {
15+
public function beforeFilter() {
1616
$this-&gt;Wizard-&gt;steps = array('account', 'address', 'billing', 'review');
1717
}
1818

19-
function wizard($step = null) {
19+
public function wizard($step = null) {
2020
$this-&gt;Wizard-&gt;process($step);
2121
}
2222
}
@@ -41,20 +41,20 @@ So lets create some basic process callbacks. Real world examples would most like
4141

4242
<pre><code>&lt;?php
4343
class SignupController extends AppController {
44-
var $uses = array('Client', 'User', 'Billing');
45-
var $components = array('Wizard');
44+
public $uses = array('Client', 'User', 'Billing');
45+
public $components = array('Wizard');
4646

47-
function beforeFilter() {
47+
public function beforeFilter() {
4848
$this-&gt;Wizard-&gt;steps = array('account', 'address', 'billing', 'review');
4949
}
5050

51-
function wizard($step = null) {
51+
public function wizard($step = null) {
5252
$this-&gt;Wizard-&gt;process($step);
5353
}
5454
/**
5555
* [Wizard Process Callbacks]
5656
*/
57-
function processAccount() {
57+
public function processAccount() {
5858
$this-&gt;Client-&gt;set($this-&gt;data);
5959
$this-&gt;User-&gt;set($this-&gt;data);
6060

@@ -64,7 +64,7 @@ class SignupController extends AppController {
6464
return false;
6565
}
6666

67-
function processAddress() {
67+
public function processAddress() {
6868
$this-&gt;Client-&gt;set($this-&gt;data);
6969

7070
if($this-&gt;Client-&gt;validates()) {
@@ -73,7 +73,7 @@ class SignupController extends AppController {
7373
return false;
7474
}
7575

76-
function processBilling() {
76+
public function processBilling() {
7777
$this-&gt;Billing-&gt;set($this-&gt;data);
7878

7979
if($this-&gt;Billing-&gt;validates()) {
@@ -82,7 +82,7 @@ class SignupController extends AppController {
8282
return false;
8383
}
8484

85-
function processReview() {
85+
public function processReview() {
8686
return true;
8787
}
8888
}

0 commit comments

Comments
 (0)