public function schedule_omnibar_update()
 {
     if (!wp_get_schedule('idx_omnibar_get_locations')) {
         //refresh omnibar fields once a day
         wp_schedule_event(time(), 'daily', 'idx_omnibar_get_locations');
     }
 }
 /**
  * things to run within WordPress init
  */
 public function init()
 {
     if (!wp_get_schedule(static::schedule)) {
         wp_schedule_event(time(), static::schedule, static::schedule);
     }
     return false;
 }
Beispiel #3
0
function cp_schedule_expire_check()
{
    global $cp_options;
    $recurrance = $cp_options->ad_expired_check_recurrance;
    if (empty($recurrance)) {
        $recurrance = 'daily';
    }
    // clear schedule if prune ads disabled or recurrance set to none
    if (!$cp_options->post_prune || $recurrance == 'none') {
        if (wp_next_scheduled('cp_ad_expired_check')) {
            wp_clear_scheduled_hook('cp_ad_expired_check');
        }
        return;
    }
    // set schedule if does not exist
    if (!wp_next_scheduled('cp_ad_expired_check')) {
        wp_schedule_event(time(), $recurrance, 'cp_ad_expired_check');
        return;
    }
    // re-schedule if settings changed
    $schedule = wp_get_schedule('cp_ad_expired_check');
    if ($schedule && $schedule != $recurrance) {
        wp_clear_scheduled_hook('cp_ad_expired_check');
        wp_schedule_event(time(), $recurrance, 'cp_ad_expired_check');
    }
}
Beispiel #4
0
 public function test_deleteOldAlertsIsScheduledAndUnscheduled()
 {
     $this->plugin->activate();
     $this->assertEquals('twicedaily', wp_get_schedule('better-angels_delete_old_alerts'));
     $this->plugin->deactivate();
     $this->assertFalse(wp_get_schedule('better-angels_delete_old_alerts'));
 }
 function hook_init()
 {
     if (!defined('NEWSLETTER_EXTENSION_UPDATE') || NEWSLETTER_EXTENSION_UPDATE) {
         add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins'));
         add_filter('pre_set_site_transient_update_plugins', array($this, 'hook_pre_set_site_transient_update_plugins'));
     } else {
         add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins_disable'));
     }
     if ($this->options['enabled'] == 1) {
         add_action('newsletter_mandrill_bounce', array($this, 'bounce'));
         if ($this->options['api'] == 1) {
             if (method_exists('Newsletter', 'register_mail_method')) {
                 Newsletter::instance()->register_mail_method(array($this, 'mail'));
             }
         } else {
             add_filter('newsletter_smtp', array($this, 'hook_newsletter_smtp'));
         }
     }
     if (is_admin()) {
         add_action('admin_init', array($this, 'hook_admin_init'));
         add_action('admin_menu', array($this, 'hook_admin_menu'), 100);
         if (isset($_GET['page']) && strpos($_GET['page'], $this->slug . '/') === 0) {
             wp_enqueue_script('jquery-ui-tabs');
             wp_enqueue_style($this->prefix . '_css', plugin_dir_url(__FILE__) . '/admin.css');
         }
         if (!defined('DOING_CRON') || !DOING_CRON) {
             if (wp_get_schedule('newsletter_mandrill_bounce') === false) {
                 wp_schedule_event(time() + 60, 'daily', 'newsletter_mandrill_bounce');
             }
         }
         //            add_filter('plugin_install_action_links', array($this, 'hook_plugin_install_action_links'), 100, 2);
     }
 }
 /**
  * Checks (de)activating the plugin (un)schedules "old" alerts for
  * deletion.
  *
  * It is important for Buoy alerts to be ephemeral in nature, not
  * necessarily stored in a database for a long time. This test is
  * used to make sure that merely activating the plugin is enough
  * to tell the plugin to delete any incident data that was made
  * 48 hours ago (or longer).
  *
  * This test also checks for the inverse: that this scheduled job
  * is automatically removed whenever the plugin is deactivated.
  *
  * Note that this test does *not* ensure the alert data itself is
  * deleted, only that the automatic job scheduler has the correct
  * information.
  *
  * @ticket 21
  */
 public function test_schedule_and_unschedule_delete_old_alerts_hook_on_activation_and_deactivation()
 {
     WP_Buoy_Plugin::activate();
     $this->assertEquals('hourly', wp_get_schedule('buoy_delete_old_alerts', array('-2 days')));
     WP_Buoy_Plugin::deactivate();
     $this->assertFalse(wp_get_schedule('buoy_delete_old_alerts', array('-2 days')));
 }
Beispiel #7
0
 public function scheduleProcessComments()
 {
     $options = get_option($this->prefix . 'settings');
     if (!wp_get_schedule($this->prefix . 'process') && 1 === $options['use_txs_polling']) {
         wp_schedule_event(time(), 'hourly', $this->prefix . 'process');
     }
 }
Beispiel #8
0
 public static function initialisePlugin()
 {
     // NB Network activation will not upgrade a site
     // do upgrade will check current upgrade script version and apply as necessary
     upgrader::checkUpgrade();
     // 2 is required for $file to be populated
     add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'), 10, 2);
     add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
     add_action('wp_head', array(__CLASS__, 'addRssLink'), 100);
     // only include admin files when necessary.
     if (is_admin()) {
         include_once 'settings.php';
         include_once 'postMetaData.php';
         include_once 'categoryMetaData.php';
         settings::addHooks();
         categoryMetaData::addHooks();
         postMetaData::addHooks();
     }
     if (!wp_get_schedule('xmsg_ping')) {
         // ping in 2 hours from when setup.
         wp_schedule_event(time() + 60 * 60 * 2, 'daily', 'xmsg_ping');
     }
     add_action('xmsg_ping', array(__CLASS__, 'doPing'));
     // NB Network activation will not have set up the rules for the site.
     // Check if they exist and then reactivate.
     if (get_option(RULES_OPTION_NAME, null) != RULES_VERSION) {
         add_action('wp_loaded', array(__CLASS__, 'activateRewriteRules'), 99999, 1);
     }
 }
 /**
  * Enabled the sitemap plugin with registering all required hooks
  *
  * @uses add_action Adds actions for admin menu, executing pings and handling robots.txt
  * @uses add_filter Adds filtes for admin menu icon and contexual help
  * @uses GoogleSitemapGeneratorLoader::SetupRewriteHooks() Registeres the rewrite hooks
  * @uses GoogleSitemapGeneratorLoader::CallShowPingResult() Shows the ping result on request
  * @uses GoogleSitemapGeneratorLoader::ActivateRewrite() Writes rewrite rules the first time
  */
 public static function Enable()
 {
     //Register the sitemap creator to wordpress...
     add_action('admin_menu', array(__CLASS__, 'RegisterAdminPage'));
     //Nice icon for Admin Menu (requires Ozh Admin Drop Down Plugin)
     add_filter('ozh_adminmenu_icon', array(__CLASS__, 'RegisterAdminIcon'));
     //Additional links on the plugin page
     add_filter('plugin_row_meta', array(__CLASS__, 'RegisterPluginLinks'), 10, 2);
     //Listen to ping request
     add_action('sm_ping', array(__CLASS__, 'CallSendPing'), 10, 1);
     //Listen to daily ping
     add_action('sm_ping_daily', array(__CLASS__, 'CallSendPingDaily'), 10, 1);
     //Existing page was published
     add_action('publish_post', array(__CLASS__, 'SchedulePing'), 999, 1);
     add_action('publish_page', array(__CLASS__, 'SchedulePing'), 9999, 1);
     add_action('delete_post', array(__CLASS__, 'SchedulePing'), 9999, 1);
     //Robots.txt request
     add_action('do_robots', array(__CLASS__, 'CallDoRobots'), 100, 0);
     //Help topics for context sensitive help
     //add_filter('contextual_help_list', array(__CLASS__, 'CallHtmlShowHelpList'), 9999, 2);
     //Check if the result of a ping request should be shown
     if (!empty($_GET["sm_ping_service"])) {
         self::CallShowPingResult();
     }
     //Fix rewrite rules if not already done on activation hook. This happens on network activation for example.
     if (get_option("sm_rewrite_done", null) != self::$svnVersion) {
         add_action('wp_loaded', array(__CLASS__, 'ActivateRewrite'), 9999, 1);
     }
     //Schedule daily ping
     if (!wp_get_schedule('sm_ping_daily')) {
         wp_schedule_event(time() + 60 * 60, 'daily', 'sm_ping_daily');
     }
 }
 /**
  * Get the data from the transient and/or schedule new data to be retrieved.
  *
  * @param	string	$transient	The name of the transient. Must be 43 characters or less including $this->transient_prefix.
  * @param	string	$hook		The name of the hook to retrieve new data.
  * @param	array	$args		An array of arguments to pass to the function.
  *
  * @return	mixed	Either false or the data from the transient.
  */
 public function get_transient($transient, $hook, $args)
 {
     // Build the transient names.
     $transient = $this->prefix . $transient;
     $fallback_transient = $transient . '_';
     if (is_multisite()) {
         if (false === ($data = get_site_transient($transient))) {
             $data = get_site_transient($fallback_transient);
             if (!wp_get_schedule($hook, $args)) {
                 wp_clear_scheduled_hook($hook, $args);
                 wp_schedule_single_event(time(), $hook, $args);
             }
             return $data;
         } else {
             return $data;
         }
     } else {
         if (false === ($data = get_transient($transient))) {
             $data = get_transient($fallback_transient);
             if (!wp_get_schedule($hook, $args)) {
                 wp_clear_scheduled_hook($hook, $args);
                 wp_schedule_single_event(time(), $hook, $args);
             }
             return $data;
         } else {
             return $data;
         }
     }
 }
 public function get_schedule($cron_id)
 {
     $a = wp_get_schedule('fw_backup_cron', array($cron_id));
     if ($a === false) {
         return 'disabled';
     }
     return $a;
 }
 public function init()
 {
     // get_pung is not restrictive enough
     //add_filter ( 'get_pung', array( &$this, 'get_pung' ) );
     if (!wp_get_schedule(static::cron)) {
         wp_schedule_event(time(), static::cron, static::cron);
     }
 }
 public function feature_on()
 {
     // Already scheduled
     if (false !== wp_get_schedule(self::CRON_NAME)) {
         return;
     }
     // Schedule cron for this plugin.
     wp_schedule_event(time(), 'daily', self::CRON_NAME);
 }
function bpsPro_schedule_DBB_checks()
{
    $bpsDBBCronCheck = wp_get_schedule('bpsPro_DBB_check');
    $DBBoptions = get_option('bulletproof_security_options_db_backup');
    $clock = mktime(date("H", time()), 0, 0, date("n", time()), date("j", time()), date("Y", time()));
    if ($DBBoptions['bps_db_backup'] == 'On') {
        if (!wp_next_scheduled('bpsPro_DBB_check')) {
            wp_schedule_event($clock, 'hourly', 'bpsPro_DBB_check');
        }
    }
}
Beispiel #15
0
function _wpr_schedule_crons_initial()
{
    $cron_schedules = $GLOBALS['wpr_cron_schedules'];
    foreach ($cron_schedules as $cron) {
        if (false == wp_get_schedule($cron['action'], $cron['arguments'])) {
            if (count($cron['arguments']) > 0) {
                wp_schedule_event(time() + 300, $cron['schedule'], $cron['action'], $cron['arguments']);
            } else {
                wp_schedule_event(time() + 300, $cron['schedule'], $cron['action']);
            }
        }
    }
}
 static function reschedule()
 {
     global $ym_crons_that_exist;
     foreach ($ym_crons_that_exist as $cron_job) {
         if ($cron_job['core'] != 2 && wp_get_schedule($cron_job['task'])) {
             // reschedule
             wp_clear_scheduled_hook($cron_job['task']);
             $now = time();
             $next = mktime($cron_job['time'][0], $cron_job['time'][1], 0, date('n', $now), date('j', $now), date('Y', $now));
             // next, schedule, action_name
             wp_schedule_event($next, $cron_job['schedule'], $cron_job['task']);
         }
     }
 }
function clear_cache_for_timber_init()
{
    if (!is_super_admin() || !is_admin_bar_showing() || !class_exists('Timber') || !\Timber::$cache) {
        return;
    }
    //Check if user disable cron task and remove cron task
    if (defined('CLEAR_CACHE_FOR_TIMBER_DISABLE_CRON_JOB_CLEANUP') and CLEAR_CACHE_FOR_TIMBER_DISABLE_CRON_JOB_CLEANUP === true) {
        clear_cache_for_timber_remove_cron_task();
    } else {
        if (wp_get_schedule('clear_cache_for_timber_cron_task') === false) {
            clear_cache_for_timber_add_cron_task();
        }
    }
}
Beispiel #18
0
function _wpr_schedule_crons_initial()
{
    $cron_schedules = $GLOBALS['wpr_cron_schedules'];
    foreach ($cron_schedules as $cron) {
        if (false == wp_get_schedule($cron['action'], $cron['arguments'])) {
            if (count($cron['arguments']) > 0) {
                //check if the cron has already been scheduled
                wp_schedule_event(time(), $cron['schedule'], $cron['action'], $cron['arguments']);
            } else {
                wp_schedule_event(time(), $cron['schedule'], $cron['action']);
            }
        }
    }
}
Beispiel #19
0
 function test_schedule_event_args()
 {
     // schedule an event and make sure it's returned by wp_next_scheduled
     $hook = rand_str();
     $timestamp = strtotime('+1 hour');
     $recur = 'hourly';
     $args = array(rand_str());
     wp_schedule_event($timestamp, 'hourly', $hook, $args);
     // this returns the timestamp only if we provide matching args
     $this->assertEquals($timestamp, wp_next_scheduled($hook, $args));
     // these don't match so return nothing
     $this->assertEquals(false, wp_next_scheduled($hook));
     $this->assertEquals(false, wp_next_scheduled($hook, array(rand_str())));
     $this->assertEquals($recur, wp_get_schedule($hook, $args));
 }
function ao_cachechecker_setup()
{
    $doCacheCheck = (bool) apply_filters('autoptimize_filter_cachecheck_do', true);
    $cacheCheckSchedule = wp_get_schedule('ao_cachechecker');
    if (!$cacheCheckSchedule && $doCacheCheck) {
        $AOCCfreq = apply_filters('autoptimize_filter_cachecheck_frequency', 'daily');
        if (!in_array($AOCCfreq, array('hourly', 'daily', 'monthly'))) {
            $AOCCfreq = 'daily';
        }
        wp_schedule_event(time(), $AOCCfreq, 'ao_cachechecker');
    } else {
        if ($cacheCheckSchedule && !$doCacheCheck) {
            wp_clear_scheduled_hook('ao_cachechecker');
        }
    }
}
 function __construct()
 {
     $options_configs = array('options' => 'aus-telegram-bot_plugin_options', 'plugin_name' => 'AUS Telegram Bot', 'plugin_slug' => 'aus-telegram-bot');
     $AUS_tb_options = new AUS_tb_options($options_configs);
     // Initialize
     $this->init();
     // Add action to schedule telegram_send function
     add_action('aus_telegram_bot_schedule', array($this, 'telegram_send'));
     $this->telegram_send_scheduler();
     // Check if changed the recurrence of scheduled event. If yes unschedule the current and schedule new one.
     $recurrence = wp_get_schedule('aus_telegram_bot_schedule');
     if ($recurrence != $this->options['recurrence']) {
         wp_clear_scheduled_hook('aus_telegram_bot_schedule');
         wp_schedule_event(time(), $this->options['recurrence'], 'aus_telegram_bot_schedule');
     }
 }
Beispiel #22
0
 /**
  * Re-add cron schedule when the settings have been updated
  *
  * @param         array
  * @param unknown $options
  */
 public static function check_schedule($options)
 {
     $old_interval = wp_get_schedule('pv_schedule_mass_payments');
     $new_interval = $options['schedule'];
     $instapay = $options['instapay'];
     /**
      * 1. The user actually changed the schedule
      * 2. Instapay is turned off
      * 3. Manual was not selected
      */
     if ($old_interval != $new_interval && !$instapay && $new_interval != 'manual') {
         WCV_Cron::remove_cron_schedule($options);
         WCV_Cron::schedule_cron($new_interval);
     }
     if ($new_interval == 'manual' || $instapay) {
         WCV_Cron::remove_cron_schedule($options);
     }
 }
 public function __construct()
 {
     if (get_option('st_current_version') != ST_VERSION) {
         // Reset it.
         //$this->st_uninstall(TRUE);
         //$this->st_install(TRUE);
     }
     add_action('admin_menu', array($this, 'admin_menu'));
     add_action('publish_post', array($this, 'admin_submit_post'), 10, 1);
     add_action('admin_head', array($this, 'st_admin_jquery_css'), 10, 1);
     add_action('wp_head', array($this, 'runSocialGraph'));
     if (get_option('st_include_in_posts') == 'yes') {
         add_filter('comments_template', array($this, 'show_social_widgets'));
     }
     if (get_option('st_css_sheet') == TRUE) {
         wp_register_style('SocializeThis', WP_PLUGIN_URL . '/socialize-this/st.css');
         wp_enqueue_style('SocializeThis');
     }
     add_filter('plugin_row_meta', array($this, 'extra_plugin_links'), 10, 2);
     if (get_option('st_extend_php_limits') == TRUE) {
         @ini_set('memory_limit', '256M');
         @ini_set('max_execution_time', '60');
     }
     add_shortcode('socializethis', array($this, 'show_social_widgets'));
     $this->st_url = WP_PLUGIN_URL . '/socialize-this';
     $this->st_imgs = unserialize(get_option('st_imgs'));
     // Set up the Twitter Class
     $consumer_key = '0r2lXhprQxR5tY1XBZhc8g';
     $consumer_secret = 'q0BLVNV2kEtrKYSM4OiRqcYe5xxjUYuStBOwXVjj1ko';
     if (get_option('st_consumer_key') != '' && get_option('st_consumer_secret') != '') {
         $consumer_key = get_option('st_consumer_key');
         $consumer_secret = get_option('st_consumer_secret');
     }
     $this->t = new Twitter($consumer_key, $consumer_secret, get_option('st_oauth_token'), get_option('st_oauth_token_secret'));
     if (get_option('st_url_shortening_service') == 'bitly') {
         $this->bitly = new BitLy(get_option('st_bitly_user'), get_option('st_bitly_apikey'));
     }
     if (wp_get_schedule('updateSocialized') == FALSE) {
         wp_schedule_event(time(), 'hourly', 'updateSocialized');
     }
 }
/**
 * Add / remove cron schedules when settings are saved
 *
 * @since 2.7
 * @return $input array The settings being saved
 */
function eddc_check_schedule($input)
{
    global $edd_options;
    //print_r( $input ); exit;
    $old_interval = wp_get_schedule('eddc_schedule_mass_payments');
    $new_interval = $input['edd_commissions_autopay_schedule'];
    $instapay = $edd_options['edd_commissions_autopay_pa'];
    /**
     * 1. The user actually changed the schedule
     * 2. Instant Pay is turned off
     * 3. Manual was not selected
     */
    if ($old_interval != $new_interval && !$instapay && $new_interval != 'manual') {
        eddc_remove_cron_schedule($options);
        eddc_schedule_cron($new_interval);
    }
    if ($new_interval == 'manual' || $instapay) {
        eddc_remove_cron_schedule($options);
    }
    return $input;
}
 function init()
 {
     global $sitepress;
     $schedule_translation_analytics = wp_get_schedule('icl_send_translation_snapshots');
     $service = $sitepress->get_setting("translation_service");
     if (is_object($service)) {
         if ($schedule_translation_analytics != "") {
             $this->clear_schedule_translation_analytics_snapshot();
         }
         return;
     }
     // If WPML not active, doesn't load the plugin
     if (!$this->is_wpml_active()) {
         return;
     }
     if (is_admin()) {
         if (!defined('DOING_AJAX')) {
             wp_enqueue_script('wpml-ta', WPML_TM_URL . '/res/js/translation-analytics.js', array('jquery'), WPML_TM_VERSION);
             add_action('admin_menu', array($this, 'menu'));
             if (!defined("DOING_AJAX")) {
                 wp_enqueue_script('custom_js', WPML_TM_URL . '/res/js/iframeResizer.min.js', array('jquery'), WPML_TM_VERSION);
             }
         }
         add_action('wp_ajax_icl-toggle-analytics', array($this, 'enable_analytics'));
         add_action('wp_ajax_icl-promote-analytics', array($this, 'promote_analytics'));
         // add_action( 'wpml_before_mce_setup_html', array( $this, 'get_options_menu_dashboard' ));
     }
     if ($sitepress->get_setting('enable_analytics')) {
         $this->load_settings();
         // add message to WPML dashboard widget
         add_action('icl_dashboard_widget_content', array($this, 'icl_dashboard_widget_content'));
         add_action('icl_send_translation_snapshots', array($this, 'send_translation_snapshots'));
         if ($schedule_translation_analytics == "") {
             $this->schedule_translation_analytics_snapshot();
         }
     }
 }
Beispiel #26
0
function autoptimize_uninstall()
{
    autoptimizeCache::clearall();
    $delete_options = array("autoptimize_cache_clean", "autoptimize_cache_nogzip", "autoptimize_css", "autoptimize_css_datauris", "autoptimize_css_justhead", "autoptimize_css_defer", "autoptimize_css_defer_inline", "autoptimize_css_inline", "autoptimize_css_exclude", "autoptimize_html", "autoptimize_html_keepcomments", "autoptimize_js", "autoptimize_js_exclude", "autoptimize_js_forcehead", "autoptimize_js_justhead", "autoptimize_js_trycatch", "autoptimize_version", "autoptimize_show_adv", "autoptimize_cdn_url", "autoptimize_cachesize_notice", "autoptimize_css_include_inline", "autoptimize_js_include_inline", "autoptimize_css_nogooglefont");
    if (!is_multisite()) {
        foreach ($delete_options as $del_opt) {
            delete_option($del_opt);
        }
    } else {
        global $wpdb;
        $blog_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
        $original_blog_id = get_current_blog_id();
        foreach ($blog_ids as $blog_id) {
            switch_to_blog($blog_id);
            foreach ($delete_options as $del_opt) {
                delete_option($del_opt);
            }
        }
        switch_to_blog($original_blog_id);
    }
    if (wp_get_schedule('ao_cachechecker')) {
        wp_clear_scheduled_hook('ao_cachechecker');
    }
}
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"  />&nbsp;&nbsp;&nbsp;<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 '&nbsp;</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">&nbsp;' . __("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">&nbsp;' . __("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">&nbsp;' . __("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">&nbsp;' . __("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">&nbsp;' . __("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">&nbsp;' . __("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">&nbsp;' . __('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">&nbsp;' . __('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">&nbsp;' . __('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">&nbsp;' . __('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">&nbsp;' . __('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">&nbsp;' . __('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">&nbsp;' . __('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">&nbsp;' . __('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">&nbsp;' . __('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">&nbsp;' . __("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">&nbsp;' . __("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">&nbsp;' . __("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">&nbsp;' . __("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">&nbsp;' . __("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">&nbsp;'.__('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'] . '&nbsp;</option>';
                } else {
                    print '<option value="' . $ss . '" >' . $scheds[$ss]['display'] . '&nbsp;</option>';
                }
            }
            echo "</select> ";
            if ($wordbooker_settings['wordbooker_comment_cron'] != 'Never') {
                echo " &nbsp;&nbsp;(" . __("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">&nbsp;&nbsp;' . __("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">&nbsp;&nbsp;' . __("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) . ")&nbsp;&nbsp;";
                        $option .= '</option>';
                    }
                }
                echo $option;
                echo '</select> &nbsp;';
                $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>	&nbsp;<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 '&nbsp;<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) . ")&nbsp;&nbsp;";
                        $option .= '</option>';
                    }
                }
                echo $option;
                echo '</select> &nbsp;';
                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 '&nbsp;<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') . '&nbsp;&nbsp;</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] . "&nbsp;&nbsp;";
                        $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"  />&nbsp;&nbsp;&nbsp;<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();
    }
}
Beispiel #28
0
 public function setCronJobSettings()
 {
     if (wp_next_scheduled($this->slug())) {
         $this->cronJobSettings["period"] = wp_get_schedule($this->slug());
         $this->cronJobSettings["time"] = wp_next_scheduled($this->slug());
     }
 }
/**
 *
 */
function init()
{
    $filters = array('wp_flatexport_txt' => array('txt_insert_spress_frontmatter', 'txt_insert_content', 'normalize_line_ends'), 'wp_flatexport_comment' => array('comment_insert_spress_frontmatter', 'comment_insert_content'));
    foreach ($filters as $for => $subfilters) {
        foreach ($subfilters as $k => $filter) {
            \add_filter($for, "\\WP_FLATEXPORT\\{$filter}", 5 * ($k + 1), 2);
        }
    }
    \add_rewrite_endpoint('text', EP_PERMALINK);
    if (!wp_get_schedule('wp_flatexport')) {
        wp_schedule_event(time(), 'daily', 'wp_flatexport');
    }
}
Beispiel #30
0
    }
}
//subscribers/wp-user synch hooks
add_action('user_register', array('WYSIJA', 'hook_add_WP_subscriber'), 1);
add_action('added_existing_user', array('WYSIJA', 'hook_add_WP_subscriber'), 1);
add_action('profile_update', array('WYSIJA', 'hook_edit_WP_subscriber'), 1);
add_action('delete_user', array('WYSIJA', 'hook_del_WP_subscriber'), 1);
//post notif trigger
add_action('transition_post_status', array('WYSIJA', 'hook_postNotification_transition'), 1, 3);
//add image size for emails
add_image_size('wysija-newsletters-max', 600, 99999);
$modelConf =& WYSIJA::get('config', 'model');
if ($modelConf->getValue('installed_time')) {
    if ($modelConf->getValue('cron_manual')) {
        //if cron queue is still set then unset it
        if (wp_get_schedule('wysija_cron_queue')) {
            WYSIJA::deactivate();
        }
        //set the crons schedule for each process
        WYSIJA::get_cron_schedule();
    } else {
        //filter fixing a bug with automatic load_text_domain_from WP didn't understand yet why this was necessary...
        //somehow wp_register_script(which is irrelevant) was triggerring this kind of notice
        //Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(C:\Domains\website.com\wwwroot\web/wp-content/plugins/C:\Domains\website.com\wwwroot\web\wp-content\plugins\wysija-newsletters/languages/wysija-newsletters-en_US.mo) is not within the allowed path(s): (.;C:\Domains\;C:\PHP\;C:\Sites\;C:\SitesData\;/) in C:\Domains\website.com\wwwroot\web\wp-includes\l10n.php on line 339
        //the only solution is to make sure on our end that the file exists and rewrite it if necessary
        add_filter('override_load_textdomain', array('WYSIJA', 'override_load_textdomain'), 10, 3);
        add_filter('load_textdomain_mofile', array('WYSIJA', 'load_textdomain_mofile'), 10, 2);
        //filter to add new possible frequencies to the cron
        add_filter('cron_schedules', array('WYSIJA', 'filter_cron_schedules'));
        //action to handle the scheduled tasks in wysija
        add_action('wysija_cron_queue', array('WYSIJA', 'croned_queue'));