本文整理汇总了PHP中pathinfo_filename函数的典型用法代码示例。如果您正苦于以下问题:PHP pathinfo_filename函数的具体用法?PHP pathinfo_filename怎么用?PHP pathinfo_filename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pathinfo_filename函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTitle
function getTitle($file)
{
$str = $file;
$str = pathinfo_filename($file);
$str = str_replace(array('_', '-'), ' ', $str);
$str = ucwords($str);
return $str;
}
示例2: getMask
function getMask($file)
{
$seed = pathinfo_filename($file);
$ext = pathinfo_extension($file);
$filecount = strlen($seed);
$NumberSeed = '';
for ($i = 0; $i < $filecount; ++$i) {
$NumberSeed += $this->uniord($seed[$i]);
}
list($sec, $msec) = explode('.', microtime(true));
$mask = $msec * (int) $NumberSeed;
return $mask . '.' . $ext;
}
示例3: getAvailableModule
public function getAvailableModule()
{
$ret = array();
$files = glob(MODULES_DIR . '/*');
foreach ($files as $path) {
if (is_dir($path)) {
$files2 = glob($path . '/*');
foreach ($files2 as $file2) {
if (is_file($file2)) {
$pathinfo = pathinfo_filename($file2);
if (!isset($ret[basename($pathinfo["dirname"])])) {
$ret[basename($pathinfo["dirname"])] = array();
}
if (array_key_exists('extension', $pathinfo) && $pathinfo['extension'] == 'php') {
$pretty_name = call_user_func(array(basename($pathinfo["dirname"]) . '_' . $pathinfo["filename"], 'prettyName'));
if (is_null($pretty_name)) {
$pretty_name = $pathinfo["filename"];
}
$ret[basename($pathinfo["dirname"])][$pathinfo["filename"]] = $pretty_name;
}
}
}
}
}
return $ret;
}
示例4: getAvailableModule
public function getAvailableModule()
{
$ret = array();
$files = glob(MODULES_DIR . '/*');
foreach ($files as $path) {
if (is_dir($path)) {
$files2 = glob($path . '/*');
foreach ($files2 as $file2) {
if (is_file($file2)) {
$pathinfo = pathinfo_filename($file2);
if (!isset($ret[basename($pathinfo["dirname"])])) {
$ret[basename($pathinfo["dirname"])] = array();
}
if (array_key_exists('extension', $pathinfo) && $pathinfo['extension'] == 'php') {
$ret[basename($pathinfo["dirname"])][] = $pathinfo["filename"];
}
}
}
}
}
return $ret;
}
示例5: antixss
if (check_nonce($nonce, "set", "plugins.php")) {
$plugin = antixss($pluginid);
change_plugin($pluginid);
redirect('plugins.php');
}
}
// Variable settings
login_cookie_check();
$counter = 0;
$table = null;
$pluginfiles = getFiles(GSPLUGINPATH);
sort($pluginfiles);
$needsupdate = false;
foreach ($pluginfiles as $fi) {
$pathExt = pathinfo($fi, PATHINFO_EXTENSION);
$pathName = pathinfo_filename($fi);
$setNonce = '&nonce=' . get_nonce("set", "plugins.php");
if ($pathExt == "php") {
if ($live_plugins[$fi] == 'true') {
$cls_Enabled = 'hidden';
$cls_Disabled = '';
$trclass = 'enabled';
} else {
$cls_Enabled = '';
$cls_Disabled = 'hidden';
$trclass = 'disabled';
}
$api_data = json_decode(get_api_details('plugin', $fi));
$updatelink = null;
if (is_object($api_data) && $api_data->status == 'successful') {
if ($api_data->version > $plugin_info[$pathName]['version']) {
示例6: add_filter
/**
* Add Filter
*
* @since 2.0
* @uses $filters
* @uses $live_plugins
*
* @param string $id Id of current page
* @param string $txt Text to add to tabbed link
*/
function add_filter($filter_name, $added_function)
{
global $filters;
global $live_plugins;
$bt = debug_backtrace();
$caller = array_shift($bt);
$pathName = pathinfo_filename($caller['file']);
$filters[] = array('filter' => $filter_name, 'function' => $added_function);
}
示例7: foreach
foreach ($a as $k => $v) {
$v = str_replace($delimiter . $delimiter, $delimiter . ' ' . $delimiter, $v);
// Patch perso sinon les colonnes vides disparaissent
if (preg_match("/^{$delimiter}/", $v) || preg_match("/{$delimiter}\$/", $v)) {
$a[$k] = trim($v, $delimiter);
$a[$k] = preg_replace("/{$delimiter}/", "{$token}", $a[$k]);
}
}
$a = explode($token, implode($token, $a));
return (array) preg_replace(array("/^\\s/", "/\\s\$/", "/{$token2}/"), array('', '', $enclosure), $a);
}
}
// ============================================================================
// Constante SACoche - Atteste l'appel de ce fichier avant inclusion d'une autre page & permet de connaître le nom du script initial.
// ============================================================================
define('SACoche', pathinfo_filename($_SERVER['SCRIPT_NAME']));
if (SACoche == '_loader') {
exit('Ce fichier ne peut être appelé directement !');
}
// ============================================================================
// Config PHP - Versions PHP & MySQL - Modules PHP
// ============================================================================
// CHARSET : "iso-8859-1" ou "utf-8" suivant l'encodage utilisé
// Dès maintenant car utilisé par exit_error().
// Tous les fichiers étant en UTF-8, et le code prévu pour manipuler des données en UTF-8, changer le CHARSET serait assez hasardeux pour ne pas dire risqué...
define('CHARSET', 'utf-8');
define('NL', PHP_EOL);
// Version PHP & MySQL requises et conseillées
// Attention : ne pas mettre de ".0" (par exemple "5.0") car version_compare() considère que 5 < 5.0 (@see http://fr.php.net/version_compare)
define('PHP_VERSION_MINI_REQUISE', '5.1');
define('PHP_VERSION_MINI_CONSEILLEE', '5.4');
示例8: add_action
/**
* add_action($hook_name, $added_function, $args = array())
* Used for plugins (not used right now)
*/
function add_action($hook_name, $added_function, $args = array())
{
global $plugins;
$bt = debug_backtrace();
$shift = count($bt) - 4;
// plugin name should be
$caller = array_shift($bt);
$realPathName = pathinfo_filename($caller['file']);
$realLineNumber = $caller['line'];
while ($shift > 0) {
$caller = array_shift($bt);
$shift--;
}
$pathName = pathinfo_filename($caller['file']);
$plugins[] = array('hook' => $hook_name, 'function' => $added_function, 'args' => (array) $args, 'file' => $pathName . '.php', 'line' => $caller['line']);
}
示例9: showPluginsDownload
public function showPluginsDownload()
{
?>
<h3 class="floated">Bővítmény letöltése</h3>
<div class="edit-nav clearfix" style="">
<a href="load.php?id=extend-download&extend_type=plugins&download&download_id=10&refresh">Update Plugin Downloader</a>
</div>
<div class="plugin_padding" style="padding:10px 0px;">
<table class="highlight">
<?php
$extendData = getXML(GSDATAOTHERPATH . 'extend-download.xml');
global $plugin_info;
foreach ($extendData->plugins->plugin as $extendItem) {
$plugin_installed = 'Nem';
$plugin_version = '';
$download_confirmation = '<a href="load.php?id=extend-download&extend_type=plugins&download&download_id=' . $extendItem->id . '">Letöltés</a>';
if ($this->pluginInstalledCheck($extendItem->filename_id) == true) {
$needsupdate = false;
$fi = $extendItem->filename_id;
$pathName = pathinfo_filename($fi);
$plugin_installed = 'Igen';
$plugin_version = '<span class="extend_spec_label">Telepített verzió: </span>' . $plugin_info[$pathName]['version'];
$download_confirmation = '<a href="#" onclick="decision(\'Are You Sure You Want To Update ' . $extendItem->name . '?\',\'load.php?id=extend-download&extend_type=plugins&download&download_id=' . $extendItem->id . '\')">Frissítés</a>';
}
?>
<tr>
<td>
<h3 style="margin-bottom:10px;"><?php
echo $extendItem->name;
?>
<?php
echo $download_confirmation;
?>
</h3>
<div class="extend_specs_left">
<span class="extend_spec_label">Verzió: </span><?php
echo $extendItem->version;
?>
<br/>
<span class="extend_spec_label">Frissítve: </span><?php
echo $extendItem->updated_date;
?>
<br/>
<span class="extend_spec_label"><a href="<?php
echo $extendItem->support_url;
?>
" target="_blank">Support URL</span><br/>
<span class="extend_spec_label"><a href="<?php
echo $extendItem->author_url;
?>
" target="_blank">Author URL</a></span>
</div>
<div class="extend_specs_right">
<span class="extend_spec_label">Minimum verzió: </span><?php
echo $extendItem->tested_earliest;
?>
<br/>
<span class="extend_spec_label">Tesztelt verzió: </span><?php
echo $extendItem->tested_latest;
?>
<br/>
<span class="extend_spec_label">Telepített plugin?: </span> <?php
echo $plugin_installed;
?>
<br/>
<?php
echo $plugin_version;
?>
</div>
<div style="clear:both;"></div>
<div style="width:620px;">
<?php
echo Markdown(stripslashes(html_entity_decode($extendItem->description)));
?>
</div>
</td>
</tr>
<?php
}
?>
</table>
</div>
<?php
}
示例10: getLabelsFromFilenames
/**
* Generates a labels file from a directory listing.
*/
public function getLabelsFromFilenames($imagedirectory)
{
$files = scandir($imagedirectory);
if ($files === false) {
return array();
}
$files = array_filter($files, 'is_regular_file');
// list files inside the specified path but omit hidden files
$labels = array();
foreach ($files as $file) {
$extension = pathinfo($file, PATHINFO_EXTENSION);
switch ($extension) {
case 'jpg':
case 'jpeg':
case 'JPG':
case 'JPEG':
case 'gif':
case 'GIF':
case 'png':
case 'PNG':
$labels[] = new SIGPlusImageLabel($file, pathinfo_filename($file));
}
}
return $labels;
}
示例11: fetch_cleaner_data
/**
* Compile the cleaner data
* @param database_cleaner_data The database cleaner data object
* @param String The version
*/
function fetch_cleaner_data(&$data, $phpbb_version)
{
global $config;
// Fetch all the files
if (!function_exists('filelist')) {
include PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT;
}
$filelist = array_shift(filelist(STK_ROOT_PATH . 'includes/database_cleaner/', 'data/', PHP_EXT));
sort($filelist);
// Add the data
foreach ($filelist as $file) {
$version = pathinfo_filename($file);
$class = 'datafile_' . $version;
if (!class_exists($class)) {
include STK_ROOT_PATH . "includes/database_cleaner/data/{$version}." . PHP_EXT;
}
$_datafile = new $class();
// Set the data
$data->bots = array_merge($data->bots, $_datafile->bots);
$data->config = array_merge($data->config, $_datafile->config);
$data->acl_options = array_merge($data->acl_options, $_datafile->acl_options);
$data->acl_roles = array_merge($data->acl_roles, $_datafile->acl_roles);
$data->acl_role_data = array_merge_recursive($data->acl_role_data, $_datafile->acl_role_data);
$data->extension_groups = array_merge($data->extension_groups, $_datafile->extension_groups);
$data->extensions = array_merge($data->extensions, $_datafile->extensions);
$data->module_categories = array_merge($data->module_categories, $_datafile->module_categories);
$data->module_extras = array_merge($data->module_extras, $_datafile->module_extras);
$data->groups = array_merge($data->groups, $_datafile->groups);
$data->removed_config = array_merge($data->removed_config, $_datafile->removed_config);
$data->report_reasons = array_merge($data->report_reasons, $_datafile->report_reasons);
$_datafile->get_schema_struct($data->schema_data);
// Just make sure that nothing sticks
unset($_datafile);
// Break after our version
if (version_compare($version, $phpbb_version, 'eq')) {
break;
}
}
// Perform some actions that only have to be done on given versions or on all
switch ($phpbb_version) {
case '3_0_9':
case '3_0_8':
case '3_0_7_pl1':
case '3_0_7':
case '3_0_6':
// If $config['questionnaire_unique_id] exists add it to the config data array
if (isset($config['questionnaire_unique_id'])) {
$data->config['questionnaire_unique_id'] = array('config_value' => $config['questionnaire_unique_id'], 'is_dynamic' => '0');
}
// Need to force do some ordering on $module_extras
$extra_add = array('ACP_FORUM_PERMISSIONS_COPY');
array_splice($data->module_extras['acp']['ACP_FORUM_BASED_PERMISSIONS'], 1, 0, $extra_add);
// No Break
// No Break
case '3_0_5':
case '3_0_4':
case '3_0_3':
case '3_0_2':
case '3_0_1':
case '3_0_0':
$data->config['version'] = $phpbb_version;
// We always need to set the version afterwards
break;
}
// Call init
$data->init();
}
示例12: basename
/*
Plugin Name: Page Edit Options
Description: Adds extra options to the Pages Overview
Version: 1.1
Author: Mike Swan
Author URI: http://www.digimute.com/
*/
# get correct id for plugin
$thisfile = basename(__FILE__, ".php");
# register plugin
register_plugin($thisfile, 'Page Edit Options', '1.4', 'Mike Swan', 'http://www.digimute.com/', 'Adds extra options to the Page View Screen', 'plugins', '');
# activate hooks
$bt = debug_backtrace();
$shift = count($bt) - 1;
if (pathinfo_filename($bt[$shift]['file']) == "pages") {
add_action('footer', 'DM_PE_addPageOptions', array());
register_style('DM_Pageedit', $SITEURL . "plugins/DM_PE_Pageedit/style.css", '1.1', 'screen', FALSE);
queue_style('DM_Pageedit', GSBACK);
}
function DM_PE_addPageOptions()
{
$delNonce = get_nonce("delete", "deletefile.php");
$cloneNonce = get_nonce("clone", "pages.php");
$menu = "<tr><th>Pages</th><th>Date</th><th>Options</th></tr>";
$menu .= DM_PE_getPages('', '', 0);
echo '<script type="text/javascript">
$("#editpages tr").each(function() {
$(this).remove();
})
$(".hover").hover(
示例13: add_filter
/**
* Add Filter
*
* @since 2.0
* @uses $filters
* @uses $live_plugins
*
* @param string $id Id of current page
* @param string $txt Text to add to tabbed link
*/
function add_filter($filter_name, $added_function, $args = array())
{
global $filters;
$bt = debug_backtrace();
$caller = array_shift($bt);
$pathName = pathinfo_filename($caller['file']);
$filters[] = array('filter' => $filter_name, 'function' => $added_function, 'active' => false, 'args' => (array) $args);
}
示例14: addPlugindebugging
/**
* adds plugin debugging info to plugin action arrays
* add caller file and line #, normalizes to plugin origin file
*/
function addPlugindebugging(&$array)
{
global $live_plugins;
if (!(getDef('GSDEBUGHOOKS') || isDebug())) {
return;
}
$skip = 1;
// levels to this function, from add_action/add_filter
$shift = 3;
// levels to plugin include, from common.php
$_bt = debug_backtrace();
$bt = array_slice($_bt, $skip, count($_bt) - $shift);
$caller = array_pop($bt);
// last bactrace is the originator plugin file
// if we ever load plugins some other way or chained, then we will have to use a loop to find it
$pathName = pathinfo_filename($caller['file']);
$lineNumber = $caller['line'];
$array['file'] = $pathName . '.php';
$array['line'] = $lineNumber;
$array['core'] = !isset($live_plugins[$array['file']]);
}
示例15: login_cookie_check
* All Plugins
*
* Displays all installed plugins
*
* @package GetSimple
* @subpackage Plugins
*/
// Setup inclusions
$load['plugin'] = true;
// Include common.php
include 'inc/common.php';
login_cookie_check();
$pluginid = isset($_GET['set']) ? $_GET['set'] : null;
$nonce = isset($_GET['nonce']) ? $_GET['nonce'] : null;
if ($pluginid) {
if (check_nonce($nonce, "set_" . pathinfo_filename($pluginid), "plugins.php")) {
$plugin = antixss($pluginid);
change_plugin($plugin);
redirect('plugins.php?success=' . i18n_r('PLUGIN_UPDATED'));
} else {
redirect('plugins.php?error=' . i18n_r('ERROR_OCCURED'));
}
}
// Variable settings
$counter = 0;
$table = '';
$needsupdate = false;
$plugin_info_sorted = subval_sort($plugin_info, 'name');
foreach ($plugin_info_sorted as $pluginid => $plugininfo) {
$setNonce = '&nonce=' . get_nonce("set_" . $pluginid, "plugins.php");
// @todo disabled plugins have a version of (str) 'disabled', should be 0 or null