Esempio n. 1
0
function getstats($completed)
{
    foreach ($completed as $fname) {
        if (endsWith($fname, ".txt")) {
        }
    }
}
 /**
  * Gets the value of an environment variable. Supports boolean, empty and null.
  *
  * @param  string  $key
  * @param  mixed   $default
  * @return mixed
  */
 function env($key, $default = null)
 {
     $value = getenv($key);
     if ($value === false) {
         return value($default);
     }
     switch (strtolower($value)) {
         case 'true':
         case '(true)':
             return true;
         case 'false':
         case '(false)':
             return false;
         case 'empty':
         case '(empty)':
             return '';
         case 'null':
         case '(null)':
             return;
     }
     if (startsWith($value, '"') && endsWith($value, '"')) {
         return substr($value, 1, -1);
     }
     return $value;
 }
Esempio n. 3
0
function setup_database($new = false)
{
    global $MYSQL_SERVER;
    global $MYSQL_USER;
    global $MYSQL_PASSWORD;
    global $MYSQL_DATABASE;
    echo "= DATABASE SETUP =" . PHP_EOL . PHP_EOL;
    $conn = mysql_connect($MYSQL_SERVER, $MYSQL_USER, $MYSQL_PASSWORD);
    if ($new) {
        mysql_query("DROP DATABASE {$MYSQL_DATABASE}");
        echo "Database {$database} dropped." . PHP_EOL;
    }
    mysql_query("CREATE DATABASE IF NOT EXISTS {$MYSQL_DATABASE}") or die(mysql_error());
    echo "Database {$MYSQL_DATABASE} created." . PHP_EOL;
    mysql_select_db($MYSQL_DATABASE, $conn);
    mysql_set_charset("utf8");
    if ($new) {
        $dir = "database/";
        if (is_dir($dir)) {
            if ($handle = opendir($dir)) {
                while (false !== ($file = readdir($handle))) {
                    if (!is_dir($file) && !endsWith($file, "_inserts.sql")) {
                        create_table($file);
                    }
                }
            }
        }
        insert_languages();
        echo "Tables for {$MYSQL_DATABASE} created." . PHP_EOL;
    }
}
    public static function loadFiles($path)
    {
        if (endsWith($path, "dashboard")) {
            $css = "dashboard.wolf.css";
            if (Setting::get("theme") === "fox_theme") {
                $css = "dashboard.fox.css";
            } else {
                if (Setting::get("theme") === "wordpress-3.8") {
                    $css = "dashboard.wordpress.css";
                }
            }
            $file = PATH_PUBLIC . "wolf/plugins/dashboard/system/css/" . $css;
            ?>
<link rel="stylesheet" type="text/css" href="<?php 
            echo $file;
            ?>
" media="screen" /><?php 
            Observer::notify("dashboard_load_css");
            $file = PATH_PUBLIC . "wolf/plugins/dashboard/system/js/script.dashboard.js";
            ?>
<script type="text/javascript" language="javascript" src="<?php 
            echo $file;
            ?>
"></script><?php 
            Observer::notify("dashboard_load_js");
        }
    }
function percentToDecimal($percent)
{
    if (endsWith($percent, '%')) {
        return rtrim($percent, "%") / 100;
    }
    return $percent;
}
Esempio n. 6
0
 /**
  * 
  * @param string $template
  * @throws \InvalidArgumentException
  */
 public function setTemplatePath($template)
 {
     if (!endsWith($template, ".mustache")) {
         throw new \InvalidArgumentException("O arquivo de template do email deve ser do tipo .mustache");
     }
     $this->template = $template;
 }
Esempio n. 7
0
 function _identify($str)
 {
     $msg_identifier = "]8úü";
     $server_delivery_identifier = "Œ";
     $client_delivery_identifier = "½­";
     $acc_info_iden = "™½§”";
     $last_seen_ident = "H8úü";
     $last_seen_ident2 = "{½L‹";
     if (startsWith($str, $msg_identifier, 3)) {
         if (endsWith($str, $server_delivery_identifier)) {
             return 'server_delivery_report';
         } else {
             if (endsWith($str, $client_delivery_identifier)) {
                 return 'client_delivery_report';
             } else {
                 return 'msg';
             }
         }
     } else {
         if (startsWith($str, $acc_info_iden, 3)) {
             return 'account_info';
         } else {
             if (startsWith($str, $last_seen_ident, 3) && strpos($str, $last_seen_ident2)) {
                 return 'last_seen';
             }
         }
     }
 }
Esempio n. 8
0
 function __construct($password = NULL, $host = "127.0.0.1", $port = 10010)
 {
     $this->socket = stream_socket_client("udp://" . $host . ":" . $port, $errorno, $errorstr);
     if (!$this->socket) {
         die("Failed to connect, Error #{$errorno}: {$errorstr}");
     }
     fwrite($this->socket, Bencode::encode(array("q" => "ping")));
     // Try to ping it
     $returndata = fread($this->socket, $this->buffersize);
     if (!endsWith($returndata, "1:q4:ponge")) {
         die("{$returndata}");
     }
     $this->password = $password;
     $page = 0;
     while (True) {
         $request = array("q" => "Admin_availableFunctions", "args" => array("page" => $page));
         fwrite($this->socket, Bencode::encode($request));
         $result = Bencode::decode(fread($this->socket, $this->buffersize));
         foreach ($result['availableFunctions'] as $function => $description) {
             $this->functions[$function] = $description;
         }
         if (isset($result['more'])) {
             $page++;
         } else {
             break;
         }
     }
 }
Esempio n. 9
0
 function add_edge($_previous_as, $_as, $attrs = array())
 {
     global $edges, $graph;
     $edge_array = array($_previous_as => $_as);
     if (!array_key_exists(gek($_previous_as, $_as), $edges)) {
         $attrs['splines'] = "true";
         $edge = array($edge_array, $attrs);
         $graph->addEdge($edge_array, $attrs);
         $edges[gek($_previous_as, $_as)] = $edge;
     } else {
         if (array_key_exists('label', $attrs)) {
             $e =& $edges[gek($_previous_as, $_as)];
             $label_without_star = str_replace("*", "", $attrs['label']);
             $labels = explode("\r", $e[1]['label']);
             if (!in_array($label_without_star . "*", $labels)) {
                 $tmp_labels = array();
                 foreach ($labels as $l) {
                     if (!startsWith($l, $label_without_star)) {
                         $labels[] = $l;
                     }
                 }
                 $labels = array_merge(array($attrs['label']), $tmp_labels);
                 $cmp = function ($a, $b) {
                     return endsWith($a, "*") ? -1 : 1;
                 };
                 usort($labels, $cmp);
                 $label = escape(implode("\r", $labels));
                 $e[1]['label'] = $label;
             }
         }
     }
     return $edges[gek($_previous_as, $_as)];
 }
Esempio n. 10
0
function getFolderNameFromPath($path)
{
    if (endsWith("/", $path)) {
        $path = substr($path, 0, -1);
    }
    return substr($path, strrpos($path, "/") + 1);
}
 public function __construct(WebRequest $request)
 {
     parent::__construct($request);
     global $IP;
     if (strpos($this->mOid, '..') !== false) {
         throw new Exception('File path must not contain \'..\'.');
     }
     if (endsWith($this->mOid, '.js', false)) {
         $this->mContentType = AssetsManager::TYPE_JS;
     } else {
         if (endsWith($this->mOid, '.css', false)) {
             $this->mContentType = AssetsManager::TYPE_CSS;
         } else {
             throw new Exception('Requested file must be .css or .js.');
         }
     }
     $filePath = $IP . '/' . $this->mOid;
     if (file_exists($filePath)) {
         $this->mContent = file_get_contents($filePath);
     } else {
         $requestDetails = AssetsManager::getRequestDetails();
         Wikia::log(__METHOD__, false, "file '{$filePath}' doesn't exist ({$requestDetails})", true);
         throw new Exception('File does not exist');
     }
 }
function pugpig_validate_file($file, $mime)
{
    // CHECK UTF-8??
    if (!file_exists($file)) {
        return "No file";
    }
    if (FALSE) {
        return "File encoding is not UTF-8";
    }
    // Check XML
    if (strpos($mime, 'xml') !== FALSE || endsWith($file, '.xml')) {
        $f = file_get_contents($file);
        return check_xml_is_valid($f);
    }
    // Check JSON
    if (startsWith($mime, 'application/json') || endsWith($file, '.json')) {
        $f = file_get_contents($file);
        $json = json_decode($f);
        $err = json_last_error();
        if ($err == JSON_ERROR_NONE) {
            return "";
        }
        return "Error: {$err}";
    }
    // Check Manifests
    if (startsWith($mime, 'text/cache-manifest') || endsWith($file, '.manifest') || endsWith($file, '.appcache')) {
        $f = file_get_contents($file);
        if (!startsWith($f, "CACHE MANIFEST")) {
            return "Manifest did not start with CACHE Manifest. Instead got:\n{$f}";
        }
    }
    return "";
}
Esempio n. 13
0
 private function normalize($path)
 {
     if (!endsWith($path, '/')) {
         $path .= '/';
     }
     return $path;
 }
function validateHtmlTag($html)
{
    $result = array();
    $result[] = strpos($html, '<html>');
    $result[] = endsWith($html, '</html>');
    return $result;
}
Esempio n. 15
0
function showHeaders()
{
    ?>
    <html>
        <head>
            <meta charset="utf-8" /> 
            <?php 
    $m_data = new application\model\M_Data();
    //$array = $m_data->listFolderFiles("assets");
    $array = $m_data->directoryToArray("assets", true);
    foreach ($array as $key => $value) {
        if (endsWith($value, ".js")) {
            ?>
                    <script src="<?php 
            echo base_url($value);
            ?>
"></script>
                    <?php 
        } elseif (endsWith($value, ".css")) {
            ?>
                    <link href="<?php 
            echo base_url($value);
            ?>
" rel="stylesheet">
                    <?php 
        }
    }
    ?>
        </head>
        <body>
            <?php 
}
Esempio n. 16
0
 public function onPageRequest(PageRequestEvent $event)
 {
     global $config, $page;
     // hax.
     if ($page->mode == "page" && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) {
         $h_pagename = html_escape(implode('/', $event->args));
         $f_pagename = preg_replace("/[^a-z_\\-\\.]+/", "_", $h_pagename);
         $theme_name = $config->get_string("theme", "default");
         if (file_exists("themes/{$theme_name}/{$f_pagename}") || file_exists("lib/static/{$f_pagename}")) {
             $filename = file_exists("themes/{$theme_name}/{$f_pagename}") ? "themes/{$theme_name}/{$f_pagename}" : "lib/static/{$f_pagename}";
             $page->add_http_header("Cache-control: public, max-age=600");
             $page->add_http_header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 600) . ' GMT');
             $page->set_mode("data");
             $page->set_data(file_get_contents($filename));
             if (endsWith($filename, ".ico")) {
                 $page->set_type("image/x-icon");
             }
             if (endsWith($filename, ".png")) {
                 $page->set_type("image/png");
             }
             if (endsWith($filename, ".txt")) {
                 $page->set_type("text/plain");
             }
         } else {
             log_debug("handle_404", "Hit 404: {$h_pagename}");
             $page->set_code(404);
             $page->set_title("404");
             $page->set_heading("404 - No Handler Found");
             $page->add_block(new NavBlock());
             $page->add_block(new Block("Explanation", "No handler could be found for the page '{$h_pagename}'"));
         }
     }
 }
Esempio n. 17
0
function listFolderFiles($dir)
{
    $ffs = scandir($dir);
    global $main_dir, $content, $localized_strings;
    foreach ($ffs as $ff) {
        if ($ff != '.' && $ff != '..') {
            if (endsWith($ff, '.js')) {
                $file_content = file_get_contents($dir . DS . $ff);
                $matches = getStringsBetween($file_content, "lang(", ")");
                if (count($matches) > 0) {
                    for ($i = 0; $i < count($matches); $i++) {
                        $match = $matches[$i];
                        $match = trim($match);
                        $match = trim($match, "\"\\'");
                        $localized_strings[$match] = $match;
                        // $content .= "\"" . $match . "\" = \"" . $match . "\"\n";
                    }
                }
            }
            if (is_dir($dir . DS . $ff)) {
                listFolderFiles($dir . DS . $ff);
            }
        }
    }
}
Esempio n. 18
0
function processPluginsFolder($folder, $requiredMpsVersion, $pluginsVersion)
{
    $files = scandir($folder);
    foreach ($files as $zipfile) {
        if (pathinfo($zipfile, PATHINFO_EXTENSION) == 'zip') {
            $za = new ZipArchive();
            $za->open($folder . $zipfile);
            for ($i = 0; $i < $za->numFiles; $i++) {
                $stat = $za->statIndex($i);
                $pluginXmlFile = $stat['name'];
                if (endsWith($pluginXmlFile, "META-INF/plugin.xml")) {
                    $stream = $za->getStream($pluginXmlFile);
                    $content = stream_get_contents($stream);
                    $xml = simplexml_load_string($content);
                    if (fixPluginXml($xml, $requiredMpsVersion, $pluginsVersion)) {
                        $za->deleteName($pluginXmlFile);
                        $za->addFromString($pluginXmlFile, $xml->asXML());
                    }
                    printPluginXml($xml, $zipfile, $requiredMpsVersion, $pluginsVersion);
                    break;
                }
            }
        }
    }
}
 /**
  * Verifica se o valor não possui espaços vazios no início ou final
  * @param string $value
  * @return boolean
  */
 protected function validTrim($value)
 {
     if (startsWith($value, ' ') || endsWith($value, ' ')) {
         Factory::log()->warn('Valor possui espaços no início ou no final');
         return false;
     }
     return true;
 }
function koodimonni_mail_from($email)
{
    if (endsWith($email, '@localhost') || empty($email)) {
        $parsed = parse_url(get_site_url());
        $hostname = removeWWW($parsed['host']);
        return "no-reply@{$hostname}";
    }
}
 public function testMixedEncodingIsConvertedAndCoercedToUtf8()
 {
     $inputString = $this->testString;
     $inputString .= iconv("UTF-8", "ISO-8859-15", $this->testString);
     $outputString = $this->converter->convert($inputString);
     assertThat($outputString, endsWith($this->testString));
     assertThat(strlen($outputString), is(greaterThan(2 * strlen($this->testString))));
 }
Esempio n. 22
0
function checkIfImage($ref)
{
    if (!(endsWith($ref, ".png") || endsWith($ref, ".jpg"))) {
        return true;
    } else {
        return false;
    }
}
 private function handleDataSpace(&$data, $searchName)
 {
     //require  'Globals.php';
     require_once 'Globals.php';
     //echo "------Gobal".$this->enableCaching;
     //$newName = str_replace("%20cell", "", $searchName);
     //$newName = str_replace("%20neuron", "", $newName);
     $newName = $searchName;
     if (strcasecmp($searchName, "cell") == 0) {
         $newName = $searchName;
     } else {
         if (strcasecmp($searchName, "neuron") == 0) {
             $newName = $searchName;
         } else {
             if (endsWith($searchName, "%20cell")) {
                 $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20cell"));
                 $newName = $tempName;
             } else {
                 if (endsWith($searchName, "%20neuron")) {
                     $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20neuron"));
                     $newName = $tempName;
                 }
             }
         }
     }
     //echo "<p>----------------NewName:".$newName;
     $data['neuroElectroResult'] = searchWithinSource($newName, $neuroElectro, 20);
     $data['neuroMorphoResult'] = searchWithinSource($newName, $neuroMorpho, 20);
     $data['genSatResult'] = searchWithinSource($newName, $genSat, 20);
     $data['neuronDBResult'] = searchWithinSource($newName, $neuronDB, 20);
     $data['humanBrainResult'] = searchWithinSource($newName, $humanBrainAtlas, 20);
     $data['olfactoryMapResult'] = searchWithinSource($newName, $OlfactoryMap, 20);
     $data['abaMorphoResult'] = searchWithinSource($newName, $abaMorpho, 20);
     $data['abaCellResult'] = searchWithinSource($newName, $abaCell, 20);
     $data['brainMapResult'] = searchWithinSource($newName, $brainMap, 20);
     $data['connectivityResult'] = searchWithinSource($newName, $connectivity, 20);
     $data['humanBrainProjectResult'] = searchWithinSource($newName, $humanBrainProject, 20);
     //$data['neuroElectroDesc'] = getSourceDescObj($neuroElectro);
     //$data['neuroMorphoDesc'] = getSourceDescObj($neuroMorpho);
     //$data['genSatDesc'] = getSourceDescObj($genSat);
     //$data['neuronDBDesc'] = getSourceDescObj($neuronDB);
     /*
     $data['neuroMLResult'] = searchWithinSource("neocortex%20pyramidal%20cell", $neuroML, 20);
     $data['modelDBResult'] = searchWithinSource("neocortex%20pyramidal%20cell", $modelDB, 20);
     $data['brainModelResult'] = searchWithinSource("pyramidal%20cell", $brainModel, 20);	
     */
     /*$data['neuroMLResult'] = searchWithinSource($searchName, $neuroML, 20);
       $data['modelDBResult'] = searchWithinSource($searchName, $modelDB, 20);
       $data['brainModelResult'] = searchWithinSource($searchName, $brainModel, 20);*/
     $data['neuroMLResult'] = searchWithinSource($newName, $neuroML, 20);
     $data['modelDBResult'] = searchWithinSource($newName, $modelDB, 20);
     $data['brainModelResult'] = searchWithinSource($newName, $brainModel, 20);
     $data['cilResult'] = searchWithinSource($searchName, $CIL, 20);
     $data['cilImages'] = getImageArray($data['cilResult'], 20);
     $data['neuroMorphoImages'] = getImageArray($data['neuroMorphoResult'], 20);
     $data['originalCILImages'] = $data['cilImages'];
     $data['cilImages'] = array_merge($data['cilImages'], $data['neuroMorphoImages']);
 }
Esempio n. 24
0
 public function testStringFunctions()
 {
     $this->assertTrue(startsWith('abc', 'a'));
     $this->assertFalse(startsWith('abc', 'A'));
     $this->assertTrue(startsWith('abc', 'A', false));
     $this->assertTrue(endsWith('abc', 'c'));
     $this->assertFalse(endsWith('abc', 'C'));
     $this->assertTrue(endsWith('abc', 'C', false));
 }
Esempio n. 25
0
function render_syndrome_plus($dbc, $db_name, $id)
{
    $diseases = array();
    $values = array_merge(get_subjects($dbc, PREFIX . $id, "证候(调整)"));
    foreach ($values as $value) {
        if (array_key_exists($value, $diseases)) {
            $diseases[$value] = $diseases[$value] + 1;
        } else {
            $diseases[$value] = 1;
        }
    }
    arsort($diseases);
    if (count($diseases) != 0) {
        echo '<hr/>';
        echo '<p>证候治疗的加减变化:</p>';
        //$diseases = array_slice(array_keys($diseases), 0, 5);
        $diseases = array_keys($diseases);
        echo '<ol>';
        foreach ($diseases as $value) {
            //echo '<li class="list-group-item">';
            echo '<li>';
            $sp_links = array();
            $symptoms_plus = get_values($dbc, $value, '症状加(调整)');
            foreach ($symptoms_plus as $symptom_plus) {
                $sp_links[] = render_value($dbc, $db_name, $symptom_plus, false);
            }
            $title = '';
            if (count($sp_links) != 0) {
                $title .= '兼有' . implode(',&nbsp;', $sp_links);
            }
            $sm_links = array();
            $symptoms_minuses = get_values($dbc, $value, '症状减(调整)');
            foreach ($symptoms_minuses as $symptoms_minus) {
                $sm_links[] = render_value($dbc, $db_name, $symptoms_minus, false);
            }
            if (count($sm_links) != 0) {
                if ($title != '') {
                    $title .= ',&nbsp;';
                }
                $title .= '无' . implode(',&nbsp;', $sm_links);
            }
            if ($title == '') {
                $title = render_value($dbc, $db_name, $value, false);
            }
            echo $title;
            if (!endsWith($title, '者')) {
                echo '者';
            }
            echo ':&nbsp;';
            render_solution($dbc, $db_name, $value);
            //echo render_value($dbc, $db_name, $value, true);
            echo '&nbsp;<a class="btn btn-xs btn-primary" href="qa.php?db_name=' . $db_name . '&keywords=' . get_entity_name($dbc, $value) . '&question_type=证候加减" ><span class="glyphicon glyphicon-search"></span></a>';
            echo '<p/></li>';
        }
        echo '</ol>';
    }
}
Esempio n. 26
0
function readDirIntoArray($folder, $endsFilter, &$arr)
{
    $handle = opendir($folder);
    while (false !== ($entry = readdir($handle))) {
        if (endsWith($entry, $endsFilter)) {
            $arr[] = $entry;
        }
    }
}
Esempio n. 27
0
function ocsp_verify_json($raw_cert_data, $raw_next_cert_data, $ocsp_uri)
{
    //uses openssl cli to validate cert status with ocsp
    global $random_blurp, $timeout;
    $result = array();
    $tmp_dir = '/tmp/';
    $root_ca = getcwd() . '/cacert.pem';
    $pem_issuer = "";
    $pem_client = "";
    openssl_x509_export($raw_cert_data, $pem_client);
    openssl_x509_export_to_file($raw_cert_data, $tmp_dir . $random_blurp . '.cert_client.pem');
    openssl_x509_export($raw_next_cert_data, $pem_issuer);
    openssl_x509_export_to_file($raw_next_cert_data, $tmp_dir . $random_blurp . '.cert_issuer.pem');
    $isser_loc = $tmp_dir . $random_blurp . '.cert_issuer.pem';
    // Some OCSP's want HTTP/1.1 but OpenSSL does not do that. Add Host header as workaround.
    $ocsp_host = parse_url($ocsp_uri, PHP_URL_HOST);
    $output = shell_exec('timeout ' . $timeout . ' | openssl ocsp -no_nonce -CAfile ' . $root_ca . ' -issuer ' . $isser_loc . ' -cert ' . $tmp_dir . $random_blurp . '.cert_client.pem -url "' . escapeshellcmd($ocsp_uri) . '" -header "HOST" "' . escapeshellcmd($ocsp_host) . '" 2>&1');
    $filter_output = shell_exec('timeout ' . $timeout . ' | openssl ocsp -no_nonce -CAfile ' . $root_ca . ' -issuer ' . $isser_loc . ' -cert ' . $tmp_dir . $random_blurp . '.cert_client.pem -url "' . escapeshellcmd($ocsp_uri) . '" -header "HOST" "' . escapeshellcmd($ocsp_host) . '" 2>&1 | grep -v -e "to get local issuer certificate" -e "signer certificate not found" -e "Response Verify" -e "' . $tmp_dir . $random_blurp . '.cert_client.pem"');
    $output = preg_replace("/[[:blank:]]+/", " ", $output);
    $ocsp_status_lines = explode("\n", $output);
    $ocsp_status_lines = array_map('trim', $ocsp_status_lines);
    foreach ($ocsp_status_lines as $line) {
        if (endsWith($line, ":") == false) {
            list($k, $v) = explode(":", $line, 2);
            if (trim($k)) {
                $lines[trim($k)] = trim($v);
            }
        }
    }
    if ($lines[$tmp_dir . $random_blurp . ".cert_client.pem"] == "good") {
        $result["status"] = "good";
    } else {
        if ($lines[$tmp_dir . $random_blurp . ".cert_client.pem"] == "revoked") {
            $result["status"] = "revoked";
        } else {
            $result["error"] = $filter_output;
            $result["status"] = "unknown";
        }
    }
    if (isset($lines["This Update"])) {
        $result["this_update"] = $lines["This Update"];
    }
    if (isset($lines["Next Update"])) {
        $result["next_update"] = $lines["Next Update"];
    }
    if (isset($lines["Reason"])) {
        $result["reason"] = $lines["Reason"];
    }
    if (isset($lines["Revocation Time"])) {
        $result["revocation_time"] = $lines["Revocation Time"];
    }
    $result["ocsp_uri"] = $ocsp_uri;
    //remove temp files after use
    unlink($tmp_dir . $random_blurp . '.cert_client.pem');
    unlink($tmp_dir . $random_blurp . '.cert_issuer.pem');
    return $result;
}
function validExts($dirEntry, $exts)
{
    foreach ($exts as $ext) {
        if (endsWith($dirEntry, "." . $ext)) {
            return True;
        }
    }
    return False;
}
Esempio n. 29
0
function isExtentionValid($path, $extentions)
{
    foreach ($extentions as $extention) {
        if (endsWith(strtolower($path), strtolower($extention))) {
            return true;
        }
    }
    return false;
}
Esempio n. 30
0
 public function testFormatLogMessageEndsWithNewLineCharacter()
 {
     $jsonResult = $this->fixture('this is the message');
     function endsWith($needle, $haystack)
     {
         return $needle === '' || ($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE;
     }
     $this->assertTrue(endsWith("\n", $jsonResult));
 }