PluginProbe
CSS & JavaScript Toolbox / 8.0.3
CSS & JavaScript Toolbox v8.0.3
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / includes / installer / upgrade / template.class.php

template.class.php in CSS & JavaScript Toolbox 8.0.3, at includes/installer/upgrade/template.class.php

58 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 class CJTInstallerTemplate extends ArrayIterator {
10
11 /**
12 * put your comment there...
13 *
14 * @var mixed
15 */
16 protected $model;
17
18 /**
19 * put your comment there...
20 *
21 * @param mixed $templates
22 * @return CJTInstallerTemplate
23 */
24 public function __construct($templates) {
25 // Initialize!
26 $this->model = CJTModel::getInstance('template');
27 // Initialize Iterator!
28 parent::__construct(is_array($templates) ? $templates : array());
29 }
30
31 /**
32 * put your comment there...
33 *
34 */
35 public function upgrade() {
36 // Initiaize!
37 $template = $this->current();
38 $item = array();
39 // Revision data!
40 $revision['code'] = $template['code'];
41 $revision['changeLog'] = 'Just created...';
42 $revision['state'] = 'release';
43 // Template data!
44 unset($template['code']);
45 // js type name changed to javascript!
46 if ($template['type'] == 'js') {
47 $template['type'] = 'javascript';
48 }
49 // Build template-model template item sturture!
50 $item['template'] = $template;
51 $item['revision'] = $revision;
52 // Save template into db!
53 $this->model->inputs['item'] = $item;
54 $this->model->save();
55 }
56
57 } // End class.
58