Find a Item using their url.
@param string $url Slug of Product to find.
@param mixed|null $nb_language Language to search the Slug.
@return CNabuMediotecaItem|false Returns the Product instance if exists or false if not.
556095
public function findItemByURL(string $url, $nb_language = null)
    {
        $retval = false;
        $nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);

        $this->getItems()->iterate(
            function ($key, CNabuMediotecaItem $nb_item)
                 use (&$retval, $url, $nb_language_id)
            {
                if (is_numeric($nb_language_id) &&
                    ($nb_translation = $nb_item->getTranslation($nb_language_id)) instanceof CNabuMediotecaItemLanguage &&
                    $nb_translation->getURL() === $url
                ) {
                    $retval = $nb_item;
                } else {
                    $nb_item->getTranslations()->iterate(
                        function ($key, CNabuMediotecaItemLanguage $nb_translation)
                             use (&$retval, $nb_item, $url)
                        {
                            if ($nb_translation->getURL() === $url) {
                                $retval = $nb_item;
                            }
                            return !$retval;
                        }
                    );
                }
                return !$retval;
            }
        );

        return $retval;
    }
313916
public function findBlogsByURL($url)
    {
        $blog = null;

        $blog = $this->model->where('url', $url)->where('is_published', 1)->where('published_at', '<=', Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s'))->first();

        if (!$blog) {
            $blog = $this->translationRepo->findByUrl($url, 'Grafite\Cms\Models\Blog');
        }

        return $blog;
    }
1184781
protected function findProvider($url)
    {
        foreach ($this->providers as $regex => $provider) {
            if (preg_match("#^$regex.*$#i", $url)) {
                return $provider;
            }
        }

        return false;
    }
660341
public static function googleTranslator(Url $url)
    {
        if (($value = $url->getQueryParameter('u'))) {
            return Url::create($value);
        }

        return $url;
    }
288498
public function findOneMostRecentByUrl($url)
    {
        $entity = null;

        $qb = $this->createQueryBuilder('route');
        $qb->where('route.url = :url');
        $qb->setParameter(':url', $url);
        $qb->orderBy('route.id', 'DESC');
        $qb->setMaxResults(1);

        $results = $qb->getQuery()->getResult();

        if (count($results) > 0) {
            $entity = $results[0];
        }

        return $entity;
    }
373721
public function hasTranslation($slug = false, $language = null)
    {
        return $this->hasTrans($slug, null, $language);
    }
1010178
public function findURL($url)
    {
        $nb_site_target = $this->getItem($url, self::INDEX_URL_STATIC);
        if ($nb_site_target === null) {
            //$nb_site_target = $this->findByRegExpr(self::INDEX_URL_REGEXP, $url);
        }

        return $nb_site_target;
    }
480813
public function url($lang = null)
    {
        if ($this->url === null) {
            if (!$this->id()) {
                return null;
            }

            $this->url = $this->generateUri();
        }

        if ($lang && $this->url instanceof Translation) {
            return $this->url[$lang];
        }

        return strval($this->url);
    }
465929
public function link($urnOrRelType, $urn = null)
    {
        $relTypeKeys = array_keys(get_object_vars($this->links));
        if ($urn) {
            $relTypeKeys = [$urnOrRelType];
        } else {
            $urn = $urnOrRelType;
        }

        // look for a matching urn within the links
        foreach ($relTypeKeys as $relType) {
            $links = $this->links($relType);
            $matching = $links->rel($urn);
            if ($matching) {
                return $matching;
            }
        }
        return null;
    }
1119612
public function find(string $selector, int $nth = null)
    {
        $this->isLoaded();

        return $this->root->find($selector, $nth);
    }
596228
static public function getProductsForCommerce($nb_commerce)
    {
        $nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
        if (is_numeric($nb_commerce_id)) {
            $retval = CNabuCommerceProduct::buildObjectListFromSQL(
                'nb_commerce_product_id',
                'SELECT *
                   FROM nb_commerce_product
                  WHERE nb_commerce_id=%commerce_id$d',
                array(
                    'commerce_id' => $nb_commerce_id
                )
            );
            if ($nb_commerce instanceof CNabuCommerce) {
                $retval->setCommerce($nb_commerce);
            }
        } else {
            $retval = new CNabuCommerceProductCategoryList($nb_commerce instanceof CNabuCommerce ? $nb_commerce : null);
        }

        return $retval;
    }
615990
public function url($url = null, $full = false) {
		if (CakePlugin::loaded('I18n')) {
			$url = Common::url($url);
			if (is_array($url) && !array_key_exists('lang', $url)) {
				$url['lang'] = Configure::read('Config.language');
			}
		}

		return parent::url($url, $full);
	}
1263443
private function matchUrl($url)
    {
        $request = Request::create($url);
        $this->requestAnalyzer->analyze($request);

        try {
            return null !== $this->router->matchRequest($request);
        } catch (ResourceNotFoundException $exception) {
            return false;
        }
    }
1097177
public function setCommerceProductId(int $nb_commerce_product_id) : CNabuDataObject
    {
        if ($nb_commerce_product_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$nb_commerce_product_id")
            );
        }
        $this->setValue('nb_commerce_product_id', $nb_commerce_product_id);
        
        return $this;
    }
1286039
public static function getPageRank($url = false)
    {
        // Composer autoloads classes out of the SEOstats namespace.
        // The custom autolader, however, does not. So we need to include it first.
        if(!class_exists('\GTB_PageRank')) {
            require_once realpath(__DIR__ . '/3rdparty/GTB_PageRank.php');
        }

        $gtb = new \GTB_PageRank(parent::getUrl($url));
        $result = $gtb->getPageRank();

        return $result != "" ? $result : static::noDataDefaultValue();
    }
688736
protected function _locate($url)
    {
        if(!isset($this->_locations[$url]))
        {
            //Locate the template
            if (!$file = $this->getObject('template.locator.factory')->locate($url)) {
                throw new InvalidArgumentException(sprintf('The template "%s" cannot be located.', $url));
            }

            $this->_locations[$url] = $file;
        }

        return $this->_locations[$url];
    }
148334
public function getCatalog($force = false)
    {
        if ($this->nb_catalog === null || $force) {
            $this->nb_catalog = null;
            if ($this instanceof CNabuDataObject &&
                !$this->isBuiltIn()
                && $this->isValueNumeric(NABU_CATALOG_FIELD_ID)
            ) {
                $nb_aux_catalog = new CNabuCatalog($this->getValue(NABU_CATALOG_FIELD_ID));
                if ($nb_aux_catalog->isFetched()) {
                    $this->nb_catalog = $nb_aux_catalog;
                }
            }
        }

        return $this->nb_catalog;
    }