Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue#27673 #2021

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7a63c75
Added screenshot url in editor config
ViorelEremia Sep 27, 2024
2003ef6
Merge branch 'master' into develop
alecszaharia Oct 1, 2024
87ab2a3
Added menu url in editor client config
ViorelEremia Oct 3, 2024
38ebe0c
feat(menu): added createMenuLabel and onOpen callback from config
nicolaisirghi Oct 3, 2024
d088da4
Merge pull request #2016 from ThemeFuse/108-Menu-Integration
maxval1 Oct 9, 2024
74310f2
fix: added min suffix for react libs.
alecszaharia Oct 9, 2024
4bac45f
Revert "fix: added min suffix for react libs."
alecszaharia Oct 15, 2024
390e6f1
Merge branch 'beta-26-09-2024' into develop
alecszaharia Oct 21, 2024
f8aaec8
Merge release in develop.
alecszaharia Oct 21, 2024
61721e8
fix(react): append react-dev-tool var before react scripts
maxval1 Nov 5, 2024
6d77469
Merge pull request #2018 from ThemeFuse/fix/react-dev-tools
alecszaharia Nov 5, 2024
268a647
refactor: The structure of config.ui.leftSidebar
alecszaharia Nov 9, 2024
aa288c0
refactor: streamline addElements configuration process
alecszaharia Nov 11, 2024
a223fde
Merge branch 'release-editor-300-wp' into develop
alecszaharia Nov 12, 2024
40e29fe
Merge branch 'issue-27611' into develop
alecszaharia Nov 13, 2024
8bfc987
Merge [hotfix-27028] in develop
Nov 15, 2024
cbc9200
fix: simplify compilation check in editor's compiler
alecszaharia Nov 18, 2024
c7041d8
Merge [hotfix-18-11] in develop
Nov 18, 2024
be9de0d
Merge [hotfix-19-11] in develop
Nov 19, 2024
ee531b0
fix: needs compile on dev mode
alecszaharia Nov 25, 2024
a6b8670
refactor: adjust handling of globalBlocks and template rules
alecszaharia Nov 26, 2024
9ed66c2
fix: correct compiled HTML manipulation
alecszaharia Nov 26, 2024
1f2f7db
fix: allow rgba and var tokens on filtered html
alecszaharia Nov 27, 2024
bc8e84a
fix: add feature to remove featured image via AJAX
alecszaharia Dec 2, 2024
830ab2d
fix(sanitize): correct regex pattern for JavaScript URLs
alecszaharia Dec 3, 2024
3c1600c
Page is broken in preview when ID parameter is added in the url
Dec 5, 2024
262af92
Merge pull request #2020 from ThemeFuse/issues#25016
alecszaharia Dec 5, 2024
7feaff3
Replaces the CDN domain in the image URL with the server's domain
Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions admin/blocks/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ public function compilePageGlobalBlocks( $config, $context ) {
$config['globalBlocks'] = [];
}
$tmp = array_merge( $config['globalBlocks'], $blockManager->createResponseForEntities( $blocks, [], $context ) );
$config['globalBlocks'] = array_reduce( $tmp, function ( $result, $object ) {
$config['globalBlocks'] = array_values( array_reduce( $tmp, function ( $result, $object ) {
$result[ $object['uid'] ] = $object;

return $result;
}, [] );
}, [] ) );

return $config;
}
Expand Down Expand Up @@ -204,12 +204,10 @@ public function getMatchingBrizyBlocks( $wpPost = null ) {
$wpPost = get_post( $ruleMatches[0]['entityValues'][0] );
}
}

$matching_blocks = [];
if ( count( $ruleMatches ) ) {
$matching_blocks = $this->findMatchingBlocks( $ruleMatches );
}

$referenced = [];
if ( $wpPost ) {
try {
Expand Down
54 changes: 25 additions & 29 deletions editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,35 +409,31 @@ private function initializeAssetLoaders() {
* =====================================================================================================
* =====================================================================================================
*/
function currentPostId() {
$pid = null;
global $wp_query;

if ( isset( $_REQUEST['post'] ) ) {
$pid = (int) $_REQUEST['post'];
} elseif
( isset( $_REQUEST['page_id'] ) ) {
$pid = (int) $_REQUEST['page_id'];
} elseif
( isset( $_REQUEST['post_ID'] ) ) {
$pid = (int) $_POST['post_ID'];
} elseif
( isset( $_REQUEST['id'] ) ) {
$pid = (int) $_REQUEST['id'];
} elseif
( isset( $_REQUEST[ Brizy_Editor::prefix( '_post' ) ] ) ) {
$pid = (int) $_REQUEST[ Brizy_Editor::prefix( '_post' ) ];
} elseif ( $wp_query && $wp_query->is_posts_page ) {
$pid = (int) get_queried_object_id();
} elseif
( $wp_query && ( $apid = get_queried_object_id() ) && ( is_single() || is_page() ) && $wp_query->queried_object instanceof WP_Post ) {
$pid = (int) $apid;
} elseif ( function_exists( 'is_shop' ) && is_shop() ) {
$pid = wc_get_page_id( 'shop' );
}

return $pid;
}
function currentPostId()
{
$pid = null;
global $wp_query;

if ($wp_query && $wp_query->is_posts_page) {
$pid = absint(get_queried_object_id());
} elseif ($wp_query && ($apid = get_queried_object_id()) && (is_single() || is_page()) && $wp_query->queried_object instanceof WP_Post) {
$pid = absint($apid);
} elseif (function_exists('is_shop') && is_shop()) {
$pid = wc_get_page_id('shop');
} elseif (isset($_REQUEST[Brizy_Editor::prefix('_post')])) {
$pid = absint($_REQUEST[Brizy_Editor::prefix('_post')]);
} elseif (isset($_REQUEST['post'])) {
$pid = absint($_REQUEST['post']);
} elseif (isset($_REQUEST['page_id'])) {
$pid = absint($_REQUEST['page_id']);
} elseif (isset($_REQUEST['post_ID'])) {
$pid = absint($_REQUEST['post_ID']);
} elseif (isset($_REQUEST['id'])) {
$pid = absint($_REQUEST['id']);
}

return $pid;
}

static public function get_slug() {
return apply_filters( 'brizy-slug', 'brizy' );
Expand Down
1 change: 1 addition & 0 deletions editor/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ protected function initializeApiActions() {
add_action($p . self::AJAX_MEDIA_METAKEY, array($this, 'get_media_key'));
add_action($p . self::AJAX_CREATE_ATTACHMENT_UID, array($this, 'get_attachment_key'));
add_action($p . self::AJAX_SET_FEATURED_IMAGE, array($this, 'set_featured_image'));
add_action($p . self::AJAX_REMOVE_FEATURED_IMAGE, array($this, 'remove_featured_image'));
add_action($p . self::AJAX_SET_IMAGE_FOCAL_PT, array($this, 'set_featured_image_focal_point'));
add_action($p . self::AJAX_TIMESTAMP, array($this, 'timestamp'));
add_action($p . self::AJAX_SET_TEMPLATE_TYPE, array($this, 'setTemplateType'));
Expand Down
4 changes: 4 additions & 0 deletions editor/compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public function needsCompile( Brizy_Editor_Post $post ) {
$currentCompiler = preg_replace( "/((beta\d?)?-wp)$/", "", $post->get_compiler_version() );
$v2 = preg_replace( "/((beta\d?)?-wp)$/", "", BRIZY_MINIMUM_COMPILER_VERSION );

if(BRIZY_EDITOR_VERSION=='dev') {
$v2 = BRIZY_EDITOR_VERSION;
}

if ( version_compare( $currentCompiler, $v2, "<" ) ) {
return true;
}
Expand Down
31 changes: 28 additions & 3 deletions editor/crop-cache-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,33 @@ private function getImgUrlByWpSize( $uid, $size ) {
$imgUrl = $this->getImgUrlByWpSize( $uid, 'full' );
}

return $imgUrl;
}
return $this->replaceCdnUrl($imgUrl);
}

/**
* Replaces the CDN domain in the image URL with the server's domain.
*
* @param string $imgUrl The original image URL.
* @return string The updated image URL with the server domain and without query parameters.
*/
private function replaceCdnUrl(
string $imgUrl
): string {
$server_domain = site_url();

$parsed_url = parse_url($imgUrl);
$img_domain = $parsed_url['scheme'].'://'.$parsed_url['host'];

$path = $parsed_url['path'] ?? '';

if ($img_domain !== $server_domain) {
$imgUrl = str_replace($img_domain, $server_domain, $img_domain.$path);
} else {
$imgUrl = $img_domain.$path;
}

return $imgUrl;
}

/**
* @throws Exception
Expand All @@ -259,4 +284,4 @@ public function basename( $originalPath ) {
public function buildPath( ...$parts ) {
return implode( '/', $parts );
}
}
}
Loading