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


PHP dt函数代码示例

本文整理汇总了PHP中dt函数的典型用法代码示例。如果您正苦于以下问题:PHP dt函数的具体用法?PHP dt怎么用?PHP dt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: druplicon

 /**
  * Print druplicon as post-command output.
  *
  * @hook post-command *
  * @option druplicon Shows the druplicon as glorious ASCII art.
  * @todo hidden is not yet part of annotated-command project. It is recognized by Drush's annotation_adapter.inc
  * @hidden-option druplicon
  */
 public function druplicon($result, CommandData $commandData)
 {
     // If one command does a drush_invoke to another command,
     // then this hook will be called multiple times. Only print
     // once.  (n.b. If drush_invoke_process passes along the
     // --druplicon option, then we will still get mulitple output)
     if ($this->printed) {
         return;
     }
     $this->printed = true;
     $annotationData = $commandData->annotationData();
     $commandName = $annotationData['command'];
     // For some reason, Drush help uses drush_invoke_process to call helpsingle
     if ($commandName == 'helpsingle') {
         return;
     }
     if ($commandData->input()->getOption('druplicon')) {
         $this->logger()->debug(dt('Displaying Druplicon for "!command" command.', array('!command' => $commandName)));
         $misc_dir = DRUSH_BASE_PATH . '/misc';
         if (drush_get_context('DRUSH_NOCOLOR')) {
             $content = file_get_contents($misc_dir . '/druplicon-no_color.txt');
         } else {
             $content = file_get_contents($misc_dir . '/druplicon-color.txt');
         }
         // @todo: `$commandData->output->writeln($content)` after $output hooked up to backend invoke
         drush_print($content);
     }
 }
开发者ID:jibran,项目名称:drush,代码行数:36,代码来源:DrupliconCommands.php

示例2: getAction

  /**
   * Implements \SiteAudit\Check\Abstract\getAction().
   */
  public function getAction() {
    if ($this->score != SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS) {
      $ret_val = dt('Consider the following options:') . PHP_EOL;
      $options = array();
      $options[] = dt('Disable unneeded or unnecessary extensions.');
      $options[] = dt('Consolidate functionality if possible, or custom develop a solution specific to your needs.');
      $options[] = dt('Avoid using modules that serve only one small purpose that is not mission critical.');

      if (drush_get_option('html')) {
        $ret_val .= '<ul>';
        foreach ($options as $option) {
          $ret_val .= '<li>' . $option . '</li>';
        }
        $ret_val .= '</ul>';
      }
      else {
        foreach ($options as $option) {
          if (!drush_get_option('json')) {
            $ret_val .= str_repeat(' ', 6);
          }
          $ret_val .= '- ' . $option . PHP_EOL;
        }
        if (!drush_get_option('json')) {
          $ret_val .= str_repeat(' ', 6);
        }
      }
      $ret_val .= dt('A lightweight site is a fast and happy site!');
      return $ret_val;
    }
  }
开发者ID:karlkedrovsky,项目名称:config,代码行数:33,代码来源:Count.php

示例3: bootstrap_and_dispatch

 function bootstrap_and_dispatch()
 {
     $phases = _drush_bootstrap_phases(FALSE, TRUE);
     $return = '';
     $command_found = FALSE;
     _drush_bootstrap_output_prepare();
     foreach ($phases as $phase) {
         if (drush_bootstrap_to_phase($phase)) {
             $command = drush_parse_command();
             if (is_array($command)) {
                 $bootstrap_result = drush_bootstrap_to_phase($command['bootstrap']);
                 drush_enforce_requirement_bootstrap_phase($command);
                 drush_enforce_requirement_core($command);
                 drush_enforce_requirement_drupal_dependencies($command);
                 drush_enforce_requirement_drush_dependencies($command);
                 if ($bootstrap_result && empty($command['bootstrap_errors'])) {
                     drush_log(dt("Found command: !command (commandfile=!commandfile)", array('!command' => $command['command'], '!commandfile' => $command['commandfile'])), 'bootstrap');
                     $command_found = TRUE;
                     // Dispatch the command(s).
                     $return = drush_dispatch($command);
                     // Prevent a '1' at the end of the output.
                     if ($return === TRUE) {
                         $return = '';
                     }
                     if (drush_get_context('DRUSH_DEBUG') && !drush_get_context('DRUSH_QUIET')) {
                         // @todo Create version independant wrapper around Drupal timers. Use it.
                         drush_print_timers();
                     }
                     break;
                 }
             }
         } else {
             break;
         }
     }
     if (!$command_found) {
         // If we reach this point, command doesn't fit requirements or we have not
         // found either a valid or matching command.
         // If no command was found check if it belongs to a disabled module.
         if (!$command) {
             $command = drush_command_belongs_to_disabled_module();
         }
         // Set errors related to this command.
         $args = implode(' ', drush_get_arguments());
         if (isset($command) && is_array($command)) {
             foreach ($command['bootstrap_errors'] as $key => $error) {
                 drush_set_error($key, $error);
             }
             drush_set_error('DRUSH_COMMAND_NOT_EXECUTABLE', dt("The drush command '!args' could not be executed.", array('!args' => $args)));
         } elseif (!empty($args)) {
             drush_set_error('DRUSH_COMMAND_NOT_FOUND', dt("The drush command '!args' could not be found.  Run `drush cache-clear drush` to clear the commandfile cache if you have installed new extensions.", array('!args' => $args)));
         }
         // Set errors that occurred in the bootstrap phases.
         $errors = drush_get_context('DRUSH_BOOTSTRAP_ERRORS', array());
         foreach ($errors as $code => $message) {
             drush_set_error($code, $message);
         }
     }
     return $return;
 }
开发者ID:catch56,项目名称:drush,代码行数:60,代码来源:DrupalBoot.php

示例4: getResultInfo

 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     if (empty($this->registry['rows_by_table'])) {
         return dt('No tables with less than @min_rows rows.', array('@min_rows' => drush_get_option('min_rows', SiteAuditCheckDatabaseRowCount::AUDIT_CHECK_DB_ROW_MIN_DEFAULT)));
     }
     if (drush_get_option('html')) {
         $ret_val = '<table class="table table-condensed">';
         $ret_val .= '<thead><tr><th>Table Name</th><th>Rows</th></tr></thead>';
         $ret_val .= '<tbody>';
         foreach ($this->registry['rows_by_table'] as $table_name => $rows) {
             $ret_val .= '<tr>';
             $ret_val .= '<td>' . $table_name . '</td>';
             $ret_val .= '<td>' . $rows . '</td>';
             $ret_val .= '</tr>';
         }
         $ret_val .= '</tbody>';
         $ret_val .= '</table>';
     } else {
         $ret_val = dt('Table Name: Rows') . PHP_EOL;
         if (!drush_get_option('json')) {
             $ret_val .= str_repeat(' ', 4);
         }
         $ret_val .= '----------------';
         foreach ($this->registry['rows_by_table'] as $table_name => $rows) {
             $ret_val .= PHP_EOL;
             if (!drush_get_option('json')) {
                 $ret_val .= str_repeat(' ', 4);
             }
             $ret_val .= "{$table_name}: {$rows}";
         }
     }
     return $ret_val;
 }
开发者ID:OPIN-CA,项目名称:checkpoint,代码行数:36,代码来源:RowCount.php

示例5: run

 /**
  * {@inheritdoc}
  */
 public function run($name, $time_limit = 0)
 {
     $worker = $this->workerManager->createInstance($name);
     $end = time() + $time_limit;
     $queue = $this->getQueue($name);
     $count = 0;
     while ((!$time_limit || time() < $end) && ($item = $queue->claimItem())) {
         try {
             drush_log(dt('Processing item @id from @name queue.', array('@name' => $name, 'id' => $item->item_id)), 'info');
             $worker->processItem($item->data);
             $queue->deleteItem($item);
             $count++;
         } catch (SuspendQueueException $e) {
             // If the worker indicates there is a problem with the whole queue,
             // release the item and skip to the next queue.
             $queue->releaseItem($item);
             drush_set_error('DRUSH_SUSPEND_QUEUE_EXCEPTION', $e->getMessage());
         } catch (\Exception $e) {
             // In case of any other kind of exception, log it and leave the item
             // in the queue to be processed again later.
             drush_set_error('DRUSH_QUEUE_EXCEPTION', $e->getMessage());
         }
     }
     return $count;
 }
开发者ID:nrackleff,项目名称:capstone,代码行数:28,代码来源:Queue8.php

示例6: fetch

 public function fetch($repository, $working_directory)
 {
     $username = drush_prompt(dt('Please provide your username for this svn repository'), '');
     if (!drush_shell_exec("svn --username {$username} co {$repository} {$working_directory}")) {
         throw new RumRepositoryNotCheckedOutException($repository, $working_directory);
     }
 }
开发者ID:netsensei,项目名称:Rum,代码行数:7,代码来源:Subversion.php

示例7: handle

 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     $options = $this->event->context['scrub_options'];
     $limit = $options['batch_comment'];
     if ($options['retain_content'] || !module_exists('comment')) {
         return;
     }
     if ($options['avoid_oom']) {
         // Orphaned comments, that is comments by an authenticated user or
         // attached to a node that no longer exists, cannot be deleted by
         // comment_delete_multiple. Handle these items first.
         if ($cids = $this->getOrphanedItems($limit)) {
             $orphaned = TRUE;
         } elseif ($cids = $this->getItems($limit)) {
             $orphaned = FALSE;
         }
         if (!empty($cids)) {
             $this->deleteItems($cids, $orphaned);
             $this->event->dispatcher->interrupt();
         }
     } else {
         do {
             if ($cids = $this->getOrphanedItems($limit)) {
                 $orphaned = TRUE;
             } elseif ($cids = $this->getItems($limit)) {
                 $orphaned = FALSE;
             } else {
                 break;
             }
             $this->deleteItems($cids, $orphaned);
         } while (TRUE);
     }
 }
开发者ID:robtryson,项目名称:nysits,代码行数:37,代码来源:AcsfDuplicationScrubCommentHandler.php

示例8: apiGetField

 /**
  * Magic __get, overriding Persistent.
  *
  * @param string $name
  *   Name of the property.
  *
  * @return mixed
  *   Value of set property.
  * @throws \Exception
  */
 public function apiGetField($name)
 {
     $callers = debug_backtrace();
     drush_log(dt('Site @site_name is missing value for @name from @calling_function.', array('@site_name' => $this->name, '@name' => $name, '@calling_function' => $callers[1]['function'])));
     $provider = Switchboard\Provider::getInstance($this->getProvider());
     $provider->siteGetField($this->getName(), $name);
 }
开发者ID:fluxsauce,项目名称:switchboard,代码行数:17,代码来源:Site.php

示例9: getResultInfo

 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     if ($this->registry['size_files_kb'] < 1024) {
         return dt('Files: @size_files_kbkB', array('@size_files_kb' => number_format($this->registry['size_files_kb'])));
     }
     return dt('Files: @size_files_mbMB', array('@size_files_mb' => number_format($this->registry['size_files_kb'] / 1024, 2)));
 }
开发者ID:OPIN-CA,项目名称:checkpoint,代码行数:10,代码来源:SizeFiles.php

示例10: getResultInfo

 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     if ($this->registry['managed_filesize'] < 1048576) {
         return dt('Managed file size: @managed_filesize_kbkB', array('@managed_filesize_kb' => number_format($this->registry['managed_filesize'] / 1024, 2)));
     }
     return dt('Managed file size: @managed_filesize_mbMB', array('@managed_filesize_mb' => number_format($this->registry['managed_filesize'] / 1048576, 2)));
 }
开发者ID:OPIN-CA,项目名称:checkpoint,代码行数:10,代码来源:ManagedFileSize.php

示例11: getResultInfo

 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo() {
   if (empty($this->registry['content_type_counts'])) {
     if (drush_get_option('detail')) {
       return dt('No nodes exist.');
     }
     return '';
   }
   $ret_val = '';
   if (drush_get_option('html') == TRUE) {
     $ret_val .= '<table class="table table-condensed">';
     $ret_val .= "<thead><tr><th>Content Type</th><th>Node Count</th></tr></thead>";
     foreach ($this->registry['content_type_counts'] as $content_type => $count) {
       $ret_val .= "<tr><td>$content_type</td><td>$count</td></tr>";
     }
     $ret_val .= '</table>';
   }
   else {
     $ret_val  = 'Content Type: Count' . PHP_EOL;
     if (!drush_get_option('json')) {
       $ret_val .= str_repeat(' ', 4);
     }
     $ret_val .= '-------------------';
     foreach ($this->registry['content_type_counts'] as $content_type => $count) {
       $ret_val .= PHP_EOL;
       if (!drush_get_option('json')) {
         $ret_val .= str_repeat(' ', 4);
       }
       $ret_val .= $content_type . ': ' . $count;
     }
   }
   return $ret_val;
 }
开发者ID:karlkedrovsky,项目名称:config,代码行数:35,代码来源:ContentTypes.php

示例12: __construct

 /**
  * Class constructor.
  *
  * @param CommandBase $command
  *   The current instance of the command.
  */
 public function __construct(CommandBase $command)
 {
     $this->command = $command;
     // Determine if the "path" option has been set.
     $this->path = drush_get_option('path');
     if ($this->path && !file_exists($this->path)) {
         return drush_set_error('DRUSH_LWG_INVALID_PATH', dt("The specified project path does not exist:\n!path", array('!path' => $this->path)));
     } else {
         if (!$this->path) {
             $this->path = drush_cwd();
         }
     }
     // Ensure the path is writable.
     if (!is_writable($this->path)) {
         return drush_set_error('DRUSH_LWG_PATH_NOT_WRITABLE', dt("The specified project path is not writable:\n!path", array('!path' => $this->path)));
     }
     foreach (drush_scan_directory($this->path, '/\\.info(\\.yml)?/') as $file) {
         if ($this->info = drush_drupal_parse_info_file($file->filename)) {
             $this->name = $file->name;
             break;
         }
     }
     if (!$this->getInfo('name')) {
         return drush_set_error('DRUSH_LWG_NOT_PROJECT', dt('Project info not found. Please navigate to a valid project directory or specify one with the --path option.'));
     }
     // Indicate that this is a valid project.
     $this->valid = TRUE;
 }
开发者ID:markcarver,项目名称:drush-lwg,代码行数:34,代码来源:Project.php

示例13: getResultInfo

 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo() {
   if (!isset($this->registry['vocabulary_counts'])) {
     return dt('The taxonomy module is not enabled.');
   }
   if (empty($this->registry['vocabulary_counts'])) {
     if (drush_get_option('detail')) {
       return dt('No vocabularies exist.');
     }
     return '';
   }
   $ret_val = '';
   if (drush_get_option('html') == TRUE) {
     $ret_val .= '<table class="table table-condensed">';
     $ret_val .= "<thead><tr><th>Vocabulary</th><th>Terms</th></tr></thead>";
     foreach ($this->registry['vocabulary_counts'] as $vocabulary => $count) {
       $ret_val .= "<tr><td>$vocabulary</td><td>$count</td></tr>";
     }
     $ret_val .= '</table>';
   }
   else {
     $ret_val  = 'Vocabulary: Count' . PHP_EOL;
     if (!drush_get_option('json')) {
       $ret_val .= str_repeat(' ', 4);
     }
     $ret_val .= '-------------------';
     foreach ($this->registry['vocabulary_counts'] as $vocabulary => $count) {
       $ret_val .= PHP_EOL;
       if (!drush_get_option('json')) {
         $ret_val .= str_repeat(' ', 4);
       }
       $ret_val .= $vocabulary . ': ' . $count;
     }
   }
   return $ret_val;
 }
开发者ID:karlkedrovsky,项目名称:config,代码行数:38,代码来源:Vocabularies.php

示例14: rollback

 /**
  * Rolls back the configured migrations.
  */
 public function rollback()
 {
     $log = new DrushLogMigrateMessage();
     $query = \Drupal::entityQuery('migration');
     $names = $query->execute();
     // Order the migrations according to their dependencies.
     /** @var MigrationInterface[] $migrations */
     $migrations = \Drupal::entityManager()->getStorage('migration')->loadMultiple($names);
     // Assume we want all those tagged 'Drupal %'.
     foreach ($migrations as $migration_id => $migration) {
         $keep = FALSE;
         $tags = $migration->get('migration_tags');
         foreach ($tags as $tag) {
             if (strpos($tag, 'Drupal ') === 0) {
                 $keep = TRUE;
                 break;
             }
         }
         if (!$keep) {
             unset($migrations[$migration_id]);
         }
     }
     // Roll back in reverse order.
     $this->migrationList = array_reverse($migrations);
     foreach ($this->migrationList as $migration_id => $migration) {
         drush_print(dt('Rolling back @migration', ['@migration' => $migration_id]));
         $executable = new MigrateExecutable($migration, $log);
         // drush_op() provides --simulate support.
         drush_op([$executable, 'rollback']);
         $migration->delete();
     }
 }
开发者ID:dmyerson,项目名称:d8ecs,代码行数:35,代码来源:MigrateUpgradeDrushRunner.php

示例15: handle

 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     $tables = array();
     // Invalidate search indexes. If the search module has never been enabled,
     // then it's not enabled now and this block is skipped.
     if (module_exists('search')) {
         // Call this function to ensure that the necessary search hooks get
         // called.
         search_reindex();
         // Calling search_reindex globally (with no parameters) invokes hooks, but
         // does not truncate the following tables:
         $tables[] = 'search_dataset';
         $tables[] = 'search_index';
         $tables[] = 'search_node_links';
         $tables[] = 'search_total';
     }
     $tables[] = 'accesslog';
     $tables[] = 'node_counter';
     $tables[] = 'batch';
     $tables[] = 'queue';
     $tables[] = 'semaphore';
     $tables[] = 'sessions';
     $tables[] = 'themebuilder_session';
     $this->truncateTables($tables);
 }
开发者ID:robtryson,项目名称:nysits,代码行数:29,代码来源:AcsfDuplicationScrubTruncateTablesHandler.php


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