private function validate($name, $domain)
    {
        // check if a page exists
        if( !\Config::get('urlSuffix') && ( $objPages = \PageModel::findByAlias( $name ) ) !== null )
        {
            // check if short url has a domain
            if( $domain > 0 )
            {
                $valid = true;
                while( $objPages->next() )
                {
                    // load page details
                    $objPages->current()->loadDetails();

                    // if one of the found pages is within the same domain, do not allow it
                    if( $objPages->rootId == $domain )
                    {
                        $valid = false;
                        break;
                    }
                }

                if( $valid )
                    return;         
            }

            // otherwise throw exception
            throw new Exception(sprintf($GLOBALS['TL_LANG']['tl_short_urls']['pageExists'], $name));
        }
    }
private function validate($name, $domain)
    {
        // check if a page exists
        if( !\Config::get('urlSuffix') && ( $objPages = \PageModel::findByAlias( $name ) ) !== null )
        {
            // check if short url has a domain
            if( $domain > 0 )
            {
                $valid = true;
                while( $objPages->next() )
                {
                    // load page details
                    $objPages->current()->loadDetails();

                    // if one of the found pages is within the same domain, do not allow it
                    if( $objPages->rootId == $domain )
                    {
                        $valid = false;
                        break;
                    }
                }

                if( $valid )
                    return;         
            }

            // otherwise throw exception
            throw new Exception(sprintf($GLOBALS['TL_LANG']['tl_short_urls']['pageExists'], $name));
        }
    }
private function validate ( $ name , $ domain ) { // check if a page exists if ( ! \ Config :: get ( 'urlSuffix' ) && ( $ objPages = \ PageModel :: findByAlias ( $ name ) ) !== null ) { // check if short url has a domain if ( $ domain > 0 ) { $ valid = true ; while ( $ objPages -> next ( ) ) { // load page details $ objPages -> current ( ) -> loadDetails ( ) ; // if one of the found pages is within the same domain, do not allow it if ( $ objPages -> rootId == $ domain ) { $ valid = false ; break ; } } if ( $ valid ) return ; } // otherwise throw exception throw new Exception ( sprintf ( $ GLOBALS [ 'TL_LANG' ] [ 'tl_short_urls' ] [ 'pageExists' ] , $ name ) ) ; } }
Validate the name of a short url
@param  string $name
@param  string $domain
@return void
Validate the name of a short url