Skip to content

Instantly share code, notes, and snippets.

@Archanium
Created June 24, 2013 09:42
Show Gist options
  • Save Archanium/5848949 to your computer and use it in GitHub Desktop.
Save Archanium/5848949 to your computer and use it in GitHub Desktop.
New UrlModel
<?php
namespace Model\Common;
class Url extends \Base\Sql\Entity
{
protected $active = 1;
protected $description;
protected $domain = "";
protected $id;
protected $keywords;
protected $locale;
protected $shop_id;
protected $title;
protected $url_key;
public function deactivate()
{
$this->active = 0;
}
public function getAllowIndex()
{
return true;
}
// api compatibility methods
public function getDescription()
{
return str_replace("&nbsp;", "", $this->description);
}
public function getKeywords()
{
return str_replace("&nbsp;", "", $this->keywords);
}
public function getPageTitle()
{
return str_replace("&nbsp;", "", $this->title);
}
public function getUrlKey()
{
if (substr($this->url_key, -1) == "/" && strlen($this->url_key) > 1) {
$this->url_key = substr($this->url_key, 0, -1);
}
return $this->url_key;
}
public function hasDescription()
{
return strlen($this->getDescription()) > 0;
}
public function hasGoogleVerification()
{
return false;
}
public function hasKeywords()
{
return strlen($this->getKeywords()) > 0;
}
public function hasMetaTitle()
{
return false;
}
public function hasOgImage()
{
return false;
}
public function hasPageTitle()
{
return strlen($this->getPageTitle()) > 0;
}
public function isActive()
{
return (bool) $this->active;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment