function __construct() { global $wpdb; // check if a modulous of 5 mintutes and if so add the init hook. $min = date("i"); $this->db =& $wpdb; foreach ($this->tables as $table) { $this->{$table} = autoblog_db_prefix($this->db, $table); } add_filter('wp_feed_cache_transient_lifetime', array(&$this, 'feed_cache'), 10, 2); // override with option. $this->debug = get_autoblog_option('autoblog_debug', false); if (empty($this->db->siteid) || $this->db->siteid == 0) { $this->siteid = 1; } else { $this->siteid = $this->db->siteid; } if (empty($this->db->blogid) || $this->db->blogid == 0) { $this->blogid = 1; } else { $this->blogid = $this->db->blogid; } // Action to be called by the cron job if (defined('AUTOBLOG_PROCESSING_CHECKLIMIT') && AUTOBLOG_PROCESSING_CHECKLIMIT == 10) { $this->checkperiod = '10mins'; } else { $this->checkperiod = '5mins'; } add_action('init', array(&$this, 'set_up_schedule')); //add_action( 'autoblog_process_feeds', array(&$this, 'always_process_autoblog') ); add_filter('cron_schedules', array(&$this, 'add_time_period')); // Add in filter for the_post to add in the source content at the bottom add_filter('the_content', array(&$this, 'append_original_source'), 999, 1); }
function __construct() { global $wpdb; $this->db =& $wpdb; // Installation functions register_activation_hook(__FILE__, array(&$this, 'install')); add_action('plugins_loaded', array(&$this, 'load_textdomain')); add_action('init', array(&$this, 'initialise_plugin')); add_action('load-toplevel_page_autoblog', array(&$this, 'add_admin_header_autoblog')); add_action('load-autoblog_page_autoblog_admin', array(&$this, 'add_admin_header_autoblog_admin')); add_action('load-autoblog_page_autoblog_settings', array(&$this, 'add_admin_header_autoblog_settings')); add_action('load-autoblog_page_autoblog_addons', array(&$this, 'add_admin_header_autoblog_addons')); if (function_exists('is_multisite') && is_multisite()) { if (function_exists('is_network_admin') && is_network_admin()) { add_action('network_admin_menu', array(&$this, 'add_adminmenu')); } else { add_action('admin_menu', array(&$this, 'add_adminmenu')); } } else { add_action('admin_menu', array(&$this, 'add_adminmenu')); } foreach ($this->tables as $table) { $this->{$table} = autoblog_db_prefix($this->db, $table); } // check for installation if (get_autoblog_option('autoblog_installed', 0) < $this->build) { // create the database table $this->install(); } if (empty($this->db->siteid) || $this->db->siteid == 0) { $this->siteid = 1; } else { $this->siteid = $this->db->siteid; } if (empty($this->db->blogid) || $this->db->blogid == 0) { $this->blogid = 1; } else { $this->blogid = $this->db->blogid; } // Instantiate the tooltips class and set the icon $this->_tips = new WpmuDev_HelpTooltips(); $this->_tips->set_icon_url(autoblog_url('autoblogincludes/images/information.png')); }
function AB_handle_repair_panel() { global $action, $page, $wpdb; wp_reset_vars(array('action', 'page')); $messages = array(); $messages[1] = __('Autoblog has been repaired.', 'autoblogtext'); if (isset($_POST['action']) && esc_attr($_POST['action']) == 'repair') { check_admin_referer('update-autoblog-repair'); $sql = $wpdb->prepare("UPDATE " . autoblog_db_prefix($wpdb, 'autoblog') . " SET site_id = 1 WHERE site_id = 0"); $wpdb->query($sql); $sql = $wpdb->prepare("UPDATE " . autoblog_db_prefix($wpdb, 'autoblog') . " SET blog_id = 1 WHERE blog_id = 0"); $wpdb->query($sql); $sql = $wpdb->prepare("UPDATE " . autoblog_db_prefix($wpdb, 'autoblog') . " SET nextcheck = UNIX_TIMESTAMP() WHERE nextcheck < UNIX_TIMESTAMP()"); $wpdb->query($sql); delete_autoblog_option('autoblog_processing'); $msg = 1; } else { $msg = $_GET['msg']; } ?> <div class='wrap nosubsub'> <div class="icon32" id="icon-options-general"><br></div> <h2><?php _e('Autoblog Repair', 'autoblogtext'); ?> </h2> <?php if (isset($msg)) { echo '<div id="message" class="updated fade"><p>' . $messages[(int) $msg] . '</p></div>'; $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']); } ?> <form action='?page=<?php echo $page; ?> ' method='post'> <?php wp_nonce_field('update-autoblog-repair'); ?> <h3><?php _e('Repair the Autoblog feeds', 'autoblogtext'); ?> </h3> <p><?php _e('If Feeds do not show or process then running a repair will reset the relevant id and timestamp fields.', 'autoblogtext'); ?> </p> <p class="submit"> <input type='hidden' name='action' value='repair' /> <input type="submit" name="submit" class="button-primary" value="<?php esc_attr_e('Repair Now', 'autoblogtext'); ?> " /> </p> </form> </div> <!-- wrap --> <?php }