示例#1
0
function fileSmash($aryFiles)
{
    $aryReturnTypes = array();
    // instantiate the return ary
    foreach ($aryFiles as $key => $value) {
        // loop the ary of files passed
        /*
        		if(!strpos($value, $_SERVER['DOCUMENT_ROOT'])){			// detect if a doc root was provided
        			$value = $_SERVER['DOCUMENT_ROOT']. "/" .$value;	// attach doc root making the path
        		}
        */
        $fileData = cleanWhiteSpace(file_get_contents($value));
        // get the contents of the targeted file + strip whitespace
        $tmpAry = explode(".", $value);
        // explode path
        $ext = strtolower($tmpAry[count($tmpAry) - 1]);
        // determin extention of file. force to lowercase to avoid issues with Capitalization diffrences.
        if (!array_key_exists($ext, $aryReturnTypes)) {
            // check to see if the extention has already been hit in this loop
            $aryReturnTypes[$ext] = "";
            // instantiate the var
        }
        $aryReturnTypes[$ext] .= $fileData;
        // append the contents of the file to the already provided data
    }
    return $aryReturnTypes;
}
 function textile($text, $lite = '')
 {
     if (get_magic_quotes_gpc() == 1) {
         $text = stripslashes($text);
     }
     $text = incomingEntities($text);
     $text = encodeEntities($text);
     $text = fixEntities($text);
     $text = cleanWhiteSpace($text);
     $text = getRefs($text);
     $text = noTextile($text);
     $text = image($text);
     $text = links($text);
     $text = span($text);
     $text = superscript($text);
     $text = footnoteRef($text);
     $text = code($text);
     $text = glyphs($text);
     $text = retrieve($text);
     if ($lite == '') {
         $text = lists($text);
         $text = table($text);
         $text = block($text);
     }
     /* clean up <notextile> */
     $text = preg_replace('/<\\/?notextile>/', "", $text);
     /* turn the temp char back to an ampersand entity */
     $text = str_replace("x%x%", "&amp;", $text);
     $text = str_replace("<br />", "<br />\n", $text);
     return trim($text);
 }
示例#3
0
function block($text)
{
    $text = preg_replace("/&(?![#a-z0-9]+;)/i", "x%x%", $text);
    $text = str_replace("x%x%", "&#38;", $text);
    $text = cleanWhiteSpace($text);
    $that = array();
    $that = explode("\n\n", $text);
    foreach ($that as $key => $value) {
        $value = cleaningOutput($value);
        $value = glyphs($value);
        // to make it work with 'plug:'
        //if (preg_match("/<(h[12345]|code.*|h[12345].*|p.*|style.*|div.*|\/div)>/i", $value))
        if (preg_match("/<(h[12345]|code.*|h[12345].*|p|style.*|div.*|\\/div)>/i", $value)) {
            $s[] = $value;
        } else {
            $s[] = '<p>' . $value . '</p>';
        }
    }
    $out = implode("\n\n", $s);
    return $out;
}