function leesBestand() { $regels = array(); if (isset($_FILES['file'])) { if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } elseif ($_FILES["file"]["type"] !== "text/plain") { echo "File must be a .txt"; } else { $regels = FILE($_FILES["file"]["tmp_name"]); } } return $regels; }
function voegBestandToe() { global $woordenzoeker; if (isset($_FILES['file'])) { if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } elseif ($_FILES["file"]["type"] !== "text/plain") { echo "Dit is geen .txt bestand."; } else { $woordenzoeker = FILE($_FILES["file"]["tmp_name"]); } } else { $woordenzoeker = file("woordzoekerniveau123.txt"); } return $woordenzoeker; $woordenzoeker = file("woordzoekerniveau123.txt"); }
/** * @param string Any filename and path of a given js-file * @return string Compressed/modified content of the js-file * */ public function optimize($aFileName) { $source = implode("", FILE($aFileName)); $temp = explode(".", $aFileName); $last = array_pop($temp); $new_file_name = implode(".", $temp) . "_opt." . $last; $pattern = array("*[\\/][\\/][\\{,\\},_,\\[,\\],#,\\(,\\),;,:, ,\\.,\\-,a-z,A-Z,0-9,!,?,\\',\",\r\n,\t]{0,}[\n|\r]*", "*[\t]{0,}*", "*[\n|\r]{2,}*", "*[\n][ ]{0,}*", "*[)][ ]{0,}[)]*", "*[ ]{0,}[(][ ]{0,}[(]*", "*[ ]{0,}([\\=|\\+|\\-|\\*|\\<|\\/|\\?|\\:])[ ]{1,}*", "*[ ]{0,}([(|)])*", "*[ ]{0,}([\\{|\\}])[ ]{0,}*", "*[\n|\r]{1,}*", "*[\\}][\n|\r][\\}]*", "*[\\}]{2}[\n|\r][\\}]*", "*[;][\n|\r]*"); $replace = array("", "", "\n", "\n", "))", "((", "\\1", "\\1", "\\1", "\n", "}}", "}}}", ";"); $source = preg_replace($pattern, $replace, $source); if (file_exists($new_file_name)) { unlink($new_file_name); } $fp = fopen($new_file_name, "w"); if ($fp) { fwrite($fp, $source, strlen($source)); fclose($fp); } return $source; }
function leesBestand() { $regels = array(); if (isset($_FILES['file'])) { if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } elseif ($_FILES["file"]["type"] !== "text/plain") { echo "File must be a .txt"; } else { $regels = FILE($_FILES["file"]["tmp_name"]); //pre(); //print_r($regels); // $file_handle = fopen($_FILES["file"]["name"], "rb"); } // $fp = fopen($_FILES['uploadFile']['tmp_name'], 'rb'); // while (($line = fgets($fp)) !== false) { // echo "$line<br>"; // } } return $regels; }
public function testHasCreatedBothArrays() { // simple, included code has $regels = FILE('./tests/data/t0.txt'); //$this->assertTrue(is_array($regels)); $gelezenInvoer = inlezen($regels); //print_r($gelezenInvoer); // check if arrays have been made $this->assertTrue(is_array($gelezenInvoer)); // eerste laadje moet ook een array zijn $this->assertTrue(is_array($gelezenInvoer[0])); // ik verwacht 2 laadjes $this->assertEquals(2, count($gelezenInvoer)); // 2e laadje (bestaat volgend bovenste test) moet ook een array zijn $this->assertTrue(is_array($gelezenInvoer[1])); //$this->assertTrue(isset($wz)); //$this->assertTrue(isset($woorden)); $wz = $gelezenInvoer[0]; $woorden = $gelezenInvoer[1]; $this->assertEquals(2, count($wz), '2 regels woordzoeker'); $this->assertEquals(1, count($woorden), '1 woord te vinden'); $this->assertEquals(array(str_split('-ab--'), str_split('-----')), $wz); $this->assertEquals("ab", $woorden[0]); }
/* _ _ _____ _____ _ | | | | / ____| __ \ | | | | | |_ __ | | __| |__) |__ _ _ __ | | __ | | | | '_ \| | |_ | _ // _` | '_ \| |/ / | |__| | |_) | |__| | | \ \ (_| | | | | < \____/| .__/ \_____|_| \_\__,_|_| |_|_|\_\ | | Hadi Abedzadeh |_| */ echo "\n\n _ _ _____ _____ _ \n | | | | / ____| __ \\ | | \n | | | |_ __ | | __| |__) |__ _ _ __ | | __\n | | | | '_ \\| | |_ | _ // _` | '_ \\| |/ /\n | |__| | |_) | |__| | | \\ \\ (_| | | | | < \n \\____/| .__/ \\_____|_| \\_\\__,_|_| |_|_|\\_\\\n | | Hadi Abedzadeh \n |_| \n +-------------------------------------------------------------------+\n\n"; set_time_limit(0); if (isset($argv[1], $argv[2], $argv[3])) { $proxies = array(); $proxies = FILE($argv[3]); for ($x = 1; $x = -1; $x++) { if (isset($proxies)) { $proxy = $proxies[array_rand($proxies)]; } $ch = curl_init(); if (isset($proxy)) { curl_setopt($ch, CURLOPT_PROXY, $proxy); } curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_URL, "https://www.google.com/search?q=" . $argv[1] . "+" . $argv[2]); $results = curl_exec($ch); curl_close($ch);
/** * Gibt die Anzahl der Zeilen zur�ck * @return int count */ public function getLinesCount() { $lines = COUNT(FILE($this->path)); return $lines; }
<?php require 'autoload.php'; if (count($argv) == 2) { $fileName = $argv[1]; } else { $fileName = dirname(__FILE__) . '/test-data/data.txt'; } $instructions = FILE($fileName); $processor = new \CNCalculator\Processor(); echo $processor->process($instructions); echo "\n"; exit(0);
function process_tags($title, $aid) { global $conn; $title_array = explode(" ", strtolower($title)); $words = FILE("useless_words.txt"); $real_tags = array_diff($title_array, $words); //$obj = new I18N_Arabic_WordTag(); // echo($title . '<br />'); // echo($aid . '<br />'); //pr($real_tags); // exit; $tag_count = 0; foreach ($real_tags as $tag) { $tag = trim($tag); $tag = strtolower($tag); $tag_count++; if ($tag_count == 15) { break; } //$taggedText = $obj->tagText($tag); //echo('<br />verb:<br />'); pr($taggedText); /* $word = ''; $tag_type = ''; if (is_array($taggedText[0])) { list($word, $tag_type) = $taggedText[0]; } */ // echo('$word: ' . $word . '<br />'); // echo('$tag_type: ' . $tag_type . '<br /><br />'); $tag = str_replace("#", "", $tag); $tag = str_replace(":", "", $tag); $tag = str_replace(",", "", $tag); $tag = str_replace(".", "", $tag); $tag = str_replace(";", "", $tag); $tag = str_replace(">", "", $tag); $tag = str_replace("<", "", $tag); $tag = str_replace('"', "", $tag); $tag = str_replace("'", "", $tag); $tag = str_replace("،", "", $tag); $tag = str_replace("~", "", $tag); $tag = str_replace("`", "", $tag); $tag = str_replace("(", "", $tag); $tag = str_replace(")", "", $tag); $tag = str_replace("»", "", $tag); $tag = str_replace("«", "", $tag); $tag = preg_replace("/[a-zA-Z0-9]+/", '', $tag); $tag_encoding = mb_detect_encoding($tag); //if ($tag_encoding != "" && $tag_encoding == 'UTF-8' && !is_numeric($tag) && (mb_strlen($tag, "UTF-8") > 2) /*&& ($tag_type == 1)*/) { //just arabic and not number and tag length > 2 and it's noun if ($tag_encoding != "" && $tag_encoding == 'UTF-8' && !is_numeric($tag) && mb_strlen($tag, "UTF-8") > 2) { //just arabic and not number and tag length > 2 and it's noun $tag_id = check_if_tag_exists($tag); // pr($tag_id); exit; if ($tag_id) { if ($tag_id != 0) { $aid_tid = check_if_article_assoc_for_such_tag($aid, $tag_id); if (!$aid_tid) { $tag_query = "insert into article_tags (aid, tid) value ('{$aid}', '" . $tag_id . "')"; echo '<br />$tag_query1: ' . $tag_query . '<br />'; $res = $conn->db_query($tag_query); } } } else { if ($tag != "") { // $new_tag_id = insert_new_tag($tag, 1); // update_parent($new_tag_id); } /*if ($new_tag_id != 0) { $tag_query = "insert into article_tags (aid, tid) value ('$aid', '$new_tag_id')"; echo('<br />$tag_query2: ' . $tag_query . '<br />'); $res = $conn->db_query($tag_query); } */ } } } }
text-align: #003366; left: 65px; } </style> </head> <body> </br> </br> <h3> De woordzoeker </h3> <?php session_start(); include 'Functies.php'; include 'Tabel.php'; $m = FILE($_FILES['userfile']['tmp_name']); $lvl = $_GET['niveau']; $rij = array(); $x = 0; foreach ($m as $q) { $q = trim($q); if (strlen($q) == 0) { break; } $l = strlen($q); $wz[$x] = $q; $x++; } $len = strlen($wz[0]); $c = 0; $woorden = array();
<?php include 'Level1.php'; include 'Level2.php'; include 'Level3.php'; include 'Level3_reverse.php'; include 'Level4.php'; include 'Level4_reverse.php'; include 'Letter.php'; include 'FoundWord.php'; $ruweregels = FILE($_FILES['puzzel']['tmp_name']); $level = $_POST['PuzzleLevel']; $endOfPuzzle = false; $r = 1; foreach ($ruweregels as $regel) { $regel = trim($regel); if ($regel == "") { $endOfPuzzle = true; } if ($endOfPuzzle == false) { if ($regel != "") { $wz = str_split($regel); // opsplitsen van de letters $c = 1; foreach ($wz as $char) { $wzArray[$r][$c] = $char; if ($char != "-") { $letter = new Letter(); // letter object aanmaken // eigenschappen van de letter: row, column, letter zelf $letter->row = $r;