23 $path = sprintf(
'./widgets/%s/', $widget_name);
24 if(is_dir($path))
return $path;
34 $path = sprintf(
'./widgetstyles/%s/', $widgetStyle_name);
35 if(is_dir($path))
return $path;
46 $tpl = sprintf(
'%swidgetstyle.html', $path);
56 $oAutoinstallModel =
getModel(
'autoinstall');
60 $searched_count = count($searched_list);
61 if(!$searched_count)
return;
64 for($i=0;$i<$searched_count;$i++)
67 $widget = $searched_list[$i];
73 $widget_info =
new stdClass();
77 $packageSrl = $oAutoinstallModel->getPackageSrlByPath($widget_info->path);
78 $widget_info->remove_url = $oAutoinstallModel->getRemoveUrlByPackageSrl($packageSrl);
81 $package = $oAutoinstallModel->getInstalledPackages($packageSrl);
82 $widget_info->need_update = $package[$packageSrl]->need_update;
85 if ($widget_info->need_update ==
'Y')
87 $widget_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
90 $list[] = $widget_info;
103 $searched_count = count($searched_list);
104 if(!$searched_count)
return;
105 sort($searched_list);
107 for($i=0;$i<$searched_count;$i++)
110 $widgetStyle = $searched_list[$i];
114 $list[] = $widgetStyle_info;
127 if(!$widget_path)
return;
129 $xml_file = sprintf(
"%sconf/info.xml", $widget_path);
130 if(!file_exists($xml_file))
return;
134 if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file))
136 @include($cache_file);
141 $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
142 $xml_obj = $tmp_xml_obj->widget;
143 if(!$xml_obj)
return;
145 $buff =
'$widget_info = new stdClass;';
147 if($xml_obj->version && $xml_obj->attrs->version ==
'0.2')
150 $buff .= sprintf(
'$widget_info->widget = "%s";', $widget);
151 $buff .= sprintf(
'$widget_info->path = "%s";', $widget_path);
152 $buff .= sprintf(
'$widget_info->title = "%s";', $xml_obj->title->body);
153 $buff .= sprintf(
'$widget_info->description = "%s";', $xml_obj->description->body);
154 $buff .= sprintf(
'$widget_info->version = "%s";', $xml_obj->version->body);
155 sscanf($xml_obj->date->body,
'%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
156 $date = sprintf(
'%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
157 $buff .= sprintf(
'$widget_info->date = "%s";', $date);
158 $buff .= sprintf(
'$widget_info->homepage = "%s";', $xml_obj->link->body);
159 $buff .= sprintf(
'$widget_info->license = "%s";', $xml_obj->license->body);
160 $buff .= sprintf(
'$widget_info->license_link = "%s";', $xml_obj->license->attrs->link);
161 $buff .= sprintf(
'$widget_info->widget_srl = $widget_srl;');
162 $buff .= sprintf(
'$widget_info->widget_title = $widget_title;');
164 if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
165 else $author_list = $xml_obj->author;
167 for($i=0; $i < count($author_list); $i++)
169 $buff .=
'$widget_info->author['.$i.
'] = new stdClass;';
170 $buff .= sprintf(
'$widget_info->author['.$i.
']->name = "%s";', $author_list[$i]->name->body);
171 $buff .= sprintf(
'$widget_info->author['.$i.
']->email_address = "%s";', $author_list[$i]->attrs->email_address);
172 $buff .= sprintf(
'$widget_info->author['.$i.
']->homepage = "%s";', $author_list[$i]->attrs->link);
178 $buff .= sprintf(
'$widget_info->widget = "%s";', $widget);
179 $buff .= sprintf(
'$widget_info->path = "%s";', $widget_path);
180 $buff .= sprintf(
'$widget_info->title = "%s";', $xml_obj->title->body);
181 $buff .= sprintf(
'$widget_info->description = "%s";', $xml_obj->author->description->body);
182 $buff .= sprintf(
'$widget_info->version = "%s";', $xml_obj->attrs->version);
183 sscanf($xml_obj->author->attrs->date,
'%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
184 $date = sprintf(
'%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
185 $buff .= sprintf(
'$widget_info->date = "%s";', $date);
186 $buff .= sprintf(
'$widget_info->widget_srl = $widget_srl;');
187 $buff .= sprintf(
'$widget_info->widget_title = $widget_title;');
189 $buff .=
'$widget_info->author[0] = new stdClass;';
190 $buff .= sprintf(
'$widget_info->author[0]->name = "%s";', $xml_obj->author->name->body);
191 $buff .= sprintf(
'$widget_info->author[0]->email_address = "%s";', $xml_obj->author->attrs->email_address);
192 $buff .= sprintf(
'$widget_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link);
195 $extra_var_groups = $xml_obj->extra_vars->group;
196 if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
197 if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
198 foreach($extra_var_groups as $group)
201 if(!is_array($group->var))
$extra_vars = array($group->var);
207 $buff .= sprintf(
'$widget_info->extra_var_count = "%s";', $extra_var_count);
208 for($i=0;$i<$extra_var_count;$i++)
214 $id = $var->attrs->id?$var->attrs->id:$var->attrs->name;
215 $name = $var->name->body?$var->name->body:$var->title->body;
216 $type = $var->attrs->type?$var->attrs->type:$var->type->body;
217 $buff .= sprintf(
'$widget_info->extra_var->%s = new stdClass;', $id);
218 if($type ==
'filebox')
220 $buff .= sprintf(
'$widget_info->extra_var->%s->filter = "%s";', $id, $var->type->attrs->filter);
221 $buff .= sprintf(
'$widget_info->extra_var->%s->allow_multiple = "%s";', $id, $var->type->attrs->allow_multiple);
224 $buff .= sprintf(
'$widget_info->extra_var->%s->group = "%s";', $id, $group->title->body);
225 $buff .= sprintf(
'$widget_info->extra_var->%s->name = "%s";', $id, $name);
226 $buff .= sprintf(
'$widget_info->extra_var->%s->type = "%s";', $id, $type);
227 $buff .= sprintf(
'$widget_info->extra_var->%s->value = $vars->%s;', $id, $id);
228 $buff .= sprintf(
'$widget_info->extra_var->%s->description = "%s";', $id, str_replace(
'"',
'\"',$var->description->body));
230 $options = $var->options;
231 if(!$options)
continue;
233 if(!is_array($options)) $options = array($options);
234 $options_count = count($options);
235 for($j=0;$j<$options_count;$j++)
237 $buff .= sprintf(
'$widget_info->extra_var->%s->options["%s"] = "%s";', $id, $options[$j]->value->body, $options[$j]->name->body);
239 if($options[$j]->attrs->default && $options[$j]->attrs->default==
'true')
241 $buff .= sprintf(
'$widget_info->extra_var->%s->default_options["%s"] = true;', $id, $options[$j]->value->body);
244 if($options[$j]->attrs->init && $options[$j]->attrs->init==
'true')
246 $buff .= sprintf(
'$widget_info->extra_var->%s->init_options["%s"] = true;', $id, $options[$j]->value->body);
253 $buff =
'<?php if(!defined("__XE__")) exit(); '.$buff.
' ?>';
256 if(file_exists($cache_file)) @include($cache_file);
267 if(!$widgetStyle_path)
return;
268 $xml_file = sprintf(
"%sskin.xml", $widgetStyle_path);
269 if(!file_exists($xml_file))
return;
273 if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file))
275 @include($cache_file);
276 return $widgetStyle_info;
280 $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
281 $xml_obj = $tmp_xml_obj->widgetstyle;
282 if(!$xml_obj)
return;
285 $buff[] =
'<?php if(!defined("__XE__")) exit();';
286 $buff[] =
'$widgetStyle_info = new stdClass();';
289 $buff[] = sprintf(
'$widgetStyle_info->widgetStyle = "%s";', $widgetStyle);
290 $buff[] = sprintf(
'$widgetStyle_info->path = "%s";', $widgetStyle_path);
291 $buff[] = sprintf(
'$widgetStyle_info->title = "%s";', $xml_obj->title->body);
292 $buff[] = sprintf(
'$widgetStyle_info->description = "%s";', $xml_obj->description->body);
293 $buff[] = sprintf(
'$widgetStyle_info->version = "%s";', $xml_obj->version->body);
294 sscanf($xml_obj->date->body,
'%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
295 $date = sprintf(
'%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
296 $buff[] = sprintf(
'$widgetStyle_info->date = "%s";', $date);
297 $buff[] = sprintf(
'$widgetStyle_info->homepage = "%s";', $xml_obj->link->body);
298 $buff[] = sprintf(
'$widgetStyle_info->license = "%s";', $xml_obj->license->body);
299 $buff[] = sprintf(
'$widgetStyle_info->license_link = "%s";', $xml_obj->license->attrs->link);
302 if(!$xml_obj->preview->body) $xml_obj->preview->body =
'preview.jpg';
303 $preview_file = sprintf(
"%s%s", $widgetStyle_path,$xml_obj->preview->body);
304 if(file_exists($preview_file)) $buff[] = sprintf(
'$widgetStyle_info->preview = "%s";', $preview_file);
307 if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
308 else $author_list = $xml_obj->author;
310 foreach($author_list as $idx => $author)
312 $buff[] = sprintf(
'$widgetStyle_info->author[%d] = new stdClass();', $idx);
313 $buff[] = sprintf(
'$widgetStyle_info->author[%d]->name = "%s";', $idx, $author->name->body);
314 $buff[] = sprintf(
'$widgetStyle_info->author[%d]->email_address = "%s";', $idx, $author->attrs->email_address);
315 $buff[] = sprintf(
'$widgetStyle_info->author[%d]->homepage = "%s";', $idx, $author->attrs->link);
319 $extra_var_groups = $xml_obj->extra_vars->group;
320 if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
321 if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
323 $extra_var_count = 0;
324 $buff[] = sprintf(
'$widgetStyle_info->extra_var = new stdClass();', $extra_var_count);
325 foreach($extra_var_groups as $group)
327 $extra_vars = (!is_array($group->var)) ? array($group->var) : $group->var;
334 $id = ($var->attrs->id) ? $var->attrs->id : $var->attrs->name;
335 $name = ($var->name->body) ? $var->name->body : $var->title->body;
336 $type = ($var->attrs->type) ? $var->attrs->type : $var->type->body;
338 $buff[] = sprintf(
'$widgetStyle_info->extra_var->%s = new stdClass();', $id);
339 $buff[] = sprintf(
'$widgetStyle_info->extra_var->%s->group = "%s";', $id, $group->title->body);
340 $buff[] = sprintf(
'$widgetStyle_info->extra_var->%s->name = "%s";', $id, $name);
341 $buff[] = sprintf(
'$widgetStyle_info->extra_var->%s->type = "%s";', $id, $type);
342 if($type ==
'filebox')
344 $buff[] = sprintf(
'$widgetStyle_info->extra_var->%s->filter = "%s";', $id, $var->attrs->filter);
345 $buff[] = sprintf(
'$widgetStyle_info->extra_var->%s->allow_multiple = "%s";', $id, $var->attrs->allow_multiple);
347 $buff[] = sprintf(
'$widgetStyle_info->extra_var->%s->value = $vars->%s;', $id, $id);
348 $buff[] = sprintf(
'$widgetStyle_info->extra_var->%s->description = "%s";', $id, str_replace(
'"',
'\"',$var->description->body));
352 $var_options = (!is_array($var->options)) ? array($var->options) : $var->options;
353 foreach($var_options as $option_item)
355 $buff[] = sprintf(
'$widgetStyle_info->extra_var->%s->options["%s"] = "%s";', $id, $option_item->value->body, $option_item->name->body);
361 $buff[] = sprintf(
'$widgetStyle_info->extra_var_count = %d;', $extra_var_count);
365 if(file_exists($cache_file)) @include($cache_file);
367 return $widgetStyle_info;
foreach($sitemap as $id=> &$val) $extra_vars
writeFile($filename, $buff, $mode="w")
readDir($path, $filter= '', $to_lower=FALSE, $concat_prefix=FALSE)