Base::fixslashes PHP Méthode

fixslashes() public méthode

Convert backslashes to slashes
public fixslashes ( $str ) : string
$str string
Résultat string
    function fixslashes($str)
    {
        return $str ? strtr($str, '\\', '/') : $str;
    }

Usage Example

Exemple #1
0
 /**
  * add an asset
  * @param string $path
  * @param string $type
  * @param string $group
  * @param int $priority
  * @param string $slot
  * @param array $params
  */
 public function add($path, $type, $group = 'head', $priority = 5, $slot = null, $params = null)
 {
     if (!isset($this->assets[$group])) {
         $this->assets[$group] = array();
     }
     if (!isset($this->assets[$group][$type])) {
         $this->assets[$group][$type] = array();
     }
     $asset = array('path' => $path, 'type' => $type, 'slot' => $slot, 'origin' => '') + ($params ?: array());
     if (preg_match('/^(http(s)?:)?\\/\\/.*/i', $path)) {
         $asset['origin'] = 'external';
         $this->assets[$group][$type][$priority][] = $asset;
         return;
     }
     foreach ($this->f3->split($this->f3->get('UI')) as $dir) {
         if (is_file($view = $this->f3->fixslashes($dir . $path))) {
             $asset['path'] = ltrim($view, './');
             $asset['origin'] = 'internal';
             $this->assets[$group][$type][$priority][] = $asset;
             return;
         }
     }
     // file not found
     if ($handler = $this->f3->get('ASSETS.onFileNotFound')) {
         $this->f3->call($handler, array($path, $this));
     }
     $this->assets[$group][$type][$priority][] = $asset;
 }