From 5cbe87752e6abc92e71a119dc8f9e9c88551a3df Mon Sep 17 00:00:00 2001 From: Alex Zaharia Date: Fri, 17 Aug 2018 10:11:00 +0300 Subject: [PATCH] Remove api methods for menu --- editor/api.php | 135 +++++++++++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/editor/api.php b/editor/api.php index 147dd7152f..1ed8f6bc9d 100755 --- a/editor/api.php +++ b/editor/api.php @@ -29,8 +29,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'; @@ -105,8 +105,9 @@ private function initialize() { 'update_form_integrations_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' ) ); } @@ -114,69 +115,69 @@ 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 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 default_form() {