Prerender - Version 1.0.1

Version Notes

Code refactored
Compatibility with Magento 1.7 checked

Download this release

Release Info

Developer Laurent Clouet
Extension Prerender
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/code/community/Laurent/Prerender/Block/Adminhtml/Cms/Page/Edit/Tab/Prerender.php CHANGED
@@ -12,10 +12,11 @@
12
  * Block for putting prerender link in CMS page
13
  *
14
  */
15
- class Laurent_Prerender_Block_Adminhtml_Cms_Page_Edit_Tab_Prerender
16
- extends Mage_Adminhtml_Block_Widget_Form
17
- implements Mage_Adminhtml_Block_Widget_Tab_Interface {
18
-
 
19
  protected function _prepareForm()
20
  {
21
  /* @var $model Mage_Cms_Model_Page */
@@ -33,16 +34,16 @@ class Laurent_Prerender_Block_Adminhtml_Cms_Page_Edit_Tab_Prerender
33
 
34
  $form = new Varien_Data_Form();
35
 
36
- $form->setHtmlIdPrefix('page_');
37
 
38
- $fieldset = $form->addFieldset('base_fieldset', array('legend'=>$this->__('Prerender Link')));
39
 
40
  $fieldset->addField('prerender_link', 'text', array(
41
- 'name' => 'prerender_link',
42
- 'label' => $this->__('Link'),
43
- 'title' => $this->__('Link'),
44
- 'disabled' => $isElementDisabled,
45
- 'note' => $this->__('Link for the most likely next page.<br/>It will be prerendered in Google Chrome'),
46
  ));
47
 
48
  $form->setValues($model->getData());
@@ -50,13 +51,14 @@ class Laurent_Prerender_Block_Adminhtml_Cms_Page_Edit_Tab_Prerender
50
 
51
  return parent::_prepareForm();
52
  }
53
-
54
  /**
55
  * Return Tab label
56
  *
57
  * @return string
58
  */
59
- public function getTabLabel() {
 
60
  return $this->__('Prerender Link');
61
  }
62
 
@@ -65,7 +67,8 @@ class Laurent_Prerender_Block_Adminhtml_Cms_Page_Edit_Tab_Prerender
65
  *
66
  * @return string
67
  */
68
- public function getTabTitle() {
 
69
  return $this->__('Prerender Link');
70
  }
71
 
@@ -74,7 +77,8 @@ class Laurent_Prerender_Block_Adminhtml_Cms_Page_Edit_Tab_Prerender
74
  *
75
  * @return boolean
76
  */
77
- public function canShowTab() {
 
78
  //This tab is displayed only in guessing mode
79
  return (Mage::getStoreConfig('system/prerender/mode') == Laurent_Prerender_Model_Adminhtml_Config_Mode::MODE_GUESSING);
80
  }
@@ -84,10 +88,11 @@ class Laurent_Prerender_Block_Adminhtml_Cms_Page_Edit_Tab_Prerender
84
  *
85
  * @return boolean
86
  */
87
- public function isHidden() {
 
88
  return false;
89
  }
90
-
91
  /**
92
  * Check permission for passed action
93
  *
@@ -96,9 +101,9 @@ class Laurent_Prerender_Block_Adminhtml_Cms_Page_Edit_Tab_Prerender
96
  */
97
  protected function _isAllowedAction($action)
98
  {
99
- return Mage::getSingleton('admin/session')->isAllowed('cms/page/' . $action);
 
 
100
  }
101
 
102
  }
103
-
104
- ?>
12
  * Block for putting prerender link in CMS page
13
  *
14
  */
15
+ class Laurent_Prerender_Block_Adminhtml_Cms_Page_Edit_Tab_Prerender
16
+ extends Mage_Adminhtml_Block_Widget_Form
17
+ implements Mage_Adminhtml_Block_Widget_Tab_Interface
18
+ {
19
+
20
  protected function _prepareForm()
21
  {
22
  /* @var $model Mage_Cms_Model_Page */
34
 
35
  $form = new Varien_Data_Form();
36
 
37
+ $form->setData('html_id_prefix', 'page_');
38
 
39
+ $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Prerender Link')));
40
 
41
  $fieldset->addField('prerender_link', 'text', array(
42
+ 'name' => 'prerender_link',
43
+ 'label' => $this->__('Link'),
44
+ 'title' => $this->__('Link'),
45
+ 'disabled' => $isElementDisabled,
46
+ 'note' => $this->__('Link for the most likely next page.<br/>It will be prerendered in Google Chrome'),
47
  ));
48
 
49
  $form->setValues($model->getData());
51
 
52
  return parent::_prepareForm();
53
  }
54
+
55
  /**
56
  * Return Tab label
57
  *
58
  * @return string
59
  */
60
+ public function getTabLabel()
61
+ {
62
  return $this->__('Prerender Link');
63
  }
64
 
67
  *
68
  * @return string
69
  */
70
+ public function getTabTitle()
71
+ {
72
  return $this->__('Prerender Link');
73
  }
74
 
77
  *
78
  * @return boolean
79
  */
80
+ public function canShowTab()
81
+ {
82
  //This tab is displayed only in guessing mode
83
  return (Mage::getStoreConfig('system/prerender/mode') == Laurent_Prerender_Model_Adminhtml_Config_Mode::MODE_GUESSING);
84
  }
88
  *
89
  * @return boolean
90
  */
91
+ public function isHidden()
92
+ {
93
  return false;
94
  }
95
+
96
  /**
97
  * Check permission for passed action
98
  *
101
  */
102
  protected function _isAllowedAction($action)
103
  {
104
+ /** @var Mage_Admin_Model_Session $adminSession */
105
+ $adminSession = Mage::getSingleton('admin/session');
106
+ return $adminSession->isAllowed('cms/page/' . $action);
107
  }
108
 
109
  }
 
 
app/code/community/Laurent/Prerender/Block/Link.php CHANGED
@@ -9,55 +9,78 @@
9
  */
10
 
11
  /**
12
- * Block for displaying prerendering link in HTML <head>
13
  *
14
  */
15
- class Laurent_Prerender_Block_Link extends Mage_Core_Block_Template {
 
16
 
17
  protected $_prerenderLink = null;
18
 
19
- public function getCacheLifetime() {
 
 
 
 
 
 
20
  return 86400;
21
  }
22
 
23
- public function getCacheKey() {
24
- $key = 'PRERENDER_LINK_';
25
- $key .= sha1($this->getRequest()->getRequestUri());
 
 
 
 
 
 
26
 
27
- return $key;
28
  }
29
 
30
- public function getCacheTags() {
31
- return array(
32
- Mage_Cms_Model_Page::CACHE_TAG,
33
- );
 
 
 
 
 
 
 
34
  }
35
 
36
  /**
37
  * Get prerender url link for current page viewed
38
  * @return string Url of link to prerender empty strong if no link to prerender
39
  */
40
- public function getPrerenderLink() {
 
41
  if (is_null($this->_prerenderLink)) {
42
  if (Mage::getStoreConfig('system/prerender/mode') == Laurent_Prerender_Model_Adminhtml_Config_Mode::MODE_GUESSING) {
43
  //Guessing Mode
44
-
45
  $this->_prerenderLink = '';
46
 
47
  //Prerender link for cms page
 
48
  $cmsPage = Mage::getSingleton('cms/page');
49
  if ($cmsPage->getId()) {
50
- $this->_prerenderLink = $cmsPage->getPrerenderLink();
51
  }
52
 
53
  //Prerender link for category page
54
  $category = Mage::registry('current_category');
55
  if ($category && $category->getId()) {
 
56
  $layer = Mage::getSingleton('catalog/layer');
57
  if ($layer) {
58
  $productCollection = $layer->getProductCollection();
59
 
60
- //Loading blocks usefull for getting next page url
61
  $pagerBlock = new Mage_Page_Block_Html_Pager();
62
  $toolbarBlock = new Mage_Catalog_Block_Product_List_Toolbar();
63
 
@@ -69,11 +92,12 @@ class Laurent_Prerender_Block_Link extends Mage_Core_Block_Template {
69
  }
70
  }
71
  }
72
- }
73
- else{
74
  //Log Based Mode
75
  $url = $this->getRequest()->getRequestUri();
76
- $this->_prerenderLink = Mage::helper('prerender')->getMostCommonNextUrl($url);
 
 
77
  }
78
  }
79
 
@@ -81,5 +105,3 @@ class Laurent_Prerender_Block_Link extends Mage_Core_Block_Template {
81
  }
82
 
83
  }
84
-
85
- ?>
9
  */
10
 
11
  /**
12
+ * Block for displaying pre-rendering link in HTML <head>
13
  *
14
  */
15
+ class Laurent_Prerender_Block_Link extends Mage_Core_Block_Template
16
+ {
17
 
18
  protected $_prerenderLink = null;
19
 
20
+ /**
21
+ * Get block cache life time
22
+ *
23
+ * @return int
24
+ */
25
+ public function getCacheLifetime()
26
+ {
27
  return 86400;
28
  }
29
 
30
+ /**
31
+ * Get cache key informative items
32
+ *
33
+ * @return array
34
+ */
35
+ public function getCacheKeyInfo()
36
+ {
37
+ $cacheKeyInfo = parent::getCacheKeyInfo();
38
+ $cacheKeyInfo[] = $this->getRequest()->getRequestUri();
39
 
40
+ return $cacheKeyInfo;
41
  }
42
 
43
+ /**
44
+ * Get tags array for saving cache
45
+ *
46
+ * @return array
47
+ */
48
+ public function getCacheTags()
49
+ {
50
+ $cacheTags = parent::getCacheTags();
51
+ $cacheTags[] = Mage_Cms_Model_Page::CACHE_TAG;
52
+
53
+ return $cacheTags;
54
  }
55
 
56
  /**
57
  * Get prerender url link for current page viewed
58
  * @return string Url of link to prerender empty strong if no link to prerender
59
  */
60
+ public function getPrerenderLink()
61
+ {
62
  if (is_null($this->_prerenderLink)) {
63
  if (Mage::getStoreConfig('system/prerender/mode') == Laurent_Prerender_Model_Adminhtml_Config_Mode::MODE_GUESSING) {
64
  //Guessing Mode
65
+
66
  $this->_prerenderLink = '';
67
 
68
  //Prerender link for cms page
69
+ /** @var Mage_Cms_Model_Page $cmsPage */
70
  $cmsPage = Mage::getSingleton('cms/page');
71
  if ($cmsPage->getId()) {
72
+ $this->_prerenderLink = $cmsPage->getData('prerender_link');
73
  }
74
 
75
  //Prerender link for category page
76
  $category = Mage::registry('current_category');
77
  if ($category && $category->getId()) {
78
+ /** @var Mage_Catalog_Model_Layer $layer */
79
  $layer = Mage::getSingleton('catalog/layer');
80
  if ($layer) {
81
  $productCollection = $layer->getProductCollection();
82
 
83
+ //Loading blocks useful for getting next page url
84
  $pagerBlock = new Mage_Page_Block_Html_Pager();
85
  $toolbarBlock = new Mage_Catalog_Block_Product_List_Toolbar();
86
 
92
  }
93
  }
94
  }
95
+ } else {
 
96
  //Log Based Mode
97
  $url = $this->getRequest()->getRequestUri();
98
+ /** @var Laurent_Prerender_Helper_Data $prerenderHelper */
99
+ $prerenderHelper = $this->helper('prerender');
100
+ $this->_prerenderLink = $prerenderHelper->getMostCommonNextUrl($url);
101
  }
102
  }
103
 
105
  }
106
 
107
  }
 
 
app/code/community/Laurent/Prerender/Helper/Data.php CHANGED
@@ -11,112 +11,114 @@
11
  /**
12
  * Helper ony needed for the moment for translations
13
  */
14
- class Laurent_Prerender_Helper_Data extends Mage_Core_Helper_Abstract {
15
-
 
16
  protected $_rewriteModel = null;
17
 
18
  /**
19
  * Get the most common next url from given url based on website logs
20
- *
21
  * @param string $url The url where from we want the most common next url
22
  * @return string Most commonly next url after given url
23
  */
24
- public function getMostCommonNextUrl($url){
 
25
  $result = '';
26
-
27
  $url = $this->getRewrittenUrl($url);
28
-
29
  //Looking into logs
30
- $readAdapter = Mage::getSingleton('core/resource')->getConnection('read');
 
 
31
  $logResourceModel = Mage::getResourceSingleton('log/log');
32
  $nbDays = Mage::getStoreConfig('system/prerender/days_period');
33
  $currentDate = Mage::app()->getLocale()->date();
34
  $minDate = $currentDate->sub($nbDays, Zend_Date::DAY_SHORT);
35
-
36
  $select = $readAdapter->select()
37
- ->from(
38
- array('url_info_table' => $logResourceModel->getTable('log/url_info_table')),
39
- array(
40
- 'next_url' => 'url',
41
- 'nb_clicks' => 'COUNT(*)'
42
- ))
43
- ->join(
44
- array('url_table' => $logResourceModel->getTable('log/url_table')),
45
- 'url_info_table.url_id = url_table.url_id',
46
- array())
47
- ->where('url_info_table.referer = ?', $url)
48
- ->where('url_table.visit_time > ?', $minDate->toString(Zend_Date::ISO_8601))
49
- ->group('url_info_table.url')
50
- ->order('COUNT(*) DESC');
51
-
52
- $selectString = $select->__toString();
53
-
54
  $results = $readAdapter->fetchAll($select);
55
-
56
- if(count($results) > 0){
57
  $nextUrl = $results[0]['next_url'];
58
  $result = $this->getRewrittenUrl($nextUrl);
59
  }
60
-
61
  return $result;
62
  }
63
-
64
  /**
65
  * Get rewritten version of an url
66
  * It add host if it was not given
67
  * @param string $url
68
  * @return string The rewritten url
69
  */
70
- public function getRewrittenUrl($url){
71
- //Remove domain to url
 
72
  $domain = trim(Mage::getBaseUrl(), '/');
73
  $url = str_replace($domain, '', $url);
74
-
75
  //Remove first slash from url
76
  $url = trim($url, '/');
77
-
78
  //Remove params
79
  $urlParts = explode('?', $url, 2);
80
  $params = '';
81
- if(count($urlParts) == 2){
82
  $url = $urlParts[0];
83
  $params = $urlParts[1];
84
  }
85
-
86
  //Check if an url rewrite exists for requested url
87
  //We need then the rewritten url for looking into logs
88
  $rewriteModel = $this->_getRewriteModel();
89
  $rewriteModel->load($url, 'target_path');
90
- if($rewriteModel->getId()){
91
  $url = $rewriteModel->getRequestPath();
92
  }
93
-
94
  //Add params
95
- if($params != ''){
96
  $url .= '?' . $params;
97
  }
98
-
99
  //Add domain to url
100
- if(strpos($url, $domain) === false){
101
  $url = $domain . '/' . $url;
102
  }
103
-
104
  return $url;
105
  }
106
-
107
  /**
108
  * Get cached rewrite model
109
- * @return Mage_Core_Model_Url_Rewrite
110
  */
111
- protected function _getRewriteModel(){
112
- if(is_null($this->_rewriteModel)){
 
113
  $this->_rewriteModel = Mage::getModel('core/url_rewrite');
114
  }
115
  $this->_rewriteModel->setData(array());
116
-
117
  return $this->_rewriteModel;
118
  }
119
-
120
- }
121
 
122
- ?>
11
  /**
12
  * Helper ony needed for the moment for translations
13
  */
14
+ class Laurent_Prerender_Helper_Data extends Mage_Core_Helper_Abstract
15
+ {
16
+
17
  protected $_rewriteModel = null;
18
 
19
  /**
20
  * Get the most common next url from given url based on website logs
21
+ *
22
  * @param string $url The url where from we want the most common next url
23
  * @return string Most commonly next url after given url
24
  */
25
+ public function getMostCommonNextUrl($url)
26
+ {
27
  $result = '';
28
+
29
  $url = $this->getRewrittenUrl($url);
30
+
31
  //Looking into logs
32
+ /** @var Mage_Core_Model_Resource $resourceSingleton */
33
+ $resourceSingleton = Mage::getSingleton('core/resource');
34
+ $readAdapter = $resourceSingleton->getConnection('read');
35
  $logResourceModel = Mage::getResourceSingleton('log/log');
36
  $nbDays = Mage::getStoreConfig('system/prerender/days_period');
37
  $currentDate = Mage::app()->getLocale()->date();
38
  $minDate = $currentDate->sub($nbDays, Zend_Date::DAY_SHORT);
39
+
40
  $select = $readAdapter->select()
41
+ ->from(
42
+ array('url_info_table' => $logResourceModel->getTable('log/url_info_table')),
43
+ array(
44
+ 'next_url' => 'url',
45
+ 'nb_clicks' => 'COUNT(*)'
46
+ ))
47
+ ->join(
48
+ array('url_table' => $logResourceModel->getTable('log/url_table')),
49
+ 'url_info_table.url_id = url_table.url_id',
50
+ array())
51
+ ->where('url_info_table.referer = ?', $url)
52
+ ->where('url_table.visit_time > ?', $minDate->toString(Zend_Date::ISO_8601))
53
+ ->group('url_info_table.url')
54
+ ->order('COUNT(*) DESC');
55
+
 
 
56
  $results = $readAdapter->fetchAll($select);
57
+
58
+ if (count($results) > 0) {
59
  $nextUrl = $results[0]['next_url'];
60
  $result = $this->getRewrittenUrl($nextUrl);
61
  }
62
+
63
  return $result;
64
  }
65
+
66
  /**
67
  * Get rewritten version of an url
68
  * It add host if it was not given
69
  * @param string $url
70
  * @return string The rewritten url
71
  */
72
+ public function getRewrittenUrl($url)
73
+ {
74
+ //Remove domain to url
75
  $domain = trim(Mage::getBaseUrl(), '/');
76
  $url = str_replace($domain, '', $url);
77
+
78
  //Remove first slash from url
79
  $url = trim($url, '/');
80
+
81
  //Remove params
82
  $urlParts = explode('?', $url, 2);
83
  $params = '';
84
+ if (count($urlParts) == 2) {
85
  $url = $urlParts[0];
86
  $params = $urlParts[1];
87
  }
88
+
89
  //Check if an url rewrite exists for requested url
90
  //We need then the rewritten url for looking into logs
91
  $rewriteModel = $this->_getRewriteModel();
92
  $rewriteModel->load($url, 'target_path');
93
+ if ($rewriteModel->getId()) {
94
  $url = $rewriteModel->getRequestPath();
95
  }
96
+
97
  //Add params
98
+ if ($params != '') {
99
  $url .= '?' . $params;
100
  }
101
+
102
  //Add domain to url
103
+ if (strpos($url, $domain) === false) {
104
  $url = $domain . '/' . $url;
105
  }
106
+
107
  return $url;
108
  }
109
+
110
  /**
111
  * Get cached rewrite model
112
+ * @return Mage_Core_Model_Url_Rewrite
113
  */
114
+ protected function _getRewriteModel()
115
+ {
116
+ if (is_null($this->_rewriteModel)) {
117
  $this->_rewriteModel = Mage::getModel('core/url_rewrite');
118
  }
119
  $this->_rewriteModel->setData(array());
120
+
121
  return $this->_rewriteModel;
122
  }
 
 
123
 
124
+ }
app/code/community/Laurent/Prerender/Model/Adminhtml/Config/Mode.php CHANGED
@@ -9,11 +9,12 @@
9
  */
10
 
11
 
12
- class Laurent_Prerender_Model_Adminhtml_Config_Mode {
13
-
 
14
  const MODE_GUESSING = 'guessing';
15
  const MODE_LOG_BASED = 'log_based';
16
-
17
  /**
18
  * Give array of mode available for prerender link
19
  * @return array Different mode available for prerender links
@@ -22,16 +23,14 @@ class Laurent_Prerender_Model_Adminhtml_Config_Mode {
22
  {
23
  return array(
24
  array(
25
- 'value'=> self::MODE_GUESSING,
26
- 'label'=>Mage::helper('prerender')->__('Guessing mode')
27
  ),
28
  array(
29
- 'value'=> self::MODE_LOG_BASED,
30
- 'label'=>Mage::helper('prerender')->__('Based on Logs mode')
31
  ),
32
  );
33
  }
34
-
35
- }
36
 
37
- ?>
9
  */
10
 
11
 
12
+ class Laurent_Prerender_Model_Adminhtml_Config_Mode
13
+ {
14
+
15
  const MODE_GUESSING = 'guessing';
16
  const MODE_LOG_BASED = 'log_based';
17
+
18
  /**
19
  * Give array of mode available for prerender link
20
  * @return array Different mode available for prerender links
23
  {
24
  return array(
25
  array(
26
+ 'value' => self::MODE_GUESSING,
27
+ 'label' => Mage::helper('prerender')->__('Guessing mode')
28
  ),
29
  array(
30
+ 'value' => self::MODE_LOG_BASED,
31
+ 'label' => Mage::helper('prerender')->__('Based on Logs mode')
32
  ),
33
  );
34
  }
 
 
35
 
36
+ }
app/code/community/Laurent/Prerender/etc/config.xml CHANGED
@@ -9,7 +9,7 @@
9
  <config>
10
  <modules>
11
  <Laurent_Prerender>
12
- <version>1.0.0</version>
13
  </Laurent_Prerender>
14
  </modules>
15
  <global>
9
  <config>
10
  <modules>
11
  <Laurent_Prerender>
12
+ <version>1.0.1</version>
13
  </Laurent_Prerender>
14
  </modules>
15
  <global>
app/code/community/Laurent/Prerender/sql/prerender_setup/install-0.1.0.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * @category Laurent
5
+ * @package Laurent_Prerender
6
+ * @copyright Copyright (c) 2011 Laurent Clouet
7
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
+ * @author Laurent Clouet <laurent35240@gmail.com>
9
+ *
10
+ * Add prerender link field for cms pages
11
+ */
12
+
13
+ /* @var $this Mage_Core_Model_Resource_Setup */
14
+
15
+ $this->startSetup();
16
+
17
+ $this->getConnection()->addColumn(
18
+ $this->getTable('cms/page'),
19
+ 'prerender_link',
20
+ array(
21
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
22
+ 'length' => 255,
23
+ 'nullable' => true,
24
+ 'comment' => 'Next url for prerender meta tag',
25
+ )
26
+ );
27
+
28
+ $this->endSetup();
29
+
app/code/community/Laurent/Prerender/sql/prerender_setup/mysql4-install-0.1.0.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * @category Laurent
5
- * @package Laurent_Prerender
6
- * @copyright Copyright (c) 2011 Laurent Clouet
7
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
8
- * @author Laurent Clouet <laurent35240@gmail.com>
9
- *
10
- * Add prerender link field for cms pages
11
- */
12
-
13
- $installer = $this;
14
- /* @var $installer Mage_Core_Model_Resource_Setup */
15
-
16
- $installer->startSetup();
17
-
18
- $installer->run("
19
- ALTER TABLE `{$this->getTable('cms/page')}` ADD `prerender_link` VARCHAR( 255 ) NULL
20
- ");
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/prerender/link.phtml CHANGED
@@ -6,7 +6,7 @@
6
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
7
  * @author Laurent Clouet <laurent35240@gmail.com>
8
  *
9
- * @see Laurent_Prerender_Block_Link
10
  */
11
 
12
  ?>
6
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
7
  * @author Laurent Clouet <laurent35240@gmail.com>
8
  *
9
+ * @var $this Laurent_Prerender_Block_Link
10
  */
11
 
12
  ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Prerender</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">Academic Free License (AFL 3.0)</license>
7
  <channel>community</channel>
@@ -12,11 +12,12 @@ site.</summary>
12
  site. This functionality allow you to prerender another page after viewed page&#xD;
13
  is loaded. You can then for example load next page of a category while firt page&#xD;
14
  is being viewed by customer.</description>
15
- <notes>Stable version of Prerender extension</notes>
 
16
  <authors><author><name>Laurent Clouet</name><user>laurent35240</user><email>laurent35240@gmail.com</email></author></authors>
17
- <date>2011-10-09</date>
18
- <time>20:28:50</time>
19
- <contents><target name="magecommunity"><dir name="Laurent"><dir name="Prerender"><dir name="Block"><dir name="Adminhtml"><dir name="Cms"><dir name="Page"><dir name="Edit"><dir name="Tab"><file name="Prerender.php" hash="270fec36e1a4864de887c5fbfe222de1"/></dir></dir></dir></dir></dir><file name="Link.php" hash="66262554654d202c065e4aa884ebbe28"/></dir><dir name="Helper"><file name="Data.php" hash="2b89c42dd9af0b3186830c7538d8faa6"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Config"><file name="Mode.php" hash="f0ac6e356e977c81aff7577c800a095b"/></dir></dir></dir><dir name="doc"><file name="logo.jpg" hash="9a3602952a4fcf38c569cf97a995e6d9"/><file name="logo.svg" hash="8d6efd3edbdac63c42cf72cf50fe7542"/><file name="screenshot_cms_prerender_link_bo.png" hash="5e22e712e3e917e928692fb90077a9af"/><file name="screenshot_config_bo.png" hash="fee63ce607e6b8095cdbde0d5291f275"/></dir><dir name="etc"><file name="config.xml" hash="098028453a35a131e96e3318aaf4868d"/><file name="system.xml" hash="ca0e7f0c0c9966e854d0e1a434564063"/></dir><dir name="sql"><dir name="prerender_setup"><file name="mysql4-install-0.1.0.php" hash="e2f069fa6fec54e1f8d7bc1ba5839fe1"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="prerender.xml" hash="81951a2714d43f7a763d42856dca426e"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="prerender.xml" hash="f9b4b7bbd2ede98525e41002d5175f8e"/></dir><dir name="template"><dir name="prerender"><file name="link.phtml" hash="c4475bc8534862cb05dd83ed1d4c294b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Laurent_Prerender.xml" hash="b3c61a6fd2552016fd61ee88d1a44a17"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Laurent_Prerender.csv" hash="8ad51ee71cea9af3ef9488647c1c5a01"/></dir></target><target name="magetest"><dir name="unit"><dir name="Helper"><file name="DataTest.php" hash="e744c9bf868f88fa72c2264b7ba5c5ca"/></dir><dir name="Model"><file name="ModeTest.php" hash="2d70dd0900d6c5e1e64e0776a43265fb"/></dir><file name="bootstrap.php" hash="b2abdda667a11ea34036bd96338c1d0c"/></dir><dir name="selenium"><file name="GuessingModeTest.php" hash="1ccc9b6bb4cb801b304cc6ea97be3bd3"/><file name="LogBasedModeTest.php" hash="14014d916cd08f3222182d232089c76c"/><file name="MagentoTestCase.php" hash="3de324f44bdf4b9f9f5a1686b9080dc4"/><file name="constants_ex.php" hash="8a3e4a033ddf25434e5eb4d842fc6963"/></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Prerender</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">Academic Free License (AFL 3.0)</license>
7
  <channel>community</channel>
12
  site. This functionality allow you to prerender another page after viewed page&#xD;
13
  is loaded. You can then for example load next page of a category while firt page&#xD;
14
  is being viewed by customer.</description>
15
+ <notes>Code refactored&#xD;
16
+ Compatibility with Magento 1.7 checked</notes>
17
  <authors><author><name>Laurent Clouet</name><user>laurent35240</user><email>laurent35240@gmail.com</email></author></authors>
18
+ <date>2013-05-12</date>
19
+ <time>21:18:09</time>
20
+ <contents><target name="magecommunity"><dir name="Laurent"><dir name="Prerender"><dir name="Block"><dir name="Adminhtml"><dir name="Cms"><dir name="Page"><dir name="Edit"><dir name="Tab"><file name="Prerender.php" hash="dbb296a84c203b4d15c71e1c7741f7db"/></dir></dir></dir></dir></dir><file name="Link.php" hash="bf80ad9136a9f4fef32eaebe25e5fc0f"/></dir><dir name="Helper"><file name="Data.php" hash="dcbf5d4e3852bc108aaeaa1ceec259bc"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Config"><file name="Mode.php" hash="4d1bb52a761a12fd90d9e9823729f893"/></dir></dir></dir><dir name="doc"><file name="logo.jpg" hash="9a3602952a4fcf38c569cf97a995e6d9"/><file name="logo.svg" hash="8d6efd3edbdac63c42cf72cf50fe7542"/><file name="screenshot_cms_prerender_link_bo.png" hash="5e22e712e3e917e928692fb90077a9af"/><file name="screenshot_config_bo.png" hash="fee63ce607e6b8095cdbde0d5291f275"/></dir><dir name="etc"><file name="config.xml" hash="ad3d2974ad1885ab6b978d0bc8043122"/><file name="system.xml" hash="ca0e7f0c0c9966e854d0e1a434564063"/></dir><dir name="sql"><dir name="prerender_setup"><file name="install-0.1.0.php" hash="a343c7ae6f889b746aed46437825bb37"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="prerender.xml" hash="81951a2714d43f7a763d42856dca426e"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="prerender.xml" hash="f9b4b7bbd2ede98525e41002d5175f8e"/></dir><dir name="template"><dir name="prerender"><file name="link.phtml" hash="93ccaf5d5aa7546a310968ec360db71a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Laurent_Prerender.xml" hash="b3c61a6fd2552016fd61ee88d1a44a17"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Laurent_Prerender.csv" hash="8ad51ee71cea9af3ef9488647c1c5a01"/></dir></target><target name="magetest"><dir name="unit"><dir name="Helper"><file name="DataTest.php" hash="9cd80c0499fd6c2051ca6b8052e01dac"/></dir><dir name="Model"><file name="ModeTest.php" hash="60dca0a52ad85e53c94dd07afeda56e6"/></dir><file name="bootstrap.php" hash="39ac87b05aa77738a32a0031220b34fa"/></dir><dir name="selenium"><file name="GuessingModeTest.php" hash="f09a7c5f562cd5a2c72b2225c069eb36"/><file name="LogBasedModeTest.php" hash="366f2ffa61bfb2fcd71ec821fda0ce2b"/><file name="MagentoTestCase.php" hash="d158634c368a462828b19d238c911f43"/><file name="constants_ex.php" hash="da1b1523a8547a8d4c141d48fd0a9661"/></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>
tests/selenium/GuessingModeTest.php CHANGED
@@ -71,8 +71,8 @@ class GuessingModeTest extends MagentoTestCase{
71
  $this->logToBO();
72
  $this->setPrerenderMode('guessing');
73
 
74
- $categoryPage = 'http://www.magento-prerender.dev/music.html';
75
- $categoryNextPage = 'http://www.magento-prerender.dev/music.html?p=2';
76
 
77
  $this->open($categoryPage);
78
 
@@ -114,5 +114,3 @@ class GuessingModeTest extends MagentoTestCase{
114
  $this->assertFalse($this->isElementPresent("//link[@rel='prerender']"));
115
  }
116
  }
117
-
118
- ?>
71
  $this->logToBO();
72
  $this->setPrerenderMode('guessing');
73
 
74
+ $categoryPage = 'http://www.magento-prerender.dev/apparel.html';
75
+ $categoryNextPage = 'http://www.magento-prerender.dev/apparel.html?p=2';
76
 
77
  $this->open($categoryPage);
78
 
114
  $this->assertFalse($this->isElementPresent("//link[@rel='prerender']"));
115
  }
116
  }
 
 
tests/selenium/LogBasedModeTest.php CHANGED
@@ -39,8 +39,8 @@ class LogBasedModeTest extends MagentoTestCase{
39
 
40
  //Going five time to same product page from one category page
41
  for($i=0; $i<5; $i++){
42
- $this->open('/music.html');
43
- $this->click("link=Sigur Rós - Von");
44
  $this->waitForPageToLoad("30000");
45
  }
46
 
@@ -50,10 +50,8 @@ class LogBasedModeTest extends MagentoTestCase{
50
  $this->waitForPageToLoad("30000");
51
 
52
  //Checking that category page has now the product link has prerender link
53
- $this->open('/music.html');
54
- $this->assertElementPresent("//link[@rel='prerender' and @href='http://www.magento-prerender.dev/music/sigur-ros-von.html']");
55
  }
56
 
57
  }
58
-
59
- ?>
39
 
40
  //Going five time to same product page from one category page
41
  for($i=0; $i<5; $i++){
42
+ $this->open('/apparel.html');
43
+ $this->click("link=Coalesce: Functioning On Impatience T-Shirt");
44
  $this->waitForPageToLoad("30000");
45
  }
46
 
50
  $this->waitForPageToLoad("30000");
51
 
52
  //Checking that category page has now the product link has prerender link
53
+ $this->open('/apparel.html');
54
+ $this->assertElementPresent("//link[@rel='prerender' and @href='http://www.magento-prerender.dev/coalesce-functioning-on-impatience-t-shirt.html']");
55
  }
56
 
57
  }
 
 
tests/selenium/MagentoTestCase.php CHANGED
@@ -41,5 +41,3 @@ class MagentoTestCase extends PHPUnit_Extensions_SeleniumTestCase{
41
  }
42
 
43
  }
44
-
45
- ?>
41
  }
42
 
43
  }
 
 
tests/selenium/constants_ex.php CHANGED
@@ -12,4 +12,3 @@
12
 
13
  define('LOGIN_BO', 'login');
14
  define('PASSWORD_BO', 'password');
15
- ?>
12
 
13
  define('LOGIN_BO', 'login');
14
  define('PASSWORD_BO', 'password');
 
tests/unit/Helper/DataTest.php CHANGED
@@ -60,5 +60,3 @@ class DataTest extends PHPUnit_Framework_TestCase{
60
  }
61
 
62
  }
63
-
64
- ?>
60
  }
61
 
62
  }
 
 
tests/unit/Model/ModeTest.php CHANGED
@@ -30,5 +30,3 @@ class ModeTest extends PHPUnit_Framework_TestCase{
30
  }
31
 
32
  }
33
-
34
- ?>
30
  }
31
 
32
  }
 
 
tests/unit/bootstrap.php CHANGED
@@ -15,4 +15,3 @@ require_once 'app/Mage.php';
15
  Mage::app('default');
16
 
17
  session_start();
18
- ?>
15
  Mage::app('default');
16
 
17
  session_start();