Ejemplo n.º 1
0
 static function save_metaData($term_id, $ttId)
 {
     /* Verify the nonce before proceeding. */
     if (!isset($_POST['wpXSG_meta_nonce']) || !wp_verify_nonce($_POST['wpXSG_meta_nonce'], basename(__FILE__))) {
         return;
     }
     /* Check if the current user has permission to edit the post. */
     if (!current_user_can('manage_categories')) {
         return $term_id;
     }
     $settings = new metaSettings();
     $settings->id = isset($_POST['wpXSG-metaId']) ? $_POST['wpXSG-metaId'] : '0';
     $settings->itemId = $term_id;
     $settings->itemType = "taxonomy";
     $settings->exclude = isset($_POST['wpXSG-Exclude']) ? $_POST['wpXSG-Exclude'] : '0';
     $settings->priority = isset($_POST['wpXSG-Priority']) ? $_POST['wpXSG-Priority'] : 'default';
     $settings->frequency = isset($_POST['wpXSG-Frequency']) ? $_POST['wpXSG-Frequency'] : 'default';
     $settings->inherit = isset($_POST['wpXSG-Inherit']) ? $_POST['wpXSG-Inherit'] : 0;
     dataAccess::saveMetaItem($settings);
 }
Ejemplo n.º 2
0
 static function handlePostBack($post_id, $post)
 {
     /* Verify the nonce before proceeding. */
     if (!isset($_POST['wpXSG_meta_nonce']) || !wp_verify_nonce($_POST['wpXSG_meta_nonce'], basename(__FILE__))) {
         return;
     }
     /* Get the post type object. */
     $post_type = get_post_type_object($post->post_type);
     /* Check if the current user has permission to edit the post. */
     if (!current_user_can($post_type->cap->edit_post, $post_id)) {
         return $post_id;
     }
     if ($parent_id = wp_is_post_revision($post_id)) {
         $post_id = $parent_id;
     }
     $settings = new metaSettings();
     $settings->itemId = $post_id;
     $settings->itemType = "post";
     $settings->exclude = isset($_POST['wpXSG-Exclude']) ? $_POST['wpXSG-Exclude'] : '0';
     $settings->priority = isset($_POST['wpXSG-Priority']) ? $_POST['wpXSG-Priority'] : 'default';
     $settings->frequency = isset($_POST['wpXSG-Frequency']) ? $_POST['wpXSG-Frequency'] : 'default';
     dataAccess::saveMetaItem($settings);
 }