本文整理汇总了PHP中Constants::GET_PAGES_DIRECTORY方法的典型用法代码示例。如果您正苦于以下问题:PHP Constants::GET_PAGES_DIRECTORY方法的具体用法?PHP Constants::GET_PAGES_DIRECTORY怎么用?PHP Constants::GET_PAGES_DIRECTORY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Constants
的用法示例。
在下文中一共展示了Constants::GET_PAGES_DIRECTORY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveBlock
public function saveBlock()
{
$io = new FileIO();
//Build the file name from the bucket path (includes the bucket extension)
//and the block id.
$filename = Constants::GET_PAGES_DIRECTORY() . '/' . $this->getBucketId() . '/' . $this->getBlockId() . '.incl';
$serialized = serialize($this);
$io = new FileIO();
$io->writeFile($filename, $serialized);
}
示例2: load
public function load($bucketid)
{
$io = new FileIO();
$bucketConfigString = $io->readFile(Constants::GET_PAGES_DIRECTORY() . '/' . $bucketid . '/.bucket');
$config = unserialize($bucketConfigString);
if (isset($config['type'])) {
$type = $config['type'];
switch ($type) {
case BucketTypes::Text:
return $this->buildTextBucket($config);
break;
case BucketTypes::Blog:
return $this->buildBlogBucket($config);
break;
default:
break;
}
}
}
示例3: removeBucket
/**
* Deletes the page from this site as well as the directory and any
* containers below it.
*
* @return boolean
*/
public function removeBucket($bucketid)
{
if (isset($this->bucketlist[$bucketid])) {
$path = Constants::GET_PAGES_DIRECTORY() . "/" . $bucketid;
$io = new FileIO();
if (!$io->deleteDirectory($path, true)) {
return false;
}
unset($this->bucketlist[$bucketid]);
return true;
} else {
return false;
}
}
示例4: bucketExists
/**
* This method checks to see if this bucket already exists in the directory or not.
*/
private function bucketExists()
{
$path = Constants::GET_PAGES_DIRECTORY() . "/" . $this->getBucketId() . "/.bucket";
$io = new FileIO();
return $io->fileExists($path);
}
示例5: handlePost
//.........这里部分代码省略.........
if (!$userCreated) {
$ret['message'] = "Settings could not be saved";
$ret['settingsSaved'] = 'false';
$ret['redirectToLogin'] = 'false';
$passwordDefined = false;
}
} else {
//return 'error, passwords don't match' message
$ret['message'] = "Author passwords do not match";
$ret['settingsSaved'] = 'false';
$ret['redirectToLogin'] = 'false';
$passwordDefined = false;
}
}
/*
* This section creates the directories and files for the buckets
*/
if (isset($this->post['sitemap']) && $passwordDefined) {
//Get the existing site for comparison
$framework = new FrameworkController();
$site = $framework->getSite();
$bucketlist = $site->getAllBuckets();
$blockarray = array();
$bucketarray = array();
//This loop marks every block and bucket for deletion
foreach ($bucketlist as $bucket) {
if ($bucket->hasBlocks()) {
$blocklist = $bucket->getAllBlocks();
foreach ($blocklist as $block) {
$blockarray[$bucket->getBucketId()][$block->getBlockId()] = false;
}
}
$bucketarray[$bucket->getBucketId()] = false;
}
//The string looks like:
//page1:container1,container2,container3|page2:container1,container2,container3
$sitemap_string = $this->post['sitemap'];
$bucketsArray = explode("|", $sitemap_string);
$bucketsdir = Constants::GET_PAGES_DIRECTORY();
for ($i = 0; $i < count($bucketsArray); $i++) {
if (strlen($bucketsArray[$i]) <= 1) {
continue;
}
//Get the bucket and block list from the bucket string
$bucketstring = explode(":", $bucketsArray[$i]);
$bucketname = $bucketstring[0];
$blockstring = $bucketstring[1];
$blockNameArray = explode(",", $blockstring);
//If we have no bucket name, then there's nothing to
//do here (no bucket page names)
if ($bucketname == null || $bucketname == "") {
continue;
}
//If the directory exists, we don't want to overwrite it
//This adds the page
$bucketarray[$bucketname] = true;
$result = $site->addBucket($bucketname);
$blocktext = "";
for ($j = 0; $j < count($blockNameArray); $j++) {
$blockname = $blockNameArray[$j];
//If the block name is blank do nothing (no blank bucket names)
if ($blockname == null || $blockname == "") {
continue;
}
//Don't delete this block!
if (isset($blockarray[$bucketname][$blockname])) {
$blockarray[$bucketname][$blockname] = true;
}
//TODO: this needs to be refactored, we aren't creating a new block every time, only loading
//blocks that exist.
$bucket = $site->getBucket($bucketname);
if (!$bucket->hasBlock($blockname)) {
$newblockConfig = array("type" => BlockTypes::Text, "blockid" => $blockname, "bucketid" => $bucketname);
$factory = new BlockFactory();
$newblock = $factory->build($newblockConfig);
$bucket->addBlock($newblock);
}
}
}
//Now delete all the blocks that are still in the array as false
foreach ($blockarray as $bucketname => $blocklist) {
foreach ($blocklist as $blockname => $exists) {
if (!$exists) {
$currentbucket = $site->getBucket($bucketname);
$result = $currentbucket->removeBlock($blockname);
}
}
}
//Now delete the bucket
foreach ($bucketarray as $bucketname => $exists) {
$path = $bucketsdir . "/" . $bucketname;
if (!$exists) {
$deleted = $site->removeBucket($bucketname);
}
}
} else {
//No site map
}
return $ret;
}