-
Notifications
You must be signed in to change notification settings - Fork 6
/
wysiwyg.php
59 lines (46 loc) · 1.76 KB
/
wysiwyg.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require dirname(__FILE__) . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
class Outslide extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$blockCollection = $this->_objectManager->create('\Magento\Cms\Model\ResourceModel\Block\Collection');
$images = [];
foreach ($blockCollection as $block) {
echo 'Block Id: ' . $block->getId() . '<br/>';
echo 'Block Identifier: ' . $block->getIdentifier() . '<br/>';
$content = $block->getContent();
preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $content, $matches);
if(!empty($matches)){
echo '<pre>';
var_dump($matches);
echo '</pre>';
}
echo '<br/>';
}
//
var_dump($images);
$pageCollection = $this->_objectManager->create('\Magento\Cms\Model\ResourceModel\Page\Collection');
$images = [];
foreach ($pageCollection as $page) {
echo 'Page Id: ' . $page->getId() . '<br/>';
echo 'Page Identifier: ' . $page->getIdentifier() . '<br/>';
$content = $page->getContent();
preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $content, $matches);
if(!empty($matches)){
echo '<pre>';
var_dump($matches);
echo '</pre>';
}
echo '<br/>';
}
var_dump($images);
echo 'Done!';
//the method must end with this line
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Outslide');
$bootstrap->run($app);