Plugin Directory

Changeset 962489


Ignore:
Timestamp:
08/08/2014 03:55:46 PM (11 years ago)
Author:
noticesoftware
Message:

v2.1.5 - Custom Headlines - Prompt Controls - v4.0 Check

Location:
roost-for-bloggers
Files:
28 added
13 edited

Legend:

Unmodified
Added
Removed
  • roost-for-bloggers/trunk/includes/class-roost-api.php

    r940152 r962489  
    99    public static function roost_remote_request( $remote_data ) {
    1010        $auth_creds = '';
    11         if ( !empty( $remote_data['appkey'] ) ) {
     11        if ( ! empty( $remote_data['appkey'] ) ) {
    1212            $auth_creds = 'Basic ' . base64_encode( $remote_data['appkey'] .':'.$remote_data['appsecret'] );
    1313        }
     
    4646        );
    4747        $response = self::roost_remote_request( $remote_data );
    48         return $response;   
     48        return $response;
    4949    }
    5050   
     
    6464        );
    6565        $response = self::decode_data( $remote_data );
    66         return $response;       
     66        return $response;
    6767    }
    6868
     
    114114        }
    115115
    116         if( !empty( $remote_content ) ) {
     116        if ( ! empty( $remote_content ) ) {
    117117            $remote_data = array(
    118118                'method' => 'PUT',
     
    131131            'alert' => $alert,
    132132        );
    133         if( null === $remote_content['alert'] ) {
     133        if ( null === $remote_content['alert'] ) {
    134134            $remote_content['alert'] = '';
    135135        }
  • roost-for-bloggers/trunk/includes/class-roost-bbpress.php

    r925987 r962489  
    99            'enabled' => $roost_settings['bbPress'],
    1010        );
    11         if( class_exists( 'bbPress' ) ) {
     11        if ( class_exists( 'bbPress' ) ) {
    1212            $bbPress['present'] = true;
    1313        }
     
    1616   
    1717    public function __construct() {
    18         add_action( 'wp_enqueue_scripts', array( $this, 'load_roost_bbp_scripts' ), 1 );
    19 
    20         add_action( 'wp_ajax_roost_bbp_subscribe', array( $this, 'roost_bbp_ajax_subscription' ) );
    21         add_action( 'wp_ajax_nopriv_roost_bbp_subscribe', array( $this, 'roost_bbp_ajax_subscription' ) );
    22         add_action( 'wp_ajax_roost_bbp_unsubscribe', array( $this, 'roost_bbp_ajax_subscription' ) );
    23         add_action( 'wp_ajax_nopriv_roost_bbp_unsubscribe', array( $this, 'roost_bbp_ajax_subscription' ) );
    24 
    25         add_action( 'bbp_theme_before_reply_form_submit_wrapper', array( $this, 'roost_bbp_reply_subscription' ) );
    26         add_action( 'bbp_theme_before_topic_form_submit_wrapper', array( $this, 'roost_bbp_reply_subscription' ) );
    27         add_action( 'bbp_template_before_single_topic', array( $this, 'roost_bbp_topic_subscription' ) );       
    28         add_action( 'bbp_template_before_single_forum', array( $this, 'roost_bbp_forum_subscription' ) );
    29         add_action( 'bbp_get_request', array( $this, 'roost_bbp_subscriptions_handler' ), 1 );
    30         add_action( 'bbp_new_reply', array( $this, 'roost_bbp_subscriptions_handler' ), 1 );
    31         add_action( 'bbp_edit_reply', array( $this, 'roost_bbp_subscriptions_handler' ), 1 );
    32         add_action( 'bbp_new_topic', array( $this, 'roost_bbp_subscriptions_handler' ), 1 );
    33         add_action( 'bbp_edit_topic', array( $this, 'roost_bbp_subscriptions_handler' ), 1 );
    34        
    35         add_action( 'bbp_new_reply', array( $this, 'roost_bbp_notify_subscribers' ), 11, 5 );
    36         add_action( 'bbp_new_topic', array( $this, 'roost_bbp_notify_subscribers' ), 11, 5 );
    37 
    38         add_action( 'bbp_delete_reply', array( $this, 'roost_bbp_remove_all_subscriptions' ) );
    39         add_action( 'bbp_delete_topic', array( $this, 'roost_bbp_remove_all_subscriptions' ) );
    40         add_action( 'bbp_delete_forum', array( $this, 'roost_bbp_remove_all_subscriptions' ) );
    41     }
    42 
    43     public function load_roost_bbp_scripts() {
     18        //blank
     19    }
     20
     21    public static function init() {
     22        add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_roost_bbp_scripts' ), 1 );
     23
     24        add_action( 'wp_ajax_roost_bbp_subscribe', array( __CLASS__, 'roost_bbp_ajax_subscription' ) );
     25        add_action( 'wp_ajax_nopriv_roost_bbp_subscribe', array( __CLASS__, 'roost_bbp_ajax_subscription' ) );
     26        add_action( 'wp_ajax_roost_bbp_unsubscribe', array( __CLASS__, 'roost_bbp_ajax_subscription' ) );
     27        add_action( 'wp_ajax_nopriv_roost_bbp_unsubscribe', array( __CLASS__, 'roost_bbp_ajax_subscription' ) );
     28
     29        add_action( 'bbp_theme_before_reply_form_submit_wrapper', array( __CLASS__, 'roost_bbp_reply_subscription' ) );
     30        add_action( 'bbp_theme_before_topic_form_submit_wrapper', array( __CLASS__, 'roost_bbp_reply_subscription' ) );
     31        add_action( 'bbp_template_before_single_topic', array( __CLASS__, 'roost_bbp_topic_subscription' ) );
     32        add_action( 'bbp_template_before_single_forum', array( __CLASS__, 'roost_bbp_forum_subscription' ) );
     33        add_action( 'bbp_get_request', array( __CLASS__, 'roost_bbp_subscriptions_handler' ), 1 );
     34        add_action( 'bbp_new_reply', array( __CLASS__, 'roost_bbp_subscriptions_handler' ), 1 );
     35        add_action( 'bbp_edit_reply', array( __CLASS__, 'roost_bbp_subscriptions_handler' ), 1 );
     36        add_action( 'bbp_new_topic', array( __CLASS__, 'roost_bbp_subscriptions_handler' ), 1 );
     37        add_action( 'bbp_edit_topic', array( __CLASS__, 'roost_bbp_subscriptions_handler' ), 1 );
     38       
     39        add_action( 'bbp_new_reply', array( __CLASS__, 'roost_bbp_notify_subscribers' ), 11, 5 );
     40        add_action( 'bbp_new_topic', array( __CLASS__, 'roost_bbp_notify_subscribers' ), 11, 5 );
     41
     42        add_action( 'bbp_delete_reply', array( __CLASS__, 'roost_bbp_remove_all_subscriptions' ) );
     43        add_action( 'bbp_delete_topic', array( __CLASS__, 'roost_bbp_remove_all_subscriptions' ) );
     44        add_action( 'bbp_delete_forum', array( __CLASS__, 'roost_bbp_remove_all_subscriptions' ) );
     45    }
     46
     47    public static function load_roost_bbp_scripts() {
    4448        wp_enqueue_script( 'roostbbpjs', ROOST_URL . 'layout/js/roostbbp.js', array('jquery'), Roost::$roost_version, false );
    4549    }
    4650   
    47     public function roost_bbp_reply_subscription( $post ) {
     51    public static function roost_bbp_reply_subscription( $post ) {
    4852        global $post;
    4953        $roost_bbp_subscriptions = get_post_meta( $post->ID, 'roost_bbp_subscription', true );
     
    5660        <script>
    5761            jQuery(document).ready(function($) {
    58                 setTimeout(function(){
    59                     if(window.roostEnabled){
    60                         jQuery('.roost-bbp-reply-subscription-wrap').show();
    61                         jQuery('#roost-bbp-device-token').val(window.roostToken);                       
    62                         <?php
    63                             if ( !empty( $roost_bbp_subscriptions ) ) {
     62                setTimeout( function() {
     63                    if ( window.roostEnabled ){
     64                        jQuery( '.roost-bbp-reply-subscription-wrap' ).show();
     65                        jQuery( '#roost-bbp-device-token' ).val( window.roostToken );
     66                        <?php
     67                            if ( ! empty( $roost_bbp_subscriptions ) ) {
    6468                                $reply_bbp_subscriptions = json_encode( $roost_bbp_subscriptions );
    6569                        ?>
    6670                                var registrations = <?php echo( $reply_bbp_subscriptions ); ?>;
    67                                 if (typeof registrations[window.roostToken] !== 'undefined') {
    68                                     if(registrations[window.roostToken] === true) {
    69                                         jQuery('.roost-bbp-reply-subscription').prop('checked', true);
     71                                if ( 'undefined' !== typeof registrations[window.roostToken] ) {
     72                                    if ( true ==== registrations[window.roostToken] ) {
     73                                        jQuery( '.roost-bbp-reply-subscription' ).prop( 'checked', true );
    7074                                    }
    7175                                }
     
    7478                        ?>
    7579                    }
    76                 }, 1500);
     80                }, 1500 );
    7781            });
    7882        </script>
     
    8084    }
    8185
    82     public function roost_bbp_topic_subscription( $post ) {
     86    public static function roost_bbp_topic_subscription( $post ) {
    8387        global $post;
    8488        $post_id = $post->ID;
     
    9599                var subscribeWrap = $('#roost-subscribe-<?php echo( $post_id ); ?>');
    96100                <?php
    97                     if ( !empty( $roost_bbp_subscriptions ) ) {
     101                    if ( ! empty( $roost_bbp_subscriptions ) ) {
    98102                        $reply_bbp_subscriptions = json_encode( $roost_bbp_subscriptions );
    99103                ?>
    100104                        var registrations = <?php echo( $reply_bbp_subscriptions ); ?>;
    101                 <?php       
     105                <?php
    102106                    } else {
    103107                ?>
     
    108112               
    109113                setTimeout(function(){
    110                     if(window.roostEnabled){
    111                         if (typeof registrations[window.roostToken] !== 'undefined') {
    112                             if(registrations[window.roostToken] === true) {
    113                                 subscribeLink.text('Unsubscribe from Push Notifications');
    114                                 subscribeLink.data('action', 'roost_bbp_unsubscribe');
     114                    if ( window.roostEnabled ){
     115                        if ( 'undefined' !== typeof registrations[window.roostToken] ) {
     116                            if ( true === registrations[window.roostToken] ) {
     117                                subscribeLink.text( 'Unsubscribe from Push Notifications' );
     118                                subscribeLink.data( 'action', 'roost_bbp_unsubscribe' );
    115119                            }
    116120                        } else {
    117                             subscribeLink.text('Subscribe with Push Notifications');
    118                             subscribeLink.data('action', 'roost_bbp_subscribe');
     121                            subscribeLink.text( 'Subscribe with Push Notifications' );
     122                            subscribeLink.data( 'action', 'roost_bbp_subscribe' );
    119123                        }
    120124                        <?php
    121                             if( true === bbp_is_subscriptions_active() && true === is_user_logged_in() ) {
    122                         ?>
    123                             subscribeWrap.detach().appendTo('#subscription-toggle').show();
    124                             subscribeWrap.prepend(' | ');
    125                         <?php
    126                             } else if( true === bbp_is_favorites_active() && true === is_user_logged_in() ) {
    127                         ?>
    128                             subscribeWrap.detach();                       
    129                             subscribeWrap.appendTo('.bbp-header .bbp-reply-content').append(' | ').wrap("<div id='subscription-toggle'></div>").show();
     125                            if ( true === bbp_is_subscriptions_active() && true === is_user_logged_in() ) {
     126                        ?>
     127                            subscribeWrap.detach().appendTo( '#subscription-toggle' ).show();
     128                            subscribeWrap.prepend( ' | ' );
     129                        <?php
     130                            } else if ( true === bbp_is_favorites_active() && true === is_user_logged_in() ) {
     131                        ?>
     132                            subscribeWrap.detach();
     133                            subscribeWrap.appendTo( '.bbp-header .bbp-reply-content' ).append( ' | ' ).wrap( "<div id='subscription-toggle'></div>" ).show();
    130134                        <?php
    131135                            } else {
    132136                        ?>
    133137                            subscribeWrap.detach();
    134                             subscribeWrap.appendTo('.bbp-header .bbp-reply-content').wrap("<div id='subscription-toggle'></div>").show();
     138                            subscribeWrap.appendTo( '.bbp-header .bbp-reply-content' ).wrap( "<div id='subscription-toggle'></div>" ).show();
    135139                        <?php
    136140                            }
     
    139143                }, 1500);
    140144
    141                 subscribeLink.on('click', function(e){
     145                subscribeLink.on( 'click', function( e ){
    142146                    e.preventDefault();
    143147                    var data = {
     
    146150                        roostToken: window.roostToken,
    147151                        postID: subscribeLink.data('post'),
    148                     };                   
    149                     if(subscribeLink.data('action') === 'roost_bbp_subscribe'){
    150                         subscribeLink.text('Unsubscribe from Push Notifications');
    151                         subscribeLink.data('action', 'roost_bbp_unsubscribe');
    152                     } else {
    153                         subscribeLink.text('Subscribe with Push Notifications');
    154                         subscribeLink.data('action', 'roost_bbp_subscribe');
    155                     }
    156 
    157                     $.post(ajaxurl, data, function(response) {
     152                    };
     153                    if ( 'roost_bbp_subscribe' === subscribeLink.data( 'action' ) ){
     154                        subscribeLink.text( 'Unsubscribe from Push Notifications' );
     155                        subscribeLink.data( 'action', 'roost_bbp_unsubscribe' );
     156                    } else {
     157                        subscribeLink.text( 'Subscribe with Push Notifications' );
     158                        subscribeLink.data( 'action', 'roost_bbp_subscribe' );
     159                    }
     160
     161                    $.post( ajaxurl, data, function( response ) {
    158162
    159163                    });
     
    164168    }
    165169   
    166     function roost_bbp_ajax_subscription() {
     170    public static function roost_bbp_ajax_subscription() {
    167171        $post_id = $_POST['postID'];
    168172        self::roost_bbp_subscriptions_handler( $post_id );
     
    170174    }
    171175   
    172     public function roost_bbp_forum_subscription( $post ) {
     176    public static function roost_bbp_forum_subscription( $post ) {
    173177        global $post;
    174178        $post_id = $post->ID;
     
    185189                var subscribeWrap = $('#roost-subscribe-<?php echo( $post_id ); ?>');
    186190                <?php
    187                     if ( !empty( $roost_bbp_subscriptions ) ) {
     191                    if ( ! empty( $roost_bbp_subscriptions ) ) {
    188192                        $reply_bbp_subscriptions = json_encode( $roost_bbp_subscriptions );
    189193                ?>
    190194                        var registrations = <?php echo( $reply_bbp_subscriptions ); ?>;
    191                 <?php       
     195                <?php
    192196                    } else {
    193197                ?>
     
    198202               
    199203                setTimeout(function(){
    200                     if(window.roostEnabled){
    201                         if (typeof registrations[window.roostToken] !== 'undefined') {
    202                             if(registrations[window.roostToken] === true) {
    203                                 subscribeLink.text('Unsubscribe from Push Notifications');
    204                                 subscribeLink.data('action', 'roost_bbp_unsubscribe');
     204                    if ( window.roostEnabled ){
     205                        if ( 'undefined' !== typeof registrations[window.roostToken] ) {
     206                            if ( true === registrations[window.roostToken] ) {
     207                                subscribeLink.text( 'Unsubscribe from Push Notifications' );
     208                                subscribeLink.data( 'action', 'roost_bbp_unsubscribe' );
    205209                            }
    206210                        } else {
    207                             subscribeLink.text('Subscribe with Push Notifications');
    208                             subscribeLink.data('action', 'roost_bbp_subscribe');
     211                            subscribeLink.text( 'Subscribe with Push Notifications' );
     212                            subscribeLink.data( 'action', 'roost_bbp_subscribe' );
    209213                        }
    210214                        <?php
    211                             if( true === bbp_is_subscriptions_active() && true === is_user_logged_in() ) {
    212                         ?>
    213                             subscribeWrap.detach().appendTo('#subscription-toggle').show();
    214                             subscribeWrap.prepend(' | ');
     215                            if ( true === bbp_is_subscriptions_active() && true === is_user_logged_in() ) {
     216                        ?>
     217                            subscribeWrap.detach().appendTo( '#subscription-toggle' ).show();
     218                            subscribeWrap.prepend( ' | ' );
    215219                        <?php
    216220                            } else {
    217221                        ?>
    218                             subscribeWrap.wrap("<div id='subscription-toggle'></div>").show();
     222                            subscribeWrap.wrap( "<div id='subscription-toggle'></div>" ).show();
    219223                        <?php
    220224                            }
     
    223227                }, 1500);
    224228
    225                 subscribeLink.on('click', function(e){
     229                subscribeLink.on( 'click', function( e ){
    226230                    e.preventDefault();
    227231                    var data = {
    228                         link: subscribeLink.attr('href'),
    229                         action: subscribeLink.data('action'),
     232                        link: subscribeLink.attr( 'href' ),
     233                        action: subscribeLink.data( 'action' ),
    230234                        roostToken: window.roostToken,
    231                         postID: subscribeLink.data('post'),
    232                     };                   
    233                     if(subscribeLink.data('action') === 'roost_bbp_subscribe'){
    234                         subscribeLink.text('Unsubscribe from Push Notifications');
    235                         subscribeLink.data('action', 'roost_bbp_unsubscribe');
    236                     } else {
    237                         subscribeLink.text('Subscribe with Push Notifications');
    238                         subscribeLink.data('action', 'roost_bbp_subscribe');
    239                     }
    240 
    241                     $.post(ajaxurl, data, function(response) {
     235                        postID: subscribeLink.data( 'post' ),
     236                    };
     237                    if ( 'roost_bbp_subscribe' === subscribeLink.data( 'action' ) ){
     238                        subscribeLink.text( 'Unsubscribe from Push Notifications' );
     239                        subscribeLink.data( 'action', 'roost_bbp_unsubscribe' );
     240                    } else {
     241                        subscribeLink.text( 'Subscribe with Push Notifications' );
     242                        subscribeLink.data( 'action', 'roost_bbp_subscribe' );
     243                    }
     244
     245                    $.post( ajaxurl, data, function( response ) {
    242246
    243247                    });
     
    248252    }
    249253   
    250     public function roost_bbp_subscriptions_handler( $post_id ) {
    251         if( isset( $_POST['roostToken'] ) ) {
     254    public static function roost_bbp_subscriptions_handler( $post_id ) {
     255        if ( isset( $_POST['roostToken'] ) ) {
    252256            $action = $_POST['action'];
    253257            $roost_device_token = $_POST['roostToken'];
    254         } elseif( isset( $_POST['roost-bbp-device-token'] ) ) {
     258        } elseif ( isset( $_POST['roost-bbp-device-token'] ) ) {
    255259            $action = false;
    256260            $roost_device_token = $_POST['roost-bbp-device-token'];
     
    259263        }
    260264
    261         if( ( !empty( $roost_device_token ) ) && ( false === $action ) ) {
    262             if( isset( $_POST['roost-bbp-subscription'] ) ) {
     265        if ( ( ! empty( $roost_device_token ) ) && ( false === $action ) ) {
     266            if ( isset( $_POST['roost-bbp-subscription'] ) ) {
    263267                $roost_bbp_subscription = true;
    264268            } else {
     
    267271
    268272            $subscriptions = get_post_meta( $post_id, 'roost_bbp_subscription', true );
    269             if( !empty( $subscriptions )  ) {
     273            if ( ! empty( $subscriptions )  ) {
    270274                if ( isset( $subscriptions[$roost_device_token] ) ) {
    271                     if( true === $roost_bbp_subscription ) {
     275                    if ( true === $roost_bbp_subscription ) {
    272276                        return;
    273277                    } else {
     
    275279                    }
    276280                } else {
    277                     if( true === $roost_bbp_subscription ) {
     281                    if ( true === $roost_bbp_subscription ) {
    278282                        $subscriptions[$roost_device_token] = $roost_bbp_subscription;
    279283                    }
     
    287291        }
    288292
    289         if( ( !empty( $roost_device_token ) ) && ( 'roost_bbp_subscribe' === $action ) ) {
     293        if ( ( ! empty( $roost_device_token ) ) && ( 'roost_bbp_subscribe' === $action ) ) {
    290294            $subscriptions = get_post_meta( $post_id, 'roost_bbp_subscription', true );
    291             if( !empty( $subscriptions )  ) {
     295            if ( ! empty( $subscriptions )  ) {
    292296                $subscriptions[$roost_device_token] = true;
    293297            } else {
     
    299303        }
    300304
    301         if( ( !empty( $roost_device_token ) ) && ( 'roost_bbp_unsubscribe' === $action ) ) {
     305        if ( ( ! empty( $roost_device_token ) ) && ( 'roost_bbp_unsubscribe' === $action ) ) {
    302306            $subscriptions = get_post_meta( $post_id, 'roost_bbp_subscription', true );
    303307            unset( $subscriptions[$roost_device_token] );
    304308            update_post_meta( $post_id, 'roost_bbp_subscription', $subscriptions );
    305         }       
    306     }
    307    
    308     public function roost_bbp_remove_all_subscriptions( $action ) {
     309        }
     310    }
     311   
     312    public static function roost_bbp_remove_all_subscriptions( $action ) {
    309313        delete_post_meta( $action, 'roost_bbp_subscription' );
    310314    }
    311315   
    312     public function roost_bbp_notify_subscribers( $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author = 0 ) {
     316    public static function roost_bbp_notify_subscribers( $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author = 0 ) {
    313317        $topic_id = bbp_get_topic_id( $topic_id );
    314318        $forum_id = bbp_get_forum_id( $forum_id );
     
    320324        $topic_title   = bbp_get_topic_title( $topic_id );
    321325        $topic_url     = get_permalink( $topic_id );
    322         if( isset( $_POST['bbp_reply_to'] ) ) {
     326        if ( isset( $_POST['bbp_reply_to'] ) ) {
    323327            $reply_to_id = $_POST['bbp_reply_to'];
    324328        }
     
    330334        $message = 'New Post in ' . $topic_title;
    331335       
    332         if( !empty( $reply_to_id ) ) {
     336        if ( ! empty( $reply_to_id ) ) {
    333337            $reply_subscriptions = get_post_meta( $reply_to_id, 'roost_bbp_subscription', true );
    334338        }
     
    337341        $forum_subscriptions = get_post_meta( $forum_id, 'roost_bbp_subscription', true );
    338342
    339         if( !empty( $reply_subscriptions ) ) {
     343        if ( ! empty( $reply_subscriptions ) ) {
    340344            $device_tokens = array();
    341345            foreach( $reply_subscriptions as $token => $active ) {
     
    344348        }
    345349       
    346         if( !empty( $topic_subscriptions ) ) {
    347             if( empty( $device_tokens ) ) {
     350        if ( ! empty( $topic_subscriptions ) ) {
     351            if ( empty( $device_tokens ) ) {
    348352                $device_tokens = array();
    349353            }
     
    353357        }
    354358
    355         if( !empty( $forum_subscriptions ) ) {
    356             if( empty( $device_tokens ) ) {
     359        if ( ! empty( $forum_subscriptions ) ) {
     360            if ( empty( $device_tokens ) ) {
    357361                $device_tokens = array();
    358362            }
     
    362366        }
    363367       
    364         if( empty( $device_tokens) ) {
     368        if ( empty( $device_tokens) ) {
    365369            return;
    366370        }
    367371        Roost_API::send_notification( $message, $topic_url, null, $app_key, $app_secret, $device_tokens );
    368     }   
     372    }
    369373}
  • roost-for-bloggers/trunk/includes/class-roost-core.php

    r943608 r962489  
    33class Roost {
    44
    5     public function __construct() {
    6         $this->add_actions();
    7     }
    8    
    9     public static function init() {
    10         self::install();
    11     }   
    12 
    13     public static $roost_version = '2.1.4';
    14    
    15     protected static $database_version = 1407;
    16    
     5    public static $roost_version = '2.1.5';
     6
     7    protected static $database_version = 1408;
     8
    179    public static function site_url() {
    1810        return get_option( 'siteurl' );
    1911    }
    20    
     12
    2113    public static function registration_url() {
    2214        $tld = 'https://go.goroost.com/signup?returnURL=';
    23         $admin_path = admin_url('admin.php?page=roost-web-push');
     15        $admin_path = admin_url( 'admin.php?page=roost-web-push' );
    2416        $url = $tld . urlencode( $admin_path . '&source=wpplugin' );
    2517        return $url;
     
    2820    public static function login_url( $sso ) {
    2921        $tld = 'https://go.goroost.com/login?returnURL=';
    30         $admin_path = admin_url('admin.php?page=roost-web-push');
     22        $admin_path = admin_url( 'admin.php?page=roost-web-push' );
    3123        $url = $tld . urlencode( $admin_path );
    3224        $url = $url . '&oauth=' . $sso;
    3325        return $url;
    3426    }
    35    
     27
    3628    public static function roost_settings() {
    37         return get_option('roost_settings');   
    38     }
    39    
    40     public static function install() {
     29        return get_option( 'roost_settings' );
     30    }
     31
     32    public function __construct() {
     33        //blank
     34    }
     35
     36    public static function init() {
     37        self::add_actions();
    4138        $roost_settings = self::roost_settings();
    42        
     39        if ( empty( $roost_settings ) || ( self::$roost_version !== $roost_settings['version'] ) ) {
     40            self::install( $roost_settings );
     41        }
     42    }
     43
     44    public static function install( $roost_settings ) {
    4345        if ( empty( $roost_settings ) ) {
    4446            $roost_settings = array(
     
    4850                'autoPush' => 0,
    4951                'bbPress' => 1,
    50             );         
    51             add_option('roost_settings', $roost_settings);
     52                'database_version' => self::$database_version,
     53                'prompt_min' => 0,
     54                'prompt_visits' => 1,
     55                'prompt_event' => 0,
     56            );
     57            add_option( 'roost_settings', $roost_settings );
    5258        }
    53         if( self::$roost_version !== $roost_settings['version'] ) {
     59        if ( self::$roost_version !== $roost_settings['version'] ) {
    5460            self::update( $roost_settings );
    5561        }
    56         self::roost_activated();
    5762    }
    5863
    5964    public static function update( $roost_settings ) {
    6065        $roost_settings['version'] = self::$roost_version;
    61         update_option('roost_settings', $roost_settings);       
    62         if( empty( $roost_settings['database_version'] ) || $roost_settings['database_version'] < self::$database_version ) {
     66        update_option( 'roost_settings', $roost_settings );
     67        if ( empty( $roost_settings['database_version'] ) || $roost_settings['database_version'] < self::$database_version ) {
    6368            self::update_database( $roost_settings );
    6469        }
     
    6671   
    6772    protected static function update_database( $roost_settings ) {
    68         if( empty( $roost_settings['database_version'] ) ) {
    69             $roost_settings['database_version'] = 1407;
    70             if( empty( $roost_settings['bbPress'] ) ) {
     73        if ( empty( $roost_settings['database_version'] ) || ( 1407 === $roost_settings['database_version'] ) ) {
     74            if ( empty( $roost_settings['bbPress'] ) ) {
    7175                $roost_settings['bbPress'] = 1;
    7276            }
    73         }
     77            $roost_settings['prompt_min'] = 0;
     78            $roost_settings['prompt_visits'] = 1;
     79            $roost_settings['prompt_event'] = 0;
     80        }
     81        $roost_settings['database_version'] = self::$database_version;
    7482        update_option('roost_settings', $roost_settings);
    7583    }
    76    
    77     public static function roost_activated() {
    78         add_option('roost_do_redirect', true);
    79     }
    80 
    81     public function activate_redirect() {
    82         if ( get_option('roost_do_redirect', false) ) {
    83             delete_option('roost_do_redirect');
    84             if( !isset( $_GET['activate-multi'] ) ){
     84
     85    public static function activate_redirect() {
     86        $redirect_state = get_option( 'roost_redirected' );
     87        if ( empty( $redirect_state ) ) {
     88            update_option( 'roost_redirected', true );
     89            if ( ! isset( $_GET['activate-multi'] ) ){
    8590                wp_redirect( admin_url( 'admin.php?page=roost-web-push' ) );
    8691                exit;
     
    8893        }
    8994    }
    90    
    91     public static function uninstall(){
    92         delete_option('roost_settings');
    93         delete_post_meta_by_key( 'roostOverride' );
    94         delete_post_meta_by_key( 'roostForce' );
    95         delete_post_meta_by_key( 'roost_bbp_subscription' );
    96     }
    97 
    98     public function add_actions() {
    99         add_action( 'transition_post_status', array( $this, 'build_note' ), 10, 3 );
    100         add_action( 'post_submitbox_misc_actions', array( $this, 'note_override' ) );
    101         add_action( 'wp_head', array( $this, 'byline' ), 1 );
    102         add_action( 'wp_footer', array( $this, 'roostJS' ) );
    103         add_action( 'save_post', array( $this, 'save_post_meta_roost' ) );
    104         add_filter( 'clean_url', array( $this, 'add_async' ), 2, 1 );
    105         add_action( 'wp_ajax_graph_reload', array( $this, 'graph_reload' ) );
    106         add_action( 'wp_ajax_nopriv_graph_reload', array( $this, 'graph_reload' ) );
    107         add_action( 'wp_ajax_subs_check', array( $this, 'subs_check' ) );
    108         add_action( 'wp_ajax_nopriv_subs_check', array( $this, 'subs_check' ) );
    109        
     95
     96    public static function add_actions() {
     97        add_action( 'wp_head', array( __CLASS__, 'byline' ), 1 );
     98        add_action( 'wp_footer', array( __CLASS__, 'roostJS' ) );
     99        add_filter( 'clean_url', array( __CLASS__, 'add_async' ), 2, 1 );
     100               
    110101        if ( is_admin() ) {
    111             add_filter( 'plugin_action_links_roost-for-bloggers/roost.php', array( $this, 'add_action_links' ) );
    112             add_action( 'admin_init', array( $this, 'activate_redirect' ) );
    113             add_action( 'admin_init', array( $this, 'roost_logout' ) );
    114             add_action( 'admin_init', array( $this, 'manual_send' ) );
    115             add_action( 'admin_notices', array( $this, 'setup_notice' ) );
     102            add_filter( 'plugin_action_links_roost-for-bloggers/roost.php', array( __CLASS__, 'add_action_links' ) );
     103            add_action( 'admin_init', array( __CLASS__, 'activate_redirect' ) );
     104            add_action( 'admin_init', array( __CLASS__, 'roost_logout' ) );
     105            add_action( 'admin_init', array( __CLASS__, 'roost_save_settings' ) );
     106            add_action( 'admin_init', array( __CLASS__, 'manual_send' ) );
     107            add_action( 'admin_notices', array( __CLASS__, 'setup_notice' ) );
    116108            add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_scripts' ) );
    117             add_action( 'admin_menu', array( $this, 'admin_menu_add' ) );
    118         }
    119     }
    120 
    121     public function add_action_links ( $links ) {
     109            add_action( 'admin_menu', array( __CLASS__, 'admin_menu_add' ) );
     110            add_action( 'wp_ajax_graph_reload', array( __CLASS__, 'graph_reload' ) );
     111            add_action( 'wp_ajax_remove_headline', array( __CLASS__, 'remove_headline' ) );
     112            add_action( 'wp_ajax_subs_check', array( __CLASS__, 'subs_check' ) );
     113            add_action( 'wp_ajax_nopriv_subs_check', array( __CLASS__, 'subs_check' ) );
     114            add_action( 'post_submitbox_misc_actions', array( __CLASS__, 'note_override' ) );
     115            add_action( 'add_meta_boxes_post', array( __CLASS__, 'custom_note_text' ) );
     116            add_action( 'save_post', array( __CLASS__, 'save_post_meta_roost' ) );
     117            add_action( 'transition_post_status', array( __CLASS__, 'build_note' ), 10, 3 );
     118        }
     119    }
     120
     121    public static function add_action_links ( $links ) {
    122122        $rlink = array(
    123123            '<a href="' . admin_url( 'admin.php?page=roost-web-push' ) . '">Go to Plugin</a>',
     
    126126    }
    127127
    128     public function add_async( $url ) {
     128    public static function add_async( $url ) {
    129129        if ( false === strpos( $url, '#async' ) ) {
    130130            return $url;
     
    136136    }
    137137
    138     public function byline() {
     138    public static function byline() {
    139139        $byline = "<!-- Push notifications for this website enabled by Roost. Support for Safari, Firefox, and Chrome Browser Push. (v ". self::$roost_version .") - http://goroost.com/ -->";
    140140        echo "\n${byline}\n";
    141141    }
    142142
    143     public function roostJS() {
     143    public static function roostJS() {
    144144        $roost_settings = self::roost_settings();
    145145        $app_key = $roost_settings['appKey'];
     146        if ( ! empty( $app_key ) ) {
    146147    ?>
    147         <script>var _roost = _roost || [];_roost.push(['appkey','<?php echo( $app_key ); ?>']);</script><noscript><a href="https://goroost.com/site-contact?noscript&appkey=<?php echo($app_key); ?>" title="Contact Us" target="_blank">Questions or feedback? Need help?</a> powered by <a href="https://goroost.com" title="Roost Web Push">Roost - Push notifications for websites</a></noscript><script src="//cdn.goroost.com/js/roost.js" async></script>
     148            <script>var _roost = _roost || [];_roost.push(['appkey','<?php echo( $app_key ); ?>']);</script><noscript><a href="https://goroost.com/site-contact?noscript&appkey=<?php echo( $app_key ); ?>" title="Contact Us" target="_blank">Questions or feedback? Need help?</a> powered by <a href="https://goroost.com" title="Roost Web Push">Roost - Push notifications for websites</a></noscript><script src="//cdn.goroost.com/js/roost.js" async></script>
     149        <?php
     150            if ( ( true === $roost_settings['prompt_min'] ) || ( true === $roost_settings['prompt_event'] ) ) {
     151        ?>
     152                <script>
     153                    _roost.push( [ 'autoprompt', false ] );
     154                    <?php
     155                        if ( true == $roost_settings['prompt_min'] ) {
     156                    ?>
     157                        _roost.push( [ 'minvisits', <?php echo( $roost_settings['prompt_visits'] ); ?> ] );
     158                    <?php
     159                        }
     160                        if ( true === $roost_settings['prompt_event'] ) {
     161                    ?>
     162                            ( function( $ ) {
     163                                $( '.roost-prompt-wp' ).on( 'click', function( e ) {
     164                                    e.preventDefault();
     165                                    _roost.prompt();
     166                                });
     167                                _roost.push(['onload', function(data){
     168                                    if ( false === data.promptable ) {
     169                                        $( '.roost-prompt-wp' ).hide();
     170                                    }
     171                                }]);
     172                                _roost.push(['onresult', function(data){
     173                                    if ( true === data.registered ) {
     174                                        $( '.roost-prompt-wp' ).hide();
     175                                    }
     176                                }]);
     177                            })( jQuery );
     178                    <?php
     179                        }
     180                    ?>
     181                </script>
    148182    <?php
    149     }
    150    
     183            }
     184        }
     185    }
     186
    151187    public static function setup_notice() {
    152188        global $hook_suffix;
     
    156192        $app_key = $roost_settings['appKey'];
    157193
    158         if ( !$app_key && ( $hook_suffix !== $roost_page ) ) {
     194        if ( ! $app_key && ( $hook_suffix !== $roost_page ) ) {
    159195    ?>
    160         <div class="updated" id="roostSetupNotice">
    161             <div id="roostNoticeLogo">
     196        <div class="updated" id="roost-setup-notice">
     197            <div id="roost-notice-logo">
    162198                <img src="<?php echo( ROOST_URL . 'layout/images/roost_logo.png' ) ?>" />
    163199            </div>
    164             <div id="roostNoticeText">
     200            <div id="roost-notice-text">
    165201                <p>
    166202                    Thanks for installing the Roost plugin! You’re almost finished with<br />setup, all you need to do is create an account and login.
    167203                </p>
    168204            </div>
    169             <div id="roostNoticeTarget">
    170                 <a href="<?php echo( admin_url( 'admin.php?page=roost-web-push' ) ); ?>" id="roostNoticeCTA" >
    171                     <span id="roostNoticeCTAHighlight"></span>
     205            <div id="roost-notice-target">
     206                <a href="<?php echo( admin_url( 'admin.php?page=roost-web-push' ) ); ?>" id="roost-notice-CTA" >
     207                    <span id="roost-notice-CTA-highlight"></span>
    172208                    Finish Setup
    173209                </a>
    174210            </div>
    175         </div>   
     211        </div>
    176212    <?php
    177         } else if ( !$app_key && ( $hook_suffix === $roost_page ) ) {
     213        } else if ( ! $app_key && ( $hook_suffix === $roost_page ) ) {
    178214            $api_check = Roost_API::api_check();
    179215            if ( is_wp_error( $api_check ) ) {
     
    185221    }
    186222
    187     public function admin_menu_add(){
     223    public static function admin_menu_add(){
    188224        add_menu_page(
    189225            'Roost Web Push',
     
    194230            ROOST_URL . 'layout/images/roost_thumb.png'
    195231        );
    196     }   
     232    }
    197233
    198234    public static function admin_scripts() {
     
    201237        $roost_settings = self::roost_settings();
    202238        $app_key = $roost_settings['appKey'];
    203         if ( !empty( $app_key ) ) {
     239        if ( ! empty( $app_key ) ) {
    204240            wp_enqueue_style( 'morrisstyle', '//s3.amazonaws.com/roost/plugins/morris-0.4.3.min.css', '', self::$roost_version );
    205             wp_enqueue_script( 'morrisscript', '//s3.amazonaws.com/roost/plugins/morris-0.4.3.min.js', array('jquery', 'raphael'), self::$roost_version );
    206             wp_enqueue_script( 'raphael', '//s3.amazonaws.com/roost/plugins/raphael-min-2.1.0.js', array('jquery'), self::$roost_version );
    207             wp_enqueue_script( 'roostscript', ROOST_URL . 'layout/js/roostscript.js', array('jquery'), self::$roost_version, true );
     241            wp_enqueue_script( 'morrisscript', '//s3.amazonaws.com/roost/plugins/morris-0.4.3.min.js', array( 'jquery', 'raphael' ), self::$roost_version );
     242            wp_enqueue_script( 'raphael', '//s3.amazonaws.com/roost/plugins/raphael-min-2.1.0.js', array( 'jquery' ), self::$roost_version );
     243            wp_enqueue_script( 'roostscript', ROOST_URL . 'layout/js/roostscript.js', array( 'jquery' ), self::$roost_version, true );
    208244        }
    209245    }
     
    220256        $roost_settings['autoPush'] = $form_data['autoPush'];
    221257        $roost_settings['bbPress'] = $form_data['bbPress'];
     258        $roost_settings['prompt_min'] = $form_data['prompt_min'];
     259        $roost_settings['prompt_visits'] = $form_data['prompt_visits'];
     260        $roost_settings['prompt_event'] = $form_data['prompt_event'];
    222261        update_option('roost_settings', $roost_settings);
    223262    }
    224263
    225     public function save_post_meta_roost( $post_id ) {
    226         if ( ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) || empty( $_POST['hiddenRooster'] ) ) {
     264    public static function save_post_meta_roost( $post_id ) {
     265        if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || empty( $_POST['hiddenRooster'] ) ) {
    227266            return false;
    228267        } else {
    229268            $no_note = get_post_meta( $post_id, 'roostOverride', true );
    230269            $send_note = get_post_meta( $post_id, 'roostForce', true );
    231             if ( isset( $_POST['roostOverride'] ) && !$no_note ) {
     270            if ( isset( $_POST['roostOverride'] ) && ! $no_note ) {
    232271                $override_setting = $_POST['roostOverride'];
    233                 add_post_meta($post_id, 'roostOverride', $override_setting, true);
    234             } elseif ( !isset( $_POST['roostOverride'] ) && $no_note ) {
     272                add_post_meta( $post_id, 'roostOverride', $override_setting, true );
     273            } elseif ( ! isset( $_POST['roostOverride'] ) && $no_note ) {
    235274                delete_post_meta( $post_id, 'roostOverride' );
    236275            }
    237             if ( isset( $_POST['roostForce'] ) && !$send_note ) {
     276            if ( isset( $_POST['roostForce'] ) && ! $send_note ) {
    238277                $override_setting = $_POST['roostForce'];
    239278                add_post_meta( $post_id, 'roostForce', $override_setting, true );
    240             } elseif ( !isset( $_POST['roostForce'] ) && $send_note ) {
     279            } elseif ( ! isset( $_POST['roostForce'] ) && $send_note ) {
    241280                delete_post_meta( $post_id, 'roostForce' );
     281            }
     282            if ( isset( $_POST['custom-note-text'] ) ) {
     283                update_post_meta( $post_id, 'roost_custom_note_text', $_POST['custom-note-text'] );
    242284            }
    243285        }
     
    257299    }
    258300
    259     public function build_note( $new_status, $old_status, $post ) {
    260         if ( $new_status != $old_status && !empty( $post ) ) {
     301    public static function build_note( $new_status, $old_status, $post ) {
     302        if ( $new_status != $old_status && ! empty( $post ) ) {
    261303            $post_type = get_post_type( $post );
    262304            if ( 'post' === $post_type && 'publish' === $new_status ) {
     
    267309                $auto_push = $roost_settings['autoPush'];
    268310               
    269                 if ( !empty( $app_key ) ) {
     311                if ( ! empty( $app_key ) ) {
    270312                    if ( ( 'publish' === $new_status && 'future' === $old_status ) || empty( $_POST['hiddenRooster'] ) ) {
    271313                        $override = get_post_meta( $post_id, 'roostOverride', true );
     
    275317                            $override = $_POST['roostOverride'];
    276318                        }
    277                         if( isset( $_POST['roostForce'] ) ) {
     319                        if ( isset( $_POST['roostForce'] ) ) {
    278320                            $send_note = $_POST['roostForce'];
    279321                        }
    280322                    }
    281323                }
    282                 if ( ( 1 == $auto_push || !empty( $send_note ) ) && !empty( $app_key ) ) {
     324                if ( ( 1 == $auto_push || ! empty( $send_note ) ) && ! empty( $app_key ) ) {
    283325                    if ( empty( $override ) ) {
    284                         $alert = get_the_title( $post_id );
     326                        if ( ! empty( $_POST['custom-note-text'] ) && strlen( $_POST['custom-note-text'] ) > 3 ) {
     327                            $alert = $_POST['custom-note-text'];
     328                        } else {
     329                            $alert = get_the_title( $post_id );
     330                        }
    285331                        $url = wp_get_shortlink( $post_id );
    286                         if ( has_post_thumbnail($post_id)) {
    287                             $raw_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id));
     332                        if ( has_post_thumbnail( $post_id ) ) {
     333                            $raw_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ) );
    288334                            $image_url = $raw_image[0];
    289335                        } else {
    290336                            $image_url = null;
    291337                        }
    292                         Roost_API::send_notification($alert, $url, $image_url, $app_key, $app_secret, null );
     338                        Roost_API::send_notification( $alert, $url, $image_url, $app_key, $app_secret, null );
    293339                    }
    294340                }
     
    297343    }
    298344
    299     public function note_override(){
     345    public static function note_override() {
    300346        global $post;
    301347        if ( 'post' === $post->post_type ) {
    302             if ( 'publish' == $post->post_status ) {
    303                 $check_hidden = true;   
    304             }         
     348            if ( 'publish' === $post->post_status ) {
     349                $check_hidden = true;
     350            }
    305351            $roost_settings = self::roost_settings();
    306352            $app_key = $roost_settings['appKey'];
    307353            $auto_push = $roost_settings['autoPush'];
    308             if ( !empty( $app_key ) ) {
    309                 printf('<div class="misc-pub-section misc-pub-section-last" id="roost-post-checkboxes" %s >', ( isset( $check_hidden ) ) ? "style='display:none;'":"" );
     354            if ( ! empty( $app_key ) ) {
     355                printf('<div class="misc-pub-section misc-pub-section-last" id="roost-post-checkboxes" %s >', ( isset( $check_hidden ) ) ? 'style="display:none;"' : '' );
    310356                $pid = get_the_ID();
    311                 if( 1 == $auto_push ) {
     357                if ( 1 == $auto_push ) {
    312358                    $checked = get_post_meta($pid, 'roostOverride', true);
    313                     printf('<label><input type="checkbox" value="1" id="roost-override-checkbox" name="roostOverride" %s />', ( !empty( $checked ) ) ? "checked":"" );
     359                    printf('<label><input type="checkbox" value="1" id="roost-override-checkbox" name="roostOverride" %s />', ( ! empty( $checked ) ) ? 'checked="checked"' : '' );
    314360                    echo '<strong>Do NOT</strong> send notification with <strong>Roost</strong></label>';
    315361                } else {
    316362                    $checked = get_post_meta($pid, 'roostForce', true);
    317                     printf('<label><input type="checkbox" value="1" id="roost-forced-checkbox" name="roostForce" %s />', ( !empty( $checked ) ) ? "checked":"" );
     363                    printf('<label><input type="checkbox" value="1" id="roost-forced-checkbox" name="roostForce" %s />', ( ! empty( $checked ) ) ? 'checked="checked"' : '' );
    318364                    echo '<strong>Send</strong> notification with <strong>Roost</strong></label>';
    319365                }
     
    323369        }
    324370    }
    325    
     371   
     372    public static function custom_note_text( $post ) {
     373        if ( 'publish' !== $post->post_status ) {
     374            $custom_note_text = get_post_meta( $post->ID, 'roost_custom_note_text', true );
     375    ?>
     376        <div id="custom-note">
     377            <span id="custom-note-text-trigger" ><strong>Roost Web Push - </strong>
     378                <?php
     379                    if ( ! empty( $custom_note_text ) ) {
     380                ?>
     381                    <span class="roost-headline-cage">Push Headline: <i><?php echo( $custom_note_text ); ?></i> - <a class="roost-headline" data-action="change">Change</a> / <a class="roost-headline" data-action="remove" data-id="<?php echo( $post->ID ); ?>">Remove</a></span>
     382                <?php
     383                    } else {
     384                ?>
     385                    <a class="roost-headline" data-action="change">Use Custom Text for your Push Notification</a>
     386                <?php
     387                    }
     388                ?>
     389            </span>
     390            <input type="text" id="custom-note-text" placeholder="Enter Custom Headline for your Notification" name="custom-note-text" value="<?php echo( ! empty( $custom_note_text ) ? $custom_note_text : '' ); ?>" />
     391        </div>
     392    <?php
     393        }
     394    }
     395
    326396    public static function complete_login( $logged_in, $site ) {
    327         if ( !empty( $logged_in ) ) {
     397        if ( ! empty( $logged_in ) ) {
    328398            if ( true === $logged_in['success'] ) {
    329399                if ( count( $logged_in['apps'] ) > 1 ){
     
    337407                }
    338408            }
    339         } elseif ( !empty( $site ) ) {
     409        } elseif ( ! empty( $site ) ) {
    340410            $site_key = $site[0];
    341411            $site_secret = $site[1];
     
    348418        $response = array();
    349419
    350         if ( !empty( $form_keys ) ) {
     420        if ( ! empty( $form_keys ) ) {
    351421            self::update_keys( $form_keys );
    352422            $response['status'] = true;
     
    363433    }
    364434
    365     public function graph_reload() {
     435    public static function graph_reload() {
    366436        $roost_settings = self::roost_settings();
    367437        $app_key = $roost_settings['appKey'];
     
    374444        $roost_graph_data = json_encode( $roost_graph_data );
    375445        echo $roost_graph_data;
    376         die();               
    377     }
    378    
    379     public function subs_check() {
     446        die();
     447    }
     448
     449    public static function remove_headline() {
     450        $post_id = $_POST['postID'];
     451        update_post_meta( $post_id, 'roost_custom_note_text', '' );
     452        die();
     453    }
     454
     455    public static function subs_check() {
    380456        $roost_settings = self::roost_settings();
    381457        $app_key = $roost_settings['appKey'];
     
    387463    }
    388464
    389     public function roost_logout() {
     465    public static function roost_logout() {
    390466        if ( isset( $_POST['clearkey'] ) ) {
    391467            $form_keys = array(
     
    401477        }
    402478    }
     479
     480    public static function roost_save_settings() {
     481        if ( isset( $_POST['savesettings'] ) ) {
     482            $roost_settings = self::roost_settings();
     483
     484            $app_key = $roost_settings['appKey'];
     485            $app_secret = $roost_settings['appSecret'];
     486
     487            $roost_server_settings = Roost_API::get_server_settings( $app_key, $app_secret );
     488
     489            $autoPush = false;
     490            $bbPress = false;
     491            $prompt_min = false;
     492            $prompt_visits = 1;
     493            $prompt_event = false;
     494
     495            if ( isset( $_POST['autoPush'] ) ) {
     496                $autoPush = true;
     497            }
     498            if ( isset( $_POST['bbPress'] ) ) {
     499                $bbPress = true;
     500            }
     501            if ( isset( $_POST['promptmin'] ) ) {
     502                $prompt_min = true;
     503            }
     504            if ( isset( $_POST['promptvisits'] ) ) {
     505                if ( '0' === $_POST['promptvisits'] ) {
     506                    $prompt_visits = 1;
     507                } else {
     508                    $prompt_visits = $_POST['promptvisits'];
     509                }
     510            }
     511            if ( isset( $_POST['promptevent'] ) ) {
     512                $prompt_event = true;
     513            }
     514
     515            $form_data = array(
     516                'autoPush' => $autoPush,
     517                'bbPress' => $bbPress,
     518                'prompt_min' => $prompt_min,
     519                'prompt_visits' => $prompt_visits,
     520                'prompt_event' => $prompt_event,
     521            );
     522            self::update_settings( $form_data );
     523            Roost_API::save_remote_settings( $app_key, $app_secret, $roost_server_settings, $_POST );
     524            $status = 'Settings Saved.';
     525            $status = urlencode( $status );
     526            wp_redirect( admin_url( 'admin.php?page=roost-web-push' ) . '&status=' . $status );
     527            exit;
     528        }
     529    }
    403530   
    404     public function manual_send() {
     531    public static function manual_send() {
    405532        if ( isset( $_POST['manualtext'] ) ) {
    406533            $manual_text = $_POST['manualtext'];
     
    426553            wp_redirect( admin_url( 'admin.php?page=roost-web-push' ) . '&status=' . $status );
    427554            exit;
    428         }       
     555        }
    429556    }
    430557
     
    432559        $roost_settings = self::roost_settings();
    433560               
    434         if ( empty( $roost_settings ) ) {
    435             self::install();
    436         } else {
    437             $app_key = $roost_settings['appKey'];
    438             $app_secret = $roost_settings['appSecret'];
    439         }
    440        
    441         if ( !empty( $app_key ) ) {
     561        $app_key = $roost_settings['appKey'];
     562        $app_secret = $roost_settings['appSecret'];
     563
     564        if ( ! empty( $app_key ) ) {
    442565            $roost_active_key = true;
    443566            $bbPress_active = Roost_bbPress::bbPress_active();
     
    446569        }
    447570       
    448         if ( !empty( $app_key ) && empty( $roost_server_settings ) ) {
    449             $roost_server_settings = Roost_API::get_server_settings( $app_key, $app_secret );   
     571        if ( ! empty( $app_key ) && empty( $roost_server_settings ) ) {
     572            $roost_server_settings = Roost_API::get_server_settings( $app_key, $app_secret );
    450573            $roost_stats = Roost_API::get_stats( $app_key, $app_secret );
    451574        }
     
    457580            $response = self::complete_login( $logged_in, null );
    458581            $first_time = $response['firstTime'];
    459             $roost_server_settings = $response['server_settings']; 
     582            $roost_server_settings = $response['server_settings'];
    460583            $roost_stats = $response['stats'];
    461584            $roost_active_key = true;
     
    467590            $logged_in = Roost_API::login( $roost_user, $roost_pass, null );
    468591            $response = self::complete_login( $logged_in, null );
    469             if( empty( $response['status'] ) ) {
     592            if ( empty( $response['status'] ) ) {
    470593                $roost_sites = $response;
    471594            } else {
    472                 if( !empty( $response['firstTime'] ) ) {
     595                if ( ! empty( $response['firstTime'] ) ) {
    473596                    $first_time = $response['firstTime'];
    474                     $roost_server_settings = $response['server_settings']; 
     597                    $roost_server_settings = $response['server_settings'];
    475598                    $roost_stats = $response['stats'];
    476599                    $roost_active_key = true;
     
    486609            $response = self::complete_login( null, $site );
    487610            $first_time = $response['firstTime'];
    488             $roost_server_settings = $response['server_settings']; 
     611            $roost_server_settings = $response['server_settings'];
    489612            $roost_stats = $response['stats'];
    490613            $roost_active_key = true;
    491614        }
    492 
    493615        if ( isset( $_GET['status'] ) ) {
    494616            $status = urldecode( $_GET['status'] );
    495617        }
    496618       
    497         if ( isset( $_POST['savesettings'] ) ) {   
    498             $autoPush = false;
    499             $bbPress = false;
    500            
    501             if ( isset( $_POST['autoPush'] ) ) {
    502                 $autoPush = true;
    503             }
    504             if ( isset( $_POST['bbPress'] ) ) {
    505                 $bbPress = true;
    506             }
    507            
    508             $form_data = array(
    509                 'autoPush' => $autoPush,
    510                 'bbPress' => $bbPress,
    511             );
    512             self::update_settings( $form_data );
    513 
    514             Roost_API::save_remote_settings( $app_key, $app_secret, $roost_server_settings, $_POST );
    515             $roost_server_settings = Roost_API::get_server_settings( $app_key, $app_secret );   
    516             $roost_stats = Roost_API::get_stats( $app_key, $app_secret );
    517             $status = 'Settings Saved.';
    518         }
    519        
    520         require_once( dirname( plugin_dir_path( __FILE__ ) ) . '/layout/admin.php');       
     619        require_once( dirname( plugin_dir_path( __FILE__ ) ) . '/layout/admin.php' );
    521620    }
    522621}
  • roost-for-bloggers/trunk/layout/admin.php

    r940152 r962489  
    11<div id="rooster">
    22    <div id="roost-header">
    3         <?php if( $roost_active_key ){ ?>
     3        <?php if ( $roost_active_key ) { ?>
    44            <div class="roost-wrapper">
    5                 <div id="roost-header-right">   
     5                <div id="roost-header-right">
    66                    <form action="" method="post">
    7                         <input type="Submit" id="roostLogOut" class="type-submit" name="clearkey" value="Log Out" />
     7                        <input type="Submit" id="roost-log-out" name="clearkey" value="Log Out" />
    88                    </form>
    99                    <span id="roost-username">
    10                         <span id="roostUserLogo">
     10                        <span id="roost-user-logo">
    1111                            <?php echo get_avatar($roost_server_settings['ownerEmail'], 25 ); ?>
    1212                        </span>
     
    1717                </div>
    1818                <img src="<?php echo ROOST_URL; ?>layout/images/roost-red-logo.png" />
    19                 <?php if( $roost_active_key ) { ?>
     19                <?php if ( $roost_active_key ) { ?>
    2020                    <div id="roost-site-name"><?php echo( $roost_server_settings['name'] ); ?></div>
    2121                <?php } ?>
     
    2323        <?php } ?>
    2424    </div>
    25     <?php if ( !empty( $first_time ) ) { ?>
     25    <?php if ( ! empty( $first_time ) ) { ?>
    2626        <div class="updated roost-wrapper" id="roost-first-time-setup">
    27             <div id="roostNoticeText">
     27            <div id="roost-notice-text">
    2828                <h3>Welcome to Roost, the plugin is up and running!</h3>
    2929                <h4>Your site visitors can now opt-in to receive notifications from you. ( Safari / Mavericks only right now )</h4>
    3030            </div>
    31             <div id="roostNoticeTarget">
    32                 <a href="#" id="roostNoticeCTA" ><span id="roostNoticeCTAHighlight"></span>Dismiss</a>
     31            <div id="roost-notice-target">
     32                <a href="#" id="roost-notice-CTA" ><span id="roost-notice-CTA-highlight"></span>Dismiss</a>
    3333            </div>
    3434        </div>
     
    3838    <?php } ?>
    3939        <!--BEGIN ADMIN TABS-->
    40         <?php if( $roost_active_key ) { ?>
     40        <?php if ( $roost_active_key ) { ?>
    4141
    4242            <div id="roost-tabs" class="roost-wrapper">
     
    4949        <?php } ?>
    5050        <!--END ADMIN TABS-->
    51         <div id="roost-pre-wrap" class="<?php echo( !empty( $roost_active_key ) ? 'roost-white':''); ?>">
     51        <div id="roost-pre-wrap" class="<?php echo( ! empty( $roost_active_key ) ? 'roost-white':''); ?>">
    5252            <div id="roost-main-wrapper">
    5353                    <!--BEGIN USER LOGIN SECTION-->
    54                     <?php if( !$roost_active_key ) { ?>
     54                    <?php if ( ! $roost_active_key ) { ?>
    5555                        <form action="" method="post">
    5656                            <div id="roost-login-wrapper">
    57                                 <?php if( empty( $roost_sites ) ){ ?>
     57                                <?php if ( empty( $roost_sites ) ){ ?>
    5858                                    <div id="roost-signup-wrapper">
    5959                                        <div id="roost-signup-inner">
     
    8181                                        <div class="roost-login-input">
    8282                                            <span class="roost-label">Email:</span>
    83                                             <input name="roostuserlogin" type="text" class="type-text roost-control-login" value="<?php echo isset($_POST['roostuserlogin']) ? $_POST['roostuserlogin'] : '' ?>" size="50" tabindex="1" />
     83                                            <input name="roostuserlogin" type="text" class="roost-control-login" value="<?php echo isset($_POST['roostuserlogin']) ? $_POST['roostuserlogin'] : '' ?>" size="50" tabindex="1" />
    8484                                        </div>
    8585                                        <div class="roost-login-input">
    8686                                            <!--PASSWORD-->
    8787                                            <span class="roost-label">Password:</span>
    88                                             <input name="roostpasslogin" type="password" class="type-text roost-control-login" value="<?php echo isset($_POST['roostpasslogin']) ? $_POST['roostpasslogin'] : '' ?>" size="50" tabindex="2" />
    89                                         </div>
    90                                         <?php if( isset( $roost_sites ) ) { ?>
     88                                            <input name="roostpasslogin" type="password" class="roost-control-login" value="<?php echo isset($_POST['roostpasslogin']) ? $_POST['roostpasslogin'] : '' ?>" size="50" tabindex="2" />
     89                                        </div>
     90                                        <?php if ( isset( $roost_sites ) ) { ?>
    9191                                            <!--CONFIGS-->
    9292                                            <div class="roost-login-input">
     
    104104                                                    ?>
    105105                                                </select>
    106                                                 <span class="roostDisclaimer">
     106                                                <span class="roost-disclaimer">
    107107                                                    To switch configurations after you log in, you will need to log out and choose a different configuration.
    108108                                                </span>
    109109                                            </div>
    110                                         <?php } ?>             
     110                                        <?php } ?>
    111111                                    </div>
    112112                                    <div class="roost-primary-footer">
    113113                                        <input type="hidden" id="roost-timezone-offset" name="roost-timezone-offset" value="" />
    114                                         <input type="Submit" class="type-submit" id="roost-middle-save" name="<?php echo isset($roost_sites) ? 'roostconfigselect' : 'roostlogin' ?>" value="<?php echo isset( $roost_sites ) ? 'Choose Site' : 'Login' ?>" tabindex="3" />
     114                                        <input type="submit" id="roost-middle-save" class="roost-login" name="<?php echo isset($roost_sites) ? 'roostconfigselect' : 'roostlogin' ?>" value="<?php echo isset( $roost_sites ) ? 'Choose Site' : 'Login' ?>" tabindex="3" />
    115115                                        <?php submit_button( 'Cancel', 'delete', 'cancel', false, array( 'tabindex' => '4' ) ); ?>
    116116                                        <span class="left-link"><a href="https://go.goroost.com/login?forgot=true" target="_blank">forget password?</a></span>
     
    139139
    140140                    <!--BEGIN ALL TIME STATS SECTION-->
    141                     <?php if( $roost_active_key ) { ?>
     141                    <?php if ( $roost_active_key ) { ?>
    142142                        <div id="roost-activity" class="roost-admin-section">
    143143                            <div id="roost-all-stats">
     
    150150                                        </div>
    151151                                        <div class="roost-stats-metric">
    152                                             <span class="roost-stat"><?php echo(number_format($roost_stats['messages'])); ?></span>
     152                                            <span class="roost-stat"><?php echo(number_format($roost_stats['notifications'])); ?></span>
    153153                                            <hr />
    154154                                            <span class="roost-stat-label">Total notifications sent to your subscribers</span>
     
    166166
    167167                    <!--BEGIN RECENT ACTIVITY SECTION-->
    168                     <?php if( $roost_active_key ) { ?>
     168                    <?php if ( $roost_active_key ) { ?>
    169169                            <div class="roost-section-wrapper">
    170170                                <div class="roost-section-heading" id="roost-chart-heading">
     
    198198                                            <div id="roost-curtain-notice">Graphs will appear once you have some subscribers.</div>
    199199                                        </div>
    200                                         <div id="roostchart_dynamic" class="roostStats">
     200                                        <div id="roostchart-dynamic" class="roostStats">
    201201                                        </div>
    202202                                    </div>
     
    208208
    209209                    <!--BEGIN MANUAL PUSH SECTION-->
    210                     <?php if( $roost_active_key ) { ?>
     210                    <?php if ( $roost_active_key ) { ?>
    211211                        <form action="" method="post" id="manual-push-form">
    212212                            <div id="roost-manual-push" class="roost-admin-section">
     
    220220                                                        <div class="roost-label">Notification text:</div>
    221221                                                        <div class="roost-input-wrapper">
    222                                                             <span id="roostManualNoteCount"><span id="roostManualNoteCountInt">0</span> / 70 (reccommended)</span>
    223                                                             <input name="manualtext" type="text" class="type-text roost-control-secondary" id="roostManualNote" value="" size="50" />
     222                                                            <span id="roost-manual-note-count"><span id="roost-manual-note-count-int">0</span> / 70 (reccommended)</span>
     223                                                            <input name="manualtext" type="text" class="roost-control-secondary" id="roost-manual-note" value="" size="50" />
    224224                                                            <span class="roost-input-caption">Enter the text for the notification you would like to send your subscribers.</span>
    225225                                                        </div>
     
    228228                                                        <div class="roost-label">Notification link:</div>
    229229                                                        <div class="roost-input-wrapper">
    230                                                             <input name="manuallink" type="text" class="type-text roost-control-secondary" value="" size="50" />
     230                                                            <input name="manuallink" type="text" class="roost-control-secondary" value="" size="50" />
    231231                                                            <span class="roost-input-caption">Enter a website link (URL) that your subscribers will be sent to upon clicking the notification.</span>
    232232                                                        </div>
    233233                                                    </div>
    234                                                     <input type="Submit" class="type-submit roost-control-secondary" name="manualpush" id="manualpush" value="Send notification" />
     234                                                    <input type="Submit" class="roost-control-secondary" name="manualpush" id="manualpush" value="Send notification" />
    235235                                                </div>
    236236                                            </div>
     
    241241                        </form>
    242242                    <?php } ?>
    243                     <!--END MANUAL PUSH SECTION--> 
     243                    <!--END MANUAL PUSH SECTION-->
    244244
    245245                    <!--BEGIN SETTINGS SECTION-->
    246                     <?php if( $roost_active_key ) { ?>
     246                    <?php if ( $roost_active_key ) { ?>
    247247                        <form action="" method="post">
    248248                            <div id="roost-settings" class="roost-admin-section">
     
    250250                                    <span class="roost-section-heading">Settings</span>
    251251                                    <div class="roost-section-content roost-section-secondary">
    252                                         <div class="roost-no-collapse"> 
    253                                             <div id="roost-block">
     252                                        <div class="roost-no-collapse">
     253                                            <div class="roost-block <?php if ( ! empty( $roost_settings['prompt_event'] ) ) { echo( 'roost-settings-top-floor' ); } ?>">
    254254                                                <div class="roost-setting-wrapper">
    255 
    256255                                                    <span class="roost-label">Auto Push:</span>
    257                                                     <input type="checkbox" name="autoPush" class="roost-control-secondary" value="1" <?php if(!empty($roost_settings['autoPush'])){ echo('checked');} ?> />
     256                                                    <input type="checkbox" name="autoPush" class="roost-control-secondary" value="1" <?php if ( ! empty( $roost_settings['autoPush'] ) ) { echo( "checked='checked'" ); } ?> />
    258257                                                    <span class="roost-setting-caption">Automatically send a push notification to your subscribers every time you publish a new post.</span>
    259258                                                </div>
    260259                                                <div class="roost-setting-wrapper">
    261260                                                    <span class="roost-label">Activate all Roost features:</span>
    262                                                     <input type="checkbox" name="autoUpdate" class="roost-control-secondary" value="1" <?php if( true == $roost_server_settings['autoUpdate'] ){ echo( 'checked' ); } ?> />
     261                                                    <input type="checkbox" name="autoUpdate" class="roost-control-secondary" value="1" <?php if ( true == $roost_server_settings['autoUpdate'] ){ echo( "checked='checked'" ); } ?> />
    263262                                                    <span class="roost-setting-caption">This will automatically activate current and future features as they are added to the plugin.</span>
    264263
     
    266265                                                <div class="roost-setting-wrapper">
    267266                                                    <span class="roost-label">bbPress Push Notifications:</span>
    268                                                     <input type="checkbox" name="bbPress" class="roost-control-secondary" value="1" <?php if( true == $roost_settings['bbPress'] ){ echo( 'checked' ); } ?> <?php echo( !empty( $bbPress_active['present'] ) ? '':'disabled' ); ?> />
    269                                                     <span class="roost-setting-caption">Extends subscriptions for bbPress forums, topics, and replies to allow subscribing via push notifications if site is viewed in a push capable browser.</span>
    270 
    271                                                 </div>
    272                                                 <input type="Submit" class="type-submit roost-control-secondary" id="roost-middle-save" name="savesettings" value="Save Settings" />                             
     267                                                    <input type="checkbox" name="bbPress" class="roost-control-secondary" value="1" <?php if ( true == $roost_settings['bbPress'] ){ echo( 'checked="checked"' ); } ?> <?php echo( ! empty( $bbPress_active['present'] ) ? '' : 'disabled="disabled"' ); ?> />
     268                                                    <span class="roost-setting-caption">Extends subscriptions for bbPress forums, topics, and replies to allow subscribing via push notifications.</span>
     269                                                </div>
     270                                                <div class="roost-setting-wrapper">
     271                                                    <span class="roost-label long-label">Notification prompt options:</span>
     272                                                    <input type="checkbox" name="promptmin" id="prompt-min" value="1" <?php if ( ! empty( $roost_settings['prompt_min'] ) ) { echo( 'checked="checked"' ); } ?> />
     273                                                    <span class="roost-setting-caption" id="roost-settings-lift">Prompt visitors for notifications after they visit the site <input name="promptvisits" type="text" id="roost-min-visits" value="<?php echo( $roost_settings['prompt_visits'] ); ?>" <?php echo( ! empty( $roost_settings['prompt_min'] ) ? '' : 'disabled="disabled"' ); ?>/>times.</span>
     274                                                </div>
     275                                                <div class="roost-setting-wrapper">
     276                                                    <span class="roost-label"></span>
     277                                                    <input type="checkbox" name="promptevent" id="prompt-event" value="1" <?php if ( ! empty( $roost_settings['prompt_event'] ) ) { echo( 'checked="checked"' ); } ?> />
     278                                                    <span class="roost-setting-caption">Prompt visitors for notifications once they complete an action (clicking a button or link).</span>
     279                                                    <div id="roost-event-hints">
     280                                                        <div>
     281                                                            &bull; Assign the class <span class="roost-code">"roost-prompt-wp"</span> to any element to prompt the visitor on click.
     282                                                            <span id="roost-hint-code-line">Example: <span class="roost-code">&lt;a href="#" class="roost-prompt-wp"&gt;Receive Desktop Notifications&lt;/a&gt;</span></span>
     283                                                        </div>
     284
     285                                                        &bull; You could also create a <a href="<?php echo( admin_url( 'nav-menus.php' ) ); ?>">menu item</a> and add the same class, to trigger the prompt.
     286                                                    </div>
     287                                                    <span id="roost-event-hints-disclaimer">*Links or buttons with this class will be hidden to visitors already subscribed, or using a browser that does not support push notifications.</span>
     288                                                </div>
     289
     290                                                <input type="Submit" class="roost-control-secondary" id="roost-settings-save" name="savesettings" value="Save Settings" />
    273291                                            </div>
    274292                                        </div>
     
    279297                    <?php } ?>
    280298                    <!--END SETTINGS SECTION-->
    281                 <div id="roostSupportTag">Have Questions, Comments, or Need a Hand? Hit us up at <a href="mailto:[email protected]" target="_blank">[email protected]</a> We're Here to Help.</div>
     299                <div id="roost-support-tag">Have Questions, Comments, or Need a Hand? Hit us up at <a href="mailto:[email protected]" target="_blank">[email protected]</a> We're Here to Help.</div>
    282300            </div>
    283301        </div>
    284302    <script>
    285         (function($){
    286             $('#rooster-status-close').click(function() {
    287                 $('#rooster-status').css('display', 'none');
     303        (function( $ ){
     304            $( '#rooster-status-close' ).click( function() {
     305                $( '#rooster-status' ).css( 'display', 'none' );
    288306            });
    289             $('#roostNoticeCTA').click(function(e) {
     307            $( '#roost-notice-CTA' ).click(function( e ) {
    290308                e.preventDefault();
    291                 $('#roost-first-time-setup').css('display', 'none');
     309                $( '#roost-first-time-setup' ).css( 'display', 'none' );
    292310            });
    293311            var timeZoneOffset = new Date().getTimezoneOffset();
    294             $('#roost-timezone-offset').val(timeZoneOffset);
    295            
    296             <?php if( $roost_active_key ) { ?>
    297                 $('.chart-range-toggle, .chart-metric-toggle').on('click', function(){
    298                     $(this).parent().find('.active').removeClass('active');
    299                     $(this).addClass('active');
     312            $( '#roost-timezone-offset' ).val( timeZoneOffset );
     313            <?php if ( $roost_active_key ) { ?>
     314                $( '.chart-range-toggle, .chart-metric-toggle' ).on( 'click', function() {
     315                    $( this ).parent().find( '.active' ).removeClass( 'active' );
     316                    $( this ).addClass( 'active' );
    300317                });
    301             <?php if( 0 !== $roost_stats['registrations'] ) { ?>
    302                     $('#roost-curtain').hide();
     318            <?php if ( 0 !== $roost_stats['registrations'] ) { ?>
     319                    $( '#roost-curtain' ).hide();
    303320                    var chart;
    304321                    var data = {
    305                         type: $('.chart-range-toggle.active span').data('type'),
    306                         range: $('.chart-range-toggle.active span').data('range'),
    307                         value: $('.chart-metric-toggle.active span').data('value'),
     322                        type: $( '.chart-range-toggle.active span' ).data( 'type' ),
     323                        range: $( '.chart-range-toggle.active span' ).data( 'range' ),
     324                        value: $( '.chart-metric-toggle.active span' ).data( 'value' ),
    308325                        offset: new Date().getTimezoneOffset(),
    309326                        action: 'graph_reload',
    310327                    };
    311 
    312                     $('.chart-reload').on('click', function(e){
     328                    $( '.chart-reload' ).on( 'click', function( e ) {
    313329                        e.preventDefault();
    314                         $("#roostchart_dynamic").html("");
    315 
     330                        $( '#roostchart-dynamic' ).html( "" );
    316331                        data = {
    317                             type: $('.chart-range-toggle.active span').data('type'),
    318                             range: $('.chart-range-toggle.active span').data('range'),
    319                             value: $('.chart-metric-toggle.active span').data('value'),
     332                            type: $( '.chart-range-toggle.active span' ).data( 'type' ),
     333                            range: $( '.chart-range-toggle.active span' ).data( 'range' ),
     334                            value: $( '.chart-metric-toggle.active span' ).data( 'value' ),
    320335                            offset: new Date().getTimezoneOffset(),
    321336                            action: 'graph_reload',
    322337                        };
    323338
    324                         graphDataRequest(data);
     339                        graphDataRequest( data );
    325340                    });
    326 
    327                     function graphDataRequest(data) {
    328                         $.post(ajaxurl, data, function(response) {
     341                    function graphDataRequest( data ) {
     342                        $.post( ajaxurl, data, function( response ) {
    329343                            var data = $.parseJSON( response );
    330                             loadGraph(data);
     344                            loadGraph( data );
    331345                        });
    332346                    }
    333 
    334                     function loadGraph(data) {
    335                         $('roostchart_dynamic').html('');
    336 
     347                    function loadGraph( data ) {
     348                        $( '#roostchart-dynamic' ).html( '' );
    337349                        chart = new Morris.Bar({
    338                             element: 'roostchart_dynamic',
     350                            element: $( '#roostchart-dynamic' ),
    339351                            data: data,
    340                             barColors: ["#e25351"],
     352                            barColors: ['#e25351'],
    341353                            xkey: 'label',
    342354                            ykeys: ['value'],
     
    347359                        });
    348360                    }
    349 
    350                     $(window).resize(function() {
     361                    $( window ).resize( function() {
    351362                        chart.redraw();
    352363                    });
    353                     graphDataRequest(data);
     364                    graphDataRequest( data );
    354365                <?php } ?>
    355            
    356366            <?php } ?>
    357         })(jQuery);
    358         <?php if( isset( $roost_sites ) ){ ?>
    359             jQuery(".roost-control-login").attr("disabled", "disabled");
    360         <?php } ?>     
    361         <?php if( $roost_active_key ) { ?>
    362             (function($){
     367        })( jQuery );
     368        <?php if ( isset( $roost_sites ) ){ ?>
     369            jQuery( '.roost-control-login' ).attr( 'disabled', 'disabled' );
     370        <?php } ?>
     371        <?php if ( $roost_active_key ) { ?>
     372            (function( $ ){
    363373                function confirmMessage() {
    364                     if ( !confirm( "Are you sure you would like to send a notification?" ) ) {
     374                    if ( ! confirm( 'Are you sure you would like to send a notification?' ) ) {
    365375                        return false;
    366376                    } else {
     
    368378                    }
    369379                }
    370                 $('#manualpush').on('click', function(e) {
     380                $( '#manualpush' ).on( 'click', function( e ) {
    371381                    e.preventDefault();
    372382                    var subscribers = <?php echo $roost_stats['registrations']; ?>;
    373                     if( 0 === subscribers ) {
     383                    if ( 0 === subscribers ) {
    374384                        var resub;
    375                         $.post(ajaxurl, { action: 'subs_check' }, function(response) {
     385                        $.post( ajaxurl, { action: 'subs_check' }, function( response ) {
    376386                            var response = $.parseJSON( response );
    377387                            resub = response;
    378                             if( 0 === resub ) {
     388                            if ( 0 === resub ) {
    379389                                alert('You must have one visitor subscribed to your site to send notifications');
    380390                                return;
    381391                            } else {
    382                                 if( true === confirmMessage() ) {
    383                                      $('#manualpush').unbind('click').trigger('click');
     392                                if ( true === confirmMessage() ) {
     393                                     $( '#manualpush' ).unbind( 'click' ).trigger( 'click' );
    384394                                }
    385395                            }
    386396                        });
    387397                    } else {
    388                         if( true === confirmMessage() ) {
    389                              $('#manualpush').unbind('click').trigger('click');
     398                        if ( true === confirmMessage() ) {
     399                             $( '#manualpush' ).unbind( 'click' ).trigger( 'click' );
    390400                        }
    391401                    }
    392402                });
    393             })(jQuery);
     403            })( jQuery );
    394404        <?php } ?>
    395         <?php if( empty( $roost_sites ) ){ ?>
    396             (function($){
    397                 if( $('#roost-login-wrapper').length ) {
    398                     var signup = $('#roost-signup-wrapper');
    399                     var signin = $('#roost-signin-wrapper');
    400 
     405        <?php if ( empty( $roost_sites ) ){ ?>
     406            (function( $ ){
     407                if ( $( '#roost-login-wrapper' ).length ) {
     408                    var signup = $( '#roost-signup-wrapper' );
     409                    var signin = $( '#roost-signin-wrapper' );
    401410                    signin.hide();
    402 
    403                     $('.roost-signup').on('click', function() {
     411                    $( '.roost-signup' ).on( 'click', function() {
    404412                        signup.toggle();
    405413                        signin.toggle();
    406414                    });
    407415                }
    408             })(jQuery);
    409         <?php } ?>       
     416            })( jQuery );
     417        <?php } ?>
    410418    </script>
    411419</div>
  • roost-for-bloggers/trunk/layout/css/rooststyle.css

    r928005 r962489  
     1#rooster {
     2    margin: 0 0 0 -19px;
     3    background: #f1f1f1;
     4    color: #5c686f;
     5    font-family: 'Open Sans', sans-serif;
     6}
     7
    18#rooster a,
    29#rooster a:link,
     
    1219}
    1320
    14 #rooster .roost-signup {
    15     cursor: pointer;
    16 }
    17 
    1821#adminmenu li.current .wp-menu-image img,
    1922#adminmenu li.wp-not-current-submenu .wp-menu-image img {
     
    2124}
    2225
    23 hr {
    24     height: 1px;
    25     background: #d4d7d9;
    26     border: 0;
    27     margin: 15px 0 20px;
    28 }
    29 
    30 .type-submit {
     26#rooster input,
     27#rooster select {
     28    font-family: 'Open Sans', sans-serif;
     29}
     30
     31#rooster .roost-signup {
     32    cursor: pointer;
     33}
     34
     35.roost-login,
     36.roost-section-secondary input[type="submit"] {
     37    width: 94px;
     38    padding: 5px 0 6px;
     39    border: 1px solid;
     40    border-radius: 3px;
     41    border-color: #0074a2;
     42    background: #2ea2cc;
     43    box-shadow: none;
    3144    font-size: 13px;
    32     border-radius: 3px;
    33     background: #2ea2cc;
    34     color: #fff;
    35     box-shadow: none;
    36     border: 1px solid;
    37     border-color: #0074a2;
    38     padding: 5px 0 6px;
    39     width: 94px;
     45    color: #ffffff;
    4046    cursor: pointer;
    4147}
     
    4652}
    4753
    48 input.type-text {
     54#rooster input[type="text"] {
    4955    width: 340px;
    5056    height: 36px;
    5157    padding: 0 10px;
    52     font-family: 'Open Sans', sans-serif;
    5358}
    5459
     
    6166}
    6267
    63 #roost-manual-send-wrapper .type-text {
     68#roost-manual-send-wrapper input[type="text"] {
    6469    display:block;
    6570    width: 837px;
     
    6772}
    6873
    69 #roost-send-with-link,
    70 #roost-send-no-link {
    71 
    72 }
    73 
    74 #roost-send-no-link .roost-input-text {
    75 
    76 }
    77 
    7874#rooster select {
    7975    margin: 5px 0 0;
    8076    cursor: pointer;
    81     font-family: 'Open Sans', sans-serif;
    82 }
    83 
    84 #rooster {
    85     margin: 0 0 0 -19px;
    86     background: #f1f1f1;
    87     color: #5c686f;
    88     font-family: 'Open Sans', sans-serif;
    8977}
    9078
    9179#roost-header {
    9280    display:inline-block;
     81    width: 100%;
     82    height: 36px;
    9383    position:relative;
    94     height: 36px;
    95     width: 100%;
    9684    margin-top: 7px;
    9785    padding: 16px 0 0 0;
     
    9987
    10088#roost-header-right {
     89    width: 550px;
    10190    float: right;
    102     width: 550px;
    10391    margin: 5px;
    10492}
    10593
     94#roost-username,
     95#roost-log-out {
     96    font-size: 15px;
     97    color: #666666;
     98}
     99
    106100#roost-username {
    107     color: #666666;
    108     font-size: 15px;
    109     margin-top: -4px;
    110     font-family: 'Open Sans', sans-serif;
    111101    display: inline-block;
    112102    width: 425px;
    113103    float: right;
     104    margin-top: -4px;
    114105    margin-right: 20px;
    115106    text-align: right;
    116107}
    117108
    118 #roostLogOut {
    119     color: #666666;
     109#roost-log-out {
     110    display: block;
     111    width: 90px;
     112    float: right;
     113    padding: 5px 0 6px;
     114    border: 1px solid #cccccc;
     115    border-radius: 3px;
     116    box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
     117    font-weight:600;
    120118    background: #f7f7f7;
    121     font-family: 'Open Sans', sans-serif;
    122     font-weight:600;
    123     font-size: 15px;
    124     border: 1px solid #cccccc;
    125     box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
    126     border-radius: 3px;
    127     width: 90px;
    128     display: block;
    129     float: right;
    130119}
    131120
    132121.roost-wrapper {
    133122    margin: 0 auto;
    134 /*
    135     width: 1066px;
    136 */
    137123    width: 1000px;
    138124}
     
    144130
    145131#roost-main-wrapper {
    146     margin: -1px auto 0;
    147 /*
    148     width: 1066px;
    149 */
    150132    width: 1000px;
    151133    min-height: 800px;
    152134    position: relative;
    153135    top: 5px;
     136    margin: -1px auto 0;
    154137}
    155138
    156139#roost-signin-wrapper {
    157     background: #fff;
    158140    width: 366px;
    159141    margin: 100px auto;
     142    background: #ffffff;
    160143    box-shadow: 0px 1px 3px rgba(0,0,0,0.2);
    161144}
     
    168151
    169152#roost-primary-logo img {
     153    width: 72px;
    170154    height: 40px;
    171     width: 72px;
    172155    margin-top: 12px;
    173156}
    174157
    175158.roost-primary-heading {
    176     background: #fafafa;
    177159    height: 35px;
    178     text-align: center;
    179160    padding: 19px 30px;
    180161    border-bottom: 1px solid #d4d7d9;   
     162    background: #fafafa;
     163    text-align: center;
    181164}
    182165
    183166.roost-primary-footer {
     167    height: 35px;
     168    padding: 14px 30px 20px;
    184169    background: #fff;
    185     height: 35px;
    186170    text-align: center;
    187     padding: 14px 30px 20px;
    188171}
    189172
     
    191174    display: inline-block;
    192175    width: 100%;
     176    position: relative;
    193177    margin: 10px 0;
    194     position: relative;
    195 }
    196 
    197 #roost-signin-wrapper input.type-text {
     178}
     179
     180#roost-signin-wrapper input[type="text"],
     181#roost-signin-wrapper input[type="password"] {
    198182    width: 214px;
    199183    height: 26px;
     
    202186}
    203187
     188#roost-signin-wrapper input[type="password"] {
     189    padding-left: 10px;
     190}
     191
    204192#roost-signin-wrapper select {
    205193    width: 100%;
    206194}
    207195
    208 .roostDisclaimer {
    209     font-family: 'Open Sans', sans-serif;
     196.roost-disclaimer {
     197    display: inline-block;
     198    width: 290px;
     199    margin: 5px 0 0 5px;
    210200    font-size: 11px;
    211201    font-style: italic;
    212     display: inline-block;
    213     width: 290px;
    214     margin: 5px 0 0 5px;
    215202}
    216203
     
    218205.roost-secondary-cta {
    219206    display: block;
     207    font-size: 13px;
    220208}
    221209
    222210.roost-primary-cta {
    223     font-size: 13px;
    224     font-family: 'Open Sans', sans-serif;
     211    margin-bottom: 10px;
    225212    font-weight: 600;
    226213    line-height: 10px;
    227214    color: #222222;
    228     margin-bottom: 10px;
    229215}
    230216
    231217.roost-secondary-cta {
    232     font-size: 13px;
    233     color: #666666;
    234     font-family: 'Open Sans', sans-serif;
    235218    font-weight: 400;
    236219    font-style: italic;
     220    color: #666666;
    237221}
    238222
    239223.roost-section-wrapper {
     224    margin: 25px 0;
     225    border: 1px solid #e5e5e5;
    240226    background: #fafafa;
    241     border: 1px solid #e5e5e5;
    242     margin: 25px 0;
    243227    box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
    244228}
    245229
    246230.roost-section-heading {
    247     color: #222222;
     231    display: inline-block;
    248232    width: 100%;
    249     display: inline-block;
     233    height: 17px;
    250234    position: relative;
    251     height: 17px;
    252235    padding: 15px 0 10px 5px;
     236    background-color: #fafafa;
    253237    font-size: 14px;
    254238    letter-spacing: 0.1em;
    255239    text-indent: 13px;
    256     background-color: #fafafa;
     240    color: #222222;
    257241}
    258242
     
    267251}
    268252
    269 .roost-section-secondary .type-submit {
     253.roost-section-secondary input[type="submit"] {
     254    width: 130px !important;
    270255    float: right;
    271     width: 130px;
    272256    margin:2px 0 0 0;
    273257}
    274258
    275259#roost-all-stats {
     260    margin: 32px 0 0;
    276261    padding: 0;
    277     margin: 32px 0 0;
    278262}
    279263
     
    283267
    284268.roost-no-collapse {
     269    display: inline-block;
     270    width: 956px;
    285271    position: relative;
    286     width: 956px;
    287     display: inline-block;     
    288272}
    289273
    290274#roost-registration-points {
    291275    list-style: none;
    292     font-family: 'Open Sans', sans-serif;
    293276    font-size: 13px;
    294277}
     
    306289
    307290.roost-step {
    308     color: #fff;
    309     background: #e25351;
    310     display: inline-block;
    311     padding: 10px 9px 8px 9px;
     291    display: inline-block;
    312292    width: 18px;
    313293    height: 18px;
    314294    position: relative;
     295    margin-right: 10px;
     296    padding: 10px 9px 8px 9px;
     297    background: #e25351;
    315298    border-radius: 20px;
    316299    text-indent: 5px;
    317     margin-right: 10px;
     300    color: #fff;
    318301}
    319302
     
    334317
    335318.roost-input-text {
     319    display:inline-block;
    336320    width:100%;
     321    height:71px;
    337322    position:relative;
    338     display:inline-block;
    339     height:71px;
    340323}
    341324
    342325.roost-input-text .roost-label,
    343 #roost-block .roost-label {
     326.roost-block .roost-label {
     327    display: block;
    344328    width: 110px;
     329    float:left;
    345330    margin-right: 14px;
    346     display: block;
    347     float:left;
    348 }
    349 
    350 #roost-block .roost-label {
     331}
     332
     333.roost-block .roost-label {
    351334    width:  175px;
    352335    margin-right: 25px;
     
    355338}
    356339
     340.roost-block .roost-label.long-label {
     341    font-size: 12px;
     342}
     343
     344#roost-settings-save {
     345    position: absolute;
     346    right: 0;
     347    bottom: 0;
     348    margin-bottom: 25px;
     349}
     350
     351#roost-event-hints {
     352    display: none;
     353    width: 664px;
     354    height: 102px;
     355    position: relative;
     356    float: right;
     357    top: 10px;
     358    padding: 23px 30px 30px 30px;
     359    border: 1px solid #e9e9e9;
     360    background: #ffffff;
     361    box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.2);
     362}
     363
     364.roost-code {
     365    display: inline-block;
     366    padding: 5px 10px;
     367    background: #f0f0f0;
     368    font-family: monospace;
     369    color: #000000;
     370    text-align: center;
     371}
     372
     373#roost-hint-code-line {
     374    display: block;
     375    margin-top: 7px;
     376    margin-bottom: 25px;
     377    text-indent: 5px;
     378}
     379
     380#roost-event-hints-disclaimer {
     381    display: none;
     382    width: 630px;
     383    position: relative;
     384    float: right;
     385    top: 21px;
     386    right: 65px;
     387    font-size: 12px;
     388    font-style: italic;
     389}
     390
     391.roost-block {
     392    display: inline-block;
     393    width: 100%;
     394    height: 288px;
     395    position:relative;
     396    padding: 15px 0 0;
     397}
     398
    357399.roost-input-caption {
     400    display:block;
     401    margin-top: 5px;
    358402    font-style:italic;
    359403    font-size:13px;
    360     display:block;
    361     margin-top: 5px;
    362404    text-indent: 5px;
    363405}
     
    376418}
    377419
    378 .roost-setting-wrapper:nth-child(2) {
    379     margin-bottom: 30px;   
    380 }
    381 
    382 .roost-setting-wrapper:nth-child(3) {
    383     margin-bottom: 8px;
    384 }
    385 
    386420.roost-setting-wrapper input {
     421    position: relative;
    387422    float: left;
    388423    top: 5px;
    389424    margin-right: 10px;
    390     position: relative;
    391425}
    392426
    393427.roost-setting-caption {
     428    display:block;
     429    width: 725px;
     430    float:left;
    394431    font-style:italic;
    395     width: 725px;
    396     display:block;
    397     float:left;
     432}
     433
     434#roost-settings-lift {
     435    position: relative;
     436    top: -5px;
    398437}
    399438
     
    402441    margin: 4px 0 1px 5px;
    403442    font-size: 13px;
    404     font-family: 'Open Sans', sans-serif;
    405443    font-weight: 600;
    406444}
    407445
    408 #roost-block {
    409     display: inline-block;
    410     width: 100%;
    411     position:relative;
    412     height: 258px;
    413     padding: 15px 0 0;
     446input[type="text"]#roost-min-visits {
     447    width: 36px;
     448    height: 28px;
     449    position: relative;
     450    float: none;
     451    top: 0px;
     452    left: 4px;
     453    text-align: center;
    414454}
    415455
     
    419459
    420460#rooster-status {
     461    width: 966px;
     462    margin: 15px auto;
     463    padding: 17px 20px;
     464    border-left: 4px solid #7ad03a;
    421465    background: #fff;
    422     width: 966px;
     466    font-size: 13px;
    423467    color: #222222;
    424     font-size: 13px;
    425     padding: 17px 20px;
    426     margin: 15px auto;
    427     display: block;
    428 /*  border-left: 4px solid rgb(226, 83, 81); */
    429     border-left: 4px solid #7ad03a;
    430468}
    431469
    432470#rooster-status-text {
     471    display: inline-block;
    433472    width: 910px;
    434     display: inline-block;
    435473}
    436474
    437475#rooster-status-close {
    438     font-family: 'Open Sans', sans-serif;
    439     color: rgb(46, 162, 204);
     476    display: inline-block;
    440477    height: 16px;
    441478    position: relative;
    442     display: inline-block;
     479    float: right;
     480    color: rgb(46, 162, 204);
    443481    cursor: pointer;
    444     float: right;
    445482}
    446483
     
    452489.rooster-custom-script {
    453490    width: 220px;
     491    height: 75px;
    454492    padding: 10px;
    455     height: 75px;
    456493}
    457494
    458495.roost-text-pinch {
     496    display: inline-block; 
    459497    width: 200px;
    460498    margin-top: 50px;
    461     display: inline-block; 
    462 }
    463 #roostUserLogo {
     499}
     500#roost-user-logo {
    464501    display: inline-block;
     502    height: 24px;
     503    position:relative;
    465504    top: 7px;
    466     position:relative;
     505    margin-right: 15px;
    467506    border-radius: 3px;
    468     height: 24px;
    469     margin-right: 15px
    470 }
    471 
    472 #roostUserLogo img {
     507}
     508
     509#roost-user-logo img {
    473510    border-radius: 3px;
    474511    cursor: pointer;
     
    476513
    477514.roost-stats-metric {
    478     background: #fafafa;
     515    width: 328px;
     516    height: 95px;
     517    position: relative;
     518    float: left;
     519    top: -6px;
    479520    margin-right: 5px;
    480     display: block;
    481     height: 95px;
    482     width: 328px;
    483     float: left;
    484521    padding: 50px 0;
    485522    border: 1px solid #eeeeee;
    486     position: relative;
    487     top: -6px;
     523    background: #fafafa;
    488524}
    489525
     
    493529
    494530.roost-stats-metric hr {
     531    width: 40px;
     532    height: 2px;
     533    position: relative;
    495534    margin: 0 auto;
    496     height: 2px;
    497     width: 40px;
     535    border: 0;
    498536    background: #e8ebeb;
    499     display: block;
    500     position: relative;
    501537    top: 35px;
    502538}
    503539
    504540.roost-stat {
    505     color: #666666;
    506541    display:block;
     542    font-size: 63px;
    507543    text-align:center;
    508544    font-weight: 300;
    509     font-size: 63px;
     545    color: #666666;
    510546}
    511547
     
    513549    display:block;
    514550    width: 215px;
     551    position: relative;
     552    top: 27px;
     553    margin: 25px auto 0;
     554    font-size: 15px;
    515555    line-height: 18px;
    516     font-size: 15px;
    517     margin: 25px auto 0;
    518556    text-align:center;
    519557    color: #666666;
    520     position: relative;
    521     top: 27px;
    522558}
    523559
     
    530566}
    531567
    532 #roostManualNote {
     568#roost-manual-note {
    533569    padding: 0 179px 0 10px;
    534570}
    535571
    536 #roostManualNoteCount {
     572#roost-manual-note-count {
    537573    display: block;
    538574    position: absolute;
     575    top: 5px;
    539576    right: 0;
    540     top: 5px;
    541577    font-weight: 700;
    542578    color: #CCCCCC;
    543579}
    544580
    545 #roostManualNoteCountInt.roostWarning {
     581#roost-manual-note-count-int.roostWarning {
    546582    color: #D54E21;
    547583}
    548584
    549 #roostSupportTag {
     585#roost-support-tag {
    550586    text-align: center;
    551587}
    552588
    553 .updated#roostSetupNotice,
     589.updated#roost-setup-notice,
    554590.updated#roost-first-time-setup {
     591    min-width: 800px;
    555592    height: 90px;
    556     min-width: 800px;
     593    position: relative;
     594    margin: 15px 0 25px 0;
    557595    border: none;
    558     position: relative;
    559     display: block;
    560     margin: 15px 0 25px 0;
     596    border-radius: 5px;
     597    background: #e66d6b; /* Old browsers */
     598    background: -webkit-gradient(linear, left top, right top, color-stop(0%,#e66d6b), color-stop(100%,#e25351));
     599    background: -webkit-linear-gradient(left, #e66d6b 0%,#e25351 100%);
     600    background: -o-linear-gradient(left, #e66d6b 0%,#e25351 100%);
     601    background: -ms-linear-gradient(left, #e66d6b 0%,#e25351 100%);
     602    background: linear-gradient(to right, #e66d6b 0%,#e25351 100%);
     603    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
    561604    overflow: hidden;
    562     background: #e66d6b; /* Old browsers */
    563     background: -moz-linear-gradient(left, #e66d6b 0%, #e25351 100%); /* FF3.6+ */
    564     background: -webkit-gradient(linear, left top, right top, color-stop(0%,#e66d6b), color-stop(100%,#e25351)); /* Chrome,Safari4+ */
    565     background: -webkit-linear-gradient(left, #e66d6b 0%,#e25351 100%); /* Chrome10+,Safari5.1+ */
    566     background: -o-linear-gradient(left, #e66d6b 0%,#e25351 100%); /* Opera 11.10+ */
    567     background: -ms-linear-gradient(left, #e66d6b 0%,#e25351 100%); /* IE10+ */
    568     background: linear-gradient(to right, #e66d6b 0%,#e25351 100%); /* W3C */
    569     box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
    570     border-radius: 5px;
    571605}
    572606
     
    581615
    582616.updated#roost-first-time-setup h3 {
     617    margin: 22px 0 -10px 0;
    583618    font-size: 15px;
    584619    font-weight: 600;
    585     margin: 22px 0 -10px 0;
    586620}
    587621
     
    591625}
    592626
    593 #roostNoticeLogo {
    594     display: block;
    595     float: left;
     627#roost-notice-logo {
    596628    width: 123px;
    597629    height: 100%;
     630    float: left;
    598631    border-right: 1px solid #c45d5b;
    599632}
    600633
    601 #roostNoticeLogo img {
     634#roost-notice-logo img {
    602635    width: 75px;
     636    position: relative;
    603637    top: 26px;
    604638    left: 18px;
    605     position: relative;
    606 }
    607 
    608 #roostNoticeText {
    609     display: block;
    610     float: left;
    611     color: #fff;
     639}
     640
     641#roost-notice-text {
    612642    width: 510px;
    613643    height: 100%;
    614644    position: relative;
     645    float: left;
    615646    border-left: 1px solid rgba(255, 255, 255, 0.2);
    616 }
    617 
    618 #roostNoticeText p {
    619     font-family: 'Open Sans', sans-serif;
     647    color: #ffffff;
     648}
     649
     650#roost-notice-text p {
     651    margin-left: 14px;
     652    padding: 17px;
    620653    font-size: 14px;
    621     padding: 17px;
    622     margin-left: 14px;
    623 }
    624 
    625 #roost-first-time-setup #roostNoticeText {
    626     border: 0;
     654}
     655
     656#roost-first-time-setup #roost-notice-text {
    627657    width: auto;
    628658    padding-left: 35px;
    629 }
    630 
    631 #roostNoticeTarget {
     659    border: 0;
     660}
     661
     662#roost-notice-target {
    632663    width: 155px;
     664    height: 100%;
     665    float: left;
     666}
     667
     668a#roost-notice-CTA,
     669a#roost-notice-CTA:link,
     670a#roost-notice-CTA:active {
    633671    display: block;
    634     float: left;
    635     height: 100%;
    636 }
    637 
    638 a#roostNoticeCTA,
    639 a#roostNoticeCTA:link,
    640 a#roostNoticeCTA:active {
    641     text-align: center;
    642     display: block;
    643     color: #fff;
    644672    width: 96px;
    645673    height: 22px;
    646     background-color: #c24846;
     674    position: relative;
     675    top: 31px;
     676    left: 25px;
    647677    border: 1px solid #963836;
    648678    border-radius: 2px;
    649     position: relative;
    650     top: 31px;
    651     left: 25px;
     679    background-color: #c24846;
    652680    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
     681    text-align: center;
     682    color: #ffffff;
     683    text-decoration: none;
    653684    overflow: hidden;
     685    outline: 0;
     686}
     687
     688a#roost-notice-CTA:visited {
    654689    text-decoration: none;
    655     outline: 0;
    656 }
    657 
    658 a#roostNoticeCTA:visited {
    659     text-decoration: none;
    660     color: #fff;
     690    color: #ffffff;
    661691    outline: 0
    662692}
    663693
    664 #roostNoticeCTAHighlight {
     694#roost-notice-CTA-highlight {
    665695    display: block;
     696    width: 100px;
    666697    height: 1px;
     698    position: relative;
    667699    margin-bottom: 2px;
    668     width: 100px;
    669     position: relative;
    670700    background-color: rgba(255, 255, 255, 0.2);
    671701}
    672702
    673 a#roostNoticeCTA:hover {
     703a#roost-notice-CTA:hover {
    674704    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    675705}
    676706
    677 #roost-first-time-setup #roostNoticeTarget {
     707#roost-first-time-setup #roost-notice-target {
    678708    float: right;
    679709}
     
    684714    margin: 100px auto 50px;
    685715    padding: 80px;
    686     color: #fff;
    687716    background: rgb(230,109,107);
    688717    background: -moz-linear-gradient(top,  rgb(230,109,107) 0%, rgb(226,89,87) 100%);
     
    692721    background: -ms-linear-gradient(top,  rgb(230,109,107) 0%,rgb(226,89,87) 100%);
    693722    background: linear-gradient(to bottom,  rgb(230,109,107) 0%,rgb(226,89,87) 100%);
     723    color: #ffffff;
    694724}
    695725
    696726#roost-signup-wrapper h2 {
    697     color: #fff;
     727    margin: 40px auto 23px;
     728    color: #ffffff;
    698729    font-size: 35px;
    699730    font-weight: 300;
    700     margin: 40px auto 23px;
    701731}
    702732
     
    708738#roost-bottom-right {
    709739    position: absolute;
     740    right: 42px;
    710741    bottom: 11px;
    711     color: #f2b1b1;
    712742    font-size: 15px;
    713743    font-weight: 300;
    714     right: 42px;
     744    color: #f2b1b1;
    715745}
    716746
    717747#roost-bottom-right .roost-signup {
    718     color: #fff;
     748    margin-left: 11px;
     749    color: #ffffff;
    719750    font-weight: 600;
    720     margin-left: 11px;
    721751}
    722752
    723753#roost-signup-inner {
    724754    display: inline-block;
    725     position: relative;
    726755    width: 100%;
    727756    height: 100%;
     757    position: relative;
    728758}
    729759
    730760#roost-create-account {
     761    display: inline-block;
     762    width: 163px;
     763    height: 25px;
    731764    position: absolute;
    732765    bottom: 0;
    733766    left: 0;
    734     display: inline-block;
     767    padding: 10px 10px 5px;
     768    border-radius: 5px;
    735769    background-color: #883736;
     770    font-size: 14px;
     771    font-weight: 600;
    736772    text-align: center;
    737     border-radius: 5px;
    738     font-weight: 600;
    739     padding: 10px 10px 5px;
    740     height: 25px;
    741     color: #fff !important;
     773    color: #ffffff !important;
    742774    text-decoration: none !important;
    743     width: 163px;
    744     font-size: 14px;
    745775    text-indent: 13px;
    746776}
     
    758788
    759789#roost-api-error {
     790    position: relative;
     791    top: 75px;
    760792    padding: 12px 10px;
    761     position: relative;
    762     top: 75px;
    763793}
    764794
    765795#roost-sso {
     796    height: 58px;
    766797    background: #f7f7f7;
    767     height: 58px;
    768798}
    769799
     
    779809
    780810#roost-sso a {
     811    display: block;
     812    width: 58px;
    781813    height: 58px;
    782     width: 58px;
    783     display: block;
    784 }
    785 
    786 .roost-sso-option {
    787814}
    788815
     
    797824.roost-sso-option .roost-plugin-image {
    798825    display: block;
     826    position: relative;
     827    top: 19px;
    799828    margin: 0 auto;
    800829    text-indent: -999em;
    801     position: relative;
    802     top: 19px;
    803830}
    804831
    805832#roost-sso-facebook {
    806     background-position: -32px -86px;
    807833    width: 9px;
    808834    height: 20px;
    809835    top: 18px;
     836    background-position: -32px -86px;
    810837}
    811838
     
    815842
    816843#roost-sso-twitter {
    817     background-position: 0px -88px;
    818844    width: 23px;
    819845    height: 18px;
     846    background-position: 0px -88px;
    820847}
    821848
     
    825852
    826853#roost-sso-google {
    827     background-position: -49px -86px;
    828854    width: 24px;
    829855    height: 20px;
     856    background-position: -49px -86px;
    830857}
    831858
     
    835862
    836863#roost-tabs {
    837     display: block;
    838864    height: 50px;
    839865}
    840866
    841867#roost-tabs li {
    842     color: #666666;
    843868    display: inline-block;
    844     list-style: none;
     869    height: 27px;
     870    position: relative;
     871    z-index: 10;
    845872    float: left;
    846     cursor: pointer;
    847     height: 27px;
     873    margin: 15px 10px 10px 0;
    848874    padding: 8px 15px 0 15px;
    849     font-size: 15px;
    850     background-color: #e4e4e4;
    851     text-align: center;
    852     margin: 15px 10px 10px 0;
    853875    border: 1px solid #cccccc;
    854876    border-bottom: 0;
     877    background-color: #e4e4e4;
     878    list-style: none;
     879    font-size: 15px;
     880    text-align: center;
    855881    font-weight: 600;
     882    color: #666666;
     883    cursor: pointer;
     884}
     885
     886#roost-tabs li.active {
     887    position: relative;
     888    z-index: 50;
     889    background-color: #fff;
     890}
     891
     892#roost-pre-wrap {
    856893    position: relative;
    857894    z-index: 10;
    858895}
    859896
    860 #roost-tabs li.active {
     897#roost-pre-wrap.roost-white {
     898    border-top: 1px solid #cccccc;
    861899    background-color: #fff;
    862     position: relative;
    863     z-index: 50;
    864 }
    865 
    866 #roost-pre-wrap {
    867     position: relative;
    868     z-index: 10;
    869 }
    870 
    871 #roost-pre-wrap.roost-white {
    872     background-color: #fff;
    873     border-top: 1px solid #cccccc;
    874900}
    875901
    876902#roost-site-name {
     903    display: inline-block;
     904    position: absolute;
     905    margin-left: 24px;
     906    padding: 10px 24px;
    877907    border-left: 1px solid #d3d6d7;
    878     display: inline-block;
    879     padding: 10px 24px;
    880     margin-left: 24px;
     908    font-size: 15px;
    881909    text-align: center;
    882     position: absolute;
    883     font-family: 'Open Sans', sans-serif;
    884     font-size: 15px;
    885910}
    886911
    887912#roost-chart-heading {
    888913    height: 45px;
     914    padding: 25px 0;
    889915    background: #f1f1f1;
    890     padding: 25px 0;
    891916    text-indent: 29px;
    892917}
    893918
    894 #roostchart_dynamic {
     919#roostchart-dynamic {
    895920    height: 250px;
    896921}
     
    898923#roost-time-period {
    899924    position: absolute;
    900     display: block;
     925    top: 30px;
    901926    right: 30px;
    902     top: 30px;
    903927}
    904928
    905929.chart-range-toggle {
     930    margin-right: -6px;
     931    padding: 5px 10px;
     932    border: 1px solid #cccccc;
    906933    background: #f7f7f7;
     934    font-size: 13px;
    907935    color: #666666;
    908     font-size: 13px;
    909     border: 1px solid #cccccc;
     936    text-align: center;
    910937    cursor: pointer;
    911     text-align: center;
    912     padding: 5px 10px;
    913     margin-right: -6px;
    914938}
    915939
     
    919943
    920944.chart-range-toggle:first-of-type {
     945    border-right: 0;
    921946    border-radius: 3px 0 0 3px;
    922     border-right: 0;
    923947}
    924948
    925949.chart-range-toggle:last-of-type {
     950    margin-right: 0;
     951    border-left: 0;
    926952    border-radius: 0 3px 3px 0;
    927     border-left: 0;
    928     margin-right: 0;
    929953}
    930954
    931955#roost-metric-options {
    932     display: block;
    933956    height: 27px;
    934957    position: absolute;
     958    bottom: 14px;
    935959    left: 30px;
    936     bottom: 14px;
    937960}
    938961
    939962.chart-metric-toggle {
     963    height: 22px;
     964    position: relative;
     965    z-index: 10;
    940966    float: left;
     967    margin-right: 10px;
     968    padding: 5px 10px 0;
     969    border-bottom: 0;
     970    border: 1px solid #cccccc;
     971    background-color: #e4e4e4;
    941972    font-size: 13px;
    942973    color: #666666;
    943     cursor: pointer;
    944     height: 22px;
    945     padding: 5px 10px 0;
    946     background-color: #e4e4e4;
    947974    text-align: center;
    948     border: 1px solid #cccccc;
    949     border-bottom: 0;
    950     position: relative;
    951     z-index: 10;
    952975    text-indent: 0;
    953976    letter-spacing: 0;
    954     margin-right: 10px;
     977    cursor: pointer;
    955978}
    956979
     
    960983
    961984.chart-metric-toggle.active {
     985    position: relative;
     986    z-index: 50;
     987    border-bottom: none;
    962988    background-color: #fafafa;
    963     position: relative;
    964     z-index: 50;
    965989}
    966990
    967991#roost-curtain {
     992    display: inline-block;
     993    width: 100%;
    968994    height: 100%;
    969     display: inline-block;
    970995    position: absolute;
    971     background: #fafafa;
    972     width: 100%;
    973996    top: 0;
    974997    left: 0;
     998    background: #fafafa;
    975999}
    9761000
    9771001#roost-curtain-notice {
     1002    width: 375px;
     1003    height: 5px;
     1004    position: relative;
     1005    top: 100px;
    9781006    margin: 0 auto;
    979     position: relative;
    980     top: 100px;
     1007    padding: 10px 0 25px;
     1008    border-radius: 15px;
    9811009    background: #e4e4e4;
    9821010    color: #666666;
    983     border-radius: 15px;
    984     padding: 10px 0 25px;
    985     height: 5px;
    9861011    text-align: center;
    987     width: 375px;
    9881012    opacity: 0.8;
    9891013}
     
    9911015#roost-recent-activity {
    9921016    height: 275px;
     1017    position: relative;
     1018    z-index: 25;
    9931019    border-top: 1px solid #cccccc;
    994     position: relative;
    995     z-index: 25;
    996 }
     1020}
     1021
     1022#custom-note,
     1023#custom-note input {
     1024    display: none;
     1025    margin-top: 5px;
     1026}
     1027
     1028#custom-note-text-trigger {
     1029    display: block;
     1030    margin: 10px 0 0 10px;
     1031    color: #666666;
     1032}
     1033
     1034#custom-note a {
     1035    cursor: pointer;
     1036}
     1037
     1038#custom-note i {
     1039    font-size: 11px;
     1040}
     1041
     1042#custom-note input {
     1043    width: 100%;
     1044    margin-top: 0;
     1045    padding: 10px 10px 5px;
     1046}
  • roost-for-bloggers/trunk/layout/js/roostGoogleFont.js

    r885625 r962489  
    33  };
    44  (function() {
    5     var wf = document.createElement('script');
     5    var wf = document.createElement( 'script' );
    66    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
    77      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    88    wf.type = 'text/javascript';
    99    wf.async = 'true';
    10     var s = document.getElementsByTagName('script')[0];
    11     s.parentNode.insertBefore(wf, s);
     10    var s = document.getElementsByTagName( 'script' )[0];
     11    s.parentNode.insertBefore( wf, s );
    1212  })();
  • roost-for-bloggers/trunk/layout/js/roostbbp.js

    r925987 r962489  
    1 window._roostCallback = function(data){
    2     if(data.registered){
    3         if(data.enabled){
     1window._roostCallback = function( data ) {
     2    if ( data.registered ) {
     3        if ( data.enabled ) {
    44            roostToken = data.deviceToken;
    55            roostEnabled = data.enabled;
  • roost-for-bloggers/trunk/layout/js/roostscript.js

    r928005 r962489  
    1 (function($) {
    2     var $roostAdmin = $('.roost-admin-section');   
     1(function( $ ) {
     2    var $roostAdmin = $( '.roost-admin-section' );
    33    $roostAdmin.hide();
    4     $('#roost-activity').show();
    5        
    6     $('#roost-tabs li').on('click', function(){
    7         $(this).parent().find('.active').removeClass('active');
    8         $(this).addClass('active');
    9         var index = $(this).index();
    10         if(index === 0) {
     4    $( '#roost-activity' ).show();
     5    $( '#roost-tabs li' ).on( 'click', function() {
     6        $( this ).parent().find( '.active' ).removeClass( 'active' );
     7        $( this ).addClass( 'active' );
     8        var index = $( this ).index();
     9        if( 0 === index ) {
    1110            $roostAdmin.hide();
    12             $('#roost-activity').show();
    13         } else if (index === 1) {
     11            $( '#roost-activity' ).show();
     12        } else if ( 1 === index ) {
    1413            $roostAdmin.hide();
    15             $('#roost-manual-push').show();
     14            $( '#roost-manual-push' ).show();
    1615        } else {
    17             $roostAdmin.hide();           
    18             $('#roost-settings').show();
     16            $roostAdmin.hide();
     17            $( '#roost-settings' ).show();
    1918        }
    2019    });
    21 
    22     var roostInput = $('#roostManualNote');
    23     var roostCount = $('#roostManualNoteCountInt');
     20    var roostInput = $( '#roost-manual-note' );
     21    var roostCount = $( '#roost-manual-note-count-int' );
    2422    var roostLimit = 70;
    25 
    26     roostInput.keyup(function() {
    27         var n = this.value.replace(/{.*?}/g, '').length;
     23    roostInput.keyup( function() {
     24        var n = this.value.replace( /{.*?}/g, '' ).length;
    2825        if ( n > ( roostLimit - 11 ) ){
    29             if(!roostCount.hasClass('roostWarning')){
    30                 roostCount.addClass('roostWarning');   
     26            if( ! roostCount.hasClass( 'roostWarning' ) ) {
     27                roostCount.addClass( 'roostWarning' );
    3128            }
    3229        } else if ( n < roostLimit - 10 ) {
    33             if(roostCount.hasClass('roostWarning')){
    34                 roostCount.removeClass('roostWarning');   
     30            if( roostCount.hasClass( 'roostWarning' ) ) {
     31                roostCount.removeClass( 'roostWarning' );
    3532            }
    3633        }
    3734        roostCount.text( 0 + n );
    38     }).triggerHandler('keyup');
    39 })(jQuery);
     35    }).triggerHandler( 'keyup' );
     36    if ( $( '#prompt-event' ).is( ':checked' ) ) {
     37        $( '#roost-event-hints' ).css( 'display', 'inline-block' ).show();
     38        $( '.roost-block' ).height( '483px' );
     39        $( '#roost-event-hints-disclaimer' ).show();
     40    }
     41    $( '#prompt-event' ).change( function () {
     42        $( '#roost-event-hints' ).slideToggle( 100 );
     43        var height = $( '.roost-block' ).height();
     44        if ( 483 === height ) {
     45            $( '.roost-block' ).animate({
     46                height: 288,
     47            }, 150 );
     48            $( '#roost-event-hints-disclaimer' ).hide();
     49        } else {
     50            $( '.roost-block' ).animate({
     51                height: 483,
     52            }, 150 );
     53            $( '#roost-event-hints-disclaimer' ).show();
     54        }
     55    });
     56    $( '#prompt-min' ).change( function () {
     57        $( '#roost-min-visits' ).attr( 'disabled', ! this.checked );
     58    });
     59    $( '#custom-note' ).remove().insertAfter( '#post-body #title' ).show();
     60    $( '#custom-note-text-trigger' ).on( 'click', 'a', function() {
     61        var $this = $(this);
     62        var action = $this.data( 'action' );
     63        if ( 'change' === action ) {
     64            $( '#custom-note-text-trigger' ).fadeOut( 100, function() {
     65                $( '#custom-note-text' ).fadeIn( 100 );
     66            });
     67        } else {
     68            var data = {
     69                postID: $this.data('id'),
     70                action: 'remove_headline',
     71            };
     72            $.post( ajaxurl, data, function() {
     73                $( '#custom-note-text' ).val( '' );
     74                $( '.roost-headline-cage' ).fadeOut( 100, function() {
     75                    $( '.roost-headline-cage' ).html( '<a class="roost-headline" data-action="change">Use Custom Text for your Push Notification</a>' ).fadeIn( 150 );
     76                });
     77            });
     78        }
     79    });
     80})( jQuery );
  • roost-for-bloggers/trunk/readme.txt

    r943608 r962489  
    33Tags: safari, push, push notifications, web push notifications, Mavericks, mobile, web push, roost, roost.me, roost_me, goroost, goroost.com Post, plugin, admin, posts, page, links, widget, ajax, social, wordpress, dashboard, news, notifications, services
    44Requires at least: 3.8
    5 Tested up to: 3.9.1
    6 Stable tag: 2.1.4
     5Tested up to: 4.0
     6Stable tag: 2.1.5
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1717
    1818* **Safari Web Push** - Take advantage of web push (Desktop Push Notifications) on OS X Mavericks.
     19* **Notification Prompt Controls** - Decide how and when the subscription prompt is shown to your visitors.
     20* **Custom Notification Headlines** - Set a custom headline for your notification to be used instead of a post title.
    1921* **bbPress Subscriptions** - Allows site visitors to subscribe to forums, topics, or individual messages when posting replies.
    2022* **Detailed Analytics** - *Charts* with detailed metrics about your visitors straight to your WordPress dashboard.
     
    2527**Free** Roost account included. No setup fees, no surprises, and no limitations on your site visitors.
    2628
    27 [vimeo http://vimeo.com/99195697]
     29[youtube http://www.youtube.com/watch?v=DxElgkUsrCA]
    2830
    2931== Installation ==
     
    4648To use Safari Web Push, simply activate the *Roost for Bloggers* plugin. When your site is viewed in a push-enabled browser, the browser will prompt for permission. No additional setup is needed.
    4749
     50**Notification Prompt Control**
     51Control how and when you display the subscription prompt to your site visitors. From the settings tab, you can set a minimum number of visits, or create a link or button to trigger the prompt. When a button or link is used, if the browser is not able to receive push notifications, we will automatically hide the link or button.
     52
     53**Custom Notification Headlines**
     54Use custom text for your notification headline by setting it underneath the standard post title when creating your content. If you set a custom headline, it will be used for your notification. Not setting a headline will default to your post title.
     55
    4856**bbPress**
    4957With the bbPress extension for Roost, an additional subscribe option will appear next to the default bbPress subscription links. (This does NOT replace traditional subscription methods, only adds a new browser push channel.) Options include Forum subscriptions, Topic subscriptions, and subscribing to your individual posts. Notifications are sent about new content **only** to the visitors that have subscribed to the forum, topic, or post.
     
    7684
    7785= Do I need and Apple Developer Account or Google Play Developer account? =
    78 Nope. We've got you covered.
     86Nah. We've got you covered.
    7987
    8088= Do you support Google Chrome or Firefox for desktop push? =
     
    8290
    8391= Do my readers / subscribers have to create an account with Roost? =
    84 Nope. We have a patent-pending *zero-configuration* installation process for the Roost app. When a person hits your subscription link, the are sent to the Roost page on their device's app store, and prompted for install. Once installed and opened, a person is sent directly back to the page they were viewing on your site.
     92Nope. Just you.
    8593
    8694
    8795== Screenshots ==
    8896
    89 1. Create your Roost Account. (It's Free!)
    90 2. Log in to your Roost Account.
    91 3. Roost plugin from the Wordpress dashboard showing analytics, manual push, and settings.
     971. One-Click to subscribe for visitors to your site. Easy peasy!
     982. Notifications will be delivered in the top-right corner of your subscribers screen.
     993. Create your Roost Account. (It's Free!)
     1004. Or log in to your existing Roost account.
     1015. Roost plugin from the WordPress dashboard showing analytics.
     1026. Powerful control on how your visitors can subscribe and how your notifications are sent.
    92103
    93104== Changelog ==
     105= 2.1.5 =
     106* Control for Prompt - auto prompt, after number of visits, off, on button / link click
     107* Added custom headline option for notification when publishing a post
     108* Cleared for takeoff with WordPress v4.0
     109* Bugfix - Roost JS now only loaded if logged into plugin.
     110* Bugfix - Total notifications sent in dashboard now really total notifications *Palm to Face*
     111* Code Cleanup
     112
    94113= 2.1.4 =
    95114* Bugfix - Fixed bug that prevented stats from displaying when WordPress admin accessed via HTTPS
     
    174193
    175194== Upgrade Notice ==
     195= 2.1.5 =
     196* Added prompt control and option for custom text on notifications when publishing a post. Also, pre-check compatible with WordPress v4.0
     197
    176198= 2.1.4 =
    177199* Bugfix - Fixed bug that prevented stats from displaying when WordPress admin accessed via HTTPS
  • roost-for-bloggers/trunk/roost.php

    r943608 r962489  
    44 * Plugin URI: http://goroost.com/
    55 * Description: Drive traffic to your website with Safari Mavericks push notifications and Roost.
    6  * Version: 2.1.4
     6 * Version: 2.1.5
    77 * Author: Roost
    88 * Author URI: http://goroost.com
     
    1616require_once( plugin_dir_path( __FILE__ ) . 'includes/class-roost-bbpress.php' );
    1717
    18 $roost = new Roost();
     18Roost::init();
     19
    1920$bbPress_active = Roost_bbPress::bbPress_active();
    20 
    21 if( !empty( $bbPress_active['present'] ) && !empty( $bbPress_active['enabled'] ) ) {
    22     $roost_bbp = new Roost_bbPress();
     21if ( ! empty( $bbPress_active['present'] ) && ! empty( $bbPress_active['enabled'] ) ) {
     22    Roost_bbPress::init();
    2323}
    24 
    25 register_activation_hook( __FILE__, array( 'ROOST', 'init' ) );
    26 register_uninstall_hook( __FILE__, array( 'ROOST', 'uninstall' ) );
Note: See TracChangeset for help on using the changeset viewer.