Skip to content

Commit 4973c6b

Browse files
committed
new alpha release version
1 parent 6e0e77c commit 4973c6b

File tree

9 files changed

+60
-52
lines changed

9 files changed

+60
-52
lines changed

CmsSync/Block/Adminhtml/Cms/Block/Edit.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<?php
2-
/**
3-
* Created by Calin Diacon.
4-
* User: cdiacon
5-
* Date: 04/02/2013
6-
* Time: 22:43
7-
*
8-
*/
2+
93
class CalinDiacon_CmsSync_Block_Adminhtml_Cms_Block_Edit extends Mage_Adminhtml_Block_Cms_Block_Edit
104
{
115

CmsSync/Model/Block.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<?php
2-
/**
3-
* Created by Calin Diacon.
4-
* User: cdiacon
5-
* Date: 17/02/2013
6-
* Time: 18:35
7-
*
8-
*/
2+
93
class CalinDiacon_CmsSync_Model_Block
104
{
115
public $blockId;

CmsSync/Model/Cms.php

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<?php
2-
/**
3-
* Created by Calin Diacon.
4-
* User: cdiacon
5-
* Date: 17/02/2013
6-
* Time: 14:08
7-
*
8-
*/
2+
93
class CalinDiacon_CmsSync_Model_Cms
104
{
115
/**
@@ -76,7 +70,6 @@ public function syncStaticBlock($blockId)
7670

7771
if ($isEnabled && ! $source){
7872
if ($isNew){
79-
8073
/**
8174
* Create remote blocks
8275
*/
@@ -95,9 +88,29 @@ public function syncStaticBlock($blockId)
9588

9689
}else{
9790

98-
Mage::log('skipping the remote because is newer :' .$this->node->override);
91+
Mage::log('skipping the remote because is newer :' . $this->node->override);
9992
}
10093

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+
101114
}
102115
}else{
103116
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('cms')->__('Remote node is disabled or is using different store!'));

CmsSync/Model/Node.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<?php
2-
/**
3-
* Created by Calin Diacon.
4-
* User: cdiacon
5-
* Date: 17/02/2013
6-
* Time: 14:34
7-
*
8-
*/
2+
93
class CalinDiacon_CmsSync_Model_Node extends Mage_Core_Model_Abstract
104
{
115
protected $_url;

CmsSync/Model/NodeMapper.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<?php
2-
/**
3-
* Created by Calin Diacon.
4-
* User: cdiacon
5-
* Date: 17/02/2013
6-
* Time: 14:34
7-
*
8-
*/
2+
93
class CalinDiacon_CmsSync_Model_NodeMapper implements Countable
104
{
115
public $nodes = array();

CmsSync/Model/System/Config/Source/Master.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<?php
2-
/**
3-
* Created by Calin Diacon.
4-
* User: cdiacon
5-
* Date: 27/01/2013
6-
* Time: 19:33
7-
*
8-
*/
2+
93

104
class CalinDiacon_CmsSync_Model_System_Config_Source_Master
115
{

CmsSync/controllers/Adminhtml/Cms/BlockController.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<?php
2-
/**
3-
* Created by Calin Diacon.
4-
* User: cdiacon
5-
* Date: 04/02/2013
6-
* Time: 23:49
7-
*
8-
*/
2+
93
class CalinDiacon_CmsSync_Adminhtml_Cms_BlockController extends Mage_Adminhtml_Controller_Action
104
{
115
protected $_nodes = array();
@@ -24,8 +18,9 @@ protected function syncByBlockId($blockId = false)
2418
$cmsModel = new CalinDiacon_CmsSync_Model_Cms();
2519
$cmsModel->syncStaticBlock($blockId);
2620

21+
Mage::getSingleton('adminhtml/session')->addSuccess('All nodes was successfull updated.');
2722

28-
23+
$this->_redirect('*/cms_block/index');
2924

3025
}
3126

CmsSync/etc/api.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
<?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+
-->
217
<config>
318
<api>
419
<resources>

CmsSync/etc/system.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
<?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+
-->
217
<config>
318
<sections>
419
<cmssync translate="label">

0 commit comments

Comments
 (0)