/**
  * Initializes the class when called upon.
  */
 public function init()
 {
     /** Settings *****************************************************/
     $this->settings = bp_get_option('bp-rbe');
     /** Includes *****************************************************/
     $this->includes();
     /** Constants ****************************************************/
     $this->constants();
     /** Localization *************************************************/
     // we place this here instead of in hooks() because we want to
     // localize even before our requirements are fulfilled
     $this->localization();
     /** Requirements check *******************************************/
     // If requirements are not fulfilled, then throw an admin notice and stop now!
     if (!bp_rbe_is_required_completed($this->settings)) {
         add_action('admin_notices', array(&$this, 'admin_notice'));
         return;
     }
     /** Post-requirements routine ************************************/
     // load inbound provider
     if (bp_rbe_is_inbound()) {
         $this->load_inbound_provider();
     }
     // load the hooks!
     $this->hooks();
 }
    /**
     * Outputs next scheduled run of the (pseudo) cron.
     */
    protected function schedule()
    {
        // only show the following if required fields are filled in correctly
        if (bp_rbe_is_required_completed() && !bp_rbe_is_inbound()) {
            $is_connected = bp_rbe_is_connected();
            ?>
		<h3><?php 
            _e('Connection Info', 'bp-rbe');
            ?>
</h3>

		<p class="<?php 
            echo $is_connected ? 'connected' : 'not-connected';
            ?>
">
			<?php 
            if ($is_connected) {
                ?>
				<?php 
                _e('<strong>Reply By Email</strong> is currently <span>CONNECTED</span> and checking your inbox continuously.', 'bp-rbe');
                ?>
			<?php 
            } else {
                ?>
				<?php 
                _e('<strong>Reply By Email</strong> is currently <span>NOT CONNECTED</span>.  Please refresh the page to initiate a connection.', 'bp-rbe');
                ?>
			<?php 
            }
            ?>
		</p>

	<?php 
        }
    }
Beispiel #3
0
/**
 * BP Reply By Email default extensions.
 *
 * Currently supports BuddyPress Docs and bbPress
 * More to come in the future?
 *
 * @since 1.0-RC1
 */
function bp_rbe_default_extensions()
{
    // if RBE requirements aren't fulfilled, stop now!
    if (!bp_rbe_is_required_completed()) {
        return;
    }
    // BuddyPress Docs
    if (defined('BP_DOCS_VERSION')) {
        require BP_RBE_DIR . '/includes/bp-rbe-extend-bpdocs.php';
        // initialize the BP Docs RBE extension!
        new BP_Docs_Comment_RBE_Extension();
    }
    // bbPress
    if (function_exists('bbpress')) {
        require BP_RBE_DIR . '/includes/bp-rbe-extend-bbpress.php';
        // initialize the bbPress RBE extension!
        new BBP_RBE_Extension();
    }
}
<?php

/**
 * BP Reply By Email Hooks
 *
 * @package BP_Reply_By_Email
 * @subpackage Hooks
 */
// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
// only run the following hooks if requirements are fulfilled
if (bp_rbe_is_required_completed()) {
    // imap mode hooks
    if (!bp_rbe_is_inbound()) {
        // cron - only run on the root blog and if WP cron is not active
        if (bp_is_root_blog() && !defined('DOING_CRON')) {
            add_action('init', 'bp_rbe_should_connect', 20);
            add_action('init', 'bp_rbe_run_inbox_listener', 999);
        }
        // email inbox parsing
        /**
         * In Gmail, imap_delete() moves the email to the "All Mail" folder; it doesn't mark the email for deletion.
         *
         * Note: If you're using Gmail AND you're hooking into the "bp_rbe_imap_no_match" or "bp_rbe_imap_loop" filters,
         *       DO NOT USE imap_mail_move() or imap_mail_copy() as this will F up the message loop.
         *
         *       From my testing, using GMail and imap_mail_move() / imap_mail_copy() will also expunge the email.
         *       (Will need to test non-Gmail IMAP servers.)
         *