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

moved to API from editor #1925

Open
wants to merge 45 commits into
base: filters
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4af0029
new: Made te fields optional for update blocks/popups/layouts
alecszaharia Nov 24, 2021
5d94065
new: html changes in page.html.twig
alecszaharia Dec 1, 2021
6c13122
new: Added title and tags for block/layouts/popups
alecszaharia Dec 1, 2021
67d442d
new: Added filter to be able to change the story rewrite slug
alecszaharia Dec 6, 2021
de25d6a
fix: decode the htmlentity encoded title and tags
alecszaharia Dec 7, 2021
ac42e11
new: Added ignore dc placeholder
alecszaharia Jan 17, 2022
0643f34
new: Added simple post aware and fixed few placeholders
alecszaharia Jan 19, 2022
5976d35
Upodated editor build branch
Feb 20, 2021
cb1a898
Added post action to delete the context folder
alecszaharia Feb 21, 2021
b34b8af
feat: Added support for placeholders in Wordpress and SMTP form integ…
alecszaharia Mar 16, 2021
3b21149
fix: Added additional data about the post in editor config.
alecszaharia Jun 10, 2021
b08d62b
feat: Filters for post loops
alecszaharia Oct 9, 2020
6615e31
....
alecszaharia Apr 2, 2021
85dd21e
...
alecszaharia Apr 28, 2021
4c370c2
feat: added nested filters
alecszaharia Apr 29, 2021
fcab15a
fix: changes after rebase
alecszaharia Jul 29, 2021
1921a49
...
alecszaharia Oct 27, 2021
c0d7c62
fix: placehodersContent action
alecszaharia Nov 29, 2021
f4532af
fix: fixed get placeholders content action
alecszaharia Nov 29, 2021
ffb94ee
new: filter placeholder content ...
alecszaharia Feb 14, 2022
8ef3d8c
new: filter placeholder content
alecszaharia Feb 15, 2022
b0a3eef
fix: made the filter placeholder content action public
alecszaharia Feb 17, 2022
c6dac6a
fix: fixed the content parsed for filter placeholders
alecszaharia Feb 17, 2022
0935f93
fix: added page placeholders in context
alecszaharia May 18, 2022
6d41c64
fix: added placeholders in context
alecszaharia May 19, 2022
25dea39
fix: optimized dynamic content processor
alecszaharia May 20, 2022
e7ea25a
...
alecszaharia May 23, 2022
c5e881d
fix: dynamic content processor
alecszaharia May 23, 2022
12fe077
fix: dynamic content processor
alecszaharia May 23, 2022
5b5f0e5
fix: compile page when asking for a placeholder html
alecszaharia Jun 9, 2022
dd0d30c
fix: small fix when wrong placeholder id is required
alecszaharia Jun 13, 2022
fa27af6
fix: use $_REQUEST instead if $_POST
alecszaharia Jun 23, 2022
950c783
Fix: #19185 - Fix condition modal editor by global rules
ViorelEremia Jul 26, 2022
29c9667
fix: filter refactoring
alecszaharia Aug 9, 2022
bc7ba18
fix: Config values in dev mode 2
alecszaharia Sep 22, 2022
cedbc9d
fix: Context factor
alecszaharia Oct 7, 2022
cc5b834
fix: small fixes after rebase.
alecszaharia Jul 18, 2023
49e5243
fix: added filters in module groups
alecszaharia Jul 19, 2023
7068ff4
fix: added a new method in context to find by name and id
alecszaharia Aug 1, 2023
2cfaecf
fix: updated composer.lock
alecszaharia Aug 2, 2023
a185c03
fix: removed notion of -tag and -pag logic from api
alecszaharia Aug 3, 2023
00004d6
new: added filter placeholders url in config.
alecszaharia Aug 23, 2023
a6fa129
Merge branch 'master' into filters
alecszaharia Sep 21, 2023
a69fd4a
new: added editor client config filter
alecszaharia Sep 21, 2023
264b8fd
moved to API from editor
GunkaArtur Aug 23, 2023
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
8 changes: 4 additions & 4 deletions .github/.build-env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BUILD_ENVIRONMENT=develop
FREE_BRANCH=develop
PRO_BRANCH=develop
EDITOR_BRANCH=dev
BUILD_ENVIRONMENT=master
FREE_BRANCH=master
PRO_BRANCH=master
EDITOR_BRANCH=master
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: themefuse<br>
Requires at least: 4.5<br>
Tested up to: 6.2.2<br>
Requires PHP: 5.6.20<br>
Stable tag: 2.4.26<br>
Stable tag: 2.4.27<br>
License: GPLv3<br>
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -136,6 +136,9 @@ $bodyHtml = apply_filters( 'brizy_content', $html->get_body(), Brizy_Editor_Proj

## Changelog

### 2.4.27 - 2023-08-08
* New: Added new blocks

### 2.4.26 - 2023-07-12
* New: Added custom video URL for Block background
* New: Added copy/paste styles for Text element
Expand Down
10 changes: 9 additions & 1 deletion admin/abstract-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ protected function verifyNonce( $action ) {
}
}

protected function addAjaxAction($action,$callable) {
add_action( 'wp_ajax_' . Brizy_Editor::prefix($action), $callable );
}

protected function addNoPrivAjaxAction($action,$callable) {
add_action( 'wp_ajax_nopriv_' . Brizy_Editor::prefix($action), $callable );
}

/**
* @param int|string $name
*
Expand Down Expand Up @@ -65,4 +73,4 @@ protected function error( $code, $message ) {
protected function success( $data ) {
wp_send_json_success( $data );
}
}
}
27 changes: 15 additions & 12 deletions admin/blocks/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public function actionDownloadBlocks()
$items = array_filter($items);

if (count($items) == 0) {
$this->error(404, __('There are no blocks to be archived', 'brizy' ) );
}
$this->error(404, __('There are no blocks to be archived', 'brizy'));
}

$fontManager = new Brizy_Admin_Fonts_Manager();
$zip = new Brizy_Editor_Zip_Archiver(
Expand Down Expand Up @@ -240,7 +240,7 @@ public function actionCreateGlobalBlock()
/**
* @var Brizy_Editor_Post $block;
*/
$block = $bockManager->createEntity($this->param('uid'), $status);
$block = $bockManager->createEntity($this->param('uid'), $status);
$block->setMeta(stripslashes($this->param('meta')));
$block->set_editor_data($editorData);
$block->set_needs_compile(true);
Expand Down Expand Up @@ -380,7 +380,7 @@ public function actionUpdateGlobalBlocks()
}

$bockManager = new Brizy_Admin_Blocks_Manager(Brizy_Admin_Blocks_Main::CP_GLOBAL);
$blocks = $bockManager->getEntity((array)$this->param('uid'));
$blocks = $bockManager->getEntity((array)$this->param('uid'));

foreach ((array)$this->param('uid') as $i => $uid) {

Expand Down Expand Up @@ -442,11 +442,13 @@ public function actionUpdateGlobalBlocks()
$block->save();

do_action('brizy_global_block_updated', $block);

}
}
}

do_action('brizy_global_data_updated');


$this->success([]);

} catch (Exception $exception) {
Expand Down Expand Up @@ -479,18 +481,19 @@ public function actionGetSavedBlocks()
$this->verifyNonce(self::nonce);

try {
$fields = $this->param('fields') ? $this->param('fields') : [];
$fields = $this->param('fields') ? $this->param('fields') : [];
$bockManager = new Brizy_Admin_Blocks_Manager(Brizy_Admin_Blocks_Main::CP_SAVED);
$blocks = $bockManager->getEntities([
'paged' => (int)($this->param('page') ?: 1),
$blocks = $bockManager->getEntities([
'paged' => (int)($this->param('page') ?: 1),
'posts_per_page' => (int)($this->param('count') ?: -1),
'order' => $this->param('order') ?: 'ASC',
'orderby' => $this->param('orderby') ?: 'ID'
]);
$blocks = apply_filters('brizy_get_saved_blocks',
]);$blocks = apply_filters(
'brizy_get_saved_blocks',
$bockManager->createResponseForEntities($blocks, $fields),
$fields,
$bockManager);
$bockManager
);
$this->success($blocks);
} catch (Exception $exception) {
$this->error(400, $exception->getMessage());
Expand Down Expand Up @@ -546,7 +549,7 @@ public function actionCreateSavedBlock()

try {
$bockManager = new Brizy_Admin_Blocks_Manager(Brizy_Admin_Blocks_Main::CP_SAVED);
$block = $bockManager->createEntity($this->param('uid'));
$block = $bockManager->createEntity($this->param('uid'));
$block->setMedia(stripslashes($this->param('media')));
$block->setMeta(stripslashes($this->param('meta')));

Expand Down
53 changes: 28 additions & 25 deletions admin/layouts/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ protected function getRequestNonce()

protected function initializeApiActions()
{
$pref = 'wp_ajax_' . Brizy_Editor::prefix();
add_action($pref . self::DOWNLOAD_LAYOUTS, array($this, 'actionDownloadLayouts'));
add_action($pref . self::GET_LAYOUT_BY_UID_ACTION, array($this, 'actionGetLayoutByUid'));
add_action($pref . self::GET_LAYOUTS_ACTION, array($this, 'actionGetLayouts'));
add_action($pref . self::CREATE_LAYOUT_ACTION, array($this, 'actionCreateLayout'));
add_action($pref . self::UPDATE_LAYOUT_ACTION, array($this, 'actionUpdateLayout'));
add_action($pref . self::DELETE_LAYOUT_ACTION, array($this, 'actionDeleteLayout'));
$pref = 'wp_ajax_'.Brizy_Editor::prefix();
add_action($pref.self::DOWNLOAD_LAYOUTS, array($this, 'actionDownloadLayouts'));
add_action($pref.self::GET_LAYOUT_BY_UID_ACTION, array($this, 'actionGetLayoutByUid'));
add_action($pref.self::GET_LAYOUTS_ACTION, array($this, 'actionGetLayouts'));
add_action($pref.self::CREATE_LAYOUT_ACTION, array($this, 'actionCreateLayout'));
add_action($pref.self::UPDATE_LAYOUT_ACTION, array($this, 'actionUpdateLayout'));
add_action($pref.self::DELETE_LAYOUT_ACTION, array($this, 'actionDeleteLayout'));
}

public function actionDownloadLayouts()
Expand Down Expand Up @@ -77,26 +77,26 @@ public function actionDownloadLayouts()

return null;
}, $explode);
$items = array_filter($items);
$items = array_filter($items);
if (count($items) == 0) {
$this->error(404, __('There are no layouts to be archived'));
}

$zipPath = "Layout-" . date(DATE_ATOM) . ".zip";
$zipPath = "Layout-".date(DATE_ATOM).".zip";
$fontManager = new Brizy_Admin_Fonts_Manager();
$zip = new Brizy_Editor_Zip_Archiver(
$zip = new Brizy_Editor_Zip_Archiver(
Brizy_Editor_Project::get(),
$fontManager,
BRIZY_SYNC_VERSION
);
$zipPath = $zip->createZip($items, $zipPath);
$zipPath = $zip->createZip($items, $zipPath);

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"" . basename($zipPath) . "\";");
header("Content-Disposition: attachment; filename=\"".basename($zipPath)."\";");
header("Content-Transfer-Encoding: binary");

echo file_get_contents($zipPath);
Expand Down Expand Up @@ -143,18 +143,19 @@ public function actionGetLayouts()
$layoutManager = new Brizy_Admin_Layouts_Manager();

$fields = $this->param('fields') ? $this->param('fields') : [];
$layouts = $layoutManager->getEntities(
[

$layouts = $layoutManager->getEntities([
'paged' => (int)($this->param('page') ?: 1),
'posts_per_page' => (int)($this->param('count') ?: -1),
'order' => $this->param('order') ?: 'ASC',
'orderby' => $this->param('orderby') ?: 'ID'
]
);
$layouts = apply_filters('brizy_get_layouts',
]);
$layouts = apply_filters(
'brizy_get_layouts',
$layoutManager->createResponseForEntities($layouts, $fields),
$fields,
$layoutManager);
$layoutManager
);
$this->success($layouts);

} catch (Exception $exception) {
Expand Down Expand Up @@ -192,16 +193,18 @@ public function actionCreateLayout()
$layout->set_editor_data($editorData);
$layout->set_needs_compile(true);

if ($this->param('title')) {
$layout->setTitle(stripslashes($this->param('title')));
}
if($this->param('title'))
{
$layout->setTitle(stripslashes($this->param('title')));
}

if ($this->param('tags')) {
$layout->setTags(stripslashes($this->param('tags')));
}
if($this->param('tags'))
{
$layout->setTags(stripslashes($this->param('tags')));
}


//$layout->setCloudUpdateRequired( true );
//$layout->setCloudUpdateRequired( true );
$layout->setDataVersion(1);
$layout->save();

Expand Down
1 change: 0 additions & 1 deletion admin/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ private function enable_brizy_for_post( $p ) {
wp_update_post( $p );
}
do_action( 'brizy_before_enabled_for_post', $p );

$post->enable_editor();
$post->set_template( Brizy_Config::BRIZY_BLANK_TEMPLATE_FILE_NAME );
$post->set_plugin_version( BRIZY_VERSION );
Expand Down
4 changes: 2 additions & 2 deletions admin/rules/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public function getGroupList() {

$groups = [];

if ( $templateType == 'single' || $templateType == 'single_product' || $context == 'popup-rules' || $context == 'global-block-rules' ) {
if ($templateType == 'single' || $templateType == 'single_product' || $context == 'popup-rules' || $context == 'global-block-rules' ) {
$groups[] = array(
'title' => 'Main Content',
'value' => Brizy_Admin_Rule::POSTS,
Expand All @@ -360,7 +360,7 @@ public function getGroupList() {
) : null;
}

if ( $templateType == 'archive' || $templateType == 'product_archive' || $context == 'popup-rules' || $context == 'global-block-rules' ) {
if ($templateType == 'archive' || $templateType == 'product_archive' || $context == 'popup-rules' || $context == 'global-block-rules' ) {

$archiveItems = array_map( $closure, $this->getArchivesList( Brizy_Admin_Rule::ARCHIVE, $templateType ) );
$taxonomyItems = array_map( $closure, $this->getTaxonomyList( Brizy_Admin_Rule::TAXONOMY, $templateType ) );
Expand Down
2 changes: 1 addition & 1 deletion admin/stories/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static public function registerCustomPosts()
'public' => true,
'description' => __bt( 'brizy', 'Brizy' ) . ' ' . __( 'stories', 'brizy' ) . '.',
'show_in_menu' => Brizy_Admin_Settings::menu_slug(),
'rewrite' => [ 'slug' => self::CP_STORY ],
'rewrite' => [ 'slug' => apply_filters('brizy_story_rewrite_slug',self::CP_STORY) ],
'capability_type' => 'page',
'exclude_from_search' => true,
'supports' => [ 'title', 'post_content', 'revisions' ],
Expand Down
6 changes: 3 additions & 3 deletions brizy.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Plugin URI: https://brizy.io/
* Author: Brizy.io
* Author URI: https://brizy.io/
* Version: 2.4.26
* Version: 2.4.27
* Text Domain: brizy
* License: GPLv3
* Domain Path: /languages
Expand All @@ -19,7 +19,7 @@

define('BRIZY_DEVELOPMENT', false );
define('BRIZY_LOG', false );
define('BRIZY_VERSION', '2.4.26');
define('BRIZY_VERSION', '2.4.27');
define('BRIZY_MINIMUM_PRO_VERSION', '2.4.15');
define('BRIZY_EDITOR_VERSION', BRIZY_DEVELOPMENT ? 'dev' : '264-wp' );
define('BRIZY_SYNC_VERSION', '264');
Expand Down Expand Up @@ -132,4 +132,4 @@ function brizy_load_text_domain()
load_plugin_textdomain('brizy', false, dirname(plugin_basename(__FILE__)) . '/languages');
}

new Brizy_Compatibilities_Init();
new Brizy_Compatibilities_Init();
2 changes: 1 addition & 1 deletion compatibilities/polylang.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Brizy_Compatibilities_Polylang {

public function __construct() {
add_action( 'brizy_post_loop_args', [ $this, 'post_loop_args' ] );
add_filter( 'brizy_post_loop_args', [ $this, 'post_loop_args' ] );
add_filter( 'pll_home_url_white_list', [ $this, 'home_url_white_list' ] );
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"knplabs/gaufrette": "0.7",
"bagrinsergiu/brizy-migration-utils": "^1.4",
"bagrinsergiu/brizy-merge-page-assets": "dev-master",
"bagrinsergiu/content-placeholder": "^2.0.8",
"bagrinsergiu/content-placeholder": "^2.0.9",
"enshrined/svg-sanitize": "^0.13",
"select2/select2": "^4.0",
"symfony/dotenv": "^3",
Expand Down
14 changes: 11 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions config.dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Brizy_Config {
const PLATFORM_EMAIL = "[email protected]";

const UPGRADE_TO_PRO_URL = "https://www.brizy.io/pricing/?utm_source=wp-menu&utm_campaign=gopro&utm_medium=wp-dash/";
const EDITOR_TEMPLEATES_URL = "https://e-t-cloud.b-cdn.net/1.0.0/";
const EDITOR_TEMPLEATES_URL = "https://e-t-cloud.b-cdn.net/1.3.0/";
const SUPPORT_URL = "https://support.brizy.io";
const ABOUT_URL = "https://brizy.io";
const TERMS_OF_SERVICE_URL = "https://www.brizy.io/terms-and-conditions";
Expand All @@ -47,7 +47,7 @@ class Brizy_Config {
const CLOUD_LAYOUTS = '/api/layouts';
const CLOUD_SCREENSHOT = '/screenshot/%s';
const CLOUD_SCREENSHOTS = '/api/screenshots';
const CLOUD_CUSTOM_FILES = '/api/custom_files';
const CLOUD_CUSTOM_FILES = '/api/custom_files';
const WP_HTTP_TIMEOUT = 600;

static public function getCompilerUrls() {
Expand Down
Loading