Esempio n. 1
0
 /**
  * Loads all the data needed for a single post to be edited.
  * @return null
  */
 public function get_postlayout()
 {
     $post_type = isset($_POST['post_type']) ? $_POST['post_type'] : false;
     $type = isset($_POST['type']) ? $_POST['type'] : false;
     $id = isset($_POST['id']) ? $_POST['id'] : false;
     $post_id = isset($_POST['post_id']) ? $_POST['post_id'] : false;
     $properties = isset($_POST['properties']) ? $_POST['properties'] : false;
     if (!$post_type || !$type || !$id || !$post_id) {
         $this->_out(new Upfront_JsonResponse_Error('No post_type, type or id sent.'));
     }
     if (!empty($post_id)) {
         $post_type = get_post_type($post_id);
     }
     $layout_data = Upfront_ThisPostView::find_postlayout($type, $post_type, $id);
     $layout_data['partTemplates'] = stripslashes_deep(Upfront_ThisPostView::find_partTemplates($type, $post_type, $id));
     $layout_data['partContents'] = $this->generate_part_contents($post_id, $layout_data['partOptions'], $layout_data['partTemplates'], false, $properties);
     $this->_out(new Upfront_JsonResponse_Success($layout_data));
 }