From 1fe67980475225eae3b380636292a3ff72b7237e Mon Sep 17 00:00:00 2001 From: Alex Zaharia Date: Mon, 2 Jul 2018 09:59:52 +0300 Subject: [PATCH 1/5] Added wordpress menu tree in editor config Added api action to update the menu items --- editor/api.php | 36 ++++++++++++++++++ editor/editor/editor.php | 81 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) diff --git a/editor/api.php b/editor/api.php index 3cb41eddcc..e7f8b1121f 100755 --- a/editor/api.php +++ b/editor/api.php @@ -29,6 +29,8 @@ class Brizy_Editor_API { const AJAX_DELETE_FORM = 'brizy_delete_form'; const AJAX_FORM_INTEGRATION_STATUS = 'brizy_form_integration_status'; const AJAX_SUBMIT_FORM = 'brizy_submit_form'; + const AJAX_UPDATE_MENU_DATA = 'brizy_update_menu_data'; + const AJAX_UPDATE_MENU_ITEM_DATA = 'brizy_update_menu_item_data'; const AJAX_DOWNLOAD_MEDIA = 'brizy_download_media'; const AJAX_MEDIA_METAKEY = 'brizy_get_media_key'; @@ -108,6 +110,8 @@ private function initialize() { 'update_form_integration_status' ) ); add_action( 'wp_ajax_' . self::AJAX_DELETE_FORM, array( $this, 'delete_form' ) ); + add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_ITEM_DATA, array( $this, 'update_menu_item_data' ) ); + add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_DATA, array( $this, 'update_menu_data' ) ); add_action( 'wp_ajax_' . self::AJAX_SET_FEATURED_IMAGE, array( $this, 'set_featured_image' ) ); add_action( 'wp_ajax_' . self::AJAX_SET_FEATURED_IMAGE_FOCAL_POINT, array( $this, @@ -170,6 +174,38 @@ public function remove_featured_image() { } + public function update_menu_item_data() { + if ( ! isset( $_POST['menuItemId'] ) || get_post_type( $_POST['menuItemId'] ) != 'nav_menu_item' ) { + $this->error( 400, 'Unknown menu item' ); + } + + $json_decode = json_decode( stripslashes( $_POST['menuItemData'] ) ); + + if ( ! isset( $_POST['menuItemData'] ) || is_null( $json_decode ) ) { + $this->error( 400, 'Bad request' ); + } + + update_post_meta( (int) $_POST['menuItemId'], 'brizy_data', $json_decode ); + + $this->success( array() ); + } + + public function update_menu_data() { + if ( ! isset( $_POST['menuId'] )) { + $this->error( 400, 'Unknown menu' ); + } + + $json_decode = json_decode( stripslashes( $_POST['menuData'] ) ); + + if ( ! isset( $_POST['menuData'] ) || is_null( $json_decode ) ) { + $this->error( 400, 'Bad request' ); + } + + update_term_meta( (int) $_POST['menuId'], 'brizy_data', $json_decode ); + + $this->success( array() ); + } + public function default_form() { try { diff --git a/editor/editor/editor.php b/editor/editor/editor.php index e595ecbaa5..9f8c1cd651 100755 --- a/editor/editor/editor.php +++ b/editor/editor/editor.php @@ -166,6 +166,8 @@ public function config() { 'setFeaturedImage' => Brizy_Editor_API::AJAX_SET_FEATURED_IMAGE, 'setFeaturedImageFocalPoint' => Brizy_Editor_API::AJAX_SET_FEATURED_IMAGE_FOCAL_POINT, 'removeFeaturedImage' => Brizy_Editor_API::AJAX_REMOVE_FEATURED_IMAGE, + 'updateMenuData' => Brizy_Editor_API::AJAX_UPDATE_MENU_DATA, + 'updateMenuItemData' => Brizy_Editor_API::AJAX_UPDATE_MENU_ITEM_DATA, ), 'plugins' => array( 'dummy' => true, @@ -184,6 +186,7 @@ public function config() { 'submitUrl' => add_query_arg( 'action', 'brizy_submit_form', set_url_scheme( admin_url( 'admin-ajax.php' ) ) ) ) ), + 'menuData' => $this->get_menu_data() ); return self::$config = apply_filters( 'brizy_editor_config', $config ); @@ -396,4 +399,82 @@ function addQueryStringToUrl( $link, $query ) { } + private function get_menu_data() { + $menus = wp_get_nav_menus(); + $menu_data = array(); + + foreach ( $menus as $menu ) { + + $custom_menu_data = get_term_meta( $menu->term_id, 'brizy_data', true ); + + $amenu = array( + 'id' => $menu->term_id, + 'name' => $menu->name, + ); + + $amenu = (object) array_merge( $amenu, get_object_vars( is_object( $custom_menu_data ) ? $custom_menu_data : (object) array() ) ); + + $menu_items = wp_get_nav_menu_items( $menu->term_id ); + + $menu_items = $this->get_menu_tree( $menu_items ); + + if ( count( $menu_items ) > 0 ) { + $amenu->items = $menu_items; + } + + $menu_data[] = $amenu; + } + + return $menu_data; + } + + private function get_menu_tree( $items, $parent = 0 ) { + $result_items = array(); + + foreach ( $items as $item ) { + if ( $item->menu_item_parent != $parent ) { + continue; + } + + $megaMenuItems = $this->getMegaMenuItems(); + + $menu_data = get_post_meta( $item->ID, 'brizy_data', true ); + + $item_value = array( + 'id' => $item->ID, + 'title' => $item->title, + 'url' => $item->url, + 'megaMenuItems' => $megaMenuItems + ); + + $an_item = (object) array( + 'type' => 'MenuItem', + ); + + $an_item->value = (object) array_merge( $item_value, get_object_vars( is_object( $menu_data ) ? $menu_data : (object) array() ) ); + + $child_items = $this->get_menu_tree( $items, $item->ID ); + + if ( count( $child_items ) > 0 ) { + $an_item->value->items = $child_items; + } + + $result_items[] = $an_item; + } + + return $result_items; + } + + /** + * @return array + */ + private function getMegaMenuItems() { + + return [ + (object) ( array( + 'type' => "SectionMegaMenu", + 'value' => (object) array( 'items' => array() ) + ) ) + ]; + } } From afb5f9fbc9ae040144b54b0c478dd565a1bf74a9 Mon Sep 17 00:00:00 2001 From: Alex Zaharia Date: Thu, 16 Aug 2018 11:04:03 +0300 Subject: [PATCH 2/5] Change the menu feature to work with uids not db ids --- editor/api.php | 39 ++++++++++++++++++++++++++++++++++++--- editor/editor/editor.php | 25 ++++++++++++++++++++----- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/editor/api.php b/editor/api.php index e7f8b1121f..8210d6412a 100755 --- a/editor/api.php +++ b/editor/api.php @@ -29,6 +29,7 @@ class Brizy_Editor_API { const AJAX_DELETE_FORM = 'brizy_delete_form'; const AJAX_FORM_INTEGRATION_STATUS = 'brizy_form_integration_status'; const AJAX_SUBMIT_FORM = 'brizy_submit_form'; + const AJAX_UPDATE_MENU_DATA = 'brizy_update_menu_data'; const AJAX_UPDATE_MENU_ITEM_DATA = 'brizy_update_menu_item_data'; @@ -185,13 +186,25 @@ public function update_menu_item_data() { $this->error( 400, 'Bad request' ); } - update_post_meta( (int) $_POST['menuItemId'], 'brizy_data', $json_decode ); + $menuItems = get_posts( array( + 'meta_key' => 'brizy_post_uid', + 'meta_value' => $_POST['menuItemId'], + 'post_type' => 'nav_menu_item', + ) ); + + if ( count( $menuItems ) == 0 ) { + $this->error( 400, 'Unknown menu item' );; + } + + $menu = $menuItems[0]; + + update_post_meta( (int) $menu->ID, 'brizy_data', $json_decode ); $this->success( array() ); } public function update_menu_data() { - if ( ! isset( $_POST['menuId'] )) { + if ( ! isset( $_POST['menuId'] ) ) { $this->error( 400, 'Unknown menu' ); } @@ -201,7 +214,27 @@ public function update_menu_data() { $this->error( 400, 'Bad request' ); } - update_term_meta( (int) $_POST['menuId'], 'brizy_data', $json_decode ); + + $menu = get_terms( array( + 'taxonomy' => 'nav_menu', + 'hide_empty' => false, + 'meta_query' => array( + 'relation' => 'AND', + array( + 'key' => 'brizy_uid', + 'value' => $_POST['menuId'], + 'compare' => '=' + ) + ) + ) ); + + + if ( isset( $menu[0] ) ) { + $menu = $menu[0]; + } else { + $this->error( 400, 'Unknown menu item' ); + } + update_term_meta( (int) $menu->term_id, 'brizy_data', $json_decode ); $this->success( array() ); } diff --git a/editor/editor/editor.php b/editor/editor/editor.php index 9f8c1cd651..de061aadfa 100755 --- a/editor/editor/editor.php +++ b/editor/editor/editor.php @@ -407,9 +407,16 @@ private function get_menu_data() { $custom_menu_data = get_term_meta( $menu->term_id, 'brizy_data', true ); + $menu_uid = get_term_meta( $menu->term_id, 'brizy_uid', true ); + if ( ! $menu_uid ) { + $menu_uid = md5( $menu->term_id . time() ); + update_term_meta( $menu->term_id, 'brizy_uid', $menu_uid ); + } + $amenu = array( - 'id' => $menu->term_id, - 'name' => $menu->name, + 'id' => $menu_uid, + 'name' => $menu->name, + 'items' => array() ); $amenu = (object) array_merge( $amenu, get_object_vars( is_object( $custom_menu_data ) ? $custom_menu_data : (object) array() ) ); @@ -436,12 +443,18 @@ private function get_menu_tree( $items, $parent = 0 ) { continue; } + $menu_uid = get_post_meta( $item->ID, 'brizy_post_uid', true ); + if ( ! $menu_uid ) { + $menu_uid = md5( $item->ID . time() ); + update_post_meta( $item->ID, 'brizy_post_uid', $menu_uid ); + } + $megaMenuItems = $this->getMegaMenuItems(); $menu_data = get_post_meta( $item->ID, 'brizy_data', true ); $item_value = array( - 'id' => $item->ID, + 'id' => $menu_uid, 'title' => $item->title, 'url' => $item->url, 'megaMenuItems' => $megaMenuItems @@ -455,6 +468,8 @@ private function get_menu_tree( $items, $parent = 0 ) { $child_items = $this->get_menu_tree( $items, $item->ID ); + $an_item->value->items = array(); + if ( count( $child_items ) > 0 ) { $an_item->value->items = $child_items; } @@ -470,11 +485,11 @@ private function get_menu_tree( $items, $parent = 0 ) { */ private function getMegaMenuItems() { - return [ + return array( (object) ( array( 'type' => "SectionMegaMenu", 'value' => (object) array( 'items' => array() ) ) ) - ]; + ); } } From 064a22d41a8d2a3dad261292128c557682c6a013 Mon Sep 17 00:00:00 2001 From: Alex Zaharia Date: Fri, 17 Aug 2018 10:11:00 +0300 Subject: [PATCH 3/5] Remove api methods for menu --- editor/api.php | 74 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/editor/api.php b/editor/api.php index 8210d6412a..d44d24fac8 100755 --- a/editor/api.php +++ b/editor/api.php @@ -30,8 +30,8 @@ class Brizy_Editor_API { const AJAX_FORM_INTEGRATION_STATUS = 'brizy_form_integration_status'; const AJAX_SUBMIT_FORM = 'brizy_submit_form'; - const AJAX_UPDATE_MENU_DATA = 'brizy_update_menu_data'; - const AJAX_UPDATE_MENU_ITEM_DATA = 'brizy_update_menu_item_data'; +// const AJAX_UPDATE_MENU_DATA = 'brizy_update_menu_data'; +// const AJAX_UPDATE_MENU_ITEM_DATA = 'brizy_update_menu_item_data'; const AJAX_DOWNLOAD_MEDIA = 'brizy_download_media'; const AJAX_MEDIA_METAKEY = 'brizy_get_media_key'; @@ -111,8 +111,9 @@ private function initialize() { 'update_form_integration_status' ) ); add_action( 'wp_ajax_' . self::AJAX_DELETE_FORM, array( $this, 'delete_form' ) ); - add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_ITEM_DATA, array( $this, 'update_menu_item_data' ) ); - add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_DATA, array( $this, 'update_menu_data' ) ); + + //add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_ITEM_DATA, array( $this, 'update_menu_item_data' ) ); + //add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_DATA, array( $this, 'update_menu_data' ) ); add_action( 'wp_ajax_' . self::AJAX_SET_FEATURED_IMAGE, array( $this, 'set_featured_image' ) ); add_action( 'wp_ajax_' . self::AJAX_SET_FEATURED_IMAGE_FOCAL_POINT, array( $this, @@ -126,6 +127,71 @@ private function initialize() { add_action( 'wp_ajax_nopriv_' . self::AJAX_SUBMIT_FORM, array( $this, 'submit_form' ) ); } +// public function update_menu_item_data() { +// if ( ! isset( $_POST['menuItemId'] ) || get_post_type( $_POST['menuItemId'] ) != 'nav_menu_item' ) { +// $this->error( 400, 'Unknown menu item' ); +// } +// +// $json_decode = json_decode( stripslashes( $_POST['menuItemData'] ) ); +// +// if ( ! isset( $_POST['menuItemData'] ) || is_null( $json_decode ) ) { +// $this->error( 400, 'Bad request' ); +// } +// +// $menuItems = get_posts( array( +// 'meta_key' => 'brizy_post_uid', +// 'meta_value' => $_POST['menuItemId'], +// 'post_type' => 'nav_menu_item', +// ) ); +// +// if ( count( $menuItems ) == 0 ) { +// $this->error( 400, 'Unknown menu item' );; +// } +// +// $menu = $menuItems[0]; +// +// update_post_meta( (int) $menu->ID, 'brizy_data', $json_decode ); +// +// $this->success( array() ); +// } +// +// public function update_menu_data() { +// if ( ! isset( $_POST['menuId'] ) ) { +// $this->error( 400, 'Unknown menu' ); +// } +// +// $json_decode = json_decode( stripslashes( $_POST['menuData'] ) ); +// +// if ( ! isset( $_POST['menuData'] ) || is_null( $json_decode ) ) { +// $this->error( 400, 'Bad request' ); +// } +// +// +// $menu = get_terms( array( +// 'taxonomy' => 'nav_menu', +// 'hide_empty' => false, +// 'meta_query' => array( +// 'relation' => 'AND', +// array( +// 'key' => 'brizy_uid', +// 'value' => $_POST['menuId'], +// 'compare' => '=' +// ) +// ) +// ) ); +// +// +// if ( isset( $menu[0] ) ) { +// $menu = $menu[0]; +// } else { +// $this->error( 400, 'Unknown menu item' ); +// } +// update_term_meta( (int) $menu->term_id, 'brizy_data', $json_decode ); +// +// $this->success( array() ); +// } + + public function set_featured_image() { $this->authorize(); From 694061168b6db7313f69fbfa6c44aead38e6843c Mon Sep 17 00:00:00 2001 From: Alex Zaharia Date: Fri, 17 Aug 2018 12:14:20 +0300 Subject: [PATCH 4/5] Remove menu api methods from config.. --- editor/editor/editor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor/editor/editor.php b/editor/editor/editor.php index de061aadfa..c9713afead 100755 --- a/editor/editor/editor.php +++ b/editor/editor/editor.php @@ -166,8 +166,8 @@ public function config() { 'setFeaturedImage' => Brizy_Editor_API::AJAX_SET_FEATURED_IMAGE, 'setFeaturedImageFocalPoint' => Brizy_Editor_API::AJAX_SET_FEATURED_IMAGE_FOCAL_POINT, 'removeFeaturedImage' => Brizy_Editor_API::AJAX_REMOVE_FEATURED_IMAGE, - 'updateMenuData' => Brizy_Editor_API::AJAX_UPDATE_MENU_DATA, - 'updateMenuItemData' => Brizy_Editor_API::AJAX_UPDATE_MENU_ITEM_DATA, + //'updateMenuData' => Brizy_Editor_API::AJAX_UPDATE_MENU_DATA, + //'updateMenuItemData' => Brizy_Editor_API::AJAX_UPDATE_MENU_ITEM_DATA, ), 'plugins' => array( 'dummy' => true, From 0a40631bdc410b1c94e88cc385af33639c188c17 Mon Sep 17 00:00:00 2001 From: Alex Zaharia Date: Thu, 20 Sep 2018 17:45:19 +0300 Subject: [PATCH 5/5] Enabled menu api --- editor/api.php | 175 +++++++++++++-------------------------- editor/editor/editor.php | 4 +- 2 files changed, 59 insertions(+), 120 deletions(-) diff --git a/editor/api.php b/editor/api.php index d44d24fac8..72386014bf 100755 --- a/editor/api.php +++ b/editor/api.php @@ -30,8 +30,8 @@ class Brizy_Editor_API { const AJAX_FORM_INTEGRATION_STATUS = 'brizy_form_integration_status'; const AJAX_SUBMIT_FORM = 'brizy_submit_form'; -// const AJAX_UPDATE_MENU_DATA = 'brizy_update_menu_data'; -// const AJAX_UPDATE_MENU_ITEM_DATA = 'brizy_update_menu_item_data'; + const AJAX_UPDATE_MENU_DATA = 'brizy_update_menu_data'; + const AJAX_UPDATE_MENU_ITEM_DATA = 'brizy_update_menu_item_data'; const AJAX_DOWNLOAD_MEDIA = 'brizy_download_media'; const AJAX_MEDIA_METAKEY = 'brizy_get_media_key'; @@ -112,8 +112,8 @@ private function initialize() { ) ); add_action( 'wp_ajax_' . self::AJAX_DELETE_FORM, array( $this, 'delete_form' ) ); - //add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_ITEM_DATA, array( $this, 'update_menu_item_data' ) ); - //add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_DATA, array( $this, 'update_menu_data' ) ); + add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_ITEM_DATA, array( $this, 'update_menu_item_data' ) ); + add_action( 'wp_ajax_' . self::AJAX_UPDATE_MENU_DATA, array( $this, 'update_menu_data' ) ); add_action( 'wp_ajax_' . self::AJAX_SET_FEATURED_IMAGE, array( $this, 'set_featured_image' ) ); add_action( 'wp_ajax_' . self::AJAX_SET_FEATURED_IMAGE_FOCAL_POINT, array( $this, @@ -127,120 +127,6 @@ private function initialize() { add_action( 'wp_ajax_nopriv_' . self::AJAX_SUBMIT_FORM, array( $this, 'submit_form' ) ); } -// public function update_menu_item_data() { -// if ( ! isset( $_POST['menuItemId'] ) || get_post_type( $_POST['menuItemId'] ) != 'nav_menu_item' ) { -// $this->error( 400, 'Unknown menu item' ); -// } -// -// $json_decode = json_decode( stripslashes( $_POST['menuItemData'] ) ); -// -// if ( ! isset( $_POST['menuItemData'] ) || is_null( $json_decode ) ) { -// $this->error( 400, 'Bad request' ); -// } -// -// $menuItems = get_posts( array( -// 'meta_key' => 'brizy_post_uid', -// 'meta_value' => $_POST['menuItemId'], -// 'post_type' => 'nav_menu_item', -// ) ); -// -// if ( count( $menuItems ) == 0 ) { -// $this->error( 400, 'Unknown menu item' );; -// } -// -// $menu = $menuItems[0]; -// -// update_post_meta( (int) $menu->ID, 'brizy_data', $json_decode ); -// -// $this->success( array() ); -// } -// -// public function update_menu_data() { -// if ( ! isset( $_POST['menuId'] ) ) { -// $this->error( 400, 'Unknown menu' ); -// } -// -// $json_decode = json_decode( stripslashes( $_POST['menuData'] ) ); -// -// if ( ! isset( $_POST['menuData'] ) || is_null( $json_decode ) ) { -// $this->error( 400, 'Bad request' ); -// } -// -// -// $menu = get_terms( array( -// 'taxonomy' => 'nav_menu', -// 'hide_empty' => false, -// 'meta_query' => array( -// 'relation' => 'AND', -// array( -// 'key' => 'brizy_uid', -// 'value' => $_POST['menuId'], -// 'compare' => '=' -// ) -// ) -// ) ); -// -// -// if ( isset( $menu[0] ) ) { -// $menu = $menu[0]; -// } else { -// $this->error( 400, 'Unknown menu item' ); -// } -// update_term_meta( (int) $menu->term_id, 'brizy_data', $json_decode ); -// -// $this->success( array() ); -// } - - - public function set_featured_image() { - $this->authorize(); - - if ( ! isset( $_REQUEST['attachmentId'] ) ) { - $this->error( 400, 'Bad request' ); - } - - if ( $this->post && $this->post->uses_editor() ) { - set_post_thumbnail( $this->post->get_id(), (int) $_REQUEST['attachmentId'] ); - - $uid = $this->createMediaKey( $this->post->get_id(), (int) $_REQUEST['attachmentId'] ); - - $this->success( array( 'uid' => $uid ) ); - } - - $this->error( 400, 'Invalid post' ); - } - - public function set_featured_image_focal_point() { - if ( ! isset( $_REQUEST['attachmentId'] ) || ! isset( $_REQUEST['pointX'] ) || ! isset( $_REQUEST['pointY'] ) ) { - $this->error( 400, 'Bad request' ); - } - - if ( $this->post && $this->post->uses_editor() ) { - - update_post_meta( $this->post->get_id(), 'brizy_attachment_focal_point', array( - 'x' => $_REQUEST['pointX'], - 'y' => $_REQUEST['pointY'] - ) ); - - $this->success( array() ); - } - - $this->error( 400, 'Invalid post' ); - } - - public function remove_featured_image() { - $this->authorize(); - - if ( $this->post && $this->post->uses_editor() ) { - delete_post_thumbnail( $this->post->get_id() ); - delete_post_meta( $this->post->get_id(), 'brizy_attachment_focal_point' ); - $this->success( null ); - } - - $this->error( 400, 'Invalid post' ); - } - - public function update_menu_item_data() { if ( ! isset( $_POST['menuItemId'] ) || get_post_type( $_POST['menuItemId'] ) != 'nav_menu_item' ) { $this->error( 400, 'Unknown menu item' ); @@ -305,6 +191,59 @@ public function update_menu_data() { $this->success( array() ); } + + + + public function set_featured_image() { + $this->authorize(); + + if ( ! isset( $_REQUEST['attachmentId'] ) ) { + $this->error( 400, 'Bad request' ); + } + + if ( $this->post && $this->post->uses_editor() ) { + set_post_thumbnail( $this->post->get_id(), (int) $_REQUEST['attachmentId'] ); + + $uid = $this->createMediaKey( $this->post->get_id(), (int) $_REQUEST['attachmentId'] ); + + $this->success( array( 'uid' => $uid ) ); + } + + $this->error( 400, 'Invalid post' ); + } + + public function set_featured_image_focal_point() { + if ( ! isset( $_REQUEST['attachmentId'] ) || ! isset( $_REQUEST['pointX'] ) || ! isset( $_REQUEST['pointY'] ) ) { + $this->error( 400, 'Bad request' ); + } + + if ( $this->post && $this->post->uses_editor() ) { + + update_post_meta( $this->post->get_id(), 'brizy_attachment_focal_point', array( + 'x' => $_REQUEST['pointX'], + 'y' => $_REQUEST['pointY'] + ) ); + + $this->success( array() ); + } + + $this->error( 400, 'Invalid post' ); + } + + public function remove_featured_image() { + $this->authorize(); + + if ( $this->post && $this->post->uses_editor() ) { + delete_post_thumbnail( $this->post->get_id() ); + delete_post_meta( $this->post->get_id(), 'brizy_attachment_focal_point' ); + $this->success( null ); + } + + $this->error( 400, 'Invalid post' ); + } + + + public function default_form() { try { diff --git a/editor/editor/editor.php b/editor/editor/editor.php index c9713afead..de061aadfa 100755 --- a/editor/editor/editor.php +++ b/editor/editor/editor.php @@ -166,8 +166,8 @@ public function config() { 'setFeaturedImage' => Brizy_Editor_API::AJAX_SET_FEATURED_IMAGE, 'setFeaturedImageFocalPoint' => Brizy_Editor_API::AJAX_SET_FEATURED_IMAGE_FOCAL_POINT, 'removeFeaturedImage' => Brizy_Editor_API::AJAX_REMOVE_FEATURED_IMAGE, - //'updateMenuData' => Brizy_Editor_API::AJAX_UPDATE_MENU_DATA, - //'updateMenuItemData' => Brizy_Editor_API::AJAX_UPDATE_MENU_ITEM_DATA, + 'updateMenuData' => Brizy_Editor_API::AJAX_UPDATE_MENU_DATA, + 'updateMenuItemData' => Brizy_Editor_API::AJAX_UPDATE_MENU_ITEM_DATA, ), 'plugins' => array( 'dummy' => true,