Ejemplo n.º 1
0
#!/usr/bin/env php
<?php 
set_time_limit(0);
$theme = @$argv[1];
if (!$theme) {
    echo "usage: php gen_theme.php [theme]" . PHP_EOL;
    echo "sample: php gen_theme.php new_theme" . PHP_EOL;
    exit;
}
include_once dirname(dirname(__FILE__)) . "/app_init.php";
if (!defined("CLI")) {
    exit;
}
include_once dirname(__FILE__) . "/require_auth.php";
include_once MODULE_PATH . "/theme/lib/ThemeCreator.php";
$creator = new ThemePackCreator($theme);
$result = $creator->createNew();
?>

Ejemplo n.º 2
0
 public function CreateThemePack($theme, $recArr)
 {
     $this->recordID = $theme;
     //mkdir
     $theme_dir = OPENBIZ_THEME_PATH . DIRECTORY_SEPARATOR . $theme;
     @mkdir($theme_dir);
     //clean up array
     foreach ($recArr as $key => $value) {
         $recArr[$key] = addslashes($recArr[$key]);
         $recArr[$key] = str_replace("\n", '\\n', $recArr[$key]);
     }
     //create theme.xml metainfo
     $smarty = TemplateHelper::getSmartyTemplate();
     $smarty->assign("theme_name", $recArr['name']);
     $smarty->assign("preview", $recArr['preview']);
     $smarty->assign("icon", $recArr['icon']);
     $smarty->assign("version", $recArr['version']);
     $smarty->assign("create_date", $recArr['creationDate']);
     $smarty->assign("author", $recArr['author']);
     $smarty->assign("author_email", $recArr['authorEmail']);
     $smarty->assign("author_url", $recArr['authorUrl']);
     $smarty->assign("description", $recArr['description']);
     $data = $smarty->fetch(TemplateHelper::getTplFileWithPath("theme.xml.tpl", $this->package));
     $theme_dir = OPENBIZ_THEME_PATH . DIRECTORY_SEPARATOR . $theme;
     $theme_file = $theme_dir . DIRECTORY_SEPARATOR . "theme.xml";
     file_put_contents($theme_file, $data);
     //generate theme string files.
     $creator = new ThemePackCreator($theme);
     $creator->createNew();
     return true;
 }