Changeset 962489
- Timestamp:
- 08/08/2014 03:55:46 PM (11 years ago)
- Location:
- roost-for-bloggers
- Files:
-
- 28 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
roost-for-bloggers/trunk/includes/class-roost-api.php
r940152 r962489 9 9 public static function roost_remote_request( $remote_data ) { 10 10 $auth_creds = ''; 11 if ( ! empty( $remote_data['appkey'] ) ) {11 if ( ! empty( $remote_data['appkey'] ) ) { 12 12 $auth_creds = 'Basic ' . base64_encode( $remote_data['appkey'] .':'.$remote_data['appsecret'] ); 13 13 } … … 46 46 ); 47 47 $response = self::roost_remote_request( $remote_data ); 48 return $response; 48 return $response; 49 49 } 50 50 … … 64 64 ); 65 65 $response = self::decode_data( $remote_data ); 66 return $response; 66 return $response; 67 67 } 68 68 … … 114 114 } 115 115 116 if ( !empty( $remote_content ) ) {116 if ( ! empty( $remote_content ) ) { 117 117 $remote_data = array( 118 118 'method' => 'PUT', … … 131 131 'alert' => $alert, 132 132 ); 133 if ( null === $remote_content['alert'] ) {133 if ( null === $remote_content['alert'] ) { 134 134 $remote_content['alert'] = ''; 135 135 } -
roost-for-bloggers/trunk/includes/class-roost-bbpress.php
r925987 r962489 9 9 'enabled' => $roost_settings['bbPress'], 10 10 ); 11 if ( class_exists( 'bbPress' ) ) {11 if ( class_exists( 'bbPress' ) ) { 12 12 $bbPress['present'] = true; 13 13 } … … 16 16 17 17 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() { 44 48 wp_enqueue_script( 'roostbbpjs', ROOST_URL . 'layout/js/roostbbp.js', array('jquery'), Roost::$roost_version, false ); 45 49 } 46 50 47 public function roost_bbp_reply_subscription( $post ) {51 public static function roost_bbp_reply_subscription( $post ) { 48 52 global $post; 49 53 $roost_bbp_subscriptions = get_post_meta( $post->ID, 'roost_bbp_subscription', true ); … … 56 60 <script> 57 61 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 ) ) { 64 68 $reply_bbp_subscriptions = json_encode( $roost_bbp_subscriptions ); 65 69 ?> 66 70 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 ); 70 74 } 71 75 } … … 74 78 ?> 75 79 } 76 }, 1500 );80 }, 1500 ); 77 81 }); 78 82 </script> … … 80 84 } 81 85 82 public function roost_bbp_topic_subscription( $post ) {86 public static function roost_bbp_topic_subscription( $post ) { 83 87 global $post; 84 88 $post_id = $post->ID; … … 95 99 var subscribeWrap = $('#roost-subscribe-<?php echo( $post_id ); ?>'); 96 100 <?php 97 if ( ! empty( $roost_bbp_subscriptions ) ) {101 if ( ! empty( $roost_bbp_subscriptions ) ) { 98 102 $reply_bbp_subscriptions = json_encode( $roost_bbp_subscriptions ); 99 103 ?> 100 104 var registrations = <?php echo( $reply_bbp_subscriptions ); ?>; 101 <?php 105 <?php 102 106 } else { 103 107 ?> … … 108 112 109 113 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' ); 115 119 } 116 120 } 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' ); 119 123 } 120 124 <?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(); 130 134 <?php 131 135 } else { 132 136 ?> 133 137 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(); 135 139 <?php 136 140 } … … 139 143 }, 1500); 140 144 141 subscribeLink.on( 'click', function(e){145 subscribeLink.on( 'click', function( e ){ 142 146 e.preventDefault(); 143 147 var data = { … … 146 150 roostToken: window.roostToken, 147 151 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 ) { 158 162 159 163 }); … … 164 168 } 165 169 166 function roost_bbp_ajax_subscription() {170 public static function roost_bbp_ajax_subscription() { 167 171 $post_id = $_POST['postID']; 168 172 self::roost_bbp_subscriptions_handler( $post_id ); … … 170 174 } 171 175 172 public function roost_bbp_forum_subscription( $post ) {176 public static function roost_bbp_forum_subscription( $post ) { 173 177 global $post; 174 178 $post_id = $post->ID; … … 185 189 var subscribeWrap = $('#roost-subscribe-<?php echo( $post_id ); ?>'); 186 190 <?php 187 if ( ! empty( $roost_bbp_subscriptions ) ) {191 if ( ! empty( $roost_bbp_subscriptions ) ) { 188 192 $reply_bbp_subscriptions = json_encode( $roost_bbp_subscriptions ); 189 193 ?> 190 194 var registrations = <?php echo( $reply_bbp_subscriptions ); ?>; 191 <?php 195 <?php 192 196 } else { 193 197 ?> … … 198 202 199 203 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' ); 205 209 } 206 210 } 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' ); 209 213 } 210 214 <?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( ' | ' ); 215 219 <?php 216 220 } else { 217 221 ?> 218 subscribeWrap.wrap( "<div id='subscription-toggle'></div>").show();222 subscribeWrap.wrap( "<div id='subscription-toggle'></div>" ).show(); 219 223 <?php 220 224 } … … 223 227 }, 1500); 224 228 225 subscribeLink.on( 'click', function(e){229 subscribeLink.on( 'click', function( e ){ 226 230 e.preventDefault(); 227 231 var data = { 228 link: subscribeLink.attr( 'href'),229 action: subscribeLink.data( 'action'),232 link: subscribeLink.attr( 'href' ), 233 action: subscribeLink.data( 'action' ), 230 234 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 ) { 242 246 243 247 }); … … 248 252 } 249 253 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'] ) ) { 252 256 $action = $_POST['action']; 253 257 $roost_device_token = $_POST['roostToken']; 254 } elseif ( isset( $_POST['roost-bbp-device-token'] ) ) {258 } elseif ( isset( $_POST['roost-bbp-device-token'] ) ) { 255 259 $action = false; 256 260 $roost_device_token = $_POST['roost-bbp-device-token']; … … 259 263 } 260 264 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'] ) ) { 263 267 $roost_bbp_subscription = true; 264 268 } else { … … 267 271 268 272 $subscriptions = get_post_meta( $post_id, 'roost_bbp_subscription', true ); 269 if ( !empty( $subscriptions ) ) {273 if ( ! empty( $subscriptions ) ) { 270 274 if ( isset( $subscriptions[$roost_device_token] ) ) { 271 if ( true === $roost_bbp_subscription ) {275 if ( true === $roost_bbp_subscription ) { 272 276 return; 273 277 } else { … … 275 279 } 276 280 } else { 277 if ( true === $roost_bbp_subscription ) {281 if ( true === $roost_bbp_subscription ) { 278 282 $subscriptions[$roost_device_token] = $roost_bbp_subscription; 279 283 } … … 287 291 } 288 292 289 if ( ( !empty( $roost_device_token ) ) && ( 'roost_bbp_subscribe' === $action ) ) {293 if ( ( ! empty( $roost_device_token ) ) && ( 'roost_bbp_subscribe' === $action ) ) { 290 294 $subscriptions = get_post_meta( $post_id, 'roost_bbp_subscription', true ); 291 if ( !empty( $subscriptions ) ) {295 if ( ! empty( $subscriptions ) ) { 292 296 $subscriptions[$roost_device_token] = true; 293 297 } else { … … 299 303 } 300 304 301 if ( ( !empty( $roost_device_token ) ) && ( 'roost_bbp_unsubscribe' === $action ) ) {305 if ( ( ! empty( $roost_device_token ) ) && ( 'roost_bbp_unsubscribe' === $action ) ) { 302 306 $subscriptions = get_post_meta( $post_id, 'roost_bbp_subscription', true ); 303 307 unset( $subscriptions[$roost_device_token] ); 304 308 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 ) { 309 313 delete_post_meta( $action, 'roost_bbp_subscription' ); 310 314 } 311 315 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 ) { 313 317 $topic_id = bbp_get_topic_id( $topic_id ); 314 318 $forum_id = bbp_get_forum_id( $forum_id ); … … 320 324 $topic_title = bbp_get_topic_title( $topic_id ); 321 325 $topic_url = get_permalink( $topic_id ); 322 if ( isset( $_POST['bbp_reply_to'] ) ) {326 if ( isset( $_POST['bbp_reply_to'] ) ) { 323 327 $reply_to_id = $_POST['bbp_reply_to']; 324 328 } … … 330 334 $message = 'New Post in ' . $topic_title; 331 335 332 if ( !empty( $reply_to_id ) ) {336 if ( ! empty( $reply_to_id ) ) { 333 337 $reply_subscriptions = get_post_meta( $reply_to_id, 'roost_bbp_subscription', true ); 334 338 } … … 337 341 $forum_subscriptions = get_post_meta( $forum_id, 'roost_bbp_subscription', true ); 338 342 339 if ( !empty( $reply_subscriptions ) ) {343 if ( ! empty( $reply_subscriptions ) ) { 340 344 $device_tokens = array(); 341 345 foreach( $reply_subscriptions as $token => $active ) { … … 344 348 } 345 349 346 if ( !empty( $topic_subscriptions ) ) {347 if ( empty( $device_tokens ) ) {350 if ( ! empty( $topic_subscriptions ) ) { 351 if ( empty( $device_tokens ) ) { 348 352 $device_tokens = array(); 349 353 } … … 353 357 } 354 358 355 if ( !empty( $forum_subscriptions ) ) {356 if ( empty( $device_tokens ) ) {359 if ( ! empty( $forum_subscriptions ) ) { 360 if ( empty( $device_tokens ) ) { 357 361 $device_tokens = array(); 358 362 } … … 362 366 } 363 367 364 if ( empty( $device_tokens) ) {368 if ( empty( $device_tokens) ) { 365 369 return; 366 370 } 367 371 Roost_API::send_notification( $message, $topic_url, null, $app_key, $app_secret, $device_tokens ); 368 } 372 } 369 373 } -
roost-for-bloggers/trunk/includes/class-roost-core.php
r943608 r962489 3 3 class Roost { 4 4 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 17 9 public static function site_url() { 18 10 return get_option( 'siteurl' ); 19 11 } 20 12 21 13 public static function registration_url() { 22 14 $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' ); 24 16 $url = $tld . urlencode( $admin_path . '&source=wpplugin' ); 25 17 return $url; … … 28 20 public static function login_url( $sso ) { 29 21 $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' ); 31 23 $url = $tld . urlencode( $admin_path ); 32 24 $url = $url . '&oauth=' . $sso; 33 25 return $url; 34 26 } 35 27 36 28 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(); 41 38 $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 ) { 43 45 if ( empty( $roost_settings ) ) { 44 46 $roost_settings = array( … … 48 50 'autoPush' => 0, 49 51 '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 ); 52 58 } 53 if ( self::$roost_version !== $roost_settings['version'] ) {59 if ( self::$roost_version !== $roost_settings['version'] ) { 54 60 self::update( $roost_settings ); 55 61 } 56 self::roost_activated();57 62 } 58 63 59 64 public static function update( $roost_settings ) { 60 65 $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 ) { 63 68 self::update_database( $roost_settings ); 64 69 } … … 66 71 67 72 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'] ) ) { 71 75 $roost_settings['bbPress'] = 1; 72 76 } 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; 74 82 update_option('roost_settings', $roost_settings); 75 83 } 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'] ) ){ 85 90 wp_redirect( admin_url( 'admin.php?page=roost-web-push' ) ); 86 91 exit; … … 88 93 } 89 94 } 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 110 101 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' ) ); 116 108 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 ) { 122 122 $rlink = array( 123 123 '<a href="' . admin_url( 'admin.php?page=roost-web-push' ) . '">Go to Plugin</a>', … … 126 126 } 127 127 128 public function add_async( $url ) {128 public static function add_async( $url ) { 129 129 if ( false === strpos( $url, '#async' ) ) { 130 130 return $url; … … 136 136 } 137 137 138 public function byline() {138 public static function byline() { 139 139 $byline = "<!-- Push notifications for this website enabled by Roost. Support for Safari, Firefox, and Chrome Browser Push. (v ". self::$roost_version .") - http://goroost.com/ -->"; 140 140 echo "\n${byline}\n"; 141 141 } 142 142 143 public function roostJS() {143 public static function roostJS() { 144 144 $roost_settings = self::roost_settings(); 145 145 $app_key = $roost_settings['appKey']; 146 if ( ! empty( $app_key ) ) { 146 147 ?> 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> 148 182 <?php 149 } 150 183 } 184 } 185 } 186 151 187 public static function setup_notice() { 152 188 global $hook_suffix; … … 156 192 $app_key = $roost_settings['appKey']; 157 193 158 if ( ! $app_key && ( $hook_suffix !== $roost_page ) ) {194 if ( ! $app_key && ( $hook_suffix !== $roost_page ) ) { 159 195 ?> 160 <div class="updated" id="roost SetupNotice">161 <div id="roost NoticeLogo">196 <div class="updated" id="roost-setup-notice"> 197 <div id="roost-notice-logo"> 162 198 <img src="<?php echo( ROOST_URL . 'layout/images/roost_logo.png' ) ?>" /> 163 199 </div> 164 <div id="roost NoticeText">200 <div id="roost-notice-text"> 165 201 <p> 166 202 Thanks for installing the Roost plugin! You’re almost finished with<br />setup, all you need to do is create an account and login. 167 203 </p> 168 204 </div> 169 <div id="roost NoticeTarget">170 <a href="<?php echo( admin_url( 'admin.php?page=roost-web-push' ) ); ?>" id="roost NoticeCTA" >171 <span id="roost NoticeCTAHighlight"></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> 172 208 Finish Setup 173 209 </a> 174 210 </div> 175 </div> 211 </div> 176 212 <?php 177 } else if ( ! $app_key && ( $hook_suffix === $roost_page ) ) {213 } else if ( ! $app_key && ( $hook_suffix === $roost_page ) ) { 178 214 $api_check = Roost_API::api_check(); 179 215 if ( is_wp_error( $api_check ) ) { … … 185 221 } 186 222 187 public function admin_menu_add(){223 public static function admin_menu_add(){ 188 224 add_menu_page( 189 225 'Roost Web Push', … … 194 230 ROOST_URL . 'layout/images/roost_thumb.png' 195 231 ); 196 } 232 } 197 233 198 234 public static function admin_scripts() { … … 201 237 $roost_settings = self::roost_settings(); 202 238 $app_key = $roost_settings['appKey']; 203 if ( ! empty( $app_key ) ) {239 if ( ! empty( $app_key ) ) { 204 240 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 ); 208 244 } 209 245 } … … 220 256 $roost_settings['autoPush'] = $form_data['autoPush']; 221 257 $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']; 222 261 update_option('roost_settings', $roost_settings); 223 262 } 224 263 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'] ) ) { 227 266 return false; 228 267 } else { 229 268 $no_note = get_post_meta( $post_id, 'roostOverride', true ); 230 269 $send_note = get_post_meta( $post_id, 'roostForce', true ); 231 if ( isset( $_POST['roostOverride'] ) && ! $no_note ) {270 if ( isset( $_POST['roostOverride'] ) && ! $no_note ) { 232 271 $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 ) { 235 274 delete_post_meta( $post_id, 'roostOverride' ); 236 275 } 237 if ( isset( $_POST['roostForce'] ) && ! $send_note ) {276 if ( isset( $_POST['roostForce'] ) && ! $send_note ) { 238 277 $override_setting = $_POST['roostForce']; 239 278 add_post_meta( $post_id, 'roostForce', $override_setting, true ); 240 } elseif ( ! isset( $_POST['roostForce'] ) && $send_note ) {279 } elseif ( ! isset( $_POST['roostForce'] ) && $send_note ) { 241 280 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'] ); 242 284 } 243 285 } … … 257 299 } 258 300 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 ) ) { 261 303 $post_type = get_post_type( $post ); 262 304 if ( 'post' === $post_type && 'publish' === $new_status ) { … … 267 309 $auto_push = $roost_settings['autoPush']; 268 310 269 if ( ! empty( $app_key ) ) {311 if ( ! empty( $app_key ) ) { 270 312 if ( ( 'publish' === $new_status && 'future' === $old_status ) || empty( $_POST['hiddenRooster'] ) ) { 271 313 $override = get_post_meta( $post_id, 'roostOverride', true ); … … 275 317 $override = $_POST['roostOverride']; 276 318 } 277 if ( isset( $_POST['roostForce'] ) ) {319 if ( isset( $_POST['roostForce'] ) ) { 278 320 $send_note = $_POST['roostForce']; 279 321 } 280 322 } 281 323 } 282 if ( ( 1 == $auto_push || ! empty( $send_note ) ) && !empty( $app_key ) ) {324 if ( ( 1 == $auto_push || ! empty( $send_note ) ) && ! empty( $app_key ) ) { 283 325 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 } 285 331 $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 ) ); 288 334 $image_url = $raw_image[0]; 289 335 } else { 290 336 $image_url = null; 291 337 } 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 ); 293 339 } 294 340 } … … 297 343 } 298 344 299 public function note_override(){345 public static function note_override() { 300 346 global $post; 301 347 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 } 305 351 $roost_settings = self::roost_settings(); 306 352 $app_key = $roost_settings['appKey']; 307 353 $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;"' : '' ); 310 356 $pid = get_the_ID(); 311 if ( 1 == $auto_push ) {357 if ( 1 == $auto_push ) { 312 358 $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"' : '' ); 314 360 echo '<strong>Do NOT</strong> send notification with <strong>Roost</strong></label>'; 315 361 } else { 316 362 $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"' : '' ); 318 364 echo '<strong>Send</strong> notification with <strong>Roost</strong></label>'; 319 365 } … … 323 369 } 324 370 } 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 326 396 public static function complete_login( $logged_in, $site ) { 327 if ( ! empty( $logged_in ) ) {397 if ( ! empty( $logged_in ) ) { 328 398 if ( true === $logged_in['success'] ) { 329 399 if ( count( $logged_in['apps'] ) > 1 ){ … … 337 407 } 338 408 } 339 } elseif ( ! empty( $site ) ) {409 } elseif ( ! empty( $site ) ) { 340 410 $site_key = $site[0]; 341 411 $site_secret = $site[1]; … … 348 418 $response = array(); 349 419 350 if ( ! empty( $form_keys ) ) {420 if ( ! empty( $form_keys ) ) { 351 421 self::update_keys( $form_keys ); 352 422 $response['status'] = true; … … 363 433 } 364 434 365 public function graph_reload() {435 public static function graph_reload() { 366 436 $roost_settings = self::roost_settings(); 367 437 $app_key = $roost_settings['appKey']; … … 374 444 $roost_graph_data = json_encode( $roost_graph_data ); 375 445 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() { 380 456 $roost_settings = self::roost_settings(); 381 457 $app_key = $roost_settings['appKey']; … … 387 463 } 388 464 389 public function roost_logout() {465 public static function roost_logout() { 390 466 if ( isset( $_POST['clearkey'] ) ) { 391 467 $form_keys = array( … … 401 477 } 402 478 } 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 } 403 530 404 public function manual_send() {531 public static function manual_send() { 405 532 if ( isset( $_POST['manualtext'] ) ) { 406 533 $manual_text = $_POST['manualtext']; … … 426 553 wp_redirect( admin_url( 'admin.php?page=roost-web-push' ) . '&status=' . $status ); 427 554 exit; 428 } 555 } 429 556 } 430 557 … … 432 559 $roost_settings = self::roost_settings(); 433 560 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 ) ) { 442 565 $roost_active_key = true; 443 566 $bbPress_active = Roost_bbPress::bbPress_active(); … … 446 569 } 447 570 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 ); 450 573 $roost_stats = Roost_API::get_stats( $app_key, $app_secret ); 451 574 } … … 457 580 $response = self::complete_login( $logged_in, null ); 458 581 $first_time = $response['firstTime']; 459 $roost_server_settings = $response['server_settings']; 582 $roost_server_settings = $response['server_settings']; 460 583 $roost_stats = $response['stats']; 461 584 $roost_active_key = true; … … 467 590 $logged_in = Roost_API::login( $roost_user, $roost_pass, null ); 468 591 $response = self::complete_login( $logged_in, null ); 469 if ( empty( $response['status'] ) ) {592 if ( empty( $response['status'] ) ) { 470 593 $roost_sites = $response; 471 594 } else { 472 if ( !empty( $response['firstTime'] ) ) {595 if ( ! empty( $response['firstTime'] ) ) { 473 596 $first_time = $response['firstTime']; 474 $roost_server_settings = $response['server_settings']; 597 $roost_server_settings = $response['server_settings']; 475 598 $roost_stats = $response['stats']; 476 599 $roost_active_key = true; … … 486 609 $response = self::complete_login( null, $site ); 487 610 $first_time = $response['firstTime']; 488 $roost_server_settings = $response['server_settings']; 611 $roost_server_settings = $response['server_settings']; 489 612 $roost_stats = $response['stats']; 490 613 $roost_active_key = true; 491 614 } 492 493 615 if ( isset( $_GET['status'] ) ) { 494 616 $status = urldecode( $_GET['status'] ); 495 617 } 496 618 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' ); 521 620 } 522 621 } -
roost-for-bloggers/trunk/layout/admin.php
r940152 r962489 1 1 <div id="rooster"> 2 2 <div id="roost-header"> 3 <?php if ( $roost_active_key ){ ?>3 <?php if ( $roost_active_key ) { ?> 4 4 <div class="roost-wrapper"> 5 <div id="roost-header-right"> 5 <div id="roost-header-right"> 6 6 <form action="" method="post"> 7 <input type="Submit" id="roost LogOut" class="type-submit" name="clearkey" value="Log Out" />7 <input type="Submit" id="roost-log-out" name="clearkey" value="Log Out" /> 8 8 </form> 9 9 <span id="roost-username"> 10 <span id="roost UserLogo">10 <span id="roost-user-logo"> 11 11 <?php echo get_avatar($roost_server_settings['ownerEmail'], 25 ); ?> 12 12 </span> … … 17 17 </div> 18 18 <img src="<?php echo ROOST_URL; ?>layout/images/roost-red-logo.png" /> 19 <?php if ( $roost_active_key ) { ?>19 <?php if ( $roost_active_key ) { ?> 20 20 <div id="roost-site-name"><?php echo( $roost_server_settings['name'] ); ?></div> 21 21 <?php } ?> … … 23 23 <?php } ?> 24 24 </div> 25 <?php if ( ! empty( $first_time ) ) { ?>25 <?php if ( ! empty( $first_time ) ) { ?> 26 26 <div class="updated roost-wrapper" id="roost-first-time-setup"> 27 <div id="roost NoticeText">27 <div id="roost-notice-text"> 28 28 <h3>Welcome to Roost, the plugin is up and running!</h3> 29 29 <h4>Your site visitors can now opt-in to receive notifications from you. ( Safari / Mavericks only right now )</h4> 30 30 </div> 31 <div id="roost NoticeTarget">32 <a href="#" id="roost NoticeCTA" ><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> 33 33 </div> 34 34 </div> … … 38 38 <?php } ?> 39 39 <!--BEGIN ADMIN TABS--> 40 <?php if ( $roost_active_key ) { ?>40 <?php if ( $roost_active_key ) { ?> 41 41 42 42 <div id="roost-tabs" class="roost-wrapper"> … … 49 49 <?php } ?> 50 50 <!--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':''); ?>"> 52 52 <div id="roost-main-wrapper"> 53 53 <!--BEGIN USER LOGIN SECTION--> 54 <?php if ( !$roost_active_key ) { ?>54 <?php if ( ! $roost_active_key ) { ?> 55 55 <form action="" method="post"> 56 56 <div id="roost-login-wrapper"> 57 <?php if ( empty( $roost_sites ) ){ ?>57 <?php if ( empty( $roost_sites ) ){ ?> 58 58 <div id="roost-signup-wrapper"> 59 59 <div id="roost-signup-inner"> … … 81 81 <div class="roost-login-input"> 82 82 <span class="roost-label">Email:</span> 83 <input name="roostuserlogin" type="text" class=" type-textroost-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" /> 84 84 </div> 85 85 <div class="roost-login-input"> 86 86 <!--PASSWORD--> 87 87 <span class="roost-label">Password:</span> 88 <input name="roostpasslogin" type="password" class=" type-textroost-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 ) ) { ?> 91 91 <!--CONFIGS--> 92 92 <div class="roost-login-input"> … … 104 104 ?> 105 105 </select> 106 <span class="roost Disclaimer">106 <span class="roost-disclaimer"> 107 107 To switch configurations after you log in, you will need to log out and choose a different configuration. 108 108 </span> 109 109 </div> 110 <?php } ?> 110 <?php } ?> 111 111 </div> 112 112 <div class="roost-primary-footer"> 113 113 <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" /> 115 115 <?php submit_button( 'Cancel', 'delete', 'cancel', false, array( 'tabindex' => '4' ) ); ?> 116 116 <span class="left-link"><a href="https://go.goroost.com/login?forgot=true" target="_blank">forget password?</a></span> … … 139 139 140 140 <!--BEGIN ALL TIME STATS SECTION--> 141 <?php if ( $roost_active_key ) { ?>141 <?php if ( $roost_active_key ) { ?> 142 142 <div id="roost-activity" class="roost-admin-section"> 143 143 <div id="roost-all-stats"> … … 150 150 </div> 151 151 <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> 153 153 <hr /> 154 154 <span class="roost-stat-label">Total notifications sent to your subscribers</span> … … 166 166 167 167 <!--BEGIN RECENT ACTIVITY SECTION--> 168 <?php if ( $roost_active_key ) { ?>168 <?php if ( $roost_active_key ) { ?> 169 169 <div class="roost-section-wrapper"> 170 170 <div class="roost-section-heading" id="roost-chart-heading"> … … 198 198 <div id="roost-curtain-notice">Graphs will appear once you have some subscribers.</div> 199 199 </div> 200 <div id="roostchart _dynamic" class="roostStats">200 <div id="roostchart-dynamic" class="roostStats"> 201 201 </div> 202 202 </div> … … 208 208 209 209 <!--BEGIN MANUAL PUSH SECTION--> 210 <?php if ( $roost_active_key ) { ?>210 <?php if ( $roost_active_key ) { ?> 211 211 <form action="" method="post" id="manual-push-form"> 212 212 <div id="roost-manual-push" class="roost-admin-section"> … … 220 220 <div class="roost-label">Notification text:</div> 221 221 <div class="roost-input-wrapper"> 222 <span id="roost ManualNoteCount"><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" /> 224 224 <span class="roost-input-caption">Enter the text for the notification you would like to send your subscribers.</span> 225 225 </div> … … 228 228 <div class="roost-label">Notification link:</div> 229 229 <div class="roost-input-wrapper"> 230 <input name="manuallink" type="text" class=" type-textroost-control-secondary" value="" size="50" />230 <input name="manuallink" type="text" class="roost-control-secondary" value="" size="50" /> 231 231 <span class="roost-input-caption">Enter a website link (URL) that your subscribers will be sent to upon clicking the notification.</span> 232 232 </div> 233 233 </div> 234 <input type="Submit" class=" type-submitroost-control-secondary" name="manualpush" id="manualpush" value="Send notification" />234 <input type="Submit" class="roost-control-secondary" name="manualpush" id="manualpush" value="Send notification" /> 235 235 </div> 236 236 </div> … … 241 241 </form> 242 242 <?php } ?> 243 <!--END MANUAL PUSH SECTION--> 243 <!--END MANUAL PUSH SECTION--> 244 244 245 245 <!--BEGIN SETTINGS SECTION--> 246 <?php if ( $roost_active_key ) { ?>246 <?php if ( $roost_active_key ) { ?> 247 247 <form action="" method="post"> 248 248 <div id="roost-settings" class="roost-admin-section"> … … 250 250 <span class="roost-section-heading">Settings</span> 251 251 <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' ); } ?>"> 254 254 <div class="roost-setting-wrapper"> 255 256 255 <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'" ); } ?> /> 258 257 <span class="roost-setting-caption">Automatically send a push notification to your subscribers every time you publish a new post.</span> 259 258 </div> 260 259 <div class="roost-setting-wrapper"> 261 260 <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'" ); } ?> /> 263 262 <span class="roost-setting-caption">This will automatically activate current and future features as they are added to the plugin.</span> 264 263 … … 266 265 <div class="roost-setting-wrapper"> 267 266 <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 • 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"><a href="#" class="roost-prompt-wp">Receive Desktop Notifications</a></span></span> 283 </div> 284 285 • 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" /> 273 291 </div> 274 292 </div> … … 279 297 <?php } ?> 280 298 <!--END SETTINGS SECTION--> 281 <div id="roost SupportTag">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> 282 300 </div> 283 301 </div> 284 302 <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' ); 288 306 }); 289 $( '#roostNoticeCTA').click(function(e) {307 $( '#roost-notice-CTA' ).click(function( e ) { 290 308 e.preventDefault(); 291 $( '#roost-first-time-setup').css('display', 'none');309 $( '#roost-first-time-setup' ).css( 'display', 'none' ); 292 310 }); 293 311 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' ); 300 317 }); 301 <?php if ( 0 !== $roost_stats['registrations'] ) { ?>302 $( '#roost-curtain').hide();318 <?php if ( 0 !== $roost_stats['registrations'] ) { ?> 319 $( '#roost-curtain' ).hide(); 303 320 var chart; 304 321 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' ), 308 325 offset: new Date().getTimezoneOffset(), 309 326 action: 'graph_reload', 310 327 }; 311 312 $('.chart-reload').on('click', function(e){ 328 $( '.chart-reload' ).on( 'click', function( e ) { 313 329 e.preventDefault(); 314 $("#roostchart_dynamic").html(""); 315 330 $( '#roostchart-dynamic' ).html( "" ); 316 331 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' ), 320 335 offset: new Date().getTimezoneOffset(), 321 336 action: 'graph_reload', 322 337 }; 323 338 324 graphDataRequest( data);339 graphDataRequest( data ); 325 340 }); 326 327 function graphDataRequest(data) { 328 $.post(ajaxurl, data, function(response) { 341 function graphDataRequest( data ) { 342 $.post( ajaxurl, data, function( response ) { 329 343 var data = $.parseJSON( response ); 330 loadGraph( data);344 loadGraph( data ); 331 345 }); 332 346 } 333 334 function loadGraph(data) { 335 $('roostchart_dynamic').html(''); 336 347 function loadGraph( data ) { 348 $( '#roostchart-dynamic' ).html( '' ); 337 349 chart = new Morris.Bar({ 338 element: 'roostchart_dynamic',350 element: $( '#roostchart-dynamic' ), 339 351 data: data, 340 barColors: [ "#e25351"],352 barColors: ['#e25351'], 341 353 xkey: 'label', 342 354 ykeys: ['value'], … … 347 359 }); 348 360 } 349 350 $(window).resize(function() { 361 $( window ).resize( function() { 351 362 chart.redraw(); 352 363 }); 353 graphDataRequest( data);364 graphDataRequest( data ); 354 365 <?php } ?> 355 356 366 <?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( $ ){ 363 373 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?' ) ) { 365 375 return false; 366 376 } else { … … 368 378 } 369 379 } 370 $( '#manualpush').on('click', function(e) {380 $( '#manualpush' ).on( 'click', function( e ) { 371 381 e.preventDefault(); 372 382 var subscribers = <?php echo $roost_stats['registrations']; ?>; 373 if ( 0 === subscribers ) {383 if ( 0 === subscribers ) { 374 384 var resub; 375 $.post( ajaxurl, { action: 'subs_check' }, function(response) {385 $.post( ajaxurl, { action: 'subs_check' }, function( response ) { 376 386 var response = $.parseJSON( response ); 377 387 resub = response; 378 if ( 0 === resub ) {388 if ( 0 === resub ) { 379 389 alert('You must have one visitor subscribed to your site to send notifications'); 380 390 return; 381 391 } else { 382 if ( true === confirmMessage() ) {383 $( '#manualpush').unbind('click').trigger('click');392 if ( true === confirmMessage() ) { 393 $( '#manualpush' ).unbind( 'click' ).trigger( 'click' ); 384 394 } 385 395 } 386 396 }); 387 397 } else { 388 if ( true === confirmMessage() ) {389 $( '#manualpush').unbind('click').trigger('click');398 if ( true === confirmMessage() ) { 399 $( '#manualpush' ).unbind( 'click' ).trigger( 'click' ); 390 400 } 391 401 } 392 402 }); 393 })( jQuery);403 })( jQuery ); 394 404 <?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' ); 401 410 signin.hide(); 402 403 $('.roost-signup').on('click', function() { 411 $( '.roost-signup' ).on( 'click', function() { 404 412 signup.toggle(); 405 413 signin.toggle(); 406 414 }); 407 415 } 408 })( jQuery);409 <?php } ?> 416 })( jQuery ); 417 <?php } ?> 410 418 </script> 411 419 </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 1 8 #rooster a, 2 9 #rooster a:link, … … 12 19 } 13 20 14 #rooster .roost-signup {15 cursor: pointer;16 }17 18 21 #adminmenu li.current .wp-menu-image img, 19 22 #adminmenu li.wp-not-current-submenu .wp-menu-image img { … … 21 24 } 22 25 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; 31 44 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; 40 46 cursor: pointer; 41 47 } … … 46 52 } 47 53 48 input.type-text{54 #rooster input[type="text"] { 49 55 width: 340px; 50 56 height: 36px; 51 57 padding: 0 10px; 52 font-family: 'Open Sans', sans-serif;53 58 } 54 59 … … 61 66 } 62 67 63 #roost-manual-send-wrapper .type-text{68 #roost-manual-send-wrapper input[type="text"] { 64 69 display:block; 65 70 width: 837px; … … 67 72 } 68 73 69 #roost-send-with-link,70 #roost-send-no-link {71 72 }73 74 #roost-send-no-link .roost-input-text {75 76 }77 78 74 #rooster select { 79 75 margin: 5px 0 0; 80 76 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;89 77 } 90 78 91 79 #roost-header { 92 80 display:inline-block; 81 width: 100%; 82 height: 36px; 93 83 position:relative; 94 height: 36px;95 width: 100%;96 84 margin-top: 7px; 97 85 padding: 16px 0 0 0; … … 99 87 100 88 #roost-header-right { 89 width: 550px; 101 90 float: right; 102 width: 550px;103 91 margin: 5px; 104 92 } 105 93 94 #roost-username, 95 #roost-log-out { 96 font-size: 15px; 97 color: #666666; 98 } 99 106 100 #roost-username { 107 color: #666666;108 font-size: 15px;109 margin-top: -4px;110 font-family: 'Open Sans', sans-serif;111 101 display: inline-block; 112 102 width: 425px; 113 103 float: right; 104 margin-top: -4px; 114 105 margin-right: 20px; 115 106 text-align: right; 116 107 } 117 108 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; 120 118 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;130 119 } 131 120 132 121 .roost-wrapper { 133 122 margin: 0 auto; 134 /*135 width: 1066px;136 */137 123 width: 1000px; 138 124 } … … 144 130 145 131 #roost-main-wrapper { 146 margin: -1px auto 0;147 /*148 width: 1066px;149 */150 132 width: 1000px; 151 133 min-height: 800px; 152 134 position: relative; 153 135 top: 5px; 136 margin: -1px auto 0; 154 137 } 155 138 156 139 #roost-signin-wrapper { 157 background: #fff;158 140 width: 366px; 159 141 margin: 100px auto; 142 background: #ffffff; 160 143 box-shadow: 0px 1px 3px rgba(0,0,0,0.2); 161 144 } … … 168 151 169 152 #roost-primary-logo img { 153 width: 72px; 170 154 height: 40px; 171 width: 72px;172 155 margin-top: 12px; 173 156 } 174 157 175 158 .roost-primary-heading { 176 background: #fafafa;177 159 height: 35px; 178 text-align: center;179 160 padding: 19px 30px; 180 161 border-bottom: 1px solid #d4d7d9; 162 background: #fafafa; 163 text-align: center; 181 164 } 182 165 183 166 .roost-primary-footer { 167 height: 35px; 168 padding: 14px 30px 20px; 184 169 background: #fff; 185 height: 35px;186 170 text-align: center; 187 padding: 14px 30px 20px;188 171 } 189 172 … … 191 174 display: inline-block; 192 175 width: 100%; 176 position: relative; 193 177 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"] { 198 182 width: 214px; 199 183 height: 26px; … … 202 186 } 203 187 188 #roost-signin-wrapper input[type="password"] { 189 padding-left: 10px; 190 } 191 204 192 #roost-signin-wrapper select { 205 193 width: 100%; 206 194 } 207 195 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; 210 200 font-size: 11px; 211 201 font-style: italic; 212 display: inline-block;213 width: 290px;214 margin: 5px 0 0 5px;215 202 } 216 203 … … 218 205 .roost-secondary-cta { 219 206 display: block; 207 font-size: 13px; 220 208 } 221 209 222 210 .roost-primary-cta { 223 font-size: 13px; 224 font-family: 'Open Sans', sans-serif; 211 margin-bottom: 10px; 225 212 font-weight: 600; 226 213 line-height: 10px; 227 214 color: #222222; 228 margin-bottom: 10px;229 215 } 230 216 231 217 .roost-secondary-cta { 232 font-size: 13px;233 color: #666666;234 font-family: 'Open Sans', sans-serif;235 218 font-weight: 400; 236 219 font-style: italic; 220 color: #666666; 237 221 } 238 222 239 223 .roost-section-wrapper { 224 margin: 25px 0; 225 border: 1px solid #e5e5e5; 240 226 background: #fafafa; 241 border: 1px solid #e5e5e5;242 margin: 25px 0;243 227 box-shadow: 0px 3px 5px rgba(0,0,0,0.2); 244 228 } 245 229 246 230 .roost-section-heading { 247 color: #222222;231 display: inline-block; 248 232 width: 100%; 249 display: inline-block;233 height: 17px; 250 234 position: relative; 251 height: 17px;252 235 padding: 15px 0 10px 5px; 236 background-color: #fafafa; 253 237 font-size: 14px; 254 238 letter-spacing: 0.1em; 255 239 text-indent: 13px; 256 background-color: #fafafa;240 color: #222222; 257 241 } 258 242 … … 267 251 } 268 252 269 .roost-section-secondary .type-submit { 253 .roost-section-secondary input[type="submit"] { 254 width: 130px !important; 270 255 float: right; 271 width: 130px;272 256 margin:2px 0 0 0; 273 257 } 274 258 275 259 #roost-all-stats { 260 margin: 32px 0 0; 276 261 padding: 0; 277 margin: 32px 0 0;278 262 } 279 263 … … 283 267 284 268 .roost-no-collapse { 269 display: inline-block; 270 width: 956px; 285 271 position: relative; 286 width: 956px;287 display: inline-block;288 272 } 289 273 290 274 #roost-registration-points { 291 275 list-style: none; 292 font-family: 'Open Sans', sans-serif;293 276 font-size: 13px; 294 277 } … … 306 289 307 290 .roost-step { 308 color: #fff; 309 background: #e25351; 310 display: inline-block; 311 padding: 10px 9px 8px 9px; 291 display: inline-block; 312 292 width: 18px; 313 293 height: 18px; 314 294 position: relative; 295 margin-right: 10px; 296 padding: 10px 9px 8px 9px; 297 background: #e25351; 315 298 border-radius: 20px; 316 299 text-indent: 5px; 317 margin-right: 10px;300 color: #fff; 318 301 } 319 302 … … 334 317 335 318 .roost-input-text { 319 display:inline-block; 336 320 width:100%; 321 height:71px; 337 322 position:relative; 338 display:inline-block;339 height:71px;340 323 } 341 324 342 325 .roost-input-text .roost-label, 343 #roost-block .roost-label { 326 .roost-block .roost-label { 327 display: block; 344 328 width: 110px; 329 float:left; 345 330 margin-right: 14px; 346 display: block; 347 float:left; 348 } 349 350 #roost-block .roost-label { 331 } 332 333 .roost-block .roost-label { 351 334 width: 175px; 352 335 margin-right: 25px; … … 355 338 } 356 339 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 357 399 .roost-input-caption { 400 display:block; 401 margin-top: 5px; 358 402 font-style:italic; 359 403 font-size:13px; 360 display:block;361 margin-top: 5px;362 404 text-indent: 5px; 363 405 } … … 376 418 } 377 419 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 386 420 .roost-setting-wrapper input { 421 position: relative; 387 422 float: left; 388 423 top: 5px; 389 424 margin-right: 10px; 390 position: relative;391 425 } 392 426 393 427 .roost-setting-caption { 428 display:block; 429 width: 725px; 430 float:left; 394 431 font-style:italic; 395 width: 725px; 396 display:block; 397 float:left; 432 } 433 434 #roost-settings-lift { 435 position: relative; 436 top: -5px; 398 437 } 399 438 … … 402 441 margin: 4px 0 1px 5px; 403 442 font-size: 13px; 404 font-family: 'Open Sans', sans-serif;405 443 font-weight: 600; 406 444 } 407 445 408 #roost-block { 409 display: inline-block; 410 width: 100%; 411 position:relative; 412 height: 258px; 413 padding: 15px 0 0; 446 input[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; 414 454 } 415 455 … … 419 459 420 460 #rooster-status { 461 width: 966px; 462 margin: 15px auto; 463 padding: 17px 20px; 464 border-left: 4px solid #7ad03a; 421 465 background: #fff; 422 width: 966px;466 font-size: 13px; 423 467 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;430 468 } 431 469 432 470 #rooster-status-text { 471 display: inline-block; 433 472 width: 910px; 434 display: inline-block;435 473 } 436 474 437 475 #rooster-status-close { 438 font-family: 'Open Sans', sans-serif; 439 color: rgb(46, 162, 204); 476 display: inline-block; 440 477 height: 16px; 441 478 position: relative; 442 display: inline-block; 479 float: right; 480 color: rgb(46, 162, 204); 443 481 cursor: pointer; 444 float: right;445 482 } 446 483 … … 452 489 .rooster-custom-script { 453 490 width: 220px; 491 height: 75px; 454 492 padding: 10px; 455 height: 75px;456 493 } 457 494 458 495 .roost-text-pinch { 496 display: inline-block; 459 497 width: 200px; 460 498 margin-top: 50px; 461 display: inline-block; 462 } 463 #roostUserLogo { 499 } 500 #roost-user-logo { 464 501 display: inline-block; 502 height: 24px; 503 position:relative; 465 504 top: 7px; 466 position:relative;505 margin-right: 15px; 467 506 border-radius: 3px; 468 height: 24px; 469 margin-right: 15px 470 } 471 472 #roostUserLogo img { 507 } 508 509 #roost-user-logo img { 473 510 border-radius: 3px; 474 511 cursor: pointer; … … 476 513 477 514 .roost-stats-metric { 478 background: #fafafa; 515 width: 328px; 516 height: 95px; 517 position: relative; 518 float: left; 519 top: -6px; 479 520 margin-right: 5px; 480 display: block;481 height: 95px;482 width: 328px;483 float: left;484 521 padding: 50px 0; 485 522 border: 1px solid #eeeeee; 486 position: relative; 487 top: -6px; 523 background: #fafafa; 488 524 } 489 525 … … 493 529 494 530 .roost-stats-metric hr { 531 width: 40px; 532 height: 2px; 533 position: relative; 495 534 margin: 0 auto; 496 height: 2px; 497 width: 40px; 535 border: 0; 498 536 background: #e8ebeb; 499 display: block;500 position: relative;501 537 top: 35px; 502 538 } 503 539 504 540 .roost-stat { 505 color: #666666;506 541 display:block; 542 font-size: 63px; 507 543 text-align:center; 508 544 font-weight: 300; 509 font-size: 63px;545 color: #666666; 510 546 } 511 547 … … 513 549 display:block; 514 550 width: 215px; 551 position: relative; 552 top: 27px; 553 margin: 25px auto 0; 554 font-size: 15px; 515 555 line-height: 18px; 516 font-size: 15px;517 margin: 25px auto 0;518 556 text-align:center; 519 557 color: #666666; 520 position: relative;521 top: 27px;522 558 } 523 559 … … 530 566 } 531 567 532 #roost ManualNote {568 #roost-manual-note { 533 569 padding: 0 179px 0 10px; 534 570 } 535 571 536 #roost ManualNoteCount {572 #roost-manual-note-count { 537 573 display: block; 538 574 position: absolute; 575 top: 5px; 539 576 right: 0; 540 top: 5px;541 577 font-weight: 700; 542 578 color: #CCCCCC; 543 579 } 544 580 545 #roost ManualNoteCountInt.roostWarning {581 #roost-manual-note-count-int.roostWarning { 546 582 color: #D54E21; 547 583 } 548 584 549 #roost SupportTag {585 #roost-support-tag { 550 586 text-align: center; 551 587 } 552 588 553 .updated#roost SetupNotice,589 .updated#roost-setup-notice, 554 590 .updated#roost-first-time-setup { 591 min-width: 800px; 555 592 height: 90px; 556 min-width: 800px; 593 position: relative; 594 margin: 15px 0 25px 0; 557 595 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); 561 604 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;571 605 } 572 606 … … 581 615 582 616 .updated#roost-first-time-setup h3 { 617 margin: 22px 0 -10px 0; 583 618 font-size: 15px; 584 619 font-weight: 600; 585 margin: 22px 0 -10px 0;586 620 } 587 621 … … 591 625 } 592 626 593 #roostNoticeLogo { 594 display: block; 595 float: left; 627 #roost-notice-logo { 596 628 width: 123px; 597 629 height: 100%; 630 float: left; 598 631 border-right: 1px solid #c45d5b; 599 632 } 600 633 601 #roost NoticeLogo img {634 #roost-notice-logo img { 602 635 width: 75px; 636 position: relative; 603 637 top: 26px; 604 638 left: 18px; 605 position: relative; 606 } 607 608 #roostNoticeText { 609 display: block; 610 float: left; 611 color: #fff; 639 } 640 641 #roost-notice-text { 612 642 width: 510px; 613 643 height: 100%; 614 644 position: relative; 645 float: left; 615 646 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; 620 653 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 { 627 657 width: auto; 628 658 padding-left: 35px; 629 } 630 631 #roostNoticeTarget { 659 border: 0; 660 } 661 662 #roost-notice-target { 632 663 width: 155px; 664 height: 100%; 665 float: left; 666 } 667 668 a#roost-notice-CTA, 669 a#roost-notice-CTA:link, 670 a#roost-notice-CTA:active { 633 671 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;644 672 width: 96px; 645 673 height: 22px; 646 background-color: #c24846; 674 position: relative; 675 top: 31px; 676 left: 25px; 647 677 border: 1px solid #963836; 648 678 border-radius: 2px; 649 position: relative; 650 top: 31px; 651 left: 25px; 679 background-color: #c24846; 652 680 box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); 681 text-align: center; 682 color: #ffffff; 683 text-decoration: none; 653 684 overflow: hidden; 685 outline: 0; 686 } 687 688 a#roost-notice-CTA:visited { 654 689 text-decoration: none; 655 outline: 0; 656 } 657 658 a#roostNoticeCTA:visited { 659 text-decoration: none; 660 color: #fff; 690 color: #ffffff; 661 691 outline: 0 662 692 } 663 693 664 #roost NoticeCTAHighlight {694 #roost-notice-CTA-highlight { 665 695 display: block; 696 width: 100px; 666 697 height: 1px; 698 position: relative; 667 699 margin-bottom: 2px; 668 width: 100px;669 position: relative;670 700 background-color: rgba(255, 255, 255, 0.2); 671 701 } 672 702 673 a#roost NoticeCTA:hover {703 a#roost-notice-CTA:hover { 674 704 box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); 675 705 } 676 706 677 #roost-first-time-setup #roost NoticeTarget {707 #roost-first-time-setup #roost-notice-target { 678 708 float: right; 679 709 } … … 684 714 margin: 100px auto 50px; 685 715 padding: 80px; 686 color: #fff;687 716 background: rgb(230,109,107); 688 717 background: -moz-linear-gradient(top, rgb(230,109,107) 0%, rgb(226,89,87) 100%); … … 692 721 background: -ms-linear-gradient(top, rgb(230,109,107) 0%,rgb(226,89,87) 100%); 693 722 background: linear-gradient(to bottom, rgb(230,109,107) 0%,rgb(226,89,87) 100%); 723 color: #ffffff; 694 724 } 695 725 696 726 #roost-signup-wrapper h2 { 697 color: #fff; 727 margin: 40px auto 23px; 728 color: #ffffff; 698 729 font-size: 35px; 699 730 font-weight: 300; 700 margin: 40px auto 23px;701 731 } 702 732 … … 708 738 #roost-bottom-right { 709 739 position: absolute; 740 right: 42px; 710 741 bottom: 11px; 711 color: #f2b1b1;712 742 font-size: 15px; 713 743 font-weight: 300; 714 right: 42px;744 color: #f2b1b1; 715 745 } 716 746 717 747 #roost-bottom-right .roost-signup { 718 color: #fff; 748 margin-left: 11px; 749 color: #ffffff; 719 750 font-weight: 600; 720 margin-left: 11px;721 751 } 722 752 723 753 #roost-signup-inner { 724 754 display: inline-block; 725 position: relative;726 755 width: 100%; 727 756 height: 100%; 757 position: relative; 728 758 } 729 759 730 760 #roost-create-account { 761 display: inline-block; 762 width: 163px; 763 height: 25px; 731 764 position: absolute; 732 765 bottom: 0; 733 766 left: 0; 734 display: inline-block; 767 padding: 10px 10px 5px; 768 border-radius: 5px; 735 769 background-color: #883736; 770 font-size: 14px; 771 font-weight: 600; 736 772 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; 742 774 text-decoration: none !important; 743 width: 163px;744 font-size: 14px;745 775 text-indent: 13px; 746 776 } … … 758 788 759 789 #roost-api-error { 790 position: relative; 791 top: 75px; 760 792 padding: 12px 10px; 761 position: relative;762 top: 75px;763 793 } 764 794 765 795 #roost-sso { 796 height: 58px; 766 797 background: #f7f7f7; 767 height: 58px;768 798 } 769 799 … … 779 809 780 810 #roost-sso a { 811 display: block; 812 width: 58px; 781 813 height: 58px; 782 width: 58px;783 display: block;784 }785 786 .roost-sso-option {787 814 } 788 815 … … 797 824 .roost-sso-option .roost-plugin-image { 798 825 display: block; 826 position: relative; 827 top: 19px; 799 828 margin: 0 auto; 800 829 text-indent: -999em; 801 position: relative;802 top: 19px;803 830 } 804 831 805 832 #roost-sso-facebook { 806 background-position: -32px -86px;807 833 width: 9px; 808 834 height: 20px; 809 835 top: 18px; 836 background-position: -32px -86px; 810 837 } 811 838 … … 815 842 816 843 #roost-sso-twitter { 817 background-position: 0px -88px;818 844 width: 23px; 819 845 height: 18px; 846 background-position: 0px -88px; 820 847 } 821 848 … … 825 852 826 853 #roost-sso-google { 827 background-position: -49px -86px;828 854 width: 24px; 829 855 height: 20px; 856 background-position: -49px -86px; 830 857 } 831 858 … … 835 862 836 863 #roost-tabs { 837 display: block;838 864 height: 50px; 839 865 } 840 866 841 867 #roost-tabs li { 842 color: #666666;843 868 display: inline-block; 844 list-style: none; 869 height: 27px; 870 position: relative; 871 z-index: 10; 845 872 float: left; 846 cursor: pointer; 847 height: 27px; 873 margin: 15px 10px 10px 0; 848 874 padding: 8px 15px 0 15px; 849 font-size: 15px;850 background-color: #e4e4e4;851 text-align: center;852 margin: 15px 10px 10px 0;853 875 border: 1px solid #cccccc; 854 876 border-bottom: 0; 877 background-color: #e4e4e4; 878 list-style: none; 879 font-size: 15px; 880 text-align: center; 855 881 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 { 856 893 position: relative; 857 894 z-index: 10; 858 895 } 859 896 860 #roost-tabs li.active { 897 #roost-pre-wrap.roost-white { 898 border-top: 1px solid #cccccc; 861 899 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;874 900 } 875 901 876 902 #roost-site-name { 903 display: inline-block; 904 position: absolute; 905 margin-left: 24px; 906 padding: 10px 24px; 877 907 border-left: 1px solid #d3d6d7; 878 display: inline-block; 879 padding: 10px 24px; 880 margin-left: 24px; 908 font-size: 15px; 881 909 text-align: center; 882 position: absolute;883 font-family: 'Open Sans', sans-serif;884 font-size: 15px;885 910 } 886 911 887 912 #roost-chart-heading { 888 913 height: 45px; 914 padding: 25px 0; 889 915 background: #f1f1f1; 890 padding: 25px 0;891 916 text-indent: 29px; 892 917 } 893 918 894 #roostchart _dynamic {919 #roostchart-dynamic { 895 920 height: 250px; 896 921 } … … 898 923 #roost-time-period { 899 924 position: absolute; 900 display: block;925 top: 30px; 901 926 right: 30px; 902 top: 30px;903 927 } 904 928 905 929 .chart-range-toggle { 930 margin-right: -6px; 931 padding: 5px 10px; 932 border: 1px solid #cccccc; 906 933 background: #f7f7f7; 934 font-size: 13px; 907 935 color: #666666; 908 font-size: 13px; 909 border: 1px solid #cccccc; 936 text-align: center; 910 937 cursor: pointer; 911 text-align: center;912 padding: 5px 10px;913 margin-right: -6px;914 938 } 915 939 … … 919 943 920 944 .chart-range-toggle:first-of-type { 945 border-right: 0; 921 946 border-radius: 3px 0 0 3px; 922 border-right: 0;923 947 } 924 948 925 949 .chart-range-toggle:last-of-type { 950 margin-right: 0; 951 border-left: 0; 926 952 border-radius: 0 3px 3px 0; 927 border-left: 0;928 margin-right: 0;929 953 } 930 954 931 955 #roost-metric-options { 932 display: block;933 956 height: 27px; 934 957 position: absolute; 958 bottom: 14px; 935 959 left: 30px; 936 bottom: 14px;937 960 } 938 961 939 962 .chart-metric-toggle { 963 height: 22px; 964 position: relative; 965 z-index: 10; 940 966 float: left; 967 margin-right: 10px; 968 padding: 5px 10px 0; 969 border-bottom: 0; 970 border: 1px solid #cccccc; 971 background-color: #e4e4e4; 941 972 font-size: 13px; 942 973 color: #666666; 943 cursor: pointer;944 height: 22px;945 padding: 5px 10px 0;946 background-color: #e4e4e4;947 974 text-align: center; 948 border: 1px solid #cccccc;949 border-bottom: 0;950 position: relative;951 z-index: 10;952 975 text-indent: 0; 953 976 letter-spacing: 0; 954 margin-right: 10px;977 cursor: pointer; 955 978 } 956 979 … … 960 983 961 984 .chart-metric-toggle.active { 985 position: relative; 986 z-index: 50; 987 border-bottom: none; 962 988 background-color: #fafafa; 963 position: relative;964 z-index: 50;965 989 } 966 990 967 991 #roost-curtain { 992 display: inline-block; 993 width: 100%; 968 994 height: 100%; 969 display: inline-block;970 995 position: absolute; 971 background: #fafafa;972 width: 100%;973 996 top: 0; 974 997 left: 0; 998 background: #fafafa; 975 999 } 976 1000 977 1001 #roost-curtain-notice { 1002 width: 375px; 1003 height: 5px; 1004 position: relative; 1005 top: 100px; 978 1006 margin: 0 auto; 979 p osition: relative;980 top: 100px;1007 padding: 10px 0 25px; 1008 border-radius: 15px; 981 1009 background: #e4e4e4; 982 1010 color: #666666; 983 border-radius: 15px;984 padding: 10px 0 25px;985 height: 5px;986 1011 text-align: center; 987 width: 375px;988 1012 opacity: 0.8; 989 1013 } … … 991 1015 #roost-recent-activity { 992 1016 height: 275px; 1017 position: relative; 1018 z-index: 25; 993 1019 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 3 3 }; 4 4 (function() { 5 var wf = document.createElement( 'script');5 var wf = document.createElement( 'script' ); 6 6 wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + 7 7 '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'; 8 8 wf.type = 'text/javascript'; 9 9 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 ); 12 12 })(); -
roost-for-bloggers/trunk/layout/js/roostbbp.js
r925987 r962489 1 window._roostCallback = function( data){2 if (data.registered){3 if (data.enabled){1 window._roostCallback = function( data ) { 2 if ( data.registered ) { 3 if ( data.enabled ) { 4 4 roostToken = data.deviceToken; 5 5 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' ); 3 3 $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 ) { 11 10 $roostAdmin.hide(); 12 $( '#roost-activity').show();13 } else if ( index === 1) {11 $( '#roost-activity' ).show(); 12 } else if ( 1 === index ) { 14 13 $roostAdmin.hide(); 15 $( '#roost-manual-push').show();14 $( '#roost-manual-push' ).show(); 16 15 } else { 17 $roostAdmin.hide(); 18 $( '#roost-settings').show();16 $roostAdmin.hide(); 17 $( '#roost-settings' ).show(); 19 18 } 20 19 }); 21 22 var roostInput = $('#roostManualNote'); 23 var roostCount = $('#roostManualNoteCountInt'); 20 var roostInput = $( '#roost-manual-note' ); 21 var roostCount = $( '#roost-manual-note-count-int' ); 24 22 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; 28 25 if ( n > ( roostLimit - 11 ) ){ 29 if( !roostCount.hasClass('roostWarning')){30 roostCount.addClass( 'roostWarning');26 if( ! roostCount.hasClass( 'roostWarning' ) ) { 27 roostCount.addClass( 'roostWarning' ); 31 28 } 32 29 } else if ( n < roostLimit - 10 ) { 33 if( roostCount.hasClass('roostWarning')){34 roostCount.removeClass( 'roostWarning');30 if( roostCount.hasClass( 'roostWarning' ) ) { 31 roostCount.removeClass( 'roostWarning' ); 35 32 } 36 33 } 37 34 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 3 3 Tags: 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 4 4 Requires at least: 3.8 5 Tested up to: 3.9.16 Stable tag: 2.1. 45 Tested up to: 4.0 6 Stable tag: 2.1.5 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 17 17 18 18 * **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. 19 21 * **bbPress Subscriptions** - Allows site visitors to subscribe to forums, topics, or individual messages when posting replies. 20 22 * **Detailed Analytics** - *Charts* with detailed metrics about your visitors straight to your WordPress dashboard. … … 25 27 **Free** Roost account included. No setup fees, no surprises, and no limitations on your site visitors. 26 28 27 [ vimeo http://vimeo.com/99195697]29 [youtube http://www.youtube.com/watch?v=DxElgkUsrCA] 28 30 29 31 == Installation == … … 46 48 To 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. 47 49 50 **Notification Prompt Control** 51 Control 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** 54 Use 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 48 56 **bbPress** 49 57 With 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. … … 76 84 77 85 = Do I need and Apple Developer Account or Google Play Developer account? = 78 N ope. We've got you covered.86 Nah. We've got you covered. 79 87 80 88 = Do you support Google Chrome or Firefox for desktop push? = … … 82 90 83 91 = 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.92 Nope. Just you. 85 93 86 94 87 95 == Screenshots == 88 96 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. 97 1. One-Click to subscribe for visitors to your site. Easy peasy! 98 2. Notifications will be delivered in the top-right corner of your subscribers screen. 99 3. Create your Roost Account. (It's Free!) 100 4. Or log in to your existing Roost account. 101 5. Roost plugin from the WordPress dashboard showing analytics. 102 6. Powerful control on how your visitors can subscribe and how your notifications are sent. 92 103 93 104 == 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 94 113 = 2.1.4 = 95 114 * Bugfix - Fixed bug that prevented stats from displaying when WordPress admin accessed via HTTPS … … 174 193 175 194 == 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 176 198 = 2.1.4 = 177 199 * Bugfix - Fixed bug that prevented stats from displaying when WordPress admin accessed via HTTPS -
roost-for-bloggers/trunk/roost.php
r943608 r962489 4 4 * Plugin URI: http://goroost.com/ 5 5 * Description: Drive traffic to your website with Safari Mavericks push notifications and Roost. 6 * Version: 2.1. 46 * Version: 2.1.5 7 7 * Author: Roost 8 8 * Author URI: http://goroost.com … … 16 16 require_once( plugin_dir_path( __FILE__ ) . 'includes/class-roost-bbpress.php' ); 17 17 18 $roost = new Roost(); 18 Roost::init(); 19 19 20 $bbPress_active = Roost_bbPress::bbPress_active(); 20 21 if( !empty( $bbPress_active['present'] ) && !empty( $bbPress_active['enabled'] ) ) { 22 $roost_bbp = new Roost_bbPress(); 21 if ( ! empty( $bbPress_active['present'] ) && ! empty( $bbPress_active['enabled'] ) ) { 22 Roost_bbPress::init(); 23 23 } 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.