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


PHP scan函数代码示例

本文整理汇总了PHP中scan函数的典型用法代码示例。如果您正苦于以下问题:PHP scan函数的具体用法?PHP scan怎么用?PHP scan使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getFileArray

 private function getFileArray($subDir)
 {
     $result = array();
     $dir = TL_ROOT . '/system/modules/con4gis_maps3/assets/css/themes/' . $subDir . '/';
     if (is_dir($dir)) {
         $file = \scan($dir);
         $getLastFile = $file;
         $lastFile = max(array_keys($getLastFile));
         $hiddenName = array('.', '..', '.DS_Store');
         $x = 0;
         while ($x <= $lastFile) {
             if (!in_array($file[$x], $hiddenName)) {
                 $pathinfo = pathinfo($file[$x]);
                 if (strtolower($pathinfo['extension']) != "css") {
                     continue;
                 }
                 $fileobj = new \File($file[$x], true);
                 //needed for $file[$x] too!
                 $result[] = $file[$x];
             }
             $x++;
         }
     }
     return $result;
 }
开发者ID:Kuestenschmiede,项目名称:con4gis_maps3,代码行数:25,代码来源:tl_c4g_map_themes.php

示例2: listRows

 /**
  * List download files
  * @param   array
  * @return  string
  * @see     https://contao.org/de/manual/3.1/data-container-arrays.html#label_callback
  */
 public function listRows($row)
 {
     $objDownload = Download::findByPk($row['id']);
     $icon = '';
     if (null === $objDownload || null === $objDownload->getRelated('singleSRC')) {
         return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['invalidName'] . '</p>';
     }
     $path = $objDownload->getRelated('singleSRC')->path;
     if ($objDownload->getRelated('singleSRC')->type == 'folder') {
         $arrDownloads = array();
         foreach (scan(TL_ROOT . '/' . $path) as $file) {
             if (is_file(TL_ROOT . '/' . $path . '/' . $file)) {
                 $objFile = new \File($path . '/' . $file);
                 $icon = 'background:url(' . TL_ASSETS_URL . 'assets/contao/images/' . $objFile->icon . ') left center no-repeat; padding-left: 22px';
                 $arrDownloads[] = sprintf('<div style="margin-bottom:5px;height:16px;%s">%s</div>', $icon, $path . '/' . $file);
             }
         }
         if (empty($arrDownloads)) {
             return $GLOBALS['TL_LANG']['ERR']['emptyDownloadsFolder'];
         }
         return '<div style="margin-bottom:5px;height:16px;font-weight:bold">' . $path . '</div>' . implode("\n", $arrDownloads);
     }
     if (is_file(TL_ROOT . '/' . $path)) {
         $objFile = new \File($path);
         $icon = 'background: url(' . TL_ASSETS_URL . 'assets/contao/images/' . $objFile->icon . ') left center no-repeat; padding-left: 22px';
     }
     return sprintf('<div style="height: 16px;%s">%s</div>', $icon, $path);
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:34,代码来源:Callback.php

示例3: scan

function scan($dir)
{
    $files = array();
    // Is there actually such a folder/file?
    if (file_exists($dir)) {
        $scanned = scandir($dir);
        //get a directory listing
        $scanned = array_diff(scandir($dir), array('.', '..', '.DS_Store', 'Thumbs.db'));
        //sort folders first, then by type, then alphabetically
        usort($scanned, create_function('$a,$b', '
			return	is_dir ($a)
				? (is_dir ($b) ? strnatcasecmp ($a, $b) : -1)
				: (is_dir ($b) ? 1 : (
					strcasecmp (pathinfo ($a, PATHINFO_EXTENSION), pathinfo ($b, PATHINFO_EXTENSION)) == 0
					? strnatcasecmp ($a, $b)
					: strcasecmp (pathinfo ($a, PATHINFO_EXTENSION), pathinfo ($b, PATHINFO_EXTENSION))
				))
			;
		'));
        foreach ($scanned as $f) {
            if (!$f || $f[0] == '.') {
                continue;
                // Ignore hidden files
            }
            if (is_dir($dir . '/' . $f)) {
                // The path is a folder
                $files[] = array("name" => $f, "type" => "folder", "path" => $dir . '/' . $f, "items" => scan($dir . '/' . $f));
            } else {
                // It is a file
                $files[] = array("name" => $f, "type" => "file", "ext" => pathinfo($f, PATHINFO_EXTENSION), "path" => $dir . '/' . $f, "size" => filesize($dir . '/' . $f));
            }
        }
    }
    return $files;
}
开发者ID:vkynchev,项目名称:KynchevIDE,代码行数:35,代码来源:scan.php

示例4: run

 /**
  * Run the controller
  */
 public function run()
 {
     // Check if shop has been installed
     $blnInstalled = \Database::getInstance()->tableExists(Config::getTable());
     foreach (scan(TL_ROOT . '/system/modules/isotope/library/Isotope/Upgrade') as $strFile) {
         $strVersion = pathinfo($strFile, PATHINFO_FILENAME);
         if (preg_match('/To[0-9]{10}/', $strVersion)) {
             $strClass = 'Isotope\\Upgrade\\' . $strVersion;
             $strStep = 'Version ' . RepositoryVersion::format(substr($strVersion, 2));
             try {
                 $objUpgrade = new $strClass();
                 $objUpgrade->run($blnInstalled);
             } catch (\Exception $e) {
                 $this->handleException($strStep, $e);
             }
         }
     }
     if ($blnInstalled) {
         try {
             $this->verifySystemIntegrity();
             $this->purgeCaches();
         } catch (\Exception $e) {
             $this->handleException('Finalization', $e);
         }
     }
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:29,代码来源:Upgrade.php

示例5: scan

function scan($dir)
{
    $dir = new DirectoryIterator($dir);
    foreach ($dir as $po) {
        if ($po->isDir() && !$po->isDot()) {
            scan($po->getPathname());
        } elseif ($po->isFile() && '.po' == substr($po->getFilename(), -3)) {
            try {
                $file_po = $po->getPathname();
                $file_mo = substr($po->getPathname(), 0, -3) . '.mo';
                @mkdir(dirname($file_mo), 0777, true);
                @chmod(dirname($file_mo), 0777);
                print "Processing file: {$file_po} ";
                if (false === system("msgfmt {$file_po} -o {$file_mo}")) {
                    throw new Exception('Can\'t process file');
                }
                if (!file_exists($file_mo)) {
                    touch($file_mo);
                }
                @chmod($file_mo, 0777);
                print '[ OK ]';
            } catch (Exception $e) {
                print '[ ERROR ]';
            }
            print "<br />\n";
        }
    }
}
开发者ID:sabril-2t,项目名称:Open-Ad-Server,代码行数:28,代码来源:msgfmt.php

示例6: updateStyleSheets

 /**
  * Update all style sheets in the scripts folder
  */
 public function updateStyleSheets()
 {
     $objStyleSheets = $this->Database->execute("SELECT * FROM tl_style_sheet");
     $arrStyleSheets = $objStyleSheets->fetchEach('name');
     // Make sure the dcaconfig.php file is loaded
     @(include TL_ROOT . '/system/config/dcaconfig.php');
     // Delete old style sheets
     foreach (scan(TL_ROOT . '/system/scripts', true) as $file) {
         // Skip directories
         if (is_dir(TL_ROOT . '/system/scripts/' . $file)) {
             continue;
         }
         // Preserve root files (is this still required now that scripts are in system/scripts?)
         if (is_array($GLOBALS['TL_CONFIG']['rootFiles']) && in_array($file, $GLOBALS['TL_CONFIG']['rootFiles'])) {
             continue;
         }
         // Do not delete the combined files (see #3605)
         if (preg_match('/^[a-f0-9]{12}\\.css$/', $file)) {
             continue;
         }
         $objFile = new File('system/scripts/' . $file);
         // Delete the old style sheet
         if ($objFile->extension == 'css' && !in_array($objFile->filename, $arrStyleSheets)) {
             $objFile->delete();
         }
     }
     $objStyleSheets->reset();
     // Create the new style sheets
     while ($objStyleSheets->next()) {
         $this->writeStyleSheet($objStyleSheets->row());
         $this->log('Generated style sheet "' . $objStyleSheets->name . '.css"', 'StyleSheets updateStyleSheets()', TL_CRON);
     }
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:36,代码来源:StyleSheets.php

示例7: updateStyleSheets

 /**
  * Update all style sheets in the scripts folder
  */
 public function updateStyleSheets()
 {
     $objStyleSheets = $this->Database->execute("SELECT * FROM tl_style_sheet");
     $arrStyleSheets = $objStyleSheets->fetchEach('name');
     // Make sure the dcaconfig.php file is loaded
     include TL_ROOT . '/system/config/dcaconfig.php';
     // Delete old style sheets
     foreach (scan(TL_ROOT . '/system/scripts', true) as $file) {
         if (is_dir(TL_ROOT . '/system/scripts/' . $file)) {
             continue;
         }
         if (is_array($GLOBALS['TL_CONFIG']['rootFiles']) && in_array($file, $GLOBALS['TL_CONFIG']['rootFiles'])) {
             continue;
         }
         $objFile = new File('system/scripts/' . $file);
         if ($objFile->extension == 'css' && !in_array($objFile->filename, $arrStyleSheets)) {
             $objFile->delete();
         }
     }
     $objStyleSheets->reset();
     // Create the new style sheets
     while ($objStyleSheets->next()) {
         $this->writeStyleSheet($objStyleSheets->row());
         $this->log('Generated style sheet "' . $objStyleSheets->name . '.css"', 'StyleSheets updateStyleSheets()', TL_CRON);
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:29,代码来源:StyleSheets.php

示例8: reason_write

function reason_write()
{
    extract($_REQUEST);
    $sql = "UPDATE cubit.pslip_scans SET reason='{$double_reason}' WHERE id='{$scan_id}'";
    db_exec($sql) or errDie("Unable to record scan reason.");
    return scan();
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:7,代码来源:dispatch.php

示例9: scan

function scan($dir)
{
    $accessableFiles = dbClass::getAccessableFiles($_COOKIE['userId']);
    $folder = [];
    foreach ($accessableFiles as $index => $code) {
        if (strpos($code['file'], '/') !== false) {
            $code['file'] = explode('/', $code['file'])[1];
        }
        $folder[] = $code['file'];
    }
    $files = array();
    // Is there actually such a folder/file?
    if (file_exists($dir)) {
        $allowedFolder = $accessableFiles[0]['file'];
        foreach (scandir($dir) as $f) {
            if (!$f || $f[0] == '.') {
                continue;
                // Ignore hidden files
            }
            if (is_dir($dir . '/' . $f)) {
                // The path is a folder
                for ($i = 0; $i < count($folder); $i++) {
                    if ($f == $folder[$i]) {
                        $files[] = array("name" => $f, "type" => "folder", 'checked' => false, "path" => $dir . '/' . $f, "items" => scan($dir . '/' . $f));
                    }
                }
            } else {
                // It is a file
                $files[] = array("name" => $f, "type" => "file", 'checked' => false, "path" => $dir . '/' . $f, "size" => filesize($dir . '/' . $f));
            }
        }
    }
    return $files;
}
开发者ID:ExertisMicro-P,项目名称:exertis-library,代码行数:34,代码来源:scan.php

示例10: updateInactiveModules

 /**
  * Update the inactive modules
  * @param mixed
  * @return mixed
  */
 public function updateInactiveModules($varValue)
 {
     $arrModules = deserialize($varValue);
     if (!is_array($arrModules)) {
         $arrModules = array();
     }
     foreach (scan(TL_ROOT . '/system/modules') as $strModule) {
         if (strncmp($strModule, '.', 1) === 0) {
             continue;
         }
         // Add the .skip file to disable the module
         if (in_array($strModule, $arrModules)) {
             if (!file_exists(TL_ROOT . '/system/modules/' . $strModule . '/.skip')) {
                 $objFile = new File('system/modules/' . $strModule . '/.skip');
                 $objFile->write('As long as this file exists, the module will be ignored.');
                 $objFile->close();
             }
         } else {
             if (file_exists(TL_ROOT . '/system/modules/' . $strModule . '/.skip')) {
                 $objFile = new File('system/modules/' . $strModule . '/.skip');
                 $objFile->delete();
             }
         }
     }
     return $varValue;
 }
开发者ID:rikaix,项目名称:core,代码行数:31,代码来源:tl_settings.php

示例11: getExcludedFields

 /**
  * Return all excluded fields as HTML drop down menu
  *
  * @return array
  */
 public function getExcludedFields()
 {
     $included = array();
     foreach (ModuleLoader::getActive() as $strModule) {
         $strDir = 'system/modules/' . $strModule . '/dca';
         if (!is_dir(TL_ROOT . '/' . $strDir)) {
             continue;
         }
         foreach (scan(TL_ROOT . '/' . $strDir) as $strFile) {
             // Ignore non PHP files and files which have been included before
             if (substr($strFile, -4) != '.php' || in_array($strFile, $included)) {
                 continue;
             }
             $included[] = $strFile;
             $strTable = substr($strFile, 0, -4);
             System::loadLanguageFile($strTable);
             $this->loadDataContainer($strTable);
         }
     }
     $arrReturn = array();
     // Get all excluded fields
     foreach ($GLOBALS['TL_DCA'] as $k => $v) {
         if (is_array($v['fields'])) {
             foreach ($v['fields'] as $kk => $vv) {
                 if ($vv['exclude'] || $vv['orig_exclude']) {
                     $arrReturn[$k][specialchars($k . '::' . $kk)] = $vv['label'][0] ?: $kk;
                 }
             }
         }
     }
     ksort($arrReturn);
     return $arrReturn;
 }
开发者ID:rheintechnology,项目名称:core,代码行数:38,代码来源:tl_user_group.php

示例12: scan

function scan($dir)
{
    global $skipping, $startFile, $accountId, $accounts, $basePath;
    $cdir = scandir($dir);
    foreach ($cdir as $key => $value) {
        if (!in_array($value, [".", ".."])) {
            if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
                if (!$skipping) {
                    if (!isset($accounts[$accountId])) {
                        echo "Account #{$accountId} not exitst!\n\n";
                        return;
                    }
                    $EMAIL = $accounts[$accountId]['email'];
                    $PASS = $accounts[$accountId]['pass'];
                    $relativeDir = str_replace($basePath, '', $dir . DIRECTORY_SEPARATOR . $value);
                    `/usr/bin/megamkdir -u "{$EMAIL}" -p "{$PASS}" /Root/{$relativeDir}`;
                }
                scan($dir . DIRECTORY_SEPARATOR . $value);
            } else {
                if ($skipping) {
                    if ($startFile == $dir . DIRECTORY_SEPARATOR . $value) {
                        $skipping = false;
                        //                        processFile($dir . DIRECTORY_SEPARATOR .$value);
                    }
                    continue;
                }
                processFile($dir . DIRECTORY_SEPARATOR . $value);
            }
        }
    }
}
开发者ID:Dubiy,项目名称:MegaBackuper,代码行数:31,代码来源:pusher.php

示例13: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     \System::loadLanguageFile('tl_autoload');
     // Process the request
     if (\Input::post('FORM_SUBMIT') == 'tl_autoload') {
         $this->createAutoloadFiles();
         $this->reload();
     }
     $arrModules = array();
     // List all modules
     foreach (scan(TL_ROOT . '/system/modules') as $strFile) {
         if (strncmp($strFile, '.', 1) === 0 || !is_dir(TL_ROOT . '/system/modules/' . $strFile)) {
             continue;
         }
         $arrModules[] = $strFile;
     }
     $this->Template->modules = $arrModules;
     $this->Template->messages = \Message::generate();
     $this->Template->href = $this->getReferer(true);
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
     $this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
     $this->Template->headline = $GLOBALS['TL_LANG']['tl_autoload']['headline'];
     $this->Template->action = ampersand(\Environment::get('request'));
     $this->Template->available = $GLOBALS['TL_LANG']['tl_autoload']['available'];
     $this->Template->xplAvailable = $GLOBALS['TL_LANG']['tl_autoload']['xplAvailable'];
     $this->Template->selectAll = $GLOBALS['TL_LANG']['MSC']['selectAll'];
     $this->Template->override = $GLOBALS['TL_LANG']['tl_autoload']['override'];
     $this->Template->xplOverride = $GLOBALS['TL_LANG']['tl_autoload']['xplOverride'];
     $this->Template->submitButton = specialchars($GLOBALS['TL_LANG']['MSC']['continue']);
     $this->Template->autoload = $GLOBALS['TL_LANG']['tl_autoload']['autoload'];
     $this->Template->ideCompat = $GLOBALS['TL_LANG']['tl_autoload']['ideCompat'];
 }
开发者ID:eknoes,项目名称:core,代码行数:35,代码来源:ModuleAutoload.php

示例14: scan

function scan($dir, $ext, $callback, $find = array(), $replace = array())
{
    $result = array();
    if (!is_dir($dir)) {
        return $result;
    }
    $args = func_get_args();
    //    print_r($args);
    $args = array_slice($args, 3, null, true);
    //    print_r($args);exit;
    $fp = scandir($dir);
    if ($fp) {
        foreach ($fp as $v) {
            if ($v == '.' || $v == '..') {
                continue;
            }
            if (is_dir($dir . '/' . $v)) {
                $end = scan($dir . '/' . $v, $ext, $callback, $find, $replace);
                if ($end) {
                    $result = array_merge($result, $end);
                }
            } else {
                if (check_file($dir . '/' . $v, $ext)) {
                    $args = array($dir . '/' . $v, $find, $replace);
                    $end = call_user_func_array($callback, $args);
                    if ($end) {
                        $result[] = $end;
                    }
                }
            }
        }
    }
    return $result;
}
开发者ID:abocd,项目名称:cooltoools,代码行数:34,代码来源:public.fun.php

示例15: scan

function scan($dir, $durl = '', $min_size = "3000")
{
    static $seen = array();
    global $return;
    $files = array();
    $dir = realpath($dir);
    if (isset($seen[$dir])) {
        return $files;
    }
    $seen[$dir] = TRUE;
    $dh = @opendir($dir);
    while ($dh && ($file = readdir($dh))) {
        if ($file !== '.' && $file !== '..') {
            $path = realpath($dir . '/' . $file);
            $url = $durl . '/' . $file;
            if (preg_match("/.svn|lang/", $path)) {
                continue;
            }
            if (is_dir($path)) {
                scan($path);
            } elseif (is_file($path)) {
                if (!preg_match("/\\.js\$/", $path) || filesize($path) < $min_size) {
                    continue;
                }
                $return[] = $path;
            }
        }
    }
    @closedir($dh);
    return $files;
}
开发者ID:irovast,项目名称:eyedock,代码行数:31,代码来源:compress.php


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