'));
$definition[$z] = string_ends_with($definition[$z], ".") ? strtolower(rtrim($definition[$z], ".")) :
strtolower($definition[$z]);
}
elseif (search_string('
', $node)) {
$format = str_replace($tags, "", $node);
$format = str_replace($n1, $n2, $format);
$format = strpos($format, ".(") ? str_replace(".(", " (", $format) : $format;
$definition[$z] = string_ends_with($format, ".") ? $word . " - " . strtolower(rtrim($format, ".")) : $word . " - "
. strtolower($format);
}
$node = $explode[1];
if (strpos($definition[$z], ":")) {
$format = explode(":", $definition[$z], 2);
$definition[$z] = trim($format[0]);
}
$html = $node;
$pseg--;
$z++;
}
}
else {
if (search_string('
', $html)) {
$definition[$z] = $word . " - " . trim(get_string_between($html, '
', '')) . " " . trim(get_string_between($html,
'
', '
'));
$definition[$z] = string_ends_with($definition[$z], ".") ? strtolower(rtrim($definition[$z], ".")) :
strtolower($definition[$z]);
}
elseif (search_string('
', $html)) {
$format = str_replace($tags, "", $html);
$format = str_replace($n1, $n2, $format);
$format = strpos($format, ".(") ? str_replace(".(", " (", $format) : $format;
$definition[$z] = string_ends_with($format, ".") ? $word . " - " . strtolower(rtrim($format, ".")) : $word . " - " .
strtolower($format);
}
if (strpos($definition[$z], ":")) {
$format = explode(":", $definition[$z], 2);
$definition[$z] = trim($format[0]);
}
}
}
else {
echo "\n[ ERROR ] Unable to retrieve word.\n";
return FALSE;
}
}
return $definition;
}
function itemize($string, $full = TRUE) {
if ($full == TRUE) {
if (strpos($string, ".")) {
$exp1 = explode("-", $string, 2);
$exp2 = explode(".", $exp1[1], 2);
$word = trim($exp1[0]);
$type = trim($exp2[0]);
$definition = trim($exp2[1]);
return array($word, $type, $definition);
}
}
else {
if (strpos($string, "-")) {
$exp1 = explode("-", $string, 2);
$word = trim($exp1[0]);
}
else {
$word = trim($string);
}
return $word;
}
return FALSE;
}
function search_file($needle, $haystack, $return = FALSE) {
$contents = file_get_contents($haystack);
$pattern = preg_quote($needle, '/');
$pattern = "/^.*$pattern.*\$/m";
if (preg_match_all($pattern, $contents, $matches)) {
if ($return == TRUE) {
return $matches;
}
return TRUE;
}
return FALSE;
}
function search_string($needle, $haystack) {
if (preg_match_all("/$needle/im", $haystack) || strpos($haystack, $needle)) {
return TRUE;
}
return FALSE;
}
function get_string_between($string, $start, $end) {
$string = ' ' . $string;
$ini = strpos($string, $start);
if ($ini == 0) {
return '';
}
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}
function string_ends_with($haystack, $needle, $case = TRUE) {
$expected_position = strlen($haystack) - strlen($needle);
if ($case) {
return strrpos($haystack, $needle, 0) === $expected_position;
}
return strripos($haystack, $needle, 0) === $expected_position;
}
function vcab_configure() {
global $main, $file;
if (file_exists($main . ".vcabrc")) {
$config = fopen($main . ".vcabrc", "w");
}
echo "\n\n\t[ vcab Configuration Module ]\n";
echo "\n\t\t \n";
echo "\n\t\t1) Vocabulary file: $file\n";
echo "\n\t\t2) Load config file automatically: no\n";
echo "\n\t\t3) \n";
echo "\n\t\t4) \n";
echo "\n\t\t5) \n";
echo "\n\t\t6) \n";
echo "\n\t\t7) \n";
echo "\n\t\t8) \n";
echo "\n\t\t9) \n";
}
?>