コード例 #1
0
 /**
  * Save page builder data
  */
 function saveData($post_id)
 {
     // First we need to check if the current user is authorised to do this action.
     /*
     if ('page' == $_POST['post_type']) {
         if (!current_user_can('edit_page', $post_id))
             return;
     } else {
         if (!current_user_can('edit_post', $post_id))
             return;
     }
     */
     // Secondly we need to check if the user intended to change this value.
     if (!isset($_POST['stPageBuilder_nonce']) || !wp_verify_nonce($_POST['stPageBuilder_nonce'], st_create_nonce()) && !wp_verify_nonce($_POST['stPageBuilder_nonce'], plugin_basename(__FILE__))) {
         return;
     }
     ST_Page_Builder::save_page_options($post_id, $_POST[ST_Page_Builder::PAGE_OPTIONS_NAME]);
     update_post_meta($post_id, '_st_current_editor', $_POST['_st_current_editor']);
     // make sure page builder load completed
     if ($_POST['_st_page_builder_loaded'] == 1) {
         ST_Page_Builder::save_builder_settings($post_id, $_POST[ST_Page_Builder::BUILDER_SETTINGS_NAME]);
     }
 }