예제 #1
0
 /**
  * Save post hook.
  * 
  * @param type $post_id 
  */
 public static function wpcf_access_post_save($post_id)
 {
     $areas = Access_Helper::wpcf_access_get_areas();
     foreach ($areas as $area) {
         $groups = array();
         $groups = apply_filters('types-access-show-ui-group', $groups, $area['id']);
         foreach ($groups as $group) {
             $caps = array();
             $caps = apply_filters('types-access-cap', $caps, $area['id'], $group['id']);
             foreach ($caps as $cap) {
                 do_action('types-access-process-ui-result', $area['id'], $group['id'], $cap['cap_id']);
             }
         }
     }
     $model = TAccess_Loader::get('MODEL/Access');
     if (isset($_POST['types_access']) && !empty($_POST['types_access'])) {
         $model->updateAccessMeta($post_id, sanitize_text_field($_POST['types_access']));
     } else {
         $model->deleteAccessMeta($post_id);
     }
 }