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


PHP Strings::sanitize_u方法代码示例

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


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

示例1: getByName

 public function getByName($name, $type, $transpose = 0)
 {
     $this->name = Strings::ucfirst($name);
     $this->type = Strings::sanitize_u($type);
     $notes = $this->getNotes();
     if (in_array($this->type, array_keys($this->config))) {
         $start = array_keys($notes, $this->name);
         $note_sum = sizeof($notes) - 1;
         if (count($start) > 0) {
             if ($start[0] + $transpose < 0) {
                 $current = $start[0] + $transpose + $note_sum + 1;
             } else {
                 if ($start[0] + $transpose > $note_sum) {
                     $current = $start[0] + $transpose - $note_sum - 1;
                 } else {
                     $current = $start[0] + $transpose;
                 }
             }
             $this->chord[] = $notes[$current];
             foreach ($this->config[$this->type] as $num) {
                 $current += $num;
                 if ($current > $note_sum) {
                     $current -= $note_sum + 1;
                 }
                 $this->chord[] = $notes[$current];
             }
             return $this->chord;
         }
     }
 }
开发者ID:Acoustics,项目名称:jbLibrary,代码行数:30,代码来源:chord.php

示例2: getByChords

 public function getByChords($chords)
 {
     $_chord = new Chord();
     $notes = array();
     foreach ($chords as $chord) {
         $name = Strings::ucfirst($chord["name"]);
         $type = Strings::sanitize_u($chord["type"]);
         $_chord->getByName($name, $type);
         $notes = array_merge($notes, $_chord->notes);
     }
     $notes = array_unique($notes);
     $this->possible = array();
     $scales = $this->getTypes();
     for ($i = 0; $i < 12; $i++) {
         foreach ($scales as $scale) {
             $this->scale = null;
             $this->getByName("C", $scale, $i);
             if ($this->containsNotes($notes, $this->scale)) {
                 array_push($this->possible, array("name" => current($this->scale), "type" => $scale));
             }
         }
     }
     return $this->possible;
 }
开发者ID:Acoustics,项目名称:jbLibrary,代码行数:24,代码来源:scale.php


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