getCustomer(); return trim("{$customer->getFirstname()} {$customer->getLastname()}"); } public function getRoute(){ $route = Mage::getStoreConfig('clnews/news/route'); if (!$route){ $route = "clnews"; } return $route; } public function getUserEmail() { $customer = Mage::getSingleton('customer/session')->getCustomer(); return $customer->getEmail(); } public function getRssLink($categoryId) { if ($categoryId) { return Mage::getUrl('clnews/rss', array('category' => $categoryId)); } else { return Mage::getUrl('clnews/rss'); } } public function getFileUrl($newsitem) { $file = Mage::getBaseDir('media'). 'clnews' . DS . $newsitem->getDocument(); $file = str_replace(Mage::getBaseDir('media'), Mage::getBaseUrl('media'), $file); $file = str_replace('\\', '/', $file); return $file; } public function showAuthor() { return Mage::getStoreConfig('clnews/news/showauthorofnews'); } public function showCategory() { return Mage::getStoreConfig('clnews/news/showcategoryofnews'); } public function showDate() { return Mage::getStoreConfig('clnews/news/showdateofnews'); } public function showTime() { return Mage::getStoreConfig('clnews/news/showtimeofnews'); } public function enableLinkRoute() { return Mage::getStoreConfig('clnews/news/enablelinkrout'); } public function getLinkRoute() { return Mage::getStoreConfig('clnews/news/linkrout'); } public function getTagsAccess() { return Mage::getStoreConfig('clnews/news/tags'); } public function getGoogleAccess() { return Mage::getStoreConfig('clnews/news/google'); } public function getTwitterAccess() { return Mage::getStoreConfig('clnews/news/twitter'); } public function getLinkedInAccess() { return Mage::getStoreConfig('clnews/news/linked_in'); } public function getFaceBookAccess() { return Mage::getStoreConfig('clnews/news/facebook'); } public function resizeImage($imageName, $width=NULL, $height=NULL, $imagePath=NULL) { $imagePath = str_replace("/", DS, $imagePath); $imagePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $imageName; if($width == NULL && $height == NULL) { $width = 100; $height = 100; } $resizePath = $width . 'x' . $height; $resizePathFull = Mage::getBaseDir('media') . DS . $imagePath . DS . $resizePath . DS . $imageName; if (file_exists($imagePathFull) && !file_exists($resizePathFull)) { $imageObj = new Varien_Image($imagePathFull); $imageObj->keepAspectRatio(TRUE); $imageObj->resize($width,$height); $imageObj->save($resizePathFull); } $imagePath=str_replace(DS, "/", $imagePath); return Mage::getBaseUrl("media") . $imagePath . "/" . $resizePath . "/" . $imageName; } public function formatUrlKey($str) { $urlKey = preg_replace('#[^0-9a-z]+#i', '-', Mage::helper('catalog/product_url')->format($str)); $urlKey = strtolower($urlKey); $urlKey = trim($urlKey, '-'); return $urlKey; } public function getNewsitemUrlSuffix() { return Mage::getStoreConfig('clnews/news/itemurlsuffix'); } public function formatDate($date) { /* $date = Mage::helper('core')->formatDate($date, 'short', true); if (!Mage::helper('clnews')->showTime()) { $pos = strpos($date, ' '); $date = substr($date, 0, $pos); }*/ $date = Mage::app()->getLocale()->date(strtotime($date), null, null, false)->toString('dd MMMM, yyyy'); return $date; } public function getNewsUrl() { return Mage::getUrl('news/') . 'category/news.html'; } public function getArticlesUrl() { return Mage::getUrl('news/') . 'category/articles.html'; } }