File tree Expand file tree Collapse file tree 9 files changed +60
-52
lines changed
Block/Adminhtml/Cms/Block
controllers/Adminhtml/Cms Expand file tree Collapse file tree 9 files changed +60
-52
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
- /**
3
- * Created by Calin Diacon.
4
- * User: cdiacon
5
- * Date: 04/02/2013
6
- * Time: 22:43
7
- *
8
- */
2
+
9
3
class CalinDiacon_CmsSync_Block_Adminhtml_Cms_Block_Edit extends Mage_Adminhtml_Block_Cms_Block_Edit
10
4
{
11
5
Original file line number Diff line number Diff line change 1
1
<?php
2
- /**
3
- * Created by Calin Diacon.
4
- * User: cdiacon
5
- * Date: 17/02/2013
6
- * Time: 18:35
7
- *
8
- */
2
+
9
3
class CalinDiacon_CmsSync_Model_Block
10
4
{
11
5
public $ blockId ;
Original file line number Diff line number Diff line change 1
1
<?php
2
- /**
3
- * Created by Calin Diacon.
4
- * User: cdiacon
5
- * Date: 17/02/2013
6
- * Time: 14:08
7
- *
8
- */
2
+
9
3
class CalinDiacon_CmsSync_Model_Cms
10
4
{
11
5
/**
@@ -76,7 +70,6 @@ public function syncStaticBlock($blockId)
76
70
77
71
if ($ isEnabled && ! $ source ){
78
72
if ($ isNew ){
79
-
80
73
/**
81
74
* Create remote blocks
82
75
*/
@@ -95,9 +88,29 @@ public function syncStaticBlock($blockId)
95
88
96
89
}else {
97
90
98
- Mage::log ('skipping the remote because is newer : ' .$ this ->node ->override );
91
+ Mage::log ('skipping the remote because is newer : ' . $ this ->node ->override );
99
92
}
100
93
94
+ }
95
+ /**
96
+ * save all media from the content
97
+ */
98
+ preg_match_all ('/<img.*src=.*url="(.*)"\}\}.*\/\>/ ' , $ modelBlock ->getContent (), $ matches );
99
+ if (isset ($ matches [1 ])){
100
+ $ allMedia = $ matches [1 ];
101
+
102
+ foreach ($ allMedia as $ filename ){
103
+ $ fileData = base64_encode (file_get_contents (Mage::getBaseDir ('media ' ) . DS . $ filename ));
104
+ $ data = array (
105
+ 'fileName ' => $ filename ,
106
+ 'file ' => $ fileData
107
+ );
108
+
109
+ $ this ->proxy ->call ($ this ->sessionId , 'cms_api.block_media ' , array ($ data ));
110
+
111
+ }
112
+
113
+
101
114
}
102
115
}else {
103
116
Mage::getSingleton ('adminhtml/session ' )->addError (Mage::helper ('cms ' )->__ ('Remote node is disabled or is using different store! ' ));
Original file line number Diff line number Diff line change 1
1
<?php
2
- /**
3
- * Created by Calin Diacon.
4
- * User: cdiacon
5
- * Date: 17/02/2013
6
- * Time: 14:34
7
- *
8
- */
2
+
9
3
class CalinDiacon_CmsSync_Model_Node extends Mage_Core_Model_Abstract
10
4
{
11
5
protected $ _url ;
Original file line number Diff line number Diff line change 1
1
<?php
2
- /**
3
- * Created by Calin Diacon.
4
- * User: cdiacon
5
- * Date: 17/02/2013
6
- * Time: 14:34
7
- *
8
- */
2
+
9
3
class CalinDiacon_CmsSync_Model_NodeMapper implements Countable
10
4
{
11
5
public $ nodes = array ();
Original file line number Diff line number Diff line change 1
1
<?php
2
- /**
3
- * Created by Calin Diacon.
4
- * User: cdiacon
5
- * Date: 27/01/2013
6
- * Time: 19:33
7
- *
8
- */
2
+
9
3
10
4
class CalinDiacon_CmsSync_Model_System_Config_Source_Master
11
5
{
Original file line number Diff line number Diff line change 1
1
<?php
2
- /**
3
- * Created by Calin Diacon.
4
- * User: cdiacon
5
- * Date: 04/02/2013
6
- * Time: 23:49
7
- *
8
- */
2
+
9
3
class CalinDiacon_CmsSync_Adminhtml_Cms_BlockController extends Mage_Adminhtml_Controller_Action
10
4
{
11
5
protected $ _nodes = array ();
@@ -24,8 +18,9 @@ protected function syncByBlockId($blockId = false)
24
18
$ cmsModel = new CalinDiacon_CmsSync_Model_Cms ();
25
19
$ cmsModel ->syncStaticBlock ($ blockId );
26
20
21
+ Mage::getSingleton ('adminhtml/session ' )->addSuccess ('All nodes was successfull updated. ' );
27
22
28
-
23
+ $ this -> _redirect ( ' */cms_block/index ' );
29
24
30
25
}
31
26
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" ?>
2
+ <!--
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com and you will be sent a copy immediately.
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ -->
2
17
<config >
3
18
<api >
4
19
<resources >
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" ?>
2
+ <!--
3
+ /**
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com and you will be sent a copy immediately.
14
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
15
+ */
16
+ -->
2
17
<config >
3
18
<sections >
4
19
<cmssync translate =" label" >
You can’t perform that action at this time.
0 commit comments