当前位置: 首页>>代码示例>>PHP>>正文


PHP Cli::block方法代码示例

本文整理汇总了PHP中Cli::block方法的典型用法代码示例。如果您正苦于以下问题:PHP Cli::block方法的具体用法?PHP Cli::block怎么用?PHP Cli::block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cli的用法示例。


在下文中一共展示了Cli::block方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_block

 function test_block()
 {
     // single line, single tag
     ob_start();
     Cli::block("Output: <info>one, two</info>\n");
     $out = ob_get_clean();
     $this->assertEquals("Output: [33;33mone, two[0m\n", $out);
     // multiline, multi tag
     ob_start();
     Cli::block("<success>Yay!</success>\n<error>Oh noes</error>");
     $out = ob_get_clean();
     $this->assertEquals("[0;32mYay![0m\n[31;31mOh noes[0m", $out);
 }
开发者ID:Selwyn-b,项目名称:elefant,代码行数:13,代码来源:CliTest.php

示例2: array

  <info>./elefant crud-app list-types</info>


USAGE;
if (!isset($_SERVER['argv'][2])) {
    Cli::block($usage);
    die;
}
$types = array('checkbox', 'date', 'datetime', 'email', 'password', 'pkey', 'radio', 'select', 'text', 'textarea', 'time', 'wysiwyg');
if ($_SERVER['argv'][2] === 'list-types') {
    Cli::out(' - ' . join("\n - ", $types), 'info');
    die;
}
if (!isset($_SERVER['argv'][3])) {
    Cli::block($usage);
    die;
}
$name = strtolower($_SERVER['argv'][2]);
// get plural name
$ar = new ActiveResource();
$plural = $ar->pluralize($name);
unset($ar);
if (file_exists('apps/' . $plural)) {
    Cli::out('apps/' . $plural . ' already exists.  Please choose a different name for your new app.', 'info');
    die;
}
// build list of fields
$fields = array();
$pkey = false;
for ($i = 3; $i < count($_SERVER['argv']); $i++) {
开发者ID:Selwyn-b,项目名称:elefant,代码行数:30,代码来源:crud-app.php

示例3: glob

  <info>helper-docs <helper></info>                  Show documentation for a helper
  <info>generate-key</info>                          Generate a random 32 character key
  <info>generate-password <length(8)></info>         Generate a random password
  <info>encrypt-password <password></info>           Encrypt a password for the db
  <info>bundle-translations <appname></info>         Bundle translations into an app
  <info>version</info>                               Output the Elefant version number
  <info>help</info>                                  Print this help output


HELP;
// Extend command list with those from apps/*/conf/cli.php
$files = glob('apps/*/conf/cli.php');
if ($files) {
    $commands = array();
    foreach ($files as $file) {
        $parsed = parse_ini_file($file);
        if (!$parsed || !isset($parsed['commands'])) {
            continue;
        }
        $commands = array_merge($commands, $parsed['commands']);
    }
    if (count($commands) > 0) {
        $help .= "Extended commands:\n\n";
        foreach ($commands as $cmd => $desc) {
            $help .= sprintf("  <info>%-37s</info> %s\n", $cmd, $desc);
        }
        $help .= "\n";
    }
}
Cli::block($help);
开发者ID:Selwyn-b,项目名称:elefant,代码行数:30,代码来源:index.php

示例4: generate_password

    if (trim($sql) === 'begin' || trim($sql) === 'commit') {
        continue;
    }
    if (!DB::execute($sql)) {
        Cli::out('** Error: ' . DB::error(), 'error');
        DB::rollback();
        return;
    }
}
// change the admin user's password
$pass = generate_password(8);
$date = gmdate('Y-m-d H:i:s');
if (!DB::execute("update `#prefix#user` set `email` = ?, `password` = ? where `id` = 1", $conf['General']['email_from'], User::encrypt_pass($pass))) {
    Cli::out('Error: ' . DB::error(), 'error');
    DB::rollback();
    return;
}
DB::commit();
// respond with the root password
echo "Database created. Your initial admin account is:\n";
Cli::block('Username: <info>' . $conf['General']['email_from'] . "</info>\n");
Cli::block('Password: <info>' . $pass . "</info>\n");
// create versions entries for initial content
$wp = new Webpage('index');
Versions::add($wp);
$b = new Block('members');
Versions::add($b);
// disable the installer
@umask(00);
@touch('conf/installed');
echo "Done.\n";
开发者ID:Selwyn-b,项目名称:elefant,代码行数:31,代码来源:install.php


注:本文中的Cli::block方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。