XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
theme.php
1<?php
10
11if (!defined('XOOPS_ROOT_PATH')) {
12 exit();
13}
14
15require_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
16
17class LegacyThemeObject extends XoopsSimpleObject
18{
19 public function LegacyThemeObject()
20 {
21 self::__construct();
22 }
23
24 public function __construct()
25 {
26 static $initVars;
27 if (isset($initVars)) {
28 $this->mVars = $initVars;
29 return;
30 }
31 $this->initVar('name', XOBJ_DTYPE_STRING, '', true, 191);
32 $this->initVar('dirname', XOBJ_DTYPE_STRING, '', true, 191);
33 $this->initVar('screenshot', XOBJ_DTYPE_STRING, '', false, 191);
34 $this->initVar('description', XOBJ_DTYPE_STRING, '', false, 191);
35 $this->initVar('format', XOBJ_DTYPE_STRING, '', true, 191);
36 $this->initVar('render_system', XOBJ_DTYPE_STRING, '', true, 191);
37 $this->initVar('themeoptions', XOBJ_DTYPE_STRING, '', true, 191);
38 $this->initVar('version', XOBJ_DTYPE_STRING, '', true, 32);
39 $this->initVar('author', XOBJ_DTYPE_STRING, '', true, 64);
40 $this->initVar('url', XOBJ_DTYPE_STRING, '', true, 191);
41 $this->initVar('license', XOBJ_DTYPE_STRING, '', true, 191);
42
43 // For TYPO
44 $this->initVar('licence', XOBJ_DTYPE_STRING, '', true, 191);
45 $initVars = $this->mVars;
46 }
47}
48
49class LegacyThemeHandler extends XoopsObjectHandler
50{
51 public $_mResults = [];
52
56 public $mGetInstalledThemes = null;
57
58 public function LegacyThemeHandler(&$db)
59 {
60 self::__construct($db);
61 }
62
63 public function __construct(&$db)
64 {
65 $this->mGetInstalledThemes =new XCube_Delegate();
66 $this->mGetInstalledThemes->register('LegacyThemeHandler.GetInstalledThemes');
67 }
68
69 public function &create()
70 {
71 $to = new LegacyThemeObject();
72 return $to;
73 }
74
75 public function &get($name)
76 {
77 $ret = null;
78 $this->_makeCache();
79
80 foreach (array_keys($this->_mResults) as $key) {
81 if ($this->_mResults[$key]->get('dirname') == $name) {
82 return $this->_mResults[$key];
83 }
84 }
85
86 return $ret;
87 }
88
89 public function &getObjects($criteria = null, $id_as_key = false)
90 {
91 $this->_makeCache();
92 return $this->_mResults;
93 }
94
98 public function _makeCache()
99 {
100 if (0 === count($this->_mResults)) {
101 $t_themeArr = [];
102 $this->mGetInstalledThemes->call(new XCube_Ref($t_themeArr));
103
104 foreach ($t_themeArr as $theme) {
105 $obj =& $this->create();
106 $obj->assignVars(
107 [
108 'name' => $theme->mName,
109 'dirname' => $theme->mDirname,
110 'screenshot' => $theme->mScreenShot,
111 'description' => $theme->mDescription,
112 'format' => $theme->mFormat,
113 'render_system' => $theme->mRenderSystemName,
114 'themeoptions' => $theme->mThemeOptions,
115 'version' => $theme->mVersion,
116 'author' => $theme->mAuthor,
117 'url' => $theme->mUrl,
118 'license' => $theme->mLicence
119 ]
120 );
121 $this->_mResults[] =& $obj;
122 unset($obj);
123 }
124 }
125 }
126
127 public function insert(&$obj, $force = false)
128 {
129 return false;
130 }
131
132 public function delete(&$obj, $force = false)
133 {
134 return false;
135 }
136}
__construct(&$db)
Definition theme.php:63
[Final] Used for the simple mechanism for common delegation in XCube.