function wpbook_store_post_options($post_id, $post = false) { if (!$post || $post->post_type == 'revision') { // store the metadata with the post, not the revision return; } $wpbookAdminOptions = wpbook_getAdminOptions(); $post = get_post($post_id); $stored_meta = get_post_meta($post_id, 'wpbook_fb_publish', true); $posted_meta = $_POST['wpbook_fb_publish']; $wpbook_message = $_POST['wpbook_message']; $save = false; /* if there is $posted_meta, that takes priority over stored */ if (!empty($posted_meta)) { $posted_meta == 'yes' ? $meta = 'yes' : ($meta = 'no'); $save = true; } else { if (empty($stored_meta)) { /* if no stored meta, but streaming publishing is on, default to yes */ if ($wpbookAdminOptions['stream_publish'] || $wpbookAdminOptions['stream_publish_pages']) { $meta = 'yes'; } else { $meta = 'no'; } $save = true; /* if there is stored meta, and user didn't touch it, don't save */ } else { $save = false; } } if ($save) { update_post_meta($post_id, 'wpbook_fb_publish', $meta); } // checking to see if the meta message variable exists before setting it if (isset($wpbook_message) && $wpbook_message != '') { update_post_meta($post_id, 'wpbook_message', $wpbook_message); } if (isset($wpbook_message) && $wpbook_message == '') { delete_post_meta($post_id, 'wpbook_message'); } }
function fb_filter_pagelink($pagelink) { if(check_facebook()) { $my_offset = strlen(get_option('home')); $my_options = wpbook_getAdminOptions(); $app_url = $my_options['fb_app_url']; $my_link = 'http://apps.facebook.com/' . $app_url . substr($pagelink,$my_offset); return $my_link; } else { return $pagelink; } }