34 function getLayoutList($site_srl = 0, $layout_type=
"P", $columnList = array())
39 $site_srl = (int)$site_module_info->site_srl;
41 $args =
new stdClass();
42 $args->site_srl = $site_srl;
43 $args->layout_type = $layout_type;
46 foreach(
$output->data as $no => &$val)
55 $siteDefaultLayoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($layout_type, $site_srl);
56 if($siteDefaultLayoutSrl)
58 $siteDefaultLayoutInfo = $this->getlayout($siteDefaultLayoutSrl);
59 $newLayout = sprintf(
'%s, %s', $siteDefaultLayoutInfo->title, $siteDefaultLayoutInfo->layout);
60 $siteDefaultLayoutInfo->layout_srl = -1;
62 $siteDefaultLayoutInfo->layout = $newLayout;
64 array_unshift(
$output->data, $siteDefaultLayoutInfo);
83 foreach($layoutList as $key => $val)
85 if($thumbs[$val->layouts])
87 $val->thumbnail = $thumbs[$val->layouts];
91 $token = explode(
'|@|', $val->layout);
92 if(count($token) == 2)
94 $thumbnailPath = sprintf(
'./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]);
98 $thumbnailPath = sprintf(
'./layouts/%s/thumbnail.png' , $val->layout);
100 if(is_readable($thumbnailPath))
102 $val->thumbnail = $thumbnailPath;
106 $val->thumbnail = sprintf(
'./modules/layout/tpl/img/noThumbnail.png');
108 $thumbs[$val->layout] = $val->thumbnail;
110 $this->
add(
'layout_list', $layoutList);
126 $siteSrl = (int)$siteModuleInfo->site_srl;
128 $args =
new stdClass();
129 $args->site_srl = $siteSrl;
130 $args->layout_type = $layoutType;
131 $args->layout = $layout;
135 $instanceList = array();
138 foreach(
$output->data as $no => $iInfo)
142 $instanceList[] = $iInfo->layout;
152 $downloadedList = array();
153 $titleList = array();
155 if(is_array($_downloadedList))
157 foreach($_downloadedList as $dLayoutInfo)
159 $downloadedList[$dLayoutInfo->layout] = $dLayoutInfo->layout;
160 $titleList[$dLayoutInfo->layout] = $dLayoutInfo->title;
166 if(count($instanceList) < 1 && $downloadedList[$layout])
168 $insertArgs =
new stdClass();
169 $insertArgs->site_srl = $siteSrl;
171 $insertArgs->layout = $layout;
172 $insertArgs->title = $titleList[$layout];
173 $insertArgs->layout_type = $layoutType;
177 $isCreateInstance = TRUE;
183 $noInstanceList = array_diff($downloadedList, $instanceList);
184 foreach($noInstanceList as $layoutName)
186 $insertArgs =
new stdClass();
187 $insertArgs->site_srl = $siteSrl;
189 $insertArgs->layout = $layoutName;
190 $insertArgs->title = $titleList[$layoutName];
191 $insertArgs->layout_type = $layoutType;
195 $isCreateInstance = TRUE;
200 if($isCreateInstance)
206 foreach(
$output->data as $no => $iInfo)
229 if($layoutType ==
'P')
232 $themePathFormat =
_XE_PATH_ .
'themes/%s/layouts/%s';
237 $themePathFormat =
_XE_PATH_ .
'themes/%s/m.layouts/%s';
240 if(strpos($layout,
'|@|') !== FALSE)
242 list($themeName, $layoutName) = explode(
'|@|', $layout);
243 $path = sprintf($themePathFormat, $themeName, $layoutName);
247 $path = $pathPrefix . $layout;
250 return is_readable($path .
'/layout.html');
262 $args =
new stdClass();
275 $args =
new stdClass();
294 $layout_parse = explode(
'|@|', $layout_name);
295 if(count($layout_parse) > 1)
297 $class_path =
'./themes/'.$layout_parse[0].
'/layouts/'.$layout_parse[1].
'/';
299 else if($layout_name ==
'faceoff')
301 $class_path =
'./modules/layout/faceoff/';
303 else if($layout_type ==
"M")
305 $class_path = sprintf(
"./m.layouts/%s/", $layout_name);
309 $class_path = sprintf(
'./layouts/%s/', $layout_name);
311 if(is_dir($class_path))
return $class_path;
324 if ($withAutoinstallInfo) $oAutoinstallModel =
getModel(
'autoinstall');
328 $searched_count = count($searched_list);
329 if(!$searched_count)
return;
334 for($i=0;$i<$searched_count;$i++)
337 $layout = $searched_list[$i];
339 $layout_info = $this->
getLayoutInfo($layout, null, $layout_type);
346 if($withAutoinstallInfo)
349 $packageSrl = $oAutoinstallModel->getPackageSrlByPath($layout_info->path);
350 $layout_info->remove_url = $oAutoinstallModel->getRemoveUrlByPackageSrl($packageSrl);
353 $package = $oAutoinstallModel->getInstalledPackages($packageSrl);
354 $layout_info->need_update = $package[$packageSrl]->need_update;
357 if($layout_info->need_update)
359 $layout_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
362 $list[] = $layout_info;
365 usort($list, array($this,
'sortLayoutByTitle'));
376 $a->title = $a->layout;
381 $b->title = $b->layout;
384 $aTitle = strtolower($a->title);
385 $bTitle = strtolower($b->title);
387 if($aTitle == $bTitle)
392 return ($aTitle < $bTitle) ? -1 : 1;
403 return count($searchedList);
413 if($layoutType ==
'M')
415 $directory =
'./m.layouts';
416 $globalValueKey =
'MOBILE_LAYOUT_DIRECTOIES';
420 $directory =
'./layouts';
421 $globalValueKey =
'PC_LAYOUT_DIRECTORIES';
427 if (!$searchedList) $searchedList = array();
428 $GLOBALS[$globalValueKey] = $searchedList;
430 return $searchedList;
445 $layout_title = $info->title;
446 $layout = $info->layout;
448 $site_srl = $info->site_srl;
449 $vars = unserialize($info->extra_vars);
451 if($info->module_srl)
453 $layout_path = preg_replace(
'/([a-zA-Z0-9\_\.]+)(\.html)$/',
'',$info->layout_path);
463 if(!$xml_file) $xml_file = sprintf(
"%sconf/info.xml",
$layout_path);
464 if(!file_exists($xml_file))
466 $layout_info =
new stdClass;
467 $layout_info->title = $layout;
468 $layout_info->layout = $layout;
470 $layout_info->layout_title = $layout_title;
471 if(!$layout_info->layout_type)
473 $layout_info->layout_type = $layout_type;
488 if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file))
490 include($cache_file);
492 if($layout_info->extra_var && $vars)
494 foreach($vars as $key => $value)
496 if(!$layout_info->extra_var->{$key} && !$layout_info->{$key})
498 $layout_info->{$key} = $value;
503 if(!$layout_info->title)
505 $layout_info->title = $layout;
512 $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
514 if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout;
515 elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->
skin;
517 if(!$xml_obj) return;
520 $buff[] = '$layout_info = new stdClass;';
521 $buff[] = sprintf('$layout_info->
site_srl = "%s";', $site_srl);
523 if($xml_obj->version && $xml_obj->attrs->version == '0.2')
526 sscanf($xml_obj->date->body,
'%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
527 $date = sprintf(
'%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
528 $buff[] = sprintf(
'$layout_info->layout = "%s";', $layout);
529 $buff[] = sprintf(
'$layout_info->type = "%s";', $xml_obj->attrs->type);
530 $buff[] = sprintf(
'$layout_info->path = "%s";', $layout_path);
531 $buff[] = sprintf(
'$layout_info->title = "%s";', $xml_obj->title->body);
532 $buff[] = sprintf(
'$layout_info->description = "%s";', $xml_obj->description->body);
533 $buff[] = sprintf(
'$layout_info->version = "%s";', $xml_obj->version->body);
534 $buff[] = sprintf(
'$layout_info->date = "%s";', $date);
535 $buff[] = sprintf(
'$layout_info->homepage = "%s";', $xml_obj->link->body);
536 $buff[] = sprintf(
'$layout_info->layout_srl = $layout_srl;');
537 $buff[] = sprintf(
'$layout_info->layout_title = $layout_title;');
538 $buff[] = sprintf(
'$layout_info->license = "%s";', $xml_obj->license->body);
539 $buff[] = sprintf(
'$layout_info->license_link = "%s";', $xml_obj->license->attrs->link);
540 $buff[] = sprintf(
'$layout_info->layout_type = "%s";', $layout_type);
543 if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
544 else $author_list = $xml_obj->author;
546 $buff[] =
'$layout_info->author = array();';
547 for($i=0, $c=count($author_list); $i<$c; $i++)
549 $buff[] = sprintf(
'$layout_info->author[%d] = new stdClass;', $i);
550 $buff[] = sprintf(
'$layout_info->author[%d]->name = "%s";', $i, $author_list[$i]->name->body);
551 $buff[] = sprintf(
'$layout_info->author[%d]->email_address = "%s";', $i, $author_list[$i]->attrs->email_address);
552 $buff[] = sprintf(
'$layout_info->author[%d]->homepage = "%s";', $i, $author_list[$i]->attrs->link);
556 $extra_var_groups = $xml_obj->extra_vars->group;
557 if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
558 if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
560 $buff[] =
'$layout_info->extra_var = new stdClass;';
561 $extra_var_count = 0;
562 foreach($extra_var_groups as $group)
570 $extra_var_count += $count;
572 for($i=0;$i<$count;$i++)
574 unset($var, $options);
576 $name = $var->attrs->name;
578 $buff[] = sprintf(
'$layout_info->extra_var->%s = new stdClass;', $name);
579 $buff[] = sprintf(
'$layout_info->extra_var->%s->group = "%s";', $name, $group->title->body);
580 $buff[] = sprintf(
'$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body);
581 $buff[] = sprintf(
'$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type);
582 $buff[] = sprintf(
'$layout_info->extra_var->%s->value = $vars->%s;', $name, $name);
583 $buff[] = sprintf(
'$layout_info->extra_var->%s->description = "%s";', $name, str_replace(
'"',
'\"',$var->description->body));
585 $options = $var->options;
586 if(!$options)
continue;
587 if(!is_array($options)) $options = array($options);
589 $buff[] = sprintf(
'$layout_info->extra_var->%s->options = array();', $var->attrs->name);
590 $options_count = count($options);
591 $thumbnail_exist =
false;
592 for($j=0; $j < $options_count; $j++)
594 $buff[] = sprintf(
'$layout_info->extra_var->%s->options["%s"] = new stdClass;', $var->attrs->name, $options[$j]->attrs->value);
595 $thumbnail = $options[$j]->attrs->src;
598 $thumbnail = $layout_path.$thumbnail;
599 if(file_exists($thumbnail))
601 $buff[] = sprintf(
'$layout_info->extra_var->%s->options["%s"]->thumbnail = "%s";', $var->attrs->name, $options[$j]->attrs->value, $thumbnail);
602 if(!$thumbnail_exist)
604 $buff[] = sprintf(
'$layout_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name);
605 $thumbnail_exist =
true;
609 $buff[] = sprintf(
'$layout_info->extra_var->%s->options["%s"]->val = "%s";', $var->attrs->name, $options[$j]->attrs->value, $options[$j]->title->body);
614 $buff[] = sprintf(
'$layout_info->extra_var_count = "%s";', $extra_var_count);
616 if($xml_obj->menus->menu)
618 $menus = $xml_obj->menus->menu;
619 if(!is_array($menus)) $menus = array($menus);
621 $menu_count = count($menus);
622 $buff[] = sprintf(
'$layout_info->menu_count = "%s";', $menu_count);
623 $buff[] =
'$layout_info->menu = new stdClass;';
624 for($i=0;$i<$menu_count;$i++)
626 $name = $menus[$i]->attrs->name;
627 if($menus[$i]->attrs->default ==
"true") $buff[] = sprintf(
'$layout_info->default_menu = "%s";', $name);
628 $buff[] = sprintf(
'$layout_info->menu->%s = new stdClass;', $name);
629 $buff[] = sprintf(
'$layout_info->menu->%s->name = "%s";',$name, $menus[$i]->attrs->name);
630 $buff[] = sprintf(
'$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->
title->body);
631 $buff[] = sprintf(
'$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->attrs->maxdepth);
633 $buff[] = sprintf(
'$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name);
634 $buff[] = sprintf(
'$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name);
635 $buff[] = sprintf(
'$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name);
642 sscanf($xml_obj->author->attrs->date,
'%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
643 $date = sprintf(
'%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
644 $buff[] = sprintf(
'$layout_info->layout = "%s";', $layout);
645 $buff[] = sprintf(
'$layout_info->path = "%s";', $layout_path);
646 $buff[] = sprintf(
'$layout_info->title = "%s";', $xml_obj->title->body);
647 $buff[] = sprintf(
'$layout_info->description = "%s";', $xml_obj->author->description->body);
648 $buff[] = sprintf(
'$layout_info->version = "%s";', $xml_obj->attrs->version);
649 $buff[] = sprintf(
'$layout_info->date = "%s";', $date);
650 $buff[] = sprintf(
'$layout_info->layout_srl = $layout_srl;');
651 $buff[] = sprintf(
'$layout_info->layout_title = $layout_title;');
653 $buff[] = sprintf(
'$layout_info->author[0]->name = "%s";', $xml_obj->author->name->body);
654 $buff[] = sprintf(
'$layout_info->author[0]->email_address = "%s";', $xml_obj->author->attrs->email_address);
655 $buff[] = sprintf(
'$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link);
657 $extra_var_groups = $xml_obj->extra_vars->group;
658 if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
659 if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
660 foreach($extra_var_groups as $group)
669 $buff[] = sprintf(
'$layout_info->extra_var_count = "%s";', $extra_var_count);
670 for($i=0;$i<$extra_var_count;$i++)
672 unset($var, $options);
674 $name = $var->attrs->name;
676 $buff[] = sprintf(
'$layout_info->extra_var->%s->group = "%s";', $name, $group->title->body);
677 $buff[] = sprintf(
'$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body);
678 $buff[] = sprintf(
'$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type);
679 $buff[] = sprintf(
'$layout_info->extra_var->%s->value = $vars->%s;', $name, $name);
680 $buff[] = sprintf(
'$layout_info->extra_var->%s->description = "%s";', $name, str_replace(
'"',
'\"',$var->description->body));
682 $options = $var->options;
683 if(!$options)
continue;
685 if(!is_array($options)) $options = array($options);
686 $options_count = count($options);
687 for($j=0;$j<$options_count;$j++)
689 $buff[] = sprintf(
'$layout_info->extra_var->%s->options["%s"]->val = "%s";', $var->attrs->name, $options[$j]->value->body, $options[$j]->title->body);
695 if($xml_obj->menus->menu)
697 $menus = $xml_obj->menus->menu;
698 if(!is_array($menus)) $menus = array($menus);
700 $menu_count = count($menus);
701 $buff[] = sprintf(
'$layout_info->menu_count = "%s";', $menu_count);
702 for($i=0;$i<$menu_count;$i++)
704 $name = $menus[$i]->attrs->name;
705 if($menus[$i]->attrs->default ==
"true") $buff[] = sprintf(
'$layout_info->default_menu = "%s";', $name);
706 $buff[] = sprintf(
'$layout_info->menu->%s->name = "%s";',$name, $name);
707 $buff[] = sprintf(
'$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->
title->body);
708 $buff[] = sprintf(
'$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->maxdepth->body);
709 $buff[] = sprintf(
'$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name);
710 $buff[] = sprintf(
'$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name);
711 $buff[] = sprintf(
'$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name);
719 $header_script = trim($layout_config->header_script);
723 $buff[] = sprintf(
' $layout_info->header_script = %s; ', var_export($header_script,
true));
729 if(!$layout_info->title)
731 $layout_info->title = $layout;
781 return $this->getUserLayoutPath(
$layout_srl).
'images/';
791 return $this->getUserLayoutPath(
$layout_srl).
'layout.css';
801 if($this->useUserLayoutTemp ==
'temp')
return;
802 return $this->_getUserLayoutFaceOffCss(
$layout_srl);
812 return $this->getUserLayoutPath(
$layout_srl).
'faceoff.css';
822 return $this->getUserLayoutPath(
$layout_srl).
'tmp.faceoff.css';
832 $src = $this->getUserLayoutPath(
$layout_srl).
'layout.html';
833 if($this->useUserLayoutTemp ==
'temp')
850 return $this->getUserLayoutPath(
$layout_srl).
'tmp.layout.html';
860 $src = $this->getUserLayoutPath(
$layout_srl).
'layout.ini';
861 if($this->useUserLayoutTemp ==
'temp')
878 return $this->getUserLayoutPath(
$layout_srl).
'tmp.layout.ini';
890 return $this->getUserLayoutPath(
$layout_srl).
"{$lang_type}.cache.php";
901 if($layout_type==
'P')
903 return sprintf(
"%sfiles/cache/layout/%s.%s.cache.php",
_XE_PATH_, $layout_name,$lang_type);
907 return sprintf(
"%sfiles/cache/layout/m.%s.%s.cache.php",
_XE_PATH_, $layout_name,$lang_type);
918 return $this->getDefaultLayoutPath($layout_name).
'layout.ini';
928 return $this->getDefaultLayoutPath($layout_name).
'layout.html';
938 return $this->getDefaultLayoutPath($layout_name).
'css/layout.css';
948 return "./modules/layout/faceoff/";
958 $info = $this->getLayoutInfo($layout_name);
959 return ($info->type ==
'faceoff');
969 $this->useUserLayoutTemp = $flag;
995 basename($this->getUserLayoutFaceOffCss(
$layout_srl)),
1000 $image_path = $this->getUserLayoutImagePath(
$layout_srl);
1003 foreach($image_list as $image)
1005 $file_list[] =
'images/' . $image;
1018 $layout_info->faceoff_ini_config = $this->getUserLayoutIniConfig($layout_info->layout_srl, $layout_info->layout);
1022 $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl);
1026 if($layout_info->extra_var->colorset->value ==
'black')
Context::loadFile($this->module_path.
'/tpl/css/widget@black.css',
true);
getDefaultLayoutIni($layout_name)
getUserLayoutCss($layout_srl)
getDefaultLayoutCss($layout_name)
getUserLayoutImagePath($layout_srl)
getNumberingPath($no, $size=3)
useDefaultLayout($layout_name)
getUserLayoutImageList($layout_srl)
doActivateFaceOff(&$layout_info)
if(file_exists(_XE_PATH_. 'config/config.user.inc.php')) if(!defined('__DEBUG__')) if(!defined('__DEBUG_OUTPUT__')) if(!defined('__DEBUG_PROTECT__')) if(!defined('__DEBUG_PROTECT_IP__')) if(!defined('__DEBUG_DB_OUTPUT__')) if(!defined('__LOG_SLOW_QUERY__')) if(!defined('__LOG_SLOW_TRIGGER__')) if(!defined('__LOG_SLOW_ADDON__')) if(!defined('__LOG_SLOW_WIDGET__')) if(!defined('__DEBUG_QUERY__')) if(!defined('__OB_GZHANDLER_ENABLE__')) if(!defined('__ENABLE_PHPUNIT_TEST__')) if(!defined('__PROXY_SERVER__')) if(!defined('__ERROR_LOG__')) if(!defined('__DISABLE_DEFAULT_CSS__')) if(!defined('__AUTO_OPCACHE_INVALIDATE__')) if((__DEBUG_OUTPUT__==2)&&version_compare(PHP_VERSION, '6.0.0')===-1) if(version_compare(PHP_VERSION, '5.3.0') >=0) $GLOBALS['__xe_autoload_file_map']
getLayoutInstanceListForJSONP()
getUserLayoutTempFaceOffCss($layout_srl)
foreach($sitemap as $id=> &$val) $extra_vars
getUserLayoutTempFileList($layout_srl)
writeFile($filename, $buff, $mode="w")
getUserLayoutIni($layout_srl)
_getInstalledLayoutDirectories($layoutType= 'P')
getLayoutPath($layout_name="", $layout_type="P")
getUserLayoutCache($layout_srl, $lang_type)
getUserLayoutPath($layout_srl)
getLayoutInstanceList($siteSrl=0, $layoutType= 'P', $layout=null, $columnList=array())
getDownloadedLayoutList($layout_type="P", $withAutoinstallInfo=false)
getLayoutList($site_srl=0, $layout_type="P", $columnList=array())
getUserLayoutIniConfig($layout_srl, $layout_name=null)
setUseUserLayoutTemp($flag='temp')
$layout_path
a path of directory where layout files reside
addCSSFile($file, $optimized=FALSE, $media= 'all', $targetie= '', $index=0)
getUserLayoutTempIni($layout_srl)
getAdminModel($module_name)
getLayoutCache($layout_name, $lang_type, $layout_type='P')
copyFile($source, $target, $force= 'Y')
_getUserLayoutFaceOffCss($layout_srl)
foreach($skinTypes as $key=> $dir) $designInfo module board skin
getUserLayoutFileList($layout_srl)
getLayoutRawData($layout_srl, $columnList=array())
getDefaultLayoutHtml($layout_name)
getUserLayoutHtml($layout_srl)
isExistsLayoutFile($layout, $layoutType)
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
getUserLayoutTempHtml($layout_srl)
getInstalledLayoutCount($layoutType= 'P')
getAdminController($module_name)
readDir($path, $filter= '', $to_lower=FALSE, $concat_prefix=FALSE)
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
getLayoutInfo($layout, $info=null, $layout_type="P")
getUserLayoutFaceOffCss($layout_srl)
sortLayoutByTitle($a, $b)