text:
![FBNotifications logo](.github/FBNotifications-Logo.png?raw=true)

![Platforms][platforms-svg]
[![Build Status][build-status-svg]][build-status-link]

Facebook In-App Notifications enables you to create rich and customizable in-app notifications and deliver them via push notifications, based on the actions people take in your app. You can use text, photos, animated GIFs, buttons or extend the open format to suit your needs.

## Getting Started on iOS

[![Podspec][podspec-svg]][podspec-link]
[![Carthage compatible][carthage-svg]](carthage-link)

To get started on iOS, install the framework using one of these options:

- **[CocoaPods](https://cocoapods.org)**

 Add the following line to your Podfile:
 ```ruby
 pod 'FBNotifications'
 ```
 Run `pod install`, and you should now have the latest framework installed.

- **[Carthage](https://github.com/carthage/carthage)**

 Add the following line to your Cartfile:
 ```
 github "facebook/FBNotifications"
 ```
 Run `carthage update`, and you should now have the latest version of the framework in your Carthage folder.

After you've installed the framework, you would need to add the following to your application delegate to present the notification:

Using *Objective-C*:

```objc
/// Present In-App Notification from remote notification (if present).
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler {
  FBNotificationsManager *notificationsManager = [FBNotificationsManager sharedManager];
  [notificationsManager presentPushCardForRemoteNotificationPayload:userInfo
                                                 fromViewController:nil
                                                         completion:^(FBNCardViewController * _Nullable viewController, NSError * _Nullable error) {
                                                           if (error) {
                                                             completionHandler(UIBackgroundFetchResultFailed);
                                                           } else {
                                                             completionHandler(UIBackgroundFetchResultNewData);
                                                           }
                                                         }];
}
```

Using *Swift*:
```swift
/// Present In-App Notification from remote notification (if present).
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
  FBNotificationsManager.sharedManager().presentPushCardForRemoteNotificationPayload(userInfo, fromViewController: nil) { viewController, error in
    if let _ error = error {
      completionHandler(.Failed)
    } else {
      completionHandler(.NewData)
    }
  }
}
```

## Getting Started on Android

[![Maven Central][maven-svg]][maven-link]

To get started on Android, add the following to your gradle dependencies:

```gradle
compile 'com.facebook.android:notifications:1.+'
```

After you've added the dependency, you'll have to [set up a GCM listener service](https://developers.google.com/cloud-messaging/android/client), and add the following to your service:

```java
@Override
public void onMessageReceived(String from, final Bundle data) {
    NotificationsManager.presentNotification(
        this,
        data,
        new Intent(getApplicationContext(), MainActivity.class)
    );
}
```

Then when all the content for the notification is ready - it will automatically present the notification to the end user with a pending intent to present a card on open.
To hand-off the necessary data from the intent - you need to handle the notification in the `onCreate` function of your Main Activity:

```java
public class MainActivity extends AppCompatActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    NotificationsManager.presentCardFromNotification(this);
  }
}
```

For more help on getting started, take a look at our [Facebook Analytics Push Documentation](https://developers.facebook.com/docs/analytics/push-campaigns/android).

## In-App Notifications Format

In-app notifications are powered by a custom format that has an open specification available in this repository.
The format describes all the possible values and combinations of content that can be rendered by the framework.

We are open to accepting contributions to the format and the format is constantly evolving.
Any version of the framework is compatible with any previous version of the format in the same major version scope.

For example:
  - Framework `1.0.0` **is** compatible with format version `1.0`
  - Framework `1.0.0` **is not** compatible with format version `1.5`
  - Framework `1.5.0` **is** compatible with format version `1.5`
  - Framework `1.5.1` **is** compatible with format version `1.5`
  - Framework `2.0.0` **is not** compatible with format version `1.0`, or `1.5`

## Contributing

We want to make contributing to this project as easy and transparent as possible. Please refer to the [Contribution Guidelines](https://github.com/facebook/FBNotifications/blob/master/CONTRIBUTING.md).

## License

See the `LICENSE` file for source code.
See the `LICENSE-specification` file for In-App Notifications format specification.

 [platforms-svg]: https://img.shields.io/badge/platform-iOS%20%7C%20Android-lightgrey.svg

 [build-status-svg]: https://img.shields.io/travis/facebook/FBNotifications/master.svg
 [build-status-link]: https://travis-ci.org/facebook/FBNotifications/branches

 [podspec-svg]: https://img.shields.io/cocoapods/v/FBNotifications.svg
 [podspec-link]: https://cocoapods.org/pods/FBNotifications

 [carthage-svg]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat
 [carthage-link]: https://github.com/carthage/carthage

 [maven-svg]: https://maven-badges.herokuapp.com/maven-central/com.facebook.android/notifications/badge.svg?style=flat
 [maven-link]: https://maven-badges.herokuapp.com/maven-central/com.facebook.android/notifications


text:
<?php
    /**
    * @package Lightbox Plus Colorbox
    * @subpackage lightbox.inline.php
    * @internal 2013.01.16
    * @author Dan Zappone / 23Systems
    * @version 2.7
    * @$Id: lightbox.inline.php 937945 2014-06-24 17:11:13Z dzappone $
    * @$URL: http://plugins.svn.wordpress.org/lightbox-plus/tags/2.7/admin/lightbox.inline.php $
    */
?>

<?php _e( 'Lightbox Plus Colorbox - Inline Lightbox Settings','lightboxplus' ); ?>

<?php _e( 'General','lightboxplus' ); ?>

<?php _e( 'Usage','lightboxplus' ); ?>

<?php _e( 'Demo/Test','lightboxplus' ); ?>

                    <input type="hidden" name="ready_inline" value="1" />

                                <?php _e( 'Link Class','lightboxplus' ); ?>
<?php _e( 'Content ID','lightboxplus' ); ?>
                                <?php _e( 'Transition','lightboxplus' ); ?>
<?php _e( 'Speed','lightboxplus' ); ?>
                                <?php _e( 'Width','lightboxplus' ); ?>
<?php _e( 'Height','lightboxplus' ); ?>
                                <?php _e( 'Inner Width','lightboxplus' ); ?>
<?php _e( 'Inner Height','lightboxplus' ); ?>
                                <?php _e( 'Max Width','lightboxplus' ); ?>
<?php _e( 'Max Height','lightboxplus' ); ?>
                                <?php _e( 'Position','lightboxplus' ); ?>

<?php _e( 'Top','lightboxplus' ); ?>
<?php _e( 'Right, Bottom','lightboxplus' ); ?>
<?php _e( 'Left','lightboxplus' ); ?>

                                <?php _e( 'Fixed','lightboxplus' ); ?>
                                <?php _e( 'Auto Open','lightboxplus' ); ?>
                                <?php _e( 'Overlay Opacity','lightboxplus' ); ?>

                            <?php
                                for ($i = 1; $i <= $lightboxPlusOptions['inline_num']; $i++) {
                                    $inline_links            = array();
                                    $inline_hrefs            = array();
                                    $inline_transitions      = array();
                                    $inline_speeds           = array();
                                    $inline_widths           = array();
                                    $inline_heights          = array();
                                    $inline_inner_widths     = array();
                                    $inline_inner_heights    = array();
                                    $inline_max_widths       = array();
                                    $inline_max_heights      = array();
                                    $inline_position_tops    = array();
                                    $inline_position_rights  = array();
                                    $inline_position_bottoms = array();
                                    $inline_position_lefts   = array();
                                    $inline_fixeds           = array();
                                    $inline_opens            = array();
                                    $inline_opacitys         = array();
                                    $inline_links            = $lightboxPlusOptions['inline_links'];
                                    $inline_hrefs            = $lightboxPlusOptions['inline_hrefs'];
                                    $inline_transitions      = $lightboxPlusOptions['inline_transitions'];
                                    $inline_speeds           = $lightboxPlusOptions['inline_speeds'];
                                    $inline_widths           = $lightboxPlusOptions['inline_widths'];
                                    $inline_heights          = $lightboxPlusOptions['inline_heights'];
                                    $inline_inner_widths     = $lightboxPlusOptions['inline_inner_widths'];
                                    $inline_inner_heights    = $lightboxPlusOptions['inline_inner_heights'];
                                    $inline_max_widths       = $lightboxPlusOptions['inline_max_widths'];
                                    $inline_max_heights      = $lightboxPlusOptions['inline_max_heights'];
                                    $inline_position_tops    = $lightboxPlusOptions['inline_position_tops'];
                                    $inline_position_rights  = $lightboxPlusOptions['inline_position_rights'];
                                    $inline_position_bottoms = $lightboxPlusOptions['inline_position_bottoms'];
                                    $inline_position_lefts   = $lightboxPlusOptions['inline_position_lefts'];
                                    $inline_fixeds           = $lightboxPlusOptions['inline_fixeds'];
                                    $inline_opens            = $lightboxPlusOptions['inline_opens'];
                                    $inline_opacitys         = $lightboxPlusOptions['inline_opacitys'];
                                ?>
                                <tr <?php if ($i % 2 == 0) {echo 'class="alternate"';} ?>>
                                    <?php _e( 'Inline Lightbox #'.$i, 'lightboxplus' )?>:

                                        <input type="text" size="15" name="inline_link_<?php echo $i; ?>" id="inline_link_<?php echo $i; ?>" value="<?php if (empty( $inline_links[$i - 1] )) { echo 'lbp-inline-link-'.$i; } else {echo $inline_links[$i - 1];}?>" />
<input type="text" size="15" name="inline_href_<?php echo $i; ?>" id="inline_href_<?php echo $i; ?>" value="<?php if (empty( $inline_hrefs[$i - 1] )) { echo 'lbp-inline-href-'.$i; } else {echo $inline_hrefs[$i - 1];}?>" />

                                        <select name="inline_transition_<?php echo $i; ?>" id="inline_transition_<?php echo $i; ?>">
                                            <option value="elastic"<?php if ( $inline_transitions[$i - 1] == 'elastic' ) echo ' selected="selected"'?>>Elastic</option>
                                            <option value="fade"<?php if ( $inline_transitions[$i - 1] == 'fade' ) echo ' selected="selected"'?>>Fade</option>
                                            <option value="none"<?php if ( $inline_transitions[$i - 1] == 'none' ) echo ' selected="selected"'?>>None</option>
                                        </select>

                                        <select name="inline_speed_<?php echo $i; ?>" id="inline_speed_<?php echo $i; ?>">
                                            <?php
                                                for($j = 0;$j <= 5001;){ ?>
                                                <option value="<?php echo $j; ?>"<?php if ( $inline_speeds[$i - 1] == strval($j) ) echo ' selected="selected"'?>><?php echo $j; ?></option>
                                                <?php
                                                    if ($j >= 2000) { $j = $j + 500; }
                                                    elseif ($j >= 1250) { $j = $j + 250; }
                                                    else { $j = $j + 50; }
                                                }
                                            ?>
                                        </select>

                                        <input type="text" size="5" name="inline_width_<?php echo $i; ?>" id="inline_width_<?php echo $i; ?>" value="<?php if (empty( $inline_widths[$i - 1] )) { echo '80%'; } else {echo $inline_widths[$i - 1];}?>" />

                                        <input type="text" size="5" name="inline_height_<?php echo $i; ?>" id="inline_height_<?php echo $i; ?>" value="<?php if (empty( $inline_heights[$i - 1] )) { echo '80%'; } else  {echo $inline_heights[$i - 1];}?>" />

                                        <input type="text" size="5" name="inline_inner_width_<?php echo $i; ?>" id="inline_inner_width_<?php echo $i; ?>" value="<?php if (empty( $inline_inner_widths[$i - 1] )) { echo 'false'; } else {echo $inline_inner_widths[$i - 1];}?>" />

                                        <input type="text" size="5" name="inline_inner_height_<?php echo $i; ?>" id="inline_inner_height_<?php echo $i; ?>" value="<?php if (empty( $inline_inner_heights[$i - 1] )) { echo 'false'; } else {echo $inline_inner_heights[$i - 1];}?>" />

                                        <input type="text" size="5" name="inline_max_width_<?php echo $i; ?>" id="inline_max_width_<?php echo $i; ?>" value="<?php if (empty( $inline_max_widths[$i - 1] )) { echo '80%'; } else {echo $inline_max_widths[$i - 1];}?>" />

                                        <input type="text" size="5" name="inline_max_height_<?php echo $i; ?>" id="inline_max_height_<?php echo $i; ?>" value="<?php if (empty( $inline_max_heights[$i - 1] )) { echo '80%'; } else  {echo $inline_max_heights[$i - 1];}?>" />

                                        <input type="text" size="5" name="inline_position_top_<?php echo $i; ?>" id="inline_position_top_<?php echo $i; ?>" value="<?php if (empty( $inline_position_tops[$i - 1] )) { echo ''; } else {echo $inline_position_tops[$i - 1];}?>" />

                                        <input type="text" size="5" name="inline_position_right_<?php echo $i; ?>" id="inline_position_right_<?php echo $i; ?>" value="<?php if (empty( $inline_position_rights[$i - 1] )) { echo ''; } else {echo $inline_position_rights[$i - 1];}?>" /><input type="text" size="5" name="inline_position_bottom_<?php echo $i; ?>" id="inline_position_bottom_<?php echo $i; ?>" value="<?php if (empty( $inline_position_bottoms[$i - 1] )) { echo ''; } else {echo $inline_position_bottoms[$i - 1];}?>" />

                                        <input type="text" size="5" name="inline_position_left_<?php echo $i; ?>" id="inline_position_left_<?php echo $i; ?>" value="<?php if (empty( $inline_position_lefts[$i - 1] )) { echo ''; } else {echo $inline_position_lefts[$i - 1];}?>" />

                                    <?php
                                        /**
                                        * @todo fix inline fixed and open saving
                                        */
                                    ?>

                                        <input type="hidden" name="inline_fixed_<?php echo $i; ?>" value="0" />
                                        <input type="checkbox" name="inline_fixed_<?php echo $i; ?>" id="inline_fixed_<?php echo $i; ?>" value="1"<?php if ( ($inline_fixeds[$i - 1] )) { echo ' checked="checked"'; }?> />

                                    <input type="hidden" name="inline_open_<?php echo $i; ?>" value="0" />
                                        <input type="checkbox" name="inline_open_<?php echo $i; ?>" id="inline_open_<?php echo $i; ?>" value="1"<?php if ( ($inline_opens[$i - 1] )) { echo ' checked="checked"'; }?> />

                                        <select name="inline_opacity_<?php echo $i; ?>" id="inline_opacity_<?php echo $i; ?>">
                                            <?php
                                                for($j = 0; $j <= 1.01; $j = $j + .05){ ?>
                                                <option value="<?php echo $j; ?>"<?php if ( $inline_opacitys[$i - 1] == strval($j) ) { echo ' selected="selected"'; }?>><?php echo ($j*100); ?>%</option>
                                                <?php
                                                }
                                            ?>
                                        </select>

                                <?php
                                }
                            ?>

<?php _e('Using Inline Lightboxes', 'lightboxplus')?>

<?php _e( 'Inline lightboxes are used to display content that exists on the current page.  It can be used to display a form, video or any other content that is contained on the page.  In order to display inline content using Lightbox Plus Colorbox and Colorbox you must at a minimum has the following items set: Link Class, Content ID, Width, Height, and Opacity.', 'lightboxplus')?>

<?php _e('Example', 'lightboxplus')?>

<?php _e( 'The following example shows how to setup content for display in a lightbox.  You will need to create a link to the content that contains a class that has the same value as the Link Class for the inline lightbox you are using.', 'lightboxplus')?>

                                        <a class="lbp-inline-link-1" href="#"><?php _e( 'Inline HTML Link Name', 'lightboxplus') ?></a>

<?php _e( 'You will also need to set up a div element to contain you content.  The div element that contains the content must contains have and id with a value of the Content ID for the inline light box you are using.  Finally if you want the content to be hidden until the visitor clicks the link, wrap the content div with another div and set the value for style to display:none or assign a class that has display:none for a property', 'lightboxplus')?>

                                            <div style="display:none">

                                                <div id="lbp-inline-href-1" style="padding: 10px;background: #fff">

                                                    <?php _e( 'Inline Content Goes Here', 'lightboxplus') ?>

                                                </div>

                                            </div>

                                <?php _e('Here you can test you settings with various different implementation of Lightbox Plus Colorbox using inline content.  This demo makes use of the first inline lightbox you have set up.  If they do not work try reloading the page and please check that you have the following items set: Link Class, Content ID, Width, Height, and Opacity.  You will not be able to display this example without the minimum options set.',"lightboxplus"); ?>

                                    <a class="<?php echo $inline_links[0]; ?>" href="#"><?php _e('Inline Content Test including form',"lightboxplus"); ?>

                                    Skeleton code

                                        <div style="display:none">

                                            <div id="<?php echo $inline_hrefs[0]; ?>" style="padding: 10px;background: #fff">

                                                <h3><?php _e( 'TITLE HERE','lightboxplus' ); ?></h3>

                                            <div>

                                                <?php _e( 'FORM HERE','lightboxplus' ); ?>

                                            </div>

                                            <p style="text-align: justify;">

                                                <?php _e( 'TEXT HERE','lightboxplus' ); ?>

                                            </p>

                                        </div>

                <input type="submit" style="padding:5px 30px 5px 30px;" name="Submit" title="<?php _e( 'Save all Lightbox Plus Colorbox settings', 'lightboxplus' )?>" value="<?php _e( 'Save all settings', 'lightboxplus' )?> »" />

redpajama_set_name: RedPajamaGithub