Version Description
- 2018-11-05 =
- Improved: Refactored the content module
Download this release
Release Info
Developer | themefusecom |
Plugin | Brizy – Page Builder |
Version | 1.0.43 |
Comparing to | |
See all releases |
Code changes from version 1.0.42 to 1.0.43
- README.md +4 -1
- admin/templates.php +57 -37
- brizy.php +2 -2
- content/context-factory.php +9 -4
- content/context.php +0 -4
- content/dynamic-content-processor.php +9 -26
- content/main-processor.php +63 -0
- content/placeholder-extractor.php +15 -28
- content/placeholder-replacer.php +18 -17
- editor.php +2 -0
- editor/api.php +1 -1
- editor/asset/abstract-storage.php +4 -26
- editor/asset/asset-proxy-processor.php +4 -5
- editor/asset/domain-processor.php +4 -5
- editor/asset/media-asset-processor.php +13 -6
- editor/asset/storage.php +13 -0
- editor/asset/strip-tags-processor.php +4 -5
- editor/content/processor-interface.php +7 -1
- editor/post.php +4 -21
- editor/user.php +1 -1
- public/main.php +24 -17
- readme.txt +4 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +2 -2
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,9 @@ A good bug report includes full details to easily understand the issue you are h
|
|
96 |
|
97 |
## Changelog
|
98 |
|
|
|
|
|
|
|
99 |
### 1.0.42 - 2018-11-01 ###
|
100 |
* New: Added tablet mode
|
101 |
* Improved: Added warning when the theme does not use the_content filter
|
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.43<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.43 - 2018-11-05 ###
|
100 |
+
* Improved: Refactored the content module
|
101 |
+
|
102 |
### 1.0.42 - 2018-11-01 ###
|
103 |
* New: Added tablet mode
|
104 |
* Improved: Added warning when the theme does not use the_content filter
|
admin/templates.php
CHANGED
@@ -474,7 +474,6 @@ class Brizy_Admin_Templates {
|
|
474 |
} catch ( Exception $e ) {
|
475 |
|
476 |
}
|
477 |
-
|
478 |
try {
|
479 |
|
480 |
if ( is_null( $pid ) || ! $is_using_brizy ) {
|
@@ -494,6 +493,10 @@ class Brizy_Admin_Templates {
|
|
494 |
}
|
495 |
}
|
496 |
|
|
|
|
|
|
|
|
|
497 |
remove_filter( 'the_content', 'wpautop' );
|
498 |
|
499 |
// insert the compiled head and content
|
@@ -510,6 +513,32 @@ class Brizy_Admin_Templates {
|
|
510 |
}
|
511 |
|
512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
public function bodyClassFrontend( $classes ) {
|
514 |
|
515 |
$classes[] = 'brz';
|
@@ -527,17 +556,22 @@ class Brizy_Admin_Templates {
|
|
527 |
}
|
528 |
$pid = Brizy_Editor::get()->currentPostId();
|
529 |
|
530 |
-
$
|
531 |
|
532 |
-
if ( $pid
|
533 |
-
$
|
534 |
}
|
535 |
|
536 |
-
$compiled_page = $this->template->get_compiled_page( Brizy_Editor_Project::get(), $brizyPost );
|
537 |
|
538 |
-
$compiled_page
|
539 |
|
540 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
|
542 |
?>
|
543 |
<!-- BRIZY HEAD -->
|
@@ -563,43 +597,23 @@ class Brizy_Admin_Templates {
|
|
563 |
|
564 |
$pid = Brizy_Editor::get()->currentPostId();
|
565 |
|
566 |
-
$
|
567 |
|
568 |
-
if ( $pid
|
569 |
-
$
|
570 |
}
|
571 |
|
572 |
-
$
|
573 |
-
|
574 |
-
echo do_shortcode( $compiled_page->get_body() );
|
575 |
-
}
|
576 |
-
|
577 |
-
/**
|
578 |
-
* @internal
|
579 |
-
*/
|
580 |
-
public function enqueue_preview_assets() {
|
581 |
-
if ( wp_script_is( 'jquery' ) === false ) {
|
582 |
-
wp_register_script( 'jquery-core', "/wp-includes/js/jquery/jquery.js" );
|
583 |
-
wp_register_script( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate.min.js" );
|
584 |
-
wp_register_script( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) );
|
585 |
-
}
|
586 |
|
587 |
-
$
|
588 |
-
$assets_url = $urlBuilder->editor_asset_url();
|
589 |
|
|
|
590 |
|
591 |
-
|
592 |
-
wp_register_script( 'brizy-polyfill', "https://cdn.polyfill.io/v2/polyfill.js?features=IntersectionObserver,IntersectionObserverEntry", array(), null, true );
|
593 |
-
wp_enqueue_script( 'brizy-preview', "${assets_url}/editor/js/preview.js", array(
|
594 |
-
'jquery',
|
595 |
-
'brizy-polyfill'
|
596 |
-
), BRIZY_EDITOR_VERSION, true );
|
597 |
-
//wp_add_inline_script( 'brizy-preview', "var __CONFIG__ = ${config_json};", 'before' );
|
598 |
|
599 |
-
|
600 |
}
|
601 |
|
602 |
-
|
603 |
/**
|
604 |
* @param $content
|
605 |
*
|
@@ -611,10 +625,16 @@ class Brizy_Admin_Templates {
|
|
611 |
if ( ! $this->template ) {
|
612 |
return $content;
|
613 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
614 |
|
615 |
-
$
|
616 |
|
617 |
-
return $compiled_page->get_body();
|
618 |
}
|
619 |
|
620 |
/**
|
474 |
} catch ( Exception $e ) {
|
475 |
|
476 |
}
|
|
|
477 |
try {
|
478 |
|
479 |
if ( is_null( $pid ) || ! $is_using_brizy ) {
|
493 |
}
|
494 |
}
|
495 |
|
496 |
+
if ( $pid ) {
|
497 |
+
$this->pid = $pid;
|
498 |
+
}
|
499 |
+
|
500 |
remove_filter( 'the_content', 'wpautop' );
|
501 |
|
502 |
// insert the compiled head and content
|
513 |
}
|
514 |
|
515 |
|
516 |
+
/**
|
517 |
+
* @internal
|
518 |
+
*/
|
519 |
+
public function enqueue_preview_assets() {
|
520 |
+
if ( wp_script_is( 'jquery' ) === false ) {
|
521 |
+
wp_register_script( 'jquery-core', "/wp-includes/js/jquery/jquery.js" );
|
522 |
+
wp_register_script( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate.min.js" );
|
523 |
+
wp_register_script( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) );
|
524 |
+
}
|
525 |
+
|
526 |
+
$urlBuilder = new Brizy_Editor_UrlBuilder( Brizy_Editor_Project::get() );
|
527 |
+
$assets_url = $urlBuilder->editor_asset_url();
|
528 |
+
|
529 |
+
|
530 |
+
wp_enqueue_style( 'brizy-preview', "${assets_url}/editor/css/preview.css", array(), BRIZY_EDITOR_VERSION );
|
531 |
+
wp_register_script( 'brizy-polyfill', "https://cdn.polyfill.io/v2/polyfill.js?features=IntersectionObserver,IntersectionObserverEntry", array(), null, true );
|
532 |
+
wp_enqueue_script( 'brizy-preview', "${assets_url}/editor/js/preview.js", array(
|
533 |
+
'jquery',
|
534 |
+
'brizy-polyfill'
|
535 |
+
), BRIZY_EDITOR_VERSION, true );
|
536 |
+
//wp_add_inline_script( 'brizy-preview', "var __CONFIG__ = ${config_json};", 'before' );
|
537 |
+
|
538 |
+
do_action( 'brizy_preview_enqueue_scripts' );
|
539 |
+
}
|
540 |
+
|
541 |
+
|
542 |
public function bodyClassFrontend( $classes ) {
|
543 |
|
544 |
$classes[] = 'brz';
|
556 |
}
|
557 |
$pid = Brizy_Editor::get()->currentPostId();
|
558 |
|
559 |
+
$post = $this->template->get_wp_post();
|
560 |
|
561 |
+
if ( $pid ) {
|
562 |
+
$post = get_post( $pid );
|
563 |
}
|
564 |
|
|
|
565 |
|
566 |
+
$compiled_page = $this->template->get_compiled_page();
|
567 |
|
568 |
+
//$compiled_page->addAssetProcessor( new Brizy_Editor_Asset_StripTagsProcessor( array( '<title>' ) ) );
|
569 |
+
|
570 |
+
$context = Brizy_Content_ContextFactory::createContext( Brizy_Editor_Project::get(), null, $post,null );
|
571 |
+
|
572 |
+
$mainProcessor = new Brizy_Content_MainProcessor( $context );
|
573 |
+
|
574 |
+
$head = $mainProcessor->process( $compiled_page->get_head() );
|
575 |
|
576 |
?>
|
577 |
<!-- BRIZY HEAD -->
|
597 |
|
598 |
$pid = Brizy_Editor::get()->currentPostId();
|
599 |
|
600 |
+
$post = $this->template;
|
601 |
|
602 |
+
if ( $pid ) {
|
603 |
+
$post = get_post( $pid );
|
604 |
}
|
605 |
|
606 |
+
$context = Brizy_Content_ContextFactory::createContext( Brizy_Editor_Project::get(), null, $post->get_wp_post(),null );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
607 |
|
608 |
+
$compiled_page = $this->template->get_compiled_page();
|
|
|
609 |
|
610 |
+
$mainProcessor = new Brizy_Content_MainProcessor( $context );
|
611 |
|
612 |
+
$content = $mainProcessor->process( $compiled_page->get_body() );
|
|
|
|
|
|
|
|
|
|
|
|
|
613 |
|
614 |
+
echo do_shortcode( $content );
|
615 |
}
|
616 |
|
|
|
617 |
/**
|
618 |
* @param $content
|
619 |
*
|
625 |
if ( ! $this->template ) {
|
626 |
return $content;
|
627 |
}
|
628 |
+
$pid = Brizy_Editor::get()->currentPostId();
|
629 |
+
$brizyPost = get_post( $pid );
|
630 |
+
|
631 |
+
$context = Brizy_Content_ContextFactory::createContext( Brizy_Editor_Project::get(), null, $brizyPost, null );
|
632 |
+
|
633 |
+
$compiled_page = $this->template->get_compiled_page();
|
634 |
|
635 |
+
$mainProcessor = new Brizy_Content_MainProcessor( $context );
|
636 |
|
637 |
+
return $mainProcessor->process( $compiled_page->get_body() );
|
638 |
}
|
639 |
|
640 |
/**
|
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
|
@@ -20,7 +20,7 @@ if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && stripos( $_SERVER['HTTP_X_FO
|
|
20 |
|
21 |
define( 'BRIZY_DEVELOPMENT', false );
|
22 |
define( 'BRIZY_LOG', false );
|
23 |
-
define( 'BRIZY_VERSION', '1.0.
|
24 |
define( 'BRIZY_EDITOR_VERSION', '1.0.69' );
|
25 |
define( 'BRIZY_FILE', __FILE__ );
|
26 |
define( 'BRIZY_PLUGIN_BASE', plugin_basename( BRIZY_FILE ) );
|
5 |
* Plugin URI: https://brizy.io/
|
6 |
* Author: Brizy.io
|
7 |
* Author URI: https://brizy.io/
|
8 |
+
* Version: 1.0.43
|
9 |
* Text Domain: brizy
|
10 |
* License: GPLv3
|
11 |
* Domain Path: /languages
|
20 |
|
21 |
define( 'BRIZY_DEVELOPMENT', false );
|
22 |
define( 'BRIZY_LOG', false );
|
23 |
+
define( 'BRIZY_VERSION', '1.0.43' );
|
24 |
define( 'BRIZY_EDITOR_VERSION', '1.0.69' );
|
25 |
define( 'BRIZY_FILE', __FILE__ );
|
26 |
define( 'BRIZY_PLUGIN_BASE', plugin_basename( BRIZY_FILE ) );
|
content/context-factory.php
CHANGED
@@ -16,11 +16,16 @@ class Brizy_Content_ContextFactory {
|
|
16 |
*
|
17 |
* @return Brizy_Content_Context
|
18 |
*/
|
19 |
-
static public function createContext(
|
20 |
-
$context = new Brizy_Content_Context( $project,
|
21 |
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
|
|
|
|
|
|
|
25 |
}
|
26 |
}
|
16 |
*
|
17 |
* @return Brizy_Content_Context
|
18 |
*/
|
19 |
+
static public function createContext( $project, $brizy_post, $wp_post, $contentHtml ) {
|
20 |
+
$context = new Brizy_Content_Context( $project, null, $wp_post,null );
|
21 |
|
22 |
+
if ( $wp_post ) {
|
23 |
+
$context->setAuthor( $wp_post->post_author );
|
24 |
+
}
|
25 |
|
26 |
+
/**
|
27 |
+
* We send here the $wp_post for compatibility
|
28 |
+
*/
|
29 |
+
return apply_filters( 'brizy_context_create', $context, $wp_post );
|
30 |
}
|
31 |
}
|
content/context.php
CHANGED
@@ -61,14 +61,10 @@ class Brizy_Content_Context {
|
|
61 |
* BrizyPro_Content_Context constructor.
|
62 |
*
|
63 |
* @param $project
|
64 |
-
* @param $brizy_post
|
65 |
* @param $wp_post
|
66 |
-
* @param $contentHtml
|
67 |
*/
|
68 |
public function __construct( $project, $brizy_post, $wp_post, $contentHtml ) {
|
69 |
-
$this->setContent( $contentHtml );
|
70 |
$this->setProject( $project );
|
71 |
-
$this->setPost( $brizy_post );
|
72 |
$this->setWpPost( $wp_post );
|
73 |
}
|
74 |
}
|
61 |
* BrizyPro_Content_Context constructor.
|
62 |
*
|
63 |
* @param $project
|
|
|
64 |
* @param $wp_post
|
|
|
65 |
*/
|
66 |
public function __construct( $project, $brizy_post, $wp_post, $contentHtml ) {
|
|
|
67 |
$this->setProject( $project );
|
|
|
68 |
$this->setWpPost( $wp_post );
|
69 |
}
|
70 |
}
|
content/dynamic-content-processor.php
CHANGED
@@ -3,39 +3,22 @@
|
|
3 |
class Brizy_Content_DynamicContentProcessor implements Brizy_Editor_Content_ProcessorInterface {
|
4 |
|
5 |
/**
|
6 |
-
* @
|
7 |
-
|
8 |
-
private $post;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var Brizy_Editor_Project
|
12 |
-
*/
|
13 |
-
private $project;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @param Brizy_Editor_Project $project
|
17 |
-
* @param Brizy_Editor_Post $post
|
18 |
-
*/
|
19 |
-
public function __construct( $project, $post = null ) {
|
20 |
-
$this->post = $post;
|
21 |
-
$this->project = $project;
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @param $content
|
26 |
*
|
27 |
* @return mixed
|
28 |
*/
|
29 |
-
public function process( $content ) {
|
30 |
-
|
31 |
-
$context = Brizy_Content_ContextFactory::createContext( $this->project, $this->post, $this->post->get_wp_post(), $content );
|
32 |
-
$context = apply_filters( 'brizy_context_create', $context, $this->post->get_wp_post() );
|
33 |
|
34 |
$placeholderProvider = new Brizy_Content_PlaceholderProvider( $context );
|
35 |
-
$extractor = new Brizy_Content_PlaceholderExtractor( $
|
|
|
|
|
36 |
|
37 |
$replacer = new Brizy_Content_PlaceholderReplacer( $context, $placeholderProvider, $extractor );
|
38 |
|
39 |
-
|
|
|
|
|
40 |
}
|
41 |
}
|
3 |
class Brizy_Content_DynamicContentProcessor implements Brizy_Editor_Content_ProcessorInterface {
|
4 |
|
5 |
/**
|
6 |
+
* @param string $content
|
7 |
+
* @param Brizy_Content_Context $context
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
*
|
9 |
* @return mixed
|
10 |
*/
|
11 |
+
public function process( $content, Brizy_Content_Context $context ) {
|
|
|
|
|
|
|
12 |
|
13 |
$placeholderProvider = new Brizy_Content_PlaceholderProvider( $context );
|
14 |
+
$extractor = new Brizy_Content_PlaceholderExtractor( $placeholderProvider );
|
15 |
+
|
16 |
+
list( $placeholders, $content ) = $extractor->extract( $content );
|
17 |
|
18 |
$replacer = new Brizy_Content_PlaceholderReplacer( $context, $placeholderProvider, $extractor );
|
19 |
|
20 |
+
$content = $replacer->getContent( $placeholders, $content );
|
21 |
+
|
22 |
+
return $content;
|
23 |
}
|
24 |
}
|
content/main-processor.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: viorel
|
5 |
+
* Date: 10/29/18
|
6 |
+
* Time: 4:19 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Brizy_Content_MainProcessor {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @var Brizy_Editor_Content_ProcessorInterface[]
|
13 |
+
*/
|
14 |
+
private $processors = array();
|
15 |
+
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var Brizy_Content_Context
|
19 |
+
*/
|
20 |
+
private $context;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Brizy_Content_MainProcessor constructor.
|
24 |
+
*
|
25 |
+
* @param $context
|
26 |
+
*/
|
27 |
+
public function __construct( Brizy_Content_Context $context ) {
|
28 |
+
|
29 |
+
$this->context = $context;
|
30 |
+
|
31 |
+
$this->processors[] = new Brizy_Editor_Asset_DomainProcessor();
|
32 |
+
$this->processors[] = new Brizy_Content_DynamicContentProcessor();
|
33 |
+
|
34 |
+
$urlBuilder = new Brizy_Editor_UrlBuilder( $context->getProject(), $context->getWpPost()->ID );
|
35 |
+
$asset_storage = new Brizy_Editor_Asset_AssetProxyStorage( $urlBuilder );
|
36 |
+
$media_storage = new Brizy_Editor_Asset_MediaProxyStorage( $urlBuilder );
|
37 |
+
|
38 |
+
$this->processors[] = new Brizy_Editor_Asset_AssetProxyProcessor( $asset_storage );
|
39 |
+
$this->processors[] = new Brizy_Editor_Asset_MediaAssetProcessor( $media_storage );
|
40 |
+
|
41 |
+
$this->processors = apply_filters( 'brizy_content_processors', $this->processors, $context );
|
42 |
+
|
43 |
+
array_unshift( $this->processors, new Brizy_Content_DynamicContentProcessor() );
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param $content
|
48 |
+
*
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
public function process( $content ) {
|
52 |
+
$content = html_entity_decode( $content, ENT_QUOTES | ENT_HTML5, get_bloginfo( 'charset' ) );
|
53 |
+
|
54 |
+
$processors = apply_filters( 'brizy_apply_content_processors', $this->processors );
|
55 |
+
|
56 |
+
foreach ( $processors as $processor ) {
|
57 |
+
$content = $processor->process( $content, $this->context );
|
58 |
+
}
|
59 |
+
|
60 |
+
return $content;
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
content/placeholder-extractor.php
CHANGED
@@ -9,12 +9,7 @@
|
|
9 |
class Brizy_Content_PlaceholderExtractor {
|
10 |
|
11 |
/**
|
12 |
-
* @var
|
13 |
-
*/
|
14 |
-
private $context;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @var BrizyPro_Content_Providers_AbstractProvider
|
18 |
*/
|
19 |
private $provider;
|
20 |
|
@@ -22,35 +17,28 @@ class Brizy_Content_PlaceholderExtractor {
|
|
22 |
/**
|
23 |
* BrizyPro_Content_PlaceholderExtractor constructor.
|
24 |
*
|
25 |
-
* @param
|
26 |
-
* @param BrizyPro_Content_Providers_AbstractProvider $provider
|
27 |
*/
|
28 |
-
public function __construct( $
|
29 |
-
$this->context = $context;
|
30 |
$this->provider = $provider;
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
-
* @
|
35 |
-
|
36 |
-
public function getContent() {
|
37 |
-
return $this->content;
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
* @return array
|
42 |
*/
|
43 |
-
public function extract() {
|
44 |
|
45 |
$placeholders = array();
|
46 |
$expression = "/(?<placeholder>{{\s*(?<placeholderName>.+?)(?<attributes>(?:\s+)((?:\w+\s*=\s*'(?:.[^']*|)'\s*)*))?}}(?:(?<content>.*?){{\s*end_(\g{placeholderName})\s*}})?)/ims";
|
47 |
|
48 |
$matches = array();
|
49 |
|
50 |
-
preg_match_all( $expression, $
|
51 |
|
52 |
if ( count( $matches['placeholder'] ) == 0 ) {
|
53 |
-
return $placeholders;
|
54 |
}
|
55 |
|
56 |
foreach ( $matches['placeholder'] as $i => $name ) {
|
@@ -64,19 +52,18 @@ class Brizy_Content_PlaceholderExtractor {
|
|
64 |
$hasPlaceholder = $this->provider->getPlaceholder( $placeholder->getName() );
|
65 |
|
66 |
// ignore unknown placeholders
|
67 |
-
if(
|
|
|
|
|
68 |
|
69 |
-
|
70 |
-
$
|
71 |
-
|
72 |
-
if ($pos !== false) {
|
73 |
-
$content = substr_replace($content, $placeholder->getUid(), $pos, strlen($placeholder->getPlaceholder()));
|
74 |
}
|
75 |
|
76 |
-
$this->context->setContent( $content );
|
77 |
}
|
78 |
|
79 |
-
return $placeholders;
|
80 |
}
|
81 |
|
82 |
/**
|
9 |
class Brizy_Content_PlaceholderExtractor {
|
10 |
|
11 |
/**
|
12 |
+
* @var Brizy_Content_Providers_AbstractProvider
|
|
|
|
|
|
|
|
|
|
|
13 |
*/
|
14 |
private $provider;
|
15 |
|
17 |
/**
|
18 |
* BrizyPro_Content_PlaceholderExtractor constructor.
|
19 |
*
|
20 |
+
* @param Brizy_Content_Providers_AbstractProvider $provider
|
|
|
21 |
*/
|
22 |
+
public function __construct( $provider ) {
|
|
|
23 |
$this->provider = $provider;
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
+
* @param $content
|
28 |
+
*
|
|
|
|
|
|
|
|
|
|
|
29 |
* @return array
|
30 |
*/
|
31 |
+
public function extract( $content ) {
|
32 |
|
33 |
$placeholders = array();
|
34 |
$expression = "/(?<placeholder>{{\s*(?<placeholderName>.+?)(?<attributes>(?:\s+)((?:\w+\s*=\s*'(?:.[^']*|)'\s*)*))?}}(?:(?<content>.*?){{\s*end_(\g{placeholderName})\s*}})?)/ims";
|
35 |
|
36 |
$matches = array();
|
37 |
|
38 |
+
preg_match_all( $expression, $content, $matches );
|
39 |
|
40 |
if ( count( $matches['placeholder'] ) == 0 ) {
|
41 |
+
return array($placeholders, $content);
|
42 |
}
|
43 |
|
44 |
foreach ( $matches['placeholder'] as $i => $name ) {
|
52 |
$hasPlaceholder = $this->provider->getPlaceholder( $placeholder->getName() );
|
53 |
|
54 |
// ignore unknown placeholders
|
55 |
+
if ( ! $hasPlaceholder ) {
|
56 |
+
continue;
|
57 |
+
}
|
58 |
|
59 |
+
$pos = strpos( $content, $placeholder->getPlaceholder() );
|
60 |
+
if ( $pos !== false ) {
|
61 |
+
$content = substr_replace( $content, $placeholder->getUid(), $pos, strlen( $placeholder->getPlaceholder() ) );
|
|
|
|
|
62 |
}
|
63 |
|
|
|
64 |
}
|
65 |
|
66 |
+
return array( $placeholders, $content );
|
67 |
}
|
68 |
|
69 |
/**
|
content/placeholder-replacer.php
CHANGED
@@ -37,36 +37,37 @@ class Brizy_Content_PlaceholderReplacer {
|
|
37 |
}
|
38 |
|
39 |
/**
|
|
|
|
|
|
|
40 |
* @return mixed
|
41 |
*/
|
42 |
-
public function getContent() {
|
43 |
|
44 |
-
$placeholders = $this->placeholderExtractor->extract();
|
45 |
$toReplace = array();
|
46 |
$toReplaceWithValues = array();
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
} else {
|
57 |
-
$toReplaceWithValues[] = '';
|
58 |
}
|
59 |
-
|
60 |
-
} catch ( Exception $e ) {
|
61 |
-
continue;
|
62 |
}
|
63 |
}
|
64 |
|
65 |
-
$content = str_replace( $toReplace, $toReplaceWithValues, $
|
66 |
-
|
67 |
-
$this->context->setContent( $content );
|
68 |
|
69 |
-
return $
|
70 |
}
|
71 |
|
72 |
}
|
37 |
}
|
38 |
|
39 |
/**
|
40 |
+
* @param $placeholders
|
41 |
+
* @param $content
|
42 |
+
*
|
43 |
* @return mixed
|
44 |
*/
|
45 |
+
public function getContent( $placeholders = null, $content = null ) {
|
46 |
|
|
|
47 |
$toReplace = array();
|
48 |
$toReplaceWithValues = array();
|
49 |
|
50 |
+
if ( $placeholders ) {
|
51 |
+
foreach ( $placeholders as $contentPlaceholder ) {
|
52 |
+
try {
|
53 |
+
$placeholder = $this->placeholderProvider->getPlaceholder( $contentPlaceholder->getName() );
|
54 |
+
$toReplace[] = $contentPlaceholder->getUid();
|
55 |
|
56 |
+
if ( $placeholder ) {
|
57 |
+
$toReplaceWithValues[] = $placeholder->getValue( $this->context, $contentPlaceholder );
|
58 |
+
} else {
|
59 |
+
$toReplaceWithValues[] = '';
|
60 |
+
}
|
61 |
|
62 |
+
} catch ( Exception $e ) {
|
63 |
+
continue;
|
|
|
|
|
64 |
}
|
|
|
|
|
|
|
65 |
}
|
66 |
}
|
67 |
|
68 |
+
$content = str_replace( $toReplace, $toReplaceWithValues, $content );
|
|
|
|
|
69 |
|
70 |
+
return $content;
|
71 |
}
|
72 |
|
73 |
}
|
editor.php
CHANGED
@@ -293,6 +293,8 @@ class Brizy_Editor {
|
|
293 |
} elseif
|
294 |
( ( $apid = get_queried_object_id() ) && ( is_single() || is_page() ) && $wp_query->queried_object instanceof WP_Post ) {
|
295 |
$pid = (int) $apid;
|
|
|
|
|
296 |
}
|
297 |
|
298 |
return $pid;
|
293 |
} elseif
|
294 |
( ( $apid = get_queried_object_id() ) && ( is_single() || is_page() ) && $wp_query->queried_object instanceof WP_Post ) {
|
295 |
$pid = (int) $apid;
|
296 |
+
} elseif ( function_exists( 'is_shop' ) && is_shop() ) {
|
297 |
+
$pid = wc_get_page_id( 'shop' );
|
298 |
}
|
299 |
|
300 |
return $pid;
|
editor/api.php
CHANGED
@@ -527,7 +527,7 @@ class Brizy_Editor_API {
|
|
527 |
//$post->compile_page();
|
528 |
$this->post->save();
|
529 |
|
530 |
-
$brizy_compiled_page = $this->post->get_compiled_page(
|
531 |
|
532 |
wp_update_post( array(
|
533 |
'ID' => $this->post->get_parent_id(),
|
527 |
//$post->compile_page();
|
528 |
$this->post->save();
|
529 |
|
530 |
+
$brizy_compiled_page = $this->post->get_compiled_page( );
|
531 |
|
532 |
wp_update_post( array(
|
533 |
'ID' => $this->post->get_parent_id(),
|
editor/asset/abstract-storage.php
CHANGED
@@ -6,23 +6,7 @@
|
|
6 |
* Time: 10:46 AM
|
7 |
*/
|
8 |
|
9 |
-
abstract class Brizy_Editor_Asset_AbstractStorage
|
10 |
-
|
11 |
-
/**
|
12 |
-
* @var Brizy_Editor_Project
|
13 |
-
*/
|
14 |
-
protected $project;
|
15 |
-
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var Brizy_Editor_Post
|
19 |
-
*/
|
20 |
-
protected $post;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var array
|
24 |
-
*/
|
25 |
-
protected $config;
|
26 |
|
27 |
/**
|
28 |
* @var Brizy_Editor_UrlBuilder
|
@@ -32,18 +16,12 @@ abstract class Brizy_Editor_Asset_AbstractStorage extends Brizy_Editor_Asset_S
|
|
32 |
/**
|
33 |
* Brizy_Editor_Asset_AbstractStorage constructor.
|
34 |
*
|
35 |
-
* @param $
|
36 |
-
* @param Brizy_Editor_Post $post
|
37 |
-
* @param $config
|
38 |
*/
|
39 |
-
public function __construct( $
|
40 |
-
$this->
|
41 |
-
$this->post = $post;
|
42 |
-
$this->config = $config;
|
43 |
-
$this->url_builder = new Brizy_Editor_UrlBuilder( $project, $post->get_parent_id() );
|
44 |
}
|
45 |
|
46 |
-
|
47 |
/**
|
48 |
* Get the asset and store it somewhere in uploads and return the new local url.
|
49 |
*
|
6 |
* Time: 10:46 AM
|
7 |
*/
|
8 |
|
9 |
+
abstract class Brizy_Editor_Asset_AbstractStorage extends Brizy_Editor_Asset_StaticFile {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
/**
|
12 |
* @var Brizy_Editor_UrlBuilder
|
16 |
/**
|
17 |
* Brizy_Editor_Asset_AbstractStorage constructor.
|
18 |
*
|
19 |
+
* @param $url_builder
|
|
|
|
|
20 |
*/
|
21 |
+
public function __construct( $url_builder ) {
|
22 |
+
$this->url_builder = $url_builder;
|
|
|
|
|
|
|
23 |
}
|
24 |
|
|
|
25 |
/**
|
26 |
* Get the asset and store it somewhere in uploads and return the new local url.
|
27 |
*
|
editor/asset/asset-proxy-processor.php
CHANGED
@@ -23,13 +23,12 @@ class Brizy_Editor_Asset_AssetProxyProcessor implements Brizy_Editor_Content_Pro
|
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
-
*
|
|
|
27 |
*
|
28 |
-
* @
|
29 |
-
*
|
30 |
-
* @return string
|
31 |
*/
|
32 |
-
public function process( $content ) {
|
33 |
|
34 |
preg_match_all( '/"(.[^"]*(?:\?|&|&)brizy=(.[^"]*))"/im', $content, $matches );
|
35 |
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
+
* @param string $content
|
27 |
+
* @param Brizy_Content_Context $context
|
28 |
*
|
29 |
+
* @return mixed|string
|
|
|
|
|
30 |
*/
|
31 |
+
public function process( $content, Brizy_Content_Context $context ) {
|
32 |
|
33 |
preg_match_all( '/"(.[^"]*(?:\?|&|&)brizy=(.[^"]*))"/im', $content, $matches );
|
34 |
|
editor/asset/domain-processor.php
CHANGED
@@ -10,13 +10,12 @@ class Brizy_Editor_Asset_DomainProcessor implements Brizy_Editor_Content_Process
|
|
10 |
|
11 |
|
12 |
/**
|
13 |
-
*
|
|
|
14 |
*
|
15 |
-
* @
|
16 |
-
*
|
17 |
-
* @return string
|
18 |
*/
|
19 |
-
public function process( $content ) {
|
20 |
|
21 |
$content = Brizy_SiteUrlReplacer::restoreSiteUrl( $content );
|
22 |
|
10 |
|
11 |
|
12 |
/**
|
13 |
+
* @param string $content
|
14 |
+
* @param Brizy_Content_Context $context
|
15 |
*
|
16 |
+
* @return mixed|null|string|string[]
|
|
|
|
|
17 |
*/
|
18 |
+
public function process( $content, Brizy_Content_Context $context ) {
|
19 |
|
20 |
$content = Brizy_SiteUrlReplacer::restoreSiteUrl( $content );
|
21 |
|
editor/asset/media-asset-processor.php
CHANGED
@@ -25,23 +25,30 @@ class Brizy_Editor_Asset_MediaAssetProcessor implements Brizy_Editor_Content_Pro
|
|
25 |
/**
|
26 |
* Find and cache all assets and replace the urls with new local ones.
|
27 |
*
|
28 |
-
* @param $content
|
|
|
29 |
*
|
30 |
-
* @return string
|
31 |
*/
|
32 |
-
public function process( $content ) {
|
33 |
|
34 |
-
$content = $this->process_external_asset_urls( $content );
|
35 |
|
36 |
return $content;
|
37 |
}
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
$site_url = str_replace( array( 'http://', 'https://' ), '', home_url() );
|
42 |
|
43 |
$site_url = str_replace( array( '/', '.' ), array( '\/', '\.' ), $site_url );
|
44 |
-
$project =
|
45 |
|
46 |
preg_match_all( '/' . $site_url . '\/?(\?' . Brizy_Public_CropProxy::ENDPOINT . '=(.[^"\',\s)]*))/im', $content, $matches );
|
47 |
preg_match_all( '/(http|https):\/\/' . $site_url . '\/?(\?' . Brizy_Public_CropProxy::ENDPOINT . '=(.[^"\',\s)]*))/im', $content, $matches );
|
25 |
/**
|
26 |
* Find and cache all assets and replace the urls with new local ones.
|
27 |
*
|
28 |
+
* @param string $content
|
29 |
+
* @param Brizy_Content_Context $context
|
30 |
*
|
31 |
+
* @return mixed|string
|
32 |
*/
|
33 |
+
public function process( $content, Brizy_Content_Context $context ) {
|
34 |
|
35 |
+
$content = $this->process_external_asset_urls( $content, $context );
|
36 |
|
37 |
return $content;
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* @param string $content
|
42 |
+
* @param Brizy_Content_Context $context
|
43 |
+
*
|
44 |
+
* @return mixed
|
45 |
+
*/
|
46 |
+
public function process_external_asset_urls( $content, Brizy_Content_Context $context ) {
|
47 |
|
48 |
$site_url = str_replace( array( 'http://', 'https://' ), '', home_url() );
|
49 |
|
50 |
$site_url = str_replace( array( '/', '.' ), array( '\/', '\.' ), $site_url );
|
51 |
+
$project = $context->getProject();
|
52 |
|
53 |
preg_match_all( '/' . $site_url . '\/?(\?' . Brizy_Public_CropProxy::ENDPOINT . '=(.[^"\',\s)]*))/im', $content, $matches );
|
54 |
preg_match_all( '/(http|https):\/\/' . $site_url . '\/?(\?' . Brizy_Public_CropProxy::ENDPOINT . '=(.[^"\',\s)]*))/im', $content, $matches );
|
editor/asset/storage.php
CHANGED
@@ -8,6 +8,19 @@
|
|
8 |
|
9 |
class Brizy_Editor_Asset_Storage extends Brizy_Editor_Asset_AbstractStorage {
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
/**
|
13 |
* Get the asset and store it somewhere in uploads and return the new local url.
|
8 |
|
9 |
class Brizy_Editor_Asset_Storage extends Brizy_Editor_Asset_AbstractStorage {
|
10 |
|
11 |
+
private $config;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Brizy_Editor_Asset_Storage constructor.
|
15 |
+
*
|
16 |
+
* @param $url_builder
|
17 |
+
* @param $config
|
18 |
+
*/
|
19 |
+
public function __construct( $url_builder, $config ) {
|
20 |
+
parent::__construct( $url_builder );
|
21 |
+
$this->config = $config;
|
22 |
+
}
|
23 |
+
|
24 |
|
25 |
/**
|
26 |
* Get the asset and store it somewhere in uploads and return the new local url.
|
editor/asset/strip-tags-processor.php
CHANGED
@@ -24,13 +24,12 @@ class Brizy_Editor_Asset_StripTagsProcessor implements Brizy_Editor_Content_Proc
|
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
-
*
|
|
|
28 |
*
|
29 |
-
* @
|
30 |
-
*
|
31 |
-
* @return string
|
32 |
*/
|
33 |
-
public function process( $content ) {
|
34 |
|
35 |
foreach ( $this->tags as $tag ) {
|
36 |
//$content = $this->strip_tags_content( $content, $tag );
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
+
* @param string $content
|
28 |
+
* @param Brizy_Content_Context $context
|
29 |
*
|
30 |
+
* @return mixed|string
|
|
|
|
|
31 |
*/
|
32 |
+
public function process( $content, Brizy_Content_Context $context ) {
|
33 |
|
34 |
foreach ( $this->tags as $tag ) {
|
35 |
//$content = $this->strip_tags_content( $content, $tag );
|
editor/content/processor-interface.php
CHANGED
@@ -1,5 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
interface Brizy_Editor_Content_ProcessorInterface {
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
}
|
1 |
<?php
|
2 |
|
3 |
interface Brizy_Editor_Content_ProcessorInterface {
|
4 |
+
/**
|
5 |
+
* @param string $content
|
6 |
+
* @param Brizy_Content_Context $context
|
7 |
+
*
|
8 |
+
* @return mixed
|
9 |
+
*/
|
10 |
+
public function process( $content, Brizy_Content_Context $context );
|
11 |
}
|
editor/post.php
CHANGED
@@ -325,33 +325,16 @@ class Brizy_Editor_Post extends Brizy_Admin_Serializable {
|
|
325 |
return true;
|
326 |
}
|
327 |
|
328 |
-
|
|
|
|
|
|
|
329 |
|
330 |
if ( self::$compiled_page ) {
|
331 |
return self::$compiled_page;
|
332 |
}
|
333 |
-
|
334 |
-
if ( is_null( $post ) ) {
|
335 |
-
$post = $this;
|
336 |
-
}
|
337 |
-
|
338 |
-
$brizy_editor_editor_editor = Brizy_Editor_Editor_Editor::get( $project, $this );
|
339 |
-
$config = $brizy_editor_editor_editor->config();
|
340 |
-
$asset_storage = new Brizy_Editor_Asset_AssetProxyStorage( $project, $post, $config );
|
341 |
-
$media_storage = new Brizy_Editor_Asset_MediaProxyStorage( $project, $post, $config );
|
342 |
-
|
343 |
-
$asset_processors[] = new Brizy_Editor_Asset_DomainProcessor();
|
344 |
-
$asset_processors[] = new Brizy_Editor_Asset_AssetProxyProcessor( $asset_storage );
|
345 |
-
$asset_processors[] = new Brizy_Editor_Asset_MediaAssetProcessor( $media_storage );
|
346 |
-
|
347 |
$brizy_editor_compiled_html = new Brizy_Editor_CompiledHtml( $this->get_compiled_html() );
|
348 |
|
349 |
-
$asset_processors = apply_filters( 'brizy_content_processors', $asset_processors, $project, $post );
|
350 |
-
|
351 |
-
array_unshift( $asset_processors, new Brizy_Content_DynamicContentProcessor( $project, $post ) );
|
352 |
-
|
353 |
-
$brizy_editor_compiled_html->setProcessors( $asset_processors );
|
354 |
-
|
355 |
return self::$compiled_page = $brizy_editor_compiled_html;
|
356 |
}
|
357 |
|
325 |
return true;
|
326 |
}
|
327 |
|
328 |
+
/**
|
329 |
+
* @return Brizy_Editor_CompiledHtml
|
330 |
+
*/
|
331 |
+
public function get_compiled_page( ) {
|
332 |
|
333 |
if ( self::$compiled_page ) {
|
334 |
return self::$compiled_page;
|
335 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
$brizy_editor_compiled_html = new Brizy_Editor_CompiledHtml( $this->get_compiled_html() );
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
return self::$compiled_page = $brizy_editor_compiled_html;
|
339 |
}
|
340 |
|
editor/user.php
CHANGED
@@ -187,7 +187,7 @@ class Brizy_Editor_User {
|
|
187 |
$editor_data = $post->get_editor_data();
|
188 |
|
189 |
$config = Brizy_Editor_Editor_Editor::get( $project, $post )->config();
|
190 |
-
$urlBuilder = new Brizy_Editor_UrlBuilder( $project, $post );
|
191 |
|
192 |
|
193 |
$page_html = $this->get_client()->compile_page( $project, $editor_data, $config, $urlBuilder->compiler_url() );
|
187 |
$editor_data = $post->get_editor_data();
|
188 |
|
189 |
$config = Brizy_Editor_Editor_Editor::get( $project, $post )->config();
|
190 |
+
$urlBuilder = new Brizy_Editor_UrlBuilder( $project, $post->get_parent_id() );
|
191 |
|
192 |
|
193 |
$page_html = $this->get_client()->compile_page( $project, $editor_data, $config, $urlBuilder->compiler_url() );
|
public/main.php
CHANGED
@@ -180,18 +180,18 @@ class Brizy_Public_Main {
|
|
180 |
return;
|
181 |
}
|
182 |
|
183 |
-
$type
|
184 |
-
$postTypeLabel = $wp_post_types[$type]->labels->singular_name;
|
185 |
-
$args
|
186 |
'id' => 'brizy_Edit_page_link',
|
187 |
-
'title' => __( "Edit "
|
188 |
'href' => $this->post->edit_url(),
|
189 |
'meta' => array()
|
190 |
);
|
191 |
$wp_admin_bar->add_node( $args );
|
192 |
}
|
193 |
|
194 |
-
public function templateIncludeForEditor($template) {
|
195 |
global $post;
|
196 |
|
197 |
if ( ! $post ) {
|
@@ -239,7 +239,7 @@ class Brizy_Public_Main {
|
|
239 |
public function body_class_frontend( $classes ) {
|
240 |
|
241 |
$classes[] = 'brz';
|
242 |
-
$classes[] = ( function_exists('wp_is_mobile') && wp_is_mobile() ) ? 'brz-is-mobile' : '';
|
243 |
|
244 |
return $classes;
|
245 |
}
|
@@ -278,7 +278,7 @@ class Brizy_Public_Main {
|
|
278 |
* @return bool
|
279 |
*/
|
280 |
public function is_view_page() {
|
281 |
-
return ! is_admin() && $this->post->uses_editor() && !isset( $_GET[ Brizy_Editor_Constants::EDIT_KEY_IFRAME ] ) && !isset( $_GET[ Brizy_Editor_Constants::EDIT_KEY ] );
|
282 |
}
|
283 |
|
284 |
/**
|
@@ -323,7 +323,8 @@ class Brizy_Public_Main {
|
|
323 |
*/
|
324 |
public function insert_page_head() {
|
325 |
|
326 |
-
$
|
|
|
327 |
if ( ! $this->post->get_compiled_html() ) {
|
328 |
|
329 |
$compiled_html_head = $this->post->get_compiled_html_head();
|
@@ -332,20 +333,22 @@ class Brizy_Public_Main {
|
|
332 |
$this->post->set_needs_compile( true )
|
333 |
->save();
|
334 |
|
335 |
-
$
|
336 |
|
337 |
} else {
|
338 |
-
$compiled_page = $this->post->get_compiled_page(
|
339 |
-
|
340 |
-
$compiled_page->addAssetProcessor( new Brizy_Editor_Asset_StripTagsProcessor( array( '<title>' ) ) );
|
341 |
-
|
342 |
$head = $compiled_page->get_head();
|
343 |
|
344 |
-
$
|
345 |
}
|
346 |
|
|
|
|
|
|
|
|
|
347 |
echo Brizy_TwigEngine::instance( self::path( 'views' ) )
|
348 |
-
->render( 'head-partial.html.twig', $
|
349 |
|
350 |
return;
|
351 |
}
|
@@ -360,7 +363,7 @@ class Brizy_Public_Main {
|
|
360 |
|
361 |
global $post;
|
362 |
|
363 |
-
if ( false === strpos( $content, 'brz-root__container' ) || ( $post && $post->ID !== $this->post->get_id() )) {
|
364 |
return $content;
|
365 |
}
|
366 |
|
@@ -369,10 +372,14 @@ class Brizy_Public_Main {
|
|
369 |
$content = Brizy_SiteUrlReplacer::restoreSiteUrl( $compiled_html_body );
|
370 |
$this->post->set_needs_compile( true )->save();
|
371 |
} else {
|
372 |
-
$compiled_page = $this->post->get_compiled_page(
|
373 |
$content = $compiled_page->get_body();
|
374 |
}
|
375 |
|
|
|
|
|
|
|
|
|
376 |
return $content;
|
377 |
}
|
378 |
|
180 |
return;
|
181 |
}
|
182 |
|
183 |
+
$type = $this->post->get_wp_post()->post_type;
|
184 |
+
$postTypeLabel = $wp_post_types[ $type ]->labels->singular_name;
|
185 |
+
$args = array(
|
186 |
'id' => 'brizy_Edit_page_link',
|
187 |
+
'title' => __( "Edit " . $postTypeLabel . " with Brizy" ),
|
188 |
'href' => $this->post->edit_url(),
|
189 |
'meta' => array()
|
190 |
);
|
191 |
$wp_admin_bar->add_node( $args );
|
192 |
}
|
193 |
|
194 |
+
public function templateIncludeForEditor( $template ) {
|
195 |
global $post;
|
196 |
|
197 |
if ( ! $post ) {
|
239 |
public function body_class_frontend( $classes ) {
|
240 |
|
241 |
$classes[] = 'brz';
|
242 |
+
$classes[] = ( function_exists( 'wp_is_mobile' ) && wp_is_mobile() ) ? 'brz-is-mobile' : '';
|
243 |
|
244 |
return $classes;
|
245 |
}
|
278 |
* @return bool
|
279 |
*/
|
280 |
public function is_view_page() {
|
281 |
+
return ! is_admin() && $this->post->uses_editor() && ! isset( $_GET[ Brizy_Editor_Constants::EDIT_KEY_IFRAME ] ) && ! isset( $_GET[ Brizy_Editor_Constants::EDIT_KEY ] );
|
282 |
}
|
283 |
|
284 |
/**
|
323 |
*/
|
324 |
public function insert_page_head() {
|
325 |
|
326 |
+
$params = array( 'content' => '' );
|
327 |
+
|
328 |
if ( ! $this->post->get_compiled_html() ) {
|
329 |
|
330 |
$compiled_html_head = $this->post->get_compiled_html_head();
|
333 |
$this->post->set_needs_compile( true )
|
334 |
->save();
|
335 |
|
336 |
+
$params['content'] = $compiled_html_head;
|
337 |
|
338 |
} else {
|
339 |
+
$compiled_page = $this->post->get_compiled_page();
|
340 |
+
//$compiled_page->addAssetProcessor( new Brizy_Editor_Asset_StripTagsProcessor( array( '<title>' ) ) );
|
|
|
|
|
341 |
$head = $compiled_page->get_head();
|
342 |
|
343 |
+
$params['content'] = $head;
|
344 |
}
|
345 |
|
346 |
+
$context = Brizy_Content_ContextFactory::createContext( Brizy_Editor_Project::get(), null, $this->post->get_wp_post(), null );
|
347 |
+
$mainProcessor = new Brizy_Content_MainProcessor( $context );
|
348 |
+
$params['content'] = $mainProcessor->process( $params['content'] );
|
349 |
+
|
350 |
echo Brizy_TwigEngine::instance( self::path( 'views' ) )
|
351 |
+
->render( 'head-partial.html.twig', $params );
|
352 |
|
353 |
return;
|
354 |
}
|
363 |
|
364 |
global $post;
|
365 |
|
366 |
+
if ( false === strpos( $content, 'brz-root__container' ) || ( $post && $post->ID !== $this->post->get_id() ) ) {
|
367 |
return $content;
|
368 |
}
|
369 |
|
372 |
$content = Brizy_SiteUrlReplacer::restoreSiteUrl( $compiled_html_body );
|
373 |
$this->post->set_needs_compile( true )->save();
|
374 |
} else {
|
375 |
+
$compiled_page = $this->post->get_compiled_page();
|
376 |
$content = $compiled_page->get_body();
|
377 |
}
|
378 |
|
379 |
+
$context = Brizy_Content_ContextFactory::createContext( Brizy_Editor_Project::get(), null, $this->post->get_wp_post(), null );
|
380 |
+
$mainProcessor = new Brizy_Content_MainProcessor( $context );
|
381 |
+
$content = $mainProcessor->process( $content );
|
382 |
+
|
383 |
return $content;
|
384 |
}
|
385 |
|
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 |
|
@@ -139,6 +139,9 @@ The progress you're making while building your page is always backed up in the c
|
|
139 |
|
140 |
== Changelog ==
|
141 |
|
|
|
|
|
|
|
142 |
= 1.0.42 - 2018-11-01 =
|
143 |
* New: Added tablet mode
|
144 |
* Improved: Added warning when the theme does not use the_content filter
|
4 |
Requires at least: 4.5
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.4
|
7 |
+
Stable tag: 1.0.43
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
139 |
|
140 |
== Changelog ==
|
141 |
|
142 |
+
= 1.0.43 - 2018-11-05 =
|
143 |
+
* Improved: Refactored the content module
|
144 |
+
|
145 |
= 1.0.42 - 2018-11-01 =
|
146 |
* New: Added tablet mode
|
147 |
* Improved: Added warning when the theme does not use the_content filter
|
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 ComposerAutoloaderInit3694c9ad043d9a634ac072ad693d61dd::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 ComposerAutoloaderInitc9757c331c721146f27a3ac844f39dbb
|
|
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 ComposerAutoloaderInit3694c9ad043d9a634ac072ad693d61dd
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit3694c9ad043d9a634ac072ad693d61dd', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit3694c9ad043d9a634ac072ad693d61dd', '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\ComposerStaticInit3694c9ad043d9a634ac072ad693d61dd::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 $prefixesPsr0 = array (
|
10 |
'T' =>
|
@@ -19,7 +19,7 @@ class ComposerStaticInitc9757c331c721146f27a3ac844f39dbb
|
|
19 |
public static function getInitializer(ClassLoader $loader)
|
20 |
{
|
21 |
return \Closure::bind(function () use ($loader) {
|
22 |
-
$loader->prefixesPsr0 =
|
23 |
|
24 |
}, null, ClassLoader::class);
|
25 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit3694c9ad043d9a634ac072ad693d61dd
|
8 |
{
|
9 |
public static $prefixesPsr0 = array (
|
10 |
'T' =>
|
19 |
public static function getInitializer(ClassLoader $loader)
|
20 |
{
|
21 |
return \Closure::bind(function () use ($loader) {
|
22 |
+
$loader->prefixesPsr0 = ComposerStaticInit3694c9ad043d9a634ac072ad693d61dd::$prefixesPsr0;
|
23 |
|
24 |
}, null, ClassLoader::class);
|
25 |
}
|