Example #1
0
 public function testGetUrls()
 {
     $message = "This test contains a url here http://www.sugarcrm.com and not here http://amazon.com";
     $result = getUrls($message);
     $this->assertContains('http://www.sugarcrm.com', $result, ' Could not find first url.');
     $this->assertContains('http://amazon.com', $result, ' Could not find second url.');
 }
Example #2
0
function printStats()
{
    $votes = getStats();
    $urls = getUrls();
    $total = 0;
    foreach ($votes as $key => $value) {
        $total += $value;
    }
    foreach ($votes as $key => $value) {
        echo "<h3><a href='" . "{$urls[$key]}" . "' target='_blank' style='color:#333333;'>" . $key . "</a>: <span style='color: #FA3D79;'>" . round($value / $total, 2) * 100 . "%</span></h3>";
    }
}
Example #3
0
function getLists($site, $counter)
{
    echo "start working with " . $site . "\n";
    $links[] = $site;
    $intraLinks[] = $site;
    $globalCSS = array();
    $globalJS = array();
    $i = 0;
    while ($i <= $counter && count($intraLinks) > $i) {
        $code = getSourceCode($intraLinks[$i]);
        // echo "working with ".$intraLinks[$i]."\n";
        $urls = getUrls($code);
        $localCSS = getCSSLinks($code);
        $localJS = getJSLinks($code);
        if (count($urls) > 0) {
            foreach ($urls as $url) {
                // если начинается на два слэша - внешний линк, дописываем http:
                if ($url[0] == "/" && $url[1] == "/") {
                    $url = "http:" . $url;
                    if (!in_array($url, $links)) {
                        $links[] = $url;
                    }
                    // если начинается на один слэш - внутренний линк, добавляем основную часть (домен)
                } elseif ($url[0] == "/") {
                    $url = $site . $url;
                    if (!in_array($url, $intraLinks)) {
                        $intraLinks[] = $url;
                    }
                    // в остальных случаях - обычная внешняя ссылка - добавляем в список
                } elseif (!in_array($url, $links)) {
                    $links[] = $url;
                }
            }
        }
        if (count($localCSS) > 0) {
            foreach ($localCSS as $url) {
                // если начинается на два слэша - внешний линк, дописываем http:
                if ($url[0] == "/" && $url[1] == "/") {
                    $url = "http:" . $url;
                    if (!in_array($url, $globalCSS)) {
                        $globalCSS[] = $url;
                    }
                    // если начинается на один слэш - внутренний линк, добавляем основную часть (домен)
                } elseif ($url[0] == "/") {
                    $url = $site . $url;
                    if (!in_array($url, $globalCSS)) {
                        $globalCSS[] = $url;
                    }
                } elseif (!in_array($url, $globalCSS)) {
                    $globalCSS[] = $url;
                }
            }
        }
        if (count($localJS) > 0) {
            foreach ($localJS as $url) {
                // если начинается на два слэша - внешний линк, дописываем http:
                if ($url[0] == "/" && $url[1] == "/") {
                    $url = "http:" . $url;
                    if (!in_array($url, $globalJS)) {
                        $globalJS[] = $url;
                    }
                    // если начинается на один слэш - внутренний линк, добавляем основную часть (домен)
                } elseif ($url[0] == "/") {
                    $url = $site . $url;
                    if (!in_array($url, $globalJS)) {
                        $globalJS[] = $url;
                    }
                } elseif (!in_array($url, $globalJS)) {
                    $globalJS[] = $url;
                }
            }
        }
        $i += 1;
    }
    return array($intraLinks, $globalCSS, $globalJS);
}
Example #4
0
}
$turl = "";
# Cycle through tree and build a url list
while ($turl = getNextUrl($turl)) {
    # Extend script time limit
    set_time_limit(3000);
    # Read html file into memory
    if ($html = file($turl)) {
        $html = stripslashes(implode($html));
        echo '<url>' . "\n\t" . '<loc>' . googlesitemap_compatible($turl) . '</loc>' . "\n";
        if ($lastmodification == true) {
            echo "\t" . '<lastmod>' . date("Y-m-d") . '</lastmod>' . "\n";
        }
        echo "\t" . '<changefreq>' . $frequency . '</changefreq>' . "\n\t" . '<priority>' . $priority . '</priority>' . "\n" . '</url>' . "\n";
        # Get site urls from html and add new unique url to list if needed
        addUrls(getUrls($turl, $html));
        #writte the same thing above on website if you have permission to writte
        if ($open_file == 'sucess') {
            fputs($fp, '<url>' . "\n\t" . '<loc>' . googlesitemap_compatible($turl) . '</loc>' . "\n");
            if ($lastmodification == true) {
                fputs($fp, "\t" . '<lastmod>' . date("Y-m-d") . '</lastmod>' . "\n");
            }
            fputs($fp, "\t" . '<changefreq>' . $frequency . '</changefreq>' . "\n\t" . '<priority>' . $priority . '</priority>' . "\n" . '</url>' . "\n");
        }
    } else {
        # check if 404error.txt was sucsefuly opened
        if ($open_file_404 == 'sucess') {
            fputs($fp_err, $turl . "\n");
        }
    }
}
Example #5
0
<?php

header('Content-Type: text/html; charset=utf-8');
function getUrls($string)
{
    $regex = '/https?\\:\\/\\/download[^\\" ]+/i';
    preg_match_all($regex, $string, $matches);
    //return (array_reverse($matches[0]));
    return $matches[0];
}
if (isset($_GET['url']) && $_GET['url']) {
    $url = $_GET['url'];
    $url1 = "http://download.freeapk.ru/?package=" . $url;
    $curl = curl_init();
    curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $url1, CURLOPT_USERAGENT => 'get apk file'));
    $resp = curl_exec($curl);
    $urls = getUrls($resp);
    $downloadLink = $urls[1];
    if (empty($downloadLink)) {
        $urlapk = $url;
        header("Location: {$urlapk}");
    } else {
        if ($downloadLink == "http://download.freeapk.ru.com") {
            $urlapk = $url;
            header("Location: {$urlapk}");
        } else {
            header("Location: {$downloadLink}");
        }
    }
}
Example #6
0
 /**
  * Parse a piece of text and replace with proper display tags.
  * @static
  * @param  $input
  * @return void
  */
 public static function parseMessage($input)
 {
     $urls = getUrls($input);
     foreach ($urls as $url) {
         $output = "<a href='{$url}' target='_blank'>" . $url . "</a>";
         $input = str_replace($url, $output, $input);
     }
     return $input;
 }
Example #7
0
<?php

include "sessionValid.php";
include "messagesFns.php";
include "header.php";
?>

<div class="content">
<div class="urls">
<div class="urlLine firstLine">
<div class="title">Title</div>
<div class="url">content</div>
</div>
<?php 
$uid = $_SESSION['validUid'];
$urls = getUrls($uid);
if (isset($urls)) {
    foreach ($urls as $url) {
        ?>
			<div class="urlLine">
			<div class="title">
			<?php 
        echo $url['title'] . "&nbsp;&nbsp;";
        ?>
			</div>
			<div class="url">
			<?php 
        echo "<a href=" . "http://" . $url['url'] . " target=\"_blank\">" . $url['url'] . "</a>";
        ?>
			</div>
			<div class="op">