Example #1
0
<?php

$networks = isset($_GET['networks']) ? $_GET['networks'] : 'facebook,twitter';
$url = isset($_GET['url']) ? $_GET['url'] : '';
header('Content-type: application/json');
echo json_encode(get_numbers($networks, $url));
function get_numbers($networks, $url)
{
    $LOCATION = './networks';
    $FUNCTION_PREFIX = 'get_counter_number__';
    $numbers = array();
    $networks = explode(',', $networks);
    for ($i = 0; $i < count($networks); $i++) {
        $network = $networks[$i];
        $include = $LOCATION . '/' . $network . '.php';
        $function_name = $FUNCTION_PREFIX . $network;
        if (file_exists($include)) {
            include $include;
            $num = $function_name($url);
            $numbers[$network] = $num;
        }
    }
    return $numbers;
}
        }
        $lang = array_shift($y);
        $lang = explode("-", $lang);
        $lang = trim(strtolower(array_shift($lang)));
        $w = 5 * $weight;
        $w = chr(70 - $w);
        $w = $w . $w;
        $w = $w . $w . $w;
        if (!isset($r[$lang]) || $r[$lang] < $w) {
            $r[$lang] = $w;
        }
    }
    return $r;
}
# Parsing text file and generating output
$n = get_numbers($articlecountfile);
$shade = getshades($userlang);
$l = "<table align=center border=1 width='50%' cellpadding=2>";
$count = 0;
$t = readafile($textsourcefile);
$t = explode("\n", $t);
foreach ($t as $x) {
    $y = explode(':', $x, 2);
    if (count($y) == 2) {
        $language = trim(strtolower($y[0]));
        # language id
        if (isset($n[$language])) {
            $ltext = $y[1];
            # Language text
            $noa = $n[$language];
            # Number of articles
Example #3
0
}
// set up default response
$password = null;
$data = array('success' => false, 'result' => $password);
$settings = array('wordCount' => $_POST['wordCount'] ? (int) $_POST['wordCount'] : WORD_COUNT, 'numbersCount' => $_POST['numbersCount'], 'specialCharactersCount' => $_POST['specialCharactersCount'] ? (int) $_POST['specialCharactersCount'] : SPECIAL_CHARACTERS_COUNT, 'includeHyphens' => $_POST['includeHyphens'], 'caseSelection' => $_POST['caseSelection'] ? $_POST['caseSelection'] : CASE_SELECTION);
// get raw words picked based on setting
$words = get_words($settings['wordCount']);
// build special chars selection
if ($settings['specialCharactersCount']) {
    $specialChars = get_special_chars($settings['specialCharactersCount']);
} else {
    $specialChars = "";
}
// get random numbers
if ($settings['numbersCount']) {
    $numbers = get_numbers($settings['numbersCount']);
} else {
    $numbers = "";
}
// upper or lower case the words
$words = array_flip($words);
if ($settings['caseSelection'] == "lower") {
    $words = array_change_key_case($words, CASE_LOWER);
} else {
    $words = array_change_key_case($words, CASE_UPPER);
}
$words = array_flip($words);
// add hyphens and convert array of words to string
if ($settings['includeHyphens'] == "true") {
    $words_string = implode('-', $words);
} else {