/** * display widget */ function widget($args, $instance) { extract($args, EXTR_SKIP); global $wpdb, $user_ID, $table_prefix, $blog_id; $userid = $instance['snorl']; $wordbooker_settings = wordbooker_options(); echo $before_widget; if (strlen($instance['dname']) > 0) { $name = $instance['dname']; } $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $before_title . $title . $after_title; } $wplang = "en_US"; if (strlen(WPLANG) > 2) { $wplang = WPLANG; } echo "<p>"; $height = $instance['height']; $width = $instance['width']; $connections = $instance['connections']; $border_colour = $instance['border_colour']; $scheme = $instance['scheme']; $stream = "false"; $header = "false"; $faces = "false"; if ($instance['stream'] == 'on') { $height = $height + 300; $stream = "true"; } if ($instance['header'] == 'on') { $height = $height + 18; $header = "true"; } if ($instance['faces'] == 'on') { $faces = "true"; $height = $height + 40; } $fanpages = unserialize(stripslashes($instance['fanpages'])); $url = $fanpages[$instance['pid']]; if (!isset($wordbooker_settings['wordbooker_like_button_show']) && !isset($wordbooker_settings['wordbooker_like_share_too']) || isset($wordbooker_settings['wordbooker_iframe'])) { echo '<iframe src="http://www.facebook.com/plugins/likebox.php?href=' . urlencode($url) . '&width=' . $width . '&colorscheme=' . $scheme . '&show_faces=' . $faces . '&border_color=%23' . $border_colour . '&stream=' . $stream . '&header=' . $header . '&height=' . $height . '" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' . $width . 'px; height:' . $height . 'px;" allowTransparency="true"></iframe>'; } else { echo '<fb:like-box href="' . $url . '" width="' . $width . '" height="' . $height . '" colorscheme="' . $scheme . '" show_faces="' . $faces . '" border_color="#' . $border_colour . '" stream="' . $stream . '" header="' . $header . '"></fb:like-box>'; } # echo '<br /><div class="fb-add-to-timeline" data-show-faces="true" data-mode="button"></div>'; echo $after_widget; }
function wordbooker_option_manager() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id, $wordbooker_hook; echo '<div class="wrap">'; echo '<h2>' . WORDBOOKER_APPLICATION_NAME . " " . __('Options Page', 'wordbooker') . ' </h2>'; if (isset($_POST["reset_user_config"])) { wordbooker_delete_userdata(); } $wordbooker_settings = wordbooker_options(); if (isset($wordbooker_settings['wordbooker_disabled'])) { echo "<div align='center'><b> " . __('WARNING : Wordbooker is DISABLED', 'wordbooker') . "</b></div>"; } else { if (isset($wordbooker_settings['wordbooker_fake_publish'])) { echo "<div align='center'><b> " . __('WARNING : Wordbooker is in TEST mode - NO Posts will be made to Facebook', 'wordbooker') . "</b></div>"; } } if ($wordbooker_settings['wordbooker_comment_cron'] != wp_get_schedule('wb_comment_job')) { $dummy = wp_clear_scheduled_hook('wb_comment_job'); $sql = "Delete from " . WORDBOOKER_POSTCOMMENTS . " where in_out='stat'"; $wpdb->query($sql); if ($wordbooker_settings['wordbooker_comment_cron'] == 'Never' || $wordbooker_settings['wordbooker_comment_cron'] == 'Manual') { } else { $dummy = wp_schedule_event(time(), $wordbooker_settings['wordbooker_comment_cron'], 'wb_comment_job'); } } //Set some defaults: # If the closedboxes are not set then lets set them up - General Options open, all the rest closed $wordbooker_settings = wordbooker_options(); $wb_boxes = get_usermeta($user_ID, 'closedpostboxes_settings_page_wordbooker'); if (count($wb_boxes) == 0) { $wb_boxes[0] = 'wb_opt2'; $wb_boxes[1] = 'wb_opt3'; $wb_boxes[2] = 'wb_opt4'; update_user_meta($user_ID, 'closedpostboxes_settings_page_wordbooker', $wb_boxes); } if (!wbs_retrieve_hash()) { $temp_hash = wbs_generate_hash(); wbs_store_hash($temp_hash); } #var_dump($wordbooker_settings); // If no default author set, lets set it if (!isset($wordbooker_settings["wordbooker_default_author"])) { $wordbooker_settings["wordbooker_default_author"] = 0; } // If no attribute set, then set it. if (!isset($wordbooker_settings["wordbooker_attribute"])) { $wordbooker_settings["wordbooker_attribute"] = __("Posted a new post on their blog", 'wordbooker'); } // If no Status line text, then set it if (!isset($wordbooker_settings["wordbooker_status_update_text"])) { $wordbooker_settings["wordbooker_status_update_text"] = __(": New blog post : %title% - %link%", 'wordbooker'); } // No Share link set, then set it if (!isset($wordbooker_settings["wordbooker_actionlink"])) { $wordbooker_settings["wordbooker_actionlink"] = 300; } // No extract length if (!isset($wordbooker_settings['wordbooker_extract_length'])) { $wordbooker_settings['wordbooker_extract_length'] = 256; } if (!isset($wordbooker_settings['wordbooker_page_post'])) { $wordbooker_settings['wordbooker_page_post'] = -100; } if (!isset($wordbooker_settings['wordbooker_advanced_diagnostics_level'])) { $wordbooker_settings['wordbooker_advanced_diagnostics_level'] = 99; } // Generate meta Description if (!isset($wordbooker_settings['wordbooker_description_meta_length'])) { $wordbooker_settings['wordbooker_description_meta_length'] = '350'; } if (!isset($wordbooker_settings['wordbooker_meta_tag_scan'])) { $wordbooker_settings['wordbooker_meta_tag_scan'] = "image,thumb,Thumbnail"; } // Now lets write those setting back.; wordbooker_set_options($wordbooker_settings); $wordbooker_user_settings_id = "wordbookuser" . $blog_id; echo '<div class="wrap">'; if (isset($_POST['user_meta'])) { // Now we check the hash, to make sure we are not getting CSRF if (wbs_is_hash_valid($_POST['token'])) { foreach (array_keys($_POST) as $key) { if (substr($key, 0, 8) == 'wordbook') { $wordbookeruser_settings[$key] = $_POST[$key]; } } $encoded_setings = $wordbookeruser_settings; #$wordbooker_user_settings_id="wordbookuser".$blog_id; update_usermeta($user_ID, $wordbooker_user_settings_id, $encoded_setings); if (isset($_POST['rwbus'])) { delete_usermeta($user_ID, $wordbooker_user_settings_id); $ol_flash = __("Your user level settings have been reset.", 'wordbooker'); } else { $ol_flash = __("Your user level settings have been saved.", 'wordbooker'); } } else { // Invalid form hash, possible CSRF attempt $ol_flash = __("Security hash missing.", 'wordbooker'); } // endif wbs_is_hash_valid } // end if user_meta check. if ($ol_flash != '') { echo '<div id="message" class="updated fade"><p>' . $ol_flash . '</p></div>'; } wordbooker_option_notices(); $sql = "select user_ID from " . WORDBOOKER_USERDATA . " where user_ID=" . $user_ID; $result = $wpdb->get_results($sql); # We need to put a check in here to stop this crapping out if there is no user id - so flag no row returned $got_id = 0; if (isset($result[0]->user_ID)) { $wbuser = wordbooker_get_userdata($result[0]->user_ID); if ($wbuser->access_token) { $got_id = 1; } } if ($got_id == 1) { wordbooker_update_userdata($wbuser); $checked_flag = array('on' => 'checked', 'off' => ''); # Populate the cache table for this user if its not there. $result = $wpdb->get_row("select facebook_id from " . WORDBOOKER_USERDATA . " where user_id=" . $user_ID); if (strlen($result->facebook_id) < 4) { wordbooker_cache_refresh($user_ID, $fbclient); } # If the user saved their config after setting permissions or chose to refresh the cache then lets refresh the cache if (isset($_POST["perm_save"])) { wordbooker_cache_refresh($user_ID, $fbclient); } function wordbooker_blog_level_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id, $wordbooker_hook; add_meta_box('wb_opt1', __('General Posting Options', 'wordbooker'), 'wordbooker_blog_posting_options', $wordbooker_hook, 'normal', 'core'); add_meta_box('wb_opt2', __('Facebook Like and Share Options', 'wordbooker'), 'wordbooker_blog_facebook_options', $wordbooker_hook, 'normal', 'core'); add_meta_box('wb_opt3', __('Comment Handling Options', 'wordbooker'), 'wordbooker_blog_comment_options', $wordbooker_hook, 'normal', 'core'); add_meta_box('wb_opt4', __('Advanced Options', 'wordbooker'), 'wordbooker_blog_advanced_options', $wordbooker_hook, 'normal', 'core'); echo '<p><hr><h3>'; _e('Blog Level Settings', 'wordbooker'); echo '</h3><form action="options.php" method="post" action="">'; wp_nonce_field('wordbooker_bl_options'); wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); settings_fields('wordbooker_options'); echo '<input type="hidden" name="wordbooker_settings[schema_vers]" value=' . $wordbooker_settings['schema_vers'] . ' />'; ?> <div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?> "> <div id="side-info-column" class="inner-sidebar"> <?php php; ?> </div> <div id="post-body" class="has-sidebar"> <div id="post-body-content" class="has-sidebar-content"> <?php do_meta_boxes($wordbooker_hook, 'normal', $data); ?> </div> </div> <br class="clear"/> </div> <?php if (current_user_can('activate_plugins')) { echo '<input type="submit" name="SBLO" value="' . __("Save Blog Level Options", 'wordbooker') . '" class="button-primary" /> <input type="submit" name="RSD" value="' . __("Reset to system Defaults", 'wordbooker') . '" class="button-primary" action="poo" />'; } echo '</p></form><br /></div><hr>'; } function wordbooker_blog_posting_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id; $checked_flag = array('on' => 'checked', 'off' => ''); $sql = "select wpu.ID,wpu.display_name from {$wpdb->users} wpu," . WORDBOOKER_USERDATA . " wud where wpu.ID=wud.user_id;"; $wb_users = $wpdb->get_results($sql); if (!isset($wordbooker_settings['wordbooker_comment_email'])) { $wordbooker_settings['wordbooker_comment_email'] = get_bloginfo('admin_email'); } ## Make it so that the drop down includes "Current logged in user" We know now that they have to have an account now as I've changed the code. echo '<label for="wb_publish_post_default">' . __("Default Publish Post to Facebook", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_publish_post_default]" ' . $checked_flag[$wordbooker_settings["wordbooker_publish_post_default"]] . ' ><br />'; echo '<label for="wb_publish_page_default">' . __("Default Publish Page to Facebook", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_publish_page_default]" ' . $checked_flag[$wordbooker_settings["wordbooker_publish_page_default"]] . ' ><br />'; _e('Unless changed, Posts will be published on the Facebook belonging to :', 'wordbooker'); echo '<select name="wordbooker_settings[wordbooker_default_author]" ><option value=0>'; _e('Current Logged in user', 'wordbooker'); echo ' </option>'; $option = ""; foreach ($wb_users as $wb_user) { if ($wb_user->ID == $wordbooker_settings["wordbooker_default_author"]) { $option .= '<option selected="yes" value=' . $wb_user->ID . '>'; } else { $option .= '<option value=' . $wb_user->ID . '>'; } $option .= $wb_user->display_name; $option .= '</option>'; } echo $option; echo '</select><br />'; echo '<label for="wb_publish_no_user">' . __("Publish Posts by non Wordbooker users", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_publish_no_user]" ' . $checked_flag[$wordbooker_settings["wordbooker_publish_no_user"]] . ' ><br />'; echo '<label for="wb_publish_user_publish">' . __("Allow non Wordbooker users to chose to publish a post", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_allow_publish_select]" ' . $checked_flag[$wordbooker_settings["wordbooker_allow_publish_select"]] . ' ><br />'; echo '<label for="wb_extract_length">' . __('Length of Extract', 'wordbooker') . ' :</label> <select id="wordbooker_extract_length" name="wordbooker_settings[wordbooker_extract_length]" >'; $arr = array(10 => "10", 20 => "20", 50 => "50", 100 => "100", 120 => "120", 150 => "150", 175 => "175", 200 => "200", 250 => "250", 256 => __("256 (Default) ", 'wordbooker'), 270 => "270", 300 => "300", 350 => "350", 400 => "400", 500 => "500", 600 => "600", 700 => "700", 800 => "800", 900 => "900"); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_extract_length']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_attribute">' . __("Post Attribute", 'wordbooker') . ' : </label>'; echo '<INPUT NAME="wordbooker_settings[wordbooker_attribute]" size=60 maxlength=240 value="' . stripslashes($wordbooker_settings["wordbooker_attribute"]) . '"><br />'; echo '<label for="wb_status_update">' . __("Facebook Status Attribute", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[wordbooker_status_update_text]" size=60 maxlength=60 value="' . stripslashes($wordbooker_settings["wordbooker_status_update_text"]) . '"> '; echo '<br /><label for="wb_action_link">' . __("Action Link Option ", 'wordbooker') . ': </label><select id="wordbooker_actionlink" name="wordbooker_settings[wordbooker_actionlink]" >'; $arr = array(100 => "None ", 200 => __("Share Link ", 'wordbooker'), 300 => __("Read Full Article", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_actionlink']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wordbooker_search_this_header">' . __("Enable Extended description for Share Link", 'wordbooker') . ' :</label> '; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_search_this_header]" ' . $checked_flag[$wordbooker_settings["wordbooker_search_this_header"]] . ' /><br />'; echo '<label for="wb_description_meta_length">' . __('Length of Description Meta-Tag', 'wordbooker') . ' :</label> <select id="wordbooker_description_meta_length" name="wordbooker_settings[wordbooker_description_meta_length]" >'; $arr = array(0 => "Disable", 150 => "150", 350 => "350 (Default)"); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_description_meta_length']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; } function wordbooker_blog_facebook_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id; $fblike_action = array('recommend' => 'Recommend ', 'like' => 'Like '); $fblike_colorscheme = array('dark' => 'Dark', 'light' => 'Light'); $fblike_font = array('arial' => 'Arial', 'lucida grande' => 'Lucida grande ', 'segoe ui' => 'Segoe ui', 'tahoma' => 'Tahoma', 'trebuchet ms' => 'Trebuchet ms ', 'verdana' => 'Verdana'); $fblike_button = array('button_count' => 'Button Count ', 'standard' => 'Standard ', 'box_count' => 'Box Count'); $fblike_faces = array('false' => __('No', 'wordbooker'), 'true' => __('Yes', 'wordbooker')); $fblike_location = array('top' => __('Above Post ', 'wordbooker'), 'bottom' => __('Below Post', 'wordbooker'), 'coded' => __('Defined by theme template', 'wordbooker'), 'tagged' => __('Defined by Tag in post', 'wordbooker')); $checked_flag = array('on' => 'checked', 'off' => ''); $fblike_send = array('false' => __('No', 'wordbooker'), 'true' => __('Yes', 'wordbooker')); $fblike_send_combi = array('false' => __('No - use Send instead of Like', 'wordbooker'), 'true' => __('Yes - use both Like and Send', 'wordbooker')); echo '<label for="wb_facebook_like">' . __("Include a Facebook Like button in blog", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_show]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_show"]] . ' ><br />'; echo '<label for="wb_facebook_like_front"> ' . __("Show Facebook Like button on front page", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_frontpage]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_frontpage"]] . ' ><br />'; echo '<label for="wb_facebook_like_front"> ' . __("Show Facebook Like button on Category pages", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_category]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_category"]] . ' ><br />'; echo '<label for="wb_facebook_like_page"> ' . __("Show Facebook Like button on Pages", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_page]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_page"]] . ' ><br />'; echo '<label for="wb_facebook_like"> ' . __("Show Facebook Like button in each post", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_post]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_post"]] . ' ><br />'; echo '<label for="wb_facebook_like"> ' . __("Don't show Facebook Like / Send Button on Sticky Posts", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_no_like_stick]" ' . $checked_flag[$wordbooker_settings["wordbooker_no_like_stick"]] . ' ><br />'; if (!is_numeric($wordbooker_settings['wordbooker_like_width']) || $wordbooker_settings['wordbooker_like_width'] < 0) { $wordbooker_settings['wordbooker_like_width'] = 250; } echo '<label for="wb_facebook_like_width"> ' . __("Width of Facebook Like box", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=text NAME="wordbooker_settings[wordbooker_like_width]" size="7"value="' . $wordbooker_settings["wordbooker_like_width"] . '" ><br />'; echo '<label for="wb_fblike_location"> ' . __('Facebook Like - Display Button ', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_location" name="wordbooker_settings[wordbooker_fblike_location]" >'; foreach ($fblike_location as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_location']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_location[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_location[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_action"> ' . __('Facebook Like - Verb to Display', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_action" name="wordbooker_settings[wordbooker_fblike_action]" >'; foreach ($fblike_action as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_action']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_action[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_action[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_colorscheme"> ' . __('Facebook Like - Colour Scheme', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_colorscheme" name="wordbooker_settings[wordbooker_fblike_colorscheme]" >'; foreach ($fblike_colorscheme as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_colorscheme']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_colorscheme[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_colorscheme[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_font"> ' . __('Facebook Like - Display Font', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_font" name="wordbooker_settings[wordbooker_fblike_font]" >'; foreach ($fblike_font as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_font']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_font[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_font[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_button"> ' . __('Facebook Like - Layout Style', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_button" name="wordbooker_settings[wordbooker_fblike_button]" >'; foreach ($fblike_button as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_button']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_button[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_button[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_faces"> ' . __('Facebook Like - Display Faces (Standard layout only)', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_faces" name="wordbooker_settings[wordbooker_fblike_faces]" >'; foreach ($fblike_faces as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_faces']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_faces[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_faces[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_send_combi"> ' . __('Combine Send with Like', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_send_combi" name="wordbooker_settings[wordbooker_fblike_send_combi]" >'; foreach ($fblike_send_combi as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_send_combi']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_send_combi[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_send_combi[$i] . '</option>'; } } echo "</select><br/> "; echo '<label for="wb_fblike_send"> ' . __('Facebook Send - Display Button', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_send" name="wordbooker_settings[wordbooker_fblike_send]" >'; foreach ($fblike_send as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_send']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_send[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_send[$i] . '</option>'; } } echo "</select><br /><hr><br />"; echo '<label for="wb_facebook_like_share">' . __("Include a Facebook Share button in blog", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_share_too]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_share_too"]] . ' ><br />'; echo '<label for="wb_fbshare_location"> ' . __('Facebook Share - Display Button ', 'wordbooker') . ' :</label> <select id="wordbooker_fbshare_location" name="wordbooker_settings[wordbooker_fbshare_location]" >'; foreach ($fblike_location as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fbshare_location']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_location[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_location[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_facebook_share_front"> ' . __("Show Facebook Share button on front page", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_share_button_frontpage]" ' . $checked_flag[$wordbooker_settings["wordbooker_share_button_frontpage"]] . ' ><br />'; echo '<label for="wb_facebook_share_front"> ' . __("Show Facebook Share button on Category pages", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_share_button_category]" ' . $checked_flag[$wordbooker_settings["wordbooker_share_button_category"]] . ' ><br />'; echo '<label for="wb_facebook_share_page"> ' . __("Show Facebook Share button on Pages", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_share_button_page]" ' . $checked_flag[$wordbooker_settings["wordbooker_share_button_page"]] . ' ><br />'; echo '<label for="wb_facebook_share_post"> ' . __("Show Facebook Share button in each post", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_share_button_post]" ' . $checked_flag[$wordbooker_settings["wordbooker_share_button_post"]] . ' ><br />'; echo '<label for="wb_facebook_like"> ' . __("Don't show Facebook Share button on Sticky Posts", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_no_share_stick]" ' . $checked_flag[$wordbooker_settings["wordbooker_no_share_stick"]] . ' ><br />'; echo "<hr><br />"; echo '<label for="wb_facebook_gravatars">' . __("Do not replace Gravtars with Facebook Photos", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_no_facebook_gravatars]" ' . $checked_flag[$wordbooker_settings["wordbooker_no_facebook_gravatars"]] . ' ><br />'; /* echo "<hr><br />"; echo '<label for="wb_facebook_time">'.__("Use Frictionless sharing / Timeline instead of Share", 'wordbooker'). ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_time_button]" '.$checked_flag[$wordbooker_settings["wordbooker_time_button"]].' ><br />'; echo '<label for="wb_fbread_location"> '.__('Facebook Read - Display Button ', 'wordbooker').' :</label> <select id="wordbooker_fbread_location" name="wordbooker_settings[wordbooker_fbread_location]" >'; foreach ($fblike_location as $i => $value) { if ($i==$wordbooker_settings['wordbooker_fbread_location']){ print '<option selected="yes" value="'.$i.'" >'.$fblike_location[$i].'</option>';} else {print '<option value="'.$i.'" >'.$fblike_location[$i].'</option>';}} echo "</select><br />"; */ } function wordbooker_blog_comment_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id; $checked_flag = array('on' => 'checked', 'off' => ''); $fbcomment_colorscheme = array('dark' => 'Dark', 'light' => 'Light'); echo "<b>" . __('Wordpress Comment handling Options', 'wordbooker') . "</b><br />"; $scheds1['Never'] = array('interval' => 999999999, 'display' => __('Never ', 'wordbooker')); $scheds1['Manual'] = array('interval' => 999999999, 'display' => __('Manual Polling ', 'wordbooker')); $scheds2 = wp_get_schedules(); $scheds = array_merge($scheds1, $scheds2); echo '<label for="wb_comment_cron">' . __('Process Comments ', 'wordbooker') . ' :</label> <select id="wordbooker_comment_cron" name="wordbooker_settings[wordbooker_comment_cron]" >'; foreach (array_keys($scheds) as $ss) { if ($ss == $wordbooker_settings['wordbooker_comment_cron']) { print '<option selected="yes" value="' . $ss . '" >' . $scheds[$ss]['display'] . ' </option>'; } else { print '<option value="' . $ss . '" >' . $scheds[$ss]['display'] . ' </option>'; } } echo "</select> "; if ($wordbooker_settings['wordbooker_comment_cron'] != 'Never') { echo " (" . __("Next Scheduled fetch is in", 'wordbooker') . ' : ' . date('H:i', wp_next_scheduled('wb_comment_job') - time()) . ')'; } echo '<br /><label for="wb_publish_comment_handling">' . __("Enable Comment processing", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_handling]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_handling"]] . ' /><br />'; echo '<label for="wb_import_comment"> ' . __("Disable Comment Importing", 'wordbooker') . ': </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_pul]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_pull"]] . '/> <br />'; echo '<label for="wb_import_comment"> ' . __("Disable Comment Exporting", 'wordbooker') . ': </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_push]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_push"]] . '/> <br />'; if (!isset($wordbooker_settings["wordbooker_comment_attribute"])) { $wordbooker_settings["wordbooker_comment_attribute"] = __("[Comment imported from blog]", 'wordbooker'); } echo '<label for="wb_cooment_attribute">' . __('Comment Tag', 'wordbooker') . ' : </label>'; echo '<INPUT NAME="wordbooker_settings[wordbooker_comment_attribute]" size=60 maxlength=240 value="' . stripslashes($wordbooker_settings["wordbooker_comment_attribute"]) . '"><br />'; if (strlen($wordbooker_settings['wordbooker_comment_post_format']) < 2) { $wordbooker_settings['wordbooker_comment_post_format'] = "%tag%"; } echo '<p class="DataForm"><label for="wb_cooment_post_format">' . __('Facebook Comment Structure', 'wordbooker') . ' : </label>'; echo "<TEXTAREA NAME='wordbooker_settings[wordbooker_comment_post_format]' ROWS=8 COLS=60>" . stripslashes($wordbooker_settings["wordbooker_comment_post_format"]) . "</TEXTAREA><br /></p>"; echo '<label for="wb_comment_email">' . __("Assign this email address to comments", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[wordbooker_comment_email]" size=60 maxlength=60 value="' . stripslashes($wordbooker_settings["wordbooker_comment_email"]) . '"> <br />'; echo '<label for="wb_import_comment">' . __("Import Comments from Facebook for new Wordbooker Posts", 'wordbooker') . ': </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_get]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_get"]] . '/> <br />'; echo '<label for="wb_publish_comment_push">' . __("Push Comments up to Facebook for new posts", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_put]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_put"]] . ' /> <br /> '; echo '<label for="wb_publish_comment_approve">' . __("Auto Approve imported comments", 'wordbooker') . ' :</label> '; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_approve]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_approve"]] . ' /><br />'; if ($wordbooker_settings['wordbooker_comment_cron'] != 'Never') { echo '<br /><input type="submit" value="' . __("Run Comment Handling Now", 'wordbooker') . '" name="mcp" class="button-primary" />'; } echo "<hr><br /><b>" . __('Facebook Comment Box Options', 'wordbooker') . "</b><br /><br />"; echo '<label for="wb_use_fb_comments">' . __("Enable Facebook Comment handling ", 'wordbooker') . ' : </label> '; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_use_fb_comments]" ' . $checked_flag[$wordbooker_settings["wordbooker_use_fb_comments"]] . ' /> <br />'; $fb_comment_location = array('bottom' => __('Created in line below post', 'wordbooker'), 'coded' => __('Defined by theme template', 'wordbooker'), 'tagged' => __('Defined by Tag in post', 'wordbooker')); echo '<label for="wb_comment_location">' . __('Comment placing ', 'wordbooker') . ' :</label> <select id="wordbooker_comment_location" name="wordbooker_settings[wordbooker_comment_location]" >'; foreach ($fb_comment_location as $i => $value) { if ($i == $wordbooker_settings['wordbooker_comment_location']) { print '<option selected="yes" value="' . $i . '" >' . $fb_comment_location[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fb_comment_location[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_comment_colorscheme">' . __('Comment Box - Colour Scheme', 'wordbooker') . ' :</label> <select id="wb_comment_colorscheme" name="wordbooker_settings[wb_comment_colorscheme]" >'; foreach ($fbcomment_colorscheme as $i => $value) { if ($i == $wordbooker_settings['wb_comment_colorscheme']) { print '<option selected="yes" value="' . $i . '" >' . $fbcomment_colorscheme[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fbcomment_colorscheme[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_use_fb_comments_admin">' . __("All Wordbooker users can moderate comments ", 'wordbooker') . ' : </label> '; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_fb_comments_admin]" ' . $checked_flag[$wordbooker_settings["wordbooker_fb_comments_admin"]] . ' /> <br />'; if (!defined('WORDBOOKER_PREMIUM') || defined('WORDBOOKER_MULTI') && WORDBOOKER_MULTI == true) { echo '<label for="fb_comment_app_id">' . __("Use this Facebook Application ID for comment moderation", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[fb_comment_app_id]" size=20 maxlength=20 value="' . stripslashes($wordbooker_settings["fb_comment_app_id"]) . '"> <br />'; } echo '<label for="fb_comment_app_id">' . __("Width of comment box", 'wordbooker') . ' :</label>'; if (strlen($wordbooker_settings["fb_comment_box_size"]) <= 2) { $wordbooker_settings["fb_comment_box_size"] = 350; } if ($wordbooker_settings["fb_comment_box_size"] < 350) { $wordbooker_settings["fb_comment_box_size"] = 350; } echo ' <INPUT NAME="wordbooker_settings[fb_comment_box_size]" size=3 maxlength=3 value="' . stripslashes($wordbooker_settings["fb_comment_box_size"]) . '"> <br />'; echo '<label for="fb_comment_count">' . __("Number of comments to display", 'wordbooker') . ' :</label>'; if (strlen($wordbooker_settings["fb_comment_box_count"]) < 1) { $wordbooker_settings["fb_comment_box_count"] = 20; } if ($wordbooker_settings["fb_comment_box_count"] < 2) { $wordbooker_settings["fb_comment_box_count"] = 2; } echo ' <INPUT NAME="wordbooker_settings[fb_comment_box_count]" size=3 maxlength=3 value="' . stripslashes($wordbooker_settings["fb_comment_box_count"]) . '"> <br />'; echo '<label for="wordbooker_comment_notify">' . __('Enable notification of new comments', 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[fb_comment_box_notify]" ' . $checked_flag[$wordbooker_settings["fb_comment_box_notify"]] . '><br />'; echo '<label for="wordbooker_use_facebook_comments">' . __('Facebook comment handling should be enabled on new posts', 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_use_facebook_comments]" ' . $checked_flag[$wordbooker_settings["wordbooker_use_facebook_comments"]] . '><br />'; } function wordbooker_blog_advanced_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id, $table_prefix; $checked_flag = array('on' => 'checked', 'off' => ''); if (intval(WORDBOOKER_WP_VERSION) > 30) { $admin_users = get_users(array('role' => 'administrator')); echo '<label for="wordbooker_diagnostic admin">' . __('User who should get Admin level diagnostics', 'wordbooker') . ' :</label> <select id="wordbooker_diagnostic_admin" name="wordbooker_settings[wordbooker_diagnostic_admin]" >'; foreach ($admin_users as $adminuser) { if ($adminuser->ID == $wordbooker_settings['wordbooker_diagnostic_admin']) { print '<option selected="yes" value="' . $adminuser->ID . '" >' . $adminuser->display_name . ' ( ' . $adminuser->user_login . ' ) </option>'; } else { print '<option value="' . $adminuser->ID . '" >' . $adminuser->display_name . ' ( ' . $adminuser->user_login . ' ) </option>'; } } echo "</select><br />"; } if (!isset($wordbooker_settings['wordbooker_advanced_diagnostics_level'])) { $wordbooker_settings['wordbooker_advanced_diagnostics_level'] = 10; } $arr = array(0 => __("Show Everything and I mean everything", 'wordbooker'), 10 => __("Show everything but Cache Diagnostics", 'wordbooker'), 90 => __("Show result of major actions", 'wordbooker'), 99 => __("Don't show anything apart from Fatal errors", 'wordbooker'), 999 => __("Disabled (Show nothing at all)", 'wordbooker')); echo '<p><label for="wb_advanced_diagnostics_level">' . __("Post Diagnostics display level", 'wordbooker') . ' : </label><select id="wordbooker_advanced_diagnostics_level" name="wordbooker_settings[wordbooker_advanced_diagnostics_level]" >'; foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_advanced_diagnostics_level']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br /></P><p>"; echo '<label for="wb_wordbooker_diag_clear">' . __("Clear detailed diagnostics on successful post", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_clear_diagnostics]" ' . $checked_flag[$wordbooker_settings["wordbooker_clear_diagnostics"]] . ' ></P><p>'; echo '<label for="wb_wordbooker_disable_shorties">' . __("Disable the use of short URLs in links posted to Facebook", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_disable_shorties]" ' . $checked_flag[$wordbooker_settings["wordbooker_disable_shorties"]] . ' ></P><p>'; echo '<label for="wb_wordbooker_fb_rec_act">' . __("Include FB Recent activity on Wordbooker Options page", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_fb_rec_act]" ' . $checked_flag[$wordbooker_settings["wordbooker_fb_rec_act"]] . ' ></P><p>'; echo '<label for="wb_facebook_iframe">' . __("Use Iframes instead of FBXML to render FB features", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_iframe]" ' . $checked_flag[$wordbooker_settings["wordbooker_iframe"]] . ' ></P><p>'; echo '<label for="wordbooker_use_url_not_slug">' . __("Use Site URL not Blog Description in Wall Posts", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_use_url_not_slug]" ' . $checked_flag[$wordbooker_settings["wordbooker_use_url_not_slug"]] . ' ></P><p>'; echo '<label for="wb_meta_tag_scan">' . __("Check the following Custom Post Meta tags for images", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[wordbooker_meta_tag_scan]" size=60 maxlength=129 value="' . stripslashes($wordbooker_settings["wordbooker_meta_tag_scan"]) . '"/></P><p> '; echo '<label for="wb_meta_tag_thumb">' . __("Use Image from Custom Meta instead of Featured Image for Open Graph image", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_meta_tag_thumb]" ' . $checked_flag[$wordbooker_settings["wordbooker_meta_tag_thumb"]] . ' /></P><p>'; echo '<label for="wb_wordbooker_default_image">' . __("Default Open Graph image to use for posts", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[wb_wordbooker_default_image]" size=60 maxlength=120 value="' . stripslashes($wordbooker_settings["wb_wordbooker_default_image"]) . '"></P><p>'; echo '<label for="wb_facebook_use_this_image">' . __("Use the above image instead of a blank for posts with no image", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_use_this_image]" ' . $checked_flag[$wordbooker_settings["wordbooker_use_this_image"]] . ' ></P><p>'; echo '<label for="wb_wordbooker_disable_ogtags">' . __("Disable in-line production of OpenGraph Tags", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_fb_disable_og]" ' . $checked_flag[$wordbooker_settings["wordbooker_fb_disable_og"]] . ' ></P><p>'; echo '<label for="wb_fake_publish">' . __("Only Pretend to Publish on Facebook - TEST MODE", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_fake_publish]" ' . $checked_flag[$wordbooker_settings["wordbooker_fake_publish"]] . ' /></P><p>'; echo '<label for="wb_disable">' . __("Disable ALL Wordbooker functionality", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_disabled]" ' . $checked_flag[$wordbooker_settings["wordbooker_disabled"]] . ' /></P>'; echo '<input type="hidden" name="wordbooker_settings[wordbooker_page_post]" value="-100" />'; echo '<input type="hidden" name="wordbooker_settings[wordbooker_orandpage]" value="2" />'; } function wordbooker_user_level_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id, $user_ID, $wordbooker_hook; id; # USER LEVEL OPTIONS $checked_flag = array('on' => 'checked', 'off' => ''); $wordbookeruser_settings = get_usermeta($user_ID, $wordbooker_user_settings_id); # Set a couple of options that we really need. if (!isset($wordbookeruser_settings['wordbooker_orandpage'])) { $wordbookeruser_settings['wordbooker_orandpage'] = 2; } if (!isset($wordbookeruser_settings['wordbooker_publish_default'])) { $wordbookeruser_settings['wordbooker_publish_default'] = $wordbooker_settings['wordbooker_publish_default']; } echo '<div class="wrap">'; echo '<h3>' . __('User Level Settings', 'wordbooker') . '</h3>'; _e("If set, these options will override the Blog Level options for this user", 'wordbooker'); echo '<br /><br /><form action="" method="post">'; echo '<input type="hidden" name="token" value="' . wbs_retrieve_hash() . '" />'; echo '<input type="hidden" name="user_meta" value="true" />'; wp_nonce_field('wordbooker_ul_options'); wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); echo '<label for="wb_publish_post_default">' . __('Default Publish Post to Facebook', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_publish_post_default" name="wordbooker_publish_post_default" >'; $arr = array(0 => __("Same as Blog", 'wordbooker'), 100 => __("No", 'wordbooker'), 200 => "Yes"); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_publish_post_default']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_publish_page_default">' . __('Default Publish Page to Facebook', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_publish_page_default" name="wordbooker_publish_page_default" >'; $arr = array(0 => __("Same as Blog", 'wordbooker'), 100 => __("No", 'wordbooker'), 200 => "Yes"); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_publish_page_default']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<input type="hidden" name="wordbooker_page_post" value="-100" />'; echo '<input type="hidden" name="wordbooker_orandpage" value="2" />'; # Get the list of pages this user is an admin for $result = $wpdb->get_row("select pages from " . WORDBOOKER_USERDATA . " where user_id=" . $user_ID); $fanpages = unserialize($result->pages); $sql = "select wpu.ID,wpu.display_name,facebook_id from {$wpdb->users} wpu," . WORDBOOKER_USERDATA . " wud where wpu.ID=wud.user_id and wud.user_id=" . $user_ID; $wb_users = $wpdb->get_results($sql); $fanpages2 = $fanpages; $fanpages[] = array('id' => 'PW:' . $wb_users[0]->facebook_id, 'name' => "Personal Wall"); if (!isset($wordbookeruser_settings["wordbooker_primary_target"])) { $wordbookeruser_settings["wordbooker_primary_target"] = 'PW:' . $wb_users[0]->facebook_id; } $have_fan_pages = 0; if (count($fanpages) > 1) { echo '<p><label for="wb_primary_target">' . __('Post to the following Wall', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_primary_target" name="wordbooker_primary_target" >'; $option = ""; foreach ($fanpages as $fan_page) { if (strlen($fan_page['name']) >= 2) { if ($fan_page['id'] == $wordbookeruser_settings["wordbooker_primary_target"]) { $option .= '<option selected="yes" value=' . $fan_page['id'] . '>'; } else { $option .= '<option value=' . $fan_page[id] . '>'; } $option .= $fan_page['name'] . " (" . substr($fan_page['id'], 3) . ") "; $option .= '</option>'; } } echo $option; echo '</select> '; $arr = array(1 => __("As a Wall Post", 'wordbooker'), 2 => __("As a Note", 'wordbooker'), 3 => __("As a Status Update", 'wordbooker'), 4 => __("As a Link", 'wordbooker')); echo '<select id="wordbooker_primary_type" name="wordbooker_primary_type" >'; foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_primary_type']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo '</select> <INPUT TYPE=CHECKBOX NAME="wordbooker_primary_active" ' . $checked_flag[$wordbookeruser_settings["wordbooker_primary_active"]] . '></p><p>'; } else { echo '<p><label for="wb_primary_target">' . __('Post to my Personal Wall', 'wordbooker') . ' : </label> '; echo '<input type="hidden" name="wordbooker_primary_target" value="PW:' . $wb_users[0]->facebook_id . '" />'; echo '<select id="wordbooker_primary_type" name="wordbooker_primary_type" >'; foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_primary_type']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo ' <INPUT TYPE=CHECKBOX NAME="wordbooker_primary_active" ' . $checked_flag[$wordbookeruser_settings["wordbooker_primary_active"]] . '></p><p>'; } if (is_array($fanpages2)) { $have_fan_pages = 1; echo '<label for="wb_secondary_target">' . __('Post to the following Wall', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_secondary_target" name="wordbooker_secondary_target" >'; $option = ""; foreach ($fanpages2 as $fan_page) { if (strlen($fan_page['name']) >= 2) { if ($fan_page['id'] == $wordbookeruser_settings["wordbooker_secondary_target"]) { $option .= '<option selected="yes" value=' . $fan_page['id'] . '>'; } else { $option .= '<option value=' . $fan_page[id] . '>'; } $option .= $fan_page['name'] . " (" . substr($fan_page['id'], 3) . ") "; $option .= '</option>'; } } echo $option; echo '</select> '; echo '<select id="wordbooker_secondary_type" name="wordbooker_secondary_type" >'; foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_secondary_type']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select>"; echo ' <INPUT TYPE=CHECKBOX NAME="wordbooker_secondary_active" ' . $checked_flag[$wordbookeruser_settings["wordbooker_secondary_active"]] . '></p><P>'; } if (!isset($wordbookeruser_settings['wordbooker_extract_length'])) { $wordbookeruser_settings['wordbooker_extract_length'] = $wordbooker_settings['wordbooker_extract_length']; } echo '<label for="wb_extract_length">' . __('Length of Extract', 'wordbooker') . ' : </label><select id="wordbooker_extract_length" name="wordbooker_extract_length" >'; $arr = array(10 => "10", 20 => "20", 50 => "50", 100 => "100", 120 => "120", 150 => "150", 175 => "175", 200 => "200", 250 => "250", 256 => __("256 (Default) ", 'wordbooker'), 270 => "270", 300 => "300", 350 => "350", 400 => "400", 500 => "500", 600 => "600", 700 => "700", 800 => "800", 900 => "900"); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_extract_length']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_status_update">' . __('Facebook Status Text', 'wordbooker') . ' : </label> '; echo '<INPUT NAME="wordbooker_status_update_text" size=60 maxlength=60 value="' . stripslashes($wordbookeruser_settings["wordbooker_status_update_text"]) . '"> '; echo '</select><br />'; echo '<label for="wb_attribute">' . __('Post Attribute', 'wordbooker') . ' : </label>'; echo '<INPUT NAME="wordbooker_attribute" size=60 maxlength=240 value="' . stripslashes($wordbookeruser_settings["wordbooker_attribute"]) . '"><br />'; echo '<label for="wb_action_link">' . __('Action Link Option', 'wordbooker') . ' : </label><select id="wordbooker_actionlink" name="wordbooker_actionlink" >'; $arr = array(0 => __("Same as Blog", 'wordbooker'), 100 => __("None", 'wordbooker'), 200 => __("Share Link", 'wordbooker'), 300 => __("Read Full Article", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_actionlink']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wordbooker_search_this_header">' . __('Enable Extended description for Share Link', 'wordbooker') . ' : </label> '; echo '<select id="wordbooker_search_this_header" name="wordbooker_search_this_header" >'; $arr = array(0 => __("Same as Blog", 'wordbooker'), 100 => __("No", 'wordbooker'), 200 => __("Yes", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_search_this_header']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; if (function_exists('get_the_post_thumbnail')) { echo '<label for="wb_thumb_only">' . __('Use Post Thumbnail only', 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_thumb_only" ' . $checked_flag[$wordbookeruser_settings["wordbooker_thumb_only"]] . '><br />'; } echo '<label for="wb_use_extract">' . __('Use Post Excerpt', 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_use_excerpt" ' . $checked_flag[$wordbookeruser_settings["wordbooker_use_excerpt"]] . '><br />'; echo '<label for="wb_status_id">' . __('Show Status for', 'wordbooker') . ' : </label> <select name="wordbooker_status_id" ><option selected="yes" value=-100>' . __('My Own Profile', 'wordbooker') . ' </option>'; $option = ""; if ($have_fan_pages == 1) { foreach ($fanpages as $fan_page) { if (substr($fan_page[id], 0, 2) != "GW") { if ($fan_page[id] == $wordbookeruser_settings["wordbooker_status_id"]) { $option .= '<option selected="yes" value=' . $fan_page[id] . '>'; } else { $option .= '<option value=' . $fan_page[id] . '>'; } $option .= $fan_page[name] . " "; $option .= '</option>'; } } echo $option; } echo '</select><br />'; _e('Disable Facebook User information in Status', 'wordbooker'); echo ' : <INPUT TYPE=CHECKBOX NAME="wordbooker_disable_status" ' . $checked_flag[$wordbookeruser_settings["wordbooker_disable_status"]] . '><br /><p>'; echo '<input type="submit" value="' . __("Save User Options", 'wordbooker') . '" name="swbus" class="button-primary" /> <input type="submit" name="rwbus" value="' . __("Reset to Blog Defaults", 'wordbooker') . '" class="button-primary" /></form><br /></div><hr>'; } // Lets poll if they want to - we only poll for this user if (isset($wordbooker_settings["wordbooker_comment_poll"]) && ADVANCED_DEBUG) { $dummy = wordbooker_poll_facebook($user_ID); } wordbooker_blog_level_options(); wordbooker_user_level_options(); wordbooker_render_errorlogs(); wordbooker_status($user_ID); wordbooker_option_status($wbuser); echo "<br /><hr><h3>"; _e("Donate", 'wordbooker'); echo "</h3>"; if (defined('WORDBOOKER_PREMIUM')) { _e("You're using the Premium options in Wordbooker. You really should contribute something to the support and development of this plugin. Please provide your FB Id number and your website when making payment so your details can be added to the <a href='http://wordbooker.tty.org.uk/thanks/'>'Thanks'</a> list on the web site", 'wordbooker'); } _e("If you've found this extension useful then please feel free to donate to its support and future development. Please provide your FB Id number and your website when making payment so your details can be added to the <a href='http://wordbooker.tty.org.uk/thanks/'>'Thanks'</a> page on the Website", 'wordbooker'); ?> <br /><br /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBS1CS6j8gSPzUcHkKZ5UYKF2n97UX8EhSB+QgoExXlfJWLo6S7MJFvuzay0RhJNefA9Y1Jkz8UQahqaR7SuIDBkz0Ys4Mfx6opshuXQqxp17YbZSUlO6zuzdJT4qBny2fNWqutEpXe6GkCopRuOHCvI/Ogxc0QHtIlHT5TKRfpejELMAkGBSsOAwIaBQAwgbwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIitf6nEQBOsSAgZgWnlCfjf2E3Yekw5n9DQrNMDoUZTckFlqkQaLYLwnSYbtKanICptkU2fkRQ3T9tYFMhe1LhAuHVQmbVmZWtPb/djud5uZW6Lp5kREe7c01YtI5GRlK63cAF6kpxDL9JT2GH10Cojt9UF15OH46Q+2V3gu98d0Lad77PXz3V1XY0cto29buKZZRfGG8u9NfpXZjv1utEG2CP6CCA4cwggODMIIC7KADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTAeFw0wNDAyMTMxMDEzMTVaFw0zNTAyMTMxMDEzMTVaMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwUdO3fxEzEtcnI7ZKZL412XvZPugoni7i7D7prCe0AtaHTc97CYgm7NsAtJyxNLixmhLV8pyIEaiHXWAh8fPKW+R017+EmXrr9EaquPmsVvTywAAE1PMNOKqo2kl4Gxiz9zZqIajOm1fZGWcGS0f5JQ2kBqNbvbg2/Za+GJ/qwUCAwEAAaOB7jCB6zAdBgNVHQ4EFgQUlp98u8ZvF71ZP1LXChvsENZklGswgbsGA1UdIwSBszCBsIAUlp98u8ZvF71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA5MTAyODE0MzM1OVowIwYJKoZIhvcNAQkEMRYEFIf+6qkVI7LG/jPumIrQXIOhI4hJMA0GCSqGSIb3DQEBAQUABIGAdpAB4Mj4JkQ6K44Xxp4Da3GsRCeiLr2LMqrAgzF8jYGgV9zjf7PXxpC8XJTVC7L7oKDtoW442T9ntYj6RM/hSjmRO2iaJq0CAZkz2sPZWvGlnhYrpEB/XB3dhmd2nGhUMSXbtQzZvR7JMVoPR0zxL/X/Hfj6c+uF7BxW8xTSBqw=-----END PKCS7-----"> <input type="image" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."> <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </form><br /><br /><hr><h3> <?php wordbooker_option_support(); ?> <script type="text/javascript"> //<![CDATA[ jQuery(document).ready( function($) { // close postboxes that should be closed $('.if-js-closed').removeClass('if-js-closed').addClass('closed'); // postboxes setup //save_postboxes_state('<?php echo $wordbooker_hook; ?> '); postboxes.add_postbox_toggles('<?php echo $wordbooker_hook; ?> '); }); //]]> </script> <?php } else { wordbooker_option_setup($wbuser); wordbooker_render_errorlogs(); wordbooker_option_support(); } }
function wordbooker_store_post_result($post_id, $fb_post_id) { global $wpdb, $blog_id, $user_ID; $tstamp = time(); $wordbooker_settings = wordbooker_options(); $sql = ' INSERT INTO ' . WORDBOOKER_POSTCOMMENTS . ' (fb_post_id,comment_timestamp,wp_post_id,blog_id,user_id) VALUES ("' . $fb_post_id . '",' . $tstamp . ',' . $post_id . ',' . $blog_id . ',' . $user_ID . ')'; $result = $wpdb->query($sql); wordbooker_insert_into_postlogs($post_id, $blog_id); # Clear down the diagnostics for this post if the user has chosen so if (isset($wordbooker_settings['wb_wordbooker_diag_clear'])) { $result = $wpdb->query(' DELETE FROM ' . WORDBOOKER_ERRORLOGS . ' WHERE blog_id =' . $blog_id . ' and post_id=' . $post_id . ' and (error_message not like "(%_%)" and method not like "% - result")'); } # Now Change the publish flag for this post to mark it as published. $wb_params = get_post_meta($post_id, '_wordbooker_options', true); $wb_params["wordbooker_publish_default"] = 'published'; update_post_meta($post_id, '_wordbooker_options', $wb_params); }
function wordbooker_publish_remote($post_id) { global $blog_id; $post = get_post($post_id); wordbooker_debugger("Commence Remote publish ", " ", $post->ID, 80); $wordbooker_settings = wordbooker_options(); }
function wordbooker_inner_custom_box() { # We need to put in a "read only" key on the inputs for users who will be able to post but not be able to change settings. echo '<input type="hidden" name="wordbooker_noncename" id="wordbooker_noncename" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />'; global $wpdb, $user_ID, $blog_id, $post; $wordbooker_global_settings = wordbooker_options(); $wordbooker_settings = $wordbooker_global_settings; $checked_flag = array('on' => 'checked', 'off' => '', 100 => '', 200 => 'checked'); # Now get the user settings for this blog. # If the user is set to logged in user then get the current user, otherwise pick up the settings for the user selected. if ($wordbooker_settings["wordbooker_default_author"] == 0) { $wb_user_id = $user_ID; } else { $wb_user_id = $wordbooker_settings["wordbooker_default_author"]; } $wordbooker_user_settings_id = "wordbookuser" . $blog_id; # We need to do some more checking here. If the user does not have an entry in the wordbooker user table then we should get the user options for the user set as the default user. $wordbookuser = get_usermeta($wb_user_id, $wordbooker_user_settings_id); # If we have user settings then lets go through and override the blog level defaults. if (is_array($wordbookuser)) { foreach (array_keys($wordbookuser) as $key) { if (strlen($wordbookuser[$key]) > 0 && $wordbookuser[$key] != "0") { $wordbooker_settings[$key] = $wordbookuser[$key]; } } } $x = get_post_meta($post->ID, '_wordbooker_options', true); # var_dump($x); if (is_array($x)) { foreach (array_keys($x) as $key) { if (substr($key, 0, 8) == 'wordbook') { $post_meta[$key] = str_replace(array('&', '"', ''', '<', '>', ' '), array('&', '"', '\'', '<', '>', "\t"), $x[$key]); } } } if (is_array($post_meta)) { $wordbooker_settings = $post_meta; } $post_pub_prompt = __("Publish this post to Facebook", 'wordbooker'); if ($post->post_type == 'page') { $publish = $wordbooker_settings["wordbooker_publish_page_default"]; $post_pub_prompt = __("Publish this page to Facebook", 'wordbooker'); } else { $publish = $wordbooker_settings["wordbooker_publish_post_default"]; $post_pub_prompt = __("Publish this post to Facebook", 'wordbooker'); } if ($wordbooker_settings["wordbooker_post_edited"] != 'yes') { $wordbooker_settings["wordbooker_publish_default"] = $publish; } if ($post->post_status == "publish") { $wordbooker_settings["wordbooker_publish_default"] = ''; } if (isset($wordbooker_settings['wordbooker_disabled'])) { echo "<div align='center'><b> " . __('WARNING : Wordbooker is DISABLED', 'wordbooker') . "</b></div>"; } else { if (isset($wordbooker_settings['wordbooker_fake_publish'])) { echo "<div align='center'><b> " . __('WARNING : Wordbooker is in TEST mode - NO Posts will be made to Facebook', 'wordbooker') . "</b></div>"; } } echo "<br />"; if (wordbooker_get_userdata($user_ID)) { echo __("The following options override the defaults set on the options page", 'wordbooker') . "<br /><br />"; $sql = "select wpu.ID,wpu.display_name,facebook_id from {$wpdb->users} wpu," . WORDBOOKER_USERDATA . " wud where wpu.ID=wud.user_id and wud.user_id=" . $user_ID; $wb_users = $wpdb->get_results($sql); # Get the list of pages this user is an admin for $result = $wpdb->get_row("select pages from " . WORDBOOKER_USERDATA . " where user_id=" . $user_ID); $fanpages = unserialize($result->pages); $fanpages2 = $fanpages; $fanpages[] = array('id' => 'PW:' . $wb_users[0]->facebook_id, 'name' => __("Personal Wall", 'wordbooker')); $have_fan_pages = 0; # If the post has already been published then we uncheck the publish option echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_publish_default" ' . $checked_flag[$wordbooker_settings["wordbooker_publish_default"]] . ' > ' . $post_pub_prompt . '<br />'; if (count($fanpages) > 1) { echo '<p><label for="wb_primary_target">' . __('Post to the following Wall', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_primary_target" name="wordbooker_primary_target" >'; $option = ""; foreach ($fanpages as $fan_page) { if (strlen($fan_page['name']) >= 2) { if ($fan_page['id'] == $wordbooker_settings["wordbooker_primary_target"]) { $option .= '<option selected="yes" value=' . $fan_page['id'] . '>'; } else { $option .= '<option value=' . $fan_page[id] . '>'; } $option .= $fan_page['name'] . " (" . substr($fan_page['id'], 3) . ") "; $option .= '</option>'; } } echo $option; echo '</select> '; $arr = array(1 => __("As a Wall Post", 'wordbooker'), 2 => __("As a Note", 'wordbooker'), 3 => __("As a Status Update", 'wordbooker'), 4 => __("As a Link", 'wordbooker')); echo '<select id="wordbooker_primary_type" name="wordbooker_primary_type" >'; foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_primary_type']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo '</select> <INPUT TYPE=CHECKBOX NAME="wordbooker_primary_active" ' . $checked_flag[$wordbooker_settings["wordbooker_primary_active"]] . '></p>'; } else { echo '<p><label for="wb_primary_target">' . __('Post to my Personal Wall', 'wordbooker') . ' : </label> '; echo '<input type="hidden" name="wordbooker_primary_target" value="PW:' . $wb_users[0]->facebook_id . '" />'; $arr = array(1 => __("As a Wall Post", 'wordbooker'), 2 => __("As a Note", 'wordbooker'), 3 => __("As a Status Update", 'wordbooker'), 4 => __("As a Link", 'wordbooker')); echo '<select id="wordbooker_primary_type" name="wordbooker_primary_type" >'; foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_primary_type']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo ' <INPUT TYPE=CHECKBOX NAME="wordbooker_primary_active" ' . $checked_flag[$wordbooker_settings["wordbooker_primary_active"]] . '></p><p>'; } if ($fanpages2) { $have_fan_pages = 1; echo '<label for="wb_secondary_target">' . __('Post to the following Wall', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_secondary_target" name="wordbooker_secondary_target" >'; $option = ""; foreach ($fanpages2 as $fan_page) { if (strlen($fan_page['name']) >= 2) { if ($fan_page['id'] == $wordbooker_settings["wordbooker_secondary_target"]) { $option .= '<option selected="yes" value=' . $fan_page['id'] . '>'; } else { $option .= '<option value=' . $fan_page[id] . '>'; } $option .= $fan_page['name'] . " (" . substr($fan_page['id'], 3) . ") "; $option .= '</option>'; } } echo $option; echo '</select> '; echo '<select id="wordbooker_secondary_type" name="wordbooker_secondary_type" >'; foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_secondary_type']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select> "; echo ' <INPUT TYPE=CHECKBOX NAME="wordbooker_secondary_active" ' . $checked_flag[$wordbooker_settings["wordbooker_secondary_active"]] . '></p><P>'; } echo __('Length of Extract', 'wordbooker') . ' : <select id="wordbooker_extract_length" name="wordbooker_extract_length" >'; $arr = array(10 => "10", 20 => "20", 50 => "50", 100 => "100", 120 => "120", 150 => "150", 175 => "175", 200 => "200", 250 => "250", 256 => __("256 (Default) ", 'wordbooker'), 270 => "270", 300 => "300", 350 => "350", 400 => "400", 500 => "500", 600 => "600", 700 => "700", 800 => "800", 900 => "900"); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_extract_length']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo __('Action Link Option', 'wordbooker') . ' :<select id="wordbooker_actionlink" name="wordbooker_actionlink" >'; $arr = array(100 => "None ", 200 => __("Share Link", 'wordbooker'), 300 => __("Read Full Article", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_actionlink']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "<</select><br /><br />"; echo '<input type="hidden" name="soupy" value="twist" />'; # echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_publish_override" '.$checked_flag[$wordbooker_settings["wordbooker_publish_override"]].' >'.__('Force Re-Publish Post to Facebook on Edit (overrides republish window)').'<br />'; if (function_exists('get_the_post_thumbnail')) { echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_thumb_only" ' . $checked_flag[$wordbooker_settings["wordbooker_thumb_only"]] . '>' . __(' Use Thumbnail as only image', 'wordbooker') . ' <br />'; } echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_use_excerpt" ' . $checked_flag[$wordbooker_settings["wordbooker_use_excerpt"]] . ' > Use Wordpress Excerpt for Wall Post <br />'; echo 'Facebook Post Attribute line: <INPUT NAME="wordbooker_attribute" size=80 maxlength=240 value="' . stripslashes($wordbooker_settings["wordbooker_attribute"]) . '"><br />'; echo __('Facebook Status Update text', 'wordbooker') . ' : <INPUT NAME="wordbooker_status_update_text" size=60 maxlength=240 value="' . stripslashes($wordbooker_settings["wordbooker_status_update_text"]) . '"><br />'; if ($post->post_type == 'page') { if (!isset($wordbooker_settings['wordbooker_like_button_page'])) { $wordbooker_settings['wordbooker_like_button_page'] = 1; } if (!isset($wordbooker_settings['wordbooker_share_button_page'])) { $wordbooker_settings['wordbooker_share_button_page'] = 1; } echo __('Show Facebook Like/Send for this Page', 'wordbooker') . ' : <select id="wordbooker_like_button_page" name="wordbooker_like_button_page" >'; $arr = array(1 => __("Yes", 'wordbooker'), 2 => __("No", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_like_button_page']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo __('Show Facebook Share for this Page', 'wordbooker') . ' : <select id="wordbooker_share_button_page" name="wordbooker_share_button_page" >'; $arr = array(1 => __("Yes", 'wordbooker'), 2 => __("No", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_share_button_page']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; } else { if (!isset($wordbooker_settings['wordbooker_like_button_post'])) { $wordbooker_settings['wordbooker_like_button_post'] = 1; } if (!isset($wordbooker_settings['wordbooker_share_button_post'])) { $wordbooker_settings['wordbooker_share_button_post'] = 1; } echo __('Show Facebook Like/Send for this Post', 'wordbooker') . ' : <select id="wordbooker_like_button_post" name="wordbooker_like_button_post" >'; $arr = array(1 => __("Yes", 'wordbooker'), 2 => __("No", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_like_button_post']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo __('Show Facebook Share for this Post', 'wordbooker') . ' : <select id="wordbooker_share_button_post" name="wordbooker_share_button_post" >'; $arr = array(1 => __("Yes", 'wordbooker'), 2 => __("No", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_share_button_post']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; } echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_comment_put" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_put"]] . ' > ' . __('Push Comments from this post to Facebook', 'wordbooker') . '<br />'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_comment_get" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_get"]] . ' > ' . __('Pull Comments from Facebook for this post', 'wordbooker') . '<br />'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_use_facebook_comments" ' . $checked_flag[$wordbooker_settings["wordbooker_use_facebook_comments"]] . ' > ' . __('Enable Facebook Comments for this post', 'wordbooker') . '<br />'; } else { echo "<p>" . __('Wordbooker Blog level settings are in force', 'wordbooker') . "<br /></p>"; if (isset($wordbooker_settings['wordbooker_allow_publish_select'])) { echo '<input type="hidden" name="crabstick" value="stairwell" />'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_publish_default" ' . $checked_flag[$wordbooker_settings["wordbooker_publish_default"]] . ' > ' . __('Publish This Post to Facebook', 'wordbooker') . '<br />'; #echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_publish_override" '.$checked_flag[$wordbooker_settings["wordbooker_publish_override"]].' >'.__('Force Re-Publish Post to Facebook on Edit (overrides republish window)').'<br />'; } else { echo '<input type="hidden" name="wordbooker_publish_default" value="' . $wordbooker_settings["wordbooker_publish_default"] . '" />'; } } echo '<input type="hidden" name="wordbooker_publish_page_default" value="' . $wordbooker_settings["wordbooker_publish_page_default"] . '" />'; echo '<input type="hidden" name="wordbooker_publish_post_default" value="' . $wordbooker_settings["wordbooker_publish_post_default"] . '" />'; echo '<input type="hidden" name="wordbooker_post_edited" value="yes" />'; }
function wordbooker_post_comments_to_facebook($user_id) { global $wpdb, $user_ID, $table_prefix, $blog_id, $comment_user; $processed_posts = 0; $close_comments = get_option('close_comments_for_old_posts'); $close_days_old = get_option('close_comments_days_old'); $wbuser = wordbooker_get_userdata($user_id); if (strlen($wbuser->access_token) < 20) { wordbooker_debugger("No user session for comment handling ", " ", -2, 9); return 0; } $wordbooker_settings = wordbooker_options(); $comment_structure = $wordbooker_settings['wordbooker_comment_post_format']; $comment_tag = $wordbooker_settings['wordbooker_comment_attribute']; wordbooker_debugger("Auto close comments " . $close_comments, $close_days_old, -2, 98); $sql = "select distinct wp_post_id,fb_post_id from " . WORDBOOKER_POSTCOMMENTS . " where fb_comment_id is null and blog_id=" . $blog_id . " and user_id=" . $user_id . " and in_out is null"; if ($close_comments == 1) { $sql .= " and comment_timestamp > DATE_SUB( CURDATE( ) , INTERVAL " . $close_days_old . " DAY )"; } $rows = $wpdb->get_results($sql); wordbooker_debugger("Blog posts for comment handling : " . $sql, count($rows), -2, 98); foreach ($rows as $row) { wordbooker_debugger("Starting comment handling for WP post " . $row->wp_post_id, $row->fb_post_id, -2, 9); wordbooker_debugger("Starting comment handling for WP post " . $row->wp_post_id, $row->fb_post_id, -3, 9); $wordbooker_post_options = get_post_meta($row->wp_post_id, '_wordbooker_options', true); if (!isset($wordbooker_post_options['wordbooker_comment_put'])) { wordbooker_debugger("Outgoing comment disabled for WP post " . $row->wp_post_id, $row->fb_post_id, -2, 9); wordbooker_debugger("Outgoing comment disabled for WP post " . $row->wp_post_id, $row->fb_post_id, -3, 9); continue; } $sql = "select comment_ID from " . $wpdb->comments . " where comment_post_id=" . $row->wp_post_id . " and comment_approved=1 and comment_id not in (select wp_comment_id from " . WORDBOOKER_POSTCOMMENTS . " where wp_post_id=" . $row->wp_post_id . " and fb_post_id='" . $row->fb_post_id . "' and user_id=" . $user_id . ") and comment_post_id in (select ID from " . $wpdb->posts . " WHERE comment_status='open')"; if ($close_comments == 1) { $sql .= "and comment_post_id in (select ID from " . $wpdb->posts . " WHERE post_date > DATE_SUB( CURDATE( ) , INTERVAL " . $close_days_old . " \nDAY ))"; } $results = $wpdb->get_results($sql); wordbooker_debugger("Comments for processing : " . $sql, count($results), -2, 98); foreach ($results as $result) { $x = 0; $comment_content = parse_wordbooker_comment_attributes($result->comment_ID, $comment_structure, $comment_tag); try { $x = wordbooker_fb_put_comments($row->fb_post_id, $comment_content, $wbuser->access_token); } catch (Exception $e) { $error_msg = $e->getMessage(); $err_no = (int) substr($error_msg, 2, 3); wordbooker_debugger("Failed to post comment to Facebook : " . $error_msg, $row->fb_post_id, -2, 9); wordbooker_debugger("Failed to post comment to Facebook : " . $error_msg, $row->fb_post_id, -3, 9); if ($err_no = 100) { $sql = "delete from " . WORDBOOKER_POSTCOMMENTS . " where fb_post_id='" . $row->fb_post_id . "'"; $wpdb->query($sql); } } if (strlen($x->id) > 2) { $sql = "insert into " . WORDBOOKER_POSTCOMMENTS . " (wp_post_id,fb_post_id,wp_comment_id,fb_comment_id,user_id,blog_id,comment_timestamp,in_out) values (" . $row->wp_post_id . ",'" . $row->fb_post_id . "','" . $result->comment_ID . "','" . $x->id . "'," . $user_id . "," . $blog_id . ",'" . strtotime($result->comment_date) . "','out')"; $wpdb->query($sql); wordbooker_debugger("Posting comment to Facebook Post : " . $row->fb_post_id . " returns", $x->id, -2, 9); wordbooker_debugger("Posting comment to Facebook Post : " . $row->fb_post_id . " returns", $x->id, -3, 9); $processed_posts = $processed_posts + 1; } } wordbooker_debugger("Finished comment handling for WP post " . $row->wp_post_id, $row->fb_post_id, -2, 9); wordbooker_debugger("Finished comment handling for WP post " . $row->wp_post_id, $row->fb_post_id, -3, 9); } return $processed_posts; }