PluginProbe
CSS & JavaScript Toolbox / 7.1
CSS & JavaScript Toolbox v7.1
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 / models / settings.php

settings.php in CSS & JavaScript Toolbox 7.1, at models/settings.php

56 lines 992 B
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 CJTSettingsModel {
10
11 /**
12 *
13 */
14 const SETTINGS_PAGE_DIR = 'settings';
15
16 /**
17 * put your comment there...
18 *
19 * @var mixed
20 */
21 protected $settingsPagesDir = self::SETTINGS_PAGE_DIR;
22
23 /**
24 * put your comment there...
25 *
26 * @param mixed $page
27 */
28 public function loadPage($name) {
29 // Settings page file name.
30 $pageFile = "{$name}.php";
31 require_once "{$this->settingsPagesDir}/{$pageFile}";
32 // Create settings page object.
33 $name = str_replace(array('-', '_'), '', ucwords($name));
34 $className = "CJTSettings{$name}Page";
35 return new $className();
36 }
37
38 /**
39 * put your comment there...
40 *
41 * @param mixed $settings
42 */
43 public function save($settings) {
44 // Each element represent a single settings page.
45 foreach ($settings as $page => $data) {
46 // Get page object.
47 $pObject = $this->loadPage($page);
48 // Update page settings.
49 $pObject->set($data);
50 // Save into the database.
51 $pObject->update();
52 }
53 }
54
55 } // End class.
56