Exemplo n.º 1
0
function stylish_div($words)
{
    global $min_font, $max_font, $most, $base, $total;
    if ($base <= 1) {
        $multiplicand = (6 - log($total, 1.85)) / 6;
        $bigFontsize = (int) ($multiplicand * ($max_font - $min_font)) + $min_font;
        $smallFontsize = max($max_font - $smallFontsize, $min_font);
        if ($bigFontsize < $smallFontsize) {
            $bigFontsize ^= $smallFontsize ^= $bigFontsize ^= $smallFontsize;
        }
        foreach ($words as $key => $val) {
            outputLine($key, $val, $val == 2 ? $bigFontsize : $smallFontsize);
        }
    } else {
        foreach ($words as $key => $val) {
            $multiplicand = log($val, $base) / log($most, $base);
            $fontsize = (int) ($multiplicand * ($max_font - $min_font)) + $min_font;
            outputLine($key, $val, $fontsize);
        }
    }
}
Exemplo n.º 2
0
/**
 * @param array $items
 * @param integer $style one of the STYLE_* constants
 * @return void
 */
function outputBulletList(array $items, $style = STYLE_DEFAULT)
{
    foreach ($items as $item) {
        outputLine('  * ' . $item, array(), 4, $style);
    }
}
Exemplo n.º 3
0
            $lineArray[] = $row['retire_flg'];
            $lineArray[] = $row['trainer_1'];
            $lineArray[] = $row['trainer_2'];
            $lineArray[] = $row['trainer_3'];
            $lineArray[] = $row['trainer_4'];
            $lineArray[] = $row['trainer_5'];
            $lineArray[] = $row['trainer_6'];
            $lineArray[] = $row['trainer_7'];
            $lineArray[] = $row['trainer_8'];
            $lineArray[] = $row['trainer_9'];
            $lineArray[] = $row['trainer_10'];
            $lineArray[] = $row['admin_1'];
            $lineArray[] = $row['admin_2'];
            $lineArray[] = $row['admin_3'];
            $lineArray[] = $row['admin_4'];
            $lineArray[] = $row['admin_5'];
            $lineArray[] = $row['admin_6'];
            $lineArray[] = $row['admin_7'];
            $lineArray[] = $row['admin_8'];
            $lineArray[] = $row['admin_9'];
            $lineArray[] = $row['admin_10'];
            outputLine($lineArray);
        }
    }
    exit;
} catch (Exception $e) {
    $error = array();
    $param['errors'][] = "システムエラーが発生しました。";
    renderTemplate('error.tpl', $param);
    exit;
}
Exemplo n.º 4
0
        continue;
    }
    $r = Revision::newFromTitle($t);
    #echo $r->getText() . "\n";
    #print_r($matches); exit;
    echo "\t<article>\n";
    echo "\t\t<title>How to {$t->getText()}</title>\n";
    echo "\t\t<tags>" . trim($tokens[3]) . ", {$tokens[4]}</tags>\n";
    echo "\t\t<categories>\n";
    echo "\t\t\t<category type=\"mainmenu\">" . htmlspecialchars(trim($tokens[1])) . "</category>\n";
    $sub = trim($tokens[2]);
    if ($sub != "None") {
        echo "\t\t\t<category type=\"featured\">{$sub}</category>\n";
    }
    echo "\t\t</categories>\n";
    echo "\t\t<content>\n";
    $intro = preg_replace("@== Steps(.|\n)*@im", "", $r->getText());
    outputLine($intro, true);
    echo "\t\t<steps>\n";
    preg_match("@== Steps ==(.|\n)*^==@imU", $r->getText(), $matches);
    $steps = split("\n", $matches[0]);
    foreach ($steps as $s) {
        if (preg_match("@^#@", $s)) {
            outputLine($s, false);
        }
    }
    echo "\t\t</steps>\n";
    echo "\t\t</content>\n";
    echo "\t</article>\n";
}
echo "</wikihowmedia>\n";
        $keyPattern = str_replace('__KEY__', $key, $basePattern);
        $replacement = str_replace(['__KEY__', '__VALUE__'], [$key, $value], $baseReplacement);
        $databaseConfigContent = preg_replace($keyPattern, $replacement, $databaseConfigContent);
    }
    file_put_contents($databaseConfig, $databaseConfigContent);
}
`chmod -R 0777 {$root}`;
/*
 * Updating dependecies
 */
echo "Updating dependecies... Please wait...\n";
executeAndOutputResult(`composer update`);
exit;
/**
 * Optional - creating new host
 */
if ("yes" == _readline('Create new apache local host? (type "yes" to proceed): ')) {
    if ($newHostName = _readLine('Enter new host name: ')) {
        $virtualHostContent = "\n            <VirtualHost *:80>\n                ServerAdmin webmaster@{$newHostName}\n                ServerName {$newHostName}\n                ServerAlias www.{$newHostName}\n                DocumentRoot /var/www/{$newHostName}\n                <Directory />\n                        Options FollowSymLinks\n                        AllowOverride All\n                </Directory>\n                <Directory /var/www/{$newHostName}>\n                        Options Indexes FollowSymLinks MultiViews\n                        AllowOverride All\n                        Order allow,deny\n                        allow from all\n                </Directory>\n            </VirtualHost>  \n        ";
        $configFile = "{$newHostName}.conf";
        $confFilePath = "/etc/apache2/sites-aviable/{$configFile}";
        executeAndOutputResult(`a2ensite {$configFile}`);
        executeAndOutputResult(`service apache2 restart`);
        file_put_contents('/etc/hosts', "127.0.0.1\t{$newHostName}\n", FILE_APPEND);
        outputLine("New host created. Address: http://{$newHostName}");
    }
} else {
    outputLine('Host creation skipped');
}
outputLine('Finish!');