low() public static méthode

Make a string lowercase
public static low ( string $string ) : string
$string string
Résultat string
Exemple #1
0
 /**
  * Less process file.
  *
  * @param string $source ("Example: MyPlugin.path/to/file.less")
  * @param bool|false $force
  * @throws \JBZoo\Less\Exception
  * @return string
  */
 public function process($source, $force = false)
 {
     $file = $this->_path->isVirtual($source) ? $this->_path->get($source) : $this->_path->get('root:' . $source);
     try {
         if ($force) {
             $this->config('force', true);
         }
         $less = new Less($this->_config);
         if (!FS::isFile($file)) {
             return $source;
         }
         list($source, $isExpired) = $less->compile($file);
         if ($isExpired) {
             $cacheId = FS::firstLine($source);
             $comment = '/* resource: ' . $this->_path->url($file) . ' */' . PHP_EOL;
             $fileHead = implode('', [$cacheId, Str::low($comment)]);
             $css = $this->_normalizeContent($source, $fileHead);
             $this->_write($source, $css);
         }
         $source = $this->_path->url(FS::clean($source, '/'));
         return $source;
     } catch (InternalErrorException $e) {
         throw new InternalErrorException($e->getMessage());
     }
 }
Exemple #2
0
 /**
  * Render empty role rows.
  *
  * @param array $roles
  * @return string
  */
 public function emptyRoleRows($roles = [])
 {
     $html = [];
     foreach ($roles as $role) {
         $html[] = $this->Html->tag('td', null, ['class' => 'aro-lb-' . Str::low($role)]);
     }
     return implode('', $html);
 }
Exemple #3
0
 /**
  * @return string
  */
 protected function _getResultFile()
 {
     // Normalize relative path
     $relPath = Slug::filter($this->_hash, '_');
     $relPath = Str::low($relPath);
     // Gett full clean path
     $fullPath = FS::real($this->_options->get('cache_path')) . '/' . $relPath . '.css';
     $fullPath = FS::clean($fullPath);
     return $fullPath;
 }
Exemple #4
0
 /**
  * Get and register render.
  *
  * @param string $render
  * @param string $ns
  * @return mixed
  */
 public static function _($render, $ns = __NAMESPACE__)
 {
     $html = self::getInstance();
     $render = Str::low($render);
     $alias = $ns . '\\' . $render;
     if (!isset($html[$alias])) {
         $html[$alias] = self::_register($render, $ns);
     }
     return $html[$alias];
 }
Exemple #5
0
 /**
  * Output content.
  *
  * @param string $name
  * @param array $attrs
  * @param int $checked
  * @param bool|true $isLblWrap
  * @return string
  */
 public function render($name, $checked = 0, array $attrs = array(), $isLblWrap = true)
 {
     $this->_type = Str::low($this->_type);
     if ($this->_type === 'radio') {
         $options = array(0 => $this->_translate('No'), 1 => $this->_translate('Yes'));
         return Html::_('radio')->render($options, $name, $checked, $attrs, $isLblWrap);
     } elseif ($this->_type === 'checkbox') {
         $options = array(1 => $this->_translate('Yes'));
         return Html::_('checkbox')->render($options, $name, $checked, $attrs, $isLblWrap);
     }
 }
Exemple #6
0
 /**
  * Get current plugin name.
  *
  * @param string $plugin
  * @return string
  */
 public static function getName($plugin = 'Union/Core')
 {
     $plugin = FS::clean($plugin, '/');
     $name = $plugin;
     if (strpos($plugin, '/')) {
         list(, $name) = explode('/', $plugin);
         if (Str::low($name) == 'core') {
             $name = 'union';
         }
     }
     return Inflector::camelize($name);
 }
Exemple #7
0
 /**
  * First char to upper, other to lower
  *
  * @param $input
  * @return string
  */
 public static function ucfirst($input)
 {
     $string = Str::low($input);
     $string = ucfirst($string);
     return $string;
 }
Exemple #8
0
 /**
  * Create buttons.
  *
  * @param string $type
  * @param string $title
  * @param array $options
  * @return $this
  */
 protected function _createBtn($type, $title, array $options = [])
 {
     $jsQuery = Str::low($this->_controller) . '.' . Str::low($type);
     $options['onclick'] = "\$(this).UnionToolBarSubmit('" . $jsQuery . "');";
     if ($this->_checkBtn($type)) {
         $this->_tools[$type] = $this->Button->{$type}($title, $options);
     }
     return $this;
 }
Exemple #9
0
 public function testMBString()
 {
     isSame(Str::isMBString(), function_exists('mb_strtoupper'));
     isSame(Str::isOverload(), (int) ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING);
     is(5, Str::len('Денис'));
     isSame(1, Str::pos('Денис', 'е'));
     isSame(false, Str::pos('Денис', 'Е'));
     isSame(3, Str::rpos('Денис', 'и'));
     isSame(1, Str::ipos('Денис', 'Е'));
     isSame(1, Str::ipos('Денис', 'Е'));
     isSame('енис', Str::strstr('Денис', 'е'));
     isSame('енис', Str::istr('Денис', 'Е'));
     isSame('ис', Str::rchr('Денис', 'и'));
     isSame('нис', Str::sub('Денис', 2));
     isSame('ени', Str::sub('Денис', 1, 3));
     isSame('денис', Str::low('ДЕНИС'));
     isSame('ДЕНИС', Str::up('денис'));
     isSame(2, Str::subCount('денис ДеНИС', 'е'));
     isSame(1, Str::subCount('денис ДеНИС', 'И'));
     isTrue(Str::isStart('денис', 'ден', true));
     isTrue(Str::isStart('денис', 'ДЕН', false));
     isFalse(Str::isStart('денис', 'ДЕН', true));
     isTrue(Str::isEnd('денис', 'нис', true));
     isTrue(Str::isEnd('денис', 'НИС', false));
     isFalse(Str::isEnd('денис', 'ДЕНИС', true));
 }
Exemple #10
0
 /**
  * Get request by classes.
  *
  * @param string|array $classes
  * @return string
  */
 public function requestClasses($classes = [])
 {
     $request = $this->request;
     $class = ['view-' . Str::low($request->param('controller')), 'action-' . Str::low($request->param('action'))];
     if ($plugin = $request->param('plugin')) {
         $plugin = Inflector::slug($plugin);
         $class[] = 'plg-' . Str::low($plugin);
     }
     return implode(' ', array_merge($class, (array) $classes));
 }