Tag Archive for extensions

Howto list all the file extension types in an SVN log dump

svn log -v > myrepo.log

perl -ne 'print qq{$1
} if m{^s+.*(.[^.s]w+)$}' myrepo.log | sort | uniq -c | sort -r

source

Remedial Javascript Functionalities

function typeOf(value) {
var s = typeof value;
if (s === 'object') {
if (value) {
if (value instanceof Array) {
s = 'array';
}
} else {
s = 'null';
}
}
return s;
}

String.prototype.supplant = function (o) {
return this.replace(/{([^{}]*)}/g,
function (a, b) {
var r = o[b];
return typeof r === 'string' || typeof r === 'number' ? r : a;
}
);
};

String.prototype.trim = function () {
return this.replace(/^s+|s+$/g, "");
};

source

Php Server module Report

<?php
/* set required extensions */
$my_required_extensions = array(
'gd',  //graphics library
'xml',  //xml
'mysql', //database
'curl',  //networking
'openssl', //site will need SSL
'pecl'  //pear
);
natcasesort($my_required_extensions);

//get loaded modules
$loaded_extensions = get_loaded_extensions();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo $source_article; ?> Example</title>
<meta name="description" value="<?php echo htmlentities($meta_description); ?>" />
<style type="text/css">
body  { font-size:12px; }
h2   { border-bottom:1px solid #ccc; font-weight:normal; font-size:18px; margin-bottom:5px; padding-bottom:2px; }
p   { line-height:20px; margin-top:0; }
.found  { background:lightgreen; padding:5px 10px; margin:0 0 10px 0; }
.miss  { background:pink; padding:5px 10px; margin:0 0 10px 0; }
.extra  { background:lightblue; padding:5px 10px; margin:0 0 10px 0; }
</style>
</head>
<body>

<h1><?php echo $_SERVER['HTTP_HOST']; ?></h1>

<h2>General Information</h2>
<p>
<strong>Server Software:</strong>  <?php echo $_SERVER['SERVER_SOFTWARE']; ?><br />
<strong>Document Root:</strong> <?php echo $_SERVER['DOCUMENT_ROOT']; ?><br />
<strong>PHP Version:</strong> <?php echo phpversion(); ?>
</p>

<h2>Extension Check</h2>
<?php
/* print out */
//analyze results
foreach($my_required_extensions as $ext)
{
if(in_array($ext,$loaded_extensions))
{
$matches[] = strtolower($ext);
}
else
{
$missings[] = strtolower($ext);
}
unset($loaded_extensions[$ext]);
}
//print out results
natcasesort($matches); natcasesort($missings); natcasesort($loaded_extensions);
foreach($matches as $match) { echo '<div class="found"><strong>',$match,'</strong> found!</div>'; }
foreach($missings as $miss) { echo '<div class="miss"><strong>',$miss,'</strong> missing!</div>'; }
foreach($loaded_extensions as $e) { if(!in_array($e,$matches) && !in_array($e,$missings)) { echo '<div class="extra"><strong>',$e,'</strong> is available.</div>'; } }
?><br />

</body>
</html>

source

PHP File extension case changer

<?php
$root = $_GET['root'];
$files = array_merge(glob("$root*.*"),glob("$root**.*"),glob("$root***.*"));
$z=0;
for($i=0;$i<count($files);$i++) {
if(stripos($files[$i],"Thumbs.db")) {
unlink($files[$i]);
$z++;
}
else {
rename($files[$i],strtolower($files[$i]));
}
}
echo "$i files renamed. $z Thumbs.db files deleted.";
?>

source

Knowing a server php extensions

<?php
/* set required extensions */
$my_required_extensions = array(
'gd',  //graphics library
'xml',  //xml
'mysql', //database
'curl',  //networking
'openssl', //site will need SSL
'pecl'  //pear
);
natcasesort($my_required_extensions);

//get loaded modules
$loaded_extensions = get_loaded_extensions();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo $source_article; ?> Example</title>
<meta name="description" value="<?php echo htmlentities($meta_description); ?>" />
<style type="text/css">
body  { font-size:12px; }
h2   { border-bottom:1px solid #ccc; font-weight:normal; font-size:18px; margin-bottom:5px; padding-bottom:2px; }
p   { line-height:20px; margin-top:0; }
.found  { background:lightgreen; padding:5px 10px; margin:0 0 10px 0; }
.miss  { background:pink; padding:5px 10px; margin:0 0 10px 0; }
.extra  { background:lightblue; padding:5px 10px; margin:0 0 10px 0; }
</style>
</head>
<body>

<h1><?php echo $_SERVER['HTTP_HOST']; ?></h1>

<h2>General Information</h2>
<p>
<strong>Server Software:</strong>  <?php echo $_SERVER['SERVER_SOFTWARE']; ?><br />
<strong>Document Root:</strong> <?php echo $_SERVER['DOCUMENT_ROOT']; ?><br />
<strong>PHP Version:</strong> <?php echo phpversion(); ?>
</p>

<h2>Extension Check</h2>
<?php
/* print out */
//analyze results
foreach($my_required_extensions as $ext)
{
if(in_array($ext,$loaded_extensions))
{
$matches[] = strtolower($ext);
}
else
{
$missings[] = strtolower($ext);
}
unset($loaded_extensions[$ext]);
}
//print out results
natcasesort($matches); natcasesort($missings); natcasesort($loaded_extensions);
foreach($matches as $match) { echo '<div class="found"><strong>',$match,'</strong> found!</div>'; }
foreach($missings as $miss) { echo '<div class="miss"><strong>',$miss,'</strong> missing!</div>'; }
foreach($loaded_extensions as $e) { if(!in_array($e,$matches) && !in_array($e,$missings)) { echo '<div class="extra"><strong>',$e,'</strong> is available.</div>'; } }
?><br />

</body>
</html>

source