Вход Регистрация
Файл: concrete5.7.5.6/concrete/src/Url/Components/Path.php
Строк: 31
<?php
namespace ConcreteCoreUrlComponents;

/**
 * c5 specific path component for league/url
 */
class Path extends LeagueUrlComponentsPath
{

    protected 
$trail false;

    
/**
     * @param LeagueUrlComponentsPath $old_path
     * @param bool                        $trailing_slash
     */
    
public function __construct($data$trailing_slash false) {
        
$this->set($data);
        
$this->trail = !!$trailing_slash;
    }

    
/**
     * {@inheritdoc}
     */
    
public function get()
    {
        
$res = array();
        foreach (
array_values($this->data) as $value) {
            
$res[] = rawurlencode($value);
        }
        if (!
$res) {
            return 
null;
        }

        foreach (
$res as $key => $value) {
            if (
$value === '') {
                unset(
$res[$key]);
            }
        }

        return 
implode($this->delimiter$res) . ((!!$this->trail && $res) ? '/' '');
    }

    public function 
withoutDispatcher()
    {
        
$path = clone $this;
        if (
$path[0] == DISPATCHER_FILENAME) {
            
$path->offsetUnset(0);
        }

        return 
$path;
    }

}
Онлайн: 1
Реклама