# css-javascript-toolbox/12.0.5/includes/installer/upgrade/template.class.php

CSS &amp; JavaScript Toolbox, version 12.0.5. 58 lines.

- Page: https://pluginprobe.com/plugins/css-javascript-toolbox/12.0.5/code/includes/installer/upgrade/template.class.php
- Raw: https://pluginprobe.com/plugins/css-javascript-toolbox/12.0.5/raw/includes/installer/upgrade/template.class.php
- Modified: 2025-10-06T13:35:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/css-javascript-toolbox/12.0.5/code/includes/installer/upgrade/template.class.php#L10-L20`.

```php
<?php
/**
* 
*/

/**
* 
*/
class CJTInstallerTemplate extends ArrayIterator {
	
	/**
	* put your comment there...
	* 
	* @var mixed
	*/
	protected $model;
	
	/**
	* put your comment there...
	* 
	* @param mixed $templates
	* @return CJTInstallerTemplate
	*/
	public function __construct($templates) {
		// Initialize!
		$this->model = CJTModel::getInstance('template');
		// Initialize Iterator!
		parent::__construct(is_array($templates) ? $templates : array());
	}
	
	/**
	* put your comment there...
	* 
	*/
	public function upgrade() {
		// Initiaize!
		$template = $this->current();
		$item = array();
		// Revision data!
		$revision['code'] = $template['code'];
		$revision['changeLog'] = 'Just created...';
		$revision['state'] = 'release';
		// Template data!
		unset($template['code']);
		// js type name changed to javascript!
		if ($template['type'] == 'js') {
			$template['type'] = 'javascript';
		}
		// Build template-model template item sturture!
		$item['template'] = $template;
		$item['revision'] = $revision;
		// Save template  into db!
		$this->model->inputs['item'] = $item;
		$this->model->save();
	}
	
} // End class.

```
