Beispiel #1
0
 /**
  * TODO : see how to make a multiple update in ONE query when updating more than one node.
  * For now, we do one update query for each node.
  * We should just update the object property here and save all at once at the end...
  */
 public function update_property($property, $value)
 {
     if ($this->type == 'page') {
         switch ($property) {
             case 'node_title':
                 wp_update_post(array('ID' => $this->wp_id, 'post_title' => $value));
                 $this->title = $value;
                 break;
             case 'node_template':
                 $page_template = $value;
                 self::set_page_template($this->wp_id, $page_template);
                 wp_update_post(array('ID' => $this->wp_id));
                 //So that date_modified changes!
                 $this->template = $page_template;
                 break;
             case 'node_marked':
                 if (ApmAddons::addon_is_on('flagged_pages')) {
                     ApmMarkedNodes::mark_user_nodes($this->apm_id, $value);
                     $this->set_marked($value);
                 }
                 break;
         }
     }
 }