Version Description
- 2018-06-25 =
- Fixed: Changed the way we store the data in db
- Fixed: Submit form for guests
- Fixed: Form serialization
- Fixed: Clean the logs table when the plugin is deactivated
Download this release
Release Info
Developer | themefusecom |
Plugin | Brizy – Page Builder |
Version | 1.0.16 |
Comparing to | |
See all releases |
Code changes from version 1.0.15 to 1.0.16
- README.md +7 -1
- admin/main.php +0 -1
- admin/serializable.php +6 -0
- brizy.php +8 -4
- editor/api.php +32 -33
- editor/api/access-token.php +21 -0
- editor/api/page.php +13 -1
- editor/api/project.php +12 -4
- editor/editor/editor.php +2 -2
- editor/forms/form.php +22 -5
- editor/helper/dom.php +1 -1
- editor/load.php +2 -3
- editor/post.php +33 -13
- editor/project.php +27 -97
- editor/resources/static-script.php +1 -1
- editor/resources/static.php +2 -2
- editor/storage/abstract.php +1 -1
- editor/storage/common.php +1 -1
- editor/storage/post.php +1 -1
- editor/url-builder.php +1 -1
- editor/user.php +28 -32
- editor/view.php +2 -2
- logger.php +12 -0
- readme.txt +7 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +4 -4
- 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: 4.9<br>
|
5 |
Requires PHP: 5.4<br>
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv3<br>
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -96,6 +96,12 @@ A good bug report includes full details to easily understand the issue you are h
|
|
96 |
|
97 |
## Changelog
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
### 1.0.15 - 2018-06-18 ###
|
100 |
* New: Added new icons
|
101 |
* Fixed: Fixed the scripts that hide the editor
|
3 |
Requires at least: 4.5<br>
|
4 |
Tested up to: 4.9<br>
|
5 |
Requires PHP: 5.4<br>
|
6 |
+
Stable tag: 1.0.16<br>
|
7 |
License: GPLv3<br>
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
96 |
|
97 |
## Changelog
|
98 |
|
99 |
+
### 1.0.16 - 2018-06-25 ###
|
100 |
+
* Fixed: Changed the way we store the data in db
|
101 |
+
* Fixed: Submit form for guests
|
102 |
+
* Fixed: Form serialization
|
103 |
+
* Fixed: Clean the logs table when the plugin is deactivated
|
104 |
+
|
105 |
### 1.0.15 - 2018-06-18 ###
|
106 |
* New: Added new icons
|
107 |
* Fixed: Fixed the scripts that hide the editor
|
admin/main.php
CHANGED
@@ -85,7 +85,6 @@ class Brizy_Admin_Main {
|
|
85 |
}
|
86 |
|
87 |
$b_post->compile_page();
|
88 |
-
$b_post->save();
|
89 |
|
90 |
remove_action( 'save_post', array( $this, 'compile_post_action' ) );
|
91 |
wp_update_post( array( 'ID' => $post_id, 'post_content' => $b_post->get_compiled_html_body() ) );
|
85 |
}
|
86 |
|
87 |
$b_post->compile_page();
|
|
|
88 |
|
89 |
remove_action( 'save_post', array( $this, 'compile_post_action' ) );
|
90 |
wp_update_post( array( 'ID' => $post_id, 'post_content' => $b_post->get_compiled_html_body() ) );
|
admin/serializable.php
CHANGED
@@ -23,6 +23,12 @@ abstract class Brizy_Admin_Serializable implements Serializable, JsonSerializabl
|
|
23 |
}
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
public function jsonSerialize() {
|
27 |
return get_object_vars( $this );
|
28 |
}
|
23 |
}
|
24 |
}
|
25 |
|
26 |
+
abstract public function convertToOptionValue( );
|
27 |
+
|
28 |
+
static public function createFromSerializedData( $data ) {
|
29 |
+
throw new Exception( 'Not implemented' );
|
30 |
+
}
|
31 |
+
|
32 |
public function jsonSerialize() {
|
33 |
return get_object_vars( $this );
|
34 |
}
|
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: 1.0.
|
9 |
* Text Domain: brizy
|
10 |
* License: GPLv3
|
11 |
* Domain Path: /languages
|
@@ -13,7 +13,7 @@
|
|
13 |
|
14 |
define( 'BRIZY_DEVELOPMENT', false );
|
15 |
define( 'BRIZY_LOG', false );
|
16 |
-
define( 'BRIZY_VERSION', '1.0.
|
17 |
define( 'BRIZY_EDITOR_VERSION', '1.0.39' );
|
18 |
define( 'BRIZY_FILE', __FILE__ );
|
19 |
define( 'BRIZY_PLUGIN_BASE', plugin_basename( BRIZY_FILE ) );
|
@@ -24,11 +24,15 @@ function brizy_install() {
|
|
24 |
Brizy_Logger::install();
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
27 |
register_activation_hook( __FILE__, 'brizy_install' );
|
|
|
28 |
|
29 |
include_once 'autoload.php';
|
30 |
include_once 'editor/load.php';
|
31 |
include_once 'shortcode/load.php';
|
32 |
include_once 'public/hooks.php';
|
33 |
-
include_once 'admin/load.php';
|
34 |
-
|
5 |
* Plugin URI: https://brizy.io/
|
6 |
* Author: Brizy.io
|
7 |
* Author URI: https://brizy.io/
|
8 |
+
* Version: 1.0.16
|
9 |
* Text Domain: brizy
|
10 |
* License: GPLv3
|
11 |
* Domain Path: /languages
|
13 |
|
14 |
define( 'BRIZY_DEVELOPMENT', false );
|
15 |
define( 'BRIZY_LOG', false );
|
16 |
+
define( 'BRIZY_VERSION', '1.0.16' );
|
17 |
define( 'BRIZY_EDITOR_VERSION', '1.0.39' );
|
18 |
define( 'BRIZY_FILE', __FILE__ );
|
19 |
define( 'BRIZY_PLUGIN_BASE', plugin_basename( BRIZY_FILE ) );
|
24 |
Brizy_Logger::install();
|
25 |
}
|
26 |
|
27 |
+
function brizy_clean() {
|
28 |
+
Brizy_Logger::clean();
|
29 |
+
}
|
30 |
+
|
31 |
register_activation_hook( __FILE__, 'brizy_install' );
|
32 |
+
register_deactivation_hook( __FILE__, 'brizy_clean' );
|
33 |
|
34 |
include_once 'autoload.php';
|
35 |
include_once 'editor/load.php';
|
36 |
include_once 'shortcode/load.php';
|
37 |
include_once 'public/hooks.php';
|
38 |
+
include_once 'admin/load.php';
|
|
editor/api.php
CHANGED
@@ -69,32 +69,36 @@ class Brizy_Editor_API {
|
|
69 |
|
70 |
private function initialize() {
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
$this,
|
95 |
-
'
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
|
99 |
add_action( 'wp_ajax_' . self::AJAX_SUBMIT_FORM, array( $this, 'submit_form' ) );
|
100 |
add_action( 'wp_ajax_nopriv_' . self::AJAX_SUBMIT_FORM, array( $this, 'submit_form' ) );
|
@@ -441,15 +445,10 @@ class Brizy_Editor_API {
|
|
441 |
**/
|
442 |
public function update_item() {
|
443 |
try {
|
444 |
-
|
445 |
-
$data
|
446 |
-
//$title = $this->param( 'title' );
|
447 |
$atemplate = $this->param( 'template' );
|
448 |
|
449 |
-
// if ( $title ) {
|
450 |
-
// $this->post->set_title( $title );
|
451 |
-
// }
|
452 |
-
|
453 |
if ( $atemplate ) {
|
454 |
$this->post->set_template( $atemplate );
|
455 |
}
|
69 |
|
70 |
private function initialize() {
|
71 |
|
72 |
+
if ( Brizy_Editor::is_user_allowed() ) {
|
73 |
+
|
74 |
+
add_action( 'wp_ajax_' . self::AJAX_PING, array( $this, 'ping' ) );
|
75 |
+
add_action( 'wp_ajax_' . self::AJAX_GET, array( $this, 'get_item' ) );
|
76 |
+
add_action( 'wp_ajax_' . self::AJAX_UPDATE, array( $this, 'update_item' ) );
|
77 |
+
add_action( 'wp_ajax_' . self::AJAX_GET_GLOBALS, array( $this, 'get_globals' ) );
|
78 |
+
add_action( 'wp_ajax_' . self::AJAX_SET_GLOBALS, array( $this, 'set_globals' ) );
|
79 |
+
add_action( 'wp_ajax_' . self::AJAX_MEDIA, array( $this, 'media' ) );
|
80 |
+
add_action( 'wp_ajax_' . self::AJAX_SIDEBARS, array( $this, 'get_sidebars' ) );
|
81 |
+
//add_action( 'wp_ajax_' . self::AJAX_BUILD, array( $this, 'build_content' ) );
|
82 |
+
add_action( 'wp_ajax_' . self::AJAX_SIDEBAR_CONTENT, array( $this, 'sidebar_content' ) );
|
83 |
+
add_action( 'wp_ajax_' . self::AJAX_SHORTCODE_CONTENT, array( $this, 'shortcode_content' ) );
|
84 |
+
add_action( 'wp_ajax_' . self::AJAX_SHORTCODE_LIST, array( $this, 'shortcode_list' ) );
|
85 |
+
add_action( 'wp_ajax_' . self::AJAX_GET_TEMPLATES, array( $this, 'template_list' ) );
|
86 |
+
add_action( 'wp_ajax_' . self::AJAX_GET_INTERNAL_LINKS, array( $this, 'get_internal_links' ) );
|
87 |
+
add_action( 'wp_ajax_' . self::AJAX_GET_MENU_LIST, array( $this, 'get_menu_list' ) );
|
88 |
+
add_action( 'wp_ajax_' . self::AJAX_SAVE_TRIGGER, array( $this, 'save_trigger' ) );
|
89 |
+
add_action( 'wp_ajax_' . self::AJAX_GET_TERMS, array( $this, 'get_terms' ) );
|
90 |
+
add_action( 'wp_ajax_' . self::AJAX_JWT_TOKEN, array( $this, 'multipass_create' ) );
|
91 |
+
|
92 |
+
add_action( 'wp_ajax_' . self::AJAX_GET_DEFAULT_FORM, array( $this, 'default_form' ) );
|
93 |
+
add_action( 'wp_ajax_' . self::AJAX_GET_FORM, array( $this, 'get_form' ) );
|
94 |
+
add_action( 'wp_ajax_' . self::AJAX_CREATE_FORM, array( $this, 'create_form' ) );
|
95 |
+
add_action( 'wp_ajax_' . self::AJAX_FORM_INTEGRATION_STATUS, array(
|
96 |
+
$this,
|
97 |
+
'update_form_integrations_status'
|
98 |
+
) );
|
99 |
+
add_action( 'wp_ajax_' . self::AJAX_DELETE_FORM, array( $this, 'delete_form' ) );
|
100 |
+
|
101 |
+
}
|
102 |
|
103 |
add_action( 'wp_ajax_' . self::AJAX_SUBMIT_FORM, array( $this, 'submit_form' ) );
|
104 |
add_action( 'wp_ajax_nopriv_' . self::AJAX_SUBMIT_FORM, array( $this, 'submit_form' ) );
|
445 |
**/
|
446 |
public function update_item() {
|
447 |
try {
|
448 |
+
//$_POST = array_map( 'stripslashes_deep', $_POST );
|
449 |
+
$data = stripslashes( $this->param( 'data' ) );
|
|
|
450 |
$atemplate = $this->param( 'template' );
|
451 |
|
|
|
|
|
|
|
|
|
452 |
if ( $atemplate ) {
|
453 |
$this->post->set_template( $atemplate );
|
454 |
}
|
editor/api/access-token.php
CHANGED
@@ -28,6 +28,27 @@ class Brizy_Editor_API_AccessToken extends Brizy_Admin_Serializable {
|
|
28 |
$this->expires = (int) $expires;
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
public function access_token() {
|
32 |
return $this->token;
|
33 |
}
|
28 |
$this->expires = (int) $expires;
|
29 |
}
|
30 |
|
31 |
+
public function convertToOptionValue() {
|
32 |
+
return array(
|
33 |
+
'token' => $this->token,
|
34 |
+
'refresh_token' => $this->refresh_token,
|
35 |
+
'expires' => $this->expires
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
static public function createFromSerializedData( $data ) {
|
40 |
+
|
41 |
+
if($data instanceof self) {
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
$instance = new self( $data['token'], $data['expires'] );
|
46 |
+
$instance->refresh_token = $data['refresh_token'];
|
47 |
+
|
48 |
+
return $instance;
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
public function access_token() {
|
53 |
return $this->token;
|
54 |
}
|
editor/api/page.php
CHANGED
@@ -18,10 +18,22 @@ class Brizy_Editor_API_Page extends Brizy_Admin_Serializable {
|
|
18 |
*
|
19 |
* @return Brizy_Editor_API_Page
|
20 |
*/
|
21 |
-
public static function get(
|
22 |
return new self( $data );
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* @return string
|
27 |
*/
|
18 |
*
|
19 |
* @return Brizy_Editor_API_Page
|
20 |
*/
|
21 |
+
public static function get( $data = array() ) {
|
22 |
return new self( $data );
|
23 |
}
|
24 |
|
25 |
+
public function convertToOptionValue() {
|
26 |
+
return array(
|
27 |
+
'data' => $this->data
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
static public function createFromSerializedData( $data ) {
|
32 |
+
$page = new self( $data['data'] );
|
33 |
+
|
34 |
+
return $page;
|
35 |
+
}
|
36 |
+
|
37 |
/**
|
38 |
* @return string
|
39 |
*/
|
editor/api/project.php
CHANGED
@@ -19,6 +19,18 @@ class Brizy_Editor_API_Project extends Brizy_Admin_Serializable {
|
|
19 |
$this->data = unserialize( $data );
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
public function get_data() {
|
23 |
return $this->data;
|
24 |
}
|
@@ -76,10 +88,6 @@ class Brizy_Editor_API_Project extends Brizy_Admin_Serializable {
|
|
76 |
return $this;
|
77 |
}
|
78 |
|
79 |
-
public function __sleep() {
|
80 |
-
return array( 'data' );
|
81 |
-
}
|
82 |
-
|
83 |
public function set_meta_key( $key, $value ) {
|
84 |
|
85 |
if ( is_null( $key ) ) {
|
19 |
$this->data = unserialize( $data );
|
20 |
}
|
21 |
|
22 |
+
public function convertToOptionValue() {
|
23 |
+
return array(
|
24 |
+
'data' => serialize( $this->data )
|
25 |
+
);
|
26 |
+
}
|
27 |
+
|
28 |
+
static public function createFromSerializedData( $data ) {
|
29 |
+
$api_project = new self( $data );
|
30 |
+
|
31 |
+
return $api_project;
|
32 |
+
}
|
33 |
+
|
34 |
public function get_data() {
|
35 |
return $this->data;
|
36 |
}
|
88 |
return $this;
|
89 |
}
|
90 |
|
|
|
|
|
|
|
|
|
91 |
public function set_meta_key( $key, $value ) {
|
92 |
|
93 |
if ( is_null( $key ) ) {
|
editor/editor/editor.php
CHANGED
@@ -22,7 +22,7 @@ class Brizy_Editor_Editor_Editor {
|
|
22 |
*
|
23 |
* @return Brizy_Editor_Editor_Editor
|
24 |
*/
|
25 |
-
public static function get(
|
26 |
return new self( $project, $post );
|
27 |
}
|
28 |
|
@@ -32,7 +32,7 @@ class Brizy_Editor_Editor_Editor {
|
|
32 |
* @param Brizy_Editor_Project $project
|
33 |
* @param Brizy_Editor_Post $post
|
34 |
*/
|
35 |
-
public function __construct(
|
36 |
$this->post = $post;
|
37 |
$this->project = $project;
|
38 |
$this->urlBuilder = new Brizy_Editor_UrlBuilder( $project, $post );
|
22 |
*
|
23 |
* @return Brizy_Editor_Editor_Editor
|
24 |
*/
|
25 |
+
public static function get( $project, $post = null ) {
|
26 |
return new self( $project, $post );
|
27 |
}
|
28 |
|
32 |
* @param Brizy_Editor_Project $project
|
33 |
* @param Brizy_Editor_Post $post
|
34 |
*/
|
35 |
+
public function __construct( $project, $post = null ) {
|
36 |
$this->post = $post;
|
37 |
$this->project = $project;
|
38 |
$this->urlBuilder = new Brizy_Editor_UrlBuilder( $project, $post );
|
editor/forms/form.php
CHANGED
@@ -37,14 +37,32 @@ class Brizy_Editor_Forms_Form extends Brizy_Admin_Serializable {
|
|
37 |
|
38 |
public function jsonSerialize() {
|
39 |
$get_object_vars = array(
|
40 |
-
'id'
|
41 |
-
'emailTo'
|
42 |
-
'subject'
|
43 |
);
|
44 |
|
45 |
return $get_object_vars;
|
46 |
}
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
/**
|
49 |
* @return string
|
50 |
*/
|
@@ -113,7 +131,7 @@ class Brizy_Editor_Forms_Form extends Brizy_Admin_Serializable {
|
|
113 |
throw new Exception( 'Bad Request', 400 );
|
114 |
}
|
115 |
|
116 |
-
$_POST['form'] = get_object_vars($json_obj);
|
117 |
|
118 |
if ( isset( $_POST['form']['id'] ) ) {
|
119 |
$instance->setId( $_POST['form']['id'] );
|
@@ -177,5 +195,4 @@ class Brizy_Editor_Forms_Form extends Brizy_Admin_Serializable {
|
|
177 |
}
|
178 |
|
179 |
|
180 |
-
|
181 |
}
|
37 |
|
38 |
public function jsonSerialize() {
|
39 |
$get_object_vars = array(
|
40 |
+
'id' => $this->id,
|
41 |
+
'emailTo' => $this->emailTo,
|
42 |
+
'subject' => $this->subject,
|
43 |
);
|
44 |
|
45 |
return $get_object_vars;
|
46 |
}
|
47 |
|
48 |
+
public function convertToOptionValue() {
|
49 |
+
return array(
|
50 |
+
'id' => $this->id,
|
51 |
+
'emailTo' => $this->emailTo,
|
52 |
+
'subject' => $this->subject,
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
+
static public function createFromSerializedData( $data ) {
|
57 |
+
$instance = new self();
|
58 |
+
$instance->id = $data['id'];
|
59 |
+
$instance->emailTo = $data['emailTo'];
|
60 |
+
$instance->subject = $data['subject'];
|
61 |
+
|
62 |
+
return $instance;
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
/**
|
67 |
* @return string
|
68 |
*/
|
131 |
throw new Exception( 'Bad Request', 400 );
|
132 |
}
|
133 |
|
134 |
+
$_POST['form'] = get_object_vars( $json_obj );
|
135 |
|
136 |
if ( isset( $_POST['form']['id'] ) ) {
|
137 |
$instance->setId( $_POST['form']['id'] );
|
195 |
}
|
196 |
|
197 |
|
|
|
198 |
}
|
editor/helper/dom.php
CHANGED
@@ -46,7 +46,7 @@ class Brizy_Editor_Helper_Dom extends Brizy_Editor_Helper_DomTag {
|
|
46 |
*
|
47 |
* @return array
|
48 |
*/
|
49 |
-
public function get_attributes(
|
50 |
$list = array();
|
51 |
|
52 |
foreach ( $tags as $tag ) {
|
46 |
*
|
47 |
* @return array
|
48 |
*/
|
49 |
+
public function get_attributes( $tags, $attr ) {
|
50 |
$list = array();
|
51 |
|
52 |
foreach ( $tags as $tag ) {
|
editor/load.php
CHANGED
@@ -50,9 +50,8 @@ function brizy_initialize_Brizy_Public_Api() {
|
|
50 |
return;
|
51 |
}
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
}
|
56 |
|
57 |
} catch ( Exception $e ) {
|
58 |
Brizy_Logger::instance()->exception( $e );
|
50 |
return;
|
51 |
}
|
52 |
|
53 |
+
|
54 |
+
$api_instance = new Brizy_Editor_API( $project, $post );
|
|
|
55 |
|
56 |
} catch ( Exception $e ) {
|
57 |
Brizy_Logger::instance()->exception( $e );
|
editor/post.php
CHANGED
@@ -40,16 +40,6 @@ class Brizy_Editor_Post extends Brizy_Admin_Serializable {
|
|
40 |
*/
|
41 |
protected $needs_compile;
|
42 |
|
43 |
-
/**
|
44 |
-
* @var bool
|
45 |
-
*/
|
46 |
-
//protected $store_assets;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @var array
|
50 |
-
*/
|
51 |
-
//protected $assets = array();
|
52 |
-
|
53 |
/**
|
54 |
* Json for the editor.
|
55 |
*
|
@@ -64,7 +54,9 @@ class Brizy_Editor_Post extends Brizy_Admin_Serializable {
|
|
64 |
*/
|
65 |
public function __construct( $wp_post_id ) {
|
66 |
$this->wp_post_id = (int) $wp_post_id;
|
67 |
-
|
|
|
|
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -97,6 +89,27 @@ class Brizy_Editor_Post extends Brizy_Admin_Serializable {
|
|
97 |
unset( $this->api_page );
|
98 |
}
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
/**
|
101 |
* @param $apost
|
102 |
*
|
@@ -122,6 +135,12 @@ class Brizy_Editor_Post extends Brizy_Admin_Serializable {
|
|
122 |
|
123 |
$post = $brizy_editor_storage_post->get( self::BRIZY_POST );
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
$post->wp_post_id = $wp_post_id;
|
126 |
$post->wp_post = get_post( $wp_post_id );
|
127 |
|
@@ -182,7 +201,8 @@ class Brizy_Editor_Post extends Brizy_Admin_Serializable {
|
|
182 |
public function save() {
|
183 |
|
184 |
try {
|
185 |
-
$
|
|
|
186 |
} catch ( Exception $exception ) {
|
187 |
Brizy_Logger::instance()->exception( $exception );
|
188 |
|
@@ -242,7 +262,7 @@ class Brizy_Editor_Post extends Brizy_Admin_Serializable {
|
|
242 |
}
|
243 |
|
244 |
public function set_editor_data( $content ) {
|
245 |
-
$this->editor_data =
|
246 |
|
247 |
return $this;
|
248 |
}
|
40 |
*/
|
41 |
protected $needs_compile;
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* Json for the editor.
|
45 |
*
|
54 |
*/
|
55 |
public function __construct( $wp_post_id ) {
|
56 |
$this->wp_post_id = (int) $wp_post_id;
|
57 |
+
if ( $this->wp_post_id ) {
|
58 |
+
$this->wp_post = get_post( $this->wp_post_id );
|
59 |
+
}
|
60 |
}
|
61 |
|
62 |
/**
|
89 |
unset( $this->api_page );
|
90 |
}
|
91 |
|
92 |
+
|
93 |
+
public function convertToOptionValue() {
|
94 |
+
return array(
|
95 |
+
'compiled_html_body' => $this->get_compiled_html_body(),
|
96 |
+
'compiled_html_head' => $this->get_compiled_html_head(),
|
97 |
+
'needs_compile' => $this->needs_compile,
|
98 |
+
'editor_data' => addslashes($this->editor_data),
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
static public function createFromSerializedData( $data ) {
|
103 |
+
$post = new self( null );
|
104 |
+
$post->compiled_html_body = $data['compiled_html_body'];
|
105 |
+
$post->compiled_html_head = $data['compiled_html_head'];
|
106 |
+
$post->needs_compile = $data['needs_compile'];
|
107 |
+
$post->editor_data = $data['editor_data'];
|
108 |
+
|
109 |
+
return $post;
|
110 |
+
}
|
111 |
+
|
112 |
+
|
113 |
/**
|
114 |
* @param $apost
|
115 |
*
|
135 |
|
136 |
$post = $brizy_editor_storage_post->get( self::BRIZY_POST );
|
137 |
|
138 |
+
if ( is_array( $post ) ) {
|
139 |
+
$post = self::createFromSerializedData( $post );
|
140 |
+
} elseif ($post instanceof self) {
|
141 |
+
$post->save();
|
142 |
+
}
|
143 |
+
|
144 |
$post->wp_post_id = $wp_post_id;
|
145 |
$post->wp_post = get_post( $wp_post_id );
|
146 |
|
201 |
public function save() {
|
202 |
|
203 |
try {
|
204 |
+
$value = $this->convertToOptionValue();
|
205 |
+
$this->storage()->set( self::BRIZY_POST, $value );
|
206 |
} catch ( Exception $exception ) {
|
207 |
Brizy_Logger::instance()->exception( $exception );
|
208 |
|
262 |
}
|
263 |
|
264 |
public function set_editor_data( $content ) {
|
265 |
+
$this->editor_data = $content ;
|
266 |
|
267 |
return $this;
|
268 |
}
|
editor/project.php
CHANGED
@@ -26,12 +26,6 @@ class Brizy_Editor_Project extends Brizy_Admin_Serializable {
|
|
26 |
*/
|
27 |
protected $creation_signature;
|
28 |
|
29 |
-
/**
|
30 |
-
* @var bool
|
31 |
-
*/
|
32 |
-
protected $store_assets = true;
|
33 |
-
|
34 |
-
|
35 |
/**
|
36 |
* Brizy_Editor_Project constructor.
|
37 |
*
|
@@ -41,6 +35,21 @@ class Brizy_Editor_Project extends Brizy_Admin_Serializable {
|
|
41 |
$this->api_project = $api_project;
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
/**
|
45 |
* @return Brizy_Editor_Project|mixed
|
46 |
* @throws Exception
|
@@ -51,29 +60,24 @@ class Brizy_Editor_Project extends Brizy_Admin_Serializable {
|
|
51 |
return self::$instance;
|
52 |
}
|
53 |
|
54 |
-
// $platform = new Brizy_Editor_API_Platform();
|
55 |
-
|
56 |
try {
|
57 |
$brizy_editor_storage_common = Brizy_Editor_Storage_Common::instance();
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
} catch ( Brizy_Editor_Exceptions_NotFound $e ) {
|
60 |
-
self::$instance = self::create(
|
61 |
} catch ( Exception $e ) {
|
62 |
Brizy_Logger::instance()->exception( $e );
|
63 |
}
|
64 |
|
65 |
-
// try {
|
66 |
-
// if ( ! $platform->isUserCreatedLocally() ) {
|
67 |
-
// self::$instance->checkSignature();
|
68 |
-
// }
|
69 |
-
// } catch ( Brizy_Editor_Exceptions_SignatureMismatch $e ) {
|
70 |
-
// Brizy_Logger::instance()->notice( "Project signature mismatch" );
|
71 |
-
// self::$instance = self::create( self::$instance->get_id(), false );
|
72 |
-
// } catch ( Exception $e ) {
|
73 |
-
// Brizy_Logger::instance()->exception( $e );
|
74 |
-
// throw new Exception( 'Unable to check the signature.' );
|
75 |
-
// }
|
76 |
-
|
77 |
return self::$instance;
|
78 |
}
|
79 |
|
@@ -112,53 +116,6 @@ class Brizy_Editor_Project extends Brizy_Admin_Serializable {
|
|
112 |
|
113 |
self::$instance = $project;
|
114 |
|
115 |
-
/*
|
116 |
-
if ( $clone_from ) {
|
117 |
-
|
118 |
-
$project_data = $project->get_api_project()->get_data();
|
119 |
-
|
120 |
-
Brizy_Logger::instance()->notice( 'Clone all project data' );
|
121 |
-
|
122 |
-
foreach ( $project_data['languages'] as $language ) {
|
123 |
-
$pages = $language['pages'];
|
124 |
-
|
125 |
-
Brizy_Logger::instance()->notice( 'New pages from cloned project', array( $pages ) );
|
126 |
-
|
127 |
-
if ( is_array( $pages ) && count( $pages ) > 0 ) {
|
128 |
-
|
129 |
-
// debug logs
|
130 |
-
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
|
131 |
-
foreach ( (array) $pages as $aclone ) {
|
132 |
-
Brizy_Logger::instance()->debug( sprintf( "Cloned page [%s] to page [%s]", $aclone['cloned_from'], $aclone['id'] ) );
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
foreach ( (array) $pages as $page ) {
|
137 |
-
// get wordpress post by old brizy hash
|
138 |
-
|
139 |
-
$wp_post = Brizy_Editor_Post::get_post_by_foreign_hash( $page['cloned_from'] );
|
140 |
-
|
141 |
-
if ( ! $wp_post ) {
|
142 |
-
continue;
|
143 |
-
}
|
144 |
-
|
145 |
-
$old_page = Brizy_Editor_Post::get( $wp_post );
|
146 |
-
$new_post = new Brizy_Editor_Post( new Brizy_Editor_API_Page( $page ), $wp_post->ID );
|
147 |
-
|
148 |
-
$new_post->set_compiled_html_body( $old_page->get_compiled_html_body() );
|
149 |
-
$new_post->set_compiled_html_head( $old_page->get_compiled_html_head() );
|
150 |
-
|
151 |
-
update_post_meta( $wp_post->ID, Brizy_Editor_Post::BRIZY_POST_SIGNATURE_KEY, Brizy_Editor_Signature::get() );
|
152 |
-
update_post_meta( $wp_post->ID, Brizy_Editor_Post::BRIZY_POST_HASH_KEY, $new_post->get_api_page()->get_id() );
|
153 |
-
|
154 |
-
$new_post->save();
|
155 |
-
}
|
156 |
-
}
|
157 |
-
}
|
158 |
-
}
|
159 |
-
*/
|
160 |
-
|
161 |
-
|
162 |
return $project;
|
163 |
}
|
164 |
|
@@ -175,21 +132,11 @@ class Brizy_Editor_Project extends Brizy_Admin_Serializable {
|
|
175 |
$this->set_meta_key( 'worpdress_description', get_bloginfo( 'description' ) );
|
176 |
|
177 |
$brizy_editor_storage_common = Brizy_Editor_Storage_Common::instance();
|
178 |
-
$brizy_editor_storage_common->set( self::BRIZY_PROJECT, $this );
|
179 |
|
180 |
return $this;
|
181 |
}
|
182 |
|
183 |
-
|
184 |
-
/**
|
185 |
-
* @throws Brizy_Editor_Exceptions_SignatureMismatch
|
186 |
-
*/
|
187 |
-
public function checkSignature() {
|
188 |
-
if ( Brizy_Editor_Signature::get() != $this->creation_signature ) {
|
189 |
-
throw new Brizy_Editor_Exceptions_SignatureMismatch( 'Clone project required.' );
|
190 |
-
}
|
191 |
-
}
|
192 |
-
|
193 |
/**
|
194 |
* @return mixed
|
195 |
*/
|
@@ -216,7 +163,6 @@ class Brizy_Editor_Project extends Brizy_Admin_Serializable {
|
|
216 |
return $this->api_project->get_globals();
|
217 |
}
|
218 |
|
219 |
-
|
220 |
/**
|
221 |
* @param $globals
|
222 |
*
|
@@ -233,7 +179,6 @@ class Brizy_Editor_Project extends Brizy_Admin_Serializable {
|
|
233 |
|
234 |
// when the globals is updated all pages needs to be compiled.
|
235 |
// se will update the flag for all pages edited with brizy
|
236 |
-
|
237 |
$posts = get_posts( array(
|
238 |
'orderby' => null,
|
239 |
'numberposts' => - 1,
|
@@ -299,19 +244,4 @@ class Brizy_Editor_Project extends Brizy_Admin_Serializable {
|
|
299 |
|
300 |
$this->get_api_project()->set_meta_key( $key, $value );
|
301 |
}
|
302 |
-
|
303 |
-
// public function invalidateAssetsFor( $version ) {
|
304 |
-
//
|
305 |
-
// Brizy_Logger::instance()->notice( 'Invalidate assets for version ' . $version, array( $version ) );
|
306 |
-
//
|
307 |
-
// $dir_path = sprintf( rtrim( ABSPATH, DIRECTORY_SEPARATOR ) . Brizy_Config::BRIZY_WP_EDITOR_ASSET_PATH, $version );
|
308 |
-
//
|
309 |
-
// Brizy_Logger::instance()->notice( 'Remove directory ' . $dir_path, array( $dir_path ) );
|
310 |
-
//
|
311 |
-
// $fs = new WP_Filesystem_Direct( null );
|
312 |
-
// $fs->rmdir( $dir_path, true );
|
313 |
-
//
|
314 |
-
// return $this;
|
315 |
-
// }
|
316 |
-
|
317 |
}
|
26 |
*/
|
27 |
protected $creation_signature;
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* Brizy_Editor_Project constructor.
|
31 |
*
|
35 |
$this->api_project = $api_project;
|
36 |
}
|
37 |
|
38 |
+
public function convertToOptionValue() {
|
39 |
+
return array(
|
40 |
+
'api_project' => $this->get_api_project()->serialize(),
|
41 |
+
'creation_signature' => $this->creation_signature
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
static public function createFromSerializedData( $data ) {
|
46 |
+
$project = new self( Brizy_Editor_API_Project::createFromSerializedData( unserialize($data['api_project']) ) );
|
47 |
+
$project->creation_signature = $data['creation_signature'];
|
48 |
+
|
49 |
+
return $project;
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
/**
|
54 |
* @return Brizy_Editor_Project|mixed
|
55 |
* @throws Exception
|
60 |
return self::$instance;
|
61 |
}
|
62 |
|
|
|
|
|
63 |
try {
|
64 |
$brizy_editor_storage_common = Brizy_Editor_Storage_Common::instance();
|
65 |
+
$project = $brizy_editor_storage_common->get( self::BRIZY_PROJECT );
|
66 |
+
|
67 |
+
if ( is_array( $project ) ) {
|
68 |
+
$project = self::createFromSerializedData( $project );
|
69 |
+
} elseif($project instanceof self) {
|
70 |
+
$project->save();
|
71 |
+
}
|
72 |
+
|
73 |
+
self::$instance = $project;
|
74 |
+
|
75 |
} catch ( Brizy_Editor_Exceptions_NotFound $e ) {
|
76 |
+
self::$instance = self::create();
|
77 |
} catch ( Exception $e ) {
|
78 |
Brizy_Logger::instance()->exception( $e );
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
return self::$instance;
|
82 |
}
|
83 |
|
116 |
|
117 |
self::$instance = $project;
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
return $project;
|
120 |
}
|
121 |
|
132 |
$this->set_meta_key( 'worpdress_description', get_bloginfo( 'description' ) );
|
133 |
|
134 |
$brizy_editor_storage_common = Brizy_Editor_Storage_Common::instance();
|
135 |
+
$brizy_editor_storage_common->set( self::BRIZY_PROJECT, $this->convertToOptionValue() );
|
136 |
|
137 |
return $this;
|
138 |
}
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
/**
|
141 |
* @return mixed
|
142 |
*/
|
163 |
return $this->api_project->get_globals();
|
164 |
}
|
165 |
|
|
|
166 |
/**
|
167 |
* @param $globals
|
168 |
*
|
179 |
|
180 |
// when the globals is updated all pages needs to be compiled.
|
181 |
// se will update the flag for all pages edited with brizy
|
|
|
182 |
$posts = get_posts( array(
|
183 |
'orderby' => null,
|
184 |
'numberposts' => - 1,
|
244 |
|
245 |
$this->get_api_project()->set_meta_key( $key, $value );
|
246 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
editor/resources/static-script.php
CHANGED
@@ -11,7 +11,7 @@ class Brizy_Editor_Resources_StaticScript extends Brizy_Editor_Resources_Static
|
|
11 |
$this->footer = $footer;
|
12 |
}
|
13 |
|
14 |
-
public function enqueue( $locale_id = null,
|
15 |
wp_enqueue_script(
|
16 |
$this->get_id(),
|
17 |
$this->get_url(),
|
11 |
$this->footer = $footer;
|
12 |
}
|
13 |
|
14 |
+
public function enqueue( $locale_id = null, $value = array() ) {
|
15 |
wp_enqueue_script(
|
16 |
$this->get_id(),
|
17 |
$this->get_url(),
|
editor/resources/static.php
CHANGED
@@ -9,7 +9,7 @@ abstract class Brizy_Editor_Resources_Static {
|
|
9 |
private $deps;
|
10 |
private $version;
|
11 |
|
12 |
-
public function __construct( $id, $url,
|
13 |
$this->id = $id;
|
14 |
$this->set_url( $url );
|
15 |
$this->set_deps( $deps );
|
@@ -38,7 +38,7 @@ abstract class Brizy_Editor_Resources_Static {
|
|
38 |
return $this->deps;
|
39 |
}
|
40 |
|
41 |
-
public function set_deps(
|
42 |
$this->deps = $deps;
|
43 |
|
44 |
return $this;
|
9 |
private $deps;
|
10 |
private $version;
|
11 |
|
12 |
+
public function __construct( $id, $url, $deps = array(), $ver = false ) {
|
13 |
$this->id = $id;
|
14 |
$this->set_url( $url );
|
15 |
$this->set_deps( $deps );
|
38 |
return $this->deps;
|
39 |
}
|
40 |
|
41 |
+
public function set_deps( $deps ) {
|
42 |
$this->deps = $deps;
|
43 |
|
44 |
return $this;
|
editor/storage/abstract.php
CHANGED
@@ -57,7 +57,7 @@ abstract class Brizy_Editor_Storage_Abstract {
|
|
57 |
*
|
58 |
* @return Brizy_Editor_Storage_Abstract
|
59 |
*/
|
60 |
-
abstract protected function update_storage(
|
61 |
|
62 |
/**
|
63 |
* @return array
|
57 |
*
|
58 |
* @return Brizy_Editor_Storage_Abstract
|
59 |
*/
|
60 |
+
abstract protected function update_storage( $storage );
|
61 |
|
62 |
/**
|
63 |
* @return array
|
editor/storage/common.php
CHANGED
@@ -31,7 +31,7 @@ class Brizy_Editor_Storage_Common extends Brizy_Editor_Storage_Abstract {
|
|
31 |
*
|
32 |
* @return $this
|
33 |
*/
|
34 |
-
protected function update_storage(
|
35 |
update_option( $this->key(), $storage );
|
36 |
|
37 |
return $this;
|
31 |
*
|
32 |
* @return $this
|
33 |
*/
|
34 |
+
protected function update_storage( $storage ) {
|
35 |
update_option( $this->key(), $storage );
|
36 |
|
37 |
return $this;
|
editor/storage/post.php
CHANGED
@@ -37,7 +37,7 @@ class Brizy_Editor_Storage_Post extends Brizy_Editor_Storage_Abstract {
|
|
37 |
*
|
38 |
* @return $this
|
39 |
*/
|
40 |
-
protected function update_storage(
|
41 |
update_post_meta( $this->get_id(), $this->key(), $storage );
|
42 |
|
43 |
return $this;
|
37 |
*
|
38 |
* @return $this
|
39 |
*/
|
40 |
+
protected function update_storage( $storage ) {
|
41 |
update_post_meta( $this->get_id(), $this->key(), $storage );
|
42 |
|
43 |
return $this;
|
editor/url-builder.php
CHANGED
@@ -23,7 +23,7 @@ class Brizy_Editor_UrlBuilder {
|
|
23 |
* @param Brizy_Editor_Project|null $project
|
24 |
* @param Brizy_Editor_Post|null $post
|
25 |
*/
|
26 |
-
public function __construct(
|
27 |
|
28 |
global $wp_rewrite;
|
29 |
|
23 |
* @param Brizy_Editor_Project|null $project
|
24 |
* @param Brizy_Editor_Post|null $post
|
25 |
*/
|
26 |
+
public function __construct( $project = null, $post = null ) {
|
27 |
|
28 |
global $wp_rewrite;
|
29 |
|
editor/user.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
die( 'Direct access forbidden.' );
|
3 |
}
|
4 |
|
5 |
-
class Brizy_Editor_User
|
6 |
|
7 |
const BRIZY_ATTACHMENT_HASH_KEY = 'brizy_attachment_hash';
|
8 |
|
@@ -33,6 +33,30 @@ class Brizy_Editor_User extends Brizy_Admin_Serializable implements Brizy_Editor
|
|
33 |
*/
|
34 |
private $platform_user_signature;
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* @return Brizy_Editor_User
|
38 |
* @throws Brizy_Editor_Exceptions_ServiceUnavailable
|
@@ -49,26 +73,17 @@ class Brizy_Editor_User extends Brizy_Admin_Serializable implements Brizy_Editor
|
|
49 |
'User is in maintenance mode'
|
50 |
);
|
51 |
}
|
|
|
52 |
$user = null;
|
53 |
$platform = new Brizy_Editor_API_Platform();
|
54 |
|
55 |
try {
|
56 |
$user = new Brizy_Editor_User( Brizy_Editor_Storage_Common::instance() );
|
57 |
-
// if ( ! $platform->isUserCreatedLocally() ) {
|
58 |
-
// $user->checkSignature();
|
59 |
-
// }
|
60 |
-
} catch ( Brizy_Editor_Exceptions_SignatureMismatch $e ) {
|
61 |
-
// $platform->createUser( $user->getPlatformUserId(), false );
|
62 |
-
// $user = new Brizy_Editor_User( Brizy_Editor_Storage_Common::instance() );
|
63 |
} catch ( Brizy_Editor_Exceptions_NotFound $e ) {
|
64 |
-
$platform->createUser(
|
65 |
$user = new Brizy_Editor_User( Brizy_Editor_Storage_Common::instance() );
|
66 |
}
|
67 |
|
68 |
-
// if ( ! $platform->isUserCreatedLocally() && ( ! $user->token || $user->token->expired() ) ) {
|
69 |
-
// $user->auth();
|
70 |
-
// }
|
71 |
-
|
72 |
return self::$instance = $user;
|
73 |
}
|
74 |
|
@@ -76,25 +91,6 @@ class Brizy_Editor_User extends Brizy_Admin_Serializable implements Brizy_Editor
|
|
76 |
return self::$instance = new self( Brizy_Editor_Storage_Common::instance() );
|
77 |
}
|
78 |
|
79 |
-
/**
|
80 |
-
* Brizy_Editor_User constructor.
|
81 |
-
*
|
82 |
-
* @param $common_storage
|
83 |
-
*
|
84 |
-
* @throws Brizy_Editor_Exceptions_NotFound
|
85 |
-
*/
|
86 |
-
protected function __construct( $common_storage ) {
|
87 |
-
|
88 |
-
$this->common_storage = $common_storage;
|
89 |
-
|
90 |
-
$this->platform_user_id = $this->common_storage->get( 'platform_user_id' );
|
91 |
-
$this->platform_user_email = $this->common_storage->get( 'platform_user_email' );
|
92 |
-
$this->platform_user_signature = $this->common_storage->get( 'platform_user_signature' );
|
93 |
-
$this->token = $this->common_storage->get( 'access-token', false );
|
94 |
-
|
95 |
-
Brizy_Logger::instance()->debug( 'New user instance with storage', array( $this ) );
|
96 |
-
}
|
97 |
-
|
98 |
/**
|
99 |
* @throws Brizy_Editor_Exceptions_SignatureMismatch
|
100 |
*/
|
@@ -148,7 +144,7 @@ class Brizy_Editor_User extends Brizy_Admin_Serializable implements Brizy_Editor
|
|
148 |
$auth_api = new Brizy_Editor_API_Auth( Brizy_Config::GATEWAY_URI, $credentials->client_id, $credentials->client_secret );
|
149 |
$auth_api->clearTokenCache();
|
150 |
$this->token = $auth_api->getToken( $this->platform_user_email );
|
151 |
-
$this->common_storage->set( 'access-token', $this->token );
|
152 |
|
153 |
} catch ( Exception $exception ) {
|
154 |
Brizy_Logger::instance()->exception( $exception );
|
2 |
die( 'Direct access forbidden.' );
|
3 |
}
|
4 |
|
5 |
+
class Brizy_Editor_User implements Brizy_Editor_SignatureInterface {
|
6 |
|
7 |
const BRIZY_ATTACHMENT_HASH_KEY = 'brizy_attachment_hash';
|
8 |
|
33 |
*/
|
34 |
private $platform_user_signature;
|
35 |
|
36 |
+
/**
|
37 |
+
* Brizy_Editor_User constructor.
|
38 |
+
*
|
39 |
+
* @param $common_storage
|
40 |
+
*
|
41 |
+
* @throws Brizy_Editor_Exceptions_NotFound
|
42 |
+
*/
|
43 |
+
protected function __construct( $common_storage ) {
|
44 |
+
|
45 |
+
$this->common_storage = $common_storage;
|
46 |
+
|
47 |
+
$this->platform_user_id = $this->common_storage->get( 'platform_user_id' );
|
48 |
+
$this->platform_user_email = $this->common_storage->get( 'platform_user_email' );
|
49 |
+
$this->platform_user_signature = $this->common_storage->get( 'platform_user_signature' );
|
50 |
+
|
51 |
+
$token_data = $this->common_storage->get( 'access-token', false );
|
52 |
+
if ( $token_data instanceof Brizy_Editor_API_AccessToken ) {
|
53 |
+
$this->token = $token_data;
|
54 |
+
$this->common_storage->set( 'access-token', $token_data->convertToOptionValue() );
|
55 |
+
} elseif ( is_array( $token_data ) ) {
|
56 |
+
$this->token = Brizy_Editor_API_AccessToken::createFromSerializedData( $token_data );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
/**
|
61 |
* @return Brizy_Editor_User
|
62 |
* @throws Brizy_Editor_Exceptions_ServiceUnavailable
|
73 |
'User is in maintenance mode'
|
74 |
);
|
75 |
}
|
76 |
+
|
77 |
$user = null;
|
78 |
$platform = new Brizy_Editor_API_Platform();
|
79 |
|
80 |
try {
|
81 |
$user = new Brizy_Editor_User( Brizy_Editor_Storage_Common::instance() );
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
} catch ( Brizy_Editor_Exceptions_NotFound $e ) {
|
83 |
+
$platform->createUser();
|
84 |
$user = new Brizy_Editor_User( Brizy_Editor_Storage_Common::instance() );
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
87 |
return self::$instance = $user;
|
88 |
}
|
89 |
|
91 |
return self::$instance = new self( Brizy_Editor_Storage_Common::instance() );
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
/**
|
95 |
* @throws Brizy_Editor_Exceptions_SignatureMismatch
|
96 |
*/
|
144 |
$auth_api = new Brizy_Editor_API_Auth( Brizy_Config::GATEWAY_URI, $credentials->client_id, $credentials->client_secret );
|
145 |
$auth_api->clearTokenCache();
|
146 |
$this->token = $auth_api->getToken( $this->platform_user_email );
|
147 |
+
$this->common_storage->set( 'access-token', $this->token->convertToOptionValue() );
|
148 |
|
149 |
} catch ( Exception $exception ) {
|
150 |
Brizy_Logger::instance()->exception( $exception );
|
editor/view.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
}
|
4 |
|
5 |
class Brizy_Editor_View {
|
6 |
-
public static function render( $path,
|
7 |
$file = $path . '.php';
|
8 |
|
9 |
if ( ! file_exists( $file ) ) {
|
@@ -14,7 +14,7 @@ class Brizy_Editor_View {
|
|
14 |
include $file;
|
15 |
}
|
16 |
|
17 |
-
public static function get( $path,
|
18 |
ob_start();
|
19 |
self::render( $path, $args );
|
20 |
return ob_get_clean();
|
3 |
}
|
4 |
|
5 |
class Brizy_Editor_View {
|
6 |
+
public static function render( $path, $args = array() ) {
|
7 |
$file = $path . '.php';
|
8 |
|
9 |
if ( ! file_exists( $file ) ) {
|
14 |
include $file;
|
15 |
}
|
16 |
|
17 |
+
public static function get( $path, $args = array() ) {
|
18 |
ob_start();
|
19 |
self::render( $path, $args );
|
20 |
return ob_get_clean();
|
logger.php
CHANGED
@@ -53,6 +53,18 @@ class Brizy_Logger {
|
|
53 |
|
54 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
55 |
dbDelta( $create_table_query );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
|
58 |
|
53 |
|
54 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
55 |
dbDelta( $create_table_query );
|
56 |
+
|
57 |
+
self::clean();
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Create logger table.
|
63 |
+
*/
|
64 |
+
static public function clean() {
|
65 |
+
|
66 |
+
global $wpdb;
|
67 |
+
$wpdb->query( "TRUNCATE `{$wpdb->prefix}brizy_logs`" );
|
68 |
}
|
69 |
|
70 |
|
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: 4.9
|
6 |
Requires PHP: 5.4
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -129,6 +129,12 @@ The progress you're making while building your page is always backed up in the c
|
|
129 |
|
130 |
== Changelog ==
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
= 1.0.15 - 2018-06-18 =
|
133 |
* New: Added new icons
|
134 |
* Fixed: Fixed the scripts that hide the editor
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 1.0.16
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
129 |
|
130 |
== Changelog ==
|
131 |
|
132 |
+
= 1.0.16 - 2018-06-25 =
|
133 |
+
* Fixed: Changed the way we store the data in db
|
134 |
+
* Fixed: Submit form for guests
|
135 |
+
* Fixed: Form serialization
|
136 |
+
* Fixed: Clean the logs table when the plugin is deactivated
|
137 |
+
|
138 |
= 1.0.15 - 2018-06-18 =
|
139 |
* New: Added new icons
|
140 |
* Fixed: Fixed the scripts that hide the editor
|
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 ComposerAutoloaderInit8e5c7800a2973d65cd82c2cb9555c8c7::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 ComposerAutoloaderInitb69e95002f927685757c46610249a187
|
|
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) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit8e5c7800a2973d65cd82c2cb9555c8c7
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit8e5c7800a2973d65cd82c2cb9555c8c7', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit8e5c7800a2973d65cd82c2cb9555c8c7', '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\ComposerStaticInit8e5c7800a2973d65cd82c2cb9555c8c7::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'T' =>
|
@@ -33,9 +33,9 @@ class ComposerStaticInitb69e95002f927685757c46610249a187
|
|
33 |
public static function getInitializer(ClassLoader $loader)
|
34 |
{
|
35 |
return \Closure::bind(function () use ($loader) {
|
36 |
-
$loader->prefixLengthsPsr4 =
|
37 |
-
$loader->prefixDirsPsr4 =
|
38 |
-
$loader->prefixesPsr0 =
|
39 |
|
40 |
}, null, ClassLoader::class);
|
41 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit8e5c7800a2973d65cd82c2cb9555c8c7
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'T' =>
|
33 |
public static function getInitializer(ClassLoader $loader)
|
34 |
{
|
35 |
return \Closure::bind(function () use ($loader) {
|
36 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit8e5c7800a2973d65cd82c2cb9555c8c7::$prefixLengthsPsr4;
|
37 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit8e5c7800a2973d65cd82c2cb9555c8c7::$prefixDirsPsr4;
|
38 |
+
$loader->prefixesPsr0 = ComposerStaticInit8e5c7800a2973d65cd82c2cb9555c8c7::$prefixesPsr0;
|
39 |
|
40 |
}, null, ClassLoader::class);
|
41 |
}
|