当前位置: 首页>>代码示例>>PHP>>正文


PHP BigTree::makeDirectory方法代码示例

本文整理汇总了PHP中BigTree::makeDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP BigTree::makeDirectory方法的具体用法?PHP BigTree::makeDirectory怎么用?PHP BigTree::makeDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BigTree的用法示例。


在下文中一共展示了BigTree::makeDirectory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

}
// Fix licenses into an array
if (array_filter((array) $licenses)) {
    $license_array = array();
    foreach ($licenses as $license) {
        $license_array[$license] = $available_licenses["Open Source"][$license];
    }
} elseif ($license_name) {
    $license_array = array($license_name => $license_url);
} elseif ($license) {
    $license_array = array($license => $available_licenses["Closed Source"][$license]);
}
// Create extension directory if it doesn't exist
$extension_root = SERVER_ROOT . "extensions/{$id}/";
if (!file_exists($extension_root)) {
    BigTree::makeDirectory($extension_root);
}
// Setup JSON manifest
$package = array("type" => "extension", "id" => $id, "version" => $version, "revision" => 1, "compatibility" => $compatibility, "title" => $title, "description" => $description, "keywords" => $keywords, "author" => $author, "licenses" => $license_array, "components" => array("module_groups" => array(), "modules" => array(), "templates" => array(), "callouts" => array(), "settings" => array(), "feeds" => array(), "field_types" => array(), "tables" => array()));
// We're going to be associating things to the extension before creating it
sqlquery("SET foreign_key_checks = 0");
$used_forms = array();
$used_views = array();
$used_reports = array();
$extension = sqlescape($id);
foreach (array_filter((array) $module_groups) as $group) {
    $package["components"]["module_groups"][] = $admin->getModuleGroup($group);
}
foreach (array_filter((array) $callouts) as $callout) {
    if (strpos($callout, "*") === false) {
        sqlquery("UPDATE bigtree_callouts SET extension = '{$extension}', id = '{$extension}*" . sqlescape($callout) . "' WHERE id = '" . sqlescape($callout) . "'");
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:31,代码来源:create.php

示例2: explode

<?php

// First we need to package the file so they can download it manually if they wish.
if (!BigTree::isDirectoryWritable(SERVER_ROOT . "cache/package/")) {
    ?>
<div class="container">
	<section>
		<h3>Error</h3>
		<p>Your cache/ and cache/package/ directories must be writable.</p>
	</section>
</div>
<?php 
    $admin->stop();
}
BigTree::makeDirectory(SERVER_ROOT . "cache/package/");
// Fix keywords into an array
$keywords = explode(",", $keywords);
foreach ($keywords as &$word) {
    $word = trim($word);
}
// Fix licenses into an array
if ($license_name) {
    $license_array = array($license_name => $license_url);
} elseif ($license) {
    $license_array = array($license => $available_licenses["Closed Source"][$license]);
} else {
    $license_array = array();
    if (is_array($licenses)) {
        foreach ($licenses as $license) {
            $license_array[$license] = $available_licenses["Open Source"][$license];
        }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:31,代码来源:create.php

示例3: elseif

} elseif ($error == 3) {
    $_SESSION["upload_error"] = "File upload failed.";
}
if ($error) {
    BigTree::redirect(DEVELOPER_ROOT . "packages/install/");
}
// We've at least got the file now, unpack it and see what's going on.
$file = $_FILES["file"]["tmp_name"];
if (!$file) {
    $_SESSION["upload_error"] = "File upload failed.";
    BigTree::redirect(DEVELOPER_ROOT . "packages/install/");
}
// Clean up existing area
$cache_root = SERVER_ROOT . "cache/package/";
BigTree::deleteDirectory($cache_root);
BigTree::makeDirectory($cache_root);
// Unzip the package
include BigTree::path("inc/lib/pclzip.php");
$zip = new PclZip($file);
$files = $zip->extract(PCLZIP_OPT_PATH, $cache_root);
if (!$files) {
    BigTree::deleteDirectory($cache_root);
    $_SESSION["upload_error"] = "The zip file uploaded was corrupt.";
    BigTree::redirect(DEVELOPER_ROOT . "packages/install/");
}
// Read the manifest
$json = json_decode(file_get_contents($cache_root . "manifest.json"), true);
// Make sure it's legit
if ($json["type"] != "package" || !isset($json["id"]) || !isset($json["title"])) {
    BigTree::deleteDirectory($cache_root);
    $_SESSION["upload_error"] = "The zip file uploaded does not appear to be a BigTree package.";
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:31,代码来源:unpack.php

示例4: unzip

 static function unzip($file, $destination)
 {
     // If we can't write the output directory, we're not getting anywhere.
     if (!BigTree::isDirectoryWritable($destination)) {
         return false;
     }
     // Up the memory limit for the unzip.
     ini_set("memory_limit", "512M");
     $destination = rtrim($destination) . "/";
     BigTree::makeDirectory($destination);
     // If we have the built in ZipArchive extension, use that.
     if (class_exists("ZipArchive")) {
         $z = new ZipArchive();
         if (!$z->open($file)) {
             // Bad zip file.
             return false;
         }
         for ($i = 0; $i < $z->numFiles; $i++) {
             if (!($info = $z->statIndex($i))) {
                 // Unzipping the file failed for some reason.
                 return false;
             }
             // If it's a directory, ignore it. We'll create them in putFile.
             if (substr($info["name"], -1) == "/") {
                 continue;
             }
             // Ignore __MACOSX and all it's files.
             if (substr($info["name"], 0, 9) == "__MACOSX/") {
                 continue;
             }
             $content = $z->getFromIndex($i);
             if ($content === false) {
                 // File extraction failed.
                 return false;
             }
             BigTree::putFile($destination . $file["name"], $content);
         }
         $z->close();
         return true;
         // Fall back on PclZip if we don't have the "native" version.
     } else {
         // WordPress claims this could be an issue, so we'll make sure multibyte encoding isn't overloaded.
         if (ini_get('mbstring.func_overload') && function_exists('mb_internal_encoding')) {
             $previous_encoding = mb_internal_encoding();
             mb_internal_encoding('ISO-8859-1');
         }
         $z = new PclZip($file);
         $archive = $z->extract(PCLZIP_OPT_EXTRACT_AS_STRING);
         // If we saved a previous encoding, reset it now.
         if (isset($previous_encoding)) {
             mb_internal_encoding($previous_encoding);
             unset($previous_encoding);
         }
         // If it's not an array, it's not a good zip. Also, if it's empty it's not a good zip.
         if (!is_array($archive) || !count($archive)) {
             return false;
         }
         foreach ($archive as $item) {
             // If it's a directory, ignore it. We'll create them in putFile.
             if ($item["folder"]) {
                 continue;
             }
             // Ignore __MACOSX and all it's files.
             if (substr($item["filename"], 0, 9) == "__MACOSX/") {
                 continue;
             }
             BigTree::putFile($directory . $item["filename"], $item["content"]);
         }
         return true;
     }
 }
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:71,代码来源:utils.php

示例5: installLocal

 function installLocal()
 {
     // Create backups folder
     BigTree::makeDirectory(SERVER_ROOT . "backups/");
     // Doing a core upgrade
     if ($this->Extension === false) {
         // Move old core into backups
         rename(SERVER_ROOT . "core/", SERVER_ROOT . "backups/core-" . BIGTREE_VERSION . "/");
         // Backup database
         global $admin;
         $admin->backupDatabase(SERVER_ROOT . "backups/core-" . BIGTREE_VERSION . "/backup.sql");
         // Move new core into place
         rename(SERVER_ROOT . "cache/update/core/", SERVER_ROOT . "core/");
         // Doing an extension upgrade
     } else {
         $extension = $this->Extension;
         // Create a backups folder for this extension
         BigTree::makeDirectory(SERVER_ROOT . "backups/extensions/{$extension}/");
         // Read manifest file for current version
         $current_manifest = json_decode(file_get_contents(SERVER_ROOT . "extensions/{$extension}/manifest.json"), true);
         $old_version = $current_manifest["version"];
         // Get a unique directory name
         $old_version = BigTree::getAvailableFileName(SERVER_ROOT . "backups/extensions/{$extension}/", $old_version);
         // Move old extension into backups
         rename(SERVER_ROOT . "extensions/{$extension}/", SERVER_ROOT . "backups/extensions/{$extension}/{$old_version}/");
         // Move new extension into place
         rename(SERVER_ROOT . "cache/update/", SERVER_ROOT . "extensions/{$extension}/");
     }
     $this->cleanup();
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:30,代码来源:updater.php

示例6: str_repeat

<?php

$email .= $d["label"] . "\n";
$email .= str_repeat("-", strlen($d["label"])) . "\n";
if ($_FILES[$field_name]["tmp_name"]) {
    if ($d["directory"]) {
        $directory = rtrim($d["directory"], "/") . "/";
    } else {
        $directory = "files/form-builder/";
    }
    if (BigTree::directoryContents($directory) === false) {
        BigTree::makeDirectory($directory);
    }
    $value = $storage->store($_FILES[$field_name]["tmp_name"], $_FILES[$field_name]["name"], $directory);
    $email .= $cms->replaceRelativeRoots($value);
} else {
    $email .= "No File Uploaded";
    if ($d["required"]) {
        $errors[] = $field_name;
    }
    $value = "";
}
$email .= "\n\n";
开发者ID:jmason03,项目名称:bigtree-form-builder,代码行数:23,代码来源:upload.php


注:本文中的BigTree::makeDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。