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


PHP preg_files函数代码示例

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


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

示例1: spiplistes_console_lit_log

function spiplistes_console_lit_log ($logname) {

	$files = preg_files(defined('_DIR_TMP') ? _DIR_TMP : _DIR_SESSION, "$logname\.log(\.[0-9])?");
	krsort($files);

	$log = "";
	foreach($files as $nom){
		if (lire_fichier($nom, $contenu))
			$log .= $contenu;
	}
	$contenu = explode("\n", $contenu);
	
	$result = "";
	$maxlines = 40;
	while ($contenu && $maxlines){
		$ii = trim(array_pop($contenu));
		if(strlen($ii)) { 
			$result .= $ii."\n";
			$maxlines--;
		}
	}
	
	$result = "<pre style='margin-top:1em'>".$result."</pre>\n";
	
	return($result);
}
开发者ID:rhertzog,项目名称:lcs,代码行数:26,代码来源:spiplistes_lire_console.php

示例2: ckeditor_install

function ckeditor_install($action,$prefix,$version_cible){
	switch($action) {
		case 'test':
			$ckeditor = lire_config('ckeditor',false) ;
			return is_array($ckeditor) ;
		case 'install':
			$formulaires = preg_files(_DIR_RACINE, "ckeditor-spip-plugin/formulaires/.*.php") ;
			foreach($formulaires as $formulaire) {
				spip_log("formulaire : $formulaire", "ckeditor");
				if (preg_match("~formulaires/(ck[a-z]).php$~",$formulaire, $m)) {
					include_spip("formulaires/".$m[1]);
					$fonction = "formulaires_".$m[1]."_charger_dist" ;
					$valeurs = $fonction() ;
					$vals=array();
					foreach($valeurs as $entree => $valeur) {
						if (! is_null($valeur) && ! ($valeur === '')) {
								ecrire_config("ckeditor/".$entree, $valeur) ;
								$vals[]="ckeditor/$entree";
						}
					}
				}
			}
			return true ;
		default:
			spip_log("installation[action:$action non prise en charge]", "ckeditor");
	}
}
开发者ID:samszo,项目名称:open-edition,代码行数:27,代码来源:ckeditor_install.php

示例3: box_lister_skins

function box_lister_skins()
{
    $skins = array('none' => array('nom' => _T('mediabox:label_aucun_style')));
    $maxfiles = 1000;
    $liste_fichiers = array();
    $recurs = array();
    foreach (creer_chemin() as $d) {
        $f = $d . "colorbox/";
        if (@is_dir($f)) {
            $liste = preg_files($f, "colorbox[.]css\$", $maxfiles - count($liste_fichiers), $recurs);
            foreach ($liste as $chemin) {
                $nom = substr(dirname($chemin), strlen($f));
                // ne prendre que les fichiers pas deja trouves
                // car find_in_path prend le premier qu'il trouve,
                // les autres sont donc masques
                if (!isset($liste_fichiers[$nom])) {
                    $liste_fichiers[$nom] = $chemin;
                }
            }
        }
    }
    foreach ($liste_fichiers as $short => $fullpath) {
        $skins[$short] = array('nom' => basename($short));
        if (file_exists($f = dirname($fullpath) . "/vignette.jpg")) {
            $skins[$short]['img'] = $f;
        }
    }
    return $skins;
}
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:29,代码来源:configurer_mediabox.php

示例4: formulaires_restauration_cfg_charger_dist

function formulaires_restauration_cfg_charger_dist()
{
    $fonds = array();
    $pages_cfg = explode(':', _SARKASPIP_PAGES_CONFIG);
    foreach ($pages_cfg as $_page) {
        if ($_page != 'maintenance') {
            $fond = "sarkaspip_{$_page}";
            $fonds[$fond] = _T("sarkaspip:{$fond}");
        }
    }
    $dir = sous_repertoire(_DIR_TMP, "cfg");
    $saves = preg_files($dir, implode('|', array_flip($fonds)));
    $options = '';
    $groupe = '';
    foreach ($saves as $_fichier) {
        $nom = basename($_fichier);
        $dirs = explode('/', dirname($_fichier));
        $_dir = end($dirs);
        if ($_dir != $groupe) {
            if ($options) {
                $options .= '</optgroup>';
            }
            $options .= '<optgroup style="font-weight: strong;" label="' . $fonds[$_dir] . '">';
            $groupe = $_dir;
        }
        $options .= '<option value="' . $_fichier . '">' . $nom . '</option>';
    }
    if ($options) {
        $options .= '</optgroup>';
    }
    $valeurs = array('_fichiers_sauvegardes' => $options);
    return $valeurs;
}
开发者ID:jazzman346,项目名称:CAC_Site,代码行数:33,代码来源:restauration_cfg.php

示例5: liste_plugin_files

function liste_plugin_files($dir_plugins = null){
	static $plugin_files=array();

	if (is_null($dir_plugins)) {
		$dir_plugins = _DIR_PLUGINS;
		if (defined('_DIR_PLUGINS_SUPPL'))
			$dir_plugins_suppl = array_filter(explode(':',_DIR_PLUGINS_SUPPL));
	}

	if (!isset($plugin_files[$dir_plugins])
	OR count($plugin_files[$dir_plugins]) == 0){
		$plugin_files[$dir_plugins] = array();
		foreach (preg_files($dir_plugins, '/plugin[.]xml$') as $plugin) {
			$plugin_files[$dir_plugins][] = substr(dirname($plugin),strlen($dir_plugins));
		}
		sort($plugin_files[$dir_plugins]);

		// hack affreux pour avoir le bon chemin pour les repertoires
		// supplementaires ; chemin calcule par rapport a _DIR_PLUGINS.
		if (isset($dir_plugins_suppl)) {
			foreach($dir_plugins_suppl as $suppl) {
				foreach (preg_files(_DIR_RACINE.$suppl, 'plugin[.]xml$') as $plugin) {
					$plugin_files[$dir_plugins][] = (_DIR_RACINE? '':'../').dirname($plugin);
				}
			}
		}
	}

	return $plugin_files[$dir_plugins];
}
开发者ID:rhertzog,项目名称:lcs,代码行数:30,代码来源:plugin.php

示例6: liste_cfg

function liste_cfg($dir = '')
{
    // Faire la liste des éléments qui ont un cfg ; ca peut etre des plugins
    // mais aussi des squelettes ou n'importe quoi
    $liste = array();
    // tous les repertoires
    if (!$dir) {
        foreach (creer_chemin() as $dir) {
            if (basename($dir) != 'cfg') {
                $liste = array_merge($liste, preg_files($dir . 'fonds/', '/cfg_.*html$'));
            }
        }
        // ou seulement celui demande
    } else {
        $dir = rtrim(rtrim($dir), '/') . '/';
        $liste = preg_files($dir . 'fonds/', '/cfg_.*html$');
    }
    if ($liste) {
        $l = array();
        foreach ($liste as $cfg) {
            $fonds = substr(basename($cfg, '.html'), 4);
            $l[$fonds] = $cfg;
        }
        ksort($l);
        return $l;
    }
}
开发者ID:pcrest,项目名称:eludis,代码行数:27,代码来源:cfg.php

示例7: bases_referencees

function bases_referencees($exclu='')
{
	$tables = array();
	foreach(preg_files(_DIR_CONNECT, '.php$') as $f) {
		if ($f != $exclu AND analyse_fichier_connection($f))
			$tables[]= basename($f, '.php');
	}
	return $tables;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:9,代码来源:install.php

示例8: skeleditor_files_editables

/**
 * Lister les fichiers editables
 */
function skeleditor_files_editables($path=null){
	if (is_null($path))
		$path = skeleditor_path_editable();
	if (!$path) return array();

	$files_editable = preg_files($path,'[.]('._SE_EXTENSIONS.')$');
	$files_editable = sort_directory_first($files_editable,$path); // utile ?

	return $files_editable;
}
开发者ID:samszo,项目名称:open-edition,代码行数:13,代码来源:skeleditor.php

示例9: essais_tw_propre_typo

function essais_tw_propre_typo()
{
    $tests = preg_files(_DIR_PLUGIN_TW . "tests/data/typo/", '\\.txt$');
    $texte = $expected = "";
    $essais = array();
    foreach ($tests as $t) {
        lire_fichier($t, $texte);
        lire_fichier(substr($t, 0, -4) . ".html", $expected);
        $essais[basename($t, ".txt")] = array($expected, $texte);
    }
    return $essais;
}
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:12,代码来源:tw_propre_typo.php

示例10: cextras_types_formulaires

function cextras_types_formulaires(){
	$types = array();

	foreach(_chemin() as $dir) {
		if (@is_dir($s = $dir.'extra-saisies/')) {
			foreach(preg_files($s, '.*.html$') as $saisie) {
				$type = basename($saisie,'.html');
				$types[$type] = array(
					'nom' => _T('cextras:type', array('type' => $type))
				);
			}
		}
	}
	return $types;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:15,代码来源:cextras_gerer.php

示例11: bank_lister_instal_prestas

/**
 * Lister les install de presta
 * @return array
 */
function bank_lister_instal_prestas()
{
    $liste_prestas = array();
    $recurs = array();
    $maxfiles = 10000;
    $dir = 'presta/';
    // Parcourir le chemin
    foreach (creer_chemin() as $d) {
        $f = $d . $dir;
        if (@is_dir($f)) {
            $liste = preg_files($f, "/install[.]php\$", $maxfiles - count($liste_prestas), $recurs);
            foreach ($liste as $chemin) {
                $liste_prestas[] = dirname(substr($chemin, strlen($f)));
            }
        }
    }
    return $liste_prestas;
}
开发者ID:nursit,项目名称:bank,代码行数:22,代码来源:bank_administrations.php

示例12: sarkaspip_zengarden_activer_theme

function sarkaspip_zengarden_activer_theme($flux)
{
    $dir = $flux['args']['dir'];
    $action = $flux['args']['action'];
    $dir_cfg = $dir . '/cfg';
    $cfg = preg_files($dir_cfg);
    include_spip('inc/config');
    if ($action == 'activer') {
        // On sauvegarde des valeurs actuelles pour un eventuel rappel
        $dir_cfg = sous_repertoire(_DIR_TMP, "cfg");
        $dir_cfg = sous_repertoire(_DIR_TMP, "themes");
        $fonds = array();
        foreach ($cfg as $_fichier_cfg) {
            $fonds[] = basename($_fichier_cfg, '.txt');
        }
        include_spip('inc/sarkaspip_filtres');
        $ok = sauvegarder_fonds($fonds, $dir_cfg, 'theme');
        // On ecrit la nouvelle configuration n�cessaire au theme choisi
        $flux['data'] = true;
        foreach ($cfg as $_fichier_cfg) {
            lire_fichier($_fichier_cfg, $tableau);
            $fond = basename($_fichier_cfg, '.txt');
            ecrire_config($fond, $tableau);
        }
    } else {
        if ($action == 'effacer') {
            $fichiers = array();
            $flux['data'] = true;
            foreach ($cfg as $_fichier_cfg) {
                $fond = basename($_fichier_cfg, '.txt');
                effacer_config($fond);
                $fichiers[] = _DIR_TMP . 'themes/cfg/' . $fond . '.txt';
            }
            include_spip('inc/sarkaspip_filtres');
            $ok = restaurer_fonds($fichiers);
        } else {
            // action apercevoir : on ne fait rien, on sait pas faire..
        }
    }
    return $flux;
}
开发者ID:jazzman346,项目名称:CAC_Site,代码行数:41,代码来源:sarkaspip_pipelines.php

示例13: export_repertoire

function export_repertoire($meta, $val_meta)
{
	list(, $archive, , $tables, $etape, $sous_etape, , $save) = $val_meta;
	if (!function_exists('inc_export_' . ($save ? $save : 'xml'))) {
		spip_log("fonction inc_export_$save indisponible");
		return false;
	}
	$dir = base_dump_dir($meta);

	// Reperer une situation anormale (echec reprise sur interruption)
	if (($etape == 1) AND !$sous_etape) {
		$file = $dir . $archive;
		$l = preg_files($file .  ".part_[0-9]+_[0-9]+");
		if ($l) {
			spip_log("menage d'une sauvegarde inachevee: " . join(',', $l));
			foreach($l as $dummy) spip_unlink($dummy);
		}
	}
	$all = count($tables);
	return ($etape > $all OR !$all) ? false : $dir;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:21,代码来源:export.php

示例14: afficher_raccourcis

function afficher_raccourcis($module = "public") {
	global $spip_lang;
	
	charger_langue($spip_lang, $module);

	$tableau = $GLOBALS['i18n_' . $module . '_' . $spip_lang];
	ksort($tableau);

	$aff_nom_module= "";
	if ($module != "public" AND $module != "local")
		$aff_nom_module = "$module:";

	echo "<div class='arial2'>"._T('module_texte_explicatif')."</div>";
	echo "<div>&nbsp;</div>";

	foreach (preg_files(repertoire_lang().$module.'_[a-z_]+\.php[3]?$') as $f)
		if (preg_match(",^".$module."\_([a-z_]+)\.php[3]?$,", $f, $regs))
				$langue_module[$regs[1]] = traduire_nom_langue($regs[1]);

	if (isset($langue_module) && ($langue_module)) {
		ksort($langue_module);
		echo "<div class='arial2'>"._T('module_texte_traduction',
			array('module' => $module));
		echo " ".join(", ", $langue_module).".";
		echo "</div><div>&nbsp;</div>";
	}

	echo debut_cadre_relief('',true,'','','raccourcis');
	echo "\n<table class='spip' style='border:0;'>";
	echo "\n<tr class='titrem'><th class='verdana1'>"._T('module_raccourci')."</th>\n<th class='verdana2'>"._T('module_texte_affiche')."</th></tr>\n";

	$i = 0;
	foreach ($tableau as $raccourci => $val) {
		$bgcolor = alterner(++$i, 'row_even','row_odd');
		echo "\n<tr class='$bgcolor'><td class='verdana2'><b>&lt;:$aff_nom_module$raccourci:&gt;</b></td>\n<td class='arial2'>".$val."</td></tr>";
	}

	echo "</table>",fin_cadre_relief(true);
}
开发者ID:rhertzog,项目名称:lcs,代码行数:39,代码来源:lang_raccourcis.php

示例15: bank_lister_prestas

/**
 * Retourner la liste des prestataires connus
 */
function bank_lister_prestas()
{
    static $prestas = null;
    if (is_array($prestas)) {
        return $prestas;
    }
    $prestas = array();
    $regexp = "(abonnement|acte)\\.php\$";
    foreach (creer_chemin() as $d) {
        $f = $d . "presta/";
        if (@is_dir($f)) {
            $all = preg_files($f, $regexp);
            foreach ($all as $a) {
                $a = explode("/presta/", $a);
                $a = end($a);
                $a = explode("/", $a);
                if (count($a) == 3 and $a[1] = "payer") {
                    $prestas[reset($a)] = true;
                }
            }
        }
    }
    ksort($prestas);
    // a la fin
    foreach (array("cheque", "virement", "simu") as $m) {
        if (isset($prestas[$m])) {
            unset($prestas[$m]);
            $prestas[$m] = true;
        }
    }
    if (isset($prestas['gratuit'])) {
        unset($prestas['gratuit']);
    }
    $prestas = array_keys($prestas);
    return $prestas;
}
开发者ID:nursit,项目名称:bank,代码行数:39,代码来源:bank.php


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