/**
  * Format the new link for AJAX response
  */
 private function formatLink()
 {
     $this->data['np_link_content'] = Helpers::check_url($this->data['np_link_content']);
 }
 /**
  * Save a new Redirect
  * @since 1.1
  * @param array data
  */
 public function saveRedirect($data)
 {
     $this->validation->validateRedirect($data);
     $new_link = array('post_title' => sanitize_text_field($data['np_link_title']), 'post_status' => sanitize_text_field($data['_status']), 'post_content' => Helpers::check_url($data['np_link_content']), 'post_parent' => sanitize_text_field($data['parent_id']), 'post_type' => 'np-redirect', 'post_excerpt' => '');
     $this->new_id = wp_insert_post($new_link);
     $this->updateNavStatus($data);
     $this->updateNestedPagesStatus($data);
     $this->updateLinkTarget($data);
     return $this->new_id;
 }
 /**
  * Sync Link Menu Item
  * @since 1.1.4
  */
 private function syncLinkItem($menu_parent, $menu_item_id)
 {
     $menu = wp_update_nav_menu_item($this->id, $menu_item_id, array('menu-item-title' => $this->post->title, 'menu-item-position' => $this->count, 'menu-item-url' => Helpers::check_url(get_the_content($this->post->id)), 'menu-item-attr-title' => $this->post->nav_title_attr, 'menu-item-status' => 'publish', 'menu-item-classes' => $this->post->nav_css, 'menu-item-type' => 'custom', 'menu-item-object' => 'np-redirect', 'menu-item-object-id' => $this->post->id, 'menu-item-parent-id' => $menu_parent, 'menu-item-xfn' => $this->post->id, 'menu-item-target' => $this->post->link_target));
     return $menu;
 }