Version Description
- 2020-08-25 =
- Fixed: The white label support url
- Fixed: Edit With Brizy is not displayed when using Gutenberg
- Fixed: The creation of the uid when a revision is provided
- Fixed: Mail template has only one value in all placeholders
Download this release
Release Info
Developer | themefusecom |
Plugin | Brizy – Page Builder |
Version | 2.0.7 |
Comparing to | |
See all releases |
Code changes from version 2.0.6 to 2.0.7
- README.md +7 -1
- admin/form-entries.php +8 -7
- admin/settings.php +11 -20
- admin/static/js/script.js +2 -3
- brizy.php +2 -2
- editor/editor/editor.php +1 -1
- editor/entity.php +294 -271
- editor/post3.php +0 -905
- readme.txt +7 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +4 -4
README.md
CHANGED
@@ -3,7 +3,7 @@ Contributors: themefuse<br>
|
|
3 |
Requires at least: 4.5<br>
|
4 |
Tested up to: 5.5<br>
|
5 |
Requires PHP: 5.6<br>
|
6 |
-
Stable tag: 2.0.
|
7 |
License: GPLv3<br>
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -118,6 +118,12 @@ $bodyHtml = apply_filters( 'brizy_content', $html->get_body(), Brizy_Editor_Proj
|
|
118 |
|
119 |
## Changelog
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
### 2.0.6 - 2020-08-18 ###
|
122 |
* Fixed: Screenshots not working with Embed with scripts in it
|
123 |
* Fixed: Memory issue that was causing a few projects to not work at preview
|
3 |
Requires at least: 4.5<br>
|
4 |
Tested up to: 5.5<br>
|
5 |
Requires PHP: 5.6<br>
|
6 |
+
Stable tag: 2.0.7<br>
|
7 |
License: GPLv3<br>
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
118 |
|
119 |
## Changelog
|
120 |
|
121 |
+
### 2.0.7 - 2020-08-25 ###
|
122 |
+
* Fixed: The white label support url
|
123 |
+
* Fixed: Edit With Brizy is not displayed when using Gutenberg
|
124 |
+
* Fixed: The creation of the uid when a revision is provided
|
125 |
+
* Fixed: Mail template has only one value in all placeholders
|
126 |
+
|
127 |
### 2.0.6 - 2020-08-18 ###
|
128 |
* Fixed: Screenshots not working with Embed with scripts in it
|
129 |
* Fixed: Memory issue that was causing a few projects to not work at preview
|
admin/form-entries.php
CHANGED
@@ -275,17 +275,18 @@ class Brizy_Admin_FormEntries {
|
|
275 |
*/
|
276 |
public function form_submit_data( $fields, $form ) {
|
277 |
|
278 |
-
$title = '';
|
279 |
-
|
280 |
foreach ( $fields as $i => $field ) {
|
281 |
-
if ( strtolower( $field->type ) == 'email' ) {
|
282 |
-
$title = $field->value;
|
283 |
-
}
|
284 |
-
|
285 |
if ( $field->name == 'g-recaptcha-response' ) {
|
286 |
unset( $fields[ $i ] );
|
287 |
$fields = array_values( $fields );
|
288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
}
|
290 |
|
291 |
// We use htmlentities the user can insert text in some languages like German, Hindi, etc.
|
275 |
*/
|
276 |
public function form_submit_data( $fields, $form ) {
|
277 |
|
|
|
|
|
278 |
foreach ( $fields as $i => $field ) {
|
|
|
|
|
|
|
|
|
279 |
if ( $field->name == 'g-recaptcha-response' ) {
|
280 |
unset( $fields[ $i ] );
|
281 |
$fields = array_values( $fields );
|
282 |
+
break;
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
$title = '';
|
287 |
+
foreach ( $fields as $i => $field ) {
|
288 |
+
if ( strtolower( $field->type ) == 'email' ) {
|
289 |
+
$title = $field->value;
|
290 |
}
|
291 |
|
292 |
// We use htmlentities the user can insert text in some languages like German, Hindi, etc.
|
admin/settings.php
CHANGED
@@ -116,38 +116,29 @@ class Brizy_Admin_Settings {
|
|
116 |
return;
|
117 |
}
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
);
|
127 |
-
}
|
128 |
|
129 |
/**
|
130 |
* @internal
|
131 |
*/
|
132 |
public function actionRegisterSubMenuGoProPage() {
|
133 |
|
|
|
|
|
134 |
if ( class_exists( 'BrizyPro_Main' ) ) {
|
135 |
return;
|
136 |
}
|
137 |
|
138 |
-
|
139 |
-
self::menu_slug(),
|
140 |
-
'',
|
141 |
-
'<span style="display:flex;color:#00b9eb;">
|
142 |
<svg height="20" width="20">
|
143 |
<path d="M13,7 L12,7 L12,4.73333333 C12,2.6744 10.206,1 8,1 C5.794,1 4,2.6744 4,4.73333333 L4,7 L3,7 C2.448,7 2,7.41813333 2,7.93333333 L2,14.0666667 C2,14.5818667 2.448,15 3,15 L13,15 C13.552,15 14,14.5818667 14,14.0666667 L14,7.93333333 C14,7.41813333 13.552,7 13,7 Z M10,5 L12,5 L12,7 L10,7 L6,7 L6,5 C6,3.897 6.897,3 8,3 C9.103,3 10,3.897 10,5 Z" fill="#00b9eb" fill-rule="nonzero"/>
|
144 |
-
</svg>' .
|
145 |
-
__( 'Go Pro', 'brizy' ) .
|
146 |
-
'</span>',
|
147 |
-
'manage_options',
|
148 |
-
Brizy_Config::GO_PRO_DASHBOARD_URL,
|
149 |
-
array()
|
150 |
-
);
|
151 |
}
|
152 |
|
153 |
private function get_selected_tab() {
|
116 |
return;
|
117 |
}
|
118 |
|
119 |
+
if ( !class_exists( 'BrizyPro_Main' ) ) {
|
120 |
+
return;
|
121 |
+
}
|
122 |
+
|
123 |
+
global $submenu;
|
124 |
+
$submenu['brizy-settings'][] = array( '<span id="get-help"></span>'.__( 'Go Help', 'brizy' ) , 'manage_options', __bt('support-url',apply_filters('brizy_support_url', Brizy_Config::SUPPORT_URL)) );
|
125 |
+
}
|
|
|
|
|
126 |
|
127 |
/**
|
128 |
* @internal
|
129 |
*/
|
130 |
public function actionRegisterSubMenuGoProPage() {
|
131 |
|
132 |
+
global $submenu;
|
133 |
+
|
134 |
if ( class_exists( 'BrizyPro_Main' ) ) {
|
135 |
return;
|
136 |
}
|
137 |
|
138 |
+
$submenu['brizy-settings'][] = array( '<span style="display:flex;color:#00b9eb;" id="go-pro">
|
|
|
|
|
|
|
139 |
<svg height="20" width="20">
|
140 |
<path d="M13,7 L12,7 L12,4.73333333 C12,2.6744 10.206,1 8,1 C5.794,1 4,2.6744 4,4.73333333 L4,7 L3,7 C2.448,7 2,7.41813333 2,7.93333333 L2,14.0666667 C2,14.5818667 2.448,15 3,15 L13,15 C13.552,15 14,14.5818667 14,14.0666667 L14,7.93333333 C14,7.41813333 13.552,7 13,7 Z M10,5 L12,5 L12,7 L10,7 L6,7 L6,5 C6,3.897 6.897,3 8,3 C9.103,3 10,3.897 10,5 Z" fill="#00b9eb" fill-rule="nonzero"/>
|
141 |
+
</svg>'.__( 'Go Pro', 'brizy' )."</span>" , 'manage_options', apply_filters('brizy_upgrade_to_pro_url', Brizy_Config::UPGRADE_TO_PRO_URL) );
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
|
144 |
private function get_selected_tab() {
|
admin/static/js/script.js
CHANGED
@@ -152,7 +152,7 @@ jQuery(document).ready(function ($) {
|
|
152 |
});
|
153 |
|
154 |
// Open our submenu link "Get Help" in a new tab.
|
155 |
-
|
156 |
|
157 |
var BrizyGutenberg = {
|
158 |
|
@@ -177,7 +177,7 @@ jQuery(document).ready(function ($) {
|
|
177 |
var self = this;
|
178 |
setTimeout(function () {
|
179 |
self.insertBrizyBtn();
|
180 |
-
},
|
181 |
}
|
182 |
};
|
183 |
|
@@ -223,7 +223,6 @@ jQuery(document).ready(function ($) {
|
|
223 |
BrizyFeedbackDialog.init();
|
224 |
BrizyMaintenance.init();
|
225 |
} );
|
226 |
-
|
227 |
});
|
228 |
|
229 |
|
152 |
});
|
153 |
|
154 |
// Open our submenu link "Get Help" in a new tab.
|
155 |
+
$( '#get-help,#go-pro' ).parent().attr( 'target', '_blank' );
|
156 |
|
157 |
var BrizyGutenberg = {
|
158 |
|
177 |
var self = this;
|
178 |
setTimeout(function () {
|
179 |
self.insertBrizyBtn();
|
180 |
+
}, 500);
|
181 |
}
|
182 |
};
|
183 |
|
223 |
BrizyFeedbackDialog.init();
|
224 |
BrizyMaintenance.init();
|
225 |
} );
|
|
|
226 |
});
|
227 |
|
228 |
|
brizy.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Plugin URI: https://brizy.io/
|
6 |
* Author: Brizy.io
|
7 |
* Author URI: https://brizy.io/
|
8 |
-
* Version: 2.0.
|
9 |
* Text Domain: brizy
|
10 |
* License: GPLv3
|
11 |
* Domain Path: /languages
|
@@ -19,7 +19,7 @@ if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && stripos( $_SERVER['HTTP_X_FO
|
|
19 |
|
20 |
define( 'BRIZY_DEVELOPMENT', false );
|
21 |
define( 'BRIZY_LOG', false );
|
22 |
-
define( 'BRIZY_VERSION', '2.0.
|
23 |
define( 'BRIZY_EDITOR_VERSION', BRIZY_DEVELOPMENT ? 'dev' : '152-wp' );
|
24 |
define( 'BRIZY_SYNC_VERSION', '152' );
|
25 |
define( 'BRIZY_FILE', __FILE__ );
|
5 |
* Plugin URI: https://brizy.io/
|
6 |
* Author: Brizy.io
|
7 |
* Author URI: https://brizy.io/
|
8 |
+
* Version: 2.0.7
|
9 |
* Text Domain: brizy
|
10 |
* License: GPLv3
|
11 |
* Domain Path: /languages
|
19 |
|
20 |
define( 'BRIZY_DEVELOPMENT', false );
|
21 |
define( 'BRIZY_LOG', false );
|
22 |
+
define( 'BRIZY_VERSION', '2.0.7' );
|
23 |
define( 'BRIZY_EDITOR_VERSION', BRIZY_DEVELOPMENT ? 'dev' : '152-wp' );
|
24 |
define( 'BRIZY_SYNC_VERSION', '152' );
|
25 |
define( 'BRIZY_FILE', __FILE__ );
|
editor/editor/editor.php
CHANGED
@@ -125,7 +125,7 @@ class Brizy_Editor_Editor_Editor
|
|
125 |
// wp specific
|
126 |
'changeTemplate' => $change_template_url,
|
127 |
'upgradeToPro' => apply_filters('brizy_upgrade_to_pro_url', Brizy_Config::UPGRADE_TO_PRO_URL),
|
128 |
-
'support' => apply_filters('brizy_support_url', Brizy_Config::SUPPORT_URL),
|
129 |
'pluginSettings' => admin_url('admin.php?page='.Brizy_Admin_Settings::menu_slug()),
|
130 |
'dashboardNavMenu' => admin_url('nav-menus.php'),
|
131 |
'customFile' => home_url('?'.Brizy_Editor::prefix('_attachment').'='),
|
125 |
// wp specific
|
126 |
'changeTemplate' => $change_template_url,
|
127 |
'upgradeToPro' => apply_filters('brizy_upgrade_to_pro_url', Brizy_Config::UPGRADE_TO_PRO_URL),
|
128 |
+
'support' => __bt('support-url',apply_filters('brizy_support_url', Brizy_Config::SUPPORT_URL)),
|
129 |
'pluginSettings' => admin_url('admin.php?page='.Brizy_Admin_Settings::menu_slug()),
|
130 |
'dashboardNavMenu' => admin_url('nav-menus.php'),
|
131 |
'customFile' => home_url('?'.Brizy_Editor::prefix('_attachment').'='),
|
editor/entity.php
CHANGED
@@ -1,275 +1,298 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
abstract class Brizy_Editor_Entity extends Brizy_Admin_Serializable
|
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 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
JOIN {$wpdb->posts} p ON p.ID=pm.post_id and p.post_type <> 'revision' and p.post_type<>'attachment' and p.post_status='publish'
|
152 |
-
WHERE pm.meta_key = %s ",
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
}
|
1 |
<?php
|
2 |
|
3 |
+
abstract class Brizy_Editor_Entity extends Brizy_Admin_Serializable
|
4 |
+
{
|
5 |
+
|
6 |
+
const BRIZY_DATA_VERSION_KEY = 'brizy_data_version';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var string
|
10 |
+
*/
|
11 |
+
protected $uid;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var int
|
15 |
+
*/
|
16 |
+
protected $wp_post_id;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var WP_Post
|
20 |
+
*/
|
21 |
+
protected $wp_post = null;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var int
|
25 |
+
*/
|
26 |
+
protected $dataVersion = null;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Brizy_Editor_Entity constructor.
|
30 |
+
*/
|
31 |
+
public function __construct($postId)
|
32 |
+
{
|
33 |
+
if ( ! is_numeric($postId)) {
|
34 |
+
throw new Exception('Invalid post id provided');
|
35 |
+
}
|
36 |
+
|
37 |
+
Brizy_Editor::checkIfPostTypeIsSupported($postId);
|
38 |
+
|
39 |
+
$this->setWpPostId($postId);
|
40 |
+
|
41 |
+
$this->loadInstanceData();
|
42 |
+
}
|
43 |
+
|
44 |
+
static public function get($postId)
|
45 |
+
{
|
46 |
+
$type = get_post_type($postId);
|
47 |
+
|
48 |
+
switch ($type) {
|
49 |
+
case 'page':
|
50 |
+
case 'post':
|
51 |
+
case Brizy_Admin_Popups_Main::CP_POPUP:
|
52 |
+
return Brizy_Editor_Post::get($postId);
|
53 |
+
|
54 |
+
case Brizy_Admin_Blocks_Main::CP_GLOBAL:
|
55 |
+
case Brizy_Admin_Blocks_Main::CP_SAVED:
|
56 |
+
return Brizy_Editor_Block::get($postId);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @param $postId
|
62 |
+
*
|
63 |
+
* @return Brizy_Editor_Block|Brizy_Editor_Post|mixed
|
64 |
+
* @throws Exception
|
65 |
+
*/
|
66 |
+
public function duplicateTo($postId)
|
67 |
+
{
|
68 |
+
// check post types
|
69 |
+
if (get_post_type($postId) !== $this->getWpPost()->post_type) {
|
70 |
+
throw new Exception('Cannot duplicate post. Invalid target post type');
|
71 |
+
}
|
72 |
+
|
73 |
+
if ( ! $this->uses_editor()) {
|
74 |
+
throw new Exception('The source post is not using Brizy.');
|
75 |
+
}
|
76 |
+
|
77 |
+
// copy current date the the new post
|
78 |
+
$newPost = self::get($postId);
|
79 |
+
|
80 |
+
if ($newPost->uses_editor()) {
|
81 |
+
throw new Exception('Target post is using Brizy.');
|
82 |
+
}
|
83 |
+
|
84 |
+
$newPost->set_needs_compile(true);
|
85 |
+
$newPost->set_uses_editor(true);
|
86 |
+
$newPost->setDataVersion(1);
|
87 |
+
$newPost->createUid();
|
88 |
+
|
89 |
+
return $newPost;
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Will return the key on witch the object data will be saved in storage
|
95 |
+
*
|
96 |
+
* @return mixed
|
97 |
+
*/
|
98 |
+
abstract protected function getObjectKey();
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Load all object data
|
102 |
+
*/
|
103 |
+
abstract protected function loadInstanceData();
|
104 |
+
|
105 |
+
/**
|
106 |
+
* @return mixed
|
107 |
+
*/
|
108 |
+
abstract public function createResponse($fields = array());
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Save post data and and trigger post update
|
112 |
+
*
|
113 |
+
* @return mixed
|
114 |
+
*/
|
115 |
+
abstract public function savePost();
|
116 |
+
|
117 |
+
/**
|
118 |
+
* This will save ro create an autosave object the the data from entity
|
119 |
+
* Also before saving the data version will be checked
|
120 |
+
*
|
121 |
+
* @return $this
|
122 |
+
* @throws Exception
|
123 |
+
*/
|
124 |
+
public function save($autosave = 0)
|
125 |
+
{
|
126 |
+
|
127 |
+
// check entity versions before saving.
|
128 |
+
if ((int)$autosave === 0) {
|
129 |
+
$this->saveDataVersion();
|
130 |
+
}
|
131 |
+
|
132 |
+
$this->createUid();
|
133 |
+
|
134 |
+
return $this;
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* This will take all values from entity and save them to database
|
139 |
+
*/
|
140 |
+
public function saveStorage()
|
141 |
+
{
|
142 |
+
$value = $this->convertToOptionValue();
|
143 |
+
$this->getStorage()->set($this->getObjectKey(), $value);
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
/**
|
148 |
+
* @return Brizy_Editor_Post[]
|
149 |
+
* @throws Brizy_Editor_Exceptions_NotFound
|
150 |
+
* @throws Brizy_Editor_Exceptions_UnsupportedPostType
|
151 |
+
*/
|
152 |
+
public static function get_all_brizy_post_ids()
|
153 |
+
{
|
154 |
+
global $wpdb;
|
155 |
+
$posts = $wpdb->get_results(
|
156 |
+
$wpdb->prepare(
|
157 |
+
"SELECT p.ID FROM {$wpdb->postmeta} pm
|
158 |
JOIN {$wpdb->posts} p ON p.ID=pm.post_id and p.post_type <> 'revision' and p.post_type<>'attachment' and p.post_status='publish'
|
159 |
+
WHERE pm.meta_key = %s ",
|
160 |
+
Brizy_Editor_Storage_Post::META_KEY
|
161 |
+
)
|
162 |
+
);
|
163 |
+
|
164 |
+
return array_map(
|
165 |
+
function ($o) {
|
166 |
+
return (int)$o->ID;
|
167 |
+
},
|
168 |
+
$posts
|
169 |
+
);
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @return int
|
174 |
+
*/
|
175 |
+
public function getWpPostId()
|
176 |
+
{
|
177 |
+
return $this->wp_post_id;
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* @param int $wp_post_id
|
182 |
+
*
|
183 |
+
* @return Brizy_Editor_Entity
|
184 |
+
*/
|
185 |
+
public function setWpPostId($wp_post_id)
|
186 |
+
{
|
187 |
+
$this->wp_post_id = $wp_post_id;
|
188 |
+
|
189 |
+
return $this;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Return the post parent id
|
194 |
+
*
|
195 |
+
* @return int
|
196 |
+
*/
|
197 |
+
public function getWpPostParentId()
|
198 |
+
{
|
199 |
+
return $this->getWpPost()->post_parent ?: $this->getWpPostId();
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* @return WP_Post
|
204 |
+
*/
|
205 |
+
public function getWpPost()
|
206 |
+
{
|
207 |
+
return $this->wp_post ?: ($this->wp_post = get_post($this->getWpPostId()));
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* @return $this
|
212 |
+
*/
|
213 |
+
protected function saveDataVersion()
|
214 |
+
{
|
215 |
+
$version = $this->getCurrentDataVersion();
|
216 |
+
|
217 |
+
if ($this->dataVersion !== $version + 1) {
|
218 |
+
Brizy_Logger::instance()->critical(
|
219 |
+
'Unable to save entity. The data version is wrong.',
|
220 |
+
[
|
221 |
+
'currentVersion' => $version,
|
222 |
+
'newVersion' => $this->dataVersion,
|
223 |
+
]
|
224 |
+
);
|
225 |
+
throw new Brizy_Editor_Exceptions_DataVersionMismatch('Unable to save entity. The data version is wrong.');
|
226 |
+
}
|
227 |
+
|
228 |
+
update_post_meta($this->getWpPostId(), self::BRIZY_DATA_VERSION_KEY, $this->dataVersion);
|
229 |
+
|
230 |
+
return $this;
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* @return int
|
235 |
+
*/
|
236 |
+
public function getCurrentDataVersion()
|
237 |
+
{
|
238 |
+
return (int)(get_post_meta($this->getWpPostId(), self::BRIZY_DATA_VERSION_KEY, true) ?: 0);
|
239 |
+
}
|
240 |
+
|
241 |
+
|
242 |
+
/**
|
243 |
+
* @param $dataVersion
|
244 |
+
*
|
245 |
+
* @return $this
|
246 |
+
*/
|
247 |
+
public function setDataVersion($dataVersion)
|
248 |
+
{
|
249 |
+
$this->dataVersion = (int)$dataVersion;
|
250 |
+
|
251 |
+
return $this;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* @return string
|
256 |
+
*/
|
257 |
+
public function getUid()
|
258 |
+
{
|
259 |
+
return $this->uid;
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Return an instance of Brizy_Editor_Storage_Abstract that will store the object data
|
264 |
+
*
|
265 |
+
* @return Brizy_Editor_Storage_Post
|
266 |
+
*/
|
267 |
+
protected function getStorage()
|
268 |
+
{
|
269 |
+
return Brizy_Editor_Storage_Post::instance($this->wp_post_id);
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* @return mixed|string
|
274 |
+
*/
|
275 |
+
protected function createUid()
|
276 |
+
{
|
277 |
+
$WPPost = $this->getWpPost();
|
278 |
+
$post_id = $WPPost->post_type != 'revision'?$this->getWpPostId():$WPPost->post_parent;
|
279 |
+
|
280 |
+
if ($uid = $this->getUid()) {
|
281 |
+
$uid = get_post_meta($post_id, 'brizy_post_uid', true);
|
282 |
+
if ( ! $uid) {
|
283 |
+
update_post_meta($post_id, 'brizy_post_uid', $this->getUid());
|
284 |
+
}
|
285 |
+
|
286 |
+
return $uid;
|
287 |
+
}
|
288 |
+
|
289 |
+
$uid = get_post_meta($post_id, 'brizy_post_uid', true);
|
290 |
+
|
291 |
+
if ( ! $uid) {
|
292 |
+
$uid = md5($post_id.time());
|
293 |
+
update_post_meta($post_id, 'brizy_post_uid', $uid);
|
294 |
+
}
|
295 |
+
|
296 |
+
return $this->uid = $uid;
|
297 |
+
}
|
298 |
}
|
editor/post3.php
DELETED
@@ -1,905 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
-
die( 'Direct access forbidden.' );
|
3 |
-
}
|
4 |
-
|
5 |
-
class Brizy_Editor_Post3 extends Brizy_Admin_Serializable {
|
6 |
-
|
7 |
-
|
8 |
-
use Brizy_Editor_AutoSaveAware;
|
9 |
-
|
10 |
-
const BRIZY_POST = 'brizy-post';
|
11 |
-
const BRIZY_POST_NEEDS_COMPILE_KEY = 'brizy-need-compile';
|
12 |
-
const BRIZY_POST_SIGNATURE_KEY = 'brizy-post-signature';
|
13 |
-
const BRIZY_POST_HASH_KEY = 'brizy-post-hash';
|
14 |
-
const BRIZY_POST_EDITOR_VERSION = 'brizy-post-editor-version';
|
15 |
-
const BRIZY_POST_COMPILER_VERSION = 'brizy-post-compiler-version';
|
16 |
-
const BRIZY_POST_PLUGIN_VERSION = 'brizy-post-plugin-version';
|
17 |
-
|
18 |
-
static protected $instance = null;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var Brizy_Editor_API_Page
|
22 |
-
*/
|
23 |
-
protected $api_page;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var int
|
27 |
-
*/
|
28 |
-
protected $wp_post_id;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @var WP_Post
|
32 |
-
*/
|
33 |
-
protected $wp_post;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @var string
|
37 |
-
*/
|
38 |
-
protected $compiled_html;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @var string
|
42 |
-
*/
|
43 |
-
protected $compiled_html_body;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @var string
|
47 |
-
*/
|
48 |
-
protected $compiled_html_head;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @var bool
|
52 |
-
*/
|
53 |
-
protected $needs_compile;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Json for the editor.
|
57 |
-
*
|
58 |
-
* @var string
|
59 |
-
*/
|
60 |
-
protected $editor_data;
|
61 |
-
|
62 |
-
/**
|
63 |
-
* @var string
|
64 |
-
*/
|
65 |
-
protected $uid;
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @var bool
|
69 |
-
*/
|
70 |
-
protected $uses_editor;
|
71 |
-
|
72 |
-
/**
|
73 |
-
* @var string
|
74 |
-
*/
|
75 |
-
protected $editor_version;
|
76 |
-
|
77 |
-
/**
|
78 |
-
* @var string
|
79 |
-
*/
|
80 |
-
protected $compiler_version;
|
81 |
-
|
82 |
-
/**
|
83 |
-
* @var string
|
84 |
-
*/
|
85 |
-
protected $plugin_version;
|
86 |
-
|
87 |
-
/**
|
88 |
-
* @var Brizy_Editor_CompiledHtml
|
89 |
-
*/
|
90 |
-
static private $compiled_page;
|
91 |
-
|
92 |
-
|
93 |
-
public static function cleanClassCache() {
|
94 |
-
self::$instance = array();
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Brizy_Editor_Post constructor.
|
99 |
-
*
|
100 |
-
* @param $wp_post_id
|
101 |
-
*
|
102 |
-
* @throws Brizy_Editor_Exceptions_NotFound
|
103 |
-
*/
|
104 |
-
public function __construct( $wp_post_id ) {
|
105 |
-
|
106 |
-
self::checkIfPostTypeIsSupported( $wp_post_id );
|
107 |
-
$this->wp_post_id = (int) $wp_post_id;
|
108 |
-
|
109 |
-
if ( $this->wp_post_id ) {
|
110 |
-
$this->wp_post = get_post( $this->wp_post_id );
|
111 |
-
}
|
112 |
-
|
113 |
-
// get the storage values
|
114 |
-
$storage = $this->storage();
|
115 |
-
//$storageData = $storage->get_storage();
|
116 |
-
$using_editor_old = $storage->get( Brizy_Editor_Constants::USES_BRIZY, false );
|
117 |
-
$storage_post = $storage->get( self::BRIZY_POST, false );
|
118 |
-
|
119 |
-
// check for deprecated forms of posts
|
120 |
-
if ( $storage_post instanceof self ) {
|
121 |
-
$this->set_editor_data( $storage_post->editor_data );
|
122 |
-
$this->set_needs_compile( true );
|
123 |
-
$this->set_uses_editor( $using_editor_old );
|
124 |
-
$this->save();
|
125 |
-
} else if ( is_array( $storage_post ) ) {
|
126 |
-
$this->loadStorageData( $storage_post );
|
127 |
-
}
|
128 |
-
|
129 |
-
// check if the old flag is set
|
130 |
-
if ( ! is_null( $using_editor_old ) ) {
|
131 |
-
$this->uses_editor = (bool) $using_editor_old;
|
132 |
-
$storage->delete( Brizy_Editor_Constants::USES_BRIZY );
|
133 |
-
$this->save();
|
134 |
-
}
|
135 |
-
|
136 |
-
if ( $this->uses_editor() ) {
|
137 |
-
$this->create_uid();
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* @param $apost
|
143 |
-
*
|
144 |
-
* @return Brizy_Editor_Post|null
|
145 |
-
* @throws Brizy_Editor_Exceptions_NotFound
|
146 |
-
*/
|
147 |
-
public static function get( $apost ) {
|
148 |
-
|
149 |
-
$wp_post_id = $apost;
|
150 |
-
if ( $apost instanceof WP_Post ) {
|
151 |
-
$wp_post_id = $apost->ID;
|
152 |
-
}
|
153 |
-
|
154 |
-
if ( isset( self::$instance[ $wp_post_id ] ) ) {
|
155 |
-
return self::$instance[ $wp_post_id ];
|
156 |
-
}
|
157 |
-
|
158 |
-
return self::$instance[ $wp_post_id ] = new self( $wp_post_id );
|
159 |
-
|
160 |
-
}
|
161 |
-
|
162 |
-
public static function getAutoSavePost( $postId, $userId ) {
|
163 |
-
$postParentId = self::getPostParent( $postId );
|
164 |
-
$autosave = wp_get_post_autosave( $postParentId, $userId );
|
165 |
-
|
166 |
-
if ( ! $autosave ) {
|
167 |
-
return;
|
168 |
-
}
|
169 |
-
|
170 |
-
$post = get_post( $postId );
|
171 |
-
|
172 |
-
$postDate = new DateTime( $post->post_modified );
|
173 |
-
$autosaveDate = new DateTime( $autosave->post_modified );
|
174 |
-
|
175 |
-
if ( $postDate > $autosaveDate ) {
|
176 |
-
return null;
|
177 |
-
}
|
178 |
-
|
179 |
-
return $autosave->ID;
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* @param $wp_post_id
|
184 |
-
* @param bool $throw
|
185 |
-
*
|
186 |
-
* @return bool
|
187 |
-
* @throws Brizy_Editor_Exceptions_UnsupportedPostType
|
188 |
-
*/
|
189 |
-
public static function checkIfPostTypeIsSupported( $wp_post_id, $throw = true ) {
|
190 |
-
$type = get_post_type( $wp_post_id );
|
191 |
-
|
192 |
-
$supported_post_types = Brizy_Editor::get()->supported_post_types();
|
193 |
-
$supported_post_types[] = 'revision';
|
194 |
-
|
195 |
-
if ( ! in_array( $type, $supported_post_types ) ) {
|
196 |
-
|
197 |
-
if ( $throw ) {
|
198 |
-
throw new Brizy_Editor_Exceptions_UnsupportedPostType(
|
199 |
-
"Brizy editor doesn't support '{$type}' post type"
|
200 |
-
);
|
201 |
-
} else {
|
202 |
-
return false;
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
return true;
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* @return string
|
211 |
-
*/
|
212 |
-
public function serialize() {
|
213 |
-
$get_object_vars = get_object_vars( $this );
|
214 |
-
|
215 |
-
unset( $get_object_vars['wp_post_id'] );
|
216 |
-
unset( $get_object_vars['wp_post'] );
|
217 |
-
unset( $get_object_vars['api_page'] );
|
218 |
-
unset( $get_object_vars['store_assets'] );
|
219 |
-
unset( $get_object_vars['assets'] );
|
220 |
-
|
221 |
-
return serialize( $get_object_vars );
|
222 |
-
}
|
223 |
-
|
224 |
-
/**
|
225 |
-
* @param $data
|
226 |
-
*/
|
227 |
-
public function unserialize( $data ) {
|
228 |
-
parent::unserialize( $data ); // TODO: Change the autogenerated stub
|
229 |
-
|
230 |
-
if ( $this->get_api_page() ) {
|
231 |
-
$save_data = $this->get_api_page()->get_content();
|
232 |
-
$this->set_editor_data( $save_data );
|
233 |
-
}
|
234 |
-
|
235 |
-
unset( $this->api_page );
|
236 |
-
}
|
237 |
-
|
238 |
-
public function convertToOptionValue() {
|
239 |
-
|
240 |
-
return array(
|
241 |
-
'compiled_html' => $this->get_encoded_compiled_html(),
|
242 |
-
'compiled_html_body' => $this->get_compiled_html_body(),
|
243 |
-
'compiled_html_head' => $this->get_compiled_html_head(),
|
244 |
-
'editor_version' => $this->editor_version,
|
245 |
-
'compiler_version' => $this->compiler_version,
|
246 |
-
'plugin_version' => $this->plugin_version,
|
247 |
-
'editor_data' => $this->editor_data,
|
248 |
-
Brizy_Editor_Constants::USES_BRIZY => $this->uses_editor
|
249 |
-
);
|
250 |
-
}
|
251 |
-
|
252 |
-
public function loadStorageData( $data ) {
|
253 |
-
if ( isset( $data['compiled_html'] ) ) {
|
254 |
-
$this->set_encoded_compiled_html( $data['compiled_html'] );
|
255 |
-
}
|
256 |
-
|
257 |
-
$this->set_editor_data( $data['editor_data'] );
|
258 |
-
$data_needs_compile = isset( $data['needs_compile'] ) ? $data['needs_compile'] : true;
|
259 |
-
$this->needs_compile = metadata_exists( 'post', $this->wp_post_id, self::BRIZY_POST_NEEDS_COMPILE_KEY ) ? (bool) get_post_meta( $this->wp_post_id, self::BRIZY_POST_NEEDS_COMPILE_KEY, true ) : $data_needs_compile;
|
260 |
-
$this->editor_version = isset( $data['editor_version'] ) ? $data['editor_version'] : null;
|
261 |
-
$this->compiler_version = isset( $data['compiler_version'] ) ? $data['compiler_version'] : null;
|
262 |
-
$this->plugin_version = isset( $data['plugin_version'] ) ? $data['plugin_version'] : null;
|
263 |
-
$this->compiled_html_head = isset( $data['compiled_html_head'] ) ? $data['compiled_html_head'] : null;
|
264 |
-
$this->compiled_html_body = isset( $data['compiled_html_body'] ) ? $data['compiled_html_body'] : null;
|
265 |
-
$this->uses_editor = (bool) ( isset( $data[ Brizy_Editor_Constants::USES_BRIZY ] ) ? $data[ Brizy_Editor_Constants::USES_BRIZY ] : false );
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Mark all brizy post that needs compile
|
270 |
-
*/
|
271 |
-
public static function mark_all_for_compilation() {
|
272 |
-
global $wpdb;
|
273 |
-
$wpdb->update( $wpdb->postmeta, array( 'meta_value' => 1 ), array( 'meta_key' => self::BRIZY_POST_NEEDS_COMPILE_KEY ) );
|
274 |
-
}
|
275 |
-
|
276 |
-
// /**
|
277 |
-
// * @return Brizy_Editor_Post[]
|
278 |
-
// * @throws Brizy_Editor_Exceptions_NotFound
|
279 |
-
// * @throws Brizy_Editor_Exceptions_UnsupportedPostType
|
280 |
-
// * @todo: We need to move this method from here
|
281 |
-
// */
|
282 |
-
// public static function foreach_brizy_post( $callback ) {
|
283 |
-
// global $wpdb;
|
284 |
-
// $posts = $wpdb->get_results(
|
285 |
-
// $wpdb->prepare( "SELECT p.post_type, p.ID as post_id FROM {$wpdb->postmeta} pm
|
286 |
-
// JOIN {$wpdb->posts} p ON p.ID=pm.post_id and p.post_type <> 'revision' and p.post_type<>'attachment'
|
287 |
-
// WHERE pm.meta_key = %s ", Brizy_Editor_Storage_Post::META_KEY )
|
288 |
-
// );
|
289 |
-
//
|
290 |
-
// $result = array();
|
291 |
-
// foreach ( $posts as $p ) {
|
292 |
-
// if ( in_array( $p->post_type, Brizy_Editor::get()->supported_post_types() ) ) {
|
293 |
-
//
|
294 |
-
// if ( is_callable( $callback ) ) {
|
295 |
-
// $callback( $p );
|
296 |
-
// }
|
297 |
-
// }
|
298 |
-
// }
|
299 |
-
//
|
300 |
-
// return $result;
|
301 |
-
// }
|
302 |
-
|
303 |
-
/**
|
304 |
-
* @return Brizy_Editor_Post[]
|
305 |
-
* @throws Brizy_Editor_Exceptions_NotFound
|
306 |
-
* @throws Brizy_Editor_Exceptions_UnsupportedPostType
|
307 |
-
*/
|
308 |
-
public static function get_all_brizy_post_ids() {
|
309 |
-
global $wpdb;
|
310 |
-
$posts = $wpdb->get_results(
|
311 |
-
$wpdb->prepare( "SELECT p.ID FROM {$wpdb->postmeta} pm
|
312 |
-
JOIN {$wpdb->posts} p ON p.ID=pm.post_id and p.post_type <> 'revision' and p.post_type<>'attachment'
|
313 |
-
WHERE pm.meta_key = %s ", Brizy_Editor_Storage_Post::META_KEY )
|
314 |
-
);
|
315 |
-
|
316 |
-
return array_map( function ( $o ) {
|
317 |
-
return (int) $o->ID;
|
318 |
-
}, $posts );
|
319 |
-
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
* @param $project
|
323 |
-
* @param $post
|
324 |
-
*
|
325 |
-
* @return Brizy_Editor_Post
|
326 |
-
* @throws Brizy_Editor_Exceptions_UnsupportedPostType
|
327 |
-
* @throws Exception
|
328 |
-
*/
|
329 |
-
public static function create( $project, $post ) {
|
330 |
-
if ( ! in_array( ( $type = get_post_type( $post->ID ) ), Brizy_Editor::get()->supported_post_types() ) ) {
|
331 |
-
throw new Brizy_Editor_Exceptions_UnsupportedPostType(
|
332 |
-
"Brizy editor doesn't support '$type' post type 2"
|
333 |
-
);
|
334 |
-
}
|
335 |
-
Brizy_Logger::instance()->notice( 'Create post', array( $project, $post ) );
|
336 |
-
|
337 |
-
$post = new self( $post->ID );
|
338 |
-
$post->set_plugin_version( BRIZY_VERSION );
|
339 |
-
|
340 |
-
return $post;
|
341 |
-
}
|
342 |
-
|
343 |
-
private function getLastAutosave( $postParentId, $user_id ) {
|
344 |
-
global $wpdb;
|
345 |
-
|
346 |
-
$postParentId = (int) $postParentId;
|
347 |
-
$user_id = (int) $user_id;
|
348 |
-
|
349 |
-
$query = sprintf( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_type= 'revision' AND post_status= 'inherit'AND post_name LIKE '%d-autosave%%'", $postParentId, $postParentId );
|
350 |
-
|
351 |
-
if ( is_integer( $user_id ) ) {
|
352 |
-
$query .= " AND post_author={$user_id}";
|
353 |
-
}
|
354 |
-
|
355 |
-
$query .= " ORDER BY post_date DESC";
|
356 |
-
|
357 |
-
return (int) $wpdb->get_var( $query );
|
358 |
-
|
359 |
-
}
|
360 |
-
|
361 |
-
// public function auto_save_post_deperecated() {
|
362 |
-
// try {
|
363 |
-
// $user_id = get_current_user_id();
|
364 |
-
// $post = $this->getWpPost();
|
365 |
-
// $postParentId = $this->get_parent_id();
|
366 |
-
// $old_autosave = $this->get_last_autosave( $postParentId, $user_id );
|
367 |
-
// $post_data = get_object_vars( $post );
|
368 |
-
// $post_data['post_content'] .= "\n<!-- " . time() . "-->";
|
369 |
-
// $autosavePost = null;
|
370 |
-
//
|
371 |
-
// if ( $old_autosave ) {
|
372 |
-
// $autosavePost = self::get( $old_autosave );
|
373 |
-
// }
|
374 |
-
//
|
375 |
-
// if ( $old_autosave ) {
|
376 |
-
// $new_autosave = _wp_post_revision_data( $post_data, true );
|
377 |
-
// $new_autosave['ID'] = $old_autosave;
|
378 |
-
// $new_autosave['post_author'] = $user_id;
|
379 |
-
//
|
380 |
-
// // If the new autosave has the same content as the post, delete the autosave.
|
381 |
-
// $autosave_is_different = false;
|
382 |
-
//
|
383 |
-
// foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) {
|
384 |
-
// if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
|
385 |
-
// $autosave_is_different = true;
|
386 |
-
// break;
|
387 |
-
// }
|
388 |
-
// }
|
389 |
-
//
|
390 |
-
// if ( ! $autosave_is_different ) {
|
391 |
-
// wp_delete_post_revision( $old_autosave );
|
392 |
-
//
|
393 |
-
// return new WP_Error( 'rest_autosave_no_changes', __( 'There is nothing to save. The autosave and the post content are the same.' ), array( 'status' => 400 ) );
|
394 |
-
// }
|
395 |
-
//
|
396 |
-
// /**
|
397 |
-
// * This filter is documented in wp-admin/post.php.
|
398 |
-
// */
|
399 |
-
// do_action( 'wp_creating_autosave', $new_autosave );
|
400 |
-
//
|
401 |
-
// // wp_update_post expects escaped array.
|
402 |
-
// wp_update_post( wp_slash( $new_autosave ) );
|
403 |
-
//
|
404 |
-
// } else {
|
405 |
-
// // Create the new autosave as a special post revision.
|
406 |
-
// $revId = _wp_put_post_revision( $post_data, true );
|
407 |
-
// $autosavePost = self::get( $revId );
|
408 |
-
// }
|
409 |
-
//
|
410 |
-
// $autosavePost = $this->populateAutoSavedData( $autosavePost );
|
411 |
-
// $autosavePost->save();
|
412 |
-
//
|
413 |
-
// } catch ( Exception $exception ) {
|
414 |
-
// Brizy_Logger::instance()->exception( $exception );
|
415 |
-
//
|
416 |
-
// return false;
|
417 |
-
// }
|
418 |
-
// }
|
419 |
-
|
420 |
-
public function save_wp_post() {
|
421 |
-
|
422 |
-
$post_type = $this->get_wp_post()->post_type;
|
423 |
-
$post_type_object = get_post_type_object( $post_type );
|
424 |
-
|
425 |
-
if ( ! $post_type_object ) {
|
426 |
-
Brizy_Logger::instance()->critical( 'Invalid post type provided on save_wp_post', [ 'post_type' => $post_type ] );
|
427 |
-
return;
|
428 |
-
}
|
429 |
-
|
430 |
-
$can_publish = current_user_can( $post_type_object->cap->publish_posts );
|
431 |
-
$post_status = $can_publish ? 'publish' : 'pending';
|
432 |
-
|
433 |
-
$brizy_compiled_page = $this->get_compiled_page();
|
434 |
-
|
435 |
-
$this->deleteOldAutoSaves( $this->get_parent_id() );
|
436 |
-
|
437 |
-
$body = $brizy_compiled_page->get_body();
|
438 |
-
|
439 |
-
|
440 |
-
wp_update_post( array(
|
441 |
-
'ID' => $this->get_parent_id(),
|
442 |
-
'post_status' => $post_status,
|
443 |
-
'post_content' => $body
|
444 |
-
) );
|
445 |
-
}
|
446 |
-
|
447 |
-
|
448 |
-
/**
|
449 |
-
* This saves ony data.. it does not touch the wordpress post
|
450 |
-
*
|
451 |
-
*
|
452 |
-
* @return bool
|
453 |
-
*/
|
454 |
-
public function save( $autosave = 0 ) {
|
455 |
-
|
456 |
-
try {
|
457 |
-
|
458 |
-
if ( $autosave == 0 ) {
|
459 |
-
$value = $this->convertToOptionValue();
|
460 |
-
$this->storage()->set( self::BRIZY_POST, $value );
|
461 |
-
} else {
|
462 |
-
$this->auto_save_post( $this->get_wp_post(), function ( $autosaveObject ) {
|
463 |
-
$autosavePost = $this->populateAutoSavedData( $autosaveObject );
|
464 |
-
$autosavePost->save();
|
465 |
-
} );
|
466 |
-
}
|
467 |
-
|
468 |
-
} catch ( Exception $exception ) {
|
469 |
-
Brizy_Logger::instance()->exception( $exception );
|
470 |
-
|
471 |
-
return false;
|
472 |
-
}
|
473 |
-
}
|
474 |
-
|
475 |
-
|
476 |
-
/**
|
477 |
-
* @return bool
|
478 |
-
* @throws Brizy_Editor_Exceptions_ServiceUnavailable
|
479 |
-
* @throws Exception
|
480 |
-
*/
|
481 |
-
public function compile_page() {
|
482 |
-
|
483 |
-
Brizy_Logger::instance()->notice( 'Compile page', array( $this ) );
|
484 |
-
|
485 |
-
$compiled_html = Brizy_Editor_User::get()->compile_page( Brizy_Editor_Project::get(), $this );
|
486 |
-
$compiled_html = Brizy_SiteUrlReplacer::hideSiteUrl( $compiled_html );
|
487 |
-
|
488 |
-
$this->set_compiled_html( $compiled_html );
|
489 |
-
|
490 |
-
$this->set_compiled_html_head( null );
|
491 |
-
$this->set_compiled_html_body( null );
|
492 |
-
|
493 |
-
$this->set_needs_compile( false );
|
494 |
-
$this->set_compiler_version( BRIZY_EDITOR_VERSION );
|
495 |
-
|
496 |
-
return true;
|
497 |
-
}
|
498 |
-
|
499 |
-
/**
|
500 |
-
* @return Brizy_Editor_CompiledHtml
|
501 |
-
*/
|
502 |
-
public function get_compiled_page() {
|
503 |
-
|
504 |
-
if ( self::$compiled_page ) {
|
505 |
-
return self::$compiled_page;
|
506 |
-
}
|
507 |
-
|
508 |
-
return new Brizy_Editor_CompiledHtml( $this->get_compiled_html() );
|
509 |
-
}
|
510 |
-
|
511 |
-
public function isCompiledWithCurrentVersion() {
|
512 |
-
return $this->get_compiler_version() === BRIZY_EDITOR_VERSION;
|
513 |
-
}
|
514 |
-
|
515 |
-
/**
|
516 |
-
* @deprecated;
|
517 |
-
*/
|
518 |
-
public function get_api_page() {
|
519 |
-
|
520 |
-
if ( isset( $this->api_page ) ) {
|
521 |
-
return $this->api_page;
|
522 |
-
}
|
523 |
-
|
524 |
-
return null;
|
525 |
-
}
|
526 |
-
|
527 |
-
/**
|
528 |
-
* @return mixed
|
529 |
-
*/
|
530 |
-
public function get_id() {
|
531 |
-
return $this->wp_post_id;
|
532 |
-
}
|
533 |
-
|
534 |
-
/**
|
535 |
-
* A unique id assigned when brizy is enabled for this post
|
536 |
-
*
|
537 |
-
* @return string
|
538 |
-
*/
|
539 |
-
public function create_uid() {
|
540 |
-
|
541 |
-
if ( $this->uid ) {
|
542 |
-
return $this->uid;
|
543 |
-
}
|
544 |
-
|
545 |
-
$this->uid = get_post_meta( $this->get_parent_id(), 'brizy_post_uid', true );
|
546 |
-
|
547 |
-
if ( ! $this->uid ) {
|
548 |
-
$this->uid = md5( $this->get_parent_id() . time() );
|
549 |
-
update_post_meta( $this->get_parent_id(), 'brizy_post_uid', $this->uid );
|
550 |
-
}
|
551 |
-
|
552 |
-
return $this->uid;
|
553 |
-
}
|
554 |
-
|
555 |
-
/**
|
556 |
-
* @return string
|
557 |
-
*/
|
558 |
-
public function get_uid() {
|
559 |
-
return $this->uid;
|
560 |
-
}
|
561 |
-
|
562 |
-
/**
|
563 |
-
* @return string
|
564 |
-
*/
|
565 |
-
public function get_editor_data() {
|
566 |
-
|
567 |
-
if ( ( $decodedData = base64_decode( $this->editor_data, true ) ) !== false ) {
|
568 |
-
return $decodedData;
|
569 |
-
}
|
570 |
-
|
571 |
-
return $this->editor_data;
|
572 |
-
}
|
573 |
-
|
574 |
-
/**
|
575 |
-
* @param $content
|
576 |
-
*
|
577 |
-
* @return $this
|
578 |
-
*/
|
579 |
-
public function set_editor_data( $content ) {
|
580 |
-
|
581 |
-
if ( base64_decode( $content, true ) !== false ) {
|
582 |
-
$this->editor_data = $content;
|
583 |
-
} else {
|
584 |
-
$this->editor_data = base64_encode( $content );
|
585 |
-
}
|
586 |
-
|
587 |
-
return $this;
|
588 |
-
}
|
589 |
-
|
590 |
-
/**
|
591 |
-
* @return false|int|mixed
|
592 |
-
*/
|
593 |
-
public function get_parent_id() {
|
594 |
-
return self::getPostParent( $this->get_id() );
|
595 |
-
}
|
596 |
-
|
597 |
-
protected static function getPostParent( $postId ) {
|
598 |
-
$id = wp_is_post_revision( $postId );
|
599 |
-
|
600 |
-
if ( ! $id ) {
|
601 |
-
$id = $postId;
|
602 |
-
}
|
603 |
-
|
604 |
-
return $id;
|
605 |
-
}
|
606 |
-
|
607 |
-
/**
|
608 |
-
* @return string
|
609 |
-
*/
|
610 |
-
public function get_compiled_html() {
|
611 |
-
return $this->compiled_html;
|
612 |
-
}
|
613 |
-
|
614 |
-
/**
|
615 |
-
* @param string $compiled_html
|
616 |
-
*
|
617 |
-
* @return Brizy_Editor_Post
|
618 |
-
*/
|
619 |
-
public function set_compiled_html( $compiled_html ) {
|
620 |
-
$this->compiled_html = $compiled_html;
|
621 |
-
|
622 |
-
return $this;
|
623 |
-
}
|
624 |
-
|
625 |
-
|
626 |
-
/**
|
627 |
-
* @param $compiled_html
|
628 |
-
*
|
629 |
-
* @return $this
|
630 |
-
*/
|
631 |
-
public function set_encoded_compiled_html( $compiled_html ) {
|
632 |
-
|
633 |
-
if ( ( $decodedData = base64_decode( $compiled_html, true ) ) !== false ) {
|
634 |
-
$this->set_compiled_html( $decodedData );
|
635 |
-
} else {
|
636 |
-
$this->set_compiled_html( $compiled_html );
|
637 |
-
}
|
638 |
-
|
639 |
-
return $this;
|
640 |
-
}
|
641 |
-
|
642 |
-
/**
|
643 |
-
* @return string
|
644 |
-
*/
|
645 |
-
public function get_encoded_compiled_html() {
|
646 |
-
|
647 |
-
return base64_encode( $this->get_compiled_html() );
|
648 |
-
}
|
649 |
-
|
650 |
-
/**
|
651 |
-
* @return string
|
652 |
-
* @deprecated use get_compiled_html
|
653 |
-
*/
|
654 |
-
public function get_compiled_html_body() {
|
655 |
-
return $this->compiled_html_body;
|
656 |
-
}
|
657 |
-
|
658 |
-
/**
|
659 |
-
* @return string
|
660 |
-
* @deprecated use get_compiled_html
|
661 |
-
*/
|
662 |
-
public function get_compiled_html_head() {
|
663 |
-
return $this->compiled_html_head;
|
664 |
-
}
|
665 |
-
|
666 |
-
/**
|
667 |
-
* @param $html
|
668 |
-
*
|
669 |
-
* @return $this
|
670 |
-
* @deprecated use set_compiled_html
|
671 |
-
*
|
672 |
-
*/
|
673 |
-
public function set_compiled_html_body( $html ) {
|
674 |
-
$this->compiled_html_body = $html;
|
675 |
-
|
676 |
-
return $this;
|
677 |
-
}
|
678 |
-
|
679 |
-
/**
|
680 |
-
* @param $html
|
681 |
-
*
|
682 |
-
* @return $this
|
683 |
-
* @deprecated use set_compiled_html
|
684 |
-
*
|
685 |
-
*/
|
686 |
-
public function set_compiled_html_head( $html ) {
|
687 |
-
// remove all title and meta tags.
|
688 |
-
$this->compiled_html_head = $html;
|
689 |
-
|
690 |
-
return $this;
|
691 |
-
}
|
692 |
-
|
693 |
-
/**
|
694 |
-
* @return bool
|
695 |
-
*/
|
696 |
-
public function can_edit_posts() {
|
697 |
-
return current_user_can( "edit_posts" );
|
698 |
-
}
|
699 |
-
|
700 |
-
/**
|
701 |
-
* @return $this
|
702 |
-
* @throws Brizy_Editor_Exceptions_AccessDenied
|
703 |
-
*/
|
704 |
-
public function enable_editor() {
|
705 |
-
if ( ! $this->can_edit_posts() ) {
|
706 |
-
throw new Brizy_Editor_Exceptions_AccessDenied( 'Current user cannot edit page' );
|
707 |
-
}
|
708 |
-
$this->uses_editor = true;
|
709 |
-
|
710 |
-
return $this;
|
711 |
-
}
|
712 |
-
|
713 |
-
/**
|
714 |
-
*
|
715 |
-
*/
|
716 |
-
public function disable_editor() {
|
717 |
-
$this->uses_editor = false;
|
718 |
-
|
719 |
-
return $this;
|
720 |
-
}
|
721 |
-
|
722 |
-
/**
|
723 |
-
* @return Brizy_Editor_Storage_Post
|
724 |
-
*/
|
725 |
-
public function storage() {
|
726 |
-
return Brizy_Editor_Storage_Post::instance( $this->wp_post_id );
|
727 |
-
}
|
728 |
-
|
729 |
-
/**
|
730 |
-
* @return array|null|WP_Post
|
731 |
-
*/
|
732 |
-
public function get_wp_post() {
|
733 |
-
return $this->wp_post;
|
734 |
-
}
|
735 |
-
|
736 |
-
/**
|
737 |
-
* @return bool
|
738 |
-
*/
|
739 |
-
public function uses_editor() {
|
740 |
-
return $this->uses_editor;
|
741 |
-
}
|
742 |
-
|
743 |
-
/**
|
744 |
-
* @param $val
|
745 |
-
*
|
746 |
-
* @return $this
|
747 |
-
*/
|
748 |
-
public function set_uses_editor( $val ) {
|
749 |
-
$this->uses_editor = $val;
|
750 |
-
|
751 |
-
return $this;
|
752 |
-
}
|
753 |
-
|
754 |
-
|
755 |
-
/**
|
756 |
-
* @return string
|
757 |
-
*/
|
758 |
-
public function edit_url() {
|
759 |
-
return add_query_arg(
|
760 |
-
array( Brizy_Editor::prefix('-edit') => '' ),
|
761 |
-
get_permalink( $this->get_parent_id() )
|
762 |
-
);
|
763 |
-
}
|
764 |
-
|
765 |
-
/**
|
766 |
-
* @param $text
|
767 |
-
* @param string $tags
|
768 |
-
* @param bool $invert
|
769 |
-
*
|
770 |
-
* @return null|string|string[]
|
771 |
-
* @todo: We need to move this method from here
|
772 |
-
*
|
773 |
-
*/
|
774 |
-
function strip_tags_content( $text, $tags = '', $invert = false ) {
|
775 |
-
|
776 |
-
preg_match_all( '/<(.+?)[\s]*\/?[\s]*>/si', trim( $tags ), $tags );
|
777 |
-
$tags = array_unique( $tags[1] );
|
778 |
-
|
779 |
-
if ( is_array( $tags ) AND count( $tags ) > 0 ) {
|
780 |
-
if ( $invert == false ) {
|
781 |
-
return preg_replace( '@<(?!(?:' . implode( '|', $tags ) . ')\b)(\w+)\b.*?>(.*?</\1>)?@si', '', $text );
|
782 |
-
} else {
|
783 |
-
return preg_replace( '@<(' . implode( '|', $tags ) . ')\b.*?>(.*?</\1>)?@si', '', $text );
|
784 |
-
}
|
785 |
-
} elseif ( $invert == false ) {
|
786 |
-
return preg_replace( '@<(\w+)\b.*?>.*?</\1>@si', '', $text );
|
787 |
-
}
|
788 |
-
|
789 |
-
return $text;
|
790 |
-
}
|
791 |
-
|
792 |
-
/**
|
793 |
-
* @return array
|
794 |
-
*/
|
795 |
-
public function get_templates() {
|
796 |
-
|
797 |
-
$type = get_post_type( $this->get_id() );
|
798 |
-
$templates = array(
|
799 |
-
array(
|
800 |
-
'id' => '',
|
801 |
-
'title' => __( 'Default', 'brizy' )
|
802 |
-
)
|
803 |
-
);
|
804 |
-
|
805 |
-
foreach ( wp_get_theme()->get_page_templates( null, $type ) as $key => $title ) {
|
806 |
-
$templates[] = [
|
807 |
-
'id' => $key,
|
808 |
-
'title' => $title
|
809 |
-
];
|
810 |
-
}
|
811 |
-
|
812 |
-
return apply_filters( "brizy:$type:templates", $templates );
|
813 |
-
}
|
814 |
-
|
815 |
-
/**
|
816 |
-
* @param string $aTemplate
|
817 |
-
*
|
818 |
-
* @return $this
|
819 |
-
*/
|
820 |
-
public function set_template( $aTemplate ) {
|
821 |
-
|
822 |
-
$aTemplate = apply_filters( 'brizy_post_template', $aTemplate );
|
823 |
-
|
824 |
-
if ( $aTemplate == '' ) {
|
825 |
-
delete_post_meta( $this->get_id(), '_wp_page_template' );
|
826 |
-
} else {
|
827 |
-
update_post_meta( $this->get_id(), '_wp_page_template', $aTemplate );
|
828 |
-
}
|
829 |
-
|
830 |
-
return $this;
|
831 |
-
}
|
832 |
-
|
833 |
-
/**
|
834 |
-
* @return mixed
|
835 |
-
*/
|
836 |
-
public function get_template() {
|
837 |
-
return get_post_meta( $this->get_id(), '_wp_page_template', true );
|
838 |
-
}
|
839 |
-
|
840 |
-
/**
|
841 |
-
* @param string $editor_version
|
842 |
-
*/
|
843 |
-
public function set_editor_version( $editor_version ) {
|
844 |
-
$this->editor_version = $editor_version;
|
845 |
-
update_metadata( 'post', $this->wp_post_id, self::BRIZY_POST_EDITOR_VERSION, $editor_version );
|
846 |
-
}
|
847 |
-
|
848 |
-
/**
|
849 |
-
* @param string $compiler_version
|
850 |
-
*/
|
851 |
-
public function set_compiler_version( $compiler_version ) {
|
852 |
-
$this->compiler_version = $compiler_version;
|
853 |
-
update_metadata( 'post', $this->wp_post_id, self::BRIZY_POST_COMPILER_VERSION, $compiler_version );
|
854 |
-
}
|
855 |
-
|
856 |
-
/**
|
857 |
-
* @param string $plugin_version
|
858 |
-
*/
|
859 |
-
public function set_plugin_version( $plugin_version ) {
|
860 |
-
$this->plugin_version = $plugin_version;
|
861 |
-
update_metadata( 'post', $this->wp_post_id, self::BRIZY_POST_PLUGIN_VERSION, $plugin_version );
|
862 |
-
}
|
863 |
-
|
864 |
-
/**
|
865 |
-
* @param $v
|
866 |
-
*
|
867 |
-
* @return $this
|
868 |
-
*/
|
869 |
-
public function set_needs_compile( $v ) {
|
870 |
-
$this->needs_compile = (bool) $v;
|
871 |
-
update_metadata( 'post', $this->wp_post_id, self::BRIZY_POST_NEEDS_COMPILE_KEY, (bool) $v );
|
872 |
-
|
873 |
-
return $this;
|
874 |
-
}
|
875 |
-
|
876 |
-
/**
|
877 |
-
* @return bool
|
878 |
-
*/
|
879 |
-
public function get_needs_compile() {
|
880 |
-
return $this->needs_compile;
|
881 |
-
}
|
882 |
-
|
883 |
-
/**
|
884 |
-
* @return string
|
885 |
-
*/
|
886 |
-
public function get_compiler_version() {
|
887 |
-
return $this->compiler_version;
|
888 |
-
}
|
889 |
-
|
890 |
-
/**
|
891 |
-
* @return string
|
892 |
-
*/
|
893 |
-
public function get_editor_version() {
|
894 |
-
return $this->editor_version;
|
895 |
-
}
|
896 |
-
|
897 |
-
protected function populateAutoSavedData( $autosave ) {
|
898 |
-
$autosave->set_template( $this->get_template() );
|
899 |
-
$autosave->set_editor_data( $this->get_editor_data() );
|
900 |
-
$autosave->set_editor_version( $this->get_editor_version() );
|
901 |
-
|
902 |
-
return $autosave;
|
903 |
-
}
|
904 |
-
}
|
905 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: brizy, page builder, editor, visual editor, unyson, wysiwyg, landing page,
|
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -139,6 +139,12 @@ The progress you're making while building your page is always backed up in the c
|
|
139 |
|
140 |
== Changelog ==
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
= 2.0.6 - 2020-08-18 =
|
143 |
* Fixed: Screenshots not working with Embed with scripts in it
|
144 |
* Fixed: Memory issue that was causing a few projects to not work at preview
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 5.5
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 2.0.7
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
139 |
|
140 |
== Changelog ==
|
141 |
|
142 |
+
= 2.0.7 - 2020-08-25 =
|
143 |
+
* Fixed: The white label support url
|
144 |
+
* Fixed: Edit With Brizy is not displayed when using Gutenberg
|
145 |
+
* Fixed: The creation of the uid when a revision is provided
|
146 |
+
* Fixed: Mail template has only one value in all placeholders
|
147 |
+
|
148 |
= 2.0.6 - 2020-08-18 =
|
149 |
* Fixed: Screenshots not working with Embed with scripts in it
|
150 |
* Fixed: Memory issue that was causing a few projects to not work at preview
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit1d1ab9eac3d4e5f5757efb198c58b604::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitcc7d05039b8ac8c4ae75ac0fabc65710
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitcc7d05039b8ac8c4ae75ac0fabc65710
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit1d1ab9eac3d4e5f5757efb198c58b604
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit1d1ab9eac3d4e5f5757efb198c58b604', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit1d1ab9eac3d4e5f5757efb198c58b604', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit1d1ab9eac3d4e5f5757efb198c58b604::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInit1d1ab9eac3d4e5f5757efb198c58b604::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequire1d1ab9eac3d4e5f5757efb198c58b604($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequire1d1ab9eac3d4e5f5757efb198c58b604($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
@@ -74,9 +74,9 @@ class ComposerStaticInitcc7d05039b8ac8c4ae75ac0fabc65710
|
|
74 |
public static function getInitializer(ClassLoader $loader)
|
75 |
{
|
76 |
return \Closure::bind(function () use ($loader) {
|
77 |
-
$loader->prefixLengthsPsr4 =
|
78 |
-
$loader->prefixDirsPsr4 =
|
79 |
-
$loader->prefixesPsr0 =
|
80 |
|
81 |
}, null, ClassLoader::class);
|
82 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit1d1ab9eac3d4e5f5757efb198c58b604
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
74 |
public static function getInitializer(ClassLoader $loader)
|
75 |
{
|
76 |
return \Closure::bind(function () use ($loader) {
|
77 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit1d1ab9eac3d4e5f5757efb198c58b604::$prefixLengthsPsr4;
|
78 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit1d1ab9eac3d4e5f5757efb198c58b604::$prefixDirsPsr4;
|
79 |
+
$loader->prefixesPsr0 = ComposerStaticInit1d1ab9eac3d4e5f5757efb198c58b604::$prefixesPsr0;
|
80 |
|
81 |
}, null, ClassLoader::class);
|
82 |
}
|