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


PHP Strings::normalize方法代码示例

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


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

示例1: startQuery

 public function startQuery($sql, array $params = null, array $types = null)
 {
     $highlighted = Panel::highlightQuery(Panel::formatQuery($sql, (array) $params, (array) $types));
     $formatted = html_entity_decode(strip_tags($highlighted));
     $formatted = preg_replace('#^[\\t ]+#m', '', Nette\Utils\Strings::normalize($formatted));
     $message = '-- process ' . getmypid() . '; ' . Debugger::$source . "\n" . $formatted . "\n\n";
     file_put_contents($this->file, $message, FILE_APPEND);
 }
开发者ID:Richmond77,项目名称:learning-nette,代码行数:8,代码来源:FileLogger.php

示例2: createComponentGrid

 /**
  * factory to grid component
  * @param string $name
  * @return \Ublaboo\DataGrid\DataGrid
  */
 public function createComponentGrid($name)
 {
     $datasource = $this->model->getQuery()->study()->setDestination($this->remoteAet)->setRequestedFields($this->tableRows);
     if ($this->isExternist) {
         $datasource->addCondition("ReferringPhysicianName", $this->externistKey);
     }
     //create grid and set data source
     $grid = new \Ublaboo\DataGrid\DataGrid($this, $name);
     // setting datasource
     $grid->setPrimaryKey('StudyInstanceUID');
     $grid->setDataSource($datasource);
     // setting outer filter rendering
     $grid->setOuterFilterRendering(TRUE);
     // set columns hidable
     $grid->setColumnsHideable();
     //add collumn Patient ID which is sortable and may be filtered
     $grid->addColumnText('PatientID', _("PatientID"))->setSortable()->setFilterText();
     //add collumn Patient Name which is sortable and may be filtered
     $grid->addColumnText('PatientName', _("Patient name"))->setSortable()->setFilterText();
     //add collumn Study description Name which is sortable and may be filtered
     $grid->addColumnText('StudyDescription', _("Study description"))->setRenderer(function ($item) {
         return $this->model->query->encodeDicomName($item["StudyDescription"]);
     })->setSortable()->setFilterText();
     //add collumn Patient Name which is sortable and may be filtered
     $grid->addColumnText('PatientSex', _("Patient sex"))->setSortable()->setRenderer(function ($item) {
         $sexItems = $this->model->query->getConfig()["patientSexItems"];
         return $sexItems[\Nette\Utils\Strings::normalize($item["PatientSex"])];
     })->setFilterSelect($this->model->query->getConfig()["patientSexItems"]);
     //add collumn Study modality which is sortable and may be filtered
     $grid->addColumnText('Modality', _("Study modality"))->setSortable()->setFilterText();
     //add collumn Study date which is sortable and may be filtered
     $grid->addColumnDateTime('StudyDate', _("Study date"))->setFormat('Y-m-d')->setSortable()->setFilterDateRange();
     $grid->addColumnDateTime('StudyTime', _("Study time"))->setSortable()->setRenderer(function ($item) {
         return $this->model->query->encodeTime($item["StudyTime"]);
     });
     if ($this->isLocal) {
         // add action show
         $grid->addAction(':Data:Viewer:default', _('Open'))->setClass('btn btn-xs btn-default')->setIcon('folder-open-o');
         // add action send #
         $grid->addAction('sendStudyForm!', _('Send'))->setIcon('upload')->setClass('btn btn-xs btn-default ajax modalOpen')->setDataAttribute("toggle", "modal")->setDataAttribute("target", "#sendFormModal");
         // add action export
         $grid->addAction('export!', _('Export'))->setIcon('share-square-o')->setDataAttribute("toggle", "modal")->setDataAttribute("target", "#exportModal");
         // add action delete
         if ($this->user->isAllowed("data", "delete")) {
             $grid->addAction('deleteStudy!', _('Delete'))->setIcon('trash-o')->setClass('btn btn-xs btn-default')->setConfirm(_('Do you really want to delete this study?'));
         }
     } else {
         // add action show
         $grid->addAction('open!', _('Open'))->setIcon('folder-open-o');
         // add action retrieve #
         $grid->addAction('retrieve!', _('Retrieve'))->setDataAttribute("toggle", "modal")->setDataAttribute("target", "#retrieveModal")->setIcon('download');
     }
     // setting pagination
     $grid->setItemsPerPageList([20, 50, 100, 500]);
     // return grid
     return $grid;
 }
开发者ID:OCC2,项目名称:occ2pacs,代码行数:62,代码来源:BrowserPresenter.php

示例3: lex

 /**
  * @param string $config
  * @return TokenIterator tokens
  * @throws ConfigException
  */
 public function lex($config)
 {
     $normalized = Strings::normalize($config);
     // remove meaningless leading spacing to simplify T_KEYWORD
     $simplified = Strings::replace($normalized, '~^\\s+~m', '');
     try {
         $tokens = $this->getTokenizer()->tokenize($simplified);
         return new TokenIterator($tokens);
     } catch (TokenizerException $e) {
         throw ConfigException::createFromLexerException($e);
     }
 }
开发者ID:Mikulas,项目名称:ssh-config,代码行数:17,代码来源:Lexer.php

示例4: diff

 public static function diff($original, $replacement)
 {
     $original = \Nette\Utils\Strings::normalize($original);
     $replacement = \Nette\Utils\Strings::normalize($replacement);
     if ($original == $replacement) {
         //no change
         return Html::el('span', ['style' => 'color:blue;'])->setHtml($original);
     } elseif ($original == '') {
         //no original text
         return Html::el('span', ['style' => 'color:green;'])->setHtml($replacement);
     } elseif ($replacement == '') {
         //no replacement text
         return Html::el('span', ['style' => 'color:red;'])->setHtml($original);
     } else {
         //text is different
         return HTML::el('span')->add(Html::el('span', ['style' => 'color:red;'])->setHtml($original))->add(Html::el('br'))->add(Html::el('span', ['style' => 'color:green;'])->setHtml($replacement));
     }
 }
开发者ID:patrickkusebauch,项目名称:27skauti,代码行数:18,代码来源:Helpers.php

示例5: fetchSubtitles

 protected function fetchSubtitles($youtubeId, $cached)
 {
     $url = "https://report.khanovaskola.cz/api/1/subtitles/{$youtubeId}/cs" . ($cached ? '?cached=1' : '');
     $res = @file_get_contents($url);
     // was failing randomly
     if (!$res) {
         return NULL;
     }
     if ($cached) {
         $headers = $http_response_header;
         if (strpos($headers[0], 'HTTP/1.1 304') !== FALSE) {
             return $cached;
         }
     }
     $data = json_decode($res);
     if ($data->found) {
         return Strings::normalize(Strings::fixEncoding($data->subtitles));
     }
     return NULL;
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:20,代码来源:RemoteSubtitles.php

示例6: renderDefault

 public function renderDefault($search)
 {
     //FIXME tagy ::: 'publish_date <=' => new \DateTime()
     $string = Strings::lower(Strings::normalize($search));
     $string = Strings::replace($string, '/[^\\d\\w]/u', ' ');
     $words = Strings::split(Strings::trim($string), '/\\s+/u');
     $words = array_unique(array_filter($words, function ($word) {
         return Strings::length($word) > 1;
     }));
     $words = array_map(function ($word) {
         return Strings::toAscii($word);
     }, $words);
     $string = implode(' ', $words);
     $this->template->tag = $this->tags->findOneBy(['name' => $string]);
     $result = $this->posts->fulltextSearch($string);
     if (count($result) == 0) {
         $this->template->search = $search;
         $this->template->error = 'Nic nebylo nalezeno';
     } else {
         $this->template->search = $search;
         $this->template->result = $result;
     }
 }
开发者ID:krausv,项目名称:www.zeminem.cz,代码行数:23,代码来源:SearchPresenter.php

示例7: convertEncoding

 /**
  * @param CurlWrapper $curl
  * @return string
  */
 public static function convertEncoding(CurlWrapper $curl)
 {
     if (Strings::checkEncoding($response = $curl->response)) {
         return Strings::normalize($response);
     }
     if ($charset = static::charsetFromContentType($curl->info['content_type'])) {
         $response = @iconv($charset, 'UTF-8', $response);
     } else {
         if ($contentType = Strings::match($response, '~<(?P<el>meta[^>]+Content-Type[^>]+)>~i')) {
             foreach (Nette\Utils\Html::el($contentType['el'])->attrs as $attr => $value) {
                 if (strtolower($attr) !== 'content') {
                     continue;
                 }
                 if ($charset = static::charsetFromContentType($value)) {
                     $response = @iconv($charset, 'UTF-8', $response);
                     $response = static::fixContentTypeMeta($response);
                     break;
                 }
             }
         }
     }
     return Strings::normalize($response);
 }
开发者ID:noikiy,项目名称:Curl,代码行数:27,代码来源:HtmlResponse.php

示例8: __toString

 /**
  * @return string  PHP code
  */
 public function __toString()
 {
     $consts = array();
     foreach ($this->consts as $name => $value) {
         $consts[] = "const {$name} = " . Helpers::dump($value) . ";\n";
     }
     $properties = array();
     foreach ($this->properties as $property) {
         $doc = str_replace("\n", "\n * ", implode("\n", (array) $property->getDocuments()));
         $properties[] = ($property->getDocuments() ? strpos($doc, "\n") === FALSE ? "/** {$doc} */\n" : "/**\n * {$doc}\n */\n" : '') . $property->getVisibility() . ($property->isStatic() ? ' static' : '') . ' $' . $property->getName() . ($property->value === NULL ? '' : ' = ' . Helpers::dump($property->value)) . ";\n";
     }
     $extends = $implements = $traits = array();
     if ($this->namespace) {
         foreach ((array) $this->extends as $name) {
             $extends[] = $this->namespace->unresolveName($name);
         }
         foreach ((array) $this->implements as $name) {
             $implements[] = $this->namespace->unresolveName($name);
         }
         foreach ((array) $this->traits as $name) {
             $traits[] = $this->namespace->unresolveName($name);
         }
     } else {
         $extends = (array) $this->extends;
         $implements = (array) $this->implements;
         $traits = (array) $this->traits;
     }
     foreach ($this->methods as $method) {
         $method->setNamespace($this->namespace);
     }
     return Strings::normalize(($this->documents ? str_replace("\n", "\n * ", "/**\n" . implode("\n", (array) $this->documents)) . "\n */\n" : '') . ($this->abstract ? 'abstract ' : '') . ($this->final ? 'final ' : '') . $this->type . ' ' . $this->name . ' ' . ($this->extends ? 'extends ' . implode(', ', $extends) . ' ' : '') . ($this->implements ? 'implements ' . implode(', ', $implements) . ' ' : '') . "\n{\n\n" . Strings::indent(($this->traits ? 'use ' . implode(', ', $traits) . ";\n\n" : '') . ($this->consts ? implode('', $consts) . "\n\n" : '') . ($this->properties ? implode("\n", $properties) . "\n\n" : '') . implode("\n\n\n", $this->methods), 1) . "\n\n}") . "\n";
 }
开发者ID:jave007,项目名称:test,代码行数:35,代码来源:ClassType.php

示例9: addAdmin

 public function addAdmin($name)
 {
     $this->fbAdmins[] = Nette\Utils\Strings::normalize($name);
     return $this;
     //fluent interface
 }
开发者ID:rostenkowski,项目名称:nette-plugins,代码行数:6,代码来源:OpenGraphTags.php

示例10: __toString

 /**
  * @return string PHP code
  */
 public function __toString() : string
 {
     foreach ($this->namespaces as $namespace) {
         $namespace->setBracketedSyntax(isset($this->namespaces[NULL]));
     }
     return Strings::normalize("<?php\n" . ($this->comment ? "\n" . str_replace("\n", "\n * ", "/**\n" . $this->comment) . "\n */\n\n" : '') . implode("\n\n", $this->namespaces)) . "\n";
 }
开发者ID:kukulich,项目名称:php-generator,代码行数:10,代码来源:PhpFile.php

示例11: validate

 /**
  * Validate.
  */
 public function validate()
 {
     if (!ob_get_level()) {
         return;
     }
     $this->html = Strings::normalize(ob_get_contents());
     ob_end_flush();
     libxml_use_internal_errors(true);
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->resolveExternals = FALSE;
     $dom->validateOnParse = TRUE;
     $dom->preserveWhiteSpace = FALSE;
     $dom->strictErrorChecking = TRUE;
     $dom->recover = TRUE;
     set_error_handler(function ($severity, $message) {
         restore_error_handler();
     });
     @$dom->loadHTML($this->html);
     restore_error_handler();
     $this->errors = array_filter(libxml_get_errors(), function (\LibXMLError $error) {
         return !in_array((int) $error->code, ValidatorPanel::$ignoreErrors, TRUE);
     });
     libxml_clear_errors();
 }
开发者ID:simPod,项目名称:HtmlValidatorPanel,代码行数:27,代码来源:ValidatorPanel.php

示例12: processFunction

 private function processFunction(array $definition, Node $node)
 {
     $message = array(Context::LINE => $node->getLine());
     foreach ($definition as $position => $type) {
         if (!isset($node->args[$position - 1])) {
             return;
         }
         $arg = $node->args[$position - 1]->value;
         if ($arg instanceof String_) {
             $message[$type] = $arg->value;
         } elseif ($arg instanceof Array_) {
             foreach ($arg->items as $item) {
                 if ($item->value instanceof String_) {
                     $message[$type][] = $item->value->value;
                 }
             }
         } else {
             return;
         }
     }
     if (is_array($message[Context::SINGULAR])) {
         foreach ($message[Context::SINGULAR] as $value) {
             $tmp = $message;
             $tmp[Context::SINGULAR] = Strings::normalize($value);
             $this->data[] = $tmp;
         }
     } else {
         $message[Context::SINGULAR] = Strings::normalize($message[Context::SINGULAR]);
         $this->data[] = $message;
     }
 }
开发者ID:bazo,项目名称:nette-translation,代码行数:31,代码来源:PHP.php

示例13: createComponentForm

 /**
  * DataGrit form
  * @param Form $form
  * @return Form 
  */
 public function createComponentForm()
 {
     $form = new Form();
     //create filter form elements
     foreach ($this->th as $key => $value) {
         if ($value->filter) {
             switch ($value->filter) {
                 case 'text':
                     $form->addText($key)->getControlPrototype()->class('filter-' . $value->filter);
                     break;
                 case 'date':
                     $form->addText($key)->setHtmlId($this->name . '-' . $key . '-date-filter')->getControlPrototype()->class('filter-' . $value->filter);
                     break;
                 case 'int':
                     $form->addText($key)->getControlPrototype()->class('filter-' . $value->filter);
                     break;
                 case 'select':
                     $form->addSelect($key, NULL, $value->select)->getControlPrototype()->class('filter-' . $value->filter);
                     break;
                 case 'bool':
                     $form->addSelect($key, '', array('yes' => 'Áno', 'no' => 'Nie'))->setPrompt('')->getControlPrototype()->class('filter-' . $value->filter);
                     break;
             }
         }
     }
     $form->addSubmit('filter', 'Filtrovať')->getControlPrototype()->class('grid-submit-filter');
     $self = $this;
     $th = $this->th;
     $form->onSuccess[] = function ($form) use($self, $th) {
         $set_values = array();
         foreach ($form->values as $key => $value) {
             $value = Strings::normalize($value);
             if (!empty($value)) {
                 $set_values[$key] = array('value' => $th[$key]->filter == 'bool' ? $self->stringToBool($value) : $value, 'kind' => $th[$key]->filter);
             }
         }
         $self->filter = $set_values;
         $self->page = '1';
         $self->finalize();
     };
     return $form;
 }
开发者ID:ricco24,项目名称:DataGrid,代码行数:47,代码来源:DataGrid.php

示例14: __toString

 /**
  * @return string  PHP code
  */
 public function __toString()
 {
     $consts = array();
     foreach ($this->consts as $name => $value) {
         $consts[] = "const {$name} = " . Helpers::dump($value) . ";\n";
     }
     $properties = array();
     foreach ($this->properties as $property) {
         $doc = str_replace("\n", "\n * ", implode("\n", $property->getDocuments()));
         $properties[] = ($property->getDocuments() ? strpos($doc, "\n") === FALSE ? "/** {$doc} */\n" : "/**\n * {$doc}\n */\n" : '') . $property->getVisibility() . ($property->isStatic() ? ' static' : '') . ' $' . $property->getName() . ($property->value === NULL ? '' : ' = ' . Helpers::dump($property->value)) . ";\n";
     }
     $namespace = $this->namespace;
     $mapper = function (array $arr) use($namespace) {
         return $namespace ? array_map(array($namespace, 'unresolveName'), $arr) : $arr;
     };
     return Strings::normalize(($this->documents ? str_replace("\n", "\n * ", "/**\n" . implode("\n", $this->documents)) . "\n */\n" : '') . ($this->abstract ? 'abstract ' : '') . ($this->final ? 'final ' : '') . $this->type . ' ' . $this->name . ' ' . ($this->extends ? 'extends ' . implode(', ', $mapper((array) $this->extends)) . ' ' : '') . ($this->implements ? 'implements ' . implode(', ', $mapper($this->implements)) . ' ' : '') . "\n{\n" . Strings::indent(($this->traits ? 'use ' . implode(";\nuse ", $mapper($this->traits)) . ";\n\n" : '') . ($this->consts ? implode('', $consts) . "\n" : '') . ($this->properties ? implode("\n", $properties) . "\n" : '') . ($this->methods ? "\n" . implode("\n\n\n", $this->methods) . "\n\n" : ''), 1) . '}') . "\n";
 }
开发者ID:luminousinfoways,项目名称:pccfoas,代码行数:20,代码来源:ClassType.php

示例15: addSpecialClass

 /**
  * @param string $specialClass
  * @return \Illagrenan\Navigation\NavigationNode
  */
 public function addSpecialClass($specialClass)
 {
     if (Validators::isUnicode($specialClass) === FALSE) {
         throw new Exceptions\InvalidSpecialClassException("Given \"" . $specialClass . "\" is not valid special class.");
     }
     $specialClass = Strings::trim($specialClass);
     $specialClass = Strings::normalize($specialClass);
     $specialClass = Strings::toAscii($specialClass);
     $this->specialClass[] = $specialClass;
     return $this;
 }
开发者ID:illagrenan,项目名称:nette-navigation-control,代码行数:15,代码来源:NavigationNode.php


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