本文整理汇总了PHP中ezcConsoleOutput类的典型用法代码示例。如果您正苦于以下问题:PHP ezcConsoleOutput类的具体用法?PHP ezcConsoleOutput怎么用?PHP ezcConsoleOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ezcConsoleOutput类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Displays report or generates its files
*
* @param PHP_ConfigReport_Report $report Report
* @return void
*/
public function render(PHP_ConfigReport_Report $report)
{
$consoleOutput = new ezcConsoleOutput();
$consoleOutput->formats->extensionName->style = array('bold');
$consoleOutput->formats->columnTitle->style = array('bold');
$consoleOutput->formats->error->bgcolor = 'red';
$consoleOutput->formats->warning->bgcolor = 'yellow';
$consoleOutput->outputLine('PHP version: ' . $report->getPhpVersion());
$consoleOutput->outputLine('Environment: ' . $report->getEnvironment());
$noIssue = true;
foreach ($report->getSections() as $section) {
if ($section->hasIssues()) {
$noIssue = false;
$consoleOutput->outputLine();
$consoleOutput->outputLine($section->getExtensionName(), 'extensionName');
$table = new ezcConsoleTable($consoleOutput, $this->_width);
$table[0]->format = 'columnTitle';
$table[0][0]->content = 'Directive';
$table[0][1]->content = 'Level';
$table[0][2]->content = 'Type';
$table[0][3]->content = 'Value';
$table[0][4]->content = 'Suggested value';
$table[0][5]->content = 'Comments';
foreach ($section->getIssues() as $index => $issue) {
$table[$index + 1]->format = $issue->getLevel();
$directiveName = $issue->getDirectiveName();
if (is_array($directiveName)) {
$directiveName = implode(' / ', $directiveName);
}
$table[$index + 1][0]->content = $directiveName;
$table[$index + 1][1]->content = $issue->getLevel();
$table[$index + 1][2]->content = $issue->getType();
$directiveActualValue = $issue->getDirectiveActualValue();
if (is_array($directiveActualValue)) {
$directiveActualValue = implode(' / ', $directiveActualValue);
}
$table[$index + 1][3]->content = $directiveActualValue;
$directiveSuggestedValue = $issue->getDirectiveSuggestedValue();
if (is_array($directiveSuggestedValue)) {
$directiveSuggestedValue = implode(' / ', $directiveSuggestedValue);
}
$table[$index + 1][4]->content = $directiveSuggestedValue;
$table[$index + 1][5]->content = $issue->getComments();
}
$table->outputTable();
$consoleOutput->outputLine();
}
}
if ($noIssue) {
$consoleOutput->outputLine('No issue found.');
$consoleOutput->outputLine();
}
}
开发者ID:jmfontaine,项目名称:PHP_ConfigReport,代码行数:59,代码来源:Text.php
示例2: renderTable
/**
* Generate table output
*
* @param VcsStats_Table $table Table
* @return void
*/
public function renderTable(VcsStats_Report_Element_Table $table)
{
$result = '';
$output = new ezcConsoleOutput();
$output->formats->title->style = array('bold');
$alignments = array('center' => ezcConsoleTable::ALIGN_CENTER, 'left' => ezcConsoleTable::ALIGN_LEFT, 'right' => ezcConsoleTable::ALIGN_RIGHT);
$consoleTable = new ezcConsoleTable($output, 78);
// Display header
$consoleTable[0]->align = ezcConsoleTable::ALIGN_CENTER;
foreach ($table->getColumns() as $column) {
$consoleTable[0][]->content = $column->getTitle();
}
// Display values
foreach ($table->getRows() as $i => $row) {
$j = 0;
foreach ($row as $code => $value) {
$alignment = $table->getColumn($code)->getAlignment();
$consoleTable[$i + 1][$j]->align = $alignments[$alignment];
$consoleTable[$i + 1][$j]->content = $value;
$j++;
}
}
ob_start();
$output->outputLine();
$output->outputLine($table->getTitle(), 'title');
$consoleTable->outputTable();
$output->outputLine();
$output->outputLine();
$result .= ob_get_clean();
echo $result;
}
开发者ID:jmfontaine,项目名称:vcsstats,代码行数:37,代码来源:Text.php
示例3: testProgressMonitor4
public function testProgressMonitor4()
{
$out = new ezcConsoleOutput();
$out->formats->tag->color = 'red';
$out->formats->percent->color = 'blue';
$out->formats->percent->style = array('bold');
$out->formats->data->color = 'green';
$status = new ezcConsoleProgressMonitor($out, 7, array('formatString' => $out->formatText('%2$10s', 'tag') . ' ' . $out->formatText('%1$6.2f%%', 'percent') . ' ' . $out->formatText('%3$s', 'data')));
ob_start();
for ($i = 0; $i < 7; $i++) {
$status->addEntry($this->stati[$i][0], $this->stati[$i][1]);
}
$res = ob_get_contents();
ob_end_clean();
// To prepare test files use this:
// file_put_contents( dirname( __FILE__ ) . '/data/' . ( ezcBaseFeatures::os() === "Windows" ? "windows/" : "posix/" ) . 'testProgressMonitor4.dat', $res );
$this->assertEquals(file_get_contents(dirname(__FILE__) . '/data/' . (ezcBaseFeatures::os() === "Windows" ? "windows/" : "posix/") . 'testProgressMonitor4.dat'), $res, "Formated statusbar not generated correctly.");
}
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:18,代码来源:progressmonitor_test.php
示例4: testRestorePosFailure
public function testRestorePosFailure()
{
if (ezcBaseFeatures::os() === 'Windows') {
$this->markTestSkipped("Does not work on Windows");
}
$output = new ezcConsoleOutput();
try {
$output->restorePos();
} catch (ezcConsoleNoPositionStoredException $e) {
return;
}
$this->fail("Exception not thrown on restore position without stored position.");
}
开发者ID:naderman,项目名称:ezc-console-tools,代码行数:13,代码来源:output_test.php
示例5: __autoload
* @package ConsoleTools
* @version //autogen//
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
*/
require_once 'Base/src/base.php';
/**
* Autoload ezc classes
*
* @param string $className
*/
function __autoload($className)
{
ezcBase::autoload($className);
}
// Create the output handler
$out = new ezcConsoleOutput();
// Set the verbosity to level 10
$out->options->verbosityLevel = 10;
// Enable auto wrapping of lines after 40 characters
$out->options->autobreak = 40;
// Set the color of the default output format to green
$out->formats->default->color = 'green';
// Set the color of the output format named 'success' to white
$out->formats->success->color = 'white';
// Set the style of the output format named 'success' to bold
$out->formats->success->style = array('bold');
// Set the color of the output format named 'failure' to red
$out->formats->failure->color = 'red';
// Set the style of the output format named 'failure' to bold
$out->formats->failure->style = array('bold');
// Set the background color of the output format named 'failure' to blue
开发者ID:sakshika,项目名称:ATM,代码行数:31,代码来源:example_output.php
示例6: testProgress9
public function testProgress9()
{
$out = new ezcConsoleOutput();
$formatString = '' . $out->formatText('Actual progress', 'success') . ': <' . $out->formatText('%bar%', 'failure') . '> ' . $out->formatText('%fraction%', 'success');
$this->commonProgressbarTest(__FUNCTION__, 1073, 123, array('barChar' => '123', 'emptyChar' => '987', 'progressChar' => '---', 'width' => 97, 'formatString' => $formatString, 'fractionFormat' => '%o'));
}
开发者ID:bmdevel,项目名称:ezc,代码行数:6,代码来源:progressbar_test.php
示例7: array
require 'autoload.php';
$cli = eZCLI::instance();
$script = eZScript::instance( array( 'description' => ( "Fixes eZImageAliasHandler bug (http://issues.ez.no/15155)" ),
'use-session' => false,
'use-modules' => true,
'use-extensions' => true ) );
$script->startup();
$options = $script->getOptions( "[n]",
"",
array( 'n' => 'Do not wait the 10 safety seconds before starting' ) );
$script->initialize();
$output = new ezcConsoleOutput();
$output->formats->error->style = array( 'bold' );
$output->formats->error->color = 'red';
if ( !isset( $options['n'] ) )
{
$output->outputLine( 'This script will delete images that look orphan' );
$output->outputLine( 'Press ctrl-c in the next 10 seconds to prevent the script from starting...' );
sleep( 10 );
}
try
{
$output->outputLine( 'Looking for obsolete image files...' );
// Fetch all image files in ezimagefile table
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:fixorphanimages.php
示例8: __autoload
* @package ConsoleTools
* @version //autogen//
* @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
* @license http://ez.no/licenses/new_bsd New BSD License
*/
require_once 'Base/src/base.php';
/**
* Autoload ezc classes
*
* @param string $className
*/
function __autoload($className)
{
ezcBase::autoload($className);
}
$out = new ezcConsoleOutput();
// Create a progress monitor
$status = new ezcConsoleProgressMonitor($out, 7);
// Perform actions
$i = 0;
while ($i++ < 7) {
// Do whatever you want to indicate progress for
usleep(mt_rand(20000, 2000000));
// Advance the statusbar by one step
$status->addEntry('ACTION', "Performed action #{$i}.");
}
$out->outputLine();
/*
OUTPUT:
14.3% ACTION Performed action #1.
28.6% ACTION Performed action #2.
开发者ID:naderman,项目名称:pflow,代码行数:31,代码来源:example_progressmonitor.php
示例9: __set
/**
* Overloaded __set() method to gain read-only access to properties.
* It also performs checks on setting others.
*
* @throws ezcBasePropertyNotFoundException
* If the setting you try to access does not exists
* @throws ezcBaseValueException
* If trying to set an invalid value for a setting.
*
* @param string $propertyName Name of the attrinbute to access.
* @param string $val The value to set.
* @ignore
*/
public function __set($propertyName, $val)
{
if (!isset($this->properties[$propertyName])) {
throw new ezcBasePropertyNotFoundException($propertyName);
}
// Extry handling of multi styles
if ($propertyName === 'style') {
if (!is_array($val)) {
$val = array($val);
}
foreach ($val as $style) {
if (!ezcConsoleOutput::isValidFormatCode($propertyName, $style)) {
throw new ezcBaseValueException($propertyName, $style, 'valid ezcConsoleOutput format code');
}
}
$this->properties['style'] = $val;
return;
}
// Continue normal handling
if (($propertyName === "color" || $propertyName === "bgcolor") && !ezcConsoleOutput::isValidFormatCode($propertyName, $val)) {
throw new ezcBaseValueException($propertyName, $val, 'valid ezcConsoleOutput format code');
}
$this->properties[$propertyName] = $val;
}
开发者ID:sakshika,项目名称:ATM,代码行数:37,代码来源:output_format.php
示例10: dirname
<?php
/**
* Analyses a FOF song and gets tracks & difficulties
*/
include dirname(__FILE__) . '/lib/autoload.php';
$input = new ezcConsoleInput();
$dryRunOption = $input->registerOption(new ezcConsoleOption('d', 'dry-run', ezcConsoleInput::TYPE_NONE, false));
$quietOption = $input->registerOption(new ezcConsoleOption('q', 'quiet', ezcConsoleInput::TYPE_NONE, false));
$helpOption = $input->registerOption(new ezcConsoleOption('h', 'help'));
$verboseOption = $input->registerOption(new ezcConsoleOption('v', 'verbose', ezcConsoleInput::TYPE_NONE, false));
$input->argumentDefinition = new ezcConsoleArguments();
$input->argumentDefinition[0] = new ezcConsoleArgument("artist");
$input->argumentDefinition[0]->mandatory = true;
$input->argumentDefinition[0]->shorthelp = "The artist to search for";
$output = new ezcConsoleOutput();
$output->formats->info->color = 'blue';
$output->formats->error->color = 'red';
$output->formats->error->style = array('bold');
$output->formats->fatal->color = 'red';
$output->formats->fatal->style = array('bold', 'underlined');
$output->formats->fatal->bgcolor = 'black';
try {
$input->process();
} catch (ezcConsoleArgumentMandatoryViolationException $e) {
if ($helpOption->value === true) {
$output->outputText($input->getHelpText("Auto-link by artist name"));
exit;
} else {
$output->outputLine("No arguments given", "fatal");
$output->outputText($input->getHelpText("Auto-link by artist name"));
开发者ID:bdunogier,项目名称:fofscripts,代码行数:31,代码来源:linkbyartist.php
示例11: ezcConsoleOutput
<?php
require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$output->formats->info->color = 'blue';
$output->outputText('Test text in color blue', 'info');
开发者ID:sakshika,项目名称:ATM,代码行数:6,代码来源:tutorial_example_01_output_basic.php
示例12: getFormatCode
/**
* Returns the code for a given formating option of a given type.
*
* $type is the type of formating ('color', 'bgcolor' or 'style'), $key the
* name of the format to lookup. Returns the numeric code for the requested
* format or 0 if format or type do not exist.
*
* @see ezcConsoleOutput::isValidFormatCode()
*
* @param string $type Formatting type.
* @param string $key Format option name.
* @return int The code representation.
*/
protected function getFormatCode($type, $key)
{
if (!ezcConsoleOutput::isValidFormatCode($type, $key)) {
return 0;
}
return ezcConsoleOutput::${$type}[$key];
}
开发者ID:sakshika,项目名称:ATM,代码行数:20,代码来源:output.php
示例13: ezcConsoleOutput
<?php
require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$output->formats->error->color = 'red';
$output->formats->error->style = array('bold');
$output->formats->error->target = ezcConsoleOutput::TARGET_STDERR;
$output->outputLine('Unable to connect to database', 'error');
开发者ID:sakshika,项目名称:ATM,代码行数:8,代码来源:tutorial_example_output_targets.php
示例14: array
<?php
class ezcConsoleOutput
{
protected static $color = array('gray' => 30);
public static function isValidFormatCode($type, $key)
{
return isset(self::${$type}[$key]);
}
}
var_dump(ezcConsoleOutput::isValidFormatCode('color', 'gray'));
开发者ID:badlamer,项目名称:hhvm,代码行数:11,代码来源:bug53347.php
示例15: ezcConsoleOutput
<?php
require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$output->formats->info->color = 'blue';
$output->formats->info->style = array('bold');
$output->setOptions(array('autobreak' => 78, 'verbosityLevel' => 3));
$output->outputLine('This is a very very long info text. It has so much information in ' . 'it, that it will definitly not fit into 1 line. Therefore, ' . 'ezcConsoleOutput will automatically wrap the line for us.', 'info');
$output->outputLine();
$output->outputLine('This verbose information will currently not be displayed.', 'info', 10);
$output->outputLine('But this verbose information will be displayed.', 'info', 2);
开发者ID:sakshika,项目名称:ATM,代码行数:11,代码来源:tutorial_example_03_output_options.php
示例16: getInstance
/**
* Returns the instance of the class
*
* @param boolean $isCliMode
* @return CjwNewsletterLog
*/
public static function getInstance($isCliMode = false)
{
try {
if (is_null(self::$instance)) {
self::$instance = new self($isCliMode);
ezcBaseInit::fetchConfig('cjwNewsletterInitLog', self::$instance);
}
return self::$instance;
} catch (ezcBaseFilePermissionException $e) {
eZDebug::writeError($e->getMessage(), 'CjwNewsletterLog::getInstance()');
if ($isCliMode) {
$output = new ezcConsoleOutput();
$output->formats->error->color = 'red';
$output->formats->error->style = array('bold');
$output->outputLine($e->getMessage(), 'error');
exit;
}
}
}
开发者ID:hudri,项目名称:cjw_newsletter,代码行数:25,代码来源:cjwnewsletterlog.php
示例17: viewCacheClear
/**
* Clears view cache for imported content objects.
* ObjectIDs are stored in 'ezpending_actions' table, with {@link SQLIContent::ACTION_CLEAR_CACHE} action
*/
public static function viewCacheClear()
{
$db = eZDB::instance();
$isCli = isset($_SERVER['argv']);
$output = null;
$progressBar = null;
$i = 0;
$conds = array('action' => SQLIContent::ACTION_CLEAR_CACHE);
$limit = array('offset' => 0, 'length' => 50);
$count = (int) eZPersistentObject::count(eZPendingActions::definition(), $conds);
if ($isCli && $count > 0) {
// Progress bar implementation
$output = new ezcConsoleOutput();
$output->outputLine('Starting to clear view cache for imported objects...');
$progressBarOptions = array('emptyChar' => ' ', 'barChar' => '=');
$progressBar = new ezcConsoleProgressbar($output, $count, $progressBarOptions);
$progressBar->start();
}
/*
* To avoid fatal errors due to memory exhaustion, pending actions are fetched by packets
*/
do {
$aObjectsToClear = eZPendingActions::fetchObjectList(eZPendingActions::definition(), null, $conds, null, $limit);
$jMax = count($aObjectsToClear);
if ($jMax > 0) {
for ($j = 0; $j < $jMax; ++$j) {
if ($isCli) {
$progressBar->advance();
}
$db->begin();
eZContentCacheManager::clearContentCacheIfNeeded((int) $aObjectsToClear[$j]->attribute('param'));
$aObjectsToClear[$j]->remove();
$db->commit();
$i++;
}
}
unset($aObjectsToClear);
eZContentObject::clearCache();
if (eZINI::instance('site.ini')->variable('ContentSettings', 'StaticCache') == 'enabled') {
$optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
$options = new ezpExtensionOptions($optionArray);
$staticCacheHandler = eZExtension::getHandlerClass($options);
$staticCacheHandler::executeActions();
}
} while ($i < $count);
if ($isCli && $count > 0) {
$progressBar->finish();
$output->outputLine();
}
}
开发者ID:lolautruche,项目名称:sqliimport,代码行数:54,代码来源:sqliimportutils.php
示例18: testRestorePosFailure
public function testRestorePosFailure()
{
$output = new ezcConsoleOutput();
try {
$output->restorePos();
} catch (ezcConsoleNoPositionStoredException $e) {
return;
}
$this->fail("Exception not thrown on restore position without stored position.");
}
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:10,代码来源:output_test.php
示例19: __autoload
* @package ConsoleTools
* @version //autogen//
* @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
* @license http://ez.no/licenses/new_bsd New BSD License
*/
require_once 'Base/src/base.php';
/**
* Autoload ezc classes
*
* @param string $className
*/
function __autoload($className)
{
ezcBase::autoload($className);
}
$out = new ezcConsoleOutput();
$out->formats->red->color = "red";
// Create progress bar itself
$progress = new ezcConsoleProgressbar($out, 100, array('step' => 5));
$progress->options->emptyChar = '-';
$progress->options->progressChar = $out->formatText('>', "red");
$progress->options->formatString = "Uploading file </tmp/foobar.tar.bz2>: %act%/%max% kb [%bar%]";
// Perform actions
$i = 0;
while ($i++ < 20) {
// Do whatever you want to indicate progress for
usleep(mt_rand(20000, 2000000));
// Advance the progressbar by one step ( uploading 5k per run )
$progress->advance();
}
// Finish progress bar and jump to next line.
开发者ID:naderman,项目名称:pflow,代码行数:31,代码来源:example_progressbar.php
示例20: ezcConsoleOption
$helpOption->isHelpOption = true;
$sourceFileOption = $input->registerOption( new ezcConsoleOption( 's', 'source-file' ) );
$sourceFileOption->shorthelp = "File containing class to generate tests from";
$sourceFileOption->mandatory = true;
$sourceFileOption->type = ezcConsoleInput::TYPE_STRING;
$destinationFileOption = $input->registerOption( new ezcConsoleOption( 'd', 'dest-file' ) );
$destinationFileOption->shorthelp = "File to write the tests to";
$destinationFileOption->mandatory = true;
$destinationFileOption->type = ezcConsoleInput::TYPE_STRING;
// Set ouput formatting
// ---------------------------------------------------------------------------
$out = new ezcConsoleOutput();
$out->formats->count->style = array( 'bold' );
$out->formats->source->color = 'green';
$out->formats->dest->color = 'yellow';
// Process options
// ---------------------------------------------------------------------------
try
{
$input->process();
}
catch ( ezcConsoleOptionException $e )
{
die( $e->getMessage() );
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:31,代码来源:create-test-from-class.php
注:本文中的ezcConsoleOutput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论