*
* Copyright 2005, Fabio Bertagnin
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
require_once $gfcommon.'docman/engine/parser_text.inc.php';
if ($argc != 2) {
- echo "Usage : parser_doc.php <filename>\n";
+ echo 'Usage : parser_doc.php <filename>'."\n";
exit (1);
}
if (!is_file($fichin))
exit (1);
-$fichout = tempnam(forge_get_config('data_path'), "tmp");
-$cmd = "/usr/bin/antiword -i1 -t $fichin > $fichout";
+$fichout = tempnam(forge_get_config('data_path'), 'tmp');
+$cmd = '/usr/bin/antiword -i1 -t '.$fichin.' > '.$fichout;
$res = shell_exec($cmd);
echo parser_text($fichout);
// mode: php
// c-file-style: "bsd"
// End:
-
-?>
require_once $gfcommon.'docman/engine/parser_text.inc.php';
if ($argc != 2) {
- echo "Usage : parser_oo.php <filename>\n";
+ echo 'Usage : parser_oo.php <filename>'."\n";
exit(1);
}
$zip = new ZipArchive;
if ($zip->open($fichin) === TRUE) {
- $output_dir = tempnam(forge_get_config('data_path'), "tmp");
+ $output_dir = tempnam(forge_get_config('data_path'), 'tmp');
unlink($output_dir);
mkdir($output_dir);
$zip->extractTo($output_dir, array('content.xml'));
// transformer le context.xml en fichier txt
$regexp_oo = "sed -e 's/<[^>]*>//g;s/</</g;s/>/>/g;s/'/'\"'\"'/g;s/"/\"/g;s/&/\&/g'";
-$cmd = $regexp_oo." ".$output_dir."/content.xml > ".$output_dir."/content.xml.txt";
+$cmd = $regexp_oo.' '.$output_dir.'/content.xml > '.$output_dir.'/content.xml.txt';
$res = shell_exec($cmd);
echo parser_text($output_dir.'/content.xml.txt');
// mode: php
// c-file-style: "bsd"
// End:
-
-?>
*
* Copyright 2005, Fabio Bertagnin
* Copyright 2009-2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
if ($argc != 2) {
- echo "Usage : parser_pdf.php <filename>\n";
+ echo 'Usage : parser_pdf.php <filename>'."\n";
exit (1);
}
if (!is_file($fichin))
exit (1);
-$fichout = tempnam(forge_get_config('data_path'),"tmp");
-$cmd = "/usr/bin/pdftotext $fichin $fichout";
+$fichout = tempnam(forge_get_config('data_path'),'tmp');
+$cmd = '/usr/bin/pdftotext '.$fichin.' '.$fichout;
$res = shell_exec($cmd);
echo parser_text($fichout);
// mode: php
// c-file-style: "bsd"
// End:
-
-?>
* Copyright 2005, Fabio Bertagnin
* Copyright 2011, Franck Villaume - Capgemini
* Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
function parser_text($fichin) {
if (!is_file($fichin))
- return "";
+ return '';
if (filesize($fichin) == 0)
- return "";
+ return '';
- $handle = fopen($fichin, "r");
+ $handle = fopen($fichin, 'r');
$buff = fread($handle, filesize($fichin));
// tout en minuscules
// élimination d'éventuels caractères unicode encore présents
if (function_exists('mb_convert_encoding')) {
- $buff = mb_convert_encoding($buff, "ascii");
+ $buff = mb_convert_encoding($buff, 'ascii');
}
// élimination caractères avec accents
// et caractères spéciaux
$buff = suppression_diacritics($buff);
// tous les mots dans un tableau
- $words = explode(" ", $buff);
+ $words = explode(' ', $buff);
// élimination des doublons
$words = array_unique($words);
// envoi du résultat sur stdout
}
function print_list($list) {
- $rep = "";
+ $rep = '';
foreach ($list as $el) {
- if (strlen($el) > 1) $rep .= "$el ";
+ if (strlen($el) > 1) $rep .= $el.' ';
}
return $rep;
}
return ((float)$usec + (float)$sec);
}
-function print_debug ($text) {
+function print_debug($text) {
echo "$text <br />\n";
ob_flush();
}
*
* Copyright 2005, Fabio Bertagnin
* Copyright 2009-2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
require_once $gfcommon.'docman/engine/parser_text.inc.php';
if ($argc != 2) {
- echo "Usage : parser_text.php <filename>\n";
+ echo 'Usage : parser_text.php <filename>'."\n";
exit(1);
}
// mode: php
// c-file-style: "bsd"
// End:
-
-?>