public static function init()
 {
     if (is_null(self::$roost_bbp)) {
         self::$roost_bbp = new self();
         self::add_actions();
     }
     return self::$roost_bbp;
 }
 public static function admin_menu_page()
 {
     $roost_settings = self::roost_settings();
     $app_key = $roost_settings['appKey'];
     $app_secret = $roost_settings['appSecret'];
     if (true === self::roost_active()) {
         $bbPress_active = Roost_bbPress::bbPress_active();
         $roost_active_key = true;
     } else {
         $roost_active_key = false;
     }
     if (true === self::roost_active() && empty($roost_server_settings)) {
         $roost_server_settings = Roost_API::get_server_settings($app_key, $app_secret);
         $roost_stats = Roost_API::get_stats($app_key, $app_secret);
     }
     if (false === self::roost_active() && isset($_GET['roost_token'])) {
         $roost_token = $_GET['roost_token'];
         $roost_token = urldecode($roost_token);
         $logged_in = Roost_API::login(null, null, $roost_token);
         $response = self::complete_login($logged_in, null);
         $first_time = $response['firstTime'];
         $roost_server_settings = $response['server_settings'];
         $roost_stats = $response['stats'];
         $roost_active_key = true;
     }
     if (isset($_POST['roostlogin'])) {
         $roost_user = $_POST['roostuserlogin'];
         $roost_pass = $_POST['roostpasslogin'];
         $logged_in = Roost_API::login($roost_user, $roost_pass, null);
         $response = self::complete_login($logged_in, null);
         if (empty($response['status'])) {
             $roost_sites = $response;
         } else {
             if (!empty($response['firstTime'])) {
                 $first_time = $response['firstTime'];
                 $roost_server_settings = $response['server_settings'];
                 $roost_stats = $response['stats'];
                 $roost_active_key = true;
             } else {
                 $status = $response['status'];
             }
         }
     }
     if (isset($_POST['roostconfigselect'])) {
         $selected_site = $_POST['roostsites'];
         $site = explode('|', $selected_site);
         $response = self::complete_login(null, $site);
         $first_time = $response['firstTime'];
         $roost_server_settings = $response['server_settings'];
         $roost_stats = $response['stats'];
         $roost_active_key = true;
     }
     if (isset($_GET['status'])) {
         $status = urldecode($_GET['status']);
     }
     require_once dirname(plugin_dir_path(__FILE__)) . '/layout/admin.php';
 }
Beispiel #3
0
<?php
/**
 * Plugin Name: Roost Web Push
 * Plugin URI: http://goroost.com/
 * Description: Drive traffic to your website with Safari Mavericks push notifications and Roost.
 * Version: 2.2.0
 * Author: Roost
 * Author URI: http://goroost.com
 * License: GPLv2 or later
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

define( 'ROOST_URL', plugin_dir_url( __FILE__ ) );

require_once( plugin_dir_path( __FILE__ ) . 'includes/class-roost-core.php' );
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-roost-api.php' );
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-roost-bbpress.php' );

Roost::init();

$bbPress_active = Roost_bbPress::bbPress_active();
if ( ! empty( $bbPress_active['present'] ) && ! empty( $bbPress_active['enabled'] ) ) {
    Roost_bbPress::init();
}
 public static function admin_menu_page()
 {
     $roost_settings = self::roost_settings();
     $app_key = $roost_settings['appKey'];
     $app_secret = $roost_settings['appSecret'];
     $chrome_error_dismiss = $roost_settings['chrome_error_dismiss'];
     $cat_args = array('hide_empty' => 0, 'order' => 'ASC');
     $cats = get_categories($cat_args);
     if (true === self::roost_active()) {
         $bbPress_active = Roost_bbPress::bbPress_active();
         $roost_active_key = true;
     } else {
         $roost_active_key = false;
     }
     if (true === self::roost_active() && empty($roost_server_settings)) {
         $roost_server_settings = Roost_API::get_server_settings($app_key, $app_secret);
         $roost_stats = Roost_API::get_stats($app_key, $app_secret);
     }
     if (false === self::roost_active() && isset($_GET['roost_token'])) {
         $roost_token = $_GET['roost_token'];
         $roost_token = urldecode($roost_token);
         $logged_in = Roost_API::login(null, null, $roost_token);
         $response = self::complete_login($logged_in, null);
         $first_time = $response['firstTime'];
         $roost_server_settings = $response['server_settings'];
         $roost_stats = $response['stats'];
         $roost_active_key = true;
     }
     if (isset($_POST['roostlogin'])) {
         $roost_user = $_POST['roostuserlogin'];
         $roost_pass = $_POST['roostpasslogin'];
         $logged_in = Roost_API::login($roost_user, $roost_pass, null);
         $response = self::complete_login($logged_in, null);
         if (empty($response['status'])) {
             $roost_sites = $response;
         } else {
             if (!empty($response['firstTime'])) {
                 $first_time = $response['firstTime'];
                 $roost_server_settings = $response['server_settings'];
                 $roost_stats = $response['stats'];
                 $roost_active_key = true;
             } else {
                 $status = $response['status'];
             }
         }
     }
     if (isset($_POST['roostconfigselect'])) {
         $selected_site = sanitize_text_field($_POST['roostsites']);
         if ('none' === $selected_site) {
             $status = 'You must select a site.';
             $roost_server_settings = null;
             $roost_stats = null;
         } else {
             $site = explode('|', $selected_site);
             $response = self::complete_login(null, $site);
             $first_time = $response['firstTime'];
             $roost_server_settings = $response['server_settings'];
             $roost_stats = $response['stats'];
             $roost_active_key = true;
         }
     }
     if (isset($_GET['status'])) {
         $status = urldecode($_GET['status']);
     }
     require_once dirname(plugin_dir_path(__FILE__)) . '/layout/admin.php';
 }