示例#1
0
 /**
  * Get backend dependency message
  * TODO: move into AppFramework along with templates
  *
  * @param Backend[] $backends
  * @return string
  */
 public static function dependencyMessage($backends)
 {
     $l = \OC::$server->getL10N('files_external');
     $message = '';
     $dependencyGroups = [];
     foreach ($backends as $backend) {
         foreach ($backend->checkDependencies() as $dependency) {
             if ($message = $dependency->getMessage()) {
                 $message .= '<br />' . $l->t('<b>Note:</b> ') . $message;
             } else {
                 $dependencyGroups[$dependency->getDependency()][] = $backend;
             }
         }
     }
     foreach ($dependencyGroups as $module => $dependants) {
         $backends = implode(', ', array_map(function ($backend) {
             return '<i>' . $backend->getText() . '</i>';
         }, $dependants));
         $message .= '<br />' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends);
     }
     return $message;
 }
示例#2
0
文件: config.php 项目: Romua1d/core
 private static function generateDependencyMessage($dependencies)
 {
     $l = new \OC_L10N('files_external');
     $dependencyMessage = '';
     foreach ($dependencies as $module => $backends) {
         $dependencyGroup = array();
         foreach ($backends as $backend) {
             if (is_array($backend)) {
                 $dependencyMessage .= '<br />' . $l->t('<b>Note:</b> ') . $backend['message'];
             } else {
                 $dependencyGroup[] = $backend;
             }
         }
         $dependencyGroupCount = count($dependencyGroup);
         if ($dependencyGroupCount > 0) {
             $backends = '';
             for ($i = 0; $i < $dependencyGroupCount; $i++) {
                 if ($i > 0 && $i === $dependencyGroupCount - 1) {
                     $backends .= $l->t(' and ');
                 } elseif ($i > 0) {
                     $backends .= ', ';
                 }
                 $backends .= '<i>' . $dependencyGroup[$i] . '</i>';
             }
             $dependencyMessage .= '<br />' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends);
         }
     }
     return $dependencyMessage;
 }