/** * Retrieve the icon HTML for the post * * @param Fishpig_Wordpress_Model_Post $post * @return string */ public function getIcons(Fishpig_Wordpress_Model_Post $post) { if ($this->isEnabled()) { $html = Mage::helper('wordpress')->getWpOption('st_tags'); if (preg_match_all("/(<span.*><\\/span>)/iU", $html, $matches)) { $tags = array(); foreach ($matches[1] as $match) { $class = $this->_patternMatch("/class='(.*)'/iU", $match); $displayText = $this->_patternMatch("/displayText='(.*)'/iU", $match); $stVia = trim($this->_patternMatch("/st_via='(.*)'/iU", $match)); if ($displayText) { $displayText = ' displayText="' . $displayText . '" '; } if ($stVia) { $stVia = ' st_via="' . $stVia . '"'; } $tag = sprintf('<span class="%s"%sst_title="%s" st_summary="%s" st_url="%s"%s></span>', $class, $displayText, addslashes($post->getPostTitle()), trim(strip_tags(addslashes($post->getPostExcerpt()))), $post->getPermalink(), $stVia); if ($image = $post->getFeaturedImage()) { $tag = str_replace('></span>', ' st_image="' . $image->getAvailableImage() . '"></span>', $tag); } $tags[] = $tag; } return implode('', $tags); } } }
public function getFeaturedImageUrl(Fishpig_Wordpress_Model_Post $post) { if ($image = $post->getFeaturedImage()) { return $image->getThumbnailImage(); } return false; }
/** * Retrieve the icon HTML for the post * * @param Fishpig_Wordpress_Model_Post $post * @return string */ public function getIcons(Fishpig_Wordpress_Model_Post $post) { if ($this->isEnabled()) { $tags = Mage::helper('wordpress')->getWpOption('st_tags'); $tags = preg_replace("/(<\\?php[ ]{0,}the_title\\(\\)[;]{0,1}[ ]{0,}[php]{0,3}\\?>)/", addslashes($post->getPostTitle()), $tags); $tags = preg_replace("/(<\\?php[ ]{0,}the_permalink\\(\\)[;]{0,1}[ ]{0,}[php]{0,3}\\?>)/", addslashes($post->getPermalink()), $tags); $tags = preg_replace("/(<\\?php[ ]{0,}the_excerpt\\(\\)[;]{0,1}[ ]{0,}[php]{0,3}\\?>)/", addslashes(strip_tags($post->getPostExcerpt())), $tags); if (strpos($tags, 'the_image(') !== false) { if ($image = $post->getFeaturedImage()) { $tags = preg_replace("/(<\\?php[ ]{0,}the_image\\(\\)[;]{0,1}[ ]{0,}[php]{0,3}\\?>)/", $image->getThumbnailImage(), $tags); } } return $tags; } }
public function getButtons(Fishpig_Wordpress_Model_Post $post) { if ($this->isShareThis()) { $buttonsHtml = $this->_getButtonsHtml(); if (preg_match_all('/(<span.*)(>.*<\\/span>)/Us', $buttonsHtml, $matches)) { foreach ($matches[1] as $it => $prefix) { $suffix = $matches[2][$it]; $middle = " st_title='" . addslashes(strip_tags($post->getPostTitle())) . "'"; $middle .= " st_url='" . $post->getPermalink() . "'"; if ($featuredImage = $post->getFeaturedImage()) { $middle .= " st_image='" . $featuredImage->getAvailableImage() . "'"; } $middle .= " st_summary='" . ($post->getData('post_excerpt') ? addslashes(strip_tags($post->getData('post_excerpt'))) : '') . "'"; $buttonsHtml = str_replace($matches[0][$it], $prefix . $middle . $suffix, $buttonsHtml); } return $buttonsHtml; } } return ''; }
/** * Get the buttons HTML for the given $post and selected service * * @param Fishpig_Wordpress_Model_Post $post * @return string */ public function getButtons(Fishpig_Wordpress_Model_Post $post) { if ($this->isShareThis()) { $buttonsHtml = $this->_getButtonsHtml(); if (preg_match_all('/(<span.*)(>.*<\\/span>)/Us', $buttonsHtml, $matches)) { foreach ($matches[1] as $it => $prefix) { $suffix = $matches[2][$it]; $middle = sprintf(' st_title="%s"', $this->_sanitizeString($post->getPostTitle())); $middle .= sprintf(' st_url="%s"', $post->getPermalink()); if ($featuredImage = $post->getFeaturedImage()) { $middle .= sprintf(' st_image="%s"', $featuredImage->getAvailableImage()); } if (($excerpt = trim($post->getData('post_excerpt'))) !== '') { $middle .= sprintf(' st_summary="%s"', $this->_sanitizeString($excerpt, '<a><span><strong><em>')); } $buttonsHtml = str_replace($matches[0][$it], $prefix . $middle . $suffix, $buttonsHtml); } return $buttonsHtml; } } return ''; }
/** * Retrieve the thumbnail image for a post * * @param Fishpig_Wordpress_Model_Post $post * @return string */ public function getThumbnailImage(Fishpig_Wordpress_Model_Post $post) { if (($image = $post->getFeaturedImage()) !== false) { return $image->getAvailableImage(); } return $this->_getData('thumbnails_default'); }