Пример #1
0
function common_canonical_tag($tag)
{
    $tag = common_slugify($tag);
    $tag = substr($tag, 0, 64);
    return $tag;
}
Пример #2
0
    print "Welcome to GNU social's interactive PHP console!\n";
    print "Type some PHP code and it'll execute...\n";
    print "\n";
    print "Hint: return a value of any type to output it via var_export():\n";
    print "  \$profile = new Profile();\n";
    print "  \$profile->find();\n";
    print "  \$profile->fetch();\n";
    print "  return \$profile;\n";
    print "\n";
    print "Note that PHP is cranky and you can easily kill your session by mistyping.\n";
    print "\n";
    print "Type ctrl+D or enter 'exit' to exit.\n";
}
if (CONSOLE_INTERACTIVE) {
    print "GNU social interactive PHP console... type ctrl+D or enter 'exit' to exit.\n";
    $prompt = common_slugify(common_config('site', 'name')) . '> ';
} else {
    $prompt = '';
}
while (!feof(STDIN)) {
    $line = read_input_line($prompt);
    if ($line === false) {
        if (CONSOLE_INTERACTIVE) {
            print "\n";
        }
        break;
    } elseif ($line !== '') {
        try {
            if (trim($line) == 'exit') {
                break;
            } elseif (trim($line) == 'help') {