Fishpig_Wordpress_Integration - Version 4.2.0.22

Version Notes

For changes, please see http://fishpig.co.uk/magento/wordpress-integration/#changelog

Download this release

Release Info

Developer fishpig
Extension Fishpig_Wordpress_Integration
Version 4.2.0.22
Comparing to
See all releases


Code changes from version 4.2.0.21 to 4.2.0.22

app/code/community/Fishpig/Wordpress/Helper/Filter.php CHANGED
@@ -97,12 +97,26 @@ class Fishpig_Wordpress_Helper_Filter extends Fishpig_Wordpress_Helper_Abstract
97
 
98
  /**
99
  * Add paragraph tags to the content
100
- * Taken from the WordPress core
101
- * Long live open source!
102
  *
103
  * @param string $content
104
  */
105
  public function addParagraphsToString($content)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  {
107
  if (function_exists('wpautop')) {
108
  return wpautop($content);
@@ -198,7 +212,8 @@ class Fishpig_Wordpress_Helper_Filter extends Fishpig_Wordpress_Helper_Abstract
198
  return true;
199
  }
200
 
201
- $formattingFile = Mage::helper('wordpress')->getWordPressPath() . 'wp-includes' . DS . 'formatting.php';
 
202
 
203
  if (!is_file($formattingFile)) {
204
  return false;
97
 
98
  /**
99
  * Add paragraph tags to the content
 
 
100
  *
101
  * @param string $content
102
  */
103
  public function addParagraphsToString($content)
104
+ {
105
+ $content = $this->_addParagraphsToString($content);
106
+
107
+ $content = preg_replace('/<p>(\[|<div)/', '$1', $content);
108
+ $content = preg_replace('/\]<\/p>/', ']', $content);
109
+ $content = preg_replace('/(<\/div>)<\/p>/', '$1', $content);
110
+
111
+ return $content;
112
+ }
113
+
114
+ /**
115
+ * Actually do the HTML conversion
116
+ *
117
+ * @param string $content
118
+ */
119
+ protected function _addParagraphsToString($content)
120
  {
121
  if (function_exists('wpautop')) {
122
  return wpautop($content);
212
  return true;
213
  }
214
 
215
+ $formattingFile = Mage::getModuleDir('', 'Fishpig_Wordpress') . DS . 'formatting.php';
216
+ # $formattingFile = Mage::helper('wordpress')->getWordPressPath() . 'wp-includes' . DS . 'formatting.php';
217
 
218
  if (!is_file($formattingFile)) {
219
  return false;
app/code/community/Fishpig/Wordpress/Model/Observer.php CHANGED
@@ -210,8 +210,8 @@ class Fishpig_Wordpress_Model_Observer extends Varien_Object
210
  }
211
 
212
  if (Mage::getStoreConfigFlag('wordpress/misc/include_jquery')) {
213
- array_unshift($content, sprintf($jsTemplate, $baseUrl . 'wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'));
214
- array_unshift($content, sprintf($jsTemplate, $baseUrl . 'wp-includes/js/jquery/jquery.js?ver=1.11.3'));
215
  }
216
 
217
  $observer->getEvent()
210
  }
211
 
212
  if (Mage::getStoreConfigFlag('wordpress/misc/include_jquery')) {
213
+ array_unshift($content, sprintf($jsTemplate, $baseUrl . 'wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1'));
214
+ array_unshift($content, sprintf($jsTemplate, $baseUrl . 'wp-includes/js/jquery/jquery.js?ver=1.12.4'));
215
  }
216
 
217
  $observer->getEvent()
app/code/community/Fishpig/Wordpress/Model/Post.php CHANGED
@@ -108,7 +108,9 @@ class Fishpig_Wordpress_Model_Post extends Fishpig_Wordpress_Model_Abstract
108
  $this->setPostExcerpt($this->_getPostTeaser(true));
109
  }
110
  else if ((int)$maxWords > 1) {
111
- $excerpt = explode(' ', trim(strip_tags(str_replace(array("\n", ' ', ' '), ' ', $this->_getData('post_content')))));
 
 
112
 
113
  if (count($excerpt) > $maxWords) {
114
  $excerpt = rtrim(implode(' ', array_slice($excerpt, 0, $maxWords)), "!@£$%^&*()_-+=[{]};:'\",<.>/? ") . '...';
108
  $this->setPostExcerpt($this->_getPostTeaser(true));
109
  }
110
  else if ((int)$maxWords > 1) {
111
+ $excerpt = trim(strip_tags(str_replace(array("\n", ' ', ' '), ' ', $this->_getData('post_content'))));
112
+ $excerpt = preg_replace('/\[[\/]{0,1}[^\]]{1,}\]/', '', $excerpt);
113
+ $excerpt = explode(' ', $excerpt);
114
 
115
  if (count($excerpt) > $maxWords) {
116
  $excerpt = rtrim(implode(' ', array_slice($excerpt, 0, $maxWords)), "!@£$%^&*()_-+=[{]};:'\",<.>/? ") . '...';
app/code/community/Fishpig/Wordpress/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Fishpig_Wordpress>
5
- <version>4.2.0.21</version>
6
  </Fishpig_Wordpress>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Fishpig_Wordpress>
5
+ <version>4.2.0.22</version>
6
  </Fishpig_Wordpress>
7
  </modules>
8
  <global>
app/code/community/Fishpig/Wordpress/formatting.php ADDED
@@ -0,0 +1,5294 @@