本文整理汇总了PHP中Qdmvc::getPluginDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Qdmvc::getPluginDir方法的具体用法?PHP Qdmvc::getPluginDir怎么用?PHP Qdmvc::getPluginDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Qdmvc
的用法示例。
在下文中一共展示了Qdmvc::getPluginDir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_genfromfolder
public function fn_genfromfolder($location, $params)
{
$folder = Qdmvc::getPluginDir('controllers/pages');
$count = 0;
foreach (glob("{$folder}/*") as $file) {
if ($count == 0) {
QdQdmvcPage::delete_all();
}
if (is_dir($file)) {
$folder_name = basename($file);
if (QdQdmvcPage::GET($folder_name) == null) {
$tmp = new QdQdmvcPage();
$tmp->id = $folder_name;
if ($tmp->save()) {
$count++;
}
}
}
}
$this->pushValidateError('', sprintf('Total items: %s', $count), 'info');
return true;
}
示例2: fn_genfromfolder
public function fn_genfromfolder($location, $params)
{
$folder = Qdmvc::getPluginDir('models');
$count = 0;
$t = glob("{$folder}/*");
foreach (glob("{$folder}/*") as $file) {
if ($count == 0) {
QdQdmvcModel::delete_all();
}
if (is_file($file)) {
$file_name = basename($file);
$file_name = str_replace(".php", "", $file_name);
if (QdQdmvcModel::GET($file_name) == null) {
$tmp = new QdQdmvcModel();
$tmp->id = $file_name;
if ($tmp->save()) {
$count++;
}
}
}
}
$this->pushValidateError('', sprintf('Total items: %s', $count), 'info');
return true;
}
示例3: cacheRemoveAll
public static function cacheRemoveAll()
{
$folder = Qdmvc::getPluginDir('caches');
foreach (glob("{$folder}/*") as $file) {
if (is_dir($file)) {
continue;
} else {
unlink($file);
}
}
return true;
}
示例4: extractQdmvcCoreFiles
public static function extractQdmvcCoreFiles()
{
$folders = array(Qdmvc::getPluginDir('controllers/dataports/root') => '_core_pkg/controllers/dataports/root', Qdmvc::getPluginDir('controllers/pages/root') => '_core_pkg/controllers/pages/root', Qdmvc::getPluginDir('controllers/pages/root_list') => '_core_pkg/controllers/pages/root_list', Qdmvc::getPluginDir('controllers/pages/root_setup') => '_core_pkg/controllers/pages/root_setup', Qdmvc::getPluginDir('controllers/pages/user') => '_core_pkg/controllers/pages/user', Qdmvc::getPluginDir('controllers/pages/user_list') => '_core_pkg/controllers/pages/user_list', Qdmvc::getPluginDir('helpers') => '_core_pkg/helpers', Qdmvc::getPluginDir('views') => '_core_pkg/views', Qdmvc::getPluginDir('widgets') => '_core_pkg/widgets');
$coreFiles = array(Qdmvc::getPluginDir('index.php') => '_core_pkg', Qdmvc::getPluginDir('qdmvc.php') => '_core_pkg', Qdmvc::getPluginDir('models/QdRoot.php') => '_core_pkg/models', Qdmvc::getPluginDir('models/QdRootReport.php') => '_core_pkg/models', Qdmvc::getPluginDir('models/QdRootSetup.php') => '_core_pkg/models', Qdmvc::getPluginDir('models/QdUser.php') => '_core_pkg/models', Qdmvc::getPluginDir('controllers/pages/index.php') => '_core_pkg/controllers/pages', Qdmvc::getPluginDir('controllers/menus/index.php') => '_core_pkg/controllers/menus', Qdmvc::getPluginDir('controllers/dataports/index.php') => '_core_pkg/controllers/dataports', Qdmvc::getPluginDir('controllers/index.php') => '_core_pkg/controllers', Qdmvc::getPluginDir('native/index.php') => '_core_pkg/native', Qdmvc::getPluginDir('native/router.php') => '_core_pkg/native', Qdmvc::getPluginDir('native/register-admin-menu.php') => '_core_pkg/native', Qdmvc::getPluginDir('native/register-hook.php') => '_core_pkg/native', Qdmvc::getPluginDir('native/db-init.php') => '_core_pkg/native', Qdmvc::getPluginDir('messages/index.php') => '_core_pkg/messages', Qdmvc::getPluginDir('messages/global.php') => '_core_pkg/messages');
$zip = new ZipArchive();
$zipPath = Qdmvc::getPluginDir("_core_pkg.zip");
$report = '';
if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) {
foreach ($folders as $rootPath => $rp) {
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootPath), RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($files as $name => $file) {
// Skip directories (they would be added automatically)
if (!$file->isDir()) {
// Get real and relative path for current file
$filePath = $file->getRealPath();
$relativePath = $rp . '/' . substr($filePath, strlen($rootPath) + 1);
// Add current file to archive
$zip->addFile($filePath, $relativePath);
$report .= $filePath . ' => ' . $relativePath . '<br>';
}
}
}
foreach ($coreFiles as $file => $rp) {
// Skip directories (they would be added automatically)
if (!is_dir($file)) {
$rootPath = dirname($file);
// Get real and relative path for current file
$relativePath = $rp . '/' . substr($file, strlen($rootPath) + 1);
// Add current file to archive
$zip->addFile($file, $relativePath);
$report .= $file . ' => ' . $relativePath . '<br>';
}
}
$zip->close();
}
return $report;
}