示例#1
0
 public static function getContentTypes()
 {
     $strPath = getContentTypePath(".");
     $aryPath = array();
     $objDir = dir($strPath);
     while ($entry = $objDir->read()) {
         if ($entry != "." && $entry != ".." && is_dir($objDir->path . "/" . $entry)) {
             $aryPath[] = $entry;
         }
     }
     return $aryPath;
 }
示例#2
0
 public static function create($page, $type)
 {
     // copy default XML
     $strTemplatePath = getContentTypePath($type) . "/default-content.xml";
     $strPath = getXMLPath($page);
     mkdir(dirname($strPath));
     file_put_contents($strPath, file_get_contents($strTemplatePath));
     // create php file
     $level = ".." . preg_replace("/[^\\/]+/", "..", $page);
     $strPath = getPath($page) . "/index.php";
     file_put_contents($strPath, "<?php require \"" . $level . "/index.php\";?>");
     // set page content type
     $objPage = new Page($page);
     $objPage->setContentType($type);
     $objPage->save();
     // set page order
     $objOrder = new PageOrder(listDeleteAt($page, listLen($page, "/"), "/"));
     if ($objOrder->getIndex($objPage->getName()) < 0) {
         $objOrder->add($objPage->getName());
     }
     $objOrder->save();
     return $objPage;
 }