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


PHP BigTree::directoryContents方法代码示例

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


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

示例1: _localCleanup

function _localCleanup()
{
    // Remove the package directory, we do it backwards because the "deepest" files are last
    $contents = @array_reverse(BigTree::directoryContents(SERVER_ROOT . "cache/package/"));
    foreach ((array) $contents as $file) {
        @unlink($file);
        @rmdir($file);
    }
    @rmdir(SERVER_ROOT . "cache/package/");
}
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:10,代码来源:unpack.php

示例2: foreach

            }
        }
        // Include related CSS/JS files if named properly
        if (file_exists(SERVER_ROOT . "custom/admin/css/" . $module["route"] . ".css")) {
            $p["files"][] = SERVER_ROOT . "custom/admin/css/" . $module["route"] . ".css";
        }
        if (file_exists(SERVER_ROOT . "custom/admin/js/" . $module["route"] . ".js")) {
            $p["files"][] = SERVER_ROOT . "custom/admin/js/" . $module["route"] . ".js";
        }
    }
}
// Bring in files for templates
foreach ((array) $templates as $template) {
    if ($template) {
        if (is_dir(SERVER_ROOT . "templates/routed/{$template}/")) {
            $contents = BigTree::directoryContents(SERVER_ROOT . "templates/routed/{$template}/");
            foreach ($contents as $c) {
                if (is_file($c)) {
                    $p["files"][] = $c;
                }
            }
        } elseif (file_exists(SERVER_ROOT . "templates/basic/{$template}.php")) {
            $p["files"][] = SERVER_ROOT . "templates/basic/{$template}.php";
        }
    }
}
// Files for callouts
foreach ((array) $callouts as $callout) {
    if ($callout) {
        if (file_exists(SERVER_ROOT . "templates/callouts/{$callout}.php")) {
            $p["files"][] = SERVER_ROOT . "templates/callouts/{$callout}.php";
开发者ID:jzxyouok,项目名称:BigTree-CMS,代码行数:31,代码来源:save-components.php

示例3: array

            $type["use_cases"] = array("templates" => $type["pages"], "modules" => $type["modules"], "callouts" => $type["callouts"], "settings" => $type["settings"]);
        }
        $use_cases = is_array($type["use_cases"]) ? sqlescape(json_encode($type["use_cases"])) : sqlescape($type["use_cases"]);
        $self_draw = $type["self_draw"] ? "'on'" : "NULL";
        sqlquery("INSERT INTO bigtree_field_types (`id`,`name`,`use_cases`,`self_draw`) VALUES ('" . sqlescape($type["id"]) . "','" . sqlescape($type["name"]) . "','{$use_cases}',{$self_draw})");
    }
}
// Import files
foreach ($json["files"] as $file) {
    BigTree::copyFile(SERVER_ROOT . "cache/package/{$file}", SERVER_ROOT . $file);
}
// Run SQL
foreach ($json["sql"] as $sql) {
    sqlquery($sql);
}
// Empty view cache
sqlquery("DELETE FROM bigtree_module_view_cache");
// Remove the package directory, we do it backwards because the "deepest" files are last
$contents = @array_reverse(BigTree::directoryContents(SERVER_ROOT . "cache/package/"));
foreach ($contents as $file) {
    @unlink($file);
    @rmdir($file);
}
@rmdir(SERVER_ROOT . "cache/package/");
// Clear module class cache and field type cache.
@unlink(SERVER_ROOT . "cache/bigtree-module-class-list.json");
@unlink(SERVER_ROOT . "cache/bigtree-form-field-types.json");
sqlquery("INSERT INTO bigtree_extensions (`id`,`type`,`name`,`version`,`last_updated`,`manifest`) VALUES ('" . sqlescape($json["id"]) . "','package','" . sqlescape($json["title"]) . "','" . sqlescape($json["version"]) . "',NOW(),'" . sqlescape(json_encode($json)) . "')");
sqlquery("SET foreign_key_checks = 1");
$admin->growl("Developer", "Installed Package");
BigTree::redirect(DEVELOPER_ROOT . "packages/install/complete/");
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:31,代码来源:process.php

示例4: installExtension


//.........这里部分代码省略.........
             foreach ($module["embed_forms"] as $form) {
                 $this->createModuleEmbedForm($module_id, $form["title"], $form["table"], is_array($form["fields"]) ? $form["fields"] : json_decode($form["fields"], true), $form["hooks"], $form["default_position"], $form["default_pending"], $form["css"], $form["redirect_url"], $form["thank_you_message"]);
             }
             // Create views
             foreach ($module["views"] as $view) {
                 $bigtree["view_id_match"][$view["id"]] = $this->createModuleView($module_id, $view["title"], $view["description"], $view["table"], $view["type"], is_array($view["options"]) ? $view["options"] : json_decode($view["options"], true), is_array($view["fields"]) ? $view["fields"] : json_decode($view["fields"], true), is_array($view["actions"]) ? $view["actions"] : json_decode($view["actions"], true), $view["suffix"], $view["preview_url"]);
             }
             // Create regular forms
             foreach ($module["forms"] as $form) {
                 $bigtree["form_id_match"][$form["id"]] = $this->createModuleForm($module_id, $form["title"], $form["table"], is_array($form["fields"]) ? $form["fields"] : json_decode($form["fields"], true), $form["hooks"], $form["default_position"], $form["return_view"] ? $bigtree["view_id_match"][$form["return_view"]] : false, $form["return_url"], $form["tagging"]);
             }
             // Create reports
             foreach ($module["reports"] as $report) {
                 $bigtree["report_id_match"][$report["id"]] = $this->createModuleReport($module_id, $report["title"], $report["table"], $report["type"], is_array($report["filters"]) ? $report["filters"] : json_decode($report["filters"], true), is_array($report["fields"]) ? $report["fields"] : json_decode($report["fields"], true), $report["parser"], $report["view"] ? $bigtree["view_id_match"][$report["view"]] : false);
             }
             // Create actions
             foreach ($module["actions"] as $action) {
                 $this->createModuleAction($module_id, $action["name"], $action["route"], $action["in_nav"], $action["class"], $bigtree["form_id_match"][$action["form"]], $bigtree["view_id_match"][$action["view"]], $bigtree["report_id_match"][$action["report"]], $action["level"], $action["position"]);
             }
         }
     }
     // Import templates
     foreach ($manifest["components"]["templates"] as $template) {
         if ($template) {
             $resources = sqlescape(is_array($template["resources"]) ? BigTree::json($template["resources"]) : $template["resources"]);
             sqlquery("INSERT INTO bigtree_templates (`id`,`name`,`module`,`resources`,`level`,`routed`,`extension`) VALUES ('" . sqlescape($template["id"]) . "','" . sqlescape($template["name"]) . "','" . $bigtree["module_match"][$template["module"]] . "','{$resources}','" . sqlescape($template["level"]) . "','" . sqlescape($template["routed"]) . "','{$extension}')");
         }
     }
     // Import callouts
     foreach ($manifest["components"]["callouts"] as $callout) {
         if ($callout) {
             $resources = sqlescape(is_array($callout["resources"]) ? BigTree::json($callout["resources"]) : $callout["resources"]);
             sqlquery("INSERT INTO bigtree_callouts (`id`,`name`,`description`,`display_default`,`display_field`,`resources`,`level`,`position`,`extension`) VALUES ('" . sqlescape($callout["id"]) . "','" . sqlescape($callout["name"]) . "','" . sqlescape($callout["description"]) . "','" . sqlescape($callout["display_default"]) . "','" . sqlescape($callout["display_field"]) . "','{$resources}','" . sqlescape($callout["level"]) . "','" . sqlescape($callout["position"]) . "','{$extension}')");
         }
     }
     // Import Settings
     foreach ($manifest["components"]["settings"] as $setting) {
         if ($setting) {
             $this->createSetting($setting);
             sqlquery("UPDATE bigtree_settings SET extension = '{$extension}' WHERE id = '" . sqlescape($setting["id"]) . "'");
         }
     }
     // Import Feeds
     foreach ($manifest["components"]["feeds"] as $feed) {
         if ($feed) {
             $fields = sqlescape(is_array($feed["fields"]) ? BigTree::json($feed["fields"]) : $feed["fields"]);
             $options = sqlescape(is_array($feed["options"]) ? BigTree::json($feed["options"]) : $feed["options"]);
             sqlquery("INSERT INTO bigtree_feeds (`route`,`name`,`description`,`type`,`table`,`fields`,`options`,`extension`) VALUES ('" . sqlescape($feed["route"]) . "','" . sqlescape($feed["name"]) . "','" . sqlescape($feed["description"]) . "','" . sqlescape($feed["type"]) . "','" . sqlescape($feed["table"]) . "','{$fields}','{$options}','{$extension}')");
         }
     }
     // Import Field Types
     foreach ($manifest["components"]["field_types"] as $type) {
         if ($type) {
             $self_draw = $type["self_draw"] ? "'on'" : "NULL";
             $use_cases = sqlescape(is_array($type["use_cases"]) ? json_encode($type["use_cases"]) : $type["use_cases"]);
             sqlquery("INSERT INTO bigtree_field_types (`id`,`name`,`use_cases`,`self_draw`,`extension`) VALUES ('" . sqlescape($type["id"]) . "','" . sqlescape($type["name"]) . "','{$use_cases}',{$self_draw},'{$extension}')");
         }
     }
     // Upgrades don't drop tables, we run the SQL revisions instead
     if (is_array($upgrade)) {
         $old_revision = $upgrade["revision"];
         $sql_revisions = $manifest["sql_revisions"];
         // Go through all the SQL updates, we ksort first to ensure if the manifest somehow got out of order that we run the SQL update sequentially
         ksort($sql_revisions);
         foreach ($sql_revisions as $key => $statements) {
             if ($key > $old_revision) {
                 foreach ($statements as $sql_statement) {
                     sqlquery($sql_statement);
                 }
             }
         }
         // Update the extension
         sqlquery("UPDATE bigtree_extensions SET name = '" . sqlescape($manifest["title"]) . "', version = '" . sqlescape($manifest["version"]) . "', last_updated = NOW(), manifest = '" . BigTree::json($manifest, true) . "' WHERE id = '" . sqlescape($manifest["id"]) . "'");
         // Straight installs move files into place locally
     } else {
         // Make sure destination doesn't exist
         $destination_path = SERVER_ROOT . "extensions/" . $manifest["id"] . "/";
         BigTree::deleteDirectory($destination_path);
         // Move the package to the extension directory
         rename(SERVER_ROOT . "cache/package/", $destination_path);
         BigTree::setDirectoryPermissions($destination_path);
         // Create the extension
         sqlquery("INSERT INTO bigtree_extensions (`id`,`type`,`name`,`version`,`last_updated`,`manifest`) VALUES ('" . sqlescape($manifest["id"]) . "','extension','" . sqlescape($manifest["title"]) . "','" . sqlescape($manifest["version"]) . "',NOW(),'" . BigTree::json($manifest, true) . "')");
     }
     // Re-enable foreign key checks
     sqlquery("SET foreign_key_checks = 1");
     // Empty view cache
     sqlquery("DELETE FROM bigtree_module_view_cache");
     // Move public files into the site directory
     $public_dir = SERVER_ROOT . "extensions/" . $manifest["id"] . "/public/";
     $site_contents = file_exists($public_dir) ? BigTree::directoryContents($public_dir) : array();
     foreach ($site_contents as $file_path) {
         $destination_path = str_replace($public_dir, SITE_ROOT . "extensions/" . $manifest["id"] . "/", $file_path);
         BigTree::copyFile($file_path, $destination_path);
     }
     // Clear module class cache and field type cache.
     @unlink(SERVER_ROOT . "cache/bigtree-module-class-list.json");
     @unlink(SERVER_ROOT . "cache/bigtree-form-field-types.json");
     return $manifest;
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:101,代码来源:admin.php

示例5: array_filter

            $package["sql_revisions"][$revision][] = $create_statement;
        }
    }
    // Clean up the revisions (if we don't have any)
    $package["sql_revisions"] = array_filter($package["sql_revisions"]);
}
// Write the manifest file
$json = BigTree::json($package);
BigTree::putFile(SERVER_ROOT . "extensions/{$id}/manifest.json", $json);
// Create the zip, clear caches since we may have moved the routes of field types and modules
@unlink(SERVER_ROOT . "cache/package.zip");
@unlink(SERVER_ROOT . "cache/bigtree-form-field-types.json");
@unlink(SERVER_ROOT . "cache/bigtree-module-class-list.json");
include BigTree::path("inc/lib/pclzip.php");
$zip = new PclZip(SERVER_ROOT . "cache/package.zip");
$zip->create(BigTree::directoryContents(SERVER_ROOT . "extensions/{$id}/"), PCLZIP_OPT_REMOVE_PATH, SERVER_ROOT . "extensions/{$id}/");
// Store it in the database for future updates -- existing packages might be replaced
if (sqlrows(sqlquery("SELECT id FROM bigtree_extensions WHERE id = '" . sqlescape($id) . "'"))) {
    sqlquery("UPDATE bigtree_extensions SET type = 'extension', name = '" . sqlescape($title) . "', version = '" . sqlescape($version) . "', last_updated = NOW(), manifest = '" . sqlescape($json) . "' WHERE id = '" . sqlescape($id) . "'");
} else {
    sqlquery("INSERT INTO bigtree_extensions (`id`,`type`,`name`,`version`,`last_updated`,`manifest`) VALUES ('" . sqlescape($id) . "','extension','" . sqlescape($title) . "','" . sqlescape($version) . "',NOW(),'" . sqlescape($json) . "')");
}
// Turn foreign key checks back on
sqlquery("SET foreign_key_checks = 1");
?>
<div class="container">
	<section>
		<p>Extension created successfully.</p>
	</section>
	<footer>
		<a href="<?php 
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:31,代码来源:create.php

示例6: foreach

// Files for field types -- we use the $p version here because we may have added some when checking the module
foreach ((array) $p["field_types"] as $type) {
    if ($type) {
        if (file_exists(SERVER_ROOT . "custom/admin/form-field-types/draw/{$type}.php")) {
            $p["files"][] = SERVER_ROOT . "custom/admin/form-field-types/draw/{$type}.php";
        }
        if (file_exists(SERVER_ROOT . "custom/admin/form-field-types/process/{$type}.php")) {
            $p["files"][] = SERVER_ROOT . "custom/admin/form-field-types/process/{$type}.php";
        }
        if (file_exists(SERVER_ROOT . "custom/admin/ajax/developer/field-options/{$type}.php")) {
            $p["files"][] = SERVER_ROOT . "custom/admin/ajax/developer/field-options/{$type}.php";
        }
    }
}
// Add all the files in the extension directories
$contents = array_merge((array) BigTree::directoryContents(SITE_ROOT . "extensions/" . $p["id"] . "/"), (array) BigTree::directoryContents(SERVER_ROOT . "extensions/" . $p["id"] . "/"));
foreach ($contents as $file) {
    if (!is_dir($file) && file_exists($file)) {
        $p["files"][] = $file;
    }
}
// Make sure we have no dupes
$p["module_groups"] = array_unique($p["module_groups"]);
$p["modules"] = array_unique($p["modules"]);
$p["templates"] = array_unique($p["templates"]);
$p["callouts"] = array_unique($p["callouts"]);
$p["settings"] = array_unique($p["settings"]);
$p["feeds"] = array_unique($p["feeds"]);
$p["field_types"] = array_unique($p["field_types"]);
$p["files"] = array_unique($p["files"]);
$p["tables"] = array_unique($p["tables"]);
开发者ID:jzxyouok,项目名称:BigTree-CMS,代码行数:31,代码来源:save-components.php

示例7: foreach

    $package["components"]["tables"][] = $table;
}
$package["sql"][] = "SET foreign_key_checks = 1";
foreach ((array) $files as $file) {
    $file = str_replace(SERVER_ROOT, "", $file);
    BigTree::copyFile(SERVER_ROOT . $file, SERVER_ROOT . "cache/package/" . $file);
    $package["files"][] = $file;
}
// Write the manifest file
$json = BigTree::json($package);
BigTree::putFile(SERVER_ROOT . "cache/package/manifest.json", $json);
// Create the zip
@unlink(SERVER_ROOT . "cache/package.zip");
include BigTree::path("inc/lib/pclzip.php");
$zip = new PclZip(SERVER_ROOT . "cache/package.zip");
$zip->create(BigTree::directoryContents(SERVER_ROOT . "cache/package/"), PCLZIP_OPT_REMOVE_PATH, SERVER_ROOT . "cache/package/");
// Remove the package directory
BigTree::deleteDirectory(SERVER_ROOT . "cache/package/");
// Store it in the database for future updates
if (sqlrows(sqlquery("SELECT * FROM bigtree_extensions WHERE id = '" . sqlescape($id) . "'"))) {
    sqlquery("UPDATE bigtree_extensions SET name = '" . sqlescape($title) . "', version = '" . sqlescape($version) . "', last_updated = NOW(), manifest = '" . sqlescape($json) . "' WHERE id = '" . sqlescape($id) . "'");
} else {
    sqlquery("INSERT INTO bigtree_extensions (`id`,`type`,`name`,`version`,`last_updated`,`manifest`) VALUES ('" . sqlescape($id) . "','package','" . sqlescape($title) . "','" . sqlescape($version) . "',NOW(),'" . sqlescape($json) . "')");
}
?>
<div class="container">
	<section>
		<p>Package created successfully.</p>
	</section>
	<footer>
		<a href="<?php 
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:31,代码来源:create.php

示例8: directoryContents

 static function directoryContents($directory, $recurse = true, $extension = false)
 {
     $contents = array();
     $d = @opendir($directory);
     if (!$d) {
         return false;
     }
     while ($r = readdir($d)) {
         if ($r != "." && $r != ".." && $r != ".DS_Store") {
             $path = rtrim($directory, "/") . "/" . $r;
             if ($extension === false || substr($path, -1 * strlen($extension)) == $extension) {
                 $contents[] = $path;
             }
             if (is_dir($path) && $recurse) {
                 $contents = array_merge($contents, BigTree::directoryContents($path, $recurse, $extension));
             }
         }
     }
     return $contents;
 }
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:20,代码来源:utils.php

示例9: trim

			<input type="submit" class="button blue" value="Set FTP Directory" />
		</footer>
	</div>
</form>
<?php 
        } else {
            $ftp_root = "/" . trim($ftp_root, "/") . "/";
            // Create backups folder
            $ftp->createDirectory($ftp_root . "backups/");
            // Move old core
            $ftp->rename($ftp_root . "core/", $ftp_root . "backups/core-" . BIGTREE_VERSION . "/");
            // Backup database
            $admin->backupDatabase(SERVER_ROOT . "cache/backup.sql");
            $ftp->rename($ftp_root . "cache/backup.sql", $ftp_root . "backups/core-" . BIGTREE_VERSION . "/backup.sql");
            // Move new core into place
            $ftp->rename($ftp_root . "cache/update/core/", $ftp_root . "core/");
            // Delete old files
            $contents = array_reverse(BigTree::directoryContents(SERVER_ROOT . "cache/update/"));
            foreach ($contents as $file) {
                if (is_dir($file)) {
                    rmdir($file);
                } else {
                    unlink($file);
                }
            }
            rmdir(SERVER_ROOT . "cache/update/");
            unlink(SERVER_ROOT . "cache/update.zip");
            BigTree::redirect(DEVELOPER_ROOT . "upgrade/database/");
        }
    }
}
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:31,代码来源:install.php

示例10: extract

 function extract()
 {
     include_once SERVER_ROOT . "core/inc/lib/pclzip.php";
     $zip = new PclZip(SERVER_ROOT . "cache/update.zip");
     // If the temporary update directory doesn't exist, create it
     BigTree::makeDirectory(SERVER_ROOT . "cache/update/");
     // Figure out if we have just a single directory at the root
     $zip_root = $this->zipRoot($zip);
     if ($zip_root) {
         $zip->extract(PCLZIP_OPT_PATH, SERVER_ROOT . "cache/update/", PCLZIP_OPT_REMOVE_PATH, $zip_root);
     } else {
         $zip->extract(PCLZIP_OPT_PATH, SERVER_ROOT . "cache/update/");
     }
     // Error occurred extracting? Return false
     if ($zip->errorName() != "PCLZIP_ERR_NO_ERROR") {
         return false;
     }
     // Make sure everything extracted is 777 -- if we're writing as Apache we want bust permissions for the user.
     $contents = BigTree::directoryContents(SERVER_ROOT . "cache/update/");
     foreach ($contents as $file) {
         chmod($file, 0777);
     }
     return true;
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:24,代码来源:updater.php

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